This commit is contained in:
Wes Kocher 2017-03-28 13:15:57 -07:00
Родитель 89d7c65bcf 8adf6ac1c1
Коммит 6d49927150
163 изменённых файлов: 3151 добавлений и 1530 удалений

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

@ -16,9 +16,9 @@ jobs:
when:
by-project:
# Match buildbot starts for now
date: [{hour: 16, minute: 0}]
mozilla-central: [{hour: 11, minute: 0}]
mozilla-aurora: [{hour: 8, minute: 45}] # Buildbot uses minute 40
date: [{hour: 15, minute: 0}]
mozilla-central: [{hour: 10, minute: 0}]
mozilla-aurora: [{hour: 7, minute: 45}] # Buildbot uses minute 40
# No default
- name: nightly-android
@ -34,9 +34,9 @@ jobs:
when:
by-project:
# Match buildbot starts for now
date: [{hour: 16, minute: 0}]
mozilla-central: [{hour: 11, minute: 0}]
mozilla-aurora: [{hour: 8, minute: 45}] # Buildbot uses minute 40
date: [{hour: 15, minute: 0}]
mozilla-central: [{hour: 10, minute: 0}]
mozilla-aurora: [{hour: 7, minute: 45}] # Buildbot uses minute 40
# No default
- name: nightly-mochitest-valgrind

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

@ -429,10 +429,6 @@ support-files = test_offline_gzip.html gZipOfflineChild.cacheManifest gZipOfflin
# DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
[browser_page_style_menu_update.js]
# DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
[browser_permissions.js]
support-files =
permissions.html
# DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
[browser_pinnedTabs.js]
# DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
[browser_plainTextLinks.js]
@ -540,16 +536,6 @@ support-files =
# DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
[browser_tabs_owner.js]
# DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
[browser_temporary_permissions.js]
support-files =
permissions.html
temporary_permissions_subframe.html
../webrtc/get_user_media.html
# DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
[browser_temporary_permissions_navigation.js]
# DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
[browser_temporary_permissions_tabs.js]
# DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
[browser_testOpenNewRemoteTabsFromNonRemoteBrowsers.js]
run-if = e10s
# DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.

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

@ -1,196 +0,0 @@
/*
* Test the Permissions section in the Control Center.
*/
var {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
const PERMISSIONS_PAGE = "http://example.com/browser/browser/base/content/test/general/permissions.html";
var {SitePermissions} = Cu.import("resource:///modules/SitePermissions.jsm", {});
registerCleanupFunction(function() {
SitePermissions.remove(gBrowser.currentURI, "cookie");
SitePermissions.remove(gBrowser.currentURI, "geo");
SitePermissions.remove(gBrowser.currentURI, "camera");
SitePermissions.remove(gBrowser.currentURI, "microphone");
while (gBrowser.tabs.length > 1) {
gBrowser.removeCurrentTab();
}
});
function* openIdentityPopup() {
let {gIdentityHandler} = gBrowser.ownerGlobal;
let promise = BrowserTestUtils.waitForEvent(gIdentityHandler._identityPopup, "popupshown");
gIdentityHandler._identityBox.click();
return promise;
}
function* closeIdentityPopup() {
let {gIdentityHandler} = gBrowser.ownerGlobal;
let promise = BrowserTestUtils.waitForEvent(gIdentityHandler._identityPopup, "popuphidden");
gIdentityHandler._identityPopup.hidePopup();
return promise;
}
add_task(function* testMainViewVisible() {
let tab = gBrowser.selectedTab = gBrowser.addTab();
yield promiseTabLoadEvent(tab, PERMISSIONS_PAGE);
let permissionsList = document.getElementById("identity-popup-permission-list");
let emptyLabel = permissionsList.nextSibling.nextSibling;
yield openIdentityPopup();
ok(!is_hidden(emptyLabel), "List of permissions is empty");
yield closeIdentityPopup();
SitePermissions.set(gBrowser.currentURI, "camera", SitePermissions.ALLOW);
yield openIdentityPopup();
ok(is_hidden(emptyLabel), "List of permissions is not empty");
let labelText = SitePermissions.getPermissionLabel("camera");
let labels = permissionsList.querySelectorAll(".identity-popup-permission-label");
is(labels.length, 1, "One permission visible in main view");
is(labels[0].textContent, labelText, "Correct value");
let img = permissionsList.querySelector("image.identity-popup-permission-icon");
ok(img, "There is an image for the permissions");
ok(img.classList.contains("camera-icon"), "proper class is in image class");
yield closeIdentityPopup();
SitePermissions.remove(gBrowser.currentURI, "camera");
yield openIdentityPopup();
ok(!is_hidden(emptyLabel), "List of permissions is empty");
yield closeIdentityPopup();
});
add_task(function* testIdentityIcon() {
let {gIdentityHandler} = gBrowser.ownerGlobal;
let tab = gBrowser.selectedTab = gBrowser.addTab();
yield promiseTabLoadEvent(tab, PERMISSIONS_PAGE);
SitePermissions.set(gBrowser.currentURI, "geo", SitePermissions.ALLOW);
ok(gIdentityHandler._identityBox.classList.contains("grantedPermissions"),
"identity-box signals granted permissions");
SitePermissions.remove(gBrowser.currentURI, "geo");
ok(!gIdentityHandler._identityBox.classList.contains("grantedPermissions"),
"identity-box doesn't signal granted permissions");
SitePermissions.set(gBrowser.currentURI, "camera", SitePermissions.BLOCK);
ok(!gIdentityHandler._identityBox.classList.contains("grantedPermissions"),
"identity-box doesn't signal granted permissions");
SitePermissions.set(gBrowser.currentURI, "cookie", SitePermissions.ALLOW_COOKIES_FOR_SESSION);
ok(gIdentityHandler._identityBox.classList.contains("grantedPermissions"),
"identity-box signals granted permissions");
SitePermissions.remove(gBrowser.currentURI, "geo");
SitePermissions.remove(gBrowser.currentURI, "camera");
SitePermissions.remove(gBrowser.currentURI, "cookie");
});
add_task(function* testCancelPermission() {
let tab = gBrowser.selectedTab = gBrowser.addTab();
yield promiseTabLoadEvent(tab, PERMISSIONS_PAGE);
let permissionsList = document.getElementById("identity-popup-permission-list");
let emptyLabel = permissionsList.nextSibling.nextSibling;
SitePermissions.set(gBrowser.currentURI, "geo", SitePermissions.ALLOW);
SitePermissions.set(gBrowser.currentURI, "camera", SitePermissions.BLOCK);
yield openIdentityPopup();
ok(is_hidden(emptyLabel), "List of permissions is not empty");
let cancelButtons = permissionsList
.querySelectorAll(".identity-popup-permission-remove-button");
cancelButtons[0].click();
let labels = permissionsList.querySelectorAll(".identity-popup-permission-label");
is(labels.length, 1, "One permission should be removed");
cancelButtons[1].click();
labels = permissionsList.querySelectorAll(".identity-popup-permission-label");
is(labels.length, 0, "One permission should be removed");
yield closeIdentityPopup();
});
add_task(function* testPermissionHints() {
let tab = gBrowser.selectedTab = gBrowser.addTab();
yield promiseTabLoadEvent(tab, PERMISSIONS_PAGE);
let permissionsList = document.getElementById("identity-popup-permission-list");
let emptyHint = document.getElementById("identity-popup-permission-empty-hint");
let reloadHint = document.getElementById("identity-popup-permission-reload-hint");
yield openIdentityPopup();
ok(!is_hidden(emptyHint), "Empty hint is visible");
ok(is_hidden(reloadHint), "Reload hint is hidden");
yield closeIdentityPopup();
SitePermissions.set(gBrowser.currentURI, "geo", SitePermissions.ALLOW);
SitePermissions.set(gBrowser.currentURI, "camera", SitePermissions.BLOCK);
yield openIdentityPopup();
ok(is_hidden(emptyHint), "Empty hint is hidden");
ok(is_hidden(reloadHint), "Reload hint is hidden");
let cancelButtons = permissionsList
.querySelectorAll(".identity-popup-permission-remove-button");
SitePermissions.remove(gBrowser.currentURI, "camera");
cancelButtons[0].click();
ok(is_hidden(emptyHint), "Empty hint is hidden");
ok(!is_hidden(reloadHint), "Reload hint is visible");
cancelButtons[1].click();
ok(is_hidden(emptyHint), "Empty hint is hidden");
ok(!is_hidden(reloadHint), "Reload hint is visible");
yield closeIdentityPopup();
yield promiseTabLoadEvent(tab, PERMISSIONS_PAGE);
yield openIdentityPopup();
ok(!is_hidden(emptyHint), "Empty hint is visible after reloading");
ok(is_hidden(reloadHint), "Reload hint is hidden after reloading");
yield closeIdentityPopup();
});
add_task(function* testPermissionIcons() {
let {gIdentityHandler} = gBrowser.ownerGlobal;
let tab = gBrowser.selectedTab = gBrowser.addTab();
yield promiseTabLoadEvent(tab, PERMISSIONS_PAGE);
SitePermissions.set(gBrowser.currentURI, "camera", SitePermissions.ALLOW);
SitePermissions.set(gBrowser.currentURI, "geo", SitePermissions.BLOCK);
let geoIcon = gIdentityHandler._identityBox
.querySelector(".blocked-permission-icon[data-permission-id='geo']");
ok(geoIcon.hasAttribute("showing"), "blocked permission icon is shown");
let cameraIcon = gIdentityHandler._identityBox
.querySelector(".blocked-permission-icon[data-permission-id='camera']");
ok(!cameraIcon.hasAttribute("showing"),
"allowed permission icon is not shown");
SitePermissions.remove(gBrowser.currentURI, "geo");
ok(!geoIcon.hasAttribute("showing"),
"blocked permission icon is not shown after reset");
});

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

@ -66,7 +66,7 @@ add_task(function* setup() {
add_task(function* testNewWindow() {
let newWin = yield promiseOpenAndLoadWindow({}, true);
let tab = newWin.gBrowser.selectedTab = newWin.gBrowser.addTab();
let tab = yield BrowserTestUtils.openNewForegroundTab(newWin.gBrowser);
let TrackingProtection = newWin.TrackingProtection;
ok(TrackingProtection, "TP is attached to the browser window");
@ -122,7 +122,7 @@ add_task(function* testNewWindow() {
add_task(function* testPrivateBrowsing() {
let privateWin = yield promiseOpenAndLoadWindow({private: true}, true);
let tab = privateWin.gBrowser.selectedTab = privateWin.gBrowser.addTab();
let tab = yield BrowserTestUtils.openNewForegroundTab(privateWin.gBrowser);
let TrackingProtection = privateWin.TrackingProtection;
ok(TrackingProtection, "TP is attached to the browser window");

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

@ -0,0 +1,14 @@
[DEFAULT]
support-files=
head.js
[browser_permissions.js]
support-files =
permissions.html
[browser_temporary_permissions.js]
support-files =
permissions.html
temporary_permissions_subframe.html
../webrtc/get_user_media.html
[browser_temporary_permissions_navigation.js]
[browser_temporary_permissions_tabs.js]

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

@ -0,0 +1,183 @@
/*
* Test the Permissions section in the Control Center.
*/
const PERMISSIONS_PAGE = getRootDirectory(gTestPath).replace("chrome://mochitests/content", "https://example.com") + "permissions.html";
registerCleanupFunction(function() {
SitePermissions.remove(gBrowser.currentURI, "cookie");
SitePermissions.remove(gBrowser.currentURI, "geo");
SitePermissions.remove(gBrowser.currentURI, "camera");
SitePermissions.remove(gBrowser.currentURI, "microphone");
});
function* openIdentityPopup() {
let promise = BrowserTestUtils.waitForEvent(gIdentityHandler._identityPopup, "popupshown");
gIdentityHandler._identityBox.click();
return promise;
}
function* closeIdentityPopup() {
let promise = BrowserTestUtils.waitForEvent(gIdentityHandler._identityPopup, "popuphidden");
gIdentityHandler._identityPopup.hidePopup();
return promise;
}
add_task(function* testMainViewVisible() {
yield BrowserTestUtils.withNewTab(PERMISSIONS_PAGE, function*() {
let permissionsList = document.getElementById("identity-popup-permission-list");
let emptyLabel = permissionsList.nextSibling.nextSibling;
yield openIdentityPopup();
ok(!is_hidden(emptyLabel), "List of permissions is empty");
yield closeIdentityPopup();
SitePermissions.set(gBrowser.currentURI, "camera", SitePermissions.ALLOW);
yield openIdentityPopup();
ok(is_hidden(emptyLabel), "List of permissions is not empty");
let labelText = SitePermissions.getPermissionLabel("camera");
let labels = permissionsList.querySelectorAll(".identity-popup-permission-label");
is(labels.length, 1, "One permission visible in main view");
is(labels[0].textContent, labelText, "Correct value");
let img = permissionsList.querySelector("image.identity-popup-permission-icon");
ok(img, "There is an image for the permissions");
ok(img.classList.contains("camera-icon"), "proper class is in image class");
yield closeIdentityPopup();
SitePermissions.remove(gBrowser.currentURI, "camera");
yield openIdentityPopup();
ok(!is_hidden(emptyLabel), "List of permissions is empty");
yield closeIdentityPopup();
});
});
add_task(function* testIdentityIcon() {
yield BrowserTestUtils.withNewTab(PERMISSIONS_PAGE, function*() {
SitePermissions.set(gBrowser.currentURI, "geo", SitePermissions.ALLOW);
ok(gIdentityHandler._identityBox.classList.contains("grantedPermissions"),
"identity-box signals granted permissions");
SitePermissions.remove(gBrowser.currentURI, "geo");
ok(!gIdentityHandler._identityBox.classList.contains("grantedPermissions"),
"identity-box doesn't signal granted permissions");
SitePermissions.set(gBrowser.currentURI, "camera", SitePermissions.BLOCK);
ok(!gIdentityHandler._identityBox.classList.contains("grantedPermissions"),
"identity-box doesn't signal granted permissions");
SitePermissions.set(gBrowser.currentURI, "cookie", SitePermissions.ALLOW_COOKIES_FOR_SESSION);
ok(gIdentityHandler._identityBox.classList.contains("grantedPermissions"),
"identity-box signals granted permissions");
SitePermissions.remove(gBrowser.currentURI, "geo");
SitePermissions.remove(gBrowser.currentURI, "camera");
SitePermissions.remove(gBrowser.currentURI, "cookie");
});
});
add_task(function* testCancelPermission() {
yield BrowserTestUtils.withNewTab(PERMISSIONS_PAGE, function*() {
let permissionsList = document.getElementById("identity-popup-permission-list");
let emptyLabel = permissionsList.nextSibling.nextSibling;
SitePermissions.set(gBrowser.currentURI, "geo", SitePermissions.ALLOW);
SitePermissions.set(gBrowser.currentURI, "camera", SitePermissions.BLOCK);
yield openIdentityPopup();
ok(is_hidden(emptyLabel), "List of permissions is not empty");
let cancelButtons = permissionsList
.querySelectorAll(".identity-popup-permission-remove-button");
cancelButtons[0].click();
let labels = permissionsList.querySelectorAll(".identity-popup-permission-label");
is(labels.length, 1, "One permission should be removed");
cancelButtons[1].click();
labels = permissionsList.querySelectorAll(".identity-popup-permission-label");
is(labels.length, 0, "One permission should be removed");
yield closeIdentityPopup();
});
});
add_task(function* testPermissionHints() {
yield BrowserTestUtils.withNewTab(PERMISSIONS_PAGE, function*(browser) {
let permissionsList = document.getElementById("identity-popup-permission-list");
let emptyHint = document.getElementById("identity-popup-permission-empty-hint");
let reloadHint = document.getElementById("identity-popup-permission-reload-hint");
yield openIdentityPopup();
ok(!is_hidden(emptyHint), "Empty hint is visible");
ok(is_hidden(reloadHint), "Reload hint is hidden");
yield closeIdentityPopup();
SitePermissions.set(gBrowser.currentURI, "geo", SitePermissions.ALLOW);
SitePermissions.set(gBrowser.currentURI, "camera", SitePermissions.BLOCK);
yield openIdentityPopup();
ok(is_hidden(emptyHint), "Empty hint is hidden");
ok(is_hidden(reloadHint), "Reload hint is hidden");
let cancelButtons = permissionsList
.querySelectorAll(".identity-popup-permission-remove-button");
SitePermissions.remove(gBrowser.currentURI, "camera");
cancelButtons[0].click();
ok(is_hidden(emptyHint), "Empty hint is hidden");
ok(!is_hidden(reloadHint), "Reload hint is visible");
cancelButtons[1].click();
ok(is_hidden(emptyHint), "Empty hint is hidden");
ok(!is_hidden(reloadHint), "Reload hint is visible");
yield closeIdentityPopup();
let loaded = BrowserTestUtils.browserLoaded(browser);
BrowserTestUtils.loadURI(browser, PERMISSIONS_PAGE);
yield loaded;
yield openIdentityPopup();
ok(!is_hidden(emptyHint), "Empty hint is visible after reloading");
ok(is_hidden(reloadHint), "Reload hint is hidden after reloading");
yield closeIdentityPopup();
});
});
add_task(function* testPermissionIcons() {
yield BrowserTestUtils.withNewTab(PERMISSIONS_PAGE, function*() {
SitePermissions.set(gBrowser.currentURI, "camera", SitePermissions.ALLOW);
SitePermissions.set(gBrowser.currentURI, "geo", SitePermissions.BLOCK);
let geoIcon = gIdentityHandler._identityBox
.querySelector(".blocked-permission-icon[data-permission-id='geo']");
ok(geoIcon.hasAttribute("showing"), "blocked permission icon is shown");
let cameraIcon = gIdentityHandler._identityBox
.querySelector(".blocked-permission-icon[data-permission-id='camera']");
ok(!cameraIcon.hasAttribute("showing"),
"allowed permission icon is not shown");
SitePermissions.remove(gBrowser.currentURI, "geo");
ok(!geoIcon.hasAttribute("showing"),
"blocked permission icon is not shown after reset");
});
});

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

@ -3,12 +3,11 @@
"use strict";
Cu.import("resource:///modules/SitePermissions.jsm", this);
Cu.import("resource:///modules/E10SUtils.jsm");
const ORIGIN = "https://example.com";
const PERMISSIONS_PAGE = getRootDirectory(gTestPath).replace("chrome://mochitests/content", ORIGIN) + "permissions.html"
const SUBFRAME_PAGE = getRootDirectory(gTestPath).replace("chrome://mochitests/content", ORIGIN) + "temporary_permissions_subframe.html"
const PERMISSIONS_PAGE = getRootDirectory(gTestPath).replace("chrome://mochitests/content", ORIGIN) + "permissions.html";
const SUBFRAME_PAGE = getRootDirectory(gTestPath).replace("chrome://mochitests/content", ORIGIN) + "temporary_permissions_subframe.html";
const EXPIRE_TIME_MS = 100;
const TIMEOUT_MS = 500;
@ -38,7 +37,7 @@ add_task(function* testTempPermissionChangeEvents() {
// Test that temporary permissions can be re-requested after they expired
// and that the identity block is updated accordingly.
// TODO (blocked by bug 1334421): Write a check for webrtc permissions,
// TODO (bug 1349144): Write a check for webrtc permissions,
// because they use a different code path.
add_task(function* testTempPermissionRequestAfterExpiry() {
yield SpecialPowers.pushPrefEnv({set: [

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

@ -3,8 +3,6 @@
"use strict";
Cu.import("resource:///modules/SitePermissions.jsm", this);
// Test that temporary permissions are removed on user initiated reload only.
add_task(function* testTempPermissionOnReload() {
let uri = NetUtil.newURI("https://example.com");

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

@ -3,8 +3,6 @@
"use strict";
Cu.import("resource:///modules/SitePermissions.jsm", this);
// Test that temp permissions are persisted through moving tabs to new windows.
add_task(function* testTempPermissionOnTabMove() {
let uri = NetUtil.newURI("https://example.com");

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

@ -0,0 +1,18 @@
Cu.import("resource:///modules/SitePermissions.jsm", this);
function is_hidden(element) {
var style = element.ownerGlobal.getComputedStyle(element);
if (style.display == "none")
return true;
if (style.visibility != "visible")
return true;
if (style.display == "-moz-popup")
return ["hiding", "closed"].indexOf(element.state) != -1;
// Hiding a parent element will hide all its children
if (element.parentNode != element.ownerDocument)
return is_hidden(element.parentNode);
return false;
}

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

@ -5,6 +5,6 @@
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"></meta>
</head>
<body>
<iframe id="frame" src="https://example.org/browser/browser/base/content/test/general/permissions.html" />
<iframe id="frame" src="https://example.org/browser/browser/base/content/test/permissions/permissions.html" />
</body>
</html>

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

@ -46,7 +46,7 @@ support-files =
file_csp_block_all_mixedcontent.js
[browser_identity_UI.js]
[browser_identityBlock_focus.js]
support-files = ../general/permissions.html
support-files = ../permissions/permissions.html
[browser_identityPopup_focus.js]
[browser_insecureLoginForms.js]
support-files =

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

@ -670,33 +670,13 @@ function isBidiEnabled() {
if (getBoolPref("bidi.browser.ui", false))
return true;
// then check intl.uidirection.<locale>
var chromeReg = Components.classes["@mozilla.org/chrome/chrome-registry;1"].
getService(Components.interfaces.nsIXULChromeRegistry);
if (chromeReg.isLocaleRTL("global"))
return true;
// now see if the app locale is an RTL one.
const isRTL = Services.locale.isAppLocaleRTL;
// now see if the system locale is an RTL one.
var rv = false;
try {
var localeService = Components.classes["@mozilla.org/intl/nslocaleservice;1"]
.getService(Components.interfaces.nsILocaleService);
var systemLocale = localeService.getSystemLocale().getCategory("NSILOCALE_CTYPE").substr(0, 3);
switch (systemLocale) {
case "ar-":
case "he-":
case "fa-":
case "ug-":
case "ur-":
case "syr":
rv = true;
Services.prefs.setBoolPref("bidi.browser.ui", true);
}
} catch (e) {}
return rv;
if (isRTL) {
Services.prefs.setBoolPref("bidi.browser.ui", true);
}
return isRTL;
}
function openAboutDialog() {

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

@ -21,6 +21,7 @@ BROWSER_CHROME_MANIFESTS += [
'content/test/general/browser.ini',
'content/test/newtab/browser.ini',
'content/test/pageinfo/browser.ini',
'content/test/permissions/browser.ini',
'content/test/plugins/browser.ini',
'content/test/popupNotifications/browser.ini',
'content/test/popups/browser.ini',

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

@ -150,7 +150,7 @@ function* test_cookie_cleared() {
}
// Forget the site.
ForgetAboutSite.removeDataFromDomain(TEST_HOST);
yield ForgetAboutSite.removeDataFromDomain(TEST_HOST);
// Check that whether cookies has been cleared or not.
for (let userContextId of Object.keys(USER_CONTEXTS)) {
@ -185,7 +185,7 @@ function* test_cache_cleared() {
}
// Forget the site.
ForgetAboutSite.removeDataFromDomain(TEST_HOST);
yield ForgetAboutSite.removeDataFromDomain(TEST_HOST);
// Check that do caches be removed or not?
for (let userContextId of Object.keys(USER_CONTEXTS)) {
@ -217,7 +217,7 @@ function* test_image_cache_cleared() {
gHits = 0;
// Forget the site.
ForgetAboutSite.removeDataFromDomain("localhost:" + gHttpServer.identity.primaryPort + "/");
yield ForgetAboutSite.removeDataFromDomain("localhost:" + gHttpServer.identity.primaryPort + "/");
// Load again.
for (let userContextId of Object.keys(USER_CONTEXTS)) {
@ -276,7 +276,7 @@ function* test_storage_cleared() {
}
// Forget the site.
ForgetAboutSite.removeDataFromDomain(TEST_HOST);
yield ForgetAboutSite.removeDataFromDomain(TEST_HOST);
// Open the tab again without setting the localStorage and check that the
// local storage has been cleared or not.

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

@ -45,7 +45,7 @@ add_task(function* () {
}
// Cleanup.
ForgetAboutSite.removeDataFromDomain(COOKIE.host);
yield ForgetAboutSite.removeDataFromDomain(COOKIE.host);
Assert.equal(Services.cookies.countCookiesFromHost(COOKIE.host), 0,
"There are no cookies after cleanup");
});

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

@ -249,7 +249,8 @@ PlacesController.prototype = {
host = queries[0].domain;
} else
host = NetUtil.newURI(this._view.selectedNode.uri).host;
ForgetAboutSite.removeDataFromDomain(host);
ForgetAboutSite.removeDataFromDomain(host)
.catch(Components.utils.reportError);
break;
case "cmd_selectAll":
this.selectAll();

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

@ -8,7 +8,7 @@
<?xml-stylesheet href="chrome://browser/skin/preferences/preferences.css"?>
<?xml-stylesheet href="chrome://global/skin/in-content/common.css"?>
<?xml-stylesheet
href="chrome://browser/skin/preferences/in-content/preferences.css"?>
href="chrome://browser/skin/preferences/in-content-old/preferences.css"?>
<?xml-stylesheet
href="chrome://browser/content/preferences/handlers.css"?>
<?xml-stylesheet href="chrome://browser/skin/preferences/applications.css"?>

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

@ -4,18 +4,19 @@
Components.utils.import("resource://gre/modules/ForgetAboutSite.jsm");
function waitForClearHistory(aCallback) {
let observer = {
observe(aSubject, aTopic, aData) {
Services.obs.removeObserver(this, "browser:purge-domain-data");
setTimeout(aCallback, 0);
}
};
Services.obs.addObserver(observer, "browser:purge-domain-data", false);
function promiseClearHistory() {
return new Promise(resolve => {
let observer = {
observe(aSubject, aTopic, aData) {
Services.obs.removeObserver(this, "browser:purge-domain-data");
resolve();
}
};
Services.obs.addObserver(observer, "browser:purge-domain-data", false);
});
}
function test() {
waitForExplicitFinish();
add_task(function* () {
// utility functions
function countClosedTabsByTitle(aClosedTabList, aTitle) {
return aClosedTabList.filter(aData => aData.title == aTitle).length;
@ -92,39 +93,37 @@ function test() {
ss.setBrowserState(JSON.stringify(testState));
// purge domain & check that we purged correctly for closed windows
ForgetAboutSite.removeDataFromDomain("mozilla.org");
waitForClearHistory(function() {
let closedWindowData = JSON.parse(ss.getClosedWindowData());
yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
yield promiseClearHistory();
let closedWindowData = JSON.parse(ss.getClosedWindowData());
// First set of tests for _closedWindows[0] - tests basics
let win = closedWindowData[0];
is(win.tabs.length, 1, "1 tab was removed");
is(countOpenTabsByTitle(win.tabs, FORGET), 0,
"The correct tab was removed");
is(countOpenTabsByTitle(win.tabs, REMEMBER), 1,
"The correct tab was remembered");
is(win.selected, 1, "Selected tab has changed");
is(win.title, REMEMBER, "The window title was correctly updated");
// First set of tests for _closedWindows[0] - tests basics
let win = closedWindowData[0];
is(win.tabs.length, 1, "1 tab was removed");
is(countOpenTabsByTitle(win.tabs, FORGET), 0,
"The correct tab was removed");
is(countOpenTabsByTitle(win.tabs, REMEMBER), 1,
"The correct tab was remembered");
is(win.selected, 1, "Selected tab has changed");
is(win.title, REMEMBER, "The window title was correctly updated");
// Test more complicated case
win = closedWindowData[1];
is(win.tabs.length, 3, "2 tabs were removed");
is(countOpenTabsByTitle(win.tabs, FORGET), 0,
"The correct tabs were removed");
is(countOpenTabsByTitle(win.tabs, REMEMBER), 3,
"The correct tabs were remembered");
is(win.selected, 3, "Selected tab has changed");
is(win.title, REMEMBER, "The window title was correctly updated");
// Test more complicated case
win = closedWindowData[1];
is(win.tabs.length, 3, "2 tabs were removed");
is(countOpenTabsByTitle(win.tabs, FORGET), 0,
"The correct tabs were removed");
is(countOpenTabsByTitle(win.tabs, REMEMBER), 3,
"The correct tabs were remembered");
is(win.selected, 3, "Selected tab has changed");
is(win.title, REMEMBER, "The window title was correctly updated");
// Tests handling of _closedTabs
win = closedWindowData[2];
is(countClosedTabsByTitle(win._closedTabs, REMEMBER), 1,
"The correct number of tabs were removed, and the correct ones");
is(countClosedTabsByTitle(win._closedTabs, FORGET), 0,
"All tabs to be forgotten were indeed removed");
// Tests handling of _closedTabs
win = closedWindowData[2];
is(countClosedTabsByTitle(win._closedTabs, REMEMBER), 1,
"The correct number of tabs were removed, and the correct ones");
is(countClosedTabsByTitle(win._closedTabs, FORGET), 0,
"All tabs to be forgotten were indeed removed");
// restore pre-test state
ss.setBrowserState(oldState);
finish();
});
}
// restore pre-test state
ss.setBrowserState(oldState);
});

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

@ -4,21 +4,21 @@
Components.utils.import("resource://gre/modules/ForgetAboutSite.jsm");
function waitForClearHistory(aCallback) {
let observer = {
observe(aSubject, aTopic, aData) {
Services.obs.removeObserver(this, "browser:purge-domain-data");
setTimeout(aCallback, 0);
}
};
Services.obs.addObserver(observer, "browser:purge-domain-data", false);
function promiseClearHistory() {
return new Promise(resolve => {
let observer = {
observe(aSubject, aTopic, aData) {
Services.obs.removeObserver(this, "browser:purge-domain-data");
resolve();
}
};
Services.obs.addObserver(observer, "browser:purge-domain-data", false);
});
}
function test() {
add_task(function* () {
/** Test for Bug 464199 **/
waitForExplicitFinish();
const REMEMBER = Date.now(), FORGET = Math.random();
let test_state = { windows: [{ "tabs": [{ "entries": [] }], _closedTabs: [
{ state: { entries: [{ url: "http://www.example.net/" }] }, title: FORGET },
@ -53,33 +53,30 @@ function test() {
// open a window and add the above closed tab list
let newWin = openDialog(location, "", "chrome,all,dialog=no");
promiseWindowLoaded(newWin).then(() => {
gPrefService.setIntPref("browser.sessionstore.max_tabs_undo",
test_state.windows[0]._closedTabs.length);
ss.setWindowState(newWin, JSON.stringify(test_state), true);
yield promiseWindowLoaded(newWin);
gPrefService.setIntPref("browser.sessionstore.max_tabs_undo",
test_state.windows[0]._closedTabs.length);
ss.setWindowState(newWin, JSON.stringify(test_state), true);
let closedTabs = JSON.parse(ss.getClosedTabData(newWin));
is(closedTabs.length, test_state.windows[0]._closedTabs.length,
"Closed tab list has the expected length");
is(countByTitle(closedTabs, FORGET),
test_state.windows[0]._closedTabs.length - remember_count,
"The correct amout of tabs are to be forgotten");
is(countByTitle(closedTabs, REMEMBER), remember_count,
"Everything is set up.");
let closedTabs = JSON.parse(ss.getClosedTabData(newWin));
is(closedTabs.length, test_state.windows[0]._closedTabs.length,
"Closed tab list has the expected length");
is(countByTitle(closedTabs, FORGET),
test_state.windows[0]._closedTabs.length - remember_count,
"The correct amout of tabs are to be forgotten");
is(countByTitle(closedTabs, REMEMBER), remember_count,
"Everything is set up.");
ForgetAboutSite.removeDataFromDomain("example.net");
waitForClearHistory(function() {
closedTabs = JSON.parse(ss.getClosedTabData(newWin));
is(closedTabs.length, remember_count,
"The correct amout of tabs was removed");
is(countByTitle(closedTabs, FORGET), 0,
"All tabs to be forgotten were indeed removed");
is(countByTitle(closedTabs, REMEMBER), remember_count,
"... and tabs to be remembered weren't.");
// clean up
gPrefService.clearUserPref("browser.sessionstore.max_tabs_undo");
BrowserTestUtils.closeWindow(newWin).then(finish);
});
});
}
yield ForgetAboutSite.removeDataFromDomain("example.net");
yield promiseClearHistory();
closedTabs = JSON.parse(ss.getClosedTabData(newWin));
is(closedTabs.length, remember_count,
"The correct amout of tabs was removed");
is(countByTitle(closedTabs, FORGET), 0,
"All tabs to be forgotten were indeed removed");
is(countByTitle(closedTabs, REMEMBER), remember_count,
"... and tabs to be remembered weren't.");
// clean up
gPrefService.clearUserPref("browser.sessionstore.max_tabs_undo");
yield BrowserTestUtils.closeWindow(newWin);
});

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

@ -57,6 +57,16 @@ browser/chrome/en-US/locale/browser/preferences/sync.dtd
browser/chrome/en-US/locale/browser/preferences/privacy.dtd
browser/chrome/en-US/locale/browser/preferences/advanced.dtd
browser/chrome/en-US/locale/browser/preferences/preferences.properties
browser/chrome/browser/skin/classic/browser/preferences/in-content-old/search.css
browser/chrome/browser/skin/classic/browser/preferences/in-content-old/containers.css
browser/chrome/browser/skin/classic/browser/preferences/in-content-old/favicon.ico
browser/chrome/browser/skin/classic/browser/preferences/in-content-old/icons.svg
browser/chrome/browser/skin/classic/browser/preferences/in-content-old/preferences.css
browser/chrome/browser/skin/classic/browser/preferences/in-content/search.css
browser/chrome/browser/skin/classic/browser/preferences/in-content/containers.css
browser/chrome/browser/skin/classic/browser/preferences/in-content/favicon.ico
browser/chrome/browser/skin/classic/browser/preferences/in-content/icons.svg
browser/chrome/browser/skin/classic/browser/preferences/in-content/preferences.css
# browser branding / themes is bug 1313106
browser/chrome/browser/content/branding/icon128.png
browser/chrome/browser/content/branding/icon16.png

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

@ -73,6 +73,7 @@ browser.jar:
skin/classic/browser/places/downloads.png (places/downloads.png)
skin/classic/browser/preferences/alwaysAsk.png (preferences/alwaysAsk.png)
skin/classic/browser/preferences/preferences.css (preferences/preferences.css)
* skin/classic/browser/preferences/in-content-old/preferences.css (preferences/in-content-old/preferences.css)
* skin/classic/browser/preferences/in-content/preferences.css (preferences/in-content/preferences.css)
* skin/classic/browser/preferences/in-content/dialog.css (preferences/in-content/dialog.css)
skin/classic/browser/preferences/applications.css (preferences/applications.css)

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

@ -0,0 +1,48 @@
/* - 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/. */
%include ../../../shared/incontentprefs-old/preferences.inc.css
.treecol-sortdirection {
/* override the Linux only toolkit rule */
-moz-appearance: none;
}
.actionsMenu {
font-family: "Clear Sans", sans-serif;
font-size: 1.25rem;
line-height: 22px;
}
.actionsMenu > .menulist-label-box > .menulist-icon {
margin-top: 1px;
margin-inline-start: 1px;
margin-inline-end: 6px;
}
.actionsMenu > .menulist-label-box > .menulist-label {
margin-top: 2px !important;
}
#fxaProfileImage {
-moz-user-focus: normal;
}
menulist.actionsMenu > .menulist-dropmarker {
margin-top: 11px;
margin-bottom: 11px;
}
textbox + button,
filefield + button {
margin-inline-start: -4px;
}
/**
* Dialog
*/
#dialogTitle {
font-size: 1em;
}

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

@ -112,6 +112,7 @@ browser.jar:
skin/classic/browser/preferences/application.png (preferences/application.png)
skin/classic/browser/preferences/saveFile.png (preferences/saveFile.png)
* skin/classic/browser/preferences/preferences.css (preferences/preferences.css)
* skin/classic/browser/preferences/in-content-old/preferences.css (preferences/in-content-old/preferences.css)
* skin/classic/browser/preferences/in-content/preferences.css (preferences/in-content/preferences.css)
* skin/classic/browser/preferences/in-content/dialog.css (preferences/in-content/dialog.css)
skin/classic/browser/preferences/applications.css (preferences/applications.css)

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

@ -0,0 +1,53 @@
/* - 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/. */
%include ../../../shared/incontentprefs-old/preferences.inc.css
prefpane .groupbox-title {
background: none;
margin-bottom: 0;
}
.actionsMenu > .menulist-label-box > .menulist-icon {
margin-top: 2px;
margin-inline-start: 2px;
margin-inline-end: 8px !important;
}
#downloadFolder > .fileFieldContentBox {
padding-inline-start: 3px;
}
#fxaProfileImage {
-moz-user-focus: normal;
}
textbox + button {
margin-inline-start: -4px;
}
filefield + button {
margin-inline-start: -8px;
}
#popupPolicyRow {
/* Override styles from
browser/themes/osx/preferences/preferences.css */
margin-bottom: 0 !important;
padding-bottom: 0 !important;
border-bottom: none;
}
#advancedPrefs {
margin-right: 0; /*override margin from normal preferences.css */
margin-left: 0;
}
/**
* Dialog
*/
#dialogTitle {
font-size: 1.1em;
}

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

@ -0,0 +1,32 @@
/* 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/. */
%include ../../../components/contextualidentity/content/usercontext.css
.container-header-links {
margin-block-end: 15px;
}
[data-identity-icon] {
margin: 0;
margin-inline-end: 16px;
}
#containersView {
border: 0 none;
background: transparent;
}
#containersView richlistitem {
margin: 0px;
margin-inline-end: 8px;
padding: 0;
padding-block-end: 8px;
border-block-end: 1px solid var(--in-content-header-border-color);
}
#containersView richlistitem:last-of-type {
border-block-end: 0 none;
margin-block-end: 8px;
}

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

@ -0,0 +1,68 @@
%if 0
/* - 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/. */
%endif
dialog,
window,
prefpane,
prefwindow,
.windowDialog {
-moz-appearance: none;
background-color: #fbfbfb;
color: #424e5a;
margin: 0;
padding: 0;
}
.contentPane {
margin: 0;
}
tabbox {
/* override the rule in certManager.xul */
margin: 0 0 5px !important;
}
tabpanels {
font-size: 1em;
}
tabs,
label,
description,
#useDocumentColors {
margin-right: 4px;
margin-left: 4px;
}
tree:not(#rejectsTree) {
min-height: 15em;
}
.actionButtons {
margin: 3px 0 0 !important;
}
caption {
padding-inline-start: 0;
}
groupbox {
font-size: 1em;
margin-top: 0;
margin-right: 4px;
margin-left: 4px;
padding-top: 0;
padding-bottom: 5px;
}
prefpane .groupbox-body {
padding: 0 0 5px;
}
groupbox description {
margin-right: 0;
margin-left: 0;
}

Двоичные данные
browser/themes/shared/incontentprefs-old/favicon.ico Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 933 B

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

@ -0,0 +1,63 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- 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/. -->
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24">
<style>
use:not(:target) {
display: none;
}
use {
fill: #fbfbfb;
stroke: rgba(0,0,0,0.4);
stroke-width: .5px;
}
use[id$="-native"] {
fill: ThreeDHighlight;
}
</style>
<defs>
<g id="general-shape">
<path d="M18.97,3H5.03C3.914,3,3,3.914,3,5.03v13.94C3,20.086,3.914,21,5.03,21H18.97c1.117,0,2.03-0.914,2.03-2.03 V5.03C21,3.914,20.086,3,18.97,3z M5.35,19.326c-0.404,0-0.731-0.327-0.731-0.731c0-0.404,0.327-0.731,0.731-0.731 c0.404,0,0.731,0.327,0.731,0.731C6.081,19,5.754,19.326,5.35,19.326z M5.35,6.168c-0.403,0-0.731-0.328-0.731-0.731 c0-0.404,0.328-0.731,0.731-0.731c0.403,0,0.731,0.327,0.731,0.731C6.081,5.84,5.753,6.168,5.35,6.168z M15.243,14.035 c0,0.229-0.186,0.416-0.414,0.416c-0.229,0-0.415,0.186-0.415,0.414v3.347c0,0.228-0.185,0.384-0.414,0.384l-4.141,0.03 c-0.227,0-0.414-0.186-0.414-0.414v-3.347c0-0.228-0.185-0.414-0.414-0.414c-0.227,0-0.414-0.187-0.414-0.416V6.582 c0-0.229,0.187-0.414,0.414-0.414h5.798c0.228,0,0.414,0.185,0.414,0.414V14.035z M18.509,19.326c-0.404,0-0.731-0.327-0.731-0.731 c0-0.404,0.327-0.731,0.731-0.731c0.404,0,0.731,0.327,0.731,0.731C19.24,19,18.913,19.326,18.509,19.326z M18.509,6.168 c-0.404,0-0.731-0.328-0.731-0.731c0-0.404,0.327-0.731,0.731-0.731c0.404,0,0.731,0.327,0.731,0.731 C19.24,5.84,18.913,6.168,18.509,6.168z"/>
<path d="M12.757,7.824h-1.657c-0.456,0-0.828,0.373-0.828,0.828v8.282c0,0.456,0.373,0.828,0.828,0.828h1.657 c0.456,0,0.828-0.373,0.828-0.828V8.652C13.586,8.196,13.213,7.824,12.757,7.824z"/>
</g>
<g id="search-shape">
<path d="M2,10.018c0,4.43,3.585,8.019,8.009,8.019 c1.603,0,3.095-0.473,4.348-1.285l4.806,4.81c0.58,0.583,1.523,0.583,2.105,0l0.296-0.297c0.582-0.583,0.582-1.527,0-2.11 l-4.808-4.814c0.8-1.247,1.265-2.73,1.265-4.323c0-4.43-3.587-8.018-8.012-8.018C5.585,2,2,5.589,2,10.018z M5.104,10.021 c0-2.716,2.196-4.915,4.906-4.915c2.71,0,4.908,2.199,4.908,4.915c0,2.712-2.198,4.911-4.908,4.911 C7.3,14.931,5.104,12.732,5.104,10.021z"/>
</g>
<g id="content-shape">
<path d="M16.286,2H5.571C4.388,2,3.429,2.96,3.429,4.143v15.714 C3.429,21.04,4.388,22,5.571,22h12.857c1.185,0,2.143-0.96,2.143-2.143V6.286L16.286,2z M18.945,19.223c0,0.22-0.18,0.4-0.4,0.4 h-13.2c-0.22,0-0.4-0.18-0.4-0.4v-0.846c0-0.22,0.18-0.4,0.4-0.4h13.2c0.22,0,0.4,0.18,0.4,0.4V19.223z M18.945,15.223 c0,0.22-0.18,0.4-0.4,0.4h-13.2c-0.22,0-0.4-0.18-0.4-0.4v-0.846c0-0.22,0.18-0.4,0.4-0.4h13.2c0.22,0,0.4,0.18,0.4,0.4V15.223z M18.945,11.229c0,0.22-0.18,0.4-0.4,0.4h-13.2c-0.22,0-0.4-0.18-0.4-0.4v-0.846c0-0.22,0.18-0.4,0.4-0.4h13.2 c0.22,0,0.4,0.18,0.4,0.4V11.229z M14.833,7.707v-4.65l4.65,4.65H14.833z"/>
</g>
<g id="applications-shape">
<path d="M16.673,8.914C16.089,4.122,13.248,1,12,1c-1.25,0-3.986,3.122-4.767,7.914l-3.122,3.131v7.889h2.268 l2.978-3.436c0.28,0.29,0.737,1.666,1.065,1.858h3.155c0.331-0.193,0.789-1.569,1.068-1.858l3.123,3.436h2.12v-7.84L16.673,8.914z M12.042,8.735c-0.604,0-1.279,0.06-1.818,0.165c0.478-1.453,1.345-3.117,1.781-3.117c0.435,0,1.301,1.655,1.775,3.1 C13.265,8.789,12.615,8.735,12.042,8.735z M12.524,19.145c0.076,0.196,0.119,0.602,0.119,0.86c0,0.66-0.524,1.074-0.687,1.074 c-0.163,0-0.615-0.414-0.615-1.074c0-0.257,0.045-0.664,0.119-0.86h-0.754c-0.089,0.345-0.39,1.005-0.39,1.408 c0,1.458,1.328,2.447,1.686,2.447c0.359,0,1.686-0.951,1.686-2.407c0-0.404-0.301-1.103-0.388-1.449H12.524z"/>
</g>
<g id="privacy-shape">
<path d="M21.632,9.541c-0.083,1.403,0.246,3.079-1.597,5.498 c-1.965,2.578-3.914,2.594-4.284,2.575c-2.249-0.117-2.502-1.875-3.792-1.875c-1.13,0-2.012,1.745-3.711,1.836 c-0.37,0.02-2.319,0.042-4.284-2.536c-1.841-2.419-1.514-4.095-1.597-5.498C2.287,8.138,2,6.618,2,6.618s0.887,0.895,2.033,0.973 C5.179,7.67,5.394,7.191,7.811,6.501C10.424,5.752,12,8.814,12,8.814s1.776-3.016,4.189-2.313c2.414,0.7,2.515,1.169,3.661,1.091 C20.996,7.513,22,6.618,22,6.618S21.713,8.138,21.632,9.541z M8.117,10.129c-1.429-0.314-2.028,0.223-2.642,0.451 c-0.534,0.202-1.02,0.264-1.02,0.264s0.083,0.819,1.515,1.521c1.432,0.703,4.37,0.338,4.37,0.338S10.651,10.687,8.117,10.129z M18.525,10.58c-0.612-0.228-1.212-0.765-2.642-0.451c-2.534,0.558-2.223,2.573-2.223,2.573s2.938,0.365,4.37-0.338 c1.432-0.702,1.515-1.521,1.515-1.521S19.059,10.782,18.525,10.58z"/>
</g>
<g id="security-shape">
<path d="M18.909,9.783h-0.863V8.086C18.046,4.725,15.339,2,12,2 C8.661,2,5.954,4.725,5.954,8.086v1.697H5.091c-0.955,0-1.728,0.779-1.728,1.739v8.738c0,0.961,0.773,1.74,1.728,1.74h13.818 c0.954,0,1.728-0.779,1.728-1.74v-8.738C20.637,10.562,19.863,9.783,18.909,9.783z M8.545,8.086c0-1.92,1.547-3.478,3.455-3.478 c1.908,0,3.455,1.557,3.455,3.478v1.697h-6.91V8.086z M5.181,16.092l-0.909-1.2v-2.284l2.728,3.483H5.181z M8.818,16.092 l-2.773-3.657h1.727l2.864,3.657H8.818z M12,16.092l-2.773-3.657h1.727l2.864,3.657H12z M15.637,16.092l-2.773-3.657h1.727 l2.864,3.657H15.637z M19.728,16.092h-0.455l-2.773-3.657h1.727l1.501,1.916V16.092z"/>
</g>
<g id="sync-shape">
<path d="M17.024,3.351 c-0.562,0.331 -1.311,0.879 -1.821,1.698 -0.367,0.592 -0.752,1.288 -1.08,1.914 0.987,0.413 1.862,1.095 2.476,2.029 0.614,0.957 0.929,2.122 0.83,3.351 -0.201,1.787 -1.359,3.433 -3.046,4.36 -0.696,-0.774 -1.951,-2.945 -1.951,-2.945 -0.007,0.007 -0.004,2.556 -0.871,4.334 -0.573,1.184 -1.24,2.202 -2.305,2.995 1.431,0.51 2.915,0.886 4.282,0.909 l 0.162,0.002 c 2.99,0.021 5.844,-0.48 5.844,-0.48 0,0 -1.236,-0.802 -1.808,-1.346 1.86,-1.072 3.111,-2.791 3.634,-4.708 0.283,-0.759 0.478,-1.566 0.57,-2.409 C 22.383,9.011 20.33,5.278 17.024,3.351 Z M 6.569,12.302 C 6.526,10.271 7.755,8.327 9.644,7.29 c 0.696,0.774 2.32,2.899 2.32,2.899 0,0 -0.064,-5.157 1.657,-7.973 -6.097,-0.668 -9.69,0.443 -9.69,0.443 0,0 1.763,0.607 2.333,1.136 C 6.122,3.891 5.984,3.992 5.85,4.096 4.4,5.064 3.368,6.449 2.825,7.994 2.436,8.892 2.171,9.863 2.06,10.887 1.622,14.886 3.629,18.572 6.871,20.515 7.39,20.124 7.975,19.631 8.61,18.983 9.189,18.389 9.647,17.682 10.021,16.967 8.082,16.208 6.714,14.404 6.569,12.302 Z"/>
</g>
<g id="advanced-shape">
<path d="M19.173,16.163c0.004,0.04,0.007,0.08,0.007,0.121c0,1.748-3.197,3.165-7.14,3.165 c-3.943,0-7.14-1.417-7.14-3.165c0 -0.037,0.003-0.073,0.006-0.109C3.11,16.572,2,17.243,2,18.341C2,20.362,6.477,22,12,22 c5.523,0,10-1.638,10-3.659 C22,17.22,20.922,16.553,19.173,16.163z"/>
<path d="M18.224,15.979c0.006-0.11-0.018-0.285-0.054-0.39c0,0-0.762-2.205-1.176-3.403 c-0.624-1.807-2.112-6.139-2.112-6.139c-0.036-0.104-0.031-0.273,0.01-0.376l0.497-1.234c0.041-0.102,0.116-0.266,0.166-0.364 l0.986-1.942c0.05-0.098,0.013-0.133-0.081-0.077L9.965,5.871c-0.095,0.056-0.203,0.186-0.24,0.29c0,0-0.252,0.7-0.412,1.144 C8.64,9.173,7.968,11.04,7.296,12.908c-0.26,0.723-0.52,1.446-0.78,2.168c-0.056,0.156-0.112,0.311-0.168,0.466 c-0.093,0.26-0.049,0.617,0.032,0.881c0.237,0.763,1.001,1.189,1.708,1.435c0.611,0.213,1.254,0.328,1.895,0.403 c0.895,0.105,1.805,0.14,2.706,0.112c1.356-0.041,2.767-0.261,4.004-0.846c0.429-0.203,0.854-0.459,1.174-0.816 c0.121-0.135,0.226-0.287,0.297-0.455C18.215,16.134,18.224,15.979,18.224,15.979z M14.063,16.131 c0.019,0.108-0.046,0.156-0.143,0.104l-1.466-0.772c-0.097-0.052-0.257-0.052-0.354,0l-1.466,0.773 c-0.097,0.052-0.162,0.004-0.143-0.104l0.28-1.636c0.019-0.109-0.031-0.261-0.109-0.338l-1.186-1.158 c-0.079-0.077-0.054-0.153,0.055-0.169l1.638-0.239c0.109-0.016,0.238-0.11,0.286-0.209l0.733-1.488 c0.049-0.099,0.128-0.099,0.177,0l0.733,1.488c0.049,0.099,0.178,0.193,0.286,0.209l1.639,0.239 c0.109,0.016,0.134,0.092,0.055,0.169l-1.186,1.158c-0.079,0.077-0.128,0.229-0.109,0.338L14.063,16.131z"/>
</g>
</defs>
<use id="general" xlink:href="#general-shape"/>
<use id="general-native" xlink:href="#general-shape"/>
<use id="search" xlink:href="#search-shape"/>
<use id="search-native" xlink:href="#search-shape"/>
<use id="content" xlink:href="#content-shape"/>
<use id="content-native" xlink:href="#content-shape"/>
<use id="applications" xlink:href="#applications-shape"/>
<use id="applications-native" xlink:href="#applications-shape"/>
<use id="privacy" xlink:href="#privacy-shape"/>
<use id="privacy-native" xlink:href="#privacy-shape"/>
<use id="security" xlink:href="#security-shape"/>
<use id="security-native" xlink:href="#security-shape"/>
<use id="sync" xlink:href="#sync-shape"/>
<use id="sync-native" xlink:href="#sync-shape"/>
<use id="advanced" xlink:href="#advanced-shape"/>
<use id="advanced-native" xlink:href="#advanced-shape"/>
</svg>

После

Ширина:  |  Высота:  |  Размер: 8.6 KiB

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

@ -0,0 +1,566 @@
%if 0
/* - 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/. */
%endif
@namespace html "http://www.w3.org/1999/xhtml";
#mainPrefPane {
max-width: 800px;
padding: 0;
font: message-box;
font-size: 1.25rem;
}
* {
-moz-user-select: text;
}
button,
treecol {
/* override the * rule */
-moz-user-select: none;
}
#engineList treechildren::-moz-tree-image(engineShown, checked),
#blocklistsTree treechildren::-moz-tree-image(selectionCol, checked) {
list-style-image: url("chrome://global/skin/in-content/check.svg#check");
width: 21px;
height: 21px;
}
#engineList treechildren::-moz-tree-image(engineShown, checked, selected),
#blocklistsTree treechildren::-moz-tree-image(selectionCol, checked, selected) {
list-style-image: url("chrome://global/skin/in-content/check.svg#check-inverted");
}
#engineList treechildren::-moz-tree-row,
#blocklistsTree treechildren::-moz-tree-row {
min-height: 36px;
}
#selectionCol {
min-width: 26px;
}
.learnMore {
margin-inline-start: 10px;
font-weight: normal;
white-space: nowrap;
}
/* Category List */
#categories {
max-height: 100vh;
}
#categories > scrollbox {
overflow-x: hidden !important;
}
/**
* We want the last category to always have non-0 getBoundingClientRect().bottom
* so we can use the value to figure out the max-height of the list in
* preferences.js, so use collapse instead of display: none; if it's hidden
*/
#categories > .category[hidden="true"] {
display: -moz-box;
visibility: collapse;
}
#category-general > .category-icon {
list-style-image: url("chrome://browser/skin/preferences/in-content-old/icons.svg#general");
}
#category-search > .category-icon {
list-style-image: url("chrome://browser/skin/preferences/in-content-old/icons.svg#search");
}
#category-content > .category-icon {
list-style-image: url("chrome://browser/skin/preferences/in-content-old/icons.svg#content");
}
#category-application > .category-icon {
list-style-image: url("chrome://browser/skin/preferences/in-content-old/icons.svg#applications");
}
#category-privacy > .category-icon {
list-style-image: url("chrome://browser/skin/preferences/in-content-old/icons.svg#privacy");
}
#category-security > .category-icon {
list-style-image: url("chrome://browser/skin/preferences/in-content-old/icons.svg#security");
}
#category-sync > .category-icon {
list-style-image: url("chrome://browser/skin/preferences/in-content-old/icons.svg#sync");
}
#category-advanced > .category-icon {
list-style-image: url("chrome://browser/skin/preferences/in-content-old/icons.svg#advanced");
}
@media (max-width: 800px) {
.category-name {
display: none;
}
}
/* header */
.header {
display: flex;
align-items: center;
justify-content: space-between;
}
.header[hidden=true] {
display: none;
}
#header-advanced {
border-bottom: none;
padding-bottom: 0;
}
/* General Pane */
#startupTable {
border-collapse: collapse;
}
#startupTable > tr > td {
padding: 0; /* remove the padding from html.css */
}
#startupTable > tr:not(:first-child) > td {
padding-top: 0.5em; /* add a spacing between the rows */
}
#startupTable > tr > .label-cell {
text-align: end;
width: 0; /* make the column as small as possible */
}
#startupTable > tr > .label-cell > label {
white-space: nowrap;
}
#startupTable > tr > .content-cell > menulist,
#startupTable > tr > .content-cell > textbox {
width: calc(100% - 8px);
margin-left: 4px;
margin-right: 4px;
}
#startupTable > tr > .homepage-buttons {
display: flex;
flex-wrap: wrap;
}
#startupTable > tr > .homepage-buttons > .content-cell-item {
flex-grow: 1;
}
#useFirefoxSync {
font-size: 90%;
margin-inline-end: 8px !important;
}
#getStarted {
font-size: 90%;
}
#isNotDefaultLabel {
font-weight: bold;
}
#downloadFolder {
margin-inline-start: 0;
}
#browserHomePage:-moz-locale-dir(rtl) input {
unicode-bidi: plaintext;
direction: rtl;
}
/* Content pane */
#defaultFontSizeLabel {
/* !important needed to override common !important rule */
margin-inline-start: 4px !important;
}
/* Applications Pane Styles */
#applicationsContent {
padding: 15px 0;
}
#filter {
margin-inline-start: 0;
}
#handlersView {
height: 25em;
}
#handlersView > richlistitem {
min-height: 36px !important;
}
.typeIcon {
margin-inline-start: 10px !important;
margin-inline-end: 9px !important;
}
.actionIcon {
margin-inline-start: 11px !important;
margin-inline-end: 8px !important;
}
.actionsMenu {
min-height: 36px;
}
.actionsMenu > menupopup > menuitem {
padding-inline-start: 10px !important;
}
.actionsMenu > menupopup > menuitem > .menu-iconic-left {
margin-inline-end: 8px !important;
}
/* Privacy pane */
.doNotTrackLearnMore {
margin-inline-start: calc(1em + 30px);
margin-bottom: 1em;
font-weight: normal;
}
.doNotTrackLearnMore > label {
font-size: 1em !important;
margin-left: 0;
}
/* Collapse the non-active vboxes in decks to use only the height the
active vbox needs */
#historyPane:not([selectedIndex="1"]) > #historyDontRememberPane,
#historyPane:not([selectedIndex="2"]) > #historyCustomPane,
#weavePrefsDeck:not([selectedIndex="1"]) > #hasFxaAccount,
#fxaLoginStatus:not([selectedIndex="1"]) > #fxaLoginUnverified,
#fxaLoginStatus:not([selectedIndex="2"]) > #fxaLoginRejected {
visibility: collapse;
}
/* XXX This style is for bug 740213 and should be removed once that
bug has a solution. */
description > html|a {
cursor: pointer;
}
#weavePrefsDeck > vbox > label,
#weavePrefsDeck > vbox > groupbox,
#weavePrefsDeck > vbox > description,
#weavePrefsDeck > #hasFxaAccount > vbox > label,
#weavePrefsDeck > #hasFxaAccount > hbox > label {
/* no margin-inline-start for elements at the beginning of a line */
margin-inline-start: 0;
}
#tabsElement {
margin-inline-end: 4px; /* add the 4px end-margin of other elements */
}
.indent {
/* !important needed to override margin-inline-start:0 !important; rule
define in common.css for labels */
margin-inline-start: 33px !important;
}
.text-link {
margin-bottom: 0;
}
#showUpdateHistory {
margin-inline-start: 0;
}
/**
* Dialog
*/
#dialogOverlay {
background-color: rgba(0,0,0,0.5);
visibility: hidden;
}
#dialogBox {
background-color: #fbfbfb;
background-clip: content-box;
color: #424e5a;
font-size: 14px;
/* `transparent` will use the dialogText color in high-contrast themes and
when page colors are disabled */
border: 1px solid transparent;
border-radius: 3.5px;
box-shadow: 0 2px 6px 0 rgba(0,0,0,0.3);
display: -moz-box;
margin: 0;
padding: 0;
}
#dialogBox[resizable="true"] {
resize: both;
overflow: hidden;
min-height: 20em;
min-width: 66ch;
}
#dialogBox > .groupbox-title {
padding: 3.5px 0;
background-color: #F1F1F1;
border-bottom: 1px solid #C1C1C1;
}
#dialogTitle {
text-align: center;
-moz-user-select: none;
}
.close-icon {
background-color: transparent !important;
border: none;
box-shadow: none;
padding: 0;
height: auto;
min-height: 16px;
min-width: 0;
}
#dialogBox > .groupbox-body {
-moz-appearance: none;
padding: 20px;
}
#dialogFrame {
-moz-box-flex: 1;
/* Default dialog dimensions */
width: 66ch;
}
.largeDialogContainer.doScroll {
overflow-y: auto;
-moz-box-flex: 1;
}
/**
* End Dialog
*/
/**
* Font dialog menulist fixes
*/
#defaultFontType,
#serif,
#sans-serif,
#monospace {
min-width: 30ch;
}
/**
* Sync
*/
#fxaProfileImage {
max-width: 60px;
border-radius: 50%;
list-style-image: url(chrome://browser/skin/fxa/default-avatar.svg);
margin-inline-end: 15px;
image-rendering: -moz-crisp-edges;
}
#fxaLoginStatus[hasName] #fxaProfileImage {
max-width: 80px;
}
#fxaProfileImage.actionable {
cursor: pointer;
}
#fxaProfileImage.actionable:hover {
box-shadow: 0px 0px 0px 1px #0095DD;
}
#fxaProfileImage.actionable:hover:active {
box-shadow: 0px 0px 0px 1px #ff9500;
}
#noFxaAccount {
padding-top: 15px;
}
#fxaContentWrapper {
-moz-box-flex: 1;
}
#noFxaGroup {
-moz-box-flex: 1;
margin: 0;
}
#fxaContentWrapper {
padding-right: 15px;
}
#noFxaGroup > vbox,
#fxaGroup {
-moz-box-align: start;
}
#fxaSyncEngines > vbox:first-child {
margin-right: 80px;
}
#fxaSyncComputerName {
margin-inline-start: 0px;
-moz-box-flex: 1;
}
#tosPP-small-ToS {
margin-bottom: 14px;
}
#noFxaCaption {
font-weight: bold;
margin-bottom: 11px;
}
.fxaSyncIllustration {
margin-top: 35px;
}
#syncOptions caption {
margin-bottom: 11px;
}
#fxaDeviceName {
margin-bottom: 27.5px;
}
#noFxaDescription {
margin-bottom: 20px !important;
}
.separator {
border-bottom: 1px solid var(--in-content-header-border-color);
}
.fxaAccountBox {
border: 1px solid #D1D2D3;
border-radius: 5px;
padding: 14px 20px 14px 14px;
}
#signedOutAccountBoxTitle {
font-weight: bold;
}
.fxaAccountBoxButtons {
margin-bottom: 0 !important;
margin-top: 11px;
display: flex;
align-items: center;
}
.fxaAccountBoxButtons > * {
-moz-box-flex: 1;
}
.fxaAccountBoxButtons > button {
text-align: center;
padding-left: 11px;
padding-right: 11px;
margin: 0;
min-width: 0;
}
.fxaAccountBoxButtons > button:first-child {
margin-inline-end: 14px !important;
}
#verifiedManage:visited {
color: var(--in-content-link-color);
}
.fxaSyncIllustration {
width: 231px;
}
#fxaLoginStatus[hasName] #fxaEmailAddress1 {
font-size: 1.1rem;
}
#fxaEmailAddress1,
#fxaEmailAddress2,
#fxaEmailAddress3 {
word-break: break-all;
}
.fxaFirefoxLogo {
list-style-image: url(chrome://browser/skin/fxa/logo.png);
max-width: 64px;
margin-inline-end: 14px;
}
.fxaMobilePromo {
margin-bottom: 20px;
margin-top: 25px;
}
#fxaLoginRejectedWarning {
list-style-image: url(chrome://browser/skin/warning.svg);
filter: drop-shadow(0 1px 0 hsla(206, 50%, 10%, .15));
margin: 4px 8px 0px 0px;
}
#syncOptions {
margin-bottom: 27.5px;
}
.androidLink {
background-image: url("chrome://browser/skin/fxa/android.png");
}
.iOSLink {
background-image: url("chrome://browser/skin/fxa/ios.png");
}
.androidLink,
.iOSLink {
margin: 0 0 0 2px;
padding-left: 28px;
padding-top: 6px;
height: 28px;
background-repeat: no-repeat;
background-size: 24px 28px;
}
#tosPP-small {
margin-top: 20px;
margin-bottom: 20px;
}
@media (min-resolution: 1.1dppx) {
.androidLink {
background-image: url("chrome://browser/skin/fxa/android@2x.png");
}
.iOSLink {
background-image: url("chrome://browser/skin/fxa/ios@2x.png");
}
.fxaFirefoxLogo {
list-style-image: url(chrome://browser/skin/fxa/logo@2x.png);
}
}

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

@ -0,0 +1,49 @@
/* 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/. */
#defaultEngine {
margin-inline-start: 0;
}
#defaultEngine > .menulist-label-box > .menulist-icon {
height: 16px;
}
/* work around a display: none in Linux's menu.css, see bug 1112310 */
.searchengine-menuitem > .menu-iconic-left {
display: -moz-box;
}
#engineList {
margin: .5em 0;
}
#engineList treechildren::-moz-tree-image(engineName) {
margin-inline-end: 10px;
margin-inline-start: 1px;
width: 16px;
height: 16px;
}
#engineList treechildren::-moz-tree-drop-feedback {
background-color: Highlight;
width: 10000px; /* 100% doesn't work; 10k is hopefully larger than any window
we may have, overflow isn't visible. */
height: 2px;
margin-inline-start: 0;
}
#engineShown {
min-width: 26px;
}
#addEnginesBox {
margin-bottom: 1em;
}
#removeEngineButton,
#restoreDefaultSearchEngines {
margin-right: 0;
margin-left: 0;
}

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

@ -76,6 +76,10 @@
skin/classic/browser/preferences/in-content/search.css (../shared/incontentprefs/search.css)
skin/classic/browser/preferences/in-content/siteDataSettings.css (../shared/incontentprefs/siteDataSettings.css)
* skin/classic/browser/preferences/in-content/containers.css (../shared/incontentprefs/containers.css)
skin/classic/browser/preferences/in-content-old/favicon.ico (../shared/incontentprefs-old/favicon.ico)
skin/classic/browser/preferences/in-content-old/icons.svg (../shared/incontentprefs-old/icons.svg)
skin/classic/browser/preferences/in-content-old/search.css (../shared/incontentprefs-old/search.css)
* skin/classic/browser/preferences/in-content-old/containers.css (../shared/incontentprefs-old/containers.css)
* skin/classic/browser/preferences/containers.css (../shared/preferences/containers.css)
skin/classic/browser/fxa/default-avatar.svg (../shared/fxa/default-avatar.svg)
skin/classic/browser/fxa/logo.png (../shared/fxa/logo.png)

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

@ -97,6 +97,7 @@ browser.jar:
skin/classic/browser/preferences/application.png (preferences/application.png)
skin/classic/browser/preferences/saveFile.png (preferences/saveFile.png)
skin/classic/browser/preferences/preferences.css (preferences/preferences.css)
* skin/classic/browser/preferences/in-content-old/preferences.css (preferences/in-content-old/preferences.css)
* skin/classic/browser/preferences/in-content/preferences.css (preferences/in-content/preferences.css)
* skin/classic/browser/preferences/in-content/dialog.css (preferences/in-content/dialog.css)
skin/classic/browser/preferences/applications.css (preferences/applications.css)

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

@ -0,0 +1,64 @@
/* - 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/. */
%include ../../../shared/incontentprefs-old/preferences.inc.css
@media (-moz-windows-default-theme: 0) {
#category-general > .category-icon {
list-style-image: url("chrome://browser/skin/preferences/in-content-old/icons.svg#general-native");
}
#category-search > .category-icon {
list-style-image: url("chrome://browser/skin/preferences/in-content-old/icons.svg#search-native");
}
#category-content > .category-icon {
list-style-image: url("chrome://browser/skin/preferences/in-content-old/icons.svg#content-native");
}
#category-application > .category-icon {
list-style-image: url("chrome://browser/skin/preferences/in-content-old/icons.svg#applications-native");
}
#category-privacy > .category-icon {
list-style-image: url("chrome://browser/skin/preferences/in-content-old/icons.svg#privacy-native");
}
#category-security > .category-icon {
list-style-image: url("chrome://browser/skin/preferences/in-content-old/icons.svg#security-native");
}
#category-sync > .category-icon {
list-style-image: url("chrome://browser/skin/preferences/in-content-old/icons.svg#sync-native");
}
#category-advanced > .category-icon {
list-style-image: url("chrome://browser/skin/preferences/in-content-old/icons.svg#advanced-native");
}
}
.actionsMenu > .menulist-label-box > .menulist-icon {
margin-inline-end: 9px;
}
textbox + button,
filefield + button {
margin-inline-start: -4px;
}
#advancedPrefs {
padding-bottom: 0; /* override padding from normal preferences.css */
}
#fxaProfileImage {
-moz-user-focus: normal;
}
/**
* Dialog
*/
#dialogTitle {
font-size: 1em;
}

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

@ -487,7 +487,6 @@ nsChromeRegistry::FlushAllCaches()
NS_IMETHODIMP
nsChromeRegistry::ReloadChrome()
{
UpdateSelectedLocale();
FlushAllCaches();
// Do a reload of all top level windows.
nsresult rv = NS_OK;

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

@ -79,10 +79,6 @@ protected:
void FlushSkinCaches();
void FlushAllCaches();
// Update the selected locale used by the chrome registry, and fire a
// notification about this change
virtual nsresult UpdateSelectedLocale() = 0;
static void LogMessage(const char* aMsg, ...)
MOZ_FORMAT_PRINTF(1, 2);
static void LogMessageWithContext(nsIURI* aURL, uint32_t aLineNumber, uint32_t flags,
@ -95,8 +91,6 @@ protected:
virtual nsresult GetFlagsFromPackage(const nsCString& aPackage,
uint32_t* aFlags) = 0;
nsresult SelectLocaleFromPref(nsIPrefBranch* prefs);
static nsresult RefreshWindow(nsPIDOMWindowOuter* aWindow);
static nsresult GetProviderAndPath(nsIURL* aChromeURL,
nsACString& aProvider, nsACString& aPath);

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

@ -28,8 +28,6 @@
#include "mozilla/Unused.h"
#include "mozilla/intl/LocaleService.h"
#include "nsICommandLine.h"
#include "nsILocaleService.h"
#include "nsIObserverService.h"
#include "nsIPrefBranch.h"
#include "nsIPrefService.h"
@ -39,16 +37,13 @@
#include "nsIXPConnect.h"
#include "nsIXULRuntime.h"
#define UILOCALE_CMD_LINE_ARG "UILocale"
#define MATCH_OS_LOCALE_PREF "intl.locale.matchOS"
#define SELECTED_LOCALE_PREF "general.useragent.locale"
#define SELECTED_SKIN_PREF "general.skins.selectedSkin"
#define PACKAGE_OVERRIDE_BRANCH "chrome.override_package."
using namespace mozilla;
using mozilla::dom::ContentParent;
using mozilla::dom::PContentParent;
using mozilla::intl::LocaleService;
// We use a "best-fit" algorithm for matching locales and themes.
// 1) the exact selected locale/theme
@ -113,7 +108,6 @@ nsChromeRegistryChrome::Init()
if (NS_FAILED(rv))
return rv;
mSelectedLocale = NS_LITERAL_CSTRING("en-US");
mSelectedSkin = NS_LITERAL_CSTRING("classic/1.0");
bool safeMode = false;
@ -140,17 +134,13 @@ nsChromeRegistryChrome::Init()
if (NS_SUCCEEDED(rv))
mSelectedSkin = provider;
SelectLocaleFromPref(prefs);
rv = prefs->AddObserver(MATCH_OS_LOCALE_PREF, this, true);
rv = prefs->AddObserver(SELECTED_LOCALE_PREF, this, true);
rv = prefs->AddObserver(SELECTED_SKIN_PREF, this, true);
}
nsCOMPtr<nsIObserverService> obsService = mozilla::services::GetObserverService();
if (obsService) {
obsService->AddObserver(this, "command-line-startup", true);
obsService->AddObserver(this, "profile-initial-state", true);
obsService->AddObserver(this, "intl:app-locales-changed", true);
}
return NS_OK;
@ -203,22 +193,6 @@ nsChromeRegistryChrome::GetLocalesForPackage(const nsACString& aPackage,
return rv;
}
static nsresult
getUILangCountry(nsACString& aUILang)
{
nsresult rv;
nsCOMPtr<nsILocaleService> localeService = do_GetService(NS_LOCALESERVICE_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoString uiLang;
rv = localeService->GetLocaleComponentForUserAgent(uiLang);
NS_ENSURE_SUCCESS(rv, rv);
CopyUTF16toUTF8(uiLang, aUILang);
return NS_OK;
}
NS_IMETHODIMP
nsChromeRegistryChrome::IsLocaleRTL(const nsACString& package, bool *aResult)
{
@ -233,11 +207,27 @@ nsChromeRegistryChrome::IsLocaleRTL(const nsACString& package, bool *aResult)
return NS_OK;
}
/**
* This method negotiates only between the app locale and the available
* chrome packages.
*
* If you want to get the current application's UI locale, please use
* LocaleService::GetAppLocaleAsLangTag.
*/
nsresult
nsChromeRegistryChrome::GetSelectedLocale(const nsACString& aPackage,
bool aAsBCP47,
nsACString& aLocale)
{
nsAutoCString reqLocale;
if (aPackage.Equals("global")) {
LocaleService::GetInstance()->GetAppLocaleAsLangTag(reqLocale);
} else {
AutoTArray<nsCString, 10> requestedLocales;
LocaleService::GetInstance()->GetRequestedLocales(requestedLocales);
reqLocale.Assign(requestedLocales[0]);
}
nsCString realpackage;
nsresult rv = OverrideLocalePackage(aPackage, realpackage);
if (NS_FAILED(rv))
@ -246,7 +236,7 @@ nsChromeRegistryChrome::GetSelectedLocale(const nsACString& aPackage,
if (!mPackagesHash.Get(realpackage, &entry))
return NS_ERROR_FILE_NOT_FOUND;
aLocale = entry->locales.GetSelected(mSelectedLocale, nsProviderArray::LOCALE);
aLocale = entry->locales.GetSelected(reqLocale, nsProviderArray::LOCALE);
if (aLocale.IsEmpty())
return NS_ERROR_FAILURE;
@ -272,34 +262,6 @@ nsChromeRegistryChrome::OverrideLocalePackage(const nsACString& aPackage,
return NS_OK;
}
nsresult
nsChromeRegistryChrome::SelectLocaleFromPref(nsIPrefBranch* prefs)
{
nsresult rv;
bool matchOSLocale = false;
rv = prefs->GetBoolPref(MATCH_OS_LOCALE_PREF, &matchOSLocale);
if (NS_SUCCEEDED(rv) && matchOSLocale) {
// compute lang and region code only when needed!
nsAutoCString uiLocale;
rv = getUILangCountry(uiLocale);
if (NS_SUCCEEDED(rv))
mSelectedLocale = uiLocale;
}
else {
nsXPIDLCString provider;
rv = prefs->GetCharPref(SELECTED_LOCALE_PREF, getter_Copies(provider));
if (NS_SUCCEEDED(rv)) {
mSelectedLocale = provider;
}
}
if (NS_FAILED(rv))
NS_ERROR("Couldn't select locale from pref!");
return rv;
}
NS_IMETHODIMP
nsChromeRegistryChrome::Observe(nsISupports *aSubject, const char *aTopic,
const char16_t *someData)
@ -312,13 +274,7 @@ nsChromeRegistryChrome::Observe(nsISupports *aSubject, const char *aTopic,
NS_ConvertUTF16toUTF8 pref(someData);
if (pref.EqualsLiteral(MATCH_OS_LOCALE_PREF) ||
pref.EqualsLiteral(SELECTED_LOCALE_PREF)) {
rv = UpdateSelectedLocale();
if (NS_SUCCEEDED(rv) && mProfileLoaded)
FlushAllCaches();
}
else if (pref.EqualsLiteral(SELECTED_SKIN_PREF)) {
if (pref.EqualsLiteral(SELECTED_SKIN_PREF)) {
nsXPIDLCString provider;
rv = prefs->GetCharPref(pref.get(), getter_Copies(provider));
if (NS_FAILED(rv)) {
@ -332,24 +288,14 @@ nsChromeRegistryChrome::Observe(nsISupports *aSubject, const char *aTopic,
NS_ERROR("Unexpected pref!");
}
}
else if (!strcmp("command-line-startup", aTopic)) {
nsCOMPtr<nsICommandLine> cmdLine (do_QueryInterface(aSubject));
if (cmdLine) {
nsAutoString uiLocale;
rv = cmdLine->HandleFlagWithParam(NS_LITERAL_STRING(UILOCALE_CMD_LINE_ARG),
false, uiLocale);
if (NS_SUCCEEDED(rv) && !uiLocale.IsEmpty()) {
CopyUTF16toUTF8(uiLocale, mSelectedLocale);
nsCOMPtr<nsIPrefBranch> prefs (do_GetService(NS_PREFSERVICE_CONTRACTID));
if (prefs) {
prefs->RemoveObserver(SELECTED_LOCALE_PREF, this);
}
}
}
}
else if (!strcmp("profile-initial-state", aTopic)) {
mProfileLoaded = true;
}
else if (!strcmp("intl:app-locales-changed", aTopic)) {
if (mProfileLoaded) {
FlushAllCaches();
}
}
else {
NS_ERROR("Unexpected observer topic!");
}
@ -375,25 +321,6 @@ nsChromeRegistryChrome::CheckForNewChrome()
return NS_OK;
}
nsresult nsChromeRegistryChrome::UpdateSelectedLocale()
{
nsresult rv = NS_OK;
nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID));
if (prefs) {
rv = SelectLocaleFromPref(prefs);
if (NS_SUCCEEDED(rv)) {
nsCOMPtr<nsIObserverService> obsSvc =
mozilla::services::GetObserverService();
NS_ASSERTION(obsSvc, "Couldn't get observer service.");
obsSvc->NotifyObservers((nsIChromeRegistry*) this,
"selected-locale-has-changed", nullptr);
mozilla::intl::LocaleService::GetInstance()->Refresh();
}
}
return rv;
}
static void
SerializeURI(nsIURI* aURI,
SerializedURI& aSerializedURI)
@ -416,7 +343,7 @@ nsChromeRegistryChrome::SendRegisteredChrome(
for (auto iter = mPackagesHash.Iter(); !iter.Done(); iter.Next()) {
ChromePackage chromePackage;
ChromePackageFromPackageEntry(iter.Key(), iter.UserData(), &chromePackage,
mSelectedLocale, mSelectedSkin);
mSelectedSkin);
packages.AppendElement(chromePackage);
}
@ -447,9 +374,12 @@ nsChromeRegistryChrome::SendRegisteredChrome(
overrides.AppendElement(override);
}
nsAutoCString appLocale;
LocaleService::GetInstance()->GetAppLocaleAsLangTag(appLocale);
if (aParent) {
bool success = aParent->SendRegisterChrome(packages, resources, overrides,
mSelectedLocale, false);
appLocale, false);
NS_ENSURE_TRUE_VOID(success);
} else {
nsTArray<ContentParent*> parents;
@ -460,7 +390,7 @@ nsChromeRegistryChrome::SendRegisteredChrome(
for (uint32_t i = 0; i < parents.Length(); i++) {
DebugOnly<bool> success =
parents[i]->SendRegisterChrome(packages, resources, overrides,
mSelectedLocale, true);
appLocale, true);
NS_WARNING_ASSERTION(success,
"couldn't reset a child's registered chrome");
}
@ -471,12 +401,13 @@ nsChromeRegistryChrome::SendRegisteredChrome(
nsChromeRegistryChrome::ChromePackageFromPackageEntry(const nsACString& aPackageName,
PackageEntry* aPackage,
ChromePackage* aChromePackage,
const nsCString& aSelectedLocale,
const nsCString& aSelectedSkin)
{
nsAutoCString appLocale;
LocaleService::GetInstance()->GetAppLocaleAsLangTag(appLocale);
SerializeURI(aPackage->baseURI, aChromePackage->contentBaseURI);
SerializeURI(aPackage->locales.GetBase(aSelectedLocale,
nsProviderArray::LOCALE),
SerializeURI(aPackage->locales.GetBase(appLocale, nsProviderArray::LOCALE),
aChromePackage->localeBaseURI);
SerializeURI(aPackage->skins.GetBase(aSelectedSkin, nsProviderArray::ANY),
aChromePackage->skinBaseURI);
@ -511,7 +442,9 @@ nsChromeRegistryChrome::GetBaseURIFromPackage(const nsCString& aPackage,
}
if (aProvider.EqualsLiteral("locale")) {
return entry->locales.GetBase(mSelectedLocale, nsProviderArray::LOCALE);
nsAutoCString appLocale;
LocaleService::GetInstance()->GetAppLocaleAsLangTag(appLocale);
return entry->locales.GetBase(appLocale, nsProviderArray::LOCALE);
}
else if (aProvider.EqualsLiteral("skin")) {
return entry->skins.GetBase(mSelectedSkin, nsProviderArray::ANY);
@ -764,7 +697,7 @@ nsChromeRegistryChrome::ManifestContent(ManifestProcessingContext& cx, int linen
if (mDynamicRegistration) {
ChromePackage chromePackage;
ChromePackageFromPackageEntry(packageName, entry, &chromePackage,
mSelectedLocale, mSelectedSkin);
mSelectedSkin);
SendManifestEntry(chromePackage);
}
}
@ -800,9 +733,15 @@ nsChromeRegistryChrome::ManifestLocale(ManifestProcessingContext& cx, int lineno
if (mDynamicRegistration) {
ChromePackage chromePackage;
ChromePackageFromPackageEntry(packageName, entry, &chromePackage,
mSelectedLocale, mSelectedSkin);
mSelectedSkin);
SendManifestEntry(chromePackage);
}
if (strcmp(package, "global") == 0) {
// We should refresh the LocaleService, since the available
// locales changed.
LocaleService::GetInstance()->Refresh();
}
}
void
@ -836,7 +775,7 @@ nsChromeRegistryChrome::ManifestSkin(ManifestProcessingContext& cx, int lineno,
if (mDynamicRegistration) {
ChromePackage chromePackage;
ChromePackageFromPackageEntry(packageName, entry, &chromePackage,
mSelectedLocale, mSelectedSkin);
mSelectedSkin);
SendManifestEntry(chromePackage);
}
}

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

@ -58,13 +58,10 @@ class nsChromeRegistryChrome : public nsChromeRegistry
static void ChromePackageFromPackageEntry(const nsACString& aPackageName,
PackageEntry* aPackage,
ChromePackage* aChromePackage,
const nsCString& aSelectedLocale,
const nsCString& aSelectedSkin);
nsresult OverrideLocalePackage(const nsACString& aPackage,
nsACString& aOverride);
nsresult SelectLocaleFromPref(nsIPrefBranch* prefs);
nsresult UpdateSelectedLocale() override;
nsIURI* GetBaseURIFromPackage(const nsCString& aPackage,
const nsCString& aProvider,
const nsCString& aPath) override;
@ -157,7 +154,6 @@ class nsChromeRegistryChrome : public nsChromeRegistry
bool mProfileLoaded;
bool mDynamicRegistration;
nsCString mSelectedLocale;
nsCString mSelectedSkin;
// Hash of package names ("global") to PackageEntry objects

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

@ -257,11 +257,6 @@ nsChromeRegistryContent::GetXULOverlays(nsIURI *aChromeURL,
CONTENT_NOT_IMPLEMENTED();
}
nsresult nsChromeRegistryContent::UpdateSelectedLocale()
{
CONTENT_NOT_IMPLEMENTED();
}
void
nsChromeRegistryContent::ManifestContent(ManifestProcessingContext& cx,
int lineno, char *const * argv,

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

@ -56,7 +56,6 @@ class nsChromeRegistryContent : public nsChromeRegistry
uint32_t flags;
};
nsresult UpdateSelectedLocale() override;
nsIURI* GetBaseURIFromPackage(const nsCString& aPackage,
const nsCString& aProvider,
const nsCString& aPath) override;

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

@ -1,94 +0,0 @@
/* 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/.
*/
var MANIFESTS = [
do_get_file("data/test_bug519468.manifest")
];
Components.utils.import("resource://testing-common/MockRegistrar.jsm");
// Stub in the locale service so we can control what gets returned as the OS locale setting
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
var stubOSLocale = null;
StubLocaleService = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsILocaleService, Ci.nsISupports]),
getLocaleComponentForUserAgent: function SLS_getLocaleComponentForUserAgent()
{
return stubOSLocale;
}
}
MockRegistrar.register("@mozilla.org/intl/nslocaleservice;1", StubLocaleService);
// Now fire up the test
do_test_pending()
registerManifests(MANIFESTS);
var chromeReg = Cc["@mozilla.org/chrome/chrome-registry;1"]
.getService(Ci.nsIXULChromeRegistry)
.QueryInterface(Ci.nsIToolkitChromeRegistry);
chromeReg.checkForNewChrome();
var prefService = Cc["@mozilla.org/preferences-service;1"]
.getService(Ci.nsIPrefService)
.QueryInterface(Ci.nsIPrefBranch);
var os = Cc["@mozilla.org/observer-service;1"]
.getService(Ci.nsIObserverService);
var testsLocale = [
// These tests cover when the OS local is included in our manifest
{matchOS: false, selected: "en-US", osLocale: "xx-AA", locale: "en-US"},
{matchOS: true, selected: "en-US", osLocale: "xx-AA", locale: "xx-AA"},
{matchOS: false, selected: "fr-FR", osLocale: "xx-AA", locale: "fr-FR"},
{matchOS: true, selected: "fr-FR", osLocale: "xx-AA", locale: "xx-AA"},
{matchOS: false, selected: "de-DE", osLocale: "xx-AA", locale: "de-DE"},
{matchOS: true, selected: "de-DE", osLocale: "xx-AA", locale: "xx-AA"},
// these tests cover the case where the OS locale is not available in our manifest, but the
// base language is (ie, substitute xx-AA which we have for xx-BB which we don't)
{matchOS: false, selected: "en-US", osLocale: "xx-BB", locale: "en-US"},
{matchOS: true, selected: "en-US", osLocale: "xx-BB", locale: "xx-AA"},
{matchOS: false, selected: "fr-FR", osLocale: "xx-BB", locale: "fr-FR"},
{matchOS: true, selected: "fr-FR", osLocale: "xx-BB", locale: "xx-AA"},
// These tests cover where the language is not available
{matchOS: false, selected: "en-US", osLocale: "xy-BB", locale: "en-US"},
{matchOS: true, selected: "en-US", osLocale: "xy-BB", locale: "en-US"},
{matchOS: false, selected: "fr-FR", osLocale: "xy-BB", locale: "fr-FR"},
{matchOS: true, selected: "fr-FR", osLocale: "xy-BB", locale: "en-US"},
];
var observedLocale = null;
function test_locale(aTest) {
observedLocale = null;
stubOSLocale = aTest.osLocale;
prefService.setBoolPref("intl.locale.matchOS", aTest.matchOS);
prefService.setCharPref("general.useragent.locale", aTest.selected);
chromeReg.reloadChrome();
do_check_eq(observedLocale, aTest.locale);
}
// Callback function for observing locale change. May be called more than once
// per test iteration.
function checkValidity() {
observedLocale = chromeReg.getSelectedLocale("testmatchos");
dump("checkValidity called back with locale = " + observedLocale + "\n");
}
function run_test() {
os.addObserver(checkValidity, "selected-locale-has-changed", false);
for (let count = 0 ; count < testsLocale.length ; count++) {
dump("count = " + count + " " + testsLocale[count].toSource() + "\n");
test_locale(testsLocale[count]);
}
os.removeObserver(checkValidity, "selected-locale-has-changed");
do_test_finished();
}

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

@ -9,7 +9,6 @@ support-files = data/**
[test_bug399707.js]
[test_bug401153.js]
[test_bug415367.js]
[test_bug519468.js]
[test_bug564667.js]
tags = addons
[test_bug848297.js]

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

@ -230,9 +230,7 @@ Converter.prototype = {
os = "linux";
}
let chromeReg = Cc["@mozilla.org/chrome/chrome-registry;1"]
.getService(Ci.nsIXULChromeRegistry);
let dir = chromeReg.isLocaleRTL("global") ? "rtl" : "ltr";
let dir = Services.locale.isAppLocaleRTL ? "rtl" : "ltr";
return "<!DOCTYPE html>\n" +
"<html platform=\"" + os + "\" class=\"" + themeClassName +
@ -268,9 +266,7 @@ Converter.prototype = {
output += "</div><div id=\"json\">" + this.highlightError(data,
errorInfo.line, errorInfo.column) + "</div>";
let chromeReg = Cc["@mozilla.org/chrome/chrome-registry;1"]
.getService(Ci.nsIXULChromeRegistry);
let dir = chromeReg.isLocaleRTL("global") ? "rtl" : "ltr";
let dir = Services.locale.isAppLocaleRTL ? "rtl" : "ltr";
return "<!DOCTYPE html>\n" +
"<html><head><title>" + this.htmlEncode(uri + " - Error") + "</title>" +

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

@ -536,9 +536,18 @@ Animation::Reverse(ErrorResult& aRv)
SilentlySetPlaybackRate(-mPlaybackRate);
Play(aRv, LimitBehavior::AutoRewind);
// If Play() threw, restore state and don't report anything to mutation
// observers.
if (aRv.Failed()) {
SilentlySetPlaybackRate(-mPlaybackRate);
return;
}
if (IsRelevant()) {
nsNodeUtils::AnimationChanged(this);
}
// Play(), above, unconditionally calls PostUpdate so we don't need to do
// it here.
}
// ---------------------------------------------------------------------------

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

@ -9,12 +9,12 @@ support-files =
[chrome/test_animate_xrays.html]
# file_animate_xrays.html needs to go in mochitest.ini since it is served
# over HTTP
[chrome/test_animation_observers.html]
[chrome/test_animation_observers_async.html]
[chrome/test_animation_observers_sync.html]
[chrome/test_animation_performance_warning.html]
[chrome/test_animation_properties.html]
[chrome/test_cssanimation_missing_keyframes.html]
[chrome/test_generated_content_getAnimations.html]
[chrome/test_observers_for_sync_api.html]
[chrome/test_restyles.html]
skip-if = os == 'android' && processor == 'x86' # bug 1335986
[chrome/test_running_on_compositor.html]

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

@ -1,6 +1,18 @@
<!DOCTYPE html>
<meta charset=utf-8>
<title>Test chrome-only MutationObserver animation notifications</title>
<title>
Test chrome-only MutationObserver animation notifications (async tests)
</title>
<!--
This file contains tests for animation mutation observers that require
some asynchronous steps (e.g. waiting for animation events).
Where possible, however, we prefer to write synchronous tests since they are
less to timeout when run on automation. These synchronous tests are located
in test_animation_observers_sync.html.
-->
<script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
<script src="../testcommon.js"></script>

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

@ -1,8 +1,18 @@
<!DOCTYPE html>
<meta charset=utf-8>
<title>
Test chrome-only MutationObserver animation notifications for sync APIs
Test chrome-only MutationObserver animation notifications (sync tests)
</title>
<!--
This file contains synchronous tests for animation mutation observers.
In general we prefer to write synchronous tests since they are less likely to
timeout when run on automation. Tests that require asynchronous steps (e.g.
waiting on events) should be added to test_animations_observers_async.html
instead.
-->
<script type="application/javascript" src="../testharness.js"></script>
<script type="application/javascript" src="../testharnessreport.js"></script>
<script type="application/javascript" src="../testcommon.js"></script>
@ -17,6 +27,26 @@ Test chrome-only MutationObserver animation notifications for sync APIs
</style>
<script>
/**
* Return a new MutationObserver which observing |target| element
* with { animations: true, subtree: |subtree| } option.
*
* NOTE: This observer should be used only with takeRecords(). If any of
* MutationRecords are observed in the callback of the MutationObserver,
* it will raise an assertion.
*/
function setupSynchronousObserver(t, target, subtree) {
var observer = new MutationObserver(records => {
assert_unreached("Any MutationRecords should not be observed in this " +
"callback");
});
t.add_cleanup(() => {
observer.disconnect();
});
observer.observe(target, { animations: true, subtree: subtree });
return observer;
}
function assert_record_list(actual, expected, desc, index, listName) {
assert_equals(actual.length, expected.length,
`${desc} - record[${index}].${listName} length`);
@ -705,6 +735,42 @@ function createPseudo(test, element, type) {
[], "records after calling reverse()");
}, "reverse_with_zero_playbackRate");
// Test that reverse() on an Animation does *not* dispatch a changed
// notification when it throws an exception.
test(t => {
// Start an infinite animation
var div = addDiv(t, { style: "animation: anim 10s infinite" });
var observer =
setupSynchronousObserver(t,
aOptions.subtree ? div.parentNode : div,
aOptions.subtree);
var animations = div.getAnimations();
assert_equals(animations.length, 1,
"getAnimations().length after animation start");
assert_equals_records(observer.takeRecords(),
[{ added: animations, changed: [], removed: [] }],
"records after animation start");
// Shift the animation into the future such that when we call reverse
// it will try to seek to the (infinite) end.
animations[0].startTime = 100 * MS_PER_SEC;
assert_equals_records(observer.takeRecords(),
[{ added: [], changed: animations, removed: [] }],
"records after adjusting startTime");
// Reverse: should throw
assert_throws('InvalidStateError', () => {
animations[0].reverse();
}, 'reverse() on future infinite animation throws an exception');
// We should get no notifications.
assert_equals_records(observer.takeRecords(),
[], "records after calling reverse()");
}, "reverse_with_exception");
// Test that attempting to start an animation that should already be finished
// does not send any notifications.
test(t => {

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

@ -0,0 +1,18 @@
<!DOCTYPE html>
<html class="reftest-wait">
<head>
<meta charset="UTF-8">
<script>
window.onload = function(){
let a = document.documentElement.animate(null,
{ duration: 100, iterations: Number.POSITIVE_INFINITY });
a.startTime = 100000; // Set the start time far in the future
// Try reversing (this should throw because the target effect end is infinity)
try { a.reverse(); } catch(e) {}
// Do something that will trigger a timing update
a.effect.target = document.createElement("span");
document.documentElement.className = '';
};
</script>
</head>
</html>

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

@ -25,3 +25,4 @@ skip-if(stylo) pref(dom.animations-api.core.enabled,true) load 1330513-1.html #
skip-if(stylo) pref(dom.animations-api.core.enabled,true) load 1333539-1.html
skip-if(stylo) pref(dom.animations-api.core.enabled,true) load 1333539-2.html
skip-if(stylo) pref(dom.animations-api.core.enabled,true) load 1333418-1.html # bug 1311257
pref(dom.animations-api.core.enabled,true) load 1343589-1.html

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

@ -282,25 +282,6 @@ if (opener) {
}
}
/**
* Return a new MutationObserver which started observing |target| element
* with { animations: true, subtree: |subtree| } option.
* NOTE: This observer should be used only with takeRecords(). If any of
* MutationRecords are observed in the callback of the MutationObserver,
* it will raise an assertion.
*/
function setupSynchronousObserver(t, target, subtree) {
var observer = new MutationObserver(records => {
assert_unreached("Any MutationRecords should not be observed in this " +
"callback");
});
t.add_cleanup(() => {
observer.disconnect();
});
observer.observe(target, { animations: true, subtree: subtree });
return observer;
}
/*
* Returns a promise that is resolved when the document has finished loading.
*/

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

@ -15,6 +15,7 @@
#include "mozilla/SizePrintfMacros.h"
#include "mozilla/Telemetry.h"
#include "nsComponentManagerUtils.h"
#include "nsGlobalWindow.h"
#include "nsVariant.h"
#include "nsVideoFrame.h"
#include "nsIFrame.h"
@ -580,8 +581,13 @@ TextTrackManager::DispatchUpdateCueDisplay()
if (!mUpdateCueDisplayDispatched && !mShutdown &&
(mMediaElement->GetHasUserInteraction() || mMediaElement->IsCurrentlyPlaying())) {
WEBVTT_LOG("DispatchUpdateCueDisplay");
NS_DispatchToMainThread(NewRunnableMethod(this, &TextTrackManager::UpdateCueDisplay));
mUpdateCueDisplayDispatched = true;
nsPIDOMWindowInner* win = mMediaElement->OwnerDoc()->GetInnerWindow();
if (win) {
nsGlobalWindow::Cast(win)->Dispatch(
"TextTrackManager::UpdateCueDisplay", TaskCategory::Other,
NewRunnableMethod(this, &TextTrackManager::UpdateCueDisplay));
mUpdateCueDisplayDispatched = true;
}
}
}
@ -595,8 +601,13 @@ TextTrackManager::DispatchTimeMarchesOn()
if (!mTimeMarchesOnDispatched && !mShutdown &&
(mMediaElement->GetHasUserInteraction() || mMediaElement->IsCurrentlyPlaying())) {
WEBVTT_LOG("DispatchTimeMarchesOn");
NS_DispatchToMainThread(NewRunnableMethod(this, &TextTrackManager::TimeMarchesOn));
mTimeMarchesOnDispatched = true;
nsPIDOMWindowInner* win = mMediaElement->OwnerDoc()->GetInnerWindow();
if (win) {
nsGlobalWindow::Cast(win)->Dispatch(
"TextTrackManager::TimeMarchesOn", TaskCategory::Other,
NewRunnableMethod(this, &TextTrackManager::TimeMarchesOn));
mTimeMarchesOnDispatched = true;
}
}
}

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

@ -63,9 +63,10 @@ function test2()
function test3()
{
// Remove database from domain 2
ForgetAboutSite.removeDataFromDomain(domains[1]);
setPermission(testPageURL4, "indexedDB");
executeSoon(test4);
ForgetAboutSite.removeDataFromDomain(domains[1]).then(() => {
setPermission(testPageURL4, "indexedDB");
executeSoon(test4);
});
}
function test4()

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

@ -16,11 +16,16 @@
const {
utils: Cu,
} = Components;
Cu.import("resource://gre/modules/ManifestObtainer.jsm");
Cu.import("resource://gre/modules/ManifestFinder.jsm");
Cu.import("resource://gre/modules/ManifestIcons.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Task.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "ManifestObtainer",
"resource://gre/modules/ManifestObtainer.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "ManifestFinder",
"resource://gre/modules/ManifestFinder.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "ManifestIcons",
"resource://gre/modules/ManifestIcons.jsm");
const MessageHandler = {
registerListeners() {
addMessageListener(

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

@ -1623,10 +1623,16 @@ private:
Pattern *pat;
RefPtr<gfxPattern> fillPattern;
if (!mFontParams.contextPaint ||
!(fillPattern = mFontParams.contextPaint->GetFillPattern(
mRunParams.context->GetDrawTarget(),
mRunParams.context->CurrentMatrix()))) {
if (mFontParams.contextPaint) {
mozilla::image::DrawResult result = mozilla::image::DrawResult::SUCCESS;
Tie(result, fillPattern) =
mFontParams.contextPaint->GetFillPattern(
mRunParams.context->GetDrawTarget(),
mRunParams.context->CurrentMatrix());
// XXX cku Flush should return result to the caller?
Unused << result;
}
if (!fillPattern) {
if (state.pattern) {
pat = state.pattern->GetPattern(mRunParams.dt,
state.patternTransformChanged ?

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

@ -202,24 +202,28 @@ public:
mStrokeMatrix = SetupDeviceToPatternMatrix(aStrokePattern, aCTM);
}
already_AddRefed<gfxPattern> GetFillPattern(const DrawTarget* aDrawTarget,
float aOpacity,
const gfxMatrix& aCTM) {
mozilla::Pair<DrawResult, RefPtr<gfxPattern>>
GetFillPattern(const DrawTarget* aDrawTarget,
float aOpacity,
const gfxMatrix& aCTM,
uint32_t aFlags) {
if (mFillPattern) {
mFillPattern->SetMatrix(aCTM * mFillMatrix);
}
RefPtr<gfxPattern> fillPattern = mFillPattern;
return fillPattern.forget();
return MakePair(DrawResult::SUCCESS, Move(fillPattern));
}
already_AddRefed<gfxPattern> GetStrokePattern(const DrawTarget* aDrawTarget,
float aOpacity,
const gfxMatrix& aCTM) {
mozilla::Pair<DrawResult, RefPtr<gfxPattern>>
GetStrokePattern(const DrawTarget* aDrawTarget,
float aOpacity,
const gfxMatrix& aCTM,
uint32_t aFlags) {
if (mStrokePattern) {
mStrokePattern->SetMatrix(aCTM * mStrokeMatrix);
}
RefPtr<gfxPattern> strokePattern = mStrokePattern;
return strokePattern.forget();
return MakePair(DrawResult::SUCCESS, Move(strokePattern));
}
float GetFillOpacity() const {

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

@ -13,6 +13,7 @@
#include "nsIObserverService.h"
#include "nsStringEnumerator.h"
#include "nsIToolkitChromeRegistry.h"
#include "nsXULAppAPI.h"
#ifdef ENABLE_INTL_API
#include "unicode/uloc.h"
@ -42,7 +43,8 @@ mozilla::StaticRefPtr<LocaleService> LocaleService::sInstance;
* The BCP47 form should be used for all calls to ICU/Intl APIs.
* The canonical form is used for all internal operations.
*/
static void SanitizeForBCP47(nsACString& aLocale)
static void
SanitizeForBCP47(nsACString& aLocale)
{
#ifdef ENABLE_INTL_API
// Currently, the only locale code we use that's not BCP47-conformant is
@ -76,24 +78,39 @@ static void SanitizeForBCP47(nsACString& aLocale)
* Currently it collects the locale ID used by nsChromeRegistry and
* adds hardcoded "en-US" locale as a fallback.
*/
static void
ReadAppLocales(nsTArray<nsCString>& aRetVal)
void
LocaleService::NegotiateAppLocales(nsTArray<nsCString>& aRetVal)
{
nsAutoCString uaLangTag;
nsCOMPtr<nsIToolkitChromeRegistry> cr =
mozilla::services::GetToolkitChromeRegistryService();
if (cr) {
// We don't want to canonicalize the locale from ChromeRegistry into
// it's BCP47 form because we will use it for direct language
// negotiation and BCP47 changes `ja-JP-mac` into `ja-JP-x-variant-mac`.
cr->GetSelectedLocale(NS_LITERAL_CSTRING("global"), false, uaLangTag);
}
if (!uaLangTag.IsEmpty()) {
aRetVal.AppendElement(uaLangTag);
}
nsAutoCString defaultLocale;
GetDefaultLocale(defaultLocale);
if (!uaLangTag.EqualsLiteral("en-US")) {
aRetVal.AppendElement(NS_LITERAL_CSTRING("en-US"));
if (XRE_IsParentProcess()) {
AutoTArray<nsCString, 100> availableLocales;
AutoTArray<nsCString, 10> requestedLocales;
GetAvailableLocales(availableLocales);
GetRequestedLocales(requestedLocales);
NegotiateLanguages(requestedLocales, availableLocales, defaultLocale,
LangNegStrategy::Filtering, aRetVal);
} else {
//XXX: In bug 1348042 we're working on getting the content process
// to follow the parent process negotiated locales.
// Until we have it, we're going to match the behavior of following
// the ChromeRegistry locale in the content process.
nsAutoCString uaLangTag;
nsCOMPtr<nsIToolkitChromeRegistry> cr =
mozilla::services::GetToolkitChromeRegistryService();
if (cr) {
cr->GetSelectedLocale(NS_LITERAL_CSTRING("global"), false, uaLangTag);
}
if (!uaLangTag.IsEmpty()) {
aRetVal.AppendElement(uaLangTag);
}
if (!uaLangTag.Equals(defaultLocale)) {
aRetVal.AppendElement(defaultLocale);
}
}
}
@ -121,7 +138,7 @@ void
LocaleService::GetAppLocalesAsLangTags(nsTArray<nsCString>& aRetVal)
{
if (mAppLocales.IsEmpty()) {
ReadAppLocales(mAppLocales);
NegotiateAppLocales(mAppLocales);
}
aRetVal = mAppLocales;
}
@ -130,7 +147,7 @@ void
LocaleService::GetAppLocalesAsBCP47(nsTArray<nsCString>& aRetVal)
{
if (mAppLocales.IsEmpty()) {
ReadAppLocales(mAppLocales);
NegotiateAppLocales(mAppLocales);
}
for (uint32_t i = 0; i < mAppLocales.Length(); i++) {
nsAutoCString locale(mAppLocales[i]);
@ -156,15 +173,8 @@ LocaleService::GetRequestedLocales(nsTArray<nsCString>& aRetVal)
}
// Otherwise, we'll try to get the requested locale from the prefs.
// In some cases, mainly on Fennec and on Linux version,
// `general.useragent.locale` is a special 'localized' value, like:
// "chrome://global/locale/intl.properties"
if (!NS_SUCCEEDED(Preferences::GetLocalizedCString(SELECTED_LOCALE_PREF, &locale))) {
// If not, we can attempt to retrieve it as a simple string value.
if (!NS_SUCCEEDED(Preferences::GetCString(SELECTED_LOCALE_PREF, &locale))) {
return false;
}
if (!NS_SUCCEEDED(Preferences::GetCString(SELECTED_LOCALE_PREF, &locale))) {
return false;
}
// At the moment we just take a single locale, but in the future
@ -203,14 +213,23 @@ LocaleService::GetAvailableLocales(nsTArray<nsCString>& aRetVal)
void
LocaleService::Refresh()
{
// if mAppLocales has not been initialized yet, just return
if (mAppLocales.IsEmpty()) {
return;
}
nsTArray<nsCString> newLocales;
ReadAppLocales(newLocales);
NegotiateAppLocales(newLocales);
if (mAppLocales != newLocales) {
mAppLocales = Move(newLocales);
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
if (obs) {
obs->NotifyObservers(nullptr, "intl:app-locales-changed", nullptr);
// Deprecated, please use `intl:app-locales-changed`.
// Kept for now for compatibility reasons
obs->NotifyObservers(nullptr, "selected-locale-has-changed", nullptr);
}
}
}
@ -378,6 +397,36 @@ LocaleService::NegotiateLanguages(const nsTArray<nsCString>& aRequested,
return true;
}
bool
LocaleService::IsAppLocaleRTL()
{
nsAutoCString locale;
GetAppLocaleAsBCP47(locale);
#ifdef ENABLE_INTL_API
int pref = Preferences::GetInt("intl.uidirection", -1);
if (pref >= 0) {
return (pref > 0);
}
return uloc_isRightToLeft(locale.get());
#else
// first check the intl.uidirection.<locale> preference, and if that is not
// set, check the same preference but with just the first two characters of
// the locale. If that isn't set, default to left-to-right.
nsAutoCString prefString = NS_LITERAL_CSTRING("intl.uidirection.") + locale;
nsAutoCString dir;
Preferences::GetCString(prefString.get(), &dir);
if (dir.IsEmpty()) {
int32_t hyphen = prefString.FindChar('-');
if (hyphen >= 1) {
prefString.Truncate(hyphen);
Preferences::GetCString(prefString.get(), &dir);
}
}
return dir.EqualsLiteral("rtl");
#endif
}
NS_IMETHODIMP
LocaleService::Observe(nsISupports *aSubject, const char *aTopic,
const char16_t *aData)
@ -386,6 +435,7 @@ LocaleService::Observe(nsISupports *aSubject, const char *aTopic,
// user requested locales.
NS_ConvertUTF16toUTF8 pref(aData);
if (pref.EqualsLiteral(MATCH_OS_LOCALE_PREF) || pref.EqualsLiteral(SELECTED_LOCALE_PREF)) {
Refresh();
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
if (obs) {
obs->NotifyObservers(nullptr, "intl:requested-locales-changed", nullptr);
@ -420,7 +470,7 @@ NS_IMETHODIMP
LocaleService::GetAppLocalesAsLangTags(uint32_t* aCount, char*** aOutArray)
{
if (mAppLocales.IsEmpty()) {
ReadAppLocales(mAppLocales);
NegotiateAppLocales(mAppLocales);
}
*aCount = mAppLocales.Length();
@ -445,7 +495,7 @@ NS_IMETHODIMP
LocaleService::GetAppLocaleAsLangTag(nsACString& aRetVal)
{
if (mAppLocales.IsEmpty()) {
ReadAppLocales(mAppLocales);
NegotiateAppLocales(mAppLocales);
}
aRetVal = mAppLocales[0];
return NS_OK;
@ -455,7 +505,7 @@ NS_IMETHODIMP
LocaleService::GetAppLocaleAsBCP47(nsACString& aRetVal)
{
if (mAppLocales.IsEmpty()) {
ReadAppLocales(mAppLocales);
NegotiateAppLocales(mAppLocales);
}
aRetVal = mAppLocales[0];
SanitizeForBCP47(aRetVal);
@ -703,6 +753,12 @@ LocaleService::GetAvailableLocales(uint32_t* aCount, char*** aOutArray)
*aCount = availableLocales.Length();
*aOutArray = CreateOutArray(availableLocales);
return NS_OK;
}
NS_IMETHODIMP
LocaleService::GetIsAppLocaleRTL(bool* aRetVal)
{
(*aRetVal) = IsAppLocaleRTL();
return NS_OK;
}

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

@ -167,6 +167,11 @@ public:
LangNegStrategy aLangNegStrategy,
nsTArray<nsCString>& aRetVal);
/**
* Returns whether the current app locale is RTL.
*/
bool IsAppLocaleRTL();
private:
/**
* Locale object, a BCP47-style tag decomposed into subtags for
@ -212,6 +217,8 @@ private:
LangNegStrategy aStrategy,
nsTArray<nsCString>& aRetVal);
void NegotiateAppLocales(nsTArray<nsCString>& aRetVal);
virtual ~LocaleService();
nsTArray<nsCString> mAppLocales;

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

@ -172,4 +172,9 @@ interface mozILocaleService : nsISupports
*/
void getAvailableLocales([optional] out unsigned long aCount,
[retval, array, size_is(aCount)] out string aLocales);
/**
* Returns whether the current app locale is RTL.
*/
readonly attribute boolean isAppLocaleRTL;
};

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

@ -57,3 +57,10 @@ TEST(Intl_Locale_LocaleService, GetAppLocaleAsLangTag) {
ASSERT_TRUE(appLocales[0] == locale);
}
TEST(Intl_Locale_LocaleService, IsAppLocaleRTL) {
// For now we can only test if the method doesn't crash.
LocaleService::GetInstance()->IsAppLocaleRTL();
ASSERT_TRUE(true);
}

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

@ -131,6 +131,12 @@ add_test(function test_setRequestedLocales() {
run_next_test();
});
add_test(function test_isAppLocaleRTL() {
do_check_true(typeof localeService.isAppLocaleRTL === 'boolean');
run_next_test();
});
do_register_cleanup(() => {
Services.prefs.clearUserPref(PREF_SELECTED_LOCALE);
Services.prefs.clearUserPref(PREF_MATCH_OS_LOCALE);

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

@ -0,0 +1,23 @@
// Tests that onEnterFrame events are enabled when Debugger callbacks set
// before Instance creation.
load(libdir + "asserts.js");
if (!wasmIsSupported())
quit();
var g = newGlobal();
g.parent = this;
g.onEnterFrameCalled = false;
g.eval(`
var dbg = new Debugger(parent);
dbg.onEnterFrame = frame => {
onEnterFrameCalled = true;
};
`);
var i = new WebAssembly.Instance(new WebAssembly.Module(wasmTextToBinary(`
(module (func (export "f")))
`)));
i.exports.f();
assertEq(g.onEnterFrameCalled, true);

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

@ -83,6 +83,12 @@ Compartment::registerInstance(JSContext* cx, HandleWasmInstanceObject instanceOb
instance.code().ensureProfilingLabels(cx->runtime()->geckoProfiler().enabled());
if (instance.debugEnabled() &&
instance.compartment()->debuggerObservesAllExecution())
{
instance.ensureEnterFrameTrapsState(cx, true);
}
size_t index;
if (BinarySearchIf(instances_, 0, instances_.length(), InstanceComparator(instance), &index))
MOZ_CRASH("duplicate registration");

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

@ -8109,12 +8109,15 @@ nsDisplayMask::PaintMask(nsDisplayListBuilder* aBuilder,
{
MOZ_ASSERT(aMaskContext->GetDrawTarget()->GetFormat() == SurfaceFormat::A8);
uint32_t flags = aBuilder->ShouldSyncDecodeImages()
? imgIContainer::FLAG_SYNC_DECODE
: imgIContainer::FLAG_SYNC_DECODE_IF_FAST;
nsRect borderArea = nsRect(ToReferenceFrame(), mFrame->GetSize());
nsSVGIntegrationUtils::PaintFramesParams params(*aMaskContext,
mFrame, mVisibleRect,
borderArea, aBuilder,
nullptr,
mHandleOpacity);
mHandleOpacity, flags);
ComputeMaskGeometry(params);
image::DrawResult result = nsSVGIntegrationUtils::PaintMask(params);
@ -8217,12 +8220,15 @@ nsDisplayMask::PaintAsLayer(nsDisplayListBuilder* aBuilder,
{
MOZ_ASSERT(!ShouldPaintOnMaskLayer(aManager));
uint32_t flags = aBuilder->ShouldSyncDecodeImages()
? imgIContainer::FLAG_SYNC_DECODE
: imgIContainer::FLAG_SYNC_DECODE_IF_FAST;
nsRect borderArea = nsRect(ToReferenceFrame(), mFrame->GetSize());
nsSVGIntegrationUtils::PaintFramesParams params(*aCtx->ThebesContext(),
mFrame, mVisibleRect,
borderArea, aBuilder,
aManager,
mHandleOpacity);
mHandleOpacity, flags);
// Clip the drawing target by mVisibleRect, which contains the visible
// region of the target frame and its out-of-flow and inflow descendants.
@ -8407,12 +8413,15 @@ nsDisplayFilter::PaintAsLayer(nsDisplayListBuilder* aBuilder,
nsRenderingContext* aCtx,
LayerManager* aManager)
{
uint32_t flags = aBuilder->ShouldSyncDecodeImages()
? imgIContainer::FLAG_SYNC_DECODE
: imgIContainer::FLAG_SYNC_DECODE_IF_FAST;
nsRect borderArea = nsRect(ToReferenceFrame(), mFrame->GetSize());
nsSVGIntegrationUtils::PaintFramesParams params(*aCtx->ThebesContext(),
mFrame, mVisibleRect,
borderArea, aBuilder,
aManager,
mHandleOpacity);
mHandleOpacity, flags);
image::DrawResult result = nsSVGIntegrationUtils::PaintFilter(params);
nsDisplayFilterGeometry::UpdateDrawResult(this, result);

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

@ -10,6 +10,8 @@
#include "nsIServiceManager.h"
#include "nsPrintEngine.h"
using namespace mozilla;
NS_IMPL_ISUPPORTS_INHERITED(nsPagePrintTimer, mozilla::Runnable, nsITimerCallback)
nsPagePrintTimer::~nsPagePrintTimer()
@ -24,7 +26,7 @@ nsPagePrintTimer::~nsPagePrintTimer()
}
}
nsresult
nsresult
nsPagePrintTimer::StartTimer(bool aUseDelay)
{
nsresult result;
@ -41,6 +43,7 @@ nsPagePrintTimer::StartTimer(bool aUseDelay)
delay = mDelay;
}
}
mTimer->SetTarget(mDocument->EventTargetFor(TaskCategory::Other));
mTimer->InitWithCallback(this, delay, nsITimer::TYPE_ONE_SHOT);
}
return result;
@ -59,6 +62,7 @@ nsPagePrintTimer::StartWatchDogTimer()
} else {
// Instead of just doing one timer for a long period do multiple so we
// can check if the user cancelled the printing.
mWatchDogTimer->SetTarget(mDocument->EventTargetFor(TaskCategory::Other));
mWatchDogTimer->InitWithCallback(this, WATCH_DOG_INTERVAL,
nsITimer::TYPE_ONE_SHOT);
}
@ -158,7 +162,8 @@ nsPagePrintTimer::Notify(nsITimer *timer)
if (donePrePrint && !mWaitingForRemotePrint) {
StopWatchDogTimer();
NS_DispatchToMainThread(this);
// Pass nullptr here since name already was set in constructor.
mDocument->Dispatch(nullptr, TaskCategory::Other, do_AddRef(this));
} else {
// Start the watch dog if we're waiting for preprint to ensure that if any
// mozPrintCallbacks take to long we error out.
@ -188,11 +193,13 @@ nsPagePrintTimer::RemotePrintFinished()
return;
}
mWaitingForRemotePrint->SetTarget(
mDocument->EventTargetFor(mozilla::TaskCategory::Other));
mozilla::Unused <<
mWaitingForRemotePrint->InitWithCallback(this, 0, nsITimer::TYPE_ONE_SHOT);
}
nsresult
nsresult
nsPagePrintTimer::Start(nsPrintObject* aPO)
{
mPrintObj = aPO;
@ -201,7 +208,7 @@ nsPagePrintTimer::Start(nsPrintObject* aPO)
}
void
void
nsPagePrintTimer::Stop()
{
if (mTimer) {

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

@ -14,6 +14,7 @@
#include "nsThreadUtils.h"
class nsPrintEngine;
class nsIDocument;
//---------------------------------------------------
//-- Page Timer Class
@ -27,15 +28,19 @@ public:
nsPagePrintTimer(nsPrintEngine* aPrintEngine,
nsIDocumentViewerPrint* aDocViewerPrint,
nsIDocument* aDocument,
uint32_t aDelay)
: mPrintEngine(aPrintEngine)
: Runnable("nsPagePrintTimer")
, mPrintEngine(aPrintEngine)
, mDocViewerPrint(aDocViewerPrint)
, mDocument(aDocument)
, mDelay(aDelay)
, mFiringCount(0)
, mPrintObj(nullptr)
, mWatchDogCount(0)
, mDone(false)
{
MOZ_ASSERT(aDocument);
mDocViewerPrint->IncrementDestroyRefCount();
}
@ -62,6 +67,7 @@ private:
nsPrintEngine* mPrintEngine;
nsCOMPtr<nsIDocumentViewerPrint> mDocViewerPrint;
nsCOMPtr<nsIDocument> mDocument;
nsCOMPtr<nsITimer> mTimer;
nsCOMPtr<nsITimer> mWatchDogTimer;
nsCOMPtr<nsITimer> mWaitingForRemotePrint;

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

@ -3495,11 +3495,15 @@ nsPrintEngine::StartPagePrintTimer(const UniquePtr<nsPrintObject>& aPO)
if (!mPagePrintTimer) {
// Get the delay time in between the printing of each page
// this gives the user more time to press cancel
if (!mDocument) {
MOZ_LOG(gPrintingLog, LogLevel::Error,("Error! mDocument is NULL"));
return NS_ERROR_FAILURE;
}
int32_t printPageDelay = 50;
mPrt->mPrintSettings->GetPrintPageDelay(&printPageDelay);
RefPtr<nsPagePrintTimer> timer =
new nsPagePrintTimer(this, mDocViewerPrint, printPageDelay);
new nsPagePrintTimer(this, mDocViewerPrint, mDocument, printPageDelay);
timer.forget(&mPagePrintTimer);
nsCOMPtr<nsIPrintSession> printSession;
@ -3556,9 +3560,12 @@ private:
void
nsPrintEngine::FirePrintCompletionEvent()
{
MOZ_ASSERT(NS_IsMainThread());
nsCOMPtr<nsIRunnable> event = new nsPrintCompletionEvent(mDocViewerPrint);
if (NS_FAILED(NS_DispatchToCurrentThread(event)))
if (NS_FAILED(mDocument->Dispatch("nsPrintCompletionEvent",
TaskCategory::Other, event.forget()))) {
NS_WARNING("failed to dispatch print completion event");
}
}
void

Двоичные данные
layout/reftests/svg/big-image.jpeg Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 157 KiB

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

@ -0,0 +1,5 @@
<div style="left: 0px; top: 0px; width: 10px; height: 10px;">
<svg x="0" y="0" height="100%" width="100%" preserveAspectRatio="xMidYMid slice" viewBox="0 0 4000 3000">
<image xlink:href="big-image.jpeg" width="4000" height="3000"/>
</svg>
</div>

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

@ -0,0 +1,10 @@
<div style="left: 0px; top: 0px; width: 10px; height: 10px;">
<svg x="0" y="0" height="100%" width="100%">
<defs>
<pattern id="pattern-big-image" patternUnits="objectBoundingBox" preserveAspectRatio="xMidYMid slice" width="1" height="1" x="0" y="0" viewBox="0 0 4000 3000">
<image xlink:href="big-image.jpeg" width="4000" height="3000"/>
</pattern>
</defs>
<rect fill="url(#pattern-big-image)" x="0" y="0" width="100%" height="100%"/>
</svg>
</div>

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

@ -346,6 +346,7 @@ fuzzy-if(skiaContent,1,400) == path-06.svg path-06-ref.svg
== pathLength-02.svg pass.svg
== pattern-basic-01.svg pass.svg
fuzzy(1,5) skip-if(Android) == pattern-big-image.html pattern-big-image-ref.html
== pattern-invalid-01.svg pattern-invalid-01-ref.svg
fuzzy-if(skiaContent,1,5) == pattern-live-01a.svg pattern-live-01-ref.svg
fuzzy-if(skiaContent,1,5) == pattern-live-01b.svg pattern-live-01-ref.svg

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

@ -29,7 +29,7 @@ random-if(Android) == filter-html-01-extref.xhtml filter-html-01-ref.svg # Andro
== filter-html-zoomed-01.xhtml filter-html-01-ref.svg
== mask-html-01.xhtml mask-html-01-ref.svg
== mask-html-01-extref-01.xhtml mask-html-01-ref.svg
random == mask-html-01-extref-02.xhtml mask-html-01-ref.svg # random due to bug 877661
== mask-html-01-extref-02.xhtml mask-html-01-ref.svg
== mask-html-zoomed-01.xhtml mask-html-01-ref.svg
== mask-html-xbl-bound-01.html mask-html-01-ref.svg
== mask-transformed-html-01.xhtml ../pass.svg

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

@ -0,0 +1,72 @@
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<script type="application/javascript"
src="/tests/SimpleTest/paint_listener.js"></script>
<script type="application/javascript" src="animation_utils.js"></script>
<script>
var ok = opener.ok.bind(opener);
var is = opener.is.bind(opener);
var todo = opener.todo.bind(opener);
function finish() {
var o = opener;
self.close();
o.SimpleTest.finish();
}
</script>
<style type="text/css">
@keyframes anim {
0% { transform: translate(0px) }
100% { transform: translate(100px) }
}
.target {
/* The animation target needs geometry in order to qualify for OMTA */
width: 100px;
height: 100px;
background-color: white;
}
</style>
</head>
<body>
<div id="display"></div>
<script type="application/javascript">
"use strict";
runOMTATest(function() {
runAllAsyncAnimTests().then(function() {
finish();
});
}, finish, opener.SpecialPowers);
addAsyncAnimTest(function *() {
var [ div, cs ] = new_div("animation: anim 10s linear");
const animation = div.getAnimations()[0];
// Animation is initially running on compositor
yield waitForPaintsFlushed();
advance_clock(5000);
omta_is(div, 'transform', { tx: 50 }, RunningOn.Compositor,
'Animation is initally animating on compositor');
// Reverse animation
animation.reverse();
// At this point the playbackRate has changed but the transform will
// not have changed.
yield waitForPaints();
omta_is(div, 'transform', { tx: 50 }, RunningOn.Compositor,
'Animation value does not change after being reversed');
// However, we should still have sent a layer transaction to update the
// playbackRate on the compositor so that on the next tick we advance
// in the right direction.
advance_clock(1000);
omta_is(div, 'transform', { tx: 40 }, RunningOn.Compositor,
'Animation proceeds in reverse direction');
done_div();
});
</script>
</body>
</html>

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

@ -64,6 +64,8 @@ support-files = file_animations_iterationstart.html
support-files = file_animations_pausing.html
[test_animations_playbackrate.html]
support-files = file_animations_playbackrate.html
[test_animations_reverse.html]
support-files = file_animations_reverse.html
[test_animations_styles_on_event.html]
skip-if = stylo # timeout bug 1328505
support-files = file_animations_styles_on_event.html

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

@ -54,6 +54,7 @@ to mochitest command.
* test_animations_omta_start.html [1]
* test_animations_pausing.html [1]
* test_animations_playbackrate.html [1]
* test_animations_reverse.html [1]
* SMIL Animation
* test_restyles_in_smil_animation.html [2]
* CSS Timing Functions: Frames timing functions

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

@ -0,0 +1,30 @@
<!doctype html>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1343589
-->
<head>
<meta charset=utf-8>
<title>Test for Animation.reverse() on compositor animations (Bug 1343589)</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=1343589">Mozilla Bug 1343589</a>
<div id="display"></div>
<pre id="test">
<script type="application/javascript">
"use strict";
SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv(
{ "set": [[ "dom.animations-api.core.enabled", true]] },
function() {
window.open("file_animations_reverse.html");
});
</script>
</pre>
</body>
</html>

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

@ -13,6 +13,7 @@
#include "nsSVGPaintServerFrame.h"
using namespace mozilla::gfx;
using namespace mozilla::image;
namespace mozilla {
@ -26,7 +27,7 @@ namespace mozilla {
* @param aProperty the frame property descriptor of the fill or stroke paint
* server frame
*/
static void
static DrawResult
SetupInheritablePaint(const DrawTarget* aDrawTarget,
const gfxMatrix& aContextMatrix,
nsIFrame* aFrame,
@ -40,40 +41,49 @@ SetupInheritablePaint(const DrawTarget* aDrawTarget,
nsSVGPaintServerFrame *ps =
nsSVGEffects::GetPaintServer(aFrame, aFillOrStroke, aProperty);
DrawResult result = DrawResult::SUCCESS;
if (ps) {
RefPtr<gfxPattern> pattern =
RefPtr<gfxPattern> pattern;
Tie(result, pattern) =
ps->GetPaintServerPattern(aFrame, aDrawTarget, aContextMatrix,
aFillOrStroke, aOpacity);
if (pattern) {
aTargetPaint.SetPaintServer(aFrame, aContextMatrix, ps);
return;
return result;
}
}
if (aOuterContextPaint) {
RefPtr<gfxPattern> pattern;
switch ((style->*aFillOrStroke).Type()) {
case eStyleSVGPaintType_ContextFill:
pattern = aOuterContextPaint->GetFillPattern(aDrawTarget, aOpacity,
aContextMatrix);
Tie(result, pattern) =
aOuterContextPaint->GetFillPattern(aDrawTarget, aOpacity,
aContextMatrix);
break;
case eStyleSVGPaintType_ContextStroke:
pattern = aOuterContextPaint->GetStrokePattern(aDrawTarget, aOpacity,
aContextMatrix);
Tie(result, pattern) =
aOuterContextPaint->GetStrokePattern(aDrawTarget, aOpacity,
aContextMatrix);
break;
default:
;
}
if (pattern) {
aTargetPaint.SetContextPaint(aOuterContextPaint, (style->*aFillOrStroke).Type());
return;
return result;
}
}
nscolor color =
nsSVGUtils::GetFallbackOrPaintColor(aFrame->StyleContext(), aFillOrStroke);
aTargetPaint.SetColor(color);
return result;
}
DrawMode
mozilla::Pair<DrawResult, DrawMode>
SVGContextPaintImpl::Init(const DrawTarget* aDrawTarget,
const gfxMatrix& aContextMatrix,
nsIFrame* aFrame,
@ -82,6 +92,7 @@ SVGContextPaintImpl::Init(const DrawTarget* aDrawTarget,
DrawMode toDraw = DrawMode(0);
const nsStyleSVG *style = aFrame->StyleSVG();
DrawResult result = DrawResult::SUCCESS;
// fill:
if (style->mFill.Type() == eStyleSVGPaintType_None) {
@ -91,10 +102,10 @@ SVGContextPaintImpl::Init(const DrawTarget* aDrawTarget,
style->mFillOpacity,
aOuterContextPaint);
SetupInheritablePaint(aDrawTarget, aContextMatrix, aFrame,
opacity, aOuterContextPaint,
mFillPaint, &nsStyleSVG::mFill,
nsSVGEffects::FillProperty());
result &= SetupInheritablePaint(aDrawTarget, aContextMatrix, aFrame,
opacity, aOuterContextPaint,
mFillPaint, &nsStyleSVG::mFill,
nsSVGEffects::FillProperty());
SetFillOpacity(opacity);
@ -109,17 +120,17 @@ SVGContextPaintImpl::Init(const DrawTarget* aDrawTarget,
style->mStrokeOpacity,
aOuterContextPaint);
SetupInheritablePaint(aDrawTarget, aContextMatrix, aFrame,
opacity, aOuterContextPaint,
mStrokePaint, &nsStyleSVG::mStroke,
nsSVGEffects::StrokeProperty());
result &= SetupInheritablePaint(aDrawTarget, aContextMatrix, aFrame,
opacity, aOuterContextPaint,
mStrokePaint, &nsStyleSVG::mStroke,
nsSVGEffects::StrokeProperty());
SetStrokeOpacity(opacity);
toDraw |= DrawMode::GLYPH_STROKE;
}
return toDraw;
return MakePair(result, toDraw);
}
void
@ -158,27 +169,32 @@ SVGContextPaint::GetContextPaint(nsIContent* aContent)
ownerDoc->GetProperty(nsGkAtoms::svgContextPaint));
}
already_AddRefed<gfxPattern>
mozilla::Pair<DrawResult, RefPtr<gfxPattern>>
SVGContextPaintImpl::GetFillPattern(const DrawTarget* aDrawTarget,
float aOpacity,
const gfxMatrix& aCTM)
const gfxMatrix& aCTM,
uint32_t aFlags)
{
return mFillPaint.GetPattern(aDrawTarget, aOpacity, &nsStyleSVG::mFill, aCTM);
return mFillPaint.GetPattern(aDrawTarget, aOpacity, &nsStyleSVG::mFill, aCTM,
aFlags);
}
already_AddRefed<gfxPattern>
mozilla::Pair<DrawResult, RefPtr<gfxPattern>>
SVGContextPaintImpl::GetStrokePattern(const DrawTarget* aDrawTarget,
float aOpacity,
const gfxMatrix& aCTM)
const gfxMatrix& aCTM,
uint32_t aFlags)
{
return mStrokePaint.GetPattern(aDrawTarget, aOpacity, &nsStyleSVG::mStroke, aCTM);
return mStrokePaint.GetPattern(aDrawTarget, aOpacity, &nsStyleSVG::mStroke,
aCTM, aFlags);
}
already_AddRefed<gfxPattern>
mozilla::Pair<DrawResult, RefPtr<gfxPattern>>
SVGContextPaintImpl::Paint::GetPattern(const DrawTarget* aDrawTarget,
float aOpacity,
nsStyleSVGPaint nsStyleSVG::*aFillOrStroke,
const gfxMatrix& aCTM)
const gfxMatrix& aCTM,
uint32_t aFlags)
{
RefPtr<gfxPattern> pattern;
if (mPatternCache.Get(aOpacity, getter_AddRefs(pattern))) {
@ -186,9 +202,10 @@ SVGContextPaintImpl::Paint::GetPattern(const DrawTarget* aDrawTarget,
// caller. We should get the same matrix each time a pattern is constructed
// so this should be fine.
pattern->SetMatrix(aCTM * mPatternMatrix);
return pattern.forget();
return MakePair(DrawResult::SUCCESS, Move(pattern));
}
DrawResult result = DrawResult::SUCCESS;
switch (mPaintType) {
case eStyleSVGPaintType_None:
pattern = new gfxPattern(Color());
@ -202,17 +219,20 @@ SVGContextPaintImpl::Paint::GetPattern(const DrawTarget* aDrawTarget,
break;
}
case eStyleSVGPaintType_Server:
pattern = mPaintDefinition.mPaintServerFrame->GetPaintServerPattern(mFrame,
aDrawTarget,
mContextMatrix,
aFillOrStroke,
aOpacity);
Tie(result, pattern) =
mPaintDefinition.mPaintServerFrame->GetPaintServerPattern(mFrame,
aDrawTarget,
mContextMatrix,
aFillOrStroke,
aOpacity,
nullptr,
aFlags);
{
// m maps original-user-space to pattern space
gfxMatrix m = pattern->GetMatrix();
gfxMatrix deviceToOriginalUserSpace = mContextMatrix;
if (!deviceToOriginalUserSpace.Invert()) {
return nullptr;
return MakePair(DrawResult::SUCCESS, RefPtr<gfxPattern>());
}
// mPatternMatrix maps device space to pattern space via original user space
mPatternMatrix = deviceToOriginalUserSpace * m;
@ -220,24 +240,26 @@ SVGContextPaintImpl::Paint::GetPattern(const DrawTarget* aDrawTarget,
pattern->SetMatrix(aCTM * mPatternMatrix);
break;
case eStyleSVGPaintType_ContextFill:
pattern = mPaintDefinition.mContextPaint->GetFillPattern(aDrawTarget,
aOpacity, aCTM);
Tie(result, pattern) =
mPaintDefinition.mContextPaint->GetFillPattern(aDrawTarget,
aOpacity, aCTM, aFlags);
// Don't cache this. mContextPaint will have cached it anyway. If we
// cache it, we'll have to compute mPatternMatrix, which is annoying.
return pattern.forget();
return MakePair(result, Move(pattern));
case eStyleSVGPaintType_ContextStroke:
pattern = mPaintDefinition.mContextPaint->GetStrokePattern(aDrawTarget,
aOpacity, aCTM);
Tie(result, pattern) =
mPaintDefinition.mContextPaint->GetStrokePattern(aDrawTarget,
aOpacity, aCTM, aFlags);
// Don't cache this. mContextPaint will have cached it anyway. If we
// cache it, we'll have to compute mPatternMatrix, which is annoying.
return pattern.forget();
return MakePair(result, Move(pattern));
default:
MOZ_ASSERT(false, "invalid paint type");
return nullptr;
return MakePair(DrawResult::SUCCESS, RefPtr<gfxPattern>());
}
mPatternCache.Put(aOpacity, pattern);
return pattern.forget();
return MakePair(result, Move(pattern));
}
AutoSetRestoreSVGContextPaint::AutoSetRestoreSVGContextPaint(
@ -279,33 +301,37 @@ AutoSetRestoreSVGContextPaint::~AutoSetRestoreSVGContextPaint()
// SVGEmbeddingContextPaint
already_AddRefed<gfxPattern>
mozilla::Pair<DrawResult, RefPtr<gfxPattern>>
SVGEmbeddingContextPaint::GetFillPattern(const DrawTarget* aDrawTarget,
float aFillOpacity,
const gfxMatrix& aCTM)
const gfxMatrix& aCTM,
uint32_t aFlags)
{
if (!mFill) {
return nullptr;
return MakePair(DrawResult::SUCCESS, RefPtr<gfxPattern>());
}
// The gfxPattern that we create below depends on aFillOpacity, and since
// different elements in the SVG image may pass in different values for
// fill opacities we don't try to cache the gfxPattern that we create.
Color fill = *mFill;
fill.a *= aFillOpacity;
return do_AddRef(new gfxPattern(fill));
RefPtr<gfxPattern> patern = new gfxPattern(fill);
return MakePair(DrawResult::SUCCESS, Move(patern));
}
already_AddRefed<gfxPattern>
mozilla::Pair<DrawResult, RefPtr<gfxPattern>>
SVGEmbeddingContextPaint::GetStrokePattern(const DrawTarget* aDrawTarget,
float aStrokeOpacity,
const gfxMatrix& aCTM)
const gfxMatrix& aCTM,
uint32_t aFlags)
{
if (!mStroke) {
return nullptr;
return MakePair(DrawResult::SUCCESS, RefPtr<gfxPattern>());
}
Color stroke = *mStroke;
stroke.a *= aStrokeOpacity;
return do_AddRef(new gfxPattern(stroke));
RefPtr<gfxPattern> patern = new gfxPattern(stroke);
return MakePair(DrawResult::SUCCESS, Move(patern));
}
uint32_t

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

@ -17,6 +17,7 @@
#include "nsColor.h"
#include "nsStyleStruct.h"
#include "nsTArray.h"
#include "DrawResult.h"
class gfxContext;
class nsIDocument;
@ -53,27 +54,35 @@ protected:
SVGContextPaint() {}
public:
typedef image::DrawResult DrawResult;
MOZ_DECLARE_REFCOUNTED_TYPENAME(SVGContextPaint)
virtual ~SVGContextPaint() {}
virtual already_AddRefed<gfxPattern> GetFillPattern(const DrawTarget* aDrawTarget,
float aOpacity,
const gfxMatrix& aCTM) = 0;
virtual already_AddRefed<gfxPattern> GetStrokePattern(const DrawTarget* aDrawTarget,
float aOpacity,
const gfxMatrix& aCTM) = 0;
virtual mozilla::Pair<DrawResult, RefPtr<gfxPattern>>
GetFillPattern(const DrawTarget* aDrawTarget,
float aOpacity,
const gfxMatrix& aCTM,
uint32_t aFlags = 0) = 0;
virtual mozilla::Pair<DrawResult, RefPtr<gfxPattern>>
GetStrokePattern(const DrawTarget* aDrawTarget,
float aOpacity,
const gfxMatrix& aCTM,
uint32_t aFlags = 0) = 0;
virtual float GetFillOpacity() const = 0;
virtual float GetStrokeOpacity() const = 0;
already_AddRefed<gfxPattern> GetFillPattern(const DrawTarget* aDrawTarget,
const gfxMatrix& aCTM) {
return GetFillPattern(aDrawTarget, GetFillOpacity(), aCTM);
mozilla::Pair<DrawResult, RefPtr<gfxPattern>>
GetFillPattern(const DrawTarget* aDrawTarget, const gfxMatrix& aCTM,
uint32_t aFlags = 0) {
return GetFillPattern(aDrawTarget, GetFillOpacity(), aCTM, aFlags);
}
already_AddRefed<gfxPattern> GetStrokePattern(const DrawTarget* aDrawTarget,
const gfxMatrix& aCTM) {
return GetStrokePattern(aDrawTarget, GetStrokeOpacity(), aCTM);
mozilla::Pair<DrawResult, RefPtr<gfxPattern>>
GetStrokePattern(const DrawTarget* aDrawTarget, const gfxMatrix& aCTM,
uint32_t aFlags) {
return GetStrokePattern(aDrawTarget, GetStrokeOpacity(), aCTM, aFlags);
}
static SVGContextPaint* GetContextPaint(nsIContent* aContent);
@ -138,18 +147,26 @@ struct SVGContextPaintImpl : public SVGContextPaint
{
protected:
typedef mozilla::gfx::DrawTarget DrawTarget;
public:
DrawMode Init(const DrawTarget* aDrawTarget,
const gfxMatrix& aContextMatrix,
nsIFrame* aFrame,
SVGContextPaint* aOuterContextPaint);
already_AddRefed<gfxPattern> GetFillPattern(const DrawTarget* aDrawTarget,
float aOpacity,
const gfxMatrix& aCTM) override;
already_AddRefed<gfxPattern> GetStrokePattern(const DrawTarget* aDrawTarget,
float aOpacity,
const gfxMatrix& aCTM) override;
public:
typedef mozilla::image::DrawResult DrawResult;
mozilla::Pair<DrawResult, DrawMode>
Init(const DrawTarget* aDrawTarget,
const gfxMatrix& aContextMatrix,
nsIFrame* aFrame,
SVGContextPaint* aOuterContextPaint);
mozilla::Pair<DrawResult, RefPtr<gfxPattern>>
GetFillPattern(const DrawTarget* aDrawTarget,
float aOpacity,
const gfxMatrix& aCTM,
uint32_t aFlags) override;
mozilla::Pair<DrawResult, RefPtr<gfxPattern>>
GetStrokePattern(const DrawTarget* aDrawTarget,
float aOpacity,
const gfxMatrix& aCTM,
uint32_t aFlags) override;
void SetFillOpacity(float aOpacity) { mFillOpacity = aOpacity; }
float GetFillOpacity() const override { return mFillOpacity; }
@ -199,10 +216,12 @@ public:
gfxMatrix mPatternMatrix;
nsRefPtrHashtable<nsFloatHashKey, gfxPattern> mPatternCache;
already_AddRefed<gfxPattern> GetPattern(const DrawTarget* aDrawTarget,
float aOpacity,
nsStyleSVGPaint nsStyleSVG::*aFillOrStroke,
const gfxMatrix& aCTM);
mozilla::Pair<DrawResult, RefPtr<gfxPattern>>
GetPattern(const DrawTarget* aDrawTarget,
float aOpacity,
nsStyleSVGPaint nsStyleSVG::*aFillOrStroke,
const gfxMatrix& aCTM,
uint32_t aFlags);
};
Paint mFillPaint;
@ -221,6 +240,7 @@ public:
class SVGEmbeddingContextPaint : public SVGContextPaint
{
typedef gfx::Color Color;
typedef mozilla::image::DrawResult DrawResult;
public:
SVGEmbeddingContextPaint() {}
@ -235,16 +255,16 @@ public:
/**
* Returns a pattern of type PatternType::COLOR, or else nullptr.
*/
already_AddRefed<gfxPattern> GetFillPattern(const DrawTarget* aDrawTarget,
float aFillOpacity,
const gfxMatrix& aCTM) override;
mozilla::Pair<DrawResult, RefPtr<gfxPattern>>
GetFillPattern(const DrawTarget* aDrawTarget, float aFillOpacity,
const gfxMatrix& aCTM, uint32_t aFlags = 0) override;
/**
* Returns a pattern of type PatternType::COLOR, or else nullptr.
*/
already_AddRefed<gfxPattern> GetStrokePattern(const DrawTarget* aDrawTarget,
float aStrokeOpacity,
const gfxMatrix& aCTM) override;
mozilla::Pair<DrawResult, RefPtr<gfxPattern>>
GetStrokePattern(const DrawTarget* aDrawTarget, float aStrokeOpacity,
const gfxMatrix& aCTM, uint32_t aFlags = 0) override;
float GetFillOpacity() const override {
// Always 1.0f since we don't currently allow 'context-fill-opacity'

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

@ -122,8 +122,14 @@ nsDisplaySVGGeometry::Paint(nsDisplayListBuilder* aBuilder,
gfxMatrix tm = nsSVGUtils::GetCSSPxToDevPxMatrix(mFrame) *
gfxMatrix::Translation(devPixelOffset);
uint32_t flag = aBuilder->ShouldSyncDecodeImages()
? imgIContainer::FLAG_SYNC_DECODE
: imgIContainer::FLAG_SYNC_DECODE_IF_FAST;
DrawResult result =
static_cast<SVGGeometryFrame*>(mFrame)->PaintSVG(*aCtx->ThebesContext(), tm);
static_cast<SVGGeometryFrame*>(mFrame)->PaintSVG(*aCtx->ThebesContext(),
tm, nullptr, flag);
nsDisplayItemGenericImageGeometry::UpdateDrawResult(this, result);
}
@ -280,7 +286,8 @@ SVGGeometryFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
DrawResult
SVGGeometryFrame::PaintSVG(gfxContext& aContext,
const gfxMatrix& aTransform,
const nsIntRect* aDirtyRect)
const nsIntRect* aDirtyRect,
uint32_t aFlags)
{
if (!StyleVisibility()->IsVisible())
return DrawResult::SUCCESS;
@ -289,12 +296,14 @@ SVGGeometryFrame::PaintSVG(gfxContext& aContext,
gfxMatrix newMatrix =
aContext.CurrentMatrix().PreMultiply(aTransform).NudgeToIntegers();
if (newMatrix.IsSingular()) {
return DrawResult::BAD_ARGS;
return DrawResult::SUCCESS;
}
uint32_t paintOrder = StyleSVG()->mPaintOrder;
DrawResult result = DrawResult::SUCCESS;
if (paintOrder == NS_STYLE_PAINT_ORDER_NORMAL) {
Render(&aContext, eRenderFill | eRenderStroke, newMatrix);
result = Render(&aContext, eRenderFill | eRenderStroke, newMatrix, aFlags);
PaintMarkers(aContext, aTransform);
} else {
while (paintOrder) {
@ -302,10 +311,10 @@ SVGGeometryFrame::PaintSVG(gfxContext& aContext,
paintOrder & ((1 << NS_STYLE_PAINT_ORDER_BITWIDTH) - 1);
switch (component) {
case NS_STYLE_PAINT_ORDER_FILL:
Render(&aContext, eRenderFill, newMatrix);
result &= Render(&aContext, eRenderFill, newMatrix, aFlags);
break;
case NS_STYLE_PAINT_ORDER_STROKE:
Render(&aContext, eRenderStroke, newMatrix);
result &= Render(&aContext, eRenderStroke, newMatrix, aFlags);
break;
case NS_STYLE_PAINT_ORDER_MARKERS:
PaintMarkers(aContext, aTransform);
@ -315,7 +324,7 @@ SVGGeometryFrame::PaintSVG(gfxContext& aContext,
}
}
return DrawResult::SUCCESS;
return result;
}
nsIFrame*
@ -749,10 +758,11 @@ SVGGeometryFrame::MarkerProperties::GetMarkerEndFrame()
(mMarkerEnd->GetReferencedFrame(nsGkAtoms::svgMarkerFrame, nullptr));
}
void
DrawResult
SVGGeometryFrame::Render(gfxContext* aContext,
uint32_t aRenderComponents,
const gfxMatrix& aNewTransform)
const gfxMatrix& aNewTransform,
uint32_t aFlags)
{
MOZ_ASSERT(!aNewTransform.IsSingular());
@ -785,7 +795,7 @@ SVGGeometryFrame::Render(gfxContext* aContext,
drawTarget->Fill(path, white,
DrawOptions(1.0f, CompositionOp::OP_OVER, aaMode));
}
return;
return DrawResult::SUCCESS;
}
SVGGeometryElement::SimplePath simplePath;
@ -795,15 +805,18 @@ SVGGeometryFrame::Render(gfxContext* aContext,
if (!simplePath.IsPath()) {
path = element->GetOrBuildPath(*drawTarget, fillRule);
if (!path) {
return;
return DrawResult::SUCCESS;
}
}
SVGContextPaint* contextPaint = SVGContextPaint::GetContextPaint(mContent);
DrawResult result = DrawResult::SUCCESS;
if (aRenderComponents & eRenderFill) {
GeneralPattern fillPattern;
nsSVGUtils::MakeFillPatternFor(this, aContext, &fillPattern, contextPaint);
result = nsSVGUtils::MakeFillPatternFor(this, aContext, &fillPattern,
contextPaint, aFlags);
if (fillPattern.GetPattern()) {
DrawOptions drawOptions(1.0f, CompositionOp::OP_OVER, aaMode);
if (simplePath.IsRect()) {
@ -824,7 +837,7 @@ SVGGeometryFrame::Render(gfxContext* aContext,
if (!path) {
path = element->GetOrBuildPath(*drawTarget, fillRule);
if (!path) {
return;
return DrawResult::SUCCESS;
}
simplePath.Reset();
}
@ -839,7 +852,10 @@ SVGGeometryFrame::Render(gfxContext* aContext,
path = builder->Finish();
}
GeneralPattern strokePattern;
nsSVGUtils::MakeStrokePatternFor(this, aContext, &strokePattern, contextPaint);
result &=
nsSVGUtils::MakeStrokePatternFor(this, aContext, &strokePattern,
contextPaint, aFlags);
if (strokePattern.GetPattern()) {
SVGContentUtils::AutoStrokeOptions strokeOptions;
SVGContentUtils::GetStrokeOptions(&strokeOptions,
@ -847,7 +863,7 @@ SVGGeometryFrame::Render(gfxContext* aContext,
StyleContext(), contextPaint);
// GetStrokeOptions may set the line width to zero as an optimization
if (strokeOptions.mLineWidth <= 0) {
return;
return DrawResult::SUCCESS;
}
DrawOptions drawOptions(1.0f, CompositionOp::OP_OVER, aaMode);
if (simplePath.IsRect()) {
@ -861,6 +877,8 @@ SVGGeometryFrame::Render(gfxContext* aContext,
}
}
}
return result;
}
void

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

@ -103,7 +103,8 @@ protected:
// nsSVGDisplayableFrame interface:
virtual DrawResult PaintSVG(gfxContext& aContext,
const gfxMatrix& aTransform,
const nsIntRect* aDirtyRect = nullptr) override;
const nsIntRect* aDirtyRect = nullptr,
uint32_t aFlags = 0) override;
virtual nsIFrame* GetFrameForPoint(const gfxPoint& aPoint) override;
virtual void ReflowSVG() override;
virtual void NotifySVGChanged(uint32_t aFlags) override;
@ -120,8 +121,8 @@ protected:
virtual uint16_t GetHitTestFlags();
private:
enum { eRenderFill = 1, eRenderStroke = 2 };
void Render(gfxContext* aContext, uint32_t aRenderComponents,
const gfxMatrix& aTransform);
DrawResult Render(gfxContext* aContext, uint32_t aRenderComponents,
const gfxMatrix& aTransform, uint32_t aFlags);
/**
* @param aMatrix The transform that must be multiplied onto aContext to

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

@ -2929,7 +2929,7 @@ SVGTextDrawPathCallbacks::MakeFillPattern(GeneralPattern* aOutPattern)
{
if (mColor == NS_SAME_AS_FOREGROUND_COLOR ||
mColor == NS_40PERCENT_FOREGROUND_COLOR) {
nsSVGUtils::MakeFillPatternFor(mFrame, gfx, aOutPattern);
Unused << nsSVGUtils::MakeFillPatternFor(mFrame, gfx, aOutPattern);
return;
}
@ -3000,7 +3000,8 @@ SVGTextDrawPathCallbacks::StrokeGeometry()
mColor == NS_40PERCENT_FOREGROUND_COLOR) {
if (nsSVGUtils::HasStroke(mFrame, /*aContextPaint*/ nullptr)) {
GeneralPattern strokePattern;
nsSVGUtils::MakeStrokePatternFor(mFrame, gfx, &strokePattern, /*aContextPaint*/ nullptr);
Unused << nsSVGUtils::MakeStrokePatternFor(mFrame, gfx, &strokePattern,
/*aContextPaint*/ nullptr);
if (strokePattern.GetPattern()) {
if (!mFrame->GetParent()->GetContent()->IsSVGElement()) {
// The cast that follows would be unsafe
@ -3561,7 +3562,8 @@ ShouldPaintCaret(const TextRenderedRun& aThisRun, nsCaret* aCaret)
DrawResult
SVGTextFrame::PaintSVG(gfxContext& aContext,
const gfxMatrix& aTransform,
const nsIntRect *aDirtyRect)
const nsIntRect *aDirtyRect,
uint32_t aFlags)
{
DrawTarget& aDrawTarget = *aContext.GetDrawTarget();
@ -3594,7 +3596,7 @@ SVGTextFrame::PaintSVG(gfxContext& aContext,
if (aTransform.IsSingular()) {
NS_WARNING("Can't render text element!");
return DrawResult::BAD_ARGS;
return DrawResult::SUCCESS;
}
gfxMatrix matrixForPaintServers = aTransform * initialMatrix;
@ -3645,7 +3647,7 @@ SVGTextFrame::PaintSVG(gfxContext& aContext,
SVGContextPaint::GetContextPaint(mContent);
nsRenderingContext rendCtx(&aContext);
DrawResult finalResult = DrawResult::SUCCESS;
while (run.mFrame) {
nsTextFrame* frame = run.mFrame;
@ -3658,10 +3660,12 @@ SVGTextFrame::PaintSVG(gfxContext& aContext,
aContext.SetMatrix(initialMatrix);
RefPtr<SVGContextPaintImpl> contextPaint = new SVGContextPaintImpl();
DrawMode drawMode = contextPaint->Init(&aDrawTarget,
aContext.CurrentMatrix(),
frame, outerContextPaint);
DrawMode drawMode;
DrawResult result = DrawResult::SUCCESS;
Tie(result, drawMode) = contextPaint->Init(&aDrawTarget,
aContext.CurrentMatrix(),
frame, outerContextPaint);
finalResult &= result;
if (drawMode & DrawMode::GLYPH_STROKE) {
// This may change the gfxContext's transform (for non-scaling stroke),
// in which case this needs to happen before we call SetMatrix() below.
@ -3703,7 +3707,7 @@ SVGTextFrame::PaintSVG(gfxContext& aContext,
run = it.Next();
}
return DrawResult::SUCCESS;
return finalResult;
}
nsIFrame*

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

@ -256,7 +256,8 @@ public:
virtual void NotifySVGChanged(uint32_t aFlags) override;
virtual DrawResult PaintSVG(gfxContext& aContext,
const gfxMatrix& aTransform,
const nsIntRect* aDirtyRect = nullptr) override;
const nsIntRect* aDirtyRect = nullptr,
uint32_t aFlags = 0) override;
virtual nsIFrame* GetFrameForPoint(const gfxPoint& aPoint) override;
virtual void ReflowSVG() override;
virtual SVGBBox GetBBoxContribution(const Matrix& aToBBoxUserspace,

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

@ -396,10 +396,11 @@ nsFilterInstance::BuildSourcePaint(SourceInfo *aSource)
ctx->SetMatrix(mPaintTransform *
gfxMatrix::Translation(-neededRect.TopLeft()));
GeneralPattern pattern;
DrawResult result = DrawResult::SUCCESS;
if (aSource == &mFillPaint) {
nsSVGUtils::MakeFillPatternFor(mTargetFrame, ctx, &pattern);
result = nsSVGUtils::MakeFillPatternFor(mTargetFrame, ctx, &pattern);
} else if (aSource == &mStrokePaint) {
nsSVGUtils::MakeStrokePatternFor(mTargetFrame, ctx, &pattern);
result = nsSVGUtils::MakeStrokePatternFor(mTargetFrame, ctx, &pattern);
}
if (pattern.GetPattern()) {
@ -410,7 +411,7 @@ nsFilterInstance::BuildSourcePaint(SourceInfo *aSource)
aSource->mSourceSurface = offscreenDT->Snapshot();
aSource->mSurfaceRect = neededRect;
return DrawResult::SUCCESS;
return result;
}
DrawResult

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

@ -254,7 +254,8 @@ nsSVGDisplayContainerFrame::IsSVGTransformed(gfx::Matrix *aOwnTransform,
DrawResult
nsSVGDisplayContainerFrame::PaintSVG(gfxContext& aContext,
const gfxMatrix& aTransform,
const nsIntRect *aDirtyRect)
const nsIntRect *aDirtyRect,
uint32_t aFlags)
{
NS_ASSERTION(!NS_SVGDisplayListPaintingEnabled() ||
(mState & NS_FRAME_IS_NONDISPLAY) ||
@ -292,7 +293,8 @@ nsSVGDisplayContainerFrame::PaintSVG(gfxContext& aContext,
continue;
}
}
result = nsSVGUtils::PaintFrameWithEffects(kid, aContext, m, aDirtyRect);
result = nsSVGUtils::PaintFrameWithEffects(kid, aContext, m, aDirtyRect,
aFlags);
if (result != DrawResult::SUCCESS) {
return result;
}

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

@ -142,7 +142,8 @@ public:
// nsSVGDisplayableFrame interface:
virtual DrawResult PaintSVG(gfxContext& aContext,
const gfxMatrix& aTransform,
const nsIntRect *aDirtyRect = nullptr) override;
const nsIntRect *aDirtyRect = nullptr,
uint32_t aFlags = 0) override;
virtual nsIFrame* GetFrameForPoint(const gfxPoint& aPoint) override;
virtual void ReflowSVG() override;
virtual void NotifySVGChanged(uint32_t aFlags) override;

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

@ -81,10 +81,13 @@ public:
*
* @param aDirtyRect The area being redrawn, in frame offset pixel
* coordinates.
*
* @param aFlags Image flags of the imgIContainer::FLAG_* variety.
*/
virtual DrawResult PaintSVG(gfxContext& aContext,
const gfxMatrix& aTransform,
const nsIntRect* aDirtyRect = nullptr) = 0;
const nsIntRect* aDirtyRect = nullptr,
uint32_t aFlags = 0) = 0;
/**
* Returns the frame that should handle pointer events at aPoint. aPoint is

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

@ -205,7 +205,8 @@ nsSVGForeignObjectFrame::IsSVGTransformed(Matrix *aOwnTransform,
DrawResult
nsSVGForeignObjectFrame::PaintSVG(gfxContext& aContext,
const gfxMatrix& aTransform,
const nsIntRect* aDirtyRect)
const nsIntRect* aDirtyRect,
uint32_t aFlags)
{
NS_ASSERTION(!NS_SVGDisplayListPaintingEnabled() ||
(mState & NS_FRAME_IS_NONDISPLAY),
@ -221,7 +222,7 @@ nsSVGForeignObjectFrame::PaintSVG(gfxContext& aContext,
if (aTransform.IsSingular()) {
NS_WARNING("Can't render foreignObject element!");
return DrawResult::BAD_ARGS;
return DrawResult::SUCCESS;
}
nsRect kidDirtyRect = kid->GetVisualOverflowRect();

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

@ -76,7 +76,8 @@ public:
// nsSVGDisplayableFrame interface:
virtual DrawResult PaintSVG(gfxContext& aContext,
const gfxMatrix& aTransform,
const nsIntRect* aDirtyRect = nullptr) override;
const nsIntRect* aDirtyRect = nullptr,
uint32_t aFlags = 0) override;
virtual nsIFrame* GetFrameForPoint(const gfxPoint& aPoint) override;
virtual void ReflowSVG() override;
virtual void NotifySVGChanged(uint32_t aFlags) override;

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

@ -223,13 +223,14 @@ static void GetStopInformation(nsIFrame* aStopFrame,
*aStopOpacity = aStopFrame->StyleSVGReset()->mStopOpacity;
}
already_AddRefed<gfxPattern>
mozilla::Pair<DrawResult, RefPtr<gfxPattern>>
nsSVGGradientFrame::GetPaintServerPattern(nsIFrame* aSource,
const DrawTarget* aDrawTarget,
const gfxMatrix& aContextMatrix,
nsStyleSVGPaint nsStyleSVG::*aFillOrStroke,
float aGraphicOpacity,
const gfxRect* aOverrideBounds)
const gfxRect* aOverrideBounds,
uint32_t aFlags)
{
uint16_t gradientUnits = GetGradientUnits();
MOZ_ASSERT(gradientUnits == SVG_UNIT_TYPE_OBJECTBOUNDINGBOX ||
@ -251,7 +252,7 @@ nsSVGGradientFrame::GetPaintServerPattern(nsIFrame* aSource,
// the corresponding fill or stroke had "none" specified.
if (nStops == 0) {
RefPtr<gfxPattern> pattern = new gfxPattern(Color());
return pattern.forget();
return MakePair(DrawResult::SUCCESS, Move(pattern));
}
if (nStops == 1 || GradientVectorLengthIsZero()) {
@ -263,7 +264,7 @@ nsSVGGradientFrame::GetPaintServerPattern(nsIFrame* aSource,
Color stopColor2 = Color::FromABGR(stopColor);
stopColor2.a *= stopOpacity * aGraphicOpacity;
RefPtr<gfxPattern> pattern = new gfxPattern(stopColor2);
return pattern.forget();
return MakePair(DrawResult::SUCCESS, Move(pattern));
}
// Get the transform list (if there is one). We do this after the returns
@ -272,7 +273,7 @@ nsSVGGradientFrame::GetPaintServerPattern(nsIFrame* aSource,
gfxMatrix patternMatrix = GetGradientTransform(aSource, aOverrideBounds);
if (patternMatrix.IsSingular()) {
return nullptr;
return MakePair(DrawResult::SUCCESS, RefPtr<gfxPattern>());
}
// revert any vector effect transform so that the gradient appears unchanged
@ -284,12 +285,13 @@ nsSVGGradientFrame::GetPaintServerPattern(nsIFrame* aSource,
}
if (!patternMatrix.Invert()) {
return nullptr;
return MakePair(DrawResult::SUCCESS, RefPtr<gfxPattern>());
}
RefPtr<gfxPattern> gradient = CreateGradient();
if (!gradient)
return nullptr;
if (!gradient) {
return MakePair(DrawResult::TEMPORARY_ERROR, RefPtr<gfxPattern>());
}
uint16_t aSpread = GetSpreadMethod();
if (aSpread == SVG_SPREADMETHOD_PAD)
@ -320,7 +322,7 @@ nsSVGGradientFrame::GetPaintServerPattern(nsIFrame* aSource,
gradient->AddColorStop(offset, stopColor2);
}
return gradient.forget();
return MakePair(DrawResult::SUCCESS, Move(gradient));
}
// Private (helper) methods

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

@ -46,13 +46,14 @@ public:
NS_DECL_ABSTRACT_FRAME(nsSVGGradientFrame)
// nsSVGPaintServerFrame methods:
virtual already_AddRefed<gfxPattern>
virtual mozilla::Pair<DrawResult, RefPtr<gfxPattern>>
GetPaintServerPattern(nsIFrame* aSource,
const DrawTarget* aDrawTarget,
const gfxMatrix& aContextMatrix,
nsStyleSVGPaint nsStyleSVG::*aFillOrStroke,
float aGraphicOpacity,
const gfxRect* aOverrideBounds) override;
const gfxRect* aOverrideBounds,
uint32_t aFlags) override;
// nsIFrame interface:
virtual nsresult AttributeChanged(int32_t aNameSpaceID,

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

@ -68,7 +68,8 @@ public:
// nsSVGDisplayableFrame interface:
virtual DrawResult PaintSVG(gfxContext& aContext,
const gfxMatrix& aTransform,
const nsIntRect* aDirtyRect = nullptr) override;
const nsIntRect* aDirtyRect = nullptr,
uint32_t aFlags = 0) override;
virtual nsIFrame* GetFrameForPoint(const gfxPoint& aPoint) override;
virtual void ReflowSVG() override;
@ -333,7 +334,8 @@ nsSVGImageFrame::TransformContextForPainting(gfxContext* aGfxContext,
DrawResult
nsSVGImageFrame::PaintSVG(gfxContext& aContext,
const gfxMatrix& aTransform,
const nsIntRect *aDirtyRect)
const nsIntRect *aDirtyRect,
uint32_t aFlags)
{
if (!StyleVisibility()->IsVisible())
return DrawResult::SUCCESS;
@ -395,8 +397,6 @@ nsSVGImageFrame::PaintSVG(gfxContext& aContext,
dirtyRect.MoveBy(-rootRect.TopLeft());
}
uint32_t drawFlags = imgIContainer::FLAG_SYNC_DECODE_IF_FAST;
if (mImageContainer->GetType() == imgIContainer::TYPE_VECTOR) {
// Package up the attributes of this image element which can override the
// attributes of mImageContainer's internal SVG document. The 'width' &
@ -427,7 +427,7 @@ nsSVGImageFrame::PaintSVG(gfxContext& aContext,
destRect,
aDirtyRect ? dirtyRect : destRect,
context,
drawFlags);
aFlags);
} else { // mImageContainer->GetType() == TYPE_RASTER
result = nsLayoutUtils::DrawSingleUnscaledImage(
aContext,
@ -436,7 +436,7 @@ nsSVGImageFrame::PaintSVG(gfxContext& aContext,
nsLayoutUtils::GetSamplingFilterForFrame(this),
nsPoint(0, 0),
aDirtyRect ? &dirtyRect : nullptr,
drawFlags);
aFlags);
}
if (opacity != 1.0f || StyleEffects()->mMixBlendMode != NS_STYLE_BLEND_NORMAL) {

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

@ -61,7 +61,8 @@ nsSVGInnerSVGFrame::GetType() const
DrawResult
nsSVGInnerSVGFrame::PaintSVG(gfxContext& aContext,
const gfxMatrix& aTransform,
const nsIntRect *aDirtyRect)
const nsIntRect *aDirtyRect,
uint32_t aFlags)
{
NS_ASSERTION(!NS_SVGDisplayListPaintingEnabled() ||
(mState & NS_FRAME_IS_NONDISPLAY),
@ -85,7 +86,7 @@ nsSVGInnerSVGFrame::PaintSVG(gfxContext& aContext,
nsSVGUtils::SetClipRect(&aContext, aTransform, clipRect);
}
return nsSVGDisplayContainerFrame::PaintSVG(aContext, aTransform, aDirtyRect);
return nsSVGDisplayContainerFrame::PaintSVG(aContext, aTransform, aDirtyRect, aFlags);
}
void

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

@ -54,7 +54,8 @@ public:
// nsSVGDisplayableFrame interface:
virtual DrawResult PaintSVG(gfxContext& aContext,
const gfxMatrix& aTransform,
const nsIntRect *aDirtyRect = nullptr) override;
const nsIntRect *aDirtyRect = nullptr,
uint32_t aFlags = 0) override;
virtual void ReflowSVG() override;
virtual void NotifySVGChanged(uint32_t aFlags) override;
SVGBBox GetBBoxContribution(const Matrix &aToBBoxUserspace,

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

@ -437,9 +437,10 @@ PaintMaskSurface(const PaintFramesParams& aParams,
if (maskFrame) {
Matrix svgMaskMatrix;
nsSVGMaskFrame::MaskParams params(maskContext, aParams.frame,
cssPxToDevPxMatrix,
aOpacity, &svgMaskMatrix,
svgReset->mMask.mLayers[i].mMaskMode);
cssPxToDevPxMatrix,
aOpacity, &svgMaskMatrix,
svgReset->mMask.mLayers[i].mMaskMode,
aParams.flags);
RefPtr<SourceSurface> svgMask;
Tie(result, svgMask) = maskFrame->GetMaskForMaskedFrame(params);
@ -515,7 +516,8 @@ CreateAndPaintMaskSurface(const PaintFramesParams& aParams,
paintResult.opacityApplied = true;
nsSVGMaskFrame::MaskParams params(&ctx, aParams.frame, cssPxToDevPxMatrix,
aOpacity, &paintResult.maskTransform,
svgReset->mMask.mLayers[0].mMaskMode);
svgReset->mMask.mLayers[0].mMaskMode,
aParams.flags);
Tie(paintResult.result, paintResult.maskSurface) =
aMaskFrames[0]->GetMaskForMaskedFrame(params);
@ -925,7 +927,6 @@ nsSVGIntegrationUtils::PaintMaskAndClipPath(const PaintFramesParams& aParams)
result &= paintResult.result;
maskSurface = paintResult.maskSurface;
if (maskSurface) {
MOZ_ASSERT(paintResult.result == DrawResult::SUCCESS);
shouldPushMask = true;
maskTransform = paintResult.maskTransform;
opacityApplied = paintResult.opacityApplied;
@ -1232,10 +1233,12 @@ nsSVGIntegrationUtils::DrawableFromPaintServer(nsIFrame* aFrame,
gfxRect overrideBounds(0, 0,
aPaintServerSize.width, aPaintServerSize.height);
overrideBounds.ScaleInverse(aFrame->PresContext()->AppUnitsPerDevPixel());
RefPtr<gfxPattern> pattern =
server->GetPaintServerPattern(aTarget, aDrawTarget,
aContextMatrix, &nsStyleSVG::mFill, 1.0,
&overrideBounds);
DrawResult result = DrawResult::SUCCESS;
RefPtr<gfxPattern> pattern;
Tie(result, pattern) =
server->GetPaintServerPattern(aTarget, aDrawTarget,
aContextMatrix, &nsStyleSVG::mFill, 1.0,
&overrideBounds);
if (!pattern)
return nullptr;

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

@ -142,16 +142,18 @@ public:
bool handleOpacity; // If true, PaintMaskAndClipPath/ PaintFilter should
// apply css opacity.
IntRect maskRect;
uint32_t flags; // Image flags of the imgIContainer::FLAG_* variety.
explicit PaintFramesParams(gfxContext& aCtx, nsIFrame* aFrame,
const nsRect& aDirtyRect,
const nsRect& aBorderArea,
nsDisplayListBuilder* aBuilder,
mozilla::layers::LayerManager* aLayerManager,
bool aHandleOpacity)
bool aHandleOpacity, uint32_t aFlags)
: ctx(aCtx), frame(aFrame), dirtyRect(aDirtyRect),
borderArea(aBorderArea), builder(aBuilder),
layerManager(aLayerManager), handleOpacity(aHandleOpacity)
layerManager(aLayerManager), handleOpacity(aHandleOpacity),
flags(aFlags)
{ }
};

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

@ -253,7 +253,7 @@ nsSVGMaskFrame::GetMaskForMaskedFrame(MaskParams& aParams)
mMatrixForChildren = GetMaskTransform(aParams.maskedFrame) *
aParams.toUserSpace;
DrawResult result;
DrawResult result = DrawResult::SUCCESS;
for (nsIFrame* kid = mFrames.FirstChild(); kid;
kid = kid->GetNextSibling()) {
@ -267,10 +267,8 @@ nsSVGMaskFrame::GetMaskForMaskedFrame(MaskParams& aParams)
m = static_cast<nsSVGElement*>(kid->GetContent())->
PrependLocalTransformsTo(m, eUserSpaceToParent);
}
result = nsSVGUtils::PaintFrameWithEffects(kid, *tmpCtx, m);
if (result != DrawResult::SUCCESS) {
return MakePair(result, RefPtr<SourceSurface>());
}
result &= nsSVGUtils::PaintFrameWithEffects(kid, *tmpCtx, m, nullptr,
aParams.flags);
}
RefPtr<SourceSurface> maskSnapshot = maskDT->Snapshot();
@ -324,12 +322,12 @@ nsSVGMaskFrame::GetMaskForMaskedFrame(MaskParams& aParams)
// Moz2D transforms in the opposite direction to Thebes
if (!maskSurfaceMatrix.Invert()) {
return MakePair(DrawResult::TEMPORARY_ERROR, RefPtr<SourceSurface>());
return MakePair(DrawResult::SUCCESS, RefPtr<SourceSurface>());
}
*aParams.maskTransform = ToMatrix(maskSurfaceMatrix);
RefPtr<SourceSurface> surface = destMaskSurface.forget();
return MakePair(DrawResult::SUCCESS, Move(surface));
return MakePair(result, Move(surface));
}
gfxRect

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

@ -59,12 +59,15 @@ public:
float opacity;
Matrix* maskTransform;
uint8_t maskMode;
uint32_t flags; // Image flags of the imgIContainer::FLAG_* variety.
explicit MaskParams(gfxContext* aCtx, nsIFrame* aMaskedFrame,
const gfxMatrix& aToUserSpace, float aOpacity,
Matrix* aMaskTransform, uint8_t aMaskMode)
Matrix* aMaskTransform, uint8_t aMaskMode,
uint32_t aFlags)
: ctx(aCtx), maskedFrame(aMaskedFrame), toUserSpace(aToUserSpace),
opacity(aOpacity), maskTransform(aMaskTransform), maskMode(aMaskMode)
opacity(aOpacity), maskTransform(aMaskTransform), maskMode(aMaskMode),
flags(aFlags)
{ }
};

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

@ -625,13 +625,16 @@ nsDisplayOuterSVG::Paint(nsDisplayListBuilder* aBuilder,
nsLayoutUtils::PointToGfxPoint(viewportRect.TopLeft(), appUnitsPerDevPixel);
aContext->ThebesContext()->Save();
uint32_t flags = aBuilder->ShouldSyncDecodeImages()
? imgIContainer::FLAG_SYNC_DECODE
: imgIContainer::FLAG_SYNC_DECODE_IF_FAST;
// We include the offset of our frame and a scale from device pixels to user
// units (i.e. CSS px) in the matrix that we pass to our children):
gfxMatrix tm = nsSVGUtils::GetCSSPxToDevPxMatrix(mFrame) *
gfxMatrix::Translation(devPixelOffset);
DrawResult result =
nsSVGUtils::PaintFrameWithEffects(mFrame, *aContext->ThebesContext(), tm,
&contentAreaDirtyRect);
&contentAreaDirtyRect, flags);
nsDisplayItemGenericImageGeometry::UpdateDrawResult(this, result);
aContext->ThebesContext()->Restore();
@ -843,7 +846,8 @@ nsSVGOuterSVGFrame::NotifyViewportOrTransformChanged(uint32_t aFlags)
DrawResult
nsSVGOuterSVGFrame::PaintSVG(gfxContext& aContext,
const gfxMatrix& aTransform,
const nsIntRect* aDirtyRect)
const nsIntRect* aDirtyRect,
uint32_t aFlags)
{
NS_ASSERTION(PrincipalChildList().FirstChild()->GetType() ==
nsGkAtoms::svgOuterSVGAnonChildFrame &&
@ -851,7 +855,7 @@ nsSVGOuterSVGFrame::PaintSVG(gfxContext& aContext,
"We should have a single, anonymous, child");
nsSVGOuterSVGAnonChildFrame *anonKid =
static_cast<nsSVGOuterSVGAnonChildFrame*>(PrincipalChildList().FirstChild());
return anonKid->PaintSVG(aContext, aTransform, aDirtyRect);
return anonKid->PaintSVG(aContext, aTransform, aDirtyRect, aFlags);
}
SVGBBox

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

@ -121,7 +121,8 @@ public:
// nsSVGDisplayableFrame methods:
virtual DrawResult PaintSVG(gfxContext& aContext,
const gfxMatrix& aTransform,
const nsIntRect* aDirtyRect = nullptr) override;
const nsIntRect* aDirtyRect = nullptr,
uint32_t aFlags = 0) override;
virtual SVGBBox GetBBoxContribution(const Matrix &aToBBoxUserspace,
uint32_t aFlags) override;

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

@ -56,6 +56,7 @@ class nsSVGPaintServerFrame : public nsSVGContainerFrame
{
protected:
typedef mozilla::gfx::DrawTarget DrawTarget;
typedef mozilla::image::DrawResult DrawResult;
explicit nsSVGPaintServerFrame(nsStyleContext* aContext)
: nsSVGContainerFrame(aContext)
@ -74,13 +75,14 @@ public:
* that surfaces of the correct size can be created. (SVG gradients are
* vector based, so it's not used there.)
*/
virtual already_AddRefed<gfxPattern>
virtual mozilla::Pair<DrawResult, RefPtr<gfxPattern>>
GetPaintServerPattern(nsIFrame *aSource,
const DrawTarget* aDrawTarget,
const gfxMatrix& aContextMatrix,
nsStyleSVGPaint nsStyleSVG::*aFillOrStroke,
float aOpacity,
const gfxRect *aOverrideBounds = nullptr) = 0;
const gfxRect *aOverrideBounds = nullptr,
uint32_t aFlags = 0) = 0;
// nsIFrame methods:
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше