Merge mozilla-central to mozilla-inbound. a=merge on a CLOSED TREE

This commit is contained in:
Andreea Pavel 2018-08-14 19:19:03 +03:00
commit fba9b7255c
61 changed files with 707 additions and 184 deletions

View File

@ -1,2 +1,2 @@
For a full list of the people who are credited with making a
contribution to Mozilla, see http://www.mozilla.org/credits/ .
contribution to Mozilla, see https://www.mozilla.org/credits/ .

View File

@ -266,4 +266,8 @@ Selection.prototype = {
isSlotted: function() {
return this._isSlotted;
},
isShadowRootNode: function() {
return this.isNode() && this.nodeFront.isShadowRoot;
},
};

View File

@ -21,6 +21,8 @@ const KeyShortcuts = require("devtools/client/shared/key-shortcuts");
// Some margin may be required for visible element detection.
const SCROLL_MARGIN = 1;
const SHADOW_ROOT_TAGNAME = "#shadow-root";
/**
* Component to replicate functionality of XUL arrowscrollbox
* for breadcrumbs
@ -417,7 +419,7 @@ HTMLBreadcrumbs.prototype = {
* @return {String}
*/
prettyPrintNodeAsText: function(node) {
let text = node.displayName;
let text = node.isShadowRoot ? SHADOW_ROOT_TAGNAME : node.displayName;
if (node.isPseudoElement) {
text = node.isBeforePseudoElement ? "::before" : "::after";
}
@ -461,7 +463,7 @@ HTMLBreadcrumbs.prototype = {
const pseudosLabel = this.doc.createElementNS(NS_XHTML, "span");
pseudosLabel.className = "breadcrumbs-widget-item-pseudo-classes plain";
let tagText = node.displayName;
let tagText = node.isShadowRoot ? SHADOW_ROOT_TAGNAME : node.displayName;
if (node.isPseudoElement) {
tagText = node.isBeforePseudoElement ? "::before" : "::after";
}
@ -729,7 +731,7 @@ HTMLBreadcrumbs.prototype = {
stopNode = this.nodeHierarchy[originalLength - 1].node;
}
while (node && node != stopNode) {
if (node.tagName) {
if (node.tagName || node.isShadowRoot) {
const button = this.buildButton(node);
fragment.insertBefore(button, lastButtonInserted);
lastButtonInserted = button;
@ -880,7 +882,7 @@ HTMLBreadcrumbs.prototype = {
}
}
if (!this.selection.isElementNode()) {
if (!this.selection.isElementNode() && !this.selection.isShadowRootNode()) {
// no selection
this.setCursor(-1);
if (trimmed) {

View File

@ -48,7 +48,7 @@ add_task(async function() {
await onBreadcrumbsUpdated;
checkBreadcrumbsContent(breadcrumbs,
["html", "body", "test-component", "slot.slot-class"]);
["html", "body", "test-component", "#shadow-root", "slot.slot-class"]);
info("Expand the slot");
await expandContainer(inspector, slotContainer);

View File

@ -12,6 +12,9 @@ const { configureStore } = require("./create-store");
const { EVENTS } = require("./constants");
const Actions = require("./actions/index");
// Telemetry
const Telemetry = require("devtools/client/shared/telemetry");
const {
getDisplayedRequestById,
getSortedRequests
@ -30,8 +33,11 @@ function NetMonitorAPI() {
// Connector to the backend.
this.connector = new Connector();
// Telemetry
this.telemetry = new Telemetry();
// Configure store/state object.
this.store = configureStore(this.connector);
this.store = configureStore(this.connector, this.telemetry);
// List of listeners for `devtools.network.onRequestFinished` WebExt API
this._requestFinishedListeners = new Set();

View File

@ -13,6 +13,7 @@ const prefs = require("./middleware/prefs");
const thunk = require("./middleware/thunk");
const recording = require("./middleware/recording");
const throttling = require("./middleware/throttling");
const eventTelemetry = require("./middleware/event-telemetry");
// Reducers
const rootReducer = require("./reducers/index");
@ -25,7 +26,7 @@ const { UI, Columns } = require("./reducers/ui");
/**
* Configure state and middleware for the Network monitor tool.
*/
function configureStore(connector) {
function configureStore(connector, telemetry) {
// Prepare initial state.
const initialState = {
filters: new Filters({
@ -46,6 +47,7 @@ function configureStore(connector) {
batching,
recording(connector),
throttling(connector),
eventTelemetry(connector, telemetry),
);
return createStore(rootReducer, initialState, middleware);

View File

@ -0,0 +1,86 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const { gDevTools } = require("devtools/client/framework/devtools");
const {
TOGGLE_REQUEST_FILTER_TYPE,
ENABLE_REQUEST_FILTER_TYPE_ONLY,
SET_REQUEST_FILTER_TEXT,
} = require("../constants");
/**
* Event telemetry middleware is responsible for logging
* specific filter events to telemetry. This telemetry
* helps to track Net panel filtering usage.
*/
function eventTelemetryMiddleware(connector, telemetry) {
return store => next => action => {
const oldState = store.getState();
const res = next(action);
const toolbox = gDevTools.getToolbox(connector.getTabTarget());
if (!toolbox) {
return res;
}
const state = store.getState();
const filterChangeActions = [
TOGGLE_REQUEST_FILTER_TYPE,
ENABLE_REQUEST_FILTER_TYPE_ONLY,
SET_REQUEST_FILTER_TEXT,
];
if (filterChangeActions.includes(action.type)) {
filterChange({
action,
state,
oldState,
telemetry,
sessionId: toolbox.sessionId,
});
}
return res;
};
}
function filterChange({action, state, oldState, telemetry, sessionId}) {
const oldFilterState = oldState.filters;
const filterState = state.filters;
const activeFilters = [];
const inactiveFilters = [];
for (const [key, value] of Object.entries(filterState.requestFilterTypes)) {
if (value) {
activeFilters.push(key);
} else {
inactiveFilters.push(key);
}
}
let trigger;
if (action.type === TOGGLE_REQUEST_FILTER_TYPE ||
action.type === ENABLE_REQUEST_FILTER_TYPE_ONLY) {
trigger = action.filter;
} else if (action.type === SET_REQUEST_FILTER_TEXT) {
if (oldFilterState.requestFilterText !== "" &&
filterState.requestFilterText !== "") {
return;
}
trigger = "text";
}
telemetry.recordEvent("devtools.main", "filters_changed", "netmonitor", null, {
"trigger": trigger,
"active": activeFilters.join(","),
"inactive": inactiveFilters.join(","),
"session_id": sessionId
});
}
module.exports = eventTelemetryMiddleware;

View File

@ -4,6 +4,7 @@
DevToolsModules(
'batching.js',
'event-telemetry.js',
'prefs.js',
'recording.js',
'throttling.js',

View File

@ -185,6 +185,7 @@ skip-if = true # Bug 1373558
[browser_net_status-bar.js]
[browser_net_status-codes.js]
[browser_net_streaming-response.js]
[browser_net_telemetry_filters_changed.js]
[browser_net_throttle.js]
[browser_net_timeline_ticks.js]
skip-if = true # TODO: fix the test

View File

@ -0,0 +1,109 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
const OPTOUT = Ci.nsITelemetry.DATASET_RELEASE_CHANNEL_OPTOUT;
/**
* Test the filters_changed telemetry event.
*/
add_task(async function() {
const { tab, monitor } = await initNetMonitor(SIMPLE_URL);
info("Starting test... ");
const { document, store, windowRequire } = monitor.panelWin;
const Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
const {
getDisplayedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
store.dispatch(Actions.batchEnable(false));
// Remove all telemetry events (you can check about:telemetry).
Services.telemetry.clearEvents();
// Ensure no events have been logged
const snapshot = Services.telemetry.snapshotEvents(OPTOUT, true);
ok(!snapshot.parent, "No events have been logged for the main process");
// Reload to have one request in the list.
const wait = waitForNetworkEvents(monitor, 1);
tab.linkedBrowser.loadURI(SIMPLE_URL);
await wait;
info("Click on the 'HTML' filter");
EventUtils.sendMouseEvent({ type: "click" },
document.querySelector(".requests-list-filter-html-button"));
checkTelemetryEvent({
trigger: "html",
active: "html",
inactive: "all,css,js,xhr,fonts,images,media,ws,other",
});
info("Click on the 'CSS' filter");
EventUtils.sendMouseEvent({ type: "click" },
document.querySelector(".requests-list-filter-css-button"));
checkTelemetryEvent({
trigger: "css",
active: "html,css",
inactive: "all,js,xhr,fonts,images,media,ws,other",
});
info("Filter the output using the text filter input");
setFreetextFilter(monitor, "nomatch");
// Wait till the text filter is applied.
await waitUntil(() => getDisplayedRequests(store.getState()).length == 0);
checkTelemetryEvent({
trigger: "text",
active: "html,css",
inactive: "all,js,xhr,fonts,images,media,ws,other",
});
return teardown(monitor);
});
function setFreetextFilter(monitor, value) {
const { document } = monitor.panelWin;
const filterBox = document.querySelector(".devtools-filterinput");
filterBox.focus();
filterBox.value = "";
for (const ch of value) {
EventUtils.synthesizeKey(ch, {}, monitor.panelWin);
}
}
function checkTelemetryEvent(expectedEvent) {
const events = getFiltersChangedEventsExtra();
is(events.length, 1, "There was only 1 event logged");
const [event] = events;
ok(event.session_id > 0, "There is a valid session_id in the logged event");
const f = e => JSON.stringify(e, null, 2);
is(f(event), f({
...expectedEvent,
"session_id": event.session_id
}), "The event has the expected data");
}
function getFiltersChangedEventsExtra() {
// Retrieve and clear telemetry events.
const snapshot = Services.telemetry.snapshotEvents(OPTOUT, true);
const filtersChangedEvents = snapshot.parent.filter(event =>
event[1] === "devtools.main" &&
event[2] === "filters_changed" &&
event[3] === "netmonitor"
);
// Since we already know we have the correct event, we only return the `extra` field
// that was passed to it (which is event[5] here).
return filtersChangedEvents.map(event => event[5]);
}

View File

@ -1630,7 +1630,7 @@ nsFocusManager::CheckIfFocusable(Element* aElement, uint32_t aFlags)
// offscreen browsers can still be focused.
nsIDocument* subdoc = doc->GetSubDocumentFor(aElement);
if (subdoc && IsWindowVisible(subdoc->GetWindow())) {
const nsStyleUserInterface* ui = frame->StyleUserInterface();
const nsStyleUI* ui = frame->StyleUI();
int32_t tabIndex = (ui->mUserFocus == StyleUserFocus::Ignore ||
ui->mUserFocus == StyleUserFocus::None) ? -1 : 0;
return aElement->IsFocusable(&tabIndex, aFlags & FLAG_BYMOUSE) ? aElement : nullptr;

View File

@ -3191,7 +3191,7 @@ EventStateManager::PostHandleEvent(nsPresContext* aPresContext,
bool suppressBlur = false;
if (mCurrentTarget) {
mCurrentTarget->GetContentForEvent(aEvent, getter_AddRefs(newFocus));
const nsStyleUserInterface* ui = mCurrentTarget->StyleUserInterface();
const nsStyleUI* ui = mCurrentTarget->StyleUI();
activeContent = mCurrentTarget->GetContent();
// In some cases, we do not want to even blur the current focused
@ -5221,7 +5221,7 @@ EventStateManager::SetContentState(nsIContent* aContent, EventStates aState)
// XXX Is this even what we want?
if (mCurrentTarget)
{
const nsStyleUserInterface* ui = mCurrentTarget->StyleUserInterface();
const nsStyleUI* ui = mCurrentTarget->StyleUI();
if (ui->mUserInput == StyleUserInput::None) {
return false;
}

View File

@ -53,7 +53,7 @@ HTMLOptGroupElement::GetEventTargetParent(EventChainPreVisitor& aVisitor)
if (nsIFrame* frame = GetPrimaryFrame()) {
// FIXME(emilio): This poking at the style of the frame is broken unless we
// flush before every event handling, which we don't really want to.
if (frame->StyleUserInterface()->mUserInput == StyleUserInput::None) {
if (frame->StyleUI()->mUserInput == StyleUserInput::None) {
return;
}
}

View File

@ -2180,8 +2180,7 @@ nsGenericHTMLFormElement::IsElementDisabledForEvents(EventMessage aMessage,
// FIXME(emilio): This poking at the style of the frame is slightly bogus
// unless we flush before every event, which we don't really want to do.
if (aFrame &&
aFrame->StyleUserInterface()->mUserInput == StyleUserInput::None) {
if (aFrame && aFrame->StyleUI()->mUserInput == StyleUserInput::None) {
return true;
}

View File

@ -8,7 +8,6 @@
#include "nsAutoPtr.h"
#include "nsIConsoleService.h"
#include "nsIDocument.h"
#include "nsIEffectiveTLDService.h"
#include "nsIScriptSecurityManager.h"
#include "nsIStreamLoader.h"
@ -22,7 +21,6 @@
#include "nsISimpleEnumerator.h"
#include "nsITimer.h"
#include "nsIUploadChannel2.h"
#include "nsPIDOMWindow.h"
#include "nsServiceManagerUtils.h"
#include "nsDebug.h"
#include "nsISupportsPrimitives.h"
@ -1234,26 +1232,6 @@ ServiceWorkerManager::GetActiveWorkerInfoForScope(const OriginAttributes& aOrigi
return registration->GetActive();
}
ServiceWorkerInfo*
ServiceWorkerManager::GetActiveWorkerInfoForDocument(nsIDocument* aDocument)
{
MOZ_ASSERT(NS_IsMainThread());
Maybe<ClientInfo> clientInfo(aDocument->GetClientInfo());
if (clientInfo.isNothing()) {
return nullptr;
}
RefPtr<ServiceWorkerRegistrationInfo> registration;
GetClientRegistration(clientInfo.ref(), getter_AddRefs(registration));
if (!registration) {
return nullptr;
}
return registration->GetActive();
}
namespace {
class UnregisterJobCallback final : public ServiceWorkerJob::Callback
@ -1630,31 +1608,6 @@ ServiceWorkerManager::StoreRegistration(
mActor->SendRegister(data);
}
already_AddRefed<ServiceWorkerRegistrationInfo>
ServiceWorkerManager::GetServiceWorkerRegistrationInfo(nsPIDOMWindowInner* aWindow) const
{
MOZ_ASSERT(aWindow);
nsCOMPtr<nsIDocument> document = aWindow->GetExtantDoc();
return GetServiceWorkerRegistrationInfo(document);
}
already_AddRefed<ServiceWorkerRegistrationInfo>
ServiceWorkerManager::GetServiceWorkerRegistrationInfo(nsIDocument* aDoc) const
{
MOZ_ASSERT(aDoc);
nsCOMPtr<nsIURI> documentURI = aDoc->GetDocumentURI();
nsCOMPtr<nsIPrincipal> principal = aDoc->NodePrincipal();
RefPtr<ServiceWorkerRegistrationInfo> reg =
GetServiceWorkerRegistrationInfo(principal, documentURI);
if (reg) {
auto storageAllowed = nsContentUtils::StorageAllowedForDocument(aDoc);
if (storageAllowed != nsContentUtils::StorageAccess::eAllow) {
reg = nullptr;
}
}
return reg.forget();
}
already_AddRefed<ServiceWorkerRegistrationInfo>
ServiceWorkerManager::GetServiceWorkerRegistrationInfo(const ClientInfo& aClientInfo) const
{

View File

@ -378,18 +378,9 @@ private:
GetActiveWorkerInfoForScope(const OriginAttributes& aOriginAttributes,
const nsACString& aScope);
ServiceWorkerInfo*
GetActiveWorkerInfoForDocument(nsIDocument* aDocument);
void
StopControllingRegistration(ServiceWorkerRegistrationInfo* aRegistration);
already_AddRefed<ServiceWorkerRegistrationInfo>
GetServiceWorkerRegistrationInfo(nsPIDOMWindowInner* aWindow) const;
already_AddRefed<ServiceWorkerRegistrationInfo>
GetServiceWorkerRegistrationInfo(nsIDocument* aDoc) const;
already_AddRefed<ServiceWorkerRegistrationInfo>
GetServiceWorkerRegistrationInfo(const ClientInfo& aClientInfo) const;

View File

@ -205,7 +205,7 @@ nsXULPopupListener::FireFocusOnTargetContent(nsIContent* aTargetContent,
nsIFrame* targetFrame = aTargetContent->GetPrimaryFrame();
if (!targetFrame) return NS_ERROR_FAILURE;
const nsStyleUserInterface* ui = targetFrame->StyleUserInterface();
const nsStyleUI* ui = targetFrame->StyleUI();
bool suppressBlur = (ui->mUserFocus == StyleUserFocus::Ignore);
RefPtr<Element> newFocusElement;

View File

@ -1730,28 +1730,52 @@ HTMLEditor::InsertNodeIntoProperAncestorWithTransaction(
NS_IMETHODIMP
HTMLEditor::SelectElement(Element* aElement)
{
if (NS_WARN_IF(!aElement)) {
return NS_ERROR_INVALID_ARG;
}
RefPtr<Selection> selection = GetSelection();
if (NS_WARN_IF(!selection)) {
return NS_ERROR_FAILURE;
}
nsresult rv = SelectContentInternal(*selection, *aElement);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
return NS_OK;
}
nsresult
HTMLEditor::SelectContentInternal(Selection& aSelection,
nsIContent& aContentToSelect)
{
// Must be sure that element is contained in the document body
if (!IsDescendantOfEditorRoot(aElement)) {
return NS_ERROR_NULL_POINTER;
if (!IsDescendantOfEditorRoot(&aContentToSelect)) {
return NS_ERROR_FAILURE;
}
RefPtr<Selection> selection = GetSelection();
NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER);
nsINode* parent = aElement->GetParentNode();
nsINode* parent = aContentToSelect.GetParentNode();
if (NS_WARN_IF(!parent)) {
return NS_ERROR_FAILURE;
}
int32_t offsetInParent = parent->ComputeIndexOf(aElement);
// Don't notify selection change at collapse.
AutoUpdateViewBatch notifySelectionChangeOnce(this);
// XXX Perhaps, Selection should have SelectNode(nsIContent&).
int32_t offsetInParent = parent->ComputeIndexOf(&aContentToSelect);
// Collapse selection to just before desired element,
nsresult rv = selection->Collapse(parent, offsetInParent);
if (NS_SUCCEEDED(rv)) {
// then extend it to just after
rv = selection->Extend(parent, offsetInParent + 1);
nsresult rv = aSelection.Collapse(parent, offsetInParent);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
return rv;
// then extend it to just after
rv = aSelection.Extend(parent, offsetInParent + 1);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
return NS_OK;
}
NS_IMETHODIMP

View File

@ -771,6 +771,17 @@ protected: // Shouldn't be used by friend classes
virtual nsresult SelectAllInternal() override;
/**
* SelectContentInternal() sets Selection to aContentToSelect to
* aContentToSelect + 1 in parent of aContentToSelect.
*
* @param aSelection The Selection, callers have to guarantee the
* lifetime.
* @param aContentToSelect The content which should be selected.
*/
nsresult SelectContentInternal(Selection& aSelection,
nsIContent& aContentToSelect);
/**
* PasteInternal() pasts text with replacing selected content.
* This tries to dispatch ePaste event first. If its defaultPrevent() is

View File

@ -3075,7 +3075,9 @@ HTMLEditor::SetSelectionAfterTableEdit(Element* aTable,
if (cell) {
if (aSelected) {
// Reselect the cell
SelectElement(cell);
DebugOnly<nsresult> rv = SelectContentInternal(*selection, *cell);
NS_WARNING_ASSERTION(NS_SUCCEEDED(rv),
"Failed to select the cell");
return;
}

View File

@ -281,6 +281,7 @@ skip-if = android_version == '24'
[test_middle_click_paste.html]
subsuite = clipboard
skip-if = android_version == '24'
[test_nsIHTMLEditor_selectElement.html]
[test_objectResizing.html]
[test_root_element_replacement.html]
[test_select_all_without_body.html]

View File

@ -0,0 +1,131 @@
<!DOCTYPE>
<html>
<head>
<title>Test for nsIHTMLEditor.selectElement()</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
</head>
<body>
<div id="display">
</div>
<div id="content" contenteditable></div>
<pre id="test">
</pre>
<script class="testbody" type="application/javascript">
SimpleTest.waitForExplicitFinish();
SimpleTest.waitForFocus(function() {
let editor = document.getElementById("content");
let selection = window.getSelection();
editor.innerHTML = "<p>p1<b>b1</b><i>i1</i></p><p><b>b2</b><i>i2</i>p2</p>";
editor.focus();
try {
getHTMLEditor().selectElement(editor.firstChild.firstChild);
ok(false, "nsIHTMLEditor.selectElement() should throw an exception if given node is not an element");
} catch (e) {
ok(true, `nsIHTMLEditor.selectElement() should throw an exception if given node is not an element: ${e}`);
}
editor.focus();
try {
getHTMLEditor().selectElement(editor.firstChild.firstChild.nextSibling);
is(selection.anchorNode, editor.firstChild,
"nsIHTMLEditor.selectElement() should set anchor node to parent of <b> element in the first paragraph");
is(selection.anchorOffset, 1,
"nsIHTMLEditor.selectElement() should set anchor offset to the index of <b> element in the first paragraph");
is(selection.focusNode, editor.firstChild,
"nsIHTMLEditor.selectElement() should set focus node to parent of <b> element in the first paragraph");
is(selection.focusOffset, 2,
"nsIHTMLEditor.selectElement() should set anchor offset to the index of <b> element + 1 in the first paragraph");
} catch (e) {
ok(false, `nsIHTMLEditor.selectElement() shouldn't throw exception when selecting an element in focused editor #1: ${e}`);
}
editor.focus();
try {
getHTMLEditor().selectElement(editor.firstChild.nextSibling.firstChild);
is(selection.anchorNode, editor.firstChild.nextSibling,
"nsIHTMLEditor.selectElement() should set anchor node to parent of <b> element in the second paragraph");
is(selection.anchorOffset, 0,
"nsIHTMLEditor.selectElement() should set anchor offset to the index of <b> element in the second paragraph");
is(selection.focusNode, editor.firstChild.nextSibling,
"nsIHTMLEditor.selectElement() should set focus node to parent of <b> element in the second paragraph");
is(selection.focusOffset, 1,
"nsIHTMLEditor.selectElement() should set anchor offset to the index of <b> element + 1 in the second paragraph");
} catch (e) {
ok(false, `nsIHTMLEditor.selectElement() shouldn't throw exception when selecting an element in focused editor #2: ${e}`);
}
editor.focus();
try {
getHTMLEditor().selectElement(editor);
ok(false, "nsIHTMLEditor.selectElement() should throw an exception if given node is the editing host");
} catch (e) {
ok(true, `nsIHTMLEditor.selectElement() should throw an exception if given node is the editing host: ${e}`);
}
editor.focus();
try {
getHTMLEditor().selectElement(editor.parentElement);
ok(false, "nsIHTMLEditor.selectElement() should throw an exception if given node is outside of the editing host");
} catch (e) {
ok(true, `nsIHTMLEditor.selectElement() should throw an exception if given node is outside of the editing host: ${e}`);
}
selection.removeAllRanges();
editor.blur();
try {
getHTMLEditor().selectElement(editor.firstChild.nextSibling.firstChild);
ok(false, "nsIHTMLEditor.selectElement() should throw an exception if there is no active editing host");
} catch (e) {
ok(true, `nsIHTMLEditor.selectElement() should throw an exception if there is no active editing host: ${e}`);
}
editor.focus();
editor.firstChild.firstChild.nextSibling.nextSibling.setAttribute("contenteditable", "false");
try {
getHTMLEditor().selectElement(editor.firstChild.firstChild.nextSibling.nextSibling);
is(selection.anchorNode, editor.firstChild,
"nsIHTMLEditor.selectElement() should set anchor node to parent of <i contenteditable=\"false\"> element in the first paragraph");
is(selection.anchorOffset, 2,
"nsIHTMLEditor.selectElement() should set anchor offset to the index of <i contenteditable=\"false\"> element in the first paragraph");
is(selection.focusNode, editor.firstChild,
"nsIHTMLEditor.selectElement() should set focus node to parent of <i contenteditable=\"false\"> element in the first paragraph");
is(selection.focusOffset, 3,
"nsIHTMLEditor.selectElement() should set anchor offset to the index of <i contenteditable=\"false\"> element + 1 in the first paragraph");
} catch (e) {
ok(false, `nsIHTMLEditor.selectElement() shouldn't throw exception when selecting an element in focused editor #3: ${e}`);
}
editor.focus();
editor.firstChild.nextSibling.setAttribute("contenteditable", "false");
try {
getHTMLEditor().selectElement(editor.firstChild.nextSibling.firstChild.nextSibling);
is(selection.anchorNode, editor.firstChild.nextSibling,
"nsIHTMLEditor.selectElement() should set anchor node to parent of <i> element in the second paragraph which is not editable");
is(selection.anchorOffset, 1,
"nsIHTMLEditor.selectElement() should set anchor offset to the index of <i> element in the second paragraph which is not editable");
is(selection.focusNode, editor.firstChild.nextSibling,
"nsIHTMLEditor.selectElement() should set focus node to parent of <i> element in the second paragraph which is not editable");
is(selection.focusOffset, 2,
"nsIHTMLEditor.selectElement() should set anchor offset to the index of <i> element + 1 in the second paragraph which is not editable");
} catch (e) {
ok(false, `nsIHTMLEditor.selectElement() shouldn't throw exception when selecting an element in focused editor #4: ${e}`);
}
SimpleTest.finish();
});
function getHTMLEditor() {
var Ci = SpecialPowers.Ci;
var editingSession = SpecialPowers.wrap(window).docShell.editingSession;
return editingSession.getEditorForWindow(window).QueryInterface(Ci.nsIHTMLEditor);
}
</script>
</body>
</html>

View File

@ -510,9 +510,8 @@ nsCaret::GetPaintGeometry(nsRect* aRect)
}
// now we have a frame, check whether it's appropriate to show the caret here
const nsStyleUserInterface* userinterface = frame->StyleUserInterface();
if ((!mIgnoreUserModify &&
userinterface->mUserModify == StyleUserModify::ReadOnly) ||
const nsStyleUI* ui = frame->StyleUI();
if ((!mIgnoreUserModify && ui->mUserModify == StyleUserModify::ReadOnly) ||
frame->IsContentDisabled()) {
return nullptr;
}

View File

@ -287,7 +287,7 @@ value can be held for the layout objects to use.<br>
First look into <a href="http://lxr.mozilla.org/seamonkey/source/content/shared/public/nsStyleStruct.h">
nsStyleStruct.h</a>
to see the existing style strucs. Find the one that you want to store the
data on. In this example, we want to put it on the nsStyleUserInterface struct,
data on. In this example, we want to put it on the nsStyleUI struct,
however there is also a class nsStyleUIReset that holds the non-inherited
values, so we will use that one (remember, our property is not inherited).
Add a <a href="#ComputedStyleMember">data member</a>

View File

@ -176,7 +176,7 @@ nsImageControlFrame::GetCursor(const nsPoint& aPoint,
{
// Use style defined cursor if one is provided, otherwise when
// the cursor style is "auto" we use the pointer cursor.
FillCursorInformationFromStyle(StyleUserInterface(), aCursor);
FillCursorInformationFromStyle(StyleUI(), aCursor);
if (NS_STYLE_CURSOR_AUTO == aCursor.mCursor) {
aCursor.mCursor = NS_STYLE_CURSOR_POINTER;

View File

@ -2393,7 +2393,7 @@ nsIFrame::DisplayCaret(nsDisplayListBuilder* aBuilder,
nscolor
nsIFrame::GetCaretColorAt(int32_t aOffset)
{
return nsLayoutUtils::GetColor(this, &nsStyleUserInterface::mCaretColor);
return nsLayoutUtils::GetColor(this, &nsStyleUI::mCaretColor);
}
bool
@ -5202,7 +5202,7 @@ nsresult
nsFrame::GetCursor(const nsPoint& aPoint,
nsIFrame::Cursor& aCursor)
{
FillCursorInformationFromStyle(StyleUserInterface(), aCursor);
FillCursorInformationFromStyle(StyleUI(), aCursor);
if (NS_STYLE_CURSOR_AUTO == aCursor.mCursor) {
// If this is editable, I-beam cursor is better for most elements.
aCursor.mCursor =
@ -6503,7 +6503,7 @@ nsIFrame::IsContentDisabled() const
{
// FIXME(emilio): Doing this via CSS means callers must ensure the style is up
// to date, and they don't!
if (StyleUserInterface()->mUserInput == StyleUserInput::None) {
if (StyleUI()->mUserInput == StyleUserInput::None) {
return true;
}
@ -9997,7 +9997,7 @@ nsIFrame::IsFocusable(int32_t *aTabIndex, bool aWithMouse)
if (mContent && mContent->IsElement() && IsVisibleConsideringAncestors() &&
Style()->GetPseudo() != nsCSSAnonBoxes::anonymousFlexItem &&
Style()->GetPseudo() != nsCSSAnonBoxes::anonymousGridItem) {
const nsStyleUserInterface* ui = StyleUserInterface();
const nsStyleUI* ui = StyleUI();
if (ui->mUserFocus != StyleUserFocus::Ignore &&
ui->mUserFocus != StyleUserFocus::None) {
// Pass in default tabindex of -1 for nonfocusable and 0 for focusable
@ -10097,7 +10097,7 @@ nsIFrame::VerticalAlignEnum() const
}
/* static */
void nsFrame::FillCursorInformationFromStyle(const nsStyleUserInterface* ui,
void nsFrame::FillCursorInformationFromStyle(const nsStyleUI* ui,
nsIFrame::Cursor& aCursor)
{
aCursor.mCursor = ui->mCursor;
@ -11262,7 +11262,7 @@ nsIFrame::GetCompositorHitTestInfo(nsDisplayListBuilder* aBuilder)
// are the event targets for any regions viewport frames may cover.
return result;
}
const uint8_t pointerEvents = StyleUserInterface()->GetEffectivePointerEvents(this);
const uint8_t pointerEvents = StyleUI()->GetEffectivePointerEvents(this);
if (pointerEvents == NS_STYLE_POINTER_EVENTS_NONE) {
return result;
}

View File

@ -685,7 +685,7 @@ protected:
mozilla::TableSelection* aTarget);
// Fills aCursor with the appropriate information from ui
static void FillCursorInformationFromStyle(const nsStyleUserInterface* ui,
static void FillCursorInformationFromStyle(const nsStyleUI* ui,
nsIFrame::Cursor& aCursor);
NS_IMETHOD DoXULLayout(nsBoxLayoutState& aBoxLayoutState) override;

View File

@ -2201,8 +2201,7 @@ nsImageFrame::GetCursor(const nsPoint& aPoint,
PresShell()->StyleSet()->
ResolveStyleFor(area->AsElement(), Style(),
LazyComputeBehavior::Allow);
FillCursorInformationFromStyle(areaStyle->StyleUserInterface(),
aCursor);
FillCursorInformationFromStyle(areaStyle->StyleUI(), aCursor);
if (NS_STYLE_CURSOR_AUTO == aCursor.mCursor) {
aCursor.mCursor = NS_STYLE_CURSOR_DEFAULT;
}

View File

@ -340,7 +340,7 @@ nsSubDocumentFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
// If we are pointer-events:none then we don't need to HitTest background
bool pointerEventsNone =
StyleUserInterface()->mPointerEvents == NS_STYLE_POINTER_EVENTS_NONE;
StyleUI()->mPointerEvents == NS_STYLE_POINTER_EVENTS_NONE;
if (!aBuilder->IsForEventDelivery() || !pointerEventsNone) {
nsDisplayListCollection decorations(aBuilder);
DisplayBorderBackgroundOutline(aBuilder, decorations);

View File

@ -4633,7 +4633,7 @@ nsresult
nsTextFrame::GetCursor(const nsPoint& aPoint,
nsIFrame::Cursor& aCursor)
{
FillCursorInformationFromStyle(StyleUserInterface(), aCursor);
FillCursorInformationFromStyle(StyleUI(), aCursor);
if (NS_STYLE_CURSOR_AUTO == aCursor.mCursor) {
if (!IsSelectable(nullptr)) {
aCursor.mCursor = NS_STYLE_CURSOR_DEFAULT;

View File

@ -351,7 +351,7 @@ nsDisplayRemote::nsDisplayRemote(nsDisplayListBuilder* aBuilder,
, mEventRegionsOverride(EventRegionsOverride::NoOverride)
{
bool frameIsPointerEventsNone =
aFrame->StyleUserInterface()->GetEffectivePointerEvents(aFrame) ==
aFrame->StyleUI()->GetEffectivePointerEvents(aFrame) ==
NS_STYLE_POINTER_EVENTS_NONE;
if (aBuilder->IsInsidePointerEventsNoneDoc() || frameIsPointerEventsNone) {
mEventRegionsOverride |= EventRegionsOverride::ForceEmptyHitRegion;

View File

@ -2851,7 +2851,7 @@ static bool
IsFrameReceivingPointerEvents(nsIFrame* aFrame)
{
return NS_STYLE_POINTER_EVENTS_NONE !=
aFrame->StyleUserInterface()->GetEffectivePointerEvents(aFrame);
aFrame->StyleUI()->GetEffectivePointerEvents(aFrame);
}
// A list of frames, and their z depth. Used for sorting

View File

@ -131,7 +131,7 @@ ComputedStyle::CalcStyleDifference(ComputedStyle* aNewContext,
DO_STRUCT_DIFFERENCE(XUL);
DO_STRUCT_DIFFERENCE(Column);
DO_STRUCT_DIFFERENCE(Content);
DO_STRUCT_DIFFERENCE(UserInterface);
DO_STRUCT_DIFFERENCE(UI);
DO_STRUCT_DIFFERENCE(Visibility);
DO_STRUCT_DIFFERENCE(Outline);
DO_STRUCT_DIFFERENCE(TableBorder);

View File

@ -1576,7 +1576,7 @@ Gecko_InitializeImageCropRect(nsStyleImage* aImage)
}
void
Gecko_SetCursorArrayLength(nsStyleUserInterface* aStyleUI, size_t aLen)
Gecko_SetCursorArrayLength(nsStyleUI* aStyleUI, size_t aLen)
{
aStyleUI->mCursorImages.Clear();
aStyleUI->mCursorImages.SetLength(aLen);
@ -1593,8 +1593,7 @@ Gecko_SetCursorImageValue(nsCursorImage* aCursor,
}
void
Gecko_CopyCursorArrayFrom(nsStyleUserInterface* aDest,
const nsStyleUserInterface* aSrc)
Gecko_CopyCursorArrayFrom(nsStyleUI* aDest, const nsStyleUI* aSrc)
{
aDest->mCursorImages = aSrc->mCursorImages;
}

View File

@ -379,11 +379,10 @@ void Gecko_SetListStyleImageImageValue(nsStyleList* style_struct,
void Gecko_CopyListStyleImageFrom(nsStyleList* dest, const nsStyleList* src);
// cursor style.
void Gecko_SetCursorArrayLength(nsStyleUserInterface* ui, size_t len);
void Gecko_SetCursorArrayLength(nsStyleUI* ui, size_t len);
void Gecko_SetCursorImageValue(nsCursorImage* aCursor,
mozilla::css::ImageValue* aImageValue);
void Gecko_CopyCursorArrayFrom(nsStyleUserInterface* dest,
const nsStyleUserInterface* src);
void Gecko_CopyCursorArrayFrom(nsStyleUI* dest, const nsStyleUI* src);
void Gecko_SetContentDataImageValue(nsStyleContentData* aList,
mozilla::css::ImageValue* aImageValue);

View File

@ -338,7 +338,7 @@ whitelist-types = [
"nsStyleUIReset",
"nsStyleUnion",
"nsStyleUnit",
"nsStyleUserInterface",
"nsStyleUI",
"nsStyleVisibility",
"nsStyleXUL",
"nsTArrayHeader",
@ -585,7 +585,7 @@ structs-types = [
"nsStyleUIReset",
"nsStyleUnion",
"nsStyleUnit",
"nsStyleUserInterface",
"nsStyleUI",
"nsStyleVisibility",
"nsStyleXUL",
"nsTimingFunction",

View File

@ -33,4 +33,4 @@ STYLE_STRUCT(Text, (mTextEmphasisColor,
mWebkitTextStrokeColor))
STYLE_STRUCT(TextReset, (mTextDecorationColor))
STYLE_STRUCT(SVG, (mFill, mStroke))
STYLE_STRUCT(UserInterface, (mCaretColor))
STYLE_STRUCT(UI, (mCaretColor))

View File

@ -727,7 +727,7 @@ CollectImageURLsForProperty(nsCSSPropertyID aProp,
switch (aProp) {
case eCSSProperty_cursor:
for (auto& image : aStyle.StyleUserInterface()->mCursorImages) {
for (auto& image : aStyle.StyleUI()->mCursorImages) {
AddImageURL(*image.mImage, aURLs);
}
break;
@ -2985,7 +2985,7 @@ already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetScrollbarFaceColor()
{
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
SetValueForWidgetColor(val, StyleUserInterface()->mScrollbarFaceColor,
SetValueForWidgetColor(val, StyleUI()->mScrollbarFaceColor,
StyleAppearance::ScrollbarthumbVertical);
return val.forget();
}
@ -2994,7 +2994,7 @@ already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetScrollbarTrackColor()
{
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
SetValueForWidgetColor(val, StyleUserInterface()->mScrollbarTrackColor,
SetValueForWidgetColor(val, StyleUI()->mScrollbarTrackColor,
StyleAppearance::ScrollbarVertical);
return val.forget();
}
@ -3477,7 +3477,7 @@ already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetCaretColor()
{
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
SetValueFromComplexColor(val, StyleUserInterface()->mCaretColor);
SetValueFromComplexColor(val, StyleUI()->mCaretColor);
return val.forget();
}
@ -3486,7 +3486,7 @@ nsComputedDOMStyle::DoGetCursor()
{
RefPtr<nsDOMCSSValueList> valueList = GetROCSSValueList(true);
const nsStyleUserInterface *ui = StyleUserInterface();
const nsStyleUI *ui = StyleUI();
for (const nsCursorImage& item : ui->mCursorImages) {
RefPtr<nsDOMCSSValueList> itemList = GetROCSSValueList(false);

View File

@ -382,7 +382,7 @@ enum class StyleContent : uint8_t {
AltContent
};
// See nsStyleUserInterface
// See nsStyleUI
#define NS_STYLE_CURSOR_AUTO 1
#define NS_STYLE_CURSOR_CROSSHAIR 2
#define NS_STYLE_CURSOR_DEFAULT 3 // ie: an arrow

View File

@ -4559,7 +4559,7 @@ nsStyleText::TextEmphasisSide(WritingMode aWM) const
}
//-----------------------
// nsStyleUserInterface
// nsStyleUI
//
nsCursorImage::nsCursorImage()
@ -4605,7 +4605,7 @@ nsCursorImage::operator==(const nsCursorImage& aOther) const
DefinitelyEqualImages(mImage, aOther.mImage);
}
nsStyleUserInterface::nsStyleUserInterface(const nsPresContext* aContext)
nsStyleUI::nsStyleUI(const nsPresContext* aContext)
: mUserInput(StyleUserInput::Auto)
, mUserModify(StyleUserModify::ReadOnly)
, mUserFocus(StyleUserFocus::None)
@ -4615,10 +4615,10 @@ nsStyleUserInterface::nsStyleUserInterface(const nsPresContext* aContext)
, mScrollbarFaceColor(StyleComplexColor::Auto())
, mScrollbarTrackColor(StyleComplexColor::Auto())
{
MOZ_COUNT_CTOR(nsStyleUserInterface);
MOZ_COUNT_CTOR(nsStyleUI);
}
nsStyleUserInterface::nsStyleUserInterface(const nsStyleUserInterface& aSource)
nsStyleUI::nsStyleUI(const nsStyleUI& aSource)
: mUserInput(aSource.mUserInput)
, mUserModify(aSource.mUserModify)
, mUserFocus(aSource.mUserFocus)
@ -4629,17 +4629,17 @@ nsStyleUserInterface::nsStyleUserInterface(const nsStyleUserInterface& aSource)
, mScrollbarFaceColor(aSource.mScrollbarFaceColor)
, mScrollbarTrackColor(aSource.mScrollbarTrackColor)
{
MOZ_COUNT_CTOR(nsStyleUserInterface);
MOZ_COUNT_CTOR(nsStyleUI);
}
nsStyleUserInterface::~nsStyleUserInterface()
nsStyleUI::~nsStyleUI()
{
MOZ_COUNT_DTOR(nsStyleUserInterface);
MOZ_COUNT_DTOR(nsStyleUI);
}
void
nsStyleUserInterface::FinishStyle(
nsPresContext* aPresContext, const nsStyleUserInterface* aOldStyle)
nsStyleUI::FinishStyle(nsPresContext* aPresContext,
const nsStyleUI* aOldStyle)
{
MOZ_ASSERT(NS_IsMainThread());
@ -4658,7 +4658,7 @@ nsStyleUserInterface::FinishStyle(
}
nsChangeHint
nsStyleUserInterface::CalcDifference(const nsStyleUserInterface& aNewData) const
nsStyleUI::CalcDifference(const nsStyleUI& aNewData) const
{
nsChangeHint hint = nsChangeHint(0);
if (mCursor != aNewData.mCursor) {

View File

@ -2776,16 +2776,16 @@ struct nsCursorImage
}
};
struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleUserInterface
struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleUI
{
explicit nsStyleUserInterface(const nsPresContext* aContext);
nsStyleUserInterface(const nsStyleUserInterface& aOther);
~nsStyleUserInterface();
explicit nsStyleUI(const nsPresContext* aContext);
nsStyleUI(const nsStyleUI& aOther);
~nsStyleUI();
void FinishStyle(nsPresContext*, const nsStyleUserInterface*);
void FinishStyle(nsPresContext*, const nsStyleUI*);
const static bool kHasFinishStyle = true;
nsChangeHint CalcDifference(const nsStyleUserInterface& aNewData) const;
nsChangeHint CalcDifference(const nsStyleUI& aNewData) const;
mozilla::StyleUserInput mUserInput;
mozilla::StyleUserModify mUserModify; // (modify-content)

View File

@ -246,7 +246,7 @@ nsStyleDisplay::IsAbsolutelyPositioned(const nsIFrame* aContextFrame) const
}
uint8_t
nsStyleUserInterface::GetEffectivePointerEvents(nsIFrame* aFrame) const
nsStyleUI::GetEffectivePointerEvents(nsIFrame* aFrame) const
{
if (aFrame->GetContent() && !aFrame->GetContent()->GetParent()) {
// The root element has a cluster of frames associated with it
@ -255,7 +255,7 @@ nsStyleUserInterface::GetEffectivePointerEvents(nsIFrame* aFrame) const
// frame.
nsIFrame* f = aFrame->GetContent()->GetPrimaryFrame();
if (f) {
return f->StyleUserInterface()->mPointerEvents;
return f->StyleUI()->mPointerEvents;
}
}
return mPointerEvents;

View File

@ -37,7 +37,7 @@ STYLE_STRUCT_INHERITED(Color)
STYLE_STRUCT_INHERITED(List)
STYLE_STRUCT_INHERITED(Text)
STYLE_STRUCT_INHERITED(Visibility)
STYLE_STRUCT_INHERITED(UserInterface)
STYLE_STRUCT_INHERITED(UI)
STYLE_STRUCT_INHERITED(TableBorder)
STYLE_STRUCT_INHERITED(SVG)

View File

@ -502,7 +502,7 @@ nsSVGImageFrame::GetHitTestFlags()
{
uint16_t flags = 0;
switch (StyleUserInterface()->mPointerEvents) {
switch (StyleUI()->mPointerEvents) {
case NS_STYLE_POINTER_EVENTS_NONE:
break;
case NS_STYLE_POINTER_EVENTS_VISIBLEPAINTED:

View File

@ -1704,7 +1704,7 @@ nsSVGUtils::GetGeometryHitTestFlags(nsIFrame* aFrame)
{
uint16_t flags = 0;
switch (aFrame->StyleUserInterface()->mPointerEvents) {
switch (aFrame->StyleUI()->mPointerEvents) {
case NS_STYLE_POINTER_EVENTS_NONE:
break;
case NS_STYLE_POINTER_EVENTS_AUTO:

View File

@ -2442,8 +2442,7 @@ nsTreeBodyFrame::GetCursor(const nsPoint& aPoint,
// Our scratch array is already prefilled.
ComputedStyle* childContext = GetPseudoComputedStyle(child);
FillCursorInformationFromStyle(childContext->StyleUserInterface(),
aCursor);
FillCursorInformationFromStyle(childContext->StyleUI(), aCursor);
if (aCursor.mCursor == NS_STYLE_CURSOR_AUTO)
aCursor.mCursor = NS_STYLE_CURSOR_DEFAULT;

View File

@ -4147,6 +4147,73 @@ TEST(NewSdpTestNoFixture, CheckParsingResultComparer) {
ASSERT_TRUE(check_comparison(kBasicAudioVideoOffer));
ASSERT_TRUE(check_comparison(kH264AudioVideoOffer));
// Check the Fmtp comprison
const std::string kBasicOpusFmtp1 =
"v=0" CRLF
"o=Mozilla-SIPUA-35.0a1 5184 0 IN IP4 0.0.0.0" CRLF
"s=SIP Call" CRLF
"c=IN IP4 224.0.0.1/100/12" CRLF
"t=0 0" CRLF
"m=video 9 RTP/SAVPF 120" CRLF
"a=rtpmap:120 opus/48000" CRLF
"a=fmtp:120 stereo=1;useinbandfec=1" CRLF;
ASSERT_TRUE(check_comparison(kBasicOpusFmtp1));
const std::string kBasicOpusFmtp2 =
"v=0" CRLF
"o=Mozilla-SIPUA-35.0a1 5184 0 IN IP4 0.0.0.0" CRLF
"s=SIP Call" CRLF
"c=IN IP4 224.0.0.1/100/12" CRLF
"t=0 0" CRLF
"m=video 9 RTP/SAVPF 120" CRLF
"a=rtpmap:120 opus/48000" CRLF
"a=fmtp:120 useinbandfec=1;stereo=1;maxplaybackrate=32000" CRLF;
ASSERT_TRUE(check_comparison(kBasicOpusFmtp2));
const std::string kBasicVP8Fmtp1 =
"v=0" CRLF
"o=Mozilla-SIPUA-35.0a1 5184 0 IN IP4 0.0.0.0" CRLF
"s=SIP Call" CRLF
"c=IN IP4 224.0.0.1/100/12" CRLF
"t=0 0" CRLF
"m=video 9 RTP/SAVPF 120" CRLF
"a=rtpmap:120 VP8/90000" CRLF
"a=fmtp:120 max-fs=3600;max-fr=60" CRLF;
ASSERT_TRUE(check_comparison(kBasicVP8Fmtp1));
//
const std::string kBasicVP8Fmtp2 =
"v=0" CRLF
"o=Mozilla-SIPUA-35.0a1 5184 0 IN IP4 0.0.0.0" CRLF
"s=SIP Call" CRLF
"c=IN IP4 224.0.0.1/100/12" CRLF
"t=0 0" CRLF
"m=video 9 RTP/SAVPF 120" CRLF
"a=rtpmap:120 VP8/90000" CRLF
"a=fmtp:120 max-fr=60;max-fs=3600" CRLF;
ASSERT_TRUE(check_comparison(kBasicVP8Fmtp2));
const std::string kBasicH264Fmtp1 =
"v=0" CRLF
"o=Mozilla-SIPUA-35.0a1 5184 0 IN IP4 0.0.0.0" CRLF
"s=SIP Call" CRLF
"c=IN IP4 224.0.0.1/100/12" CRLF
"t=0 0" CRLF
"m=video 9 RTP/SAVPF 120" CRLF
"a=rtpmap:120 H264/90000" CRLF
"a=fmtp:120 profile-level-id=42a01e;level_asymmetry_allowed=1" CRLF;
ASSERT_TRUE(check_comparison(kBasicH264Fmtp1));
const std::string kBasicH264Fmtp2 =
"v=0" CRLF
"o=Mozilla-SIPUA-35.0a1 5184 0 IN IP4 0.0.0.0" CRLF
"s=SIP Call" CRLF
"c=IN IP4 224.0.0.1/100/12" CRLF
"t=0 0" CRLF
"m=video 9 RTP/SAVPF 120" CRLF
"a=rtpmap:120 H264/90000" CRLF
"a=fmtp:120 level_asymmetry_allowed=1;profile-level-id=42a01e;max_fs=3600" CRLF;
ASSERT_TRUE(check_comparison(kBasicH264Fmtp2));
}
TEST(NewSdpTestNoFixture, CheckAttributeTypeSerialize) {

View File

@ -212,6 +212,13 @@ ParsingResultComparer::CompareAttrLists(const SdpAttributeList& rustAttrlist,
auto rustAttrStr = ToString(*rustAttrlist.GetAttribute(type, false));
if (rustAttrStr != sipccAttrStr) {
if (type == AttributeType::kFmtpAttribute) {
if (rustAttrlist.GetFmtp() == sipccAttrlist.GetFmtp()) {
continue;
}
}
std::string originalAttrStr = GetAttributeLines(attrStr, level);
if (rustAttrStr != originalAttrStr) {
nsString typeStr;

View File

@ -177,6 +177,12 @@ SdpFingerprintAttributeList::ParseFingerprint(const std::string& str)
return fp;
}
bool
SdpFmtpAttributeList::operator==(const SdpFmtpAttributeList& other) const
{
return mFmtps == other.mFmtps;
}
void
SdpFmtpAttributeList::Serialize(std::ostream& os) const
{

View File

@ -1283,6 +1283,13 @@ public:
virtual ~Parameters() {}
virtual Parameters* Clone() const = 0;
virtual void Serialize(std::ostream& os) const = 0;
virtual bool CompareEq(const Parameters& other) const = 0;
bool operator==(const Parameters& other) const
{
return codec_type == other.codec_type &&
CompareEq(other);
}
SdpRtpmapAttributeList::CodecType codec_type;
};
@ -1310,6 +1317,12 @@ public:
}
}
virtual bool
CompareEq(const Parameters& other) const override
{
return encodings == static_cast<const RedParameters&>(other).encodings;
}
std::vector<uint8_t> encodings;
};
@ -1377,6 +1390,22 @@ public:
}
}
virtual bool
CompareEq(const Parameters& other) const override
{
const auto& otherH264 = static_cast<const H264Parameters&>(other);
// sprop is not comapred here as it does not get parsed in the rsdparsa
return packetization_mode == otherH264.packetization_mode &&
level_asymmetry_allowed == otherH264.level_asymmetry_allowed &&
profile_level_id == otherH264.profile_level_id &&
max_mbps == otherH264.max_mbps &&
max_fs == otherH264.max_fs &&
max_cpb == otherH264.max_cpb &&
max_dpb == otherH264.max_dpb &&
max_br == otherH264.max_br;
}
static const size_t max_sprop_len = 128;
char sprop_parameter_sets[max_sprop_len];
unsigned int packetization_mode;
@ -1413,6 +1442,15 @@ public:
os << ";max-fr=" << max_fr;
}
virtual bool
CompareEq(const Parameters& other) const override
{
const auto& otherVP8 = static_cast<const VP8Parameters&>(other);
return max_fs == otherVP8.max_fs &&
max_fr == otherVP8.max_fr;
}
unsigned int max_fs;
unsigned int max_fr;
};
@ -1444,6 +1482,25 @@ public:
<< ";useinbandfec=" << useInBandFec;
}
virtual bool
CompareEq(const Parameters& other) const override
{
const auto& otherOpus = static_cast<const OpusParameters&>(other);
bool maxplaybackrateIsEq = (maxplaybackrate == otherOpus.maxplaybackrate);
// This is due to a bug in sipcc that causes maxplaybackrate to
// always be 0 if it appears in the fmtp
if (((maxplaybackrate == 0) && (otherOpus.maxplaybackrate != 0)) ||
((maxplaybackrate != 0) && (otherOpus.maxplaybackrate == 0))) {
maxplaybackrateIsEq = true;
}
return maxplaybackrateIsEq &&
stereo == otherOpus.stereo &&
useInBandFec == otherOpus.useInBandFec;
}
unsigned int maxplaybackrate;
unsigned int stereo;
unsigned int useInBandFec;
@ -1469,6 +1526,13 @@ public:
os << dtmfTones;
}
virtual bool
CompareEq(const Parameters& other) const override
{
return dtmfTones == static_cast<const TelephoneEventParameters&>(other)
.dtmfTones;
}
std::string dtmfTones;
};
@ -1499,6 +1563,12 @@ public:
return *this;
}
bool operator==(const Fmtp& other) const
{
return format == other.format &&
*parameters == *other.parameters;
}
// The contract around these is as follows:
// * |parameters| is only set if we recognized the media type and had
// a subclass of Parameters to represent that type of parameters
@ -1510,6 +1580,8 @@ public:
UniquePtr<Parameters> parameters;
};
bool operator==(const SdpFmtpAttributeList& other) const;
virtual void Serialize(std::ostream& os) const override;
void

View File

@ -18,7 +18,7 @@ ac_add_options --enable-java-coverage
ac_add_options --with-android-min-sdk=16
ac_add_options --target=arm-linux-androideabi
. "$topsrcdir/mobile/android/config/mozconfigs/android-api-16/nightly"
. "$topsrcdir/mobile/android/config/mozconfigs/android-api-16/debug"
. "$topsrcdir/build/mozconfig.artifact"

View File

@ -4,7 +4,7 @@
<%namespace name="helpers" file="/helpers.mako.rs" />
<% data.new_style_struct("InheritedUI", inherited=True, gecko_name="UserInterface") %>
<% data.new_style_struct("InheritedUI", inherited=True, gecko_name="UI") %>
${helpers.predefined_type("cursor",
"Cursor",

View File

@ -1,4 +1,6 @@
[properties-value-002.html]
disabled:
if debug or asan: https://bugzilla.mozilla.org/show_bug.cgi?id=1358510
[vertical-align vertical(keyword) / values]
expected: FAIL

View File

@ -1,4 +1,6 @@
[properties-value-003.html]
disabled:
if debug or asan: https://bugzilla.mozilla.org/show_bug.cgi?id=1358510
[background-image image(url) / values]
expected: FAIL

View File

@ -633,15 +633,15 @@ devtools.main:
extra_keys:
session_id: The start time of the session in milliseconds since epoch (Unix Timestamp) e.g. 1396381378123.
filters_changed:
objects: ["webconsole"]
bug_numbers: [1463095]
objects: ["netmonitor", "webconsole"]
bug_numbers: [1463144, 1463095]
notification_emails: ["dev-developer-tools@lists.mozilla.org", "hkirschner@mozilla.com"]
record_in_processes: ["main"]
description: User has changed filters in the web console.
release_channel_collection: opt-out
expiry_version: never
extra_keys:
trigger: "The cause of the filter change: error, warn, log, info, debug, css, netxhr, net, text or reset"
trigger: "The cause of the filter change: error, warn, log, info, debug, css, netxhr, net, text or reset and all, html, css, js, xhr, fonts, images, media, ws or other for netmonitor"
active: Comma separated list of active filters.
inactive: Comma separated list of inactive filters.
session_id: The start time of the session in milliseconds since epoch (Unix Timestamp) e.g. 1396381378123.

View File

@ -809,7 +809,7 @@ var Impl = {
}
if (clearSubsession) {
this._subsessionStartActiveTicks = activeTicks;
this._subsessionStartActiveTicks = this._sessionActiveTicks;
}
ret.activeTicks = activeTicks;

View File

@ -5,6 +5,27 @@
ChromeUtils.import("resource://gre/modules/TelemetryController.jsm", this);
ChromeUtils.import("resource://gre/modules/TelemetrySession.jsm", this);
function tick(aHowMany) {
for (let i = 0; i < aHowMany; i++) {
Services.obs.notifyObservers(null, "user-interaction-active");
}
}
function checkSessionTicks(aExpected) {
let payload = TelemetrySession.getPayload();
Assert.equal(payload.simpleMeasurements.activeTicks, aExpected,
"Should record the expected number of active ticks for the session.");
}
function checkSubsessionTicks(aExpected, aClearSubsession) {
let payload = TelemetrySession.getPayload("main", aClearSubsession);
Assert.equal(payload.simpleMeasurements.activeTicks, aExpected,
"Should record the expected number of active ticks for the subsession.");
if (aExpected > 0) {
Assert.equal(payload.processes.parent.scalars["browser.engagement.active_ticks"], aExpected,
"Should record the expected number of active ticks for the subsession, in a scalar.");
}
}
add_task(async function test_setup() {
do_get_profile();
@ -49,3 +70,33 @@ add_task(async function test_record_activeTicks() {
await TelemetryController.testShutdown();
});
add_task({
skip_if: () => gIsAndroid
},
async function test_subsession_activeTicks() {
await TelemetryController.testReset();
Telemetry.clearScalars();
tick(5);
checkSessionTicks(5);
checkSubsessionTicks(5, true);
// After clearing the subsession, subsession ticks should be 0 but session
// ticks should still be 5.
checkSubsessionTicks(0);
checkSessionTicks(5);
tick(1);
checkSessionTicks(6);
checkSubsessionTicks(1, true);
checkSubsessionTicks(0);
checkSessionTicks(6);
tick(2);
checkSessionTicks(8);
checkSubsessionTicks(2);
await TelemetryController.testShutdown();
});

View File

@ -24,8 +24,8 @@
<div>
<p>All of the <b>source code</b> to this product is
available under licenses which are both
<a href="http://www.gnu.org/philosophy/free-sw.html">free</a> and
<a href="http://www.opensource.org/docs/definition.php">open source</a>.
<a href="https://www.gnu.org/philosophy/free-sw.html">free</a> and
<a href="https://www.opensource.org/docs/definition.php">open source</a>.
A URL identifying the specific source code used to create this copy can be found
on the <a href="about:buildconfig">build configuration page</a>, and you can read
<a href="https://developer.mozilla.org/en/Mozilla_Source_Code_%28Mercurial%29">instructions
@ -35,7 +35,7 @@
<p>More specifically, most of the source code is available under the
<a href="about:license#mpl">Mozilla Public License 2.0</a> (MPL).
The MPL has a
<a href="http://www.mozilla.org/MPL/2.0/FAQ.html">FAQ</a> to help
<a href="https://www.mozilla.org/MPL/2.0/FAQ/">FAQ</a> to help
you understand it. The remainder of the software which is not
under the MPL is available under one of a variety of other
free and open source licenses. Those that require reproduction
@ -623,7 +623,7 @@
<blockquote>
<p>This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this file,
You can obtain one at http://mozilla.org/MPL/2.0/.</p>
You can obtain one at https://mozilla.org/MPL/2.0/.</p>
</blockquote>
<p>If it is not possible or desirable to put the notice in a particular
@ -649,9 +649,9 @@
<p>This product contains code from the following LGPLed libraries:</p>
<ul>
<li><a href="http://www.surina.net/soundtouch/">libsoundtouch</a>
<li><a href="http://libav.org/">libav</a>
<li><a href="http://ffmpeg.org/">FFmpeg</a>
<li><a href="https://www.surina.net/soundtouch/">libsoundtouch</a>
<li><a href="https://libav.org/">Libav</a>
<li><a href="https://ffmpeg.org/">FFmpeg</a>
</ul>
<pre>
@ -1212,7 +1212,7 @@ href="https://addons.mozilla.org/en-US/firefox/addon/görans-hemmasnickrade-ordl
</ul>
<pre>Copyright &copy; 2007 Free Software Foundation, Inc.
&lt;<a href="http://fsf.org/">http://fsf.org/</a>&gt;
&lt;<a href="https://www.fsf.org/">https://www.fsf.org/</a>&gt;
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.</pre>
@ -1401,7 +1401,7 @@ Library.</p>
<pre>Version 3, 29 June 2007
Copyright &copy; 2007 Free Software Foundation, Inc.
&lt;<a href="http://fsf.org/">http://fsf.org/</a>&gt;
&lt;<a href="https://www.fsf.org/">https://www.fsf.org/</a>&gt;
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.</pre>
@ -2052,7 +2052,7 @@ the &ldquo;copyright&rdquo; line and a pointer to where the full notice is found
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see &lt;http://www.gnu.org/licenses/&gt;.
along with this program. If not, see &lt;https://www.gnu.org/licenses/&gt;.
</pre>
<p>Also add information on how to contact you by electronic and paper mail.</p>
@ -2073,14 +2073,14 @@ might be different; for a GUI interface, you would use an &ldquo;about box&rdquo
<p>You should also get your employer (if you work as a programmer) or school,
if any, to sign a &ldquo;copyright disclaimer&rdquo; for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
&lt;<a href="http://www.gnu.org/licenses/">http://www.gnu.org/licenses/</a>&gt;.</p>
&lt;<a href="https://www.gnu.org/licenses/">https://www.gnu.org/licenses/</a>&gt;.</p>
<p>The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
&lt;<a href="http://www.gnu.org/philosophy/why-not-lgpl.html">http://www.gnu.org/philosophy/why-not-lgpl.html</a>&gt;.</p>
&lt;<a href="https://www.gnu.org/philosophy/why-not-lgpl.html">https://www.gnu.org/philosophy/why-not-lgpl.html</a>&gt;.</p>
<hr>
@ -2288,7 +2288,7 @@ licences.
<pre>
Copyright (c) 2012-2014 adjust GmbH,
http://www.adjust.com
https://www.adjust.com
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
@ -2320,7 +2320,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
<pre>
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
https://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
@ -3205,7 +3205,7 @@ publicity, privacy, or moral rights may limit how you use the material.
Copyright © Institute of the Estonian Language
E-mail: litsents@eki.ee
URL: http://www.eki.ee/tarkvara/
URL: https://www.eki.ee/tarkvara/
The present Licence Agreement gives the user of this Software Product
(hereinafter: Product) the right to use the Product for whatever purpose
@ -3523,7 +3523,7 @@ OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The contents of this file are taken from Apple80211.h from the iStumbler
project (http://www.istumbler.net). This project is released under the BSD
project (https://istumbler.net/). This project is released under the BSD
license with the following restrictions.
Copyright (c) 02006, Alf Watt (alf@istumbler.net). All rights reserved.
@ -3934,7 +3934,7 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<p>This license applies to all copies of jQuery in the code.</p>
<pre>
Copyright (c) 2010 John Resig, http://jquery.com/
Copyright (c) 2010 John Resig, https://jquery.com/
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
@ -4467,7 +4467,7 @@ SUCH DAMAGE.
Copyright JS Foundation and other contributors <https://js.foundation/>
Based on Underscore.js, copyright Jeremy Ashkenas,
DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>
DocumentCloud and Investigative Reporters & Editors <https://underscorejs.org/>
This software consists of voluntary contributions made by many
individuals. For exact contribution history, see the revision history
@ -4503,7 +4503,7 @@ Copyright and related rights for sample code are waived via CC0. Sample
code is defined as all source code displayed within the prose of the
documentation.
CC0: http://creativecommons.org/publicdomain/zero/1.0/
CC0: https://creativecommons.org/publicdomain/zero/1.0/
====
@ -6188,7 +6188,7 @@ THE SOFTWARE.
COPYRIGHT AND PERMISSION NOTICE
Copyright © 1991-2016 Unicode, Inc. All rights reserved.
Distributed under the Terms of Use in http://www.unicode.org/copyright.html.
Distributed under the Terms of Use in https://www.unicode.org/copyright.html.
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Unicode data files and any associated documentation
@ -6269,7 +6269,7 @@ property of their respective owners.
# provided under other licenses, as set forth below.
#
# The BSD License
# http://opensource.org/licenses/bsd-license.php
# https://opensource.org/licenses/bsd-license.php
# Copyright (C) 2006-2008, Google Inc.
#
# All rights reserved.
@ -6471,9 +6471,9 @@ property of their respective owners.
# Copyright (c) 2013 International Business Machines Corporation
# and others. All Rights Reserved.
#
# Project: http://code.google.com/p/lao-dictionary/
# Dictionary: http://lao-dictionary.googlecode.com/git/Lao-Dictionary.txt
# License: http://lao-dictionary.googlecode.com/git/Lao-Dictionary-LICENSE.txt
# Project: https://code.google.com/p/lao-dictionary/
# Dictionary: https://lao-dictionary.googlecode.com/git/Lao-Dictionary.txt
# License: https://lao-dictionary.googlecode.com/git/Lao-Dictionary-LICENSE.txt
# (copied below)
#
# This file is derived from the above dictionary, with slight
@ -7045,7 +7045,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
JPEG Group.</li>
<li>Portions of the OS/2 and Android versions
of this software are copyright &copy;1996-2012
<a href="http://www.freetype.org/">The FreeType Project</a>.
<a href="https://www.freetype.org/">The FreeType Project</a>.
All rights reserved.</li>
</ul>
@ -7060,17 +7060,17 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
this product:</p>
<ul>
<li>The <a href="http://www.zlib.net/">zlib</a> compression library
<li>The <a href="https://www.zlib.net/">zlib</a> compression library
(Jean-loup Gailly, Mark Adler and team)</li>
<li>The <a href="http://www.bzip.org/">bzip2</a> compression library
(Julian Seward)</li>
<li>The <a href="http://www.libpng.org/pub/png/">libpng</a> graphics library
(Glenn Randers-Pehrson and team)</li>
<li>The <a href="http://www.sqlite.org/">sqlite</a> database engine
<li>The <a href="https://www.sqlite.org/">sqlite</a> database engine
(D. Richard Hipp and team)</li>
<li>The <a href="http://nsis.sourceforge.net/">Nullsoft Scriptable Install System</a>
(Amir Szekely and team)</li>
<li>The <a href="http://mattmccutchen.net/bigint/">C++ Big Integer Library</a>
<li>The <a href="https://mattmccutchen.net/bigint/">C++ Big Integer Library</a>
(Matt McCutchen)</li>
</ul>
@ -7083,7 +7083,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<h1><a id="proprietary-notices"></a>Proprietary Operating System Components</h1>
<p>Under some circumstances, under our
<a href="http://www.mozilla.org/foundation/licensing/binary-components/">binary components policy</a>,
<a href="https://www.mozilla.org/foundation/licensing/binary-components/">binary components policy</a>,
Mozilla may decide to include additional
operating system vendor code with the installer of our products designed
for that vendor's proprietary platform, to make our products work well on

View File

@ -2748,7 +2748,7 @@ nsNativeThemeCocoa::ComputeScrollbarParams(nsIFrame* aFrame, bool aIsHorizontal)
// generally good enough for use cases of custom scrollbars.
if (!params.overlay) {
ComputedStyle* style = nsLayoutUtils::StyleForScrollbar(aFrame);
if (style->StyleUserInterface()->HasCustomScrollbars()) {
if (style->StyleUI()->HasCustomScrollbars()) {
params.custom = true;
params.trackColor =
GetScrollbarTrackColor(style, &GetAutoScrollbarTrackColor);

View File

@ -849,8 +849,7 @@ nscolor
nsNativeTheme::GetScrollbarFaceColor(ComputedStyle* aStyle,
AutoColorGetter aAutoGetter)
{
StyleComplexColor complexColor =
aStyle->StyleUserInterface()->mScrollbarFaceColor;
StyleComplexColor complexColor = aStyle->StyleUI()->mScrollbarFaceColor;
if (complexColor.IsAuto()) {
return aAutoGetter(aStyle);
}
@ -866,8 +865,7 @@ nscolor
nsNativeTheme::GetScrollbarTrackColor(ComputedStyle* aStyle,
AutoColorGetter aAutoGetter)
{
StyleComplexColor complexColor =
aStyle->StyleUserInterface()->mScrollbarTrackColor;
StyleComplexColor complexColor = aStyle->StyleUI()->mScrollbarTrackColor;
nscolor color;
if (complexColor.IsAuto()) {
color = aAutoGetter(aStyle);

View File

@ -1559,7 +1559,7 @@ nsNativeThemeWin::DrawWidgetBackground(gfxContext* aContext,
if (IsWidgetScrollbarPart(aWidgetType)) {
ComputedStyle* style = nsLayoutUtils::StyleForScrollbar(aFrame);
if (style->StyleUserInterface()->HasCustomScrollbars()) {
if (style->StyleUI()->HasCustomScrollbars()) {
return DrawCustomScrollbarPart(aContext, aFrame, style,
aWidgetType, aRect, aDirtyRect);
}
@ -3192,7 +3192,7 @@ nsresult nsNativeThemeWin::ClassicGetThemePartAndState(nsIFrame* aFrame, WidgetT
else {
if (contentState.HasAllStates(NS_EVENT_STATE_ACTIVE | NS_EVENT_STATE_HOVER)) {
aState |= DFCS_PUSHED;
const nsStyleUserInterface *uiData = aFrame->StyleUserInterface();
const nsStyleUI *uiData = aFrame->StyleUI();
// The down state is flat if the button is focusable
if (uiData->mUserFocus == StyleUserFocus::Normal) {
if (!aFrame->GetContent()->IsHTMLElement())
@ -4231,8 +4231,8 @@ nsNativeThemeWin::DrawCustomScrollbarPart(gfxContext* aContext,
const nsRect& aRect,
const nsRect& aClipRect)
{
MOZ_ASSERT(!aStyle->StyleUserInterface()->mScrollbarFaceColor.IsAuto() ||
!aStyle->StyleUserInterface()->mScrollbarTrackColor.IsAuto());
MOZ_ASSERT(!aStyle->StyleUI()->mScrollbarFaceColor.IsAuto() ||
!aStyle->StyleUI()->mScrollbarTrackColor.IsAuto());
gfxRect tr(aRect.X(), aRect.Y(), aRect.Width(), aRect.Height()),
dr(aClipRect.X(), aClipRect.Y(),