Merge mozilla-central to inbound

This commit is contained in:
arthur.iakab 2018-08-30 07:38:35 +03:00
Родитель cfd6ca43dd 044707fc78
Коммит b401573dfe
73 изменённых файлов: 517 добавлений и 397 удалений

Просмотреть файл

@ -83,9 +83,6 @@ tasks:
- "index.gecko.v2.${repository.project}.pushlog-id.${push.pushlog_id}.actions.${ownTaskId}"
else: # cron
- "index.gecko.v2.${repository.project}.latest.taskgraph.decision-${cron.job_name}"
- "index.gecko.v2.${repository.project}.revision.${push.revision}.taskgraph.decision-${cron.job_name}"
- "index.gecko.v2.${repository.project}.pushlog-id.${push.pushlog_id}.decision-${cron.job_name}"
# These are the old index routes for the decision task.
- "index.gecko.v2.${repository.project}.latest.firefox.decision-${cron.job_name}"
scopes:

Просмотреть файл

@ -14,28 +14,27 @@ function caretMoveChecker(target, caretOffset) {
}
async function checkURLBarCaretEvents() {
let url = "about:mozilla";
const kURL = "about:mozilla";
let newWin = await BrowserTestUtils.openNewBrowserWindow();
newWin.gBrowser.selectedBrowser.loadURI(kURL);
let onDocLoad = waitForEvent(
await waitForEvent(
EVENT_DOCUMENT_LOAD_COMPLETE,
event => {
try {
return event.accessible.QueryInterface(nsIAccessibleDocument).URL == url;
return event.accessible.QueryInterface(nsIAccessibleDocument).URL == kURL;
} catch (e) {
return false;
}
}
);
let [ newWin ] = await Promise.all([
BrowserTestUtils.openNewBrowserWindow({ url }),
onDocLoad
]);
info("Loaded " + kURL);
let urlbarInputEl = newWin.document.getElementById("urlbar").inputField;
let urlbarInput = getAccessible(urlbarInputEl, [ nsIAccessibleText ]);
let onCaretMove = waitForEvents([
[ EVENT_TEXT_CARET_MOVED, caretMoveChecker(urlbarInput, url.length) ],
[ EVENT_TEXT_CARET_MOVED, caretMoveChecker(urlbarInput, kURL.length) ],
[ EVENT_FOCUS, urlbarInput ]
]);

Просмотреть файл

@ -113,6 +113,12 @@ var CaptivePortalWatcher = {
}
let win = BrowserWindowTracker.getTopWindow();
// Used by tests: ignore the main test window in order to enable testing of
// the case where we have no open windows.
if (win && win.document.documentElement.getAttribute("ignorecaptiveportal")) {
win = null;
}
// If no browser window has focus, open and show the tab when we regain focus.
// This is so that if a different application was focused, when the user
// (re-)focuses a browser window, we open the tab immediately in that window
@ -136,6 +142,12 @@ var CaptivePortalWatcher = {
}
let win = BrowserWindowTracker.getTopWindow();
// Used by tests: ignore the main test window in order to enable testing of
// the case where we have no open windows.
if (win && win.document.documentElement.getAttribute("ignorecaptiveportal")) {
win = null;
}
if (win != Services.ww.activeWindow) {
// The window that got focused was not a browser window.
return;

Просмотреть файл

@ -4281,6 +4281,19 @@ function toOpenWindowByType(inType, uri, features) {
window.open(uri, "_blank", "chrome,extrachrome,menubar,resizable,scrollbars,status,toolbar");
}
/**
* Open a new browser window.
*
* @param {Object} options
* {
* private: A boolean indicating if the window should be
* private
* remote: A boolean indicating if the window should run
* remote browser tabs or not. If omitted, the window
* will choose the profile default state.
* }
* @return a reference to the new window.
*/
function OpenBrowserWindow(options) {
var telemetryObj = {};
TelemetryStopwatch.start("FX_NEW_WINDOW_MS", telemetryObj);

Просмотреть файл

@ -5268,6 +5268,10 @@ var TabContextMenu = {
let contextUnpinSelectedTabs = document.getElementById("context_unpinSelectedTabs");
contextUnpinSelectedTabs.hidden = !this.contextTab.pinned || !multiselectionContext;
// Hide the "Duplicate Tab" if there is a selection present
let contextDuplicateTab = document.getElementById("context_duplicateTab");
contextDuplicateTab.hidden = multiselectionContext;
// Disable "Close Tabs to the Right" if there are no tabs
// following it.
document.getElementById("context_closeTabsToTheEnd").disabled =

Просмотреть файл

@ -20,22 +20,13 @@ async function setupPrefsAndRecentWindowBehavior() {
// We need to test behavior when a portal is detected when there is no browser
// window, but we can't close the default window opened by the test harness.
// Instead, we deactivate CaptivePortalWatcher in the default window and
// exclude it from BrowserWindowTracker.getTopWindow in an attempt to
// mask its presence.
// exclude it using an attribute to mask its presence.
window.CaptivePortalWatcher.uninit();
let getTopWindowCopy = BrowserWindowTracker.getTopWindow;
let defaultWindow = window;
BrowserWindowTracker.getTopWindow = () => {
let win = getTopWindowCopy();
if (win == defaultWindow) {
return null;
}
return win;
};
window.document.documentElement.setAttribute("ignorecaptiveportal", "true");
registerCleanupFunction(function cleanUp() {
BrowserWindowTracker.getTopWindow = getTopWindowCopy;
window.CaptivePortalWatcher.init();
window.document.documentElement.removeAttribute("ignorecaptiveportal");
});
}

Просмотреть файл

@ -590,18 +590,24 @@ add_task(async function test_large_popup() {
// This test checks the same as the previous test but in a new smaller window.
add_task(async function test_large_popup_in_small_window() {
let newwin = await BrowserTestUtils.openNewBrowserWindow({ width: 400, height: 400 });
let newWin = await BrowserTestUtils.openNewBrowserWindow();
let resizePromise = BrowserTestUtils.waitForEvent(newWin, "resize", false, e => {
return newWin.innerHeight <= 400 && newWin.innerWidth <= 400;
});
newWin.resizeTo(400, 400);
await resizePromise;
const pageUrl = "data:text/html," + escape(PAGECONTENT_SMALL);
let browserLoadedPromise = BrowserTestUtils.browserLoaded(newwin.gBrowser.selectedBrowser);
await BrowserTestUtils.loadURI(newwin.gBrowser.selectedBrowser, pageUrl);
let browserLoadedPromise = BrowserTestUtils.browserLoaded(newWin.gBrowser.selectedBrowser);
await BrowserTestUtils.loadURI(newWin.gBrowser.selectedBrowser, pageUrl);
await browserLoadedPromise;
newwin.gBrowser.selectedBrowser.focus();
newWin.gBrowser.selectedBrowser.focus();
await performLargePopupTests(newwin);
await performLargePopupTests(newWin);
await BrowserTestUtils.closeWindow(newwin);
await BrowserTestUtils.closeWindow(newWin);
});
async function performSelectSearchTests(win) {

Просмотреть файл

@ -26,7 +26,8 @@ let createPrivateWindow = async function createPrivateWindow(url) {
gPrivateBrowser = gPrivateWindow.getBrowser().selectedBrowser;
BrowserTestUtils.loadURI(gPrivateBrowser, url);
await BrowserTestUtils.browserLoaded(gPrivateBrowser);
await BrowserTestUtils.browserLoaded(gPrivateBrowser, false, url);
info("loaded " + url);
};
add_task(async function test() {

Просмотреть файл

@ -19,11 +19,11 @@ add_task(async function testAdoptedTwoWindows() {
// being adopted from the main window which doesn't have a shown sidebar. See Bug 1407737.
info("Ensure that sidebar state is adopted only from the opener");
let win1 = await BrowserTestUtils.openNewBrowserWindow({opener: window});
let win1 = await BrowserTestUtils.openNewBrowserWindow();
await win1.SidebarUI.show("viewBookmarksSidebar");
await BrowserTestUtils.closeWindow(win1);
let win2 = await BrowserTestUtils.openNewBrowserWindow({opener: window});
let win2 = await BrowserTestUtils.openNewBrowserWindow();
ok(!win2.document.getElementById("sidebar-button").hasAttribute("checked"), "Sidebar button isn't checked");
ok(!win2.SidebarUI.isOpen, "Sidebar is closed");
await BrowserTestUtils.closeWindow(win2);
@ -46,7 +46,7 @@ add_task(async function testEventReceivedInNewWindow() {
info("Opening a new window and expecting the SidebarFocused event to not fire");
let promiseNewWindow = BrowserTestUtils.waitForNewWindow();
BrowserTestUtils.openNewBrowserWindow({opener: window});
BrowserTestUtils.openNewBrowserWindow();
let win = await promiseNewWindow;
let adoptedShown = BrowserTestUtils.waitForEvent(win, "SidebarShown");

Просмотреть файл

@ -27,6 +27,7 @@ support-files =
[browser_multiselect_tabs_close_using_shortcuts.js]
[browser_multiselect_tabs_close.js]
[browser_multiselect_tabs_copy_through_drag_and_drop.js]
[browser_multiselect_tabs_duplicate.js]
[browser_multiselect_tabs_event.js]
[browser_multiselect_tabs_move_to_another_window_drag.js]
[browser_multiselect_tabs_move_to_new_window_contextmenu.js]

Просмотреть файл

@ -0,0 +1,48 @@
const PREF_MULTISELECT_TABS = "browser.tabs.multiselect";
add_task(async function setPref() {
await SpecialPowers.pushPrefEnv({
set: [[PREF_MULTISELECT_TABS, true]]
});
});
add_task(async function test() {
let tab1 = await addTab();
let tab2 = await addTab();
let tab3 = await addTab();
let menuItemDuplicateTab = document.getElementById("context_duplicateTab");
is(gBrowser.multiSelectedTabsCount, 0, "Zero multiselected tabs");
await BrowserTestUtils.switchTab(gBrowser, tab1);
await triggerClickOn(tab2, { ctrlKey: true });
ok(tab1.multiselected, "Tab1 is multiselected");
ok(tab2.multiselected, "Tab2 is multiselected");
ok(!tab3.multiselected, "Tab3 is not multiselected");
// Check the context menu with a multiselected tabs
updateTabContextMenu(tab2);
is(menuItemDuplicateTab.hidden, true, "Duplicate Tab is hidden");
// Check the context menu with a non-multiselected tab
updateTabContextMenu(tab3);
is(menuItemDuplicateTab.hidden, false, "Duplicate Tab is visible");
let newTabOpened = BrowserTestUtils.waitForNewTab(gBrowser, "http://mochi.test:8888/");
window.TabContextMenu.contextTab = tab3; // Set proper context for command handler
menuItemDuplicateTab.click();
let tab4 = await newTabOpened;
// Selection should be cleared after duplication
ok(!tab1.multiselected, "Tab1 is not multiselected");
ok(!tab2.multiselected, "Tab2 is not multiselected");
ok(!tab4.multiselected, "Tab3 is not multiselected");
ok(!tab3.multiselected, "Tab4 is not multiselected");
BrowserTestUtils.removeTab(tab1);
BrowserTestUtils.removeTab(tab2);
BrowserTestUtils.removeTab(tab3);
BrowserTestUtils.removeTab(tab4);
});

Просмотреть файл

@ -1,4 +1,6 @@
/* eslint-disable mozilla/no-arbitrary-setTimeout */
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// The purpose of this test is to test the urlbar popup's add-on iframe. It has
@ -133,13 +135,14 @@ add_task(async function() {
// urlbar.setPanelHeight
let newHeight = height + 100;
await promiseUrlbarFunctionCall("setPanelHeight", newHeight);
await new Promise(resolve => {
// The height change is animated, so give it time to complete. Again, wait
// a sec to be safe.
setTimeout(resolve, 1000);
// The height change is animated, so give it time to complete.
await TestUtils.waitForCondition(
() => Math.round(iframe.getBoundingClientRect().height) == newHeight,
"Wait for panel height change after setPanelHeight"
).catch(ex => {
info("Last detected height: " + Math.round(iframe.getBoundingClientRect().height));
throw ex;
});
Assert.equal(iframe.getBoundingClientRect().height, newHeight,
"setPanelHeight");
});
function promiseIframeLoad() {

Просмотреть файл

@ -93,6 +93,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
this.inputField.addEventListener("overflow", this);
this.inputField.addEventListener("underflow", this);
this.inputField.addEventListener("scrollend", this);
window.addEventListener("resize", this);
var textBox = document.getAnonymousElementByAttribute(this,
"anonid", "moz-input-box");
@ -158,6 +159,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
this.inputField.removeEventListener("overflow", this);
this.inputField.removeEventListener("underflow", this);
this.inputField.removeEventListener("scrollend", this);
window.removeEventListener("resize", this);
if (this._deferredKeyEventTimeout) {
clearTimeout(this._deferredKeyEventTimeout);
@ -511,7 +513,19 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
</method>
<field name="_formattingEnabled">true</field>
<!--
If the input value is a URL, the input is not focused, and formatting is
enabled, this method highlights the domain, and if mixed content is
present, it crosses out the https scheme. It also ensures that the host
is visible (not scrolled out of sight). Otherwise it removes formatting.
@param onlyEnsureFormattedHostVisible
Pass true to skip formatting and instead only ensure that the
host is visible.
-->
<method name="formatValue">
<parameter name="onlyEnsureFormattedHostVisible"/>
<body><![CDATA[
// Used to avoid re-entrance in async callbacks.
let instance = this._formattingInstance = {};
@ -519,18 +533,21 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
if (!this.editor)
return;
// Cleanup previously set styles.
this.scheme.value = "";
let controller, strikeOut, selection;
if (this._formattingEnabled) {
controller = this.editor.selectionController;
strikeOut = controller.getSelection(controller.SELECTION_URLSTRIKEOUT);
strikeOut.removeAllRanges();
selection = controller.getSelection(controller.SELECTION_URLSECONDARY);
selection.removeAllRanges();
this.formatScheme(controller.SELECTION_URLSTRIKEOUT, true);
this.formatScheme(controller.SELECTION_URLSECONDARY, true);
this.inputField.style.setProperty("--urlbar-scheme-size", "0px");
if (!onlyEnsureFormattedHostVisible) {
// Cleanup previously set styles.
this.scheme.value = "";
if (this._formattingEnabled) {
controller = this.editor.selectionController;
strikeOut = controller.getSelection(controller.SELECTION_URLSTRIKEOUT);
strikeOut.removeAllRanges();
selection = controller.getSelection(controller.SELECTION_URLSECONDARY);
selection.removeAllRanges();
this.formatScheme(controller.SELECTION_URLSTRIKEOUT, true);
this.formatScheme(controller.SELECTION_URLSECONDARY, true);
this.inputField.style.setProperty("--urlbar-scheme-size", "0px");
}
}
let textNode = this.editor.rootElement.firstChild;
@ -599,7 +616,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
}
});
if (!this._formattingEnabled)
if (onlyEnsureFormattedHostVisible || !this._formattingEnabled)
return;
this.formatScheme(controller.SELECTION_URLSECONDARY);
@ -1434,6 +1451,29 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Ensure to clear those internal caches when switching tabs.
this.controller.resetInternalState();
break;
case "resize":
// Make sure the host remains visible in the input field when the
// window is resized. We don't want to hurt resize performance,
// though, so do this only after resize events have stopped and a
// small timeout has elapsed.
if (aEvent.target == window) {
if (this._resizeThrottleTimeout) {
clearTimeout(this._resizeThrottleTimeout);
}
this._resizeThrottleTimeout = setTimeout(() => {
this._resizeThrottleTimeout = null;
// Close the popup since it would be wrongly sized, we'll
// recalculate a proper size on reopening. For example, this
// may happen when using special OS resize functions like
// Win+Arrow.
this.closePopup();
// Make the host visible via formatValue.
this.formatValue(true);
}, 100);
}
break;
}
]]></body>
</method>

Просмотреть файл

@ -42,7 +42,7 @@ add_task(async function() {
is(SidebarUI.currentID, "viewHistorySidebar", "Selected sidebar remembered");
await hideSidebar();
let otherWin = await BrowserTestUtils.openNewBrowserWindow({opener: window});
let otherWin = await BrowserTestUtils.openNewBrowserWindow();
await showSidebar(otherWin);
is(otherWin.SidebarUI.currentID, "viewHistorySidebar", "Selected sidebar remembered across windows");
await hideSidebar(otherWin);

Просмотреть файл

@ -48,7 +48,7 @@ add_task(async function sidebar_windows() {
// SidebarUI relies on window.opener being set, which is normal behavior when
// using menu or key commands to open a new browser window.
let win = await BrowserTestUtils.openNewBrowserWindow({opener: window});
let win = await BrowserTestUtils.openNewBrowserWindow();
await secondSidebar;
ok(!win.document.getElementById("sidebar-box").hidden, "sidebar box is visible in second window");

Просмотреть файл

@ -17,8 +17,7 @@ function promiseTestOpenCloseWindow(aIsPrivate, aTest) {
return (async function() {
let win = await BrowserTestUtils.openNewBrowserWindow({ "private": aIsPrivate });
win.gBrowser.selectedBrowser.loadURI(aTest.url);
await promiseBrowserLoaded(win.gBrowser.selectedBrowser);
await Promise.resolve();
await promiseBrowserLoaded(win.gBrowser.selectedBrowser, true, aTest.url);
// Mark the window with some unique data to be restored later on.
ss.setWindowValue(win, aTest.key, aTest.value);
await TabStateFlusher.flushWindow(win);

Просмотреть файл

@ -319,7 +319,7 @@ nsDocShell::nsDocShell()
, mChromeEventHandler(nullptr)
, mDefaultScrollbarPref(Scrollbar_Auto, Scrollbar_Auto)
, mCharsetReloadState(eCharsetReloadInit)
, mOrientationLock(eScreenOrientation_None)
, mOrientationLock(hal::eScreenOrientation_None)
, mParentCharsetSource(0)
, mMarginWidth(-1)
, mMarginHeight(-1)
@ -2029,14 +2029,14 @@ nsDocShell::SetFullscreenAllowed(bool aFullscreenAllowed)
return NS_OK;
}
ScreenOrientationInternal
hal::ScreenOrientation
nsDocShell::OrientationLock()
{
return mOrientationLock;
}
void
nsDocShell::SetOrientationLock(ScreenOrientationInternal aOrientationLock)
nsDocShell::SetOrientationLock(hal::ScreenOrientation aOrientationLock)
{
mOrientationLock = aOrientationLock;
}
@ -10161,15 +10161,16 @@ nsDocShell::InternalLoad(nsIURI* aURI,
// lock the orientation of the document to the document's default
// orientation. We don't explicitly check for a top-level browsing context
// here because orientation is only set on top-level browsing contexts.
if (OrientationLock() != eScreenOrientation_None) {
if (OrientationLock() != hal::eScreenOrientation_None) {
#ifdef DEBUG
nsCOMPtr<nsIDocShellTreeItem> parent;
GetSameTypeParent(getter_AddRefs(parent));
MOZ_ASSERT(!parent);
#endif
SetOrientationLock(eScreenOrientation_None);
SetOrientationLock(hal::eScreenOrientation_None);
if (mIsActive) {
ScreenOrientation::UpdateActiveOrientationLock(eScreenOrientation_None);
ScreenOrientation::UpdateActiveOrientationLock(
hal::eScreenOrientation_None);
}
}

Просмотреть файл

@ -8,6 +8,7 @@
#define nsDocShell_h__
#include "mozilla/BasePrincipal.h"
#include "mozilla/HalScreenConfiguration.h"
#include "mozilla/LinkedList.h"
#include "mozilla/Maybe.h"
#include "mozilla/Move.h"
@ -69,7 +70,6 @@ namespace dom {
class ClientInfo;
class ClientSource;
class EventTarget;
typedef uint32_t ScreenOrientationInternal;
} // namespace dom
} // namespace mozilla
@ -1019,9 +1019,7 @@ private: // data members
eCharsetReloadState mCharsetReloadState;
// The orientation lock as described by
// https://w3c.github.io/screen-orientation/
mozilla::dom::ScreenOrientationInternal mOrientationLock;
mozilla::hal::ScreenOrientation mOrientationLock;
int32_t mParentCharsetSource;
int32_t mMarginWidth;

Просмотреть файл

@ -12,6 +12,7 @@
#include "nsFocusManager.h"
#include "nsLayoutUtils.h"
#include "nsSVGUtils.h"
#include "nsWindowSizes.h"
namespace mozilla {
namespace dom {
@ -26,6 +27,36 @@ DocumentOrShadowRoot::DocumentOrShadowRoot(nsIDocument& aDoc)
, mKind(Kind::Document)
{}
void
DocumentOrShadowRoot::AddSizeOfOwnedSheetArrayExcludingThis(
nsWindowSizes& aSizes,
const nsTArray<RefPtr<StyleSheet>>& aSheets) const
{
size_t n = 0;
n += aSheets.ShallowSizeOfExcludingThis(aSizes.mState.mMallocSizeOf);
for (StyleSheet* sheet : aSheets) {
if (!sheet->GetAssociatedDocumentOrShadowRoot()) {
// Avoid over-reporting shared sheets.
continue;
}
n += sheet->SizeOfIncludingThis(aSizes.mState.mMallocSizeOf);
}
if (mKind == Kind::ShadowRoot) {
aSizes.mLayoutShadowDomStyleSheetsSize += n;
} else {
aSizes.mLayoutStyleSheetsSize += n;
}
}
void
DocumentOrShadowRoot::AddSizeOfExcludingThis(nsWindowSizes& aSizes) const
{
AddSizeOfOwnedSheetArrayExcludingThis(aSizes, mStyleSheets);
aSizes.mDOMOtherSize +=
mIdentifierMap.SizeOfExcludingThis(aSizes.mState.mMallocSizeOf);
}
DocumentOrShadowRoot::~DocumentOrShadowRoot()
{
for (StyleSheet* sheet : mStyleSheets) {

Просмотреть файл

@ -15,6 +15,7 @@
class nsContentList;
class nsIDocument;
class nsINode;
class nsWindowSizes;
namespace mozilla {
class StyleSheet;
@ -190,6 +191,11 @@ protected:
already_AddRefed<StyleSheet> RemoveSheet(StyleSheet& aSheet);
void InsertSheetAt(size_t aIndex, StyleSheet& aSheet);
void AddSizeOfExcludingThis(nsWindowSizes&) const;
void AddSizeOfOwnedSheetArrayExcludingThis(
nsWindowSizes&,
const nsTArray<RefPtr<StyleSheet>>&) const;
nsIContent* Retarget(nsIContent* aContent) const;
/**

Просмотреть файл

@ -34,34 +34,34 @@ NS_IMPL_ADDREF_INHERITED(ScreenOrientation, DOMEventTargetHelper)
NS_IMPL_RELEASE_INHERITED(ScreenOrientation, DOMEventTargetHelper)
static OrientationType
InternalOrientationToType(ScreenOrientationInternal aOrientation)
InternalOrientationToType(hal::ScreenOrientation aOrientation)
{
switch (aOrientation) {
case eScreenOrientation_PortraitPrimary:
case hal::eScreenOrientation_PortraitPrimary:
return OrientationType::Portrait_primary;
case eScreenOrientation_PortraitSecondary:
case hal::eScreenOrientation_PortraitSecondary:
return OrientationType::Portrait_secondary;
case eScreenOrientation_LandscapePrimary:
case hal::eScreenOrientation_LandscapePrimary:
return OrientationType::Landscape_primary;
case eScreenOrientation_LandscapeSecondary:
case hal::eScreenOrientation_LandscapeSecondary:
return OrientationType::Landscape_secondary;
default:
MOZ_CRASH("Bad aOrientation value");
}
}
static ScreenOrientationInternal
static hal::ScreenOrientation
OrientationTypeToInternal(OrientationType aOrientation)
{
switch (aOrientation) {
case OrientationType::Portrait_primary:
return eScreenOrientation_PortraitPrimary;
return hal::eScreenOrientation_PortraitPrimary;
case OrientationType::Portrait_secondary:
return eScreenOrientation_PortraitSecondary;
return hal::eScreenOrientation_PortraitSecondary;
case OrientationType::Landscape_primary:
return eScreenOrientation_LandscapePrimary;
return hal::eScreenOrientation_LandscapePrimary;
case OrientationType::Landscape_secondary:
return eScreenOrientation_LandscapeSecondary;
return hal::eScreenOrientation_LandscapeSecondary;
default:
MOZ_CRASH("Bad aOrientation value");
}
@ -121,7 +121,7 @@ public:
LockOrientationTask(ScreenOrientation* aScreenOrientation,
Promise* aPromise,
ScreenOrientationInternal aOrientationLock,
hal::ScreenOrientation aOrientationLock,
nsIDocument* aDocument,
bool aIsFullScreen);
protected:
@ -129,7 +129,7 @@ protected:
RefPtr<ScreenOrientation> mScreenOrientation;
RefPtr<Promise> mPromise;
ScreenOrientationInternal mOrientationLock;
hal::ScreenOrientation mOrientationLock;
nsCOMPtr<nsIDocument> mDocument;
bool mIsFullScreen;
};
@ -138,7 +138,7 @@ NS_IMPL_ISUPPORTS(ScreenOrientation::LockOrientationTask, nsIRunnable)
ScreenOrientation::LockOrientationTask::LockOrientationTask(
ScreenOrientation* aScreenOrientation, Promise* aPromise,
ScreenOrientationInternal aOrientationLock,
hal::ScreenOrientation aOrientationLock,
nsIDocument* aDocument, bool aIsFullScreen)
: mScreenOrientation(aScreenOrientation), mPromise(aPromise),
mOrientationLock(aOrientationLock), mDocument(aDocument),
@ -180,7 +180,7 @@ ScreenOrientation::LockOrientationTask::Run()
return NS_OK;
}
if (mOrientationLock == eScreenOrientation_None) {
if (mOrientationLock == hal::eScreenOrientation_None) {
mScreenOrientation->UnlockDeviceOrientation();
mPromise->MaybeResolveWithUndefined();
mDocument->SetOrientationPendingPromise(nullptr);
@ -201,7 +201,7 @@ ScreenOrientation::LockOrientationTask::Run()
}
if (OrientationLockContains(mDocument->CurrentOrientationType()) ||
(mOrientationLock == eScreenOrientation_Default &&
(mOrientationLock == hal::eScreenOrientation_Default &&
mDocument->CurrentOrientationAngle() == 0)) {
// Orientation lock will not cause an orientation change.
mPromise->MaybeResolveWithUndefined();
@ -214,37 +214,37 @@ ScreenOrientation::LockOrientationTask::Run()
already_AddRefed<Promise>
ScreenOrientation::Lock(OrientationLockType aOrientation, ErrorResult& aRv)
{
ScreenOrientationInternal orientation = eScreenOrientation_None;
hal::ScreenOrientation orientation = hal::eScreenOrientation_None;
switch (aOrientation) {
case OrientationLockType::Any:
orientation = eScreenOrientation_PortraitPrimary |
eScreenOrientation_PortraitSecondary |
eScreenOrientation_LandscapePrimary |
eScreenOrientation_LandscapeSecondary;
orientation = hal::eScreenOrientation_PortraitPrimary |
hal::eScreenOrientation_PortraitSecondary |
hal::eScreenOrientation_LandscapePrimary |
hal::eScreenOrientation_LandscapeSecondary;
break;
case OrientationLockType::Natural:
orientation |= eScreenOrientation_Default;
orientation |= hal::eScreenOrientation_Default;
break;
case OrientationLockType::Landscape:
orientation = eScreenOrientation_LandscapePrimary |
eScreenOrientation_LandscapeSecondary;
orientation = hal::eScreenOrientation_LandscapePrimary |
hal::eScreenOrientation_LandscapeSecondary;
break;
case OrientationLockType::Portrait:
orientation = eScreenOrientation_PortraitPrimary |
eScreenOrientation_PortraitSecondary;
orientation = hal::eScreenOrientation_PortraitPrimary |
hal::eScreenOrientation_PortraitSecondary;
break;
case OrientationLockType::Portrait_primary:
orientation = eScreenOrientation_PortraitPrimary;
orientation = hal::eScreenOrientation_PortraitPrimary;
break;
case OrientationLockType::Portrait_secondary:
orientation = eScreenOrientation_PortraitSecondary;
orientation = hal::eScreenOrientation_PortraitSecondary;
break;
case OrientationLockType::Landscape_primary:
orientation = eScreenOrientation_LandscapePrimary;
orientation = hal::eScreenOrientation_LandscapePrimary;
break;
case OrientationLockType::Landscape_secondary:
orientation = eScreenOrientation_LandscapeSecondary;
orientation = hal::eScreenOrientation_LandscapeSecondary;
break;
default:
NS_WARNING("Unexpected orientation type");
@ -283,7 +283,8 @@ AbortOrientationPromises(nsIDocShell* aDocShell)
}
already_AddRefed<Promise>
ScreenOrientation::LockInternal(ScreenOrientationInternal aOrientation, ErrorResult& aRv)
ScreenOrientation::LockInternal(hal::ScreenOrientation aOrientation,
ErrorResult& aRv)
{
// Steps to apply an orientation lock as defined in spec.
@ -349,7 +350,7 @@ ScreenOrientation::LockInternal(ScreenOrientationInternal aOrientation, ErrorRes
}
bool
ScreenOrientation::LockDeviceOrientation(ScreenOrientationInternal aOrientation,
ScreenOrientation::LockDeviceOrientation(hal::ScreenOrientation aOrientation,
bool aIsFullScreen, ErrorResult& aRv)
{
if (!GetOwner()) {
@ -389,7 +390,7 @@ ScreenOrientation::LockDeviceOrientation(ScreenOrientationInternal aOrientation,
void
ScreenOrientation::Unlock(ErrorResult& aRv)
{
RefPtr<Promise> p = LockInternal(eScreenOrientation_None, aRv);
RefPtr<Promise> p = LockInternal(hal::eScreenOrientation_None, aRv);
}
void
@ -514,11 +515,11 @@ ScreenOrientation::Notify(const hal::ScreenConfiguration& aConfiguration)
return;
}
ScreenOrientationInternal orientation = aConfiguration.orientation();
if (orientation != eScreenOrientation_PortraitPrimary &&
orientation != eScreenOrientation_PortraitSecondary &&
orientation != eScreenOrientation_LandscapePrimary &&
orientation != eScreenOrientation_LandscapeSecondary) {
hal::ScreenOrientation orientation = aConfiguration.orientation();
if (orientation != hal::eScreenOrientation_PortraitPrimary &&
orientation != hal::eScreenOrientation_PortraitSecondary &&
orientation != hal::eScreenOrientation_LandscapePrimary &&
orientation != hal::eScreenOrientation_LandscapeSecondary) {
// The platform may notify of some other values from
// an orientation lock, but we only care about real
// changes to screen orientation which result in one of
@ -564,9 +565,10 @@ ScreenOrientation::Notify(const hal::ScreenConfiguration& aConfiguration)
}
void
ScreenOrientation::UpdateActiveOrientationLock(ScreenOrientationInternal aOrientation)
ScreenOrientation::UpdateActiveOrientationLock(
hal::ScreenOrientation aOrientation)
{
if (aOrientation == eScreenOrientation_None) {
if (aOrientation == hal::eScreenOrientation_None) {
hal::UnlockScreenOrientation();
} else {
DebugOnly<bool> ok = hal::LockScreenOrientation(aOrientation);

Просмотреть файл

@ -18,18 +18,6 @@ namespace mozilla {
namespace dom {
class Promise;
// Make sure that any change to ScreenOrientationInternal values are
// also made in mobile/android/base/GeckoScreenOrientation.java
typedef uint32_t ScreenOrientationInternal;
static const ScreenOrientationInternal eScreenOrientation_None = 0;
static const ScreenOrientationInternal eScreenOrientation_PortraitPrimary = 1u << 0;
static const ScreenOrientationInternal eScreenOrientation_PortraitSecondary = 1u << 1;
static const ScreenOrientationInternal eScreenOrientation_LandscapePrimary = 1u << 2;
static const ScreenOrientationInternal eScreenOrientation_LandscapeSecondary = 1u << 3;
//eScreenOrientation_Default will use the natural orientation for the deivce,
//it could be PortraitPrimary or LandscapePrimary depends on display resolution
static const ScreenOrientationInternal eScreenOrientation_Default = 1u << 4;
class ScreenOrientation final : public DOMEventTargetHelper,
public mozilla::hal::ScreenConfigurationObserver
@ -63,7 +51,7 @@ public:
void Notify(const mozilla::hal::ScreenConfiguration& aConfiguration) override;
static void UpdateActiveOrientationLock(ScreenOrientationInternal aOrientation);
static void UpdateActiveOrientationLock(hal::ScreenOrientation aOrientation);
private:
virtual ~ScreenOrientation();
@ -86,7 +74,7 @@ private:
// This method calls into the HAL to lock the device and sets
// up listeners for full screen change.
bool LockDeviceOrientation(ScreenOrientationInternal aOrientation,
bool LockDeviceOrientation(hal::ScreenOrientation aOrientation,
bool aIsFullscreen, ErrorResult& aRv);
// This method calls in to the HAL to unlock the device and removes
@ -94,10 +82,10 @@ private:
void UnlockDeviceOrientation();
// This method performs the same function as |Lock| except it takes
// a ScreenOrientationInternal argument instead of an OrientationType.
// a hal::ScreenOrientation argument instead of an OrientationType.
// This method exists in order to share implementation with nsScreen that
// uses ScreenOrientationInternal.
already_AddRefed<Promise> LockInternal(ScreenOrientationInternal aOrientation,
// uses ScreenOrientation.
already_AddRefed<Promise> LockInternal(hal::ScreenOrientation aOrientation,
ErrorResult& aRv);
void DispatchChangeEvent();

Просмотреть файл

@ -10,10 +10,11 @@
#include "ChildIterator.h"
#include "nsContentUtils.h"
#include "nsIStyleSheetLinkingElement.h"
#include "nsWindowSizes.h"
#include "nsXBLPrototypeBinding.h"
#include "mozilla/dom/DirectionalityUtils.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/HTMLSlotElement.h"
#include "nsXBLPrototypeBinding.h"
#include "mozilla/EventDispatcher.h"
#include "mozilla/ServoStyleRuleMap.h"
#include "mozilla/StyleSheet.h"
@ -103,6 +104,21 @@ ShadowRoot::~ShadowRoot()
SetSubtreeRootPointer(this);
}
MOZ_DEFINE_MALLOC_SIZE_OF(ShadowRootAuthorStylesMallocSizeOf)
MOZ_DEFINE_MALLOC_ENCLOSING_SIZE_OF(ShadowRootAuthorStylesMallocEnclosingSizeOf)
void
ShadowRoot::AddSizeOfExcludingThis(nsWindowSizes& aSizes, size_t* aNodeSize) const
{
DocumentFragment::AddSizeOfExcludingThis(aSizes, aNodeSize);
DocumentOrShadowRoot::AddSizeOfExcludingThis(aSizes);
aSizes.mLayoutShadowDomAuthorStyles +=
Servo_AuthorStyles_SizeOfIncludingThis(
ShadowRootAuthorStylesMallocSizeOf,
ShadowRootAuthorStylesMallocEnclosingSizeOf,
mServoStyles.get());
}
JSObject*
ShadowRoot::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
{

Просмотреть файл

@ -55,6 +55,8 @@ public:
ShadowRoot(Element* aElement, ShadowRootMode aMode,
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
void AddSizeOfExcludingThis(nsWindowSizes&, size_t* aNodeSize) const final;
// Shadow DOM v1
Element* Host() const
{

Просмотреть файл

@ -11764,8 +11764,6 @@ nsIDocument::MaybeActiveMediaComponents()
/* virtual */ void
nsIDocument::DocAddSizeOfExcludingThis(nsWindowSizes& aSizes) const
{
nsINode::AddSizeOfExcludingThis(aSizes, &aSizes.mDOMOtherSize);
if (mPresShell) {
mPresShell->AddSizeOfIncludingThis(aSizes);
}
@ -11801,21 +11799,6 @@ nsIDocument::DocAddSizeOfIncludingThis(nsWindowSizes& aWindowSizes) const
DocAddSizeOfExcludingThis(aWindowSizes);
}
static size_t
SizeOfOwnedSheetArrayExcludingThis(const nsTArray<RefPtr<StyleSheet>>& aSheets,
MallocSizeOf aMallocSizeOf)
{
size_t n = 0;
n += aSheets.ShallowSizeOfExcludingThis(aMallocSizeOf);
for (StyleSheet* sheet : aSheets) {
if (!sheet->GetAssociatedDocumentOrShadowRoot()) {
// Avoid over-reporting shared sheets.
continue;
}
n += sheet->SizeOfIncludingThis(aMallocSizeOf);
}
return n;
}
void
nsDocument::AddSizeOfExcludingThis(nsWindowSizes& aSizes,
@ -11828,15 +11811,15 @@ nsDocument::AddSizeOfExcludingThis(nsWindowSizes& aSizes,
MOZ_CRASH();
}
static void
AddSizeOfNodeTree(nsIContent* aNode, nsWindowSizes& aWindowSizes)
/* static */ void
nsIDocument::AddSizeOfNodeTree(nsINode& aNode, nsWindowSizes& aWindowSizes)
{
size_t nodeSize = 0;
aNode->AddSizeOfIncludingThis(aWindowSizes, &nodeSize);
aNode.AddSizeOfIncludingThis(aWindowSizes, &nodeSize);
// This is where we transfer the nodeSize obtained from
// nsINode::AddSizeOfIncludingThis() to a value in nsWindowSizes.
switch (aNode->NodeType()) {
switch (aNode.NodeType()) {
case nsINode::ELEMENT_NODE:
aWindowSizes.mDOMElementNodesSize += nodeSize;
break;
@ -11854,30 +11837,50 @@ AddSizeOfNodeTree(nsIContent* aNode, nsWindowSizes& aWindowSizes)
break;
}
if (EventListenerManager* elm = aNode->GetExistingListenerManager()) {
if (EventListenerManager* elm = aNode.GetExistingListenerManager()) {
aWindowSizes.mDOMEventListenersCount += elm->ListenerCount();
}
AllChildrenIterator iter(aNode, nsIContent::eAllChildren);
for (nsIContent* n = iter.GetNextChild(); n; n = iter.GetNextChild()) {
AddSizeOfNodeTree(n, aWindowSizes);
if (aNode.IsContent()) {
nsTArray<nsIContent*> anonKids;
nsContentUtils::AppendNativeAnonymousChildren(aNode.AsContent(),
anonKids,
nsIContent::eAllChildren);
for (nsIContent* anonKid : anonKids) {
AddSizeOfNodeTree(*anonKid, aWindowSizes);
}
if (auto* element = Element::FromNode(aNode)) {
if (ShadowRoot* shadow = element->GetShadowRoot()) {
AddSizeOfNodeTree(*shadow, aWindowSizes);
}
for (nsXBLBinding* binding = element->GetXBLBinding();
binding;
binding = binding->GetBaseBinding()) {
if (nsIContent* anonContent = binding->GetAnonymousContent()) {
AddSizeOfNodeTree(*anonContent, aWindowSizes);
}
}
}
}
// NOTE(emilio): If you feel smart and want to change this function to use
// GetNextNode(), think twice, since you'd need to handle <xbl:content> in a
// sane way, and kids of <content> won't point to the parent, so we'd never
// find the root node where we should stop at.
for (nsIContent* kid = aNode.GetFirstChild(); kid; kid = kid->GetNextSibling()) {
AddSizeOfNodeTree(*kid, aWindowSizes);
}
}
void
nsDocument::DocAddSizeOfExcludingThis(nsWindowSizes& aWindowSizes) const
{
// We use AllChildrenIterator to iterate over DOM nodes in
// AddSizeOfNodeTree(). The obvious place to start is at the document's root
// element, using GetRootElement(). However, that will miss comment nodes
// that are siblings of the root element. Instead we use
// GetFirstChild()/GetNextSibling() to traverse the document's immediate
// child nodes, calling AddSizeOfNodeTree() on each to measure them and then
// all their descendants. (The comment nodes won't have any descendants).
for (nsIContent* node = nsINode::GetFirstChild();
node;
node = node->GetNextSibling()) {
AddSizeOfNodeTree(node, aWindowSizes);
nsINode::AddSizeOfExcludingThis(aWindowSizes, &aWindowSizes.mDOMOtherSize);
for (nsIContent* kid = GetFirstChild(); kid; kid = kid->GetNextSibling()) {
AddSizeOfNodeTree(*kid, aWindowSizes);
}
// IMPORTANT: for our ComputedValues measurements, we want to measure
@ -11889,13 +11892,9 @@ nsDocument::DocAddSizeOfExcludingThis(nsWindowSizes& aWindowSizes) const
// PresShell, which contains the frame tree.
nsIDocument::DocAddSizeOfExcludingThis(aWindowSizes);
aWindowSizes.mLayoutStyleSheetsSize +=
SizeOfOwnedSheetArrayExcludingThis(mStyleSheets,
aWindowSizes.mState.mMallocSizeOf);
DocumentOrShadowRoot::AddSizeOfExcludingThis(aWindowSizes);
for (auto& sheetArray : mAdditionalSheets) {
aWindowSizes.mLayoutStyleSheetsSize +=
SizeOfOwnedSheetArrayExcludingThis(sheetArray,
aWindowSizes.mState.mMallocSizeOf);
AddSizeOfOwnedSheetArrayExcludingThis(aWindowSizes, sheetArray);
}
// Lumping in the loader with the style-sheets size is not ideal,
// but most of the things in there are in fact stylesheets, so it
@ -11911,9 +11910,6 @@ nsDocument::DocAddSizeOfExcludingThis(nsWindowSizes& aWindowSizes) const
aWindowSizes.mDOMOtherSize +=
mStyledLinks.ShallowSizeOfExcludingThis(aWindowSizes.mState.mMallocSizeOf);
aWindowSizes.mDOMOtherSize +=
mIdentifierMap.SizeOfExcludingThis(aWindowSizes.mState.mMallocSizeOf);
// Measurement of the following members may be added later if DMD finds it
// is worthwhile:
// - many!

Просмотреть файл

@ -4425,6 +4425,7 @@ nsGlobalWindowInner::ResetVRTelemetry(bool aUpdate)
}
}
#ifndef XP_WIN // This guard should match the guard at the callsite.
static bool ShouldShowFocusRingIfFocusedByMouse(nsIContent* aNode)
{
if (!aNode) {
@ -4433,6 +4434,7 @@ static bool ShouldShowFocusRingIfFocusedByMouse(nsIContent* aNode)
return !nsContentUtils::ContentIsLink(aNode) &&
!aNode->IsAnyOfHTMLElements(nsGkAtoms::video, nsGkAtoms::audio);
}
#endif
void
nsGlobalWindowInner::SetFocusedElement(Element* aElement,

Просмотреть файл

@ -3017,6 +3017,10 @@ public:
bool IsSyntheticDocument() const { return mIsSyntheticDocument; }
// Adds the size of a given node, which must not be a document node, to the
// window sizes passed-in.
static void AddSizeOfNodeTree(nsINode&, nsWindowSizes&);
// Note: nsIDocument is a sub-class of nsINode, which has a
// SizeOfExcludingThis function. However, because nsIDocument objects can
// only appear at the top of the DOM tree, we have a specialized measurement

Просмотреть файл

@ -188,7 +188,7 @@ nsScreen::GetMozOrientation(nsString& aOrientation,
static void
UpdateDocShellOrientationLock(nsPIDOMWindowInner* aWindow,
ScreenOrientationInternal aOrientation)
hal::ScreenOrientation aOrientation)
{
if (!aWindow) {
return;
@ -228,27 +228,27 @@ nsScreen::MozLockOrientation(const Sequence<nsString>& aOrientations,
if (ShouldResistFingerprinting()) {
return false;
}
ScreenOrientationInternal orientation = eScreenOrientation_None;
hal::ScreenOrientation orientation = hal::eScreenOrientation_None;
for (uint32_t i = 0; i < aOrientations.Length(); ++i) {
const nsString& item = aOrientations[i];
if (item.EqualsLiteral("portrait")) {
orientation |= eScreenOrientation_PortraitPrimary |
eScreenOrientation_PortraitSecondary;
orientation |= hal::eScreenOrientation_PortraitPrimary |
hal::eScreenOrientation_PortraitSecondary;
} else if (item.EqualsLiteral("portrait-primary")) {
orientation |= eScreenOrientation_PortraitPrimary;
orientation |= hal::eScreenOrientation_PortraitPrimary;
} else if (item.EqualsLiteral("portrait-secondary")) {
orientation |= eScreenOrientation_PortraitSecondary;
orientation |= hal::eScreenOrientation_PortraitSecondary;
} else if (item.EqualsLiteral("landscape")) {
orientation |= eScreenOrientation_LandscapePrimary |
eScreenOrientation_LandscapeSecondary;
orientation |= hal::eScreenOrientation_LandscapePrimary |
hal::eScreenOrientation_LandscapeSecondary;
} else if (item.EqualsLiteral("landscape-primary")) {
orientation |= eScreenOrientation_LandscapePrimary;
orientation |= hal::eScreenOrientation_LandscapePrimary;
} else if (item.EqualsLiteral("landscape-secondary")) {
orientation |= eScreenOrientation_LandscapeSecondary;
orientation |= hal::eScreenOrientation_LandscapeSecondary;
} else if (item.EqualsLiteral("default")) {
orientation |= eScreenOrientation_Default;
orientation |= hal::eScreenOrientation_Default;
} else {
// If we don't recognize the token, we should just return 'false'
// without throwing.
@ -278,7 +278,7 @@ nsScreen::MozUnlockOrientation()
if (ShouldResistFingerprinting()) {
return;
}
UpdateDocShellOrientationLock(GetOwner(), eScreenOrientation_None);
UpdateDocShellOrientationLock(GetOwner(), hal::eScreenOrientation_None);
mScreenOrientation->UnlockDeviceOrientation();
}

Просмотреть файл

@ -353,7 +353,15 @@ CollectWindowReports(nsGlobalWindowInner *aWindow,
"other 'dom/' numbers.");
REPORT_SIZE("/layout/style-sheets", mLayoutStyleSheetsSize,
"Memory used by style sheets within a window.");
"Memory used by document style sheets within a window.");
REPORT_SIZE("/layout/shadow-dom/style-sheets", mLayoutShadowDomStyleSheetsSize,
"Memory used by Shadow DOM style sheets within a window.");
// TODO(emilio): We might want to split this up between invalidation map /
// element-and-pseudos / revalidation too just like the style set.
REPORT_SIZE("/layout/shadow-dom/author-styles", mLayoutShadowDomAuthorStyles,
"Memory used by Shadow DOM computed rule data within a window.");
REPORT_SIZE("/layout/pres-shell", mLayoutPresShellSize,
"Memory used by layout's PresShell, along with any structures "
@ -415,10 +423,6 @@ CollectWindowReports(nsGlobalWindowInner *aWindow,
REPORT_SIZE("/layout/computed-values/visited", mLayoutComputedValuesVisited,
"Memory used by ComputedValues objects used for visited styles.");
REPORT_SIZE("/layout/computed-values/stale", mLayoutComputedValuesStale,
"Memory used by ComputedValues and style structs it holds that "
"is no longer used but still alive.");
REPORT_SIZE("/property-tables", mPropertyTablesSize,
"Memory used for the property tables within a window.");

Просмотреть файл

@ -167,6 +167,8 @@ class nsWindowSizes
macro(DOM, mDOMPerformanceResourceEntries) \
macro(DOM, mDOMOtherSize) \
macro(Style, mLayoutStyleSheetsSize) \
macro(Style, mLayoutShadowDomStyleSheetsSize) \
macro(Style, mLayoutShadowDomAuthorStyles) \
macro(Other, mLayoutPresShellSize) \
macro(Style, mLayoutStyleSetsStylistRuleTree) \
macro(Style, mLayoutStyleSetsStylistElementAndPseudosMaps) \
@ -181,7 +183,6 @@ class nsWindowSizes
macro(Style, mLayoutComputedValuesDom) \
macro(Style, mLayoutComputedValuesNonDom) \
macro(Style, mLayoutComputedValuesVisited) \
macro(Style, mLayoutComputedValuesStale) \
macro(Other, mPropertyTablesSize) \
macro(Other, mBindingsSize) \

Просмотреть файл

@ -17,6 +17,7 @@
#include "nsIWebProgress.h"
#include "nsIWebProgressListener.h"
#include "nsIWindowWatcher.h"
#include "nsIXPConnect.h"
#include "nsNetUtil.h"
#include "nsPIDOMWindow.h"
#include "nsPIWindowWatcher.h"

Просмотреть файл

@ -6,6 +6,8 @@
#include "ClientPrefs.h"
#include "mozilla/Preferences.h"
namespace mozilla {
namespace dom {

Просмотреть файл

@ -211,8 +211,15 @@ GamepadManager::GetGamepad(uint32_t aIndex) const
return nullptr;
}
already_AddRefed<Gamepad>
GamepadManager::GetGamepad(uint32_t aGamepadId, GamepadServiceType aServiceType) const
{
return GetGamepad(GetGamepadIndexWithServiceType(aGamepadId, aServiceType));
}
uint32_t GamepadManager::GetGamepadIndexWithServiceType(uint32_t aIndex,
GamepadServiceType aServiceType)
GamepadServiceType aServiceType) const
{
uint32_t newIndex = 0;

Просмотреть файл

@ -60,6 +60,9 @@ class GamepadManager final : public nsIObserver
// Returns gamepad object if index exists, null otherwise
already_AddRefed<Gamepad> GetGamepad(uint32_t aIndex) const;
// Returns gamepad object if GamepadId exists, null otherwise
already_AddRefed<Gamepad> GetGamepad(uint32_t aGamepadId, GamepadServiceType aServiceType) const;
// Receive GamepadChangeEvent messages from parent process to fire DOM events
void Update(const GamepadChangeEvent& aGamepadEvent);
@ -132,7 +135,7 @@ class GamepadManager final : public nsIObserver
bool aHasSeen = true);
// Our gamepad index has VR_GAMEPAD_IDX_OFFSET while GamepadChannelType
// is from VRManager.
uint32_t GetGamepadIndexWithServiceType(uint32_t aIndex, GamepadServiceType aServiceType);
uint32_t GetGamepadIndexWithServiceType(uint32_t aIndex, GamepadServiceType aServiceType) const;
// Gamepads connected to the system. Copies of these are handed out
// to each window.

Просмотреть файл

@ -24,7 +24,7 @@ using CSSToLayoutDeviceScale from "Units.h";
using CSSRect from "Units.h";
using CSSSize from "Units.h";
using mozilla::LayoutDeviceIntPoint from "Units.h";
using mozilla::dom::ScreenOrientationInternal from "mozilla/dom/ScreenOrientation.h";
using hal::ScreenOrientation from "mozilla/HalScreenConfiguration.h";
using struct mozilla::layers::TextureFactoryIdentifier from "mozilla/layers/CompositorTypes.h";
using mozilla::layers::CompositorOptions from "mozilla/layers/CompositorOptions.h";
using mozilla::layers::LayersId from "mozilla/layers/LayersTypes.h";
@ -100,7 +100,7 @@ struct DimensionInfo
{
CSSRect rect;
CSSSize size;
ScreenOrientationInternal orientation;
ScreenOrientation orientation;
LayoutDeviceIntPoint clientOffset;
LayoutDeviceIntPoint chromeOffset;
};

Просмотреть файл

@ -408,7 +408,7 @@ TabChild::TabChild(nsIContentChild* aManager,
, mDidFakeShow(false)
, mNotified(false)
, mTriedBrowserInit(false)
, mOrientation(eScreenOrientation_PortraitPrimary)
, mOrientation(hal::eScreenOrientation_PortraitPrimary)
, mIgnoreKeyPressEvent(false)
, mHasValidInnerSize(false)
, mDestroyed(false)

Просмотреть файл

@ -477,7 +477,7 @@ public:
mMaxTouchPoints = aMaxTouchPoints;
}
ScreenOrientationInternal GetOrientation() const { return mOrientation; }
hal::ScreenOrientation GetOrientation() const { return mOrientation; }
void SetBackgroundColor(const nscolor& aColor);
@ -828,7 +828,7 @@ private:
bool mDidFakeShow;
bool mNotified;
bool mTriedBrowserInit;
ScreenOrientationInternal mOrientation;
hal::ScreenOrientation mOrientation;
bool mIgnoreKeyPressEvent;
RefPtr<APZEventState> mAPZEventState;

Просмотреть файл

@ -769,7 +769,7 @@ TabParent::UpdateDimensions(const nsIntRect& rect, const ScreenIntSize& size)
hal::ScreenConfiguration config;
hal::GetCurrentScreenConfiguration(&config);
ScreenOrientationInternal orientation = config.orientation();
hal::ScreenOrientation orientation = config.orientation();
LayoutDeviceIntPoint clientOffset = GetClientOffset();
LayoutDeviceIntPoint chromeOffset = -GetChildProcessOffset();

Просмотреть файл

@ -637,7 +637,7 @@ protected:
nsIntRect mRect;
ScreenIntSize mDimensions;
ScreenOrientationInternal mOrientation;
hal::ScreenOrientation mOrientation;
float mDPI;
int32_t mRounding;
CSSToLayoutDeviceScale mDefaultScale;

Просмотреть файл

@ -43,12 +43,16 @@ async function waitContentVisibilityChange(aIsHidden, aBrowser) {
*/
add_task(async function() {
info("creating test window");
let winTest = await BrowserTestUtils.openNewBrowserWindow();
// Specify the width, height, left and top, so that the new window can be
// fully covered by "window".
let winTest = await BrowserTestUtils.openNewBrowserWindow({ width: 500,
height: 500,
left: 200,
top: 200 });
let resizePromise = BrowserTestUtils.waitForEvent(winTest, "resize", false, e => {
return winTest.innerHeight <= 500 && winTest.innerWidth <= 500;
});
winTest.moveTo(200, 200);
winTest.resizeTo(500, 500);
await resizePromise;
let browserTest = winTest.gBrowser;
info(`loading test page: ${testPageURL}`);

Просмотреть файл

@ -10,7 +10,6 @@
#include "gfxPrefs.h" // for gfxPrefs::LayersTile...
#include "mozilla/Assertions.h" // for MOZ_ASSERT, etc
#include "mozilla/Hal.h"
#include "mozilla/dom/ScreenOrientation.h" // for ScreenOrientation
#include "mozilla/dom/TabChild.h" // for TabChild
#include "mozilla/dom/TabGroup.h" // for TabGroup
#include "mozilla/hal_sandbox/PHal.h" // for ScreenConfiguration
@ -213,7 +212,7 @@ ClientLayerManager::BeginTransactionWithTarget(gfxContext* aTarget)
// If the last transaction was incomplete (a failed DoEmptyTransaction),
// don't signal a new transaction to ShadowLayerForwarder. Carry on adding
// to the previous transaction.
dom::ScreenOrientationInternal orientation;
hal::ScreenOrientation orientation;
if (dom::TabChild* window = mWidget->GetOwningTabChild()) {
orientation = window->GetOrientation();
} else {

Просмотреть файл

@ -55,10 +55,10 @@ namespace layers {
using namespace mozilla::gfx;
static bool
IsSameDimension(dom::ScreenOrientationInternal o1, dom::ScreenOrientationInternal o2)
IsSameDimension(hal::ScreenOrientation o1, hal::ScreenOrientation o2)
{
bool isO1portrait = (o1 == dom::eScreenOrientation_PortraitPrimary || o1 == dom::eScreenOrientation_PortraitSecondary);
bool isO2portrait = (o2 == dom::eScreenOrientation_PortraitPrimary || o2 == dom::eScreenOrientation_PortraitSecondary);
bool isO1portrait = (o1 == hal::eScreenOrientation_PortraitPrimary || o1 == hal::eScreenOrientation_PortraitSecondary);
bool isO2portrait = (o2 == hal::eScreenOrientation_PortraitPrimary || o2 == hal::eScreenOrientation_PortraitSecondary);
return !(isO1portrait ^ isO2portrait);
}
@ -132,9 +132,8 @@ AsyncCompositionManager::ResolveRefLayers(CompositorBridgeParent* aCompositor,
}
if (!refLayer->GetLocalVisibleRegion().IsEmpty()) {
dom::ScreenOrientationInternal chromeOrientation =
mTargetConfig.orientation();
dom::ScreenOrientationInternal contentOrientation =
hal::ScreenOrientation chromeOrientation = mTargetConfig.orientation();
hal::ScreenOrientation contentOrientation =
state->mTargetConfig.orientation();
if (!IsSameDimension(chromeOrientation, contentOrientation) &&
ContentMightReflowOnOrientationChange(mTargetConfig.naturalBounds())) {

Просмотреть файл

@ -12,9 +12,9 @@
#include "mozilla/Attributes.h" // for final, etc
#include "mozilla/RefPtr.h" // for RefCounted
#include "mozilla/TimeStamp.h" // for TimeStamp
#include "mozilla/dom/ScreenOrientation.h" // for ScreenOrientation
#include "mozilla/gfx/BasePoint.h" // for BasePoint
#include "mozilla/gfx/Matrix.h" // for Matrix4x4
#include "mozilla/HalScreenConfiguration.h" // For ScreenOrientation
#include "mozilla/layers/FrameUniformityData.h" // For FrameUniformityData
#include "mozilla/layers/LayersMessages.h" // for TargetConfig
#include "mozilla/RefPtr.h" // for nsRefPtr
@ -102,7 +102,7 @@ public:
mTargetConfig = aTargetConfig;
}
bool RequiresReorientation(mozilla::dom::ScreenOrientationInternal aOrientation) const
bool RequiresReorientation(hal::ScreenOrientation aOrientation) const
{
return mTargetConfig.orientation() != aOrientation;
}

Просмотреть файл

@ -27,7 +27,7 @@ using class mozilla::TimeDuration from "mozilla/TimeStamp.h";
using class mozilla::TimeStamp from "mozilla/TimeStamp.h";
using mozilla::ScreenRotation from "mozilla/WidgetUtils.h";
using nsCSSPropertyID from "nsCSSPropertyID.h";
using mozilla::dom::ScreenOrientationInternal from "mozilla/dom/ScreenOrientation.h";
using hal::ScreenOrientation from "mozilla/HalScreenConfiguration.h";
using struct mozilla::layers::TextureInfo from "mozilla/layers/CompositorTypes.h";
using mozilla::LayerMargin from "Units.h";
using mozilla::LayerPoint from "Units.h";
@ -60,7 +60,7 @@ namespace layers {
struct TargetConfig {
IntRect naturalBounds;
ScreenRotation rotation;
ScreenOrientationInternal orientation;
ScreenOrientation orientation;
nsIntRegion clearRegion;
};

Просмотреть файл

@ -91,6 +91,9 @@ already_AddRefed<gfxXlibSurface>
SurfaceDescriptorX11::OpenForeign() const
{
Display* display = DefaultXDisplay();
if (!display) {
return nullptr;
}
Screen* screen = DefaultScreenOfDisplay(display);
RefPtr<gfxXlibSurface> surf;

Просмотреть файл

@ -65,13 +65,13 @@ class Transaction
public:
Transaction()
: mTargetRotation(ROTATION_0)
, mTargetOrientation(dom::eScreenOrientation_None)
, mTargetOrientation(hal::eScreenOrientation_None)
, mOpen(false)
, mRotationChanged(false)
{}
void Begin(const gfx::IntRect& aTargetBounds, ScreenRotation aRotation,
dom::ScreenOrientationInternal aOrientation)
hal::ScreenOrientation aOrientation)
{
mOpen = true;
mTargetBounds = aTargetBounds;
@ -142,7 +142,7 @@ public:
ShadowableLayerSet mSimpleMutants;
gfx::IntRect mTargetBounds;
ScreenRotation mTargetRotation;
dom::ScreenOrientationInternal mTargetOrientation;
hal::ScreenOrientation mTargetOrientation;
private:
bool mOpen;
@ -285,7 +285,7 @@ ShadowLayerForwarder::~ShadowLayerForwarder()
void
ShadowLayerForwarder::BeginTransaction(const gfx::IntRect& aTargetBounds,
ScreenRotation aRotation,
dom::ScreenOrientationInternal aOrientation)
hal::ScreenOrientation aOrientation)
{
MOZ_ASSERT(IPCOpen(), "no manager to forward to");
MOZ_ASSERT(mTxn->Finished(), "uncommitted txn?");

Просмотреть файл

@ -13,8 +13,8 @@
#include "mozilla/Attributes.h" // for override
#include "mozilla/gfx/Rect.h"
#include "mozilla/WidgetUtils.h" // for ScreenRotation
#include "mozilla/dom/ScreenOrientation.h" // for ScreenOrientation
#include "mozilla/ipc/SharedMemory.h" // for SharedMemory, etc
#include "mozilla/HalScreenConfiguration.h" // for ScreenOrientation
#include "mozilla/layers/CompositableForwarder.h"
#include "mozilla/layers/FocusTarget.h"
#include "mozilla/layers/LayersTypes.h"
@ -158,7 +158,7 @@ public:
*/
void BeginTransaction(const gfx::IntRect& aTargetBounds,
ScreenRotation aRotation,
mozilla::dom::ScreenOrientationInternal aOrientation);
hal::ScreenOrientation aOrientation);
/**
* The following methods may only be called after BeginTransaction()

Просмотреть файл

@ -13,6 +13,7 @@
#include "nsRefPtrHashtable.h"
#include "nsString.h"
#include "mozilla/dom/GamepadManager.h"
#include "mozilla/dom/Gamepad.h"
#include "mozilla/Preferences.h"
#include "mozilla/Unused.h"
#include "nsServiceManagerUtils.h"
@ -169,7 +170,8 @@ VRDisplayClient::FireGamepadEvents()
}
// Send events to notify that new controllers are added
if (lastState.controllerName[0] == '\0') {
RefPtr<dom::Gamepad> existing = gamepadManager->GetGamepad(gamepadId, dom::GamepadServiceType::VR);
if (lastState.controllerName[0] == '\0' || !existing) {
dom::GamepadAdded info(NS_ConvertUTF8toUTF16(state.controllerName),
dom::GamepadMappingType::_empty,
state.hand,

Просмотреть файл

@ -7,6 +7,7 @@
#ifndef MOZILLA_GFX_VR_VRMANAGERCHILD_H
#define MOZILLA_GFX_VR_VRMANAGERCHILD_H
#include "mozilla/dom/WindowBinding.h" // For FrameRequestCallback
#include "mozilla/gfx/PVRManagerChild.h"
#include "mozilla/ipc/SharedMemory.h" // for SharedMemory, etc
#include "ThreadSafeRefcountingWithMainThreadDestruction.h"

Просмотреть файл

@ -17,26 +17,6 @@
namespace mozilla {
namespace wr {
static EGLint
GetEGLTextureFormat(gfx::SurfaceFormat aFormat)
{
switch (aFormat) {
case gfx::SurfaceFormat::B8G8R8A8:
case gfx::SurfaceFormat::B8G8R8X8:
case gfx::SurfaceFormat::R8G8B8A8:
case gfx::SurfaceFormat::R8G8B8X8:
case gfx::SurfaceFormat::A8R8G8B8:
case gfx::SurfaceFormat::X8R8G8B8:
return LOCAL_EGL_TEXTURE_RGBA;
case gfx::SurfaceFormat::R8G8B8:
case gfx::SurfaceFormat::B8G8R8:
return LOCAL_EGL_TEXTURE_RGB;
default:
gfxCriticalError() << "GetEGLTextureFormat(): unexpected texture format";
return LOCAL_EGL_TEXTURE_RGBA;
}
}
RenderDXGITextureHostOGL::RenderDXGITextureHostOGL(WindowsHandle aHandle,
gfx::SurfaceFormat aFormat,
gfx::IntSize aSize)

Просмотреть файл

@ -21,7 +21,6 @@
#include "mozilla/ClearOnShutdown.h"
#include "mozilla/Observer.h"
#include "mozilla/dom/ContentChild.h"
#include "mozilla/dom/ScreenOrientation.h"
#include "WindowIdentifier.h"
#ifdef XP_WIN
@ -539,7 +538,7 @@ NotifyScreenConfigurationChange(const ScreenConfiguration& aScreenConfiguration)
}
bool
LockScreenOrientation(const dom::ScreenOrientationInternal& aOrientation)
LockScreenOrientation(const ScreenOrientation& aOrientation)
{
AssertMainThread();
RETURN_PROXY_IF_SANDBOXED(LockScreenOrientation(aOrientation), false);

Просмотреть файл

@ -10,7 +10,6 @@
#include "base/basictypes.h"
#include "base/platform_thread.h"
#include "nsTArray.h"
#include "mozilla/dom/ScreenOrientation.h"
#include "mozilla/hal_sandbox/PHal.h"
#include "mozilla/HalBatteryInformation.h"
#include "mozilla/HalNetworkInformation.h"
@ -225,7 +224,7 @@ void NotifyScreenConfigurationChange(const hal::ScreenConfiguration& aScreenConf
* Lock the screen orientation to the specific orientation.
* @return Whether the lock has been accepted.
*/
MOZ_MUST_USE bool LockScreenOrientation(const dom::ScreenOrientationInternal& aOrientation);
MOZ_MUST_USE bool LockScreenOrientation(const hal::ScreenOrientation& aOrientation);
/**
* Unlock the screen orientation.

Просмотреть файл

@ -11,8 +11,23 @@
namespace mozilla {
namespace hal {
// Make sure that any change to ScreenOrientation values are also made in
// mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoScreenOrientation.java
typedef uint32_t ScreenOrientation;
static const ScreenOrientation eScreenOrientation_None = 0;
static const ScreenOrientation eScreenOrientation_PortraitPrimary = 1u << 0;
static const ScreenOrientation eScreenOrientation_PortraitSecondary = 1u << 1;
static const ScreenOrientation eScreenOrientation_LandscapePrimary = 1u << 2;
static const ScreenOrientation eScreenOrientation_LandscapeSecondary = 1u << 3;
//eScreenOrientation_Default will use the natural orientation for the deivce,
//it could be PortraitPrimary or LandscapePrimary depends on display resolution
static const ScreenOrientation eScreenOrientation_Default = 1u << 4;
class ScreenConfiguration;
typedef Observer<ScreenConfiguration> ScreenConfigurationObserver;
} // namespace hal
} // namespace mozilla

Просмотреть файл

@ -8,8 +8,8 @@
#include "WindowIdentifier.h"
#include "AndroidBridge.h"
#include "mozilla/dom/network/Constants.h"
#include "mozilla/dom/ScreenOrientation.h"
#include "nsIScreenManager.h"
#include "nsPIDOMWindow.h"
#include "nsServiceManagerUtils.h"
using namespace mozilla::dom;
@ -125,7 +125,7 @@ GetCurrentScreenConfiguration(ScreenConfiguration* aScreenConfiguration)
int32_t colorDepth, pixelDepth;
int16_t angle;
ScreenOrientationInternal orientation;
ScreenOrientation orientation;
nsCOMPtr<nsIScreen> screen;
int32_t rectX, rectY, rectWidth, rectHeight;
@ -135,7 +135,7 @@ GetCurrentScreenConfiguration(ScreenConfiguration* aScreenConfiguration)
screen->GetRect(&rectX, &rectY, &rectWidth, &rectHeight);
screen->GetColorDepth(&colorDepth);
screen->GetPixelDepth(&pixelDepth);
orientation = static_cast<ScreenOrientationInternal>(bridge->GetScreenOrientation());
orientation = static_cast<ScreenOrientation>(bridge->GetScreenOrientation());
angle = bridge->GetScreenAngle();
*aScreenConfiguration =
@ -144,10 +144,10 @@ GetCurrentScreenConfiguration(ScreenConfiguration* aScreenConfiguration)
}
bool
LockScreenOrientation(const ScreenOrientationInternal& aOrientation)
LockScreenOrientation(const ScreenOrientation& aOrientation)
{
// Force the default orientation to be portrait-primary.
ScreenOrientationInternal orientation =
ScreenOrientation orientation =
aOrientation == eScreenOrientation_Default ? eScreenOrientation_PortraitPrimary
: aOrientation;

Просмотреть файл

@ -24,7 +24,7 @@ GetCurrentScreenConfiguration(hal::ScreenConfiguration* aScreenConfiguration)
}
bool
LockScreenOrientation(const dom::ScreenOrientationInternal& aOrientation)
LockScreenOrientation(const ScreenOrientation& aOrientation)
{
return false;
}

Просмотреть файл

@ -6,7 +6,6 @@
#define mozilla_fallback_FallbackScreenConfiguration_h
#include "Hal.h"
#include "mozilla/dom/ScreenOrientation.h"
#include "nsIScreenManager.h"
#include "nsServiceManagerUtils.h"
@ -25,7 +24,7 @@ GetCurrentScreenConfiguration(hal::ScreenConfiguration* aScreenConfiguration)
}
int32_t colorDepth, pixelDepth, x, y, w, h;
dom::ScreenOrientationInternal orientation;
ScreenOrientation orientation;
nsCOMPtr<nsIScreen> screen;
screenMgr->GetPrimaryScreen(getter_AddRefs(screen));
@ -33,8 +32,8 @@ GetCurrentScreenConfiguration(hal::ScreenConfiguration* aScreenConfiguration)
screen->GetColorDepth(&colorDepth);
screen->GetPixelDepth(&pixelDepth);
orientation = w >= h
? dom::eScreenOrientation_LandscapePrimary
: dom::eScreenOrientation_PortraitPrimary;
? hal::eScreenOrientation_LandscapePrimary
: hal::eScreenOrientation_PortraitPrimary;
*aScreenConfiguration = hal::ScreenConfiguration(nsIntRect(x, y, w, h),
orientation, 0,

Просмотреть файл

@ -9,7 +9,7 @@ include protocol PBrowser;
include "mozilla/GfxMessageUtils.h";
using mozilla::dom::ScreenOrientationInternal from "mozilla/dom/ScreenOrientation.h";
using hal::ScreenOrientation from "mozilla/HalScreenConfiguration.h";
using mozilla::hal::SensorType from "mozilla/HalSensor.h";
using mozilla::hal::WakeLockControl from "mozilla/HalTypes.h";
using mozilla::hal::ProcessPriority from "mozilla/HalTypes.h";
@ -46,7 +46,7 @@ struct WakeLockInformation {
struct ScreenConfiguration {
nsIntRect rect;
ScreenOrientationInternal orientation;
ScreenOrientation orientation;
uint16_t angle;
uint32_t colorDepth;
uint32_t pixelDepth;
@ -90,7 +90,7 @@ parent:
async EnableScreenConfigurationNotifications();
async DisableScreenConfigurationNotifications();
sync LockScreenOrientation(ScreenOrientationInternal aOrientation)
sync LockScreenOrientation(ScreenOrientation aOrientation)
returns (bool allowed);
async UnlockScreenOrientation();

Просмотреть файл

@ -12,7 +12,6 @@
#include "mozilla/hal_sandbox/PHalParent.h"
#include "mozilla/dom/TabParent.h"
#include "mozilla/dom/TabChild.h"
#include "mozilla/dom/ScreenOrientation.h"
#include "mozilla/fallback/FallbackScreenConfiguration.h"
#include "mozilla/EnumeratedRange.h"
#include "mozilla/Observer.h"
@ -122,7 +121,7 @@ GetCurrentScreenConfiguration(ScreenConfiguration* aScreenConfiguration)
}
bool
LockScreenOrientation(const dom::ScreenOrientationInternal& aOrientation)
LockScreenOrientation(const ScreenOrientation& aOrientation)
{
bool allowed;
Hal()->SendLockScreenOrientation(aOrientation, &allowed);
@ -332,7 +331,7 @@ public:
}
virtual mozilla::ipc::IPCResult
RecvLockScreenOrientation(const dom::ScreenOrientationInternal& aOrientation, bool* aAllowed) override
RecvLockScreenOrientation(const ScreenOrientation& aOrientation, bool* aAllowed) override
{
// FIXME/bug 777980: unprivileged content may only lock
// orientation while fullscreen. We should check whether the

Просмотреть файл

@ -25,6 +25,7 @@
#include "nsIObserverService.h"
#include "nsIDebug2.h"
#include "nsIDocShell.h"
#include "nsIDocument.h"
#include "nsIRunnable.h"
#include "nsPIDOMWindow.h"
#include "nsPrintfCString.h"
@ -2141,39 +2142,33 @@ class OrphanReporter : public JS::ObjectPrivateVisitor
virtual size_t sizeOfIncludingThis(nsISupports* aSupports) override
{
size_t n = 0;
nsCOMPtr<nsINode> node = do_QueryInterface(aSupports);
// https://bugzilla.mozilla.org/show_bug.cgi?id=773533#c11 explains
// that we have to skip XBL elements because they violate certain
// assumptions. Yuk.
if (node && !node->IsInComposedDoc() &&
!(node->IsElement() && node->AsElement()->IsInNamespace(kNameSpaceID_XBL)))
{
// This is an orphan node. If we haven't already handled the
// sub-tree that this node belongs to, measure the sub-tree's size
// and then record its root so we don't measure it again.
nsCOMPtr<nsINode> orphanTree = node->SubtreeRoot();
if (orphanTree && !mState.HaveSeenPtr(orphanTree.get())) {
n += SizeOfTreeIncludingThis(orphanTree);
}
// https://bugzilla.mozilla.org/show_bug.cgi?id=773533#c11 explains that we have to skip
// XBL elements because they violate certain assumptions. Yuk.
if (!node || node->IsInComposedDoc() ||
(node->IsElement() && node->AsElement()->IsInNamespace(kNameSpaceID_XBL))) {
return 0;
}
// This is an orphan node. If we haven't already handled the sub-tree that this node
// belongs to, measure the sub-tree's size and then record its root so we don't measure it
// again.
nsCOMPtr<nsINode> orphanTree = node->SubtreeRoot();
if (!orphanTree || mState.HaveSeenPtr(orphanTree.get())) {
return 0;
}
return n;
}
size_t SizeOfTreeIncludingThis(nsINode* tree)
{
size_t nodeSize = 0;
nsWindowSizes sizes(mState);
tree->AddSizeOfIncludingThis(sizes, &nodeSize);
for (nsIContent* child = tree->GetFirstChild(); child; child = child->GetNextNode(tree))
child->AddSizeOfIncludingThis(sizes, &nodeSize);
nsIDocument::AddSizeOfNodeTree(*orphanTree, sizes);
// We combine the node size with nsStyleSizes here. It's not ideal, but
// it's hard to get the style structs measurements out to
// nsWindowMemoryReporter. Also, we drop mServoData in
// UnbindFromTree(), so in theory any non-in-tree element won't have
// any style data to measure.
return nodeSize + sizes.getTotalSize();
// We combine the node size with nsStyleSizes here. It's not ideal, but it's hard to get
// the style structs measurements out to nsWindowMemoryReporter. Also, we drop mServoData
// in UnbindFromTree(), so in theory any non-in-tree element won't have any style data to
// measure.
//
// FIXME(emilio): We should ideally not do this, since ShadowRoots keep their StyleSheets
// alive even when detached from a document, and those could be significant in theory.
return sizes.getTotalSize();
}
private:

Просмотреть файл

@ -226,7 +226,9 @@ public:
nsDisplayCanvasThemedBackground(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame)
: nsDisplayThemedBackground(aBuilder, aFrame,
aFrame->GetRectRelativeToSelf() + aBuilder->ToReferenceFrame(aFrame))
{}
{
nsDisplayThemedBackground::Init(aBuilder);
}
virtual void Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) override;

Просмотреть файл

@ -28,7 +28,7 @@ import java.util.List;
public class GeckoScreenOrientation {
private static final String LOGTAG = "GeckoScreenOrientation";
// Make sure that any change in dom/base/ScreenOrientation.h happens here too.
// Make sure that any change in hal/HalScreenConfiguration.h happens here too.
public enum ScreenOrientation {
NONE(0),
PORTRAIT_PRIMARY(1 << 0),

Просмотреть файл

@ -15,7 +15,7 @@ SRC_DIR=$TOOLCHAIN_DIR/src
CLANG_VERSION=7.0.0
make_flags="-j$(nproc)"
mingw_version=49ca7cfe7e09f924e939921b42a3452203c437b7
mingw_version=30af18252d4e965e98612e215b8cf6b7ae42c01a
libunwind_version=86ab23972978242b6f9e27cebc239f3e8428b1af
binutils_version=2.27

Просмотреть файл

@ -14,7 +14,6 @@ import os
import slugid
from taskgraph.util.time import current_json_time
from .util import find_pushlog_info
def run_decision_task(job, params, root):
@ -37,12 +36,6 @@ def make_decision_task(params, root, symbol, arguments=[], head_rev=None):
if not head_rev:
head_rev = params['head_rev']
try:
pushlog = find_pushlog_info(
params['repository_url'],
params['head_rev'])
except (IOError, RuntimeError):
pushlog = {'pushid': -1, 'pushdate': 0}
slugids = {}
@ -66,8 +59,8 @@ def make_decision_task(params, root, symbol, arguments=[], head_rev=None):
'push': {
'revision': params['head_rev'],
# remainder are fake values, but the decision task expects them anyway
'pushlog_id': pushlog['pushid'],
'pushdate': pushlog['pushdate'],
'pushlog_id': -1,
'pushdate': 0,
'owner': 'cron',
'comment': '',
},

Просмотреть файл

@ -7,11 +7,8 @@
from __future__ import absolute_import, print_function, unicode_literals
import requests
import subprocess
PUSHLOG_TMPL = '{}/json-pushes?version=2&changeset={}&tipsonly=1&full=1'
def match_utc(params, sched):
"""Return True if params['time'] matches the given schedule.
@ -48,20 +45,3 @@ def calculate_head_rev(root):
# GECKO_HEAD_REF, so all that remains is to see what the current revision is.
# Mercurial refers to that as `.`.
return subprocess.check_output(['hg', 'log', '-r', '.', '-T', '{node}'], cwd=root)
def find_pushlog_info(repo, revision):
"""Given a repo url and a revision, find the pushlog_id of the revision."""
pushlog_url = PUSHLOG_TMPL.format(repo, revision)
r = requests.get(pushlog_url)
r.raise_for_status()
pushes = r.json()['pushes']
if len(pushes) != 1:
raise RuntimeError(
"Unable to find a single pushlog_id for {} revision {}: {}".format(
repo, revision, pushes
)
)
pushid = pushes.keys()[0]
return {'pushdate': pushes[pushid]['date'], 'pushid': pushid}

Просмотреть файл

@ -25,6 +25,9 @@ ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource://testing-common/TestUtils.jsm");
ChromeUtils.import("resource://testing-common/ContentTask.jsm");
ChromeUtils.defineModuleGetter(this, "BrowserWindowTracker",
"resource:///modules/BrowserWindowTracker.jsm");
Services
.mm
.loadFrameScript(
@ -701,61 +704,19 @@ var BrowserTestUtils = {
},
/**
* @param {Object} options
* {
* private: A boolean indicating if the window should be
* private
* remote: A boolean indicating if the window should run
* remote browser tabs or not. If omitted, the window
* will choose the profile default state.
* width: Desired width of window
* height: Desired height of window
* }
* Open a new browser window from an existing one.
* This relies on OpenBrowserWindow in browser.js, and waits for the window
* to be completely loaded before resolving.
*
* @return {Promise}
* Resolves with the new window once it is loaded.
*/
async openNewBrowserWindow(options = {}) {
let argString = Cc["@mozilla.org/supports-string;1"].
createInstance(Ci.nsISupportsString);
argString.data = "";
let features = "chrome,dialog=no,all";
let opener = null;
if (options.opener) {
opener = options.opener;
let currentWin = BrowserWindowTracker.getTopWindow({private: false});
if (!currentWin) {
throw new Error("Can't open a new browser window from this helper if no non-private window is open.");
}
if (options.private) {
features += ",private";
}
if (options.width) {
features += ",width=" + options.width;
}
if (options.height) {
features += ",height=" + options.height;
}
if (options.left) {
features += ",left=" + options.left;
}
if (options.top) {
features += ",top=" + options.top;
}
if (options.hasOwnProperty("remote")) {
let remoteState = options.remote ? "remote" : "non-remote";
features += `,${remoteState}`;
}
if (options.url) {
argString.data = options.url;
}
let win = Services.ww.openWindow(
opener, AppConstants.BROWSER_CHROME_URL, "_blank",
features, argString);
let win = currentWin.OpenBrowserWindow(options);
// Wait for browser-delayed-startup-finished notification, it indicates
// that the window has loaded completely and is ready to be used for

Просмотреть файл

@ -89,6 +89,13 @@ def write_test_settings_json(test_details, oskey):
test_settings['raptor-options']['lower_is_better'] = False
else:
test_settings['raptor-options']['lower_is_better'] = True
# support optional subtest unit/lower_is_better fields, default to main test values if not set
val = test_details.get('subtest_unit', test_settings['raptor-options']['unit'])
test_settings['raptor-options']['subtest_unit'] = val
val = test_details.get('subtest_lower', test_settings['raptor-options']['lower_is_better'])
test_settings['raptor-options']['subtest_lower_is_better'] = val
if test_details.get("alert_threshold", None) is not None:
test_settings['raptor-options']['alert_threshold'] = float(test_details['alert_threshold'])

Просмотреть файл

@ -51,6 +51,7 @@ class Output(object):
'extraOptions': test.extra_options,
'subtests': subtests,
'lowerIsBetter': test.lower_is_better,
'unit': test.unit,
'alertThreshold': float(test.alert_threshold)
}
@ -75,10 +76,10 @@ class Output(object):
new_subtest = {}
new_subtest['name'] = test.name + "-" + measurement_name
new_subtest['replicates'] = replicates
new_subtest['lowerIsBetter'] = test.lower_is_better
new_subtest['lowerIsBetter'] = test.subtest_lower_is_better
new_subtest['alertThreshold'] = float(test.alert_threshold)
new_subtest['value'] = 0
new_subtest['unit'] = test.unit
new_subtest['unit'] = test.subtest_unit
filtered_values = filter.ignore_first(new_subtest['replicates'], 1)
new_subtest['value'] = filter.median(filtered_values)
@ -146,9 +147,9 @@ class Output(object):
# for each pagecycle, build a list of subtests and append all related replicates
if sub not in _subtests.keys():
# subtest not added yet, first pagecycle, so add new one
_subtests[sub] = {'unit': test.unit,
_subtests[sub] = {'unit': test.subtest_unit,
'alertThreshold': float(test.alert_threshold),
'lowerIsBetter': test.lower_is_better,
'lowerIsBetter': test.subtest_lower_is_better,
'name': sub,
'replicates': []}
_subtests[sub]['replicates'].extend([round(x, 3) for x in replicates])
@ -183,9 +184,9 @@ class Output(object):
sub = item['name']
if sub not in _subtests.keys():
# subtest not added yet, first pagecycle, so add new one
_subtests[sub] = {'unit': test.unit,
_subtests[sub] = {'unit': test.subtest_unit,
'alertThreshold': float(test.alert_threshold),
'lowerIsBetter': test.lower_is_better,
'lowerIsBetter': test.subtest_lower_is_better,
'name': sub,
'replicates': []}
_subtests[sub]['replicates'].append(item['time'])
@ -230,9 +231,9 @@ class Output(object):
replicates = [item['duration']]
if sub not in _subtests.keys():
# subtest not added yet, first pagecycle, so add new one
_subtests[sub] = {'unit': test.unit,
_subtests[sub] = {'unit': test.subtest_unit,
'alertThreshold': float(test.alert_threshold),
'lowerIsBetter': test.lower_is_better,
'lowerIsBetter': test.subtest_lower_is_better,
'name': sub,
'replicates': []}
_subtests[sub]['replicates'].extend([round(x, 3) for x in replicates])
@ -285,9 +286,9 @@ class Output(object):
if sub not in _subtests.keys():
# subtest not added yet, first pagecycle, so add new one
_subtests[sub] = {'unit': test.unit,
_subtests[sub] = {'unit': test.subtest_unit,
'alertThreshold': float(test.alert_threshold),
'lowerIsBetter': test.lower_is_better,
'lowerIsBetter': test.subtest_lower_is_better,
'name': sub,
'replicates': []}
_subtests[sub]['replicates'].extend([replicate])
@ -311,17 +312,17 @@ class Output(object):
# for each pagecycle, build a list of subtests and append all related replicates
if sub not in _subtests.keys():
# subtest not added yet, first pagecycle, so add new one
_subtests[sub] = {'unit': test.unit,
_subtests[sub] = {'unit': test.subtest_unit,
'alertThreshold': float(test.alert_threshold),
'lowerIsBetter': test.lower_is_better,
'lowerIsBetter': test.subtest_lower_is_better,
'name': sub,
'replicates': []}
_subtests[sub]['replicates'].extend([round(x, 3) for x in replicates])
total_subtest = {
'unit': test.unit,
'unit': test.subtest_unit,
'alertThreshold': float(test.alert_threshold),
'lowerIsBetter': test.lower_is_better,
'lowerIsBetter': test.subtest_lower_is_better,
'replicates': [],
'name': 'benchmark_score',
'value': 0
@ -365,9 +366,9 @@ class Output(object):
sub = item['benchmark']
if sub not in _subtests.keys():
# subtest not added yet, first pagecycle, so add new one
_subtests[sub] = {'unit': test.unit,
_subtests[sub] = {'unit': test.subtest_unit,
'alertThreshold': float(test.alert_threshold),
'lowerIsBetter': test.lower_is_better,
'lowerIsBetter': test.subtest_lower_is_better,
'name': sub,
'replicates': []}
_subtests[sub]['replicates'].append(item['result'])
@ -404,9 +405,9 @@ class Output(object):
# build a list of subtests and append all related replicates
if _sub not in _subtests.keys():
# subtest not added yet, first pagecycle, so add new one
_subtests[_sub] = {'unit': test.unit,
_subtests[_sub] = {'unit': test.subtest_unit,
'alertThreshold': float(test.alert_threshold),
'lowerIsBetter': test.lower_is_better,
'lowerIsBetter': test.subtest_lower_is_better,
'name': _sub,
'replicates': []}
_subtests[_sub]['replicates'].extend([_value])

Просмотреть файл

@ -9,8 +9,10 @@ type = benchmark
test_url = http://localhost:<port>/Speedometer/index.html?raptor
page_cycles = 5
page_timeout = 180000
unit = score
lower_is_better = false
unit = score
subtest_unit = ms
lower_is_better = false
subtest_lower_is_better = true
alert_threshold = 2.0
[raptor-speedometer-firefox]

Просмотреть файл

@ -78,7 +78,9 @@ function getTestSettings() {
results.type = testType;
results.name = testName;
results.unit = settings.unit;
results.lower_is_better = settings.lower_is_better;
results.subtest_unit = settings.subtest_unit;
results.lower_is_better = settings.lower_is_better == "true";
results.subtest_lower_is_better = settings.subtest_lower_is_better == "true";
results.alert_threshold = settings.alert_threshold;
if (settings.page_timeout !== undefined) {

Просмотреть файл

@ -36,6 +36,9 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
'uachelper.cpp',
'updatehelper.cpp',
]
OS_LIBS += [
'rpcrt4',
]
if CONFIG['MOZ_MAINTENANCE_SERVICE']:
SOURCES += [
'certificatecheck.cpp',
@ -43,7 +46,6 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
]
OS_LIBS += [
'crypt32',
'rpcrt4',
'wintrust',
]

Просмотреть файл

@ -199,7 +199,7 @@ PathContainsInvalidLinks(wchar_t * const fullPath)
wchar_t pathCopy[MAXPATHLEN + 1] = L"";
wcsncpy(pathCopy, fullPath, MAXPATHLEN);
wchar_t* remainingPath = nullptr;
wchar_t* nextToken = wcstok(pathCopy, L"\\", &remainingPath);
wchar_t* nextToken = wcstok_s(pathCopy, L"\\", &remainingPath);
wchar_t* partialPath = nextToken;
while (nextToken) {
@ -249,7 +249,7 @@ PathContainsInvalidLinks(wchar_t * const fullPath)
}
}
nextToken = wcstok(nullptr, L"\\", &remainingPath);
nextToken = wcstok_s(nullptr, L"\\", &remainingPath);
PathAppendW(partialPath, nextToken);
}

Просмотреть файл

@ -30,7 +30,6 @@
#include "nsPresContext.h"
#include "nsIDocShell.h"
#include "nsPIDOMWindow.h"
#include "mozilla/dom/ScreenOrientation.h"
#include "nsIDOMWindowUtils.h"
#include "mozilla/ClearOnShutdown.h"
#include "nsPrintfCString.h"
@ -734,9 +733,9 @@ AndroidBridge::GetScreenOrientation()
int16_t orientation = GeckoAppShell::GetScreenOrientation();
if (!orientation)
return dom::eScreenOrientation_None;
return hal::eScreenOrientation_None;
return static_cast<dom::ScreenOrientationInternal>(orientation);
return static_cast<hal::ScreenOrientation>(orientation);
}
uint16_t

Просмотреть файл

@ -12,7 +12,6 @@
#include "nsIScreenManager.h"
#include "mozilla/Hal.h"
#include "mozilla/dom/ScreenOrientation.h"
namespace mozilla {
@ -45,7 +44,7 @@ public:
}
hal::NotifyScreenConfigurationChange(hal::ScreenConfiguration(
rect, static_cast<dom::ScreenOrientationInternal>(aOrientation),
rect, static_cast<hal::ScreenOrientation>(aOrientation),
aAngle, colorDepth, pixelDepth));
}
};