Merge m-i to m-c, a=merge

MozReview-Commit-ID: 1NtOkt6oQ7d
This commit is contained in:
Phil Ringnalda 2017-01-14 09:38:58 -08:00
commit 082d6bd9df
159 changed files with 3047 additions and 1683 deletions

View File

@ -1133,7 +1133,7 @@ pref("services.sync.sendTabToDevice.enabled", true);
// Developer edition preferences
#ifdef MOZ_DEV_EDITION
sticky_pref("lightweightThemes.selectedThemeID", "firefox-devedition@mozilla.org");
sticky_pref("lightweightThemes.selectedThemeID", "firefox-compact-dark@mozilla.org");
#else
sticky_pref("lightweightThemes.selectedThemeID", "");
#endif

View File

@ -0,0 +1,105 @@
/* 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/. */
/**
* Listeners for the compact theme. This adds an extra stylesheet
* to browser.xul if a pref is set and no other themes are applied.
*/
var CompactTheme = {
styleSheetLocation: "chrome://browser/skin/compacttheme.css",
styleSheet: null,
initialized: false,
get isStyleSheetEnabled() {
return this.styleSheet && !this.styleSheet.sheet.disabled;
},
get isThemeCurrentlyApplied() {
let theme = LightweightThemeManager.currentTheme;
return theme && (
theme.id == "firefox-compact-dark@mozilla.org" ||
theme.id == "firefox-compact-light@mozilla.org");
},
init() {
this.initialized = true;
Services.obs.addObserver(this, "lightweight-theme-styling-update", false);
if (this.isThemeCurrentlyApplied) {
this._toggleStyleSheet(true);
}
},
createStyleSheet() {
let styleSheetAttr = `href="${this.styleSheetLocation}" type="text/css"`;
this.styleSheet = document.createProcessingInstruction(
"xml-stylesheet", styleSheetAttr);
this.styleSheet.addEventListener("load", this);
document.insertBefore(this.styleSheet, document.documentElement);
this.styleSheet.sheet.disabled = true;
},
observe(subject, topic, data) {
if (topic == "lightweight-theme-styling-update") {
let newTheme = JSON.parse(data);
if (newTheme && (
newTheme.id == "firefox-compact-light@mozilla.org" ||
newTheme.id == "firefox-compact-dark@mozilla.org")) {
// We are using the theme ID on this object instead of always referencing
// LightweightThemeManager.currentTheme in case this is a preview
this._toggleStyleSheet(true);
} else {
this._toggleStyleSheet(false);
}
}
},
handleEvent(e) {
if (e.type === "load") {
this.styleSheet.removeEventListener("load", this);
this.refreshBrowserDisplay();
}
},
refreshBrowserDisplay() {
// Don't touch things on the browser if gBrowserInit.onLoad hasn't
// yet fired.
if (this.initialized) {
gBrowser.tabContainer._positionPinnedTabs();
}
},
_toggleStyleSheet(enabled) {
let wasEnabled = this.isStyleSheetEnabled;
if (enabled) {
// The stylesheet may not have been created yet if it wasn't
// needed on initial load. Make it now.
if (!this.styleSheet) {
this.createStyleSheet();
}
this.styleSheet.sheet.disabled = false;
this.refreshBrowserDisplay();
} else if (!enabled && wasEnabled) {
this.styleSheet.sheet.disabled = true;
this.refreshBrowserDisplay();
}
},
uninit() {
Services.obs.removeObserver(this, "lightweight-theme-styling-update");
if (this.styleSheet) {
this.styleSheet.removeEventListener("load", this);
}
this.styleSheet = null;
}
};
// If the compact theme is going to be applied in gBrowserInit.onLoad,
// then preload it now. This prevents a flash of unstyled content where the
// normal theme is applied while the compact theme stylesheet is loading.
if (AppConstants.INSTALL_COMPACT_THEMES &&
this != Services.appShell.hiddenDOMWindow && CompactTheme.isThemeCurrentlyApplied) {
CompactTheme.createStyleSheet();
}

View File

@ -1,142 +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/. */
/**
* Listeners for the DevEdition theme. This adds an extra stylesheet
* to browser.xul if a pref is set and no other themes are applied.
*/
var DevEdition = {
_devtoolsThemePrefName: "devtools.theme",
styleSheetLocation: "chrome://browser/skin/devedition.css",
styleSheet: null,
initialized: false,
get isStyleSheetEnabled() {
return this.styleSheet && !this.styleSheet.sheet.disabled;
},
get isThemeCurrentlyApplied() {
let theme = LightweightThemeManager.currentTheme;
return theme && theme.id == "firefox-devedition@mozilla.org";
},
init() {
this.initialized = true;
Services.prefs.addObserver(this._devtoolsThemePrefName, this, false);
Services.obs.addObserver(this, "lightweight-theme-styling-update", false);
Services.obs.addObserver(this, "lightweight-theme-window-updated", false);
this._updateDevtoolsThemeAttribute();
if (this.isThemeCurrentlyApplied) {
this._toggleStyleSheet(true);
}
},
createStyleSheet() {
let styleSheetAttr = `href="${this.styleSheetLocation}" type="text/css"`;
this.styleSheet = document.createProcessingInstruction(
"xml-stylesheet", styleSheetAttr);
this.styleSheet.addEventListener("load", this);
document.insertBefore(this.styleSheet, document.documentElement);
this.styleSheet.sheet.disabled = true;
},
observe(subject, topic, data) {
if (topic == "lightweight-theme-styling-update") {
let newTheme = JSON.parse(data);
if (newTheme && newTheme.id == "firefox-devedition@mozilla.org") {
this._toggleStyleSheet(true);
} else {
this._toggleStyleSheet(false);
}
} else if (topic == "lightweight-theme-window-updated" && subject == window) {
this._updateLWTBrightness();
}
if (topic == "nsPref:changed" && data == this._devtoolsThemePrefName) {
this._updateDevtoolsThemeAttribute();
}
},
_inferBrightness() {
ToolbarIconColor.inferFromText();
// Get an inverted full screen button if the dark theme is applied.
if (this.isStyleSheetEnabled &&
document.documentElement.getAttribute("devtoolstheme") == "dark") {
document.documentElement.setAttribute("brighttitlebarforeground", "true");
} else {
document.documentElement.removeAttribute("brighttitlebarforeground");
}
},
_updateLWTBrightness() {
if (this.isThemeCurrentlyApplied) {
let devtoolsTheme = Services.prefs.getCharPref(this._devtoolsThemePrefName);
let textColor = devtoolsTheme == "dark" ? "bright" : "dark";
document.documentElement.setAttribute("lwthemetextcolor", textColor);
}
},
_updateDevtoolsThemeAttribute() {
// Set an attribute on root element to make it possible
// to change colors based on the selected devtools theme.
let devtoolsTheme = Services.prefs.getCharPref(this._devtoolsThemePrefName);
if (devtoolsTheme != "dark") {
devtoolsTheme = "light";
}
document.documentElement.setAttribute("devtoolstheme", devtoolsTheme);
this._updateLWTBrightness();
this._inferBrightness();
},
handleEvent(e) {
if (e.type === "load") {
this.styleSheet.removeEventListener("load", this);
this.refreshBrowserDisplay();
}
},
refreshBrowserDisplay() {
// Don't touch things on the browser if gBrowserInit.onLoad hasn't
// yet fired.
if (this.initialized) {
gBrowser.tabContainer._positionPinnedTabs();
this._inferBrightness();
}
},
_toggleStyleSheet(deveditionThemeEnabled) {
let wasEnabled = this.isStyleSheetEnabled;
if (deveditionThemeEnabled && !wasEnabled) {
// The stylesheet may not have been created yet if it wasn't
// needed on initial load. Make it now.
if (!this.styleSheet) {
this.createStyleSheet();
}
this.styleSheet.sheet.disabled = false;
this.refreshBrowserDisplay();
} else if (!deveditionThemeEnabled && wasEnabled) {
this.styleSheet.sheet.disabled = true;
this.refreshBrowserDisplay();
}
},
uninit() {
Services.prefs.removeObserver(this._devtoolsThemePrefName, this);
Services.obs.removeObserver(this, "lightweight-theme-styling-update");
Services.obs.removeObserver(this, "lightweight-theme-window-updated");
if (this.styleSheet) {
this.styleSheet.removeEventListener("load", this);
}
this.styleSheet = null;
}
};
// If the DevEdition theme is going to be applied in gBrowserInit.onLoad,
// then preload it now. This prevents a flash of unstyled content where the
// normal theme is applied while the DevEdition stylesheet is loading.
if (!AppConstants.RELEASE_OR_BETA &&
this != Services.appShell.hiddenDOMWindow && DevEdition.isThemeCurrentlyApplied) {
DevEdition.createStyleSheet();
}

View File

@ -998,7 +998,7 @@ var gBrowserInit = {
LanguageDetectionListener.init();
BrowserOnClick.init();
FeedHandler.init();
DevEdition.init();
CompactTheme.init();
AboutPrivateBrowsingListener.init();
TrackingProtection.init();
RefreshBlocker.init();
@ -1515,7 +1515,7 @@ var gBrowserInit = {
FeedHandler.uninit();
DevEdition.uninit();
CompactTheme.uninit();
TrackingProtection.uninit();

View File

Before

Width:  |  Height:  |  Size: 95 B

After

Width:  |  Height:  |  Size: 95 B

View File

@ -0,0 +1,16 @@
<?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" width="32" height="32">
<rect fill="#727780" x="1" y="1" width="30" height="30" rx="2" ry="2"/>
<path fill="#393f4c" d="M3 1h26a2 2 0 0 1 2 2v14H1V3a2 2 0 0 1 2-2z"/>
<rect fill="#171b1f" x="3.5" y="3.5" width="25" height="11" rx="1" ry="1"/>
<path fill="#252c33" d="M4.5 3.5h12v11h-12a1 1 0 0 1-1-1v-9a1 1 0 0 1 1-1z"/>
<rect stroke="#1d2328" fill="none" stroke-width="2" x="1" y="1" width="30" height="30" rx="2" ry="2"/>
<path class="icon-line-2px" d="M10 6L7 9l3 3M7.5 9H13"/>
<path stroke="#1d2328" d="M1.5 16.5h29"/>
<path class="separator-toolbar-items" d="M16.5 3.5v11"/>
<rect fill="none" stroke="#171b1f" x="3.5" y="3.5" width="25" height="11" rx="1" ry="1"/>
<path fill="#f0f1f2" d="M13 8H9.4l1.3-1.3a1 1 0 0 0-1.4-1.4l-3 3a1 1 0 0 0 0 1.4l3 3a1 1 0 0 0 1.4-1.4L9.4 10H13a1 1 0 0 0 0-2z"/>
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -0,0 +1,15 @@
<?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" width="32" height="32">
<rect fill="#fff" x="1" y="1" width="30" height="30" rx="2" ry="2"/>
<path fill="#e3e3e3" d="M3 1h26a2 2 0 0 1 2 2v14H1V3a2 2 0 0 1 2-2z"/>
<rect fill="#fff" x="3.5" y="3.5" width="25" height="11" rx="1" ry="1"/>
<path fill="#fcfcfc" d="M4.5 3.5h12v11h-12a1 1 0 0 1-1-1v-9a1 1 0 0 1 1-1z"/>
<rect fill="none" stroke="#999" stroke-width="2" x="1" y="1" width="30" height="30" rx="2" ry="2"/>
<path stroke="#999" d="M1.5 16.5h29"/>
<path stroke="#b3b3b3" d="M16.5 3.5v11"/>
<rect fill="none" stroke="#b3b3b3" x="3.5" y="3.5" width="25" height="11" rx="1" ry="1"/>
<path fill="#595959" d="M13 8H9.4l1.3-1.3a1 1 0 0 0-1.4-1.4l-3 3a1 1 0 0 0 0 1.4l3 3a1 1 0 0 0 1.4-1.4L9.4 10H13a1 1 0 0 0 0-2z"/>
</svg>

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

View File

@ -13,7 +13,7 @@
<script type="application/javascript" src="chrome://browser/content/browser-addons.js"/>
<script type="application/javascript" src="chrome://browser/content/browser-ctrlTab.js"/>
<script type="application/javascript" src="chrome://browser/content/browser-customization.js"/>
<script type="application/javascript" src="chrome://browser/content/browser-devedition.js"/>
<script type="application/javascript" src="chrome://browser/content/browser-compacttheme.js"/>
<script type="application/javascript" src="chrome://browser/content/browser-feeds.js"/>
<script type="application/javascript" src="chrome://browser/content/browser-fullScreenAndPointerLock.js"/>
<script type="application/javascript" src="chrome://browser/content/browser-fullZoom.js"/>

View File

@ -280,6 +280,7 @@ skip-if = os == 'win'
subsuite = clipboard
[browser_clipboard_pastefile.js]
skip-if = true # Disabled due to the clipboard not supporting real file types yet (bug 1288773)
[browser_compacttheme.js]
[browser_contentAreaClick.js]
skip-if = e10s # Clicks in content don't go through contentAreaClick with e10s.
[browser_contentAltClick.js]
@ -294,7 +295,6 @@ skip-if = toolkit == "gtk2" || toolkit == "gtk3" # disabled on Linux due to bug
skip-if = !datareporting
[browser_decoderDoctor.js]
skip-if = os == "mac" # decoder doctor isn't implemented on osx
[browser_devedition.js]
[browser_discovery.js]
[browser_double_close_tab.js]
[browser_documentnavigation.js]

View File

@ -0,0 +1,90 @@
/*
* Testing changes for compact themes.
* A special stylesheet should be added to the browser.xul document
* when the firefox-compact-light and firefox-compact-dark lightweight
* themes are applied.
*/
const PREF_LWTHEME_USED_THEMES = "lightweightThemes.usedThemes";
const COMPACT_LIGHT_ID = "firefox-compact-light@mozilla.org";
const COMPACT_DARK_ID = "firefox-compact-dark@mozilla.org";
const SKIP_TEST = !AppConstants.INSTALL_COMPACT_THEMES;
const {LightweightThemeManager} = Components.utils.import("resource://gre/modules/LightweightThemeManager.jsm", {});
registerCleanupFunction(() => {
// Set preferences back to their original values
LightweightThemeManager.currentTheme = null;
Services.prefs.clearUserPref(PREF_LWTHEME_USED_THEMES);
});
add_task(function* startTests() {
if (SKIP_TEST) {
ok(true, "No need to run this test since themes aren't installed");
return;
}
info("Setting the current theme to null");
LightweightThemeManager.currentTheme = null;
ok(!CompactTheme.isStyleSheetEnabled, "There is no compact style sheet when no lw theme is applied.");
info("Adding a lightweight theme.");
LightweightThemeManager.currentTheme = dummyLightweightTheme("preview0");
ok(!CompactTheme.isStyleSheetEnabled, "The compact stylesheet has been removed when a lightweight theme is applied.");
info("Applying the dark compact theme.");
LightweightThemeManager.currentTheme = LightweightThemeManager.getUsedTheme(COMPACT_DARK_ID);
ok(CompactTheme.isStyleSheetEnabled, "The compact stylesheet has been added when the compact lightweight theme is applied");
info("Applying the light compact theme.");
LightweightThemeManager.currentTheme = LightweightThemeManager.getUsedTheme(COMPACT_LIGHT_ID);
ok(CompactTheme.isStyleSheetEnabled, "The compact stylesheet has been added when the compact lightweight theme is applied");
info("Adding a different lightweight theme.");
LightweightThemeManager.currentTheme = dummyLightweightTheme("preview1");
ok(!CompactTheme.isStyleSheetEnabled, "The compact stylesheet has been removed when a lightweight theme is applied.");
info("Unapplying all themes.");
LightweightThemeManager.currentTheme = null;
ok(!CompactTheme.isStyleSheetEnabled, "There is no compact style sheet when no lw theme is applied.");
});
function dummyLightweightTheme(id) {
return {
id,
name: id,
headerURL: "resource:///chrome/browser/content/browser/defaultthemes/compact.header.png",
iconURL: "resource:///chrome/browser/content/browser/defaultthemes/compactlight.icon.svg",
textcolor: "red",
accentcolor: "blue"
};
}
add_task(function* testLightweightThemePreview() {
if (SKIP_TEST) {
ok(true, "No need to run this test since themes aren't installed");
return;
}
info("Setting compact to current and previewing others");
LightweightThemeManager.currentTheme = LightweightThemeManager.getUsedTheme(COMPACT_LIGHT_ID);
ok(CompactTheme.isStyleSheetEnabled, "The compact stylesheet is enabled.");
LightweightThemeManager.previewTheme(dummyLightweightTheme("preview0"));
ok(!CompactTheme.isStyleSheetEnabled, "The compact stylesheet is not enabled after a lightweight theme preview.");
LightweightThemeManager.resetPreview();
LightweightThemeManager.previewTheme(dummyLightweightTheme("preview1"));
ok(!CompactTheme.isStyleSheetEnabled, "The compact stylesheet is not enabled after a second lightweight theme preview.");
LightweightThemeManager.resetPreview();
ok(CompactTheme.isStyleSheetEnabled, "The compact stylesheet is enabled again after resetting the preview.");
LightweightThemeManager.currentTheme = null;
ok(!CompactTheme.isStyleSheetEnabled, "The compact stylesheet is gone after removing the current theme.");
info("Previewing the compact theme");
LightweightThemeManager.previewTheme(LightweightThemeManager.getUsedTheme(COMPACT_LIGHT_ID));
ok(CompactTheme.isStyleSheetEnabled, "The compact stylesheet is enabled.");
LightweightThemeManager.previewTheme(LightweightThemeManager.getUsedTheme(COMPACT_DARK_ID));
ok(CompactTheme.isStyleSheetEnabled, "The compact stylesheet is enabled.");
LightweightThemeManager.previewTheme(dummyLightweightTheme("preview2"));
ok(!CompactTheme.isStyleSheetEnabled, "The compact stylesheet is now disabled after previewing a new sheet.");
LightweightThemeManager.resetPreview();
ok(!CompactTheme.isStyleSheetEnabled, "The compact stylesheet is now disabled after resetting the preview.");
});

View File

@ -1,129 +0,0 @@
/*
* Testing changes for Developer Edition theme.
* A special stylesheet should be added to the browser.xul document
* when the firefox-devedition@mozilla.org lightweight theme
* is applied.
*/
const PREF_LWTHEME_USED_THEMES = "lightweightThemes.usedThemes";
const PREF_DEVTOOLS_THEME = "devtools.theme";
const {LightweightThemeManager} = Components.utils.import("resource://gre/modules/LightweightThemeManager.jsm", {});
LightweightThemeManager.clearBuiltInThemes();
LightweightThemeManager.addBuiltInTheme(dummyLightweightTheme("firefox-devedition@mozilla.org"));
registerCleanupFunction(() => {
// Set preferences back to their original values
LightweightThemeManager.currentTheme = null;
Services.prefs.clearUserPref(PREF_DEVTOOLS_THEME);
Services.prefs.clearUserPref(PREF_LWTHEME_USED_THEMES);
LightweightThemeManager.currentTheme = null;
LightweightThemeManager.clearBuiltInThemes();
});
add_task(function* startTests() {
Services.prefs.setCharPref(PREF_DEVTOOLS_THEME, "dark");
info("Setting the current theme to null");
LightweightThemeManager.currentTheme = null;
ok(!DevEdition.isStyleSheetEnabled, "There is no devedition style sheet when no lw theme is applied.");
info("Adding a lightweight theme.");
LightweightThemeManager.currentTheme = dummyLightweightTheme("preview0");
ok(!DevEdition.isStyleSheetEnabled, "The devedition stylesheet has been removed when a lightweight theme is applied.");
info("Applying the devedition lightweight theme.");
let onAttributeAdded = waitForBrightTitlebarAttribute();
LightweightThemeManager.currentTheme = LightweightThemeManager.getUsedTheme("firefox-devedition@mozilla.org");
ok(DevEdition.isStyleSheetEnabled, "The devedition stylesheet has been added when the devedition lightweight theme is applied");
yield onAttributeAdded;
is(document.documentElement.getAttribute("brighttitlebarforeground"), "true",
"The brighttitlebarforeground attribute is set on the window.");
info("Unapplying all themes.");
LightweightThemeManager.currentTheme = null;
ok(!DevEdition.isStyleSheetEnabled, "There is no devedition style sheet when no lw theme is applied.");
info("Applying the devedition lightweight theme.");
onAttributeAdded = waitForBrightTitlebarAttribute();
LightweightThemeManager.currentTheme = LightweightThemeManager.getUsedTheme("firefox-devedition@mozilla.org");
ok(DevEdition.isStyleSheetEnabled, "The devedition stylesheet has been added when the devedition lightweight theme is applied");
yield onAttributeAdded;
ok(document.documentElement.hasAttribute("brighttitlebarforeground"),
"The brighttitlebarforeground attribute is set on the window with dark devtools theme.");
});
add_task(function* testDevtoolsTheme() {
info("Checking stylesheet and :root attributes based on devtools theme.");
Services.prefs.setCharPref(PREF_DEVTOOLS_THEME, "light");
is(document.documentElement.getAttribute("devtoolstheme"), "light",
"The documentElement has an attribute based on devtools theme.");
ok(DevEdition.isStyleSheetEnabled, "The devedition stylesheet is still there with the light devtools theme.");
ok(!document.documentElement.hasAttribute("brighttitlebarforeground"),
"The brighttitlebarforeground attribute is not set on the window with light devtools theme.");
Services.prefs.setCharPref(PREF_DEVTOOLS_THEME, "dark");
is(document.documentElement.getAttribute("devtoolstheme"), "dark",
"The documentElement has an attribute based on devtools theme.");
ok(DevEdition.isStyleSheetEnabled, "The devedition stylesheet is still there with the dark devtools theme.");
is(document.documentElement.getAttribute("brighttitlebarforeground"), "true",
"The brighttitlebarforeground attribute is set on the window with dark devtools theme.");
Services.prefs.setCharPref(PREF_DEVTOOLS_THEME, "foobar");
is(document.documentElement.getAttribute("devtoolstheme"), "light",
"The documentElement has 'light' as a default for the devtoolstheme attribute");
ok(DevEdition.isStyleSheetEnabled, "The devedition stylesheet is still there with the foobar devtools theme.");
ok(!document.documentElement.hasAttribute("brighttitlebarforeground"),
"The brighttitlebarforeground attribute is not set on the window with light devtools theme.");
});
function dummyLightweightTheme(id) {
return {
id,
name: id,
headerURL: "resource:///chrome/browser/content/browser/defaultthemes/devedition.header.png",
iconURL: "resource:///chrome/browser/content/browser/defaultthemes/devedition.icon.png",
textcolor: "red",
accentcolor: "blue"
};
}
add_task(function* testLightweightThemePreview() {
info("Setting devedition to current and the previewing others");
LightweightThemeManager.currentTheme = LightweightThemeManager.getUsedTheme("firefox-devedition@mozilla.org");
ok(DevEdition.isStyleSheetEnabled, "The devedition stylesheet is enabled.");
LightweightThemeManager.previewTheme(dummyLightweightTheme("preview0"));
ok(!DevEdition.isStyleSheetEnabled, "The devedition stylesheet is not enabled after a lightweight theme preview.");
LightweightThemeManager.resetPreview();
LightweightThemeManager.previewTheme(dummyLightweightTheme("preview1"));
ok(!DevEdition.isStyleSheetEnabled, "The devedition stylesheet is not enabled after a second lightweight theme preview.");
LightweightThemeManager.resetPreview();
ok(DevEdition.isStyleSheetEnabled, "The devedition stylesheet is enabled again after resetting the preview.");
LightweightThemeManager.currentTheme = null;
ok(!DevEdition.isStyleSheetEnabled, "The devedition stylesheet is gone after removing the current theme.");
info("Previewing the devedition theme");
LightweightThemeManager.previewTheme(LightweightThemeManager.getUsedTheme("firefox-devedition@mozilla.org"));
ok(DevEdition.isStyleSheetEnabled, "The devedition stylesheet is enabled.");
LightweightThemeManager.previewTheme(dummyLightweightTheme("preview2"));
LightweightThemeManager.resetPreview();
ok(!DevEdition.isStyleSheetEnabled, "The devedition stylesheet is now disabled after resetting the preview.");
});
// Use a mutation observer to wait for the brighttitlebarforeground
// attribute to change. Using this instead of waiting for the load
// event on the DevEdition styleSheet.
function waitForBrightTitlebarAttribute() {
return new Promise((resolve, reject) => {
let mutationObserver = new MutationObserver(function(mutations) {
for (let mutation of mutations) {
if (mutation.attributeName == "brighttitlebarforeground") {
mutationObserver.disconnect();
resolve();
}
}
});
mutationObserver.observe(document.documentElement, { attributes: true });
});
}

View File

@ -4,7 +4,7 @@ const ROOT = getRootDirectory(gTestPath).replace("chrome://mochitests/content/",
let pageWithAlert = ROOT + "openPromptOffTimeout.html";
registerCleanupFunction(function() {
Services.perms.removeAll(makeURI(pageWithAlert));
Services.perms.removeAll();
});
/*

View File

@ -69,7 +69,7 @@ browser.jar:
content/browser/browser-ctrlTab.js (content/browser-ctrlTab.js)
content/browser/browser-customization.js (content/browser-customization.js)
content/browser/browser-data-submission-info-bar.js (content/browser-data-submission-info-bar.js)
content/browser/browser-devedition.js (content/browser-devedition.js)
content/browser/browser-compacttheme.js (content/browser-compacttheme.js)
content/browser/browser-feeds.js (content/browser-feeds.js)
content/browser/browser-fullScreenAndPointerLock.js (content/browser-fullScreenAndPointerLock.js)
content/browser/browser-fullZoom.js (content/browser-fullZoom.js)
@ -115,8 +115,9 @@ browser.jar:
content/browser/defaultthemes/5.header.png (content/defaultthemes/5.header.png)
content/browser/defaultthemes/5.icon.jpg (content/defaultthemes/5.icon.jpg)
content/browser/defaultthemes/5.preview.jpg (content/defaultthemes/5.preview.jpg)
content/browser/defaultthemes/devedition.header.png (content/defaultthemes/devedition.header.png)
content/browser/defaultthemes/devedition.icon.png (content/defaultthemes/devedition.icon.png)
content/browser/defaultthemes/compact.header.png (content/defaultthemes/compact.header.png)
content/browser/defaultthemes/compactdark.icon.svg (content/defaultthemes/compactdark.icon.svg)
content/browser/defaultthemes/compactlight.icon.svg (content/defaultthemes/compactlight.icon.svg)
content/browser/gcli_sec_bad.svg (content/gcli_sec_bad.svg)
content/browser/gcli_sec_good.svg (content/gcli_sec_good.svg)
content/browser/gcli_sec_moderate.svg (content/gcli_sec_moderate.svg)

View File

@ -172,7 +172,7 @@ AboutNewTabService.prototype = {
.replace("%VERSION%", this.remoteVersion)
.replace("%LOCALE%", Locale.getLocale())
.replace("%CHANNEL%", releaseName);
let mode = Services.prefs.getCharPref(PREF_REMOTE_MODE, "production");
let mode = Services.prefs.getCharPref(PREF_REMOTE_MODE);
if (!(mode in NewTabRemoteResources.MODE_CHANNEL_MAP)) {
mode = "production";
}
@ -229,7 +229,7 @@ AboutNewTabService.prototype = {
},
get remoteVersion() {
return Services.prefs.getCharPref(PREF_REMOTE_VERSION, "1");
return Services.prefs.getCharPref(PREF_REMOTE_VERSION);
},
get remoteReleaseName() {

View File

@ -651,15 +651,27 @@ BrowserGlue.prototype = {
// Ensure we keep track of places/pw-mananager undo by init'ing this early.
Cu.import("resource:///modules/AutoMigrate.jsm");
if (!AppConstants.RELEASE_OR_BETA) {
let themeName = gBrowserBundle.GetStringFromName("deveditionTheme.name");
if (AppConstants.INSTALL_COMPACT_THEMES) {
let vendorShortName = gBrandBundle.GetStringFromName("vendorShortName");
LightweightThemeManager.addBuiltInTheme({
id: "firefox-devedition@mozilla.org",
name: themeName,
headerURL: "resource:///chrome/browser/content/browser/defaultthemes/devedition.header.png",
iconURL: "resource:///chrome/browser/content/browser/defaultthemes/devedition.icon.png",
id: "firefox-compact-light@mozilla.org",
name: gBrowserBundle.GetStringFromName("compactLightTheme.name"),
description: gBrowserBundle.GetStringFromName("compactLightTheme.description"),
headerURL: "resource:///chrome/browser/content/browser/defaultthemes/compact.header.png",
iconURL: "resource:///chrome/browser/content/browser/defaultthemes/compactlight.icon.svg",
textcolor: "black",
accentcolor: "white",
author: vendorShortName,
});
LightweightThemeManager.addBuiltInTheme({
id: "firefox-compact-dark@mozilla.org",
name: gBrowserBundle.GetStringFromName("compactDarkTheme.name"),
description: gBrowserBundle.GetStringFromName("compactDarkTheme.description"),
headerURL: "resource:///chrome/browser/content/browser/defaultthemes/compact.header.png",
iconURL: "resource:///chrome/browser/content/browser/defaultthemes/compactdark.icon.svg",
textcolor: "white",
accentcolor: "black",
author: vendorShortName,
});
}
@ -1718,7 +1730,7 @@ BrowserGlue.prototype = {
},
_migrateUI: function BG__migrateUI() {
const UI_VERSION = 42;
const UI_VERSION = 43;
const BROWSER_DOCURL = "chrome://browser/content/browser.xul";
let currentUIVersion;
@ -2051,6 +2063,18 @@ BrowserGlue.prototype = {
OS.File.remove(backupFile.path, {ignoreAbsent: true}).catch(ex => Cu.reportError(ex));
}
if (currentUIVersion < 43) {
let currentTheme = null;
try {
currentTheme = Services.prefs.getCharPref("lightweightThemes.selectedThemeID");
} catch (e) {}
if (currentTheme == "firefox-devedition@mozilla.org") {
let newTheme = Services.prefs.getCharPref("devtools.theme") == "dark" ?
"firefox-compact-dark@mozilla.org" : "firefox-compact-light@mozilla.org";
Services.prefs.setCharPref("lightweightThemes.selectedThemeID", newTheme);
}
}
// Update the migration version.
Services.prefs.setIntPref("browser.migration.version", UI_VERSION);
},

View File

@ -218,6 +218,5 @@ res/table-remove-row-active.gif
res/table-remove-row-hover.gif
res/table-remove-row.gif
# Aurora branding
browser/chrome/browser/content/browser/defaultthemes/devedition.icon.png
browser/chrome/browser/content/branding/icon64.png
browser/chrome/devtools/content/framework/dev-edition-promo/dev-edition-logo.png

View File

@ -106,9 +106,13 @@ unsignedAddonsDisabled.message=One or more installed add-ons cannot be verified
unsignedAddonsDisabled.learnMore.label=Learn More
unsignedAddonsDisabled.learnMore.accesskey=L
# LOCALIZATION NOTE (deveditionTheme.name): This should be nearly the brand name for aurora.
# See browser/branding/aurora/locales/*/brand.properties
deveditionTheme.name=Developer Edition
# LOCALIZATION NOTE (compactLightTheme.name): This is displayed in about:addons -> Appearance
compactLightTheme.name=Compact Light
compactLightTheme.description=A compact theme with a light color scheme.
# LOCALIZATION NOTE (compactDarkTheme.name): This is displayed in about:addons -> Appearance
compactDarkTheme.name=Compact Dark
compactDarkTheme.description=A compact theme with a dark color scheme.
# LOCALIZATION NOTE (lwthemeInstallRequest.message): %S will be replaced with
# the host name of the site.

View File

@ -471,7 +471,7 @@ this.TabCrashHandler = {
};
if (emailMe) {
data.email = this.prefs.getCharPref("email", "");
data.email = this.prefs.getCharPref("email");
}
// Make sure to only count once even if there are multiple windows

View File

@ -89,7 +89,7 @@ add_task(function* setup() {
Services.telemetry.canRecordExtended = oldCanRecord;
Services.search.currentEngine = originalEngine;
Services.search.removeEngine(engine);
Services.prefs.clearUserPref(SUGGEST_URLBAR_PREF, true);
Services.prefs.clearUserPref(SUGGEST_URLBAR_PREF);
Services.prefs.clearUserPref(ONEOFF_URLBAR_PREF);
yield PlacesTestUtils.clearHistory();
Services.telemetry.setEventRecordingEnabled("navigation", false);

View File

@ -2,13 +2,13 @@
% 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/devedition.inc.css
%include ../shared/compacttheme.inc.css
:root {
--forwardbutton-width: 29px;
}
:root[devtoolstheme="light"] {
:root:-moz-lwtheme-darktext {
--urlbar-dropmarker-url: url("chrome://browser/skin/devedition/urlbar-history-dropmarker.svg");
--urlbar-dropmarker-region: rect(0px, 11px, 14px, 0px);
--urlbar-dropmarker-hover-region: rect(0, 22px, 14px, 11px);
@ -19,8 +19,8 @@
--urlbar-dropmarker-active-2x-region: rect(0px, 33px, 14px, 22px);
}
:root[devtoolstheme="dark"] .findbar-closebutton:not(:hover),
:root[devtoolstheme="dark"] #sidebar-header > .close-icon:not(:hover),
.findbar-closebutton:-moz-lwtheme-brighttext:not(:hover),
#sidebar-header > .close-icon:-moz-lwtheme-brighttext:not(:hover),
.tab-close-button[selected]:not(:hover) {
background-image: -moz-image-rect(url("chrome://global/skin/icons/close.svg"), 0, 80, 16, 64);
}

View File

@ -11,7 +11,7 @@ browser.jar:
skin/classic/browser/aboutSyncTabs.css
* skin/classic/browser/syncedtabs/sidebar.css (syncedtabs/sidebar.css)
* skin/classic/browser/browser.css
* skin/classic/browser/devedition.css
* skin/classic/browser/compacttheme.css
* skin/classic/browser/browser-lightweightTheme.css
skin/classic/browser/click-to-play-warning-stripes.png
skin/classic/browser/Info.png
@ -79,8 +79,6 @@ browser.jar:
skin/classic/browser/preferences/applications.css (preferences/applications.css)
skin/classic/browser/social/services-16.png (social/services-16.png)
skin/classic/browser/social/services-64.png (social/services-64.png)
skin/classic/browser/social/share-button.png (social/share-button.png)
skin/classic/browser/social/share-button-active.png (social/share-button-active.png)
skin/classic/browser/tabbrowser/alltabs.png (tabbrowser/alltabs.png)
skin/classic/browser/tabbrowser/alltabs-inverted.png (tabbrowser/alltabs-inverted.png)
skin/classic/browser/tabbrowser/newtab.svg (tabbrowser/newtab.svg)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -2,7 +2,7 @@
% 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/devedition.inc.css
%include ../shared/compacttheme.inc.css
:root {
--forwardbutton-width: 32px;
@ -106,14 +106,14 @@
margin-bottom: 0;
}
:root[devtoolstheme="dark"] .findbar-closebutton:not(:hover),
.findbar-closebutton:-moz-lwtheme-brighttext:not(:hover),
/* Tab styling - make sure to use an inverted icon for the selected tab
(brighttext only covers the unselected tabs) */
.tab-close-button[selected=true]:not(:hover) {
-moz-image-region: rect(0, 64px, 16px, 48px);
}
@media (min-resolution: 2dppx) {
:root[devtoolstheme="dark"] .findbar-closebutton:not(:hover),
.findbar-closebutton:-moz-lwtheme-brighttext :not(:hover),
.tab-close-button[selected=true]:not(:hover) {
-moz-image-region: rect(0, 128px, 32px, 96px);
}

View File

@ -10,7 +10,7 @@ browser.jar:
skin/classic/browser/aboutSyncTabs.css
* skin/classic/browser/syncedtabs/sidebar.css (syncedtabs/sidebar.css)
* skin/classic/browser/browser.css
* skin/classic/browser/devedition.css
* skin/classic/browser/compacttheme.css
* skin/classic/browser/browser-lightweightTheme.css
skin/classic/browser/click-to-play-warning-stripes.png
skin/classic/browser/Info.png

View File

@ -2,9 +2,9 @@
% 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/.
/* devedition.css is loaded in browser.xul after browser.css when it is
/* compacttheme.css is loaded in browser.xul after browser.css when it is
preffed on. The bulk of the styling is here in the shared file, but
there are overrides for each platform in their devedition.css files. */
there are overrides for each platform in their compacttheme.css files. */
:root {
--tab-toolbar-navbar-overlap: 0px;
@ -14,7 +14,7 @@
--backbutton-urlbar-overlap: 0px;
}
:root[devtoolstheme="dark"] {
:root:-moz-lwtheme-brighttext {
/* Chrome */
--chrome-background-color: #272b35;
--chrome-color: #F5F7FA;
@ -50,8 +50,8 @@
}
/* Override the lwtheme-specific styling for toolbar buttons */
:root[devtoolstheme="dark"],
:root[devtoolstheme="dark"] toolbar:-moz-lwtheme {
:root:-moz-lwtheme-brighttext,
toolbar:-moz-lwtheme-brighttext {
--toolbarbutton-hover-background: rgba(25,33, 38,.6) linear-gradient(rgba(25,33,38,.6), rgba(25,33,38,.6)) padding-box;
--toolbarbutton-hover-boxshadow: none;
--toolbarbutton-hover-bordercolor: rgba(25,33,38,.6);
@ -62,7 +62,7 @@
}
:root[devtoolstheme="light"] {
:root:-moz-lwtheme-darktext {
--url-and-searchbar-background-color: #fff;
--chrome-background-color: #E3E4E6;
@ -85,8 +85,8 @@
}
/* Override the lwtheme-specific styling for toolbar buttons */
:root[devtoolstheme="light"],
:root[devtoolstheme="light"] toolbar:-moz-lwtheme {
:root:-moz-lwtheme-darktext,
toolbar:-moz-lwtheme-darktext {
--toolbarbutton-hover-background: #eaeaea;
--toolbarbutton-hover-boxshadow: none;
--toolbarbutton-hover-bordercolor: rgba(0,0,0,0.1);
@ -197,8 +197,7 @@ toolbar[brighttext] #downloads-indicator-counter {
}
%filter substitution
%define selectorPrefix :root[devtoolstheme="dark"]
%define selectorSuffix :-moz-lwtheme
%define selectorSuffix :-moz-lwtheme-brighttext
%define iconVariant -white
%include identity-block/icons.inc.css
@ -213,11 +212,11 @@ window:not([chromehidden~="toolbar"]) #urlbar-wrapper {
margin-inline-start: 0;
}
:root[devtoolstheme="dark"] #urlbar-zoom-button:hover {
#urlbar-zoom-button:-moz-lwtheme-brighttext:hover {
background-color: rgba(255,255,255,.2);
}
:root[devtoolstheme="dark"] #urlbar-zoom-button:hover:active {
#urlbar-zoom-button:-moz-lwtheme-brighttext:hover:active {
background-color: rgba(255,255,255,.3);
}

View File

@ -4,59 +4,59 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
%endif
@selectorPrefix@#identity-icon@selectorSuffix@ {
#identity-icon@selectorSuffix@ {
list-style-image: url(chrome://browser/skin/identity-icon.svg#normal@iconVariant@);
}
@selectorPrefix@#identity-box:hover > #identity-icon:not(.no-hover)@selectorSuffix@,
@selectorPrefix@#identity-box[open=true] > #identity-icon@selectorSuffix@ {
#identity-box:hover > #identity-icon:not(.no-hover)@selectorSuffix@,
#identity-box[open=true] > #identity-icon@selectorSuffix@ {
list-style-image: url(chrome://browser/skin/identity-icon.svg#hover@iconVariant@);
}
@selectorPrefix@#identity-box.grantedPermissions > #identity-icon@selectorSuffix@ {
#identity-box.grantedPermissions > #identity-icon@selectorSuffix@ {
list-style-image: url(chrome://browser/skin/identity-icon.svg#notice@iconVariant@);
}
@selectorPrefix@#identity-box.grantedPermissions:hover > #identity-icon:not(.no-hover)@selectorSuffix@,
@selectorPrefix@#identity-box.grantedPermissions[open=true] > #identity-icon@selectorSuffix@ {
#identity-box.grantedPermissions:hover > #identity-icon:not(.no-hover)@selectorSuffix@,
#identity-box.grantedPermissions[open=true] > #identity-icon@selectorSuffix@ {
list-style-image: url(chrome://browser/skin/identity-icon.svg#notice-hover@iconVariant@);
}
@selectorPrefix@#urlbar[pageproxystate="valid"] > #identity-box.chromeUI > #identity-icon@selectorSuffix@ {
#urlbar[pageproxystate="valid"] > #identity-box.chromeUI > #identity-icon@selectorSuffix@ {
list-style-image: url(chrome://branding/content/identity-icons-brand.svg);
}
@selectorPrefix@#tracking-protection-icon@selectorSuffix@ {
#tracking-protection-icon@selectorSuffix@ {
list-style-image: url(chrome://browser/skin/tracking-protection-16.svg#enabled@iconVariant@);
}
@selectorPrefix@#tracking-protection-icon[state="loaded-tracking-content"]@selectorSuffix@ {
#tracking-protection-icon[state="loaded-tracking-content"]@selectorSuffix@ {
list-style-image: url(chrome://browser/skin/tracking-protection-16.svg#disabled@iconVariant@);
}
@selectorPrefix@#urlbar[pageproxystate="valid"] > #identity-box.verifiedDomain > #connection-icon@selectorSuffix@,
@selectorPrefix@#urlbar[pageproxystate="valid"] > #identity-box.verifiedIdentity > #connection-icon@selectorSuffix@,
@selectorPrefix@#urlbar[pageproxystate="valid"] > #identity-box.mixedActiveBlocked > #connection-icon@selectorSuffix@ {
#urlbar[pageproxystate="valid"] > #identity-box.verifiedDomain > #connection-icon@selectorSuffix@,
#urlbar[pageproxystate="valid"] > #identity-box.verifiedIdentity > #connection-icon@selectorSuffix@,
#urlbar[pageproxystate="valid"] > #identity-box.mixedActiveBlocked > #connection-icon@selectorSuffix@ {
list-style-image: url(chrome://browser/skin/connection-secure.svg);
visibility: visible;
}
@selectorPrefix@#urlbar[pageproxystate="valid"] > #identity-box.certUserOverridden > #connection-icon@selectorSuffix@ {
#urlbar[pageproxystate="valid"] > #identity-box.certUserOverridden > #connection-icon@selectorSuffix@ {
list-style-image: url(chrome://browser/skin/connection-mixed-passive-loaded.svg#icon@iconVariant@);
visibility: visible;
}
@selectorPrefix@#urlbar[pageproxystate="valid"] > #identity-box.insecureLoginForms > #connection-icon@selectorSuffix@,
@selectorPrefix@#urlbar[pageproxystate="valid"] > #identity-box.mixedActiveContent > #connection-icon@selectorSuffix@ {
#urlbar[pageproxystate="valid"] > #identity-box.insecureLoginForms > #connection-icon@selectorSuffix@,
#urlbar[pageproxystate="valid"] > #identity-box.mixedActiveContent > #connection-icon@selectorSuffix@ {
list-style-image: url(chrome://browser/skin/connection-mixed-active-loaded.svg#icon@iconVariant@);
visibility: visible;
}
@selectorPrefix@#urlbar[pageproxystate="valid"] > #identity-box.weakCipher > #connection-icon@selectorSuffix@,
@selectorPrefix@#urlbar[pageproxystate="valid"] > #identity-box.mixedDisplayContent > #connection-icon@selectorSuffix@,
@selectorPrefix@#urlbar[pageproxystate="valid"] > #identity-box.mixedDisplayContentLoadedActiveBlocked > #connection-icon@selectorSuffix@ {
#urlbar[pageproxystate="valid"] > #identity-box.weakCipher > #connection-icon@selectorSuffix@,
#urlbar[pageproxystate="valid"] > #identity-box.mixedDisplayContent > #connection-icon@selectorSuffix@,
#urlbar[pageproxystate="valid"] > #identity-box.mixedDisplayContentLoadedActiveBlocked > #connection-icon@selectorSuffix@ {
list-style-image: url(chrome://browser/skin/connection-mixed-passive-loaded.svg#icon@iconVariant@);
visibility: visible;
}

View File

@ -6,12 +6,10 @@
%filter substitution
%define selectorPrefix
%define selectorSuffix
%define iconVariant
%include icons.inc.css
%define selectorPrefix
%define selectorSuffix :-moz-lwtheme
%define iconVariant -black
%include icons.inc.css

View File

@ -187,7 +187,7 @@ toolbar:-moz-lwtheme {
@media (-moz-windows-compositor: 0),
(-moz-windows-default-theme: 0) {
/* Please keep the menu text colors in this media block in sync with
* devedition.css, minus the :not(:-moz-lwtheme) condition - see Bug 1165718.
* compacttheme.css, minus the :not(:-moz-lwtheme) condition - see Bug 1165718.
*/
#main-window[tabsintitlebar]:not([inFullscreen]) #toolbar-menubar:not(:-moz-lwtheme),
#main-window[tabsintitlebar]:not([inFullscreen]) #TabsToolbar:not(:-moz-lwtheme) {

View File

@ -2,14 +2,10 @@
% 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/devedition.inc.css
%include ../shared/compacttheme.inc.css
:root {
--forwardbutton-width: 29px;
}
:root[devtoolstheme="dark"],
:root[devtoolstheme="light"] {
/* Matches the #browser-border-start, #browser-border-end color */
--chrome-nav-bar-separator-color: rgba(10, 31, 51, 0.35);
}
@ -100,8 +96,8 @@
text-shadow: none !important;
}
:root[devtoolstheme="dark"] .findbar-closebutton,
:root[devtoolstheme="dark"] #sidebar-header > .close-icon,
.findbar-closebutton:-moz-lwtheme-brighttext,
#sidebar-header > .close-icon:-moz-lwtheme-brighttext,
/* Tab styling - make sure to use an inverted icon for the selected tab
(brighttext only covers the unselected tabs) */
.tab-close-button[selected=true] {
@ -109,8 +105,8 @@
}
@media (min-resolution: 1.1dppx) {
:root[devtoolstheme="dark"] .findbar-closebutton,
:root[devtoolstheme="dark"] #sidebar-header > .close-icon,
.findbar-closebutton:-moz-lwtheme-brighttext,
#sidebar-header > .close-icon:-moz-lwtheme-brighttext,
.tab-close-button[selected=true] {
list-style-image: url("chrome://global/skin/icons/close-inverted@2x.png");
}
@ -279,34 +275,33 @@
}
/* Force white caption buttons for the dark theme on Windows 10 */
:root[devtoolstheme="dark"] #titlebar-min {
#titlebar-min:-moz-lwtheme-brighttext {
list-style-image: url(chrome://browser/skin/caption-buttons.svg#minimize-white);
}
:root[devtoolstheme="dark"] #titlebar-max {
#titlebar-max:-moz-lwtheme-brighttext {
list-style-image: url(chrome://browser/skin/caption-buttons.svg#maximize-white);
}
#main-window[devtoolstheme="dark"][sizemode="maximized"] #titlebar-max {
#main-window[sizemode="maximized"] #titlebar-max:-moz-lwtheme-brighttext {
list-style-image: url(chrome://browser/skin/caption-buttons.svg#restore-white);
}
:root[devtoolstheme="dark"] #titlebar-close {
#titlebar-close:-moz-lwtheme-brighttext {
list-style-image: url(chrome://browser/skin/caption-buttons.svg#close-white);
}
/* ... and normal ones for the light theme on Windows 10 */
:root[devtoolstheme="light"] #titlebar-min {
#titlebar-min:-moz-lwtheme-darktext {
list-style-image: url(chrome://browser/skin/caption-buttons.svg#minimize);
}
:root[devtoolstheme="light"] #titlebar-max {
#titlebar-max:-moz-lwtheme-darktext {
list-style-image: url(chrome://browser/skin/caption-buttons.svg#maximize);
}
#main-window[devtoolstheme="light"][sizemode="maximized"] #titlebar-max {
#main-window[sizemode="maximized"] #titlebar-max:-moz-lwtheme-darktext {
list-style-image: url(chrome://browser/skin/caption-buttons.svg#restore);
}
:root[devtoolstheme="light"] #titlebar-close {
#titlebar-close:-moz-lwtheme-darktext {
list-style-image: url(chrome://browser/skin/caption-buttons.svg#close);
}
:root[devtoolstheme="light"] #titlebar-close:hover {
#titlebar-close:-moz-lwtheme-darktext:hover {
list-style-image: url(chrome://browser/skin/caption-buttons.svg#close-white);
}
}

View File

@ -10,7 +10,7 @@ browser.jar:
skin/classic/browser/aboutSyncTabs.css
* skin/classic/browser/syncedtabs/sidebar.css (syncedtabs/sidebar.css)
* skin/classic/browser/browser.css
* skin/classic/browser/devedition.css
* skin/classic/browser/compacttheme.css
* skin/classic/browser/browser-lightweightTheme.css
skin/classic/browser/caption-buttons.svg
skin/classic/browser/click-to-play-warning-stripes.png

View File

@ -29,6 +29,7 @@ loader.lazyRequireGetter(this, "findCssSelector", "devtools/shared/inspector/css
loader.lazyImporter(this, "CustomizableUI", "resource:///modules/CustomizableUI.jsm");
loader.lazyImporter(this, "AppConstants", "resource://gre/modules/AppConstants.jsm");
loader.lazyImporter(this, "LightweightThemeManager", "resource://gre/modules/LightweightThemeManager.jsm");
const {LocalizationHelper} = require("devtools/shared/l10n");
const L10N = new LocalizationHelper("devtools/client/locales/toolbox.properties");
@ -38,6 +39,9 @@ const TABS_OPEN_AVG_HISTOGRAM = "DEVTOOLS_TABS_OPEN_AVERAGE_LINEAR";
const TABS_PINNED_PEAK_HISTOGRAM = "DEVTOOLS_TABS_PINNED_PEAK_LINEAR";
const TABS_PINNED_AVG_HISTOGRAM = "DEVTOOLS_TABS_PINNED_AVERAGE_LINEAR";
const COMPACT_LIGHT_ID = "firefox-compact-light@mozilla.org";
const COMPACT_DARK_ID = "firefox-compact-dark@mozilla.org";
/**
* gDevToolsBrowser exposes functions to connect the gDevTools instance with a
* Firefox instance.
@ -129,6 +133,38 @@ var gDevToolsBrowser = exports.gDevToolsBrowser = {
toggleMenuItem("menu_devtools_connect", devtoolsRemoteEnabled);
},
/**
* This function makes sure that the "devtoolstheme" attribute is set on the browser
* window to make it possible to change colors on elements in the browser (like gcli,
* or the splitter between the toolbox and web content).
*/
updateDevtoolsThemeAttribute: function(win) {
// Set an attribute on root element of each window to make it possible
// to change colors based on the selected devtools theme.
let devtoolsTheme = Services.prefs.getCharPref("devtools.theme");
if (devtoolsTheme != "dark") {
devtoolsTheme = "light";
}
win.document.documentElement.setAttribute("devtoolstheme", devtoolsTheme);
// If the toolbox color changes and we have the opposite compact theme applied,
// change it to match. For example:
// 1) toolbox changes to dark, and the light compact theme was applied.
// Switch to the dark compact theme.
// 2) toolbox changes to light or firebug, and the dark compact theme was applied.
// Switch to the light compact theme.
// 3) No compact theme was applied. Do nothing.
let currentTheme = LightweightThemeManager.currentTheme;
let currentThemeID = currentTheme && currentTheme.id;
if (currentThemeID == COMPACT_LIGHT_ID && devtoolsTheme == "dark") {
LightweightThemeManager.currentTheme = LightweightThemeManager.getUsedTheme(COMPACT_DARK_ID);
}
if (currentThemeID == COMPACT_DARK_ID && devtoolsTheme == "light") {
LightweightThemeManager.currentTheme = LightweightThemeManager.getUsedTheme(COMPACT_LIGHT_ID);
}
},
observe: function (subject, topic, prefName) {
switch (topic) {
case "browser-delayed-startup-finished":
@ -140,6 +176,11 @@ var gDevToolsBrowser = exports.gDevToolsBrowser = {
this.updateCommandAvailability(win);
}
}
if (prefName === "devtools.theme") {
for (let win of this._trackedBrowserWindows) {
this.updateDevtoolsThemeAttribute(win);
}
}
break;
case "quit-application":
gDevToolsBrowser.destroy({ shuttingDown: true });
@ -151,6 +192,20 @@ var gDevToolsBrowser = exports.gDevToolsBrowser = {
gDevToolsBrowser.destroy({ shuttingDown: false });
}
break;
case "lightweight-theme-changed":
let currentTheme = LightweightThemeManager.currentTheme;
let currentThemeID = currentTheme && currentTheme.id;
let devtoolsTheme = Services.prefs.getCharPref("devtools.theme");
// If the current lightweight theme changes to one of the compact themes, then
// keep the devtools color in sync.
if (currentThemeID == COMPACT_LIGHT_ID && devtoolsTheme == "dark") {
Services.prefs.setCharPref("devtools.theme", "light");
}
if (currentThemeID == COMPACT_DARK_ID && devtoolsTheme == "light") {
Services.prefs.setCharPref("devtools.theme", "dark");
}
break;
}
},
@ -461,6 +516,7 @@ var gDevToolsBrowser = exports.gDevToolsBrowser = {
});
this.updateCommandAvailability(win);
this.updateDevtoolsThemeAttribute(win);
this.ensurePrefObserver();
win.addEventListener("unload", this);
@ -749,6 +805,7 @@ var gDevToolsBrowser = exports.gDevToolsBrowser = {
*/
destroy: function ({ shuttingDown }) {
Services.prefs.removeObserver("devtools.", gDevToolsBrowser);
Services.obs.removeObserver(gDevToolsBrowser, "lightweight-theme-changed", false);
Services.obs.removeObserver(gDevToolsBrowser, "browser-delayed-startup-finished");
Services.obs.removeObserver(gDevToolsBrowser, "quit-application");
Services.obs.removeObserver(gDevToolsBrowser, "sdk:loader:destroy");
@ -788,6 +845,7 @@ Services.obs.addObserver(gDevToolsBrowser, "quit-application", false);
Services.obs.addObserver(gDevToolsBrowser, "browser-delayed-startup-finished", false);
// Watch for module loader unload. Fires when the tools are reloaded.
Services.obs.addObserver(gDevToolsBrowser, "sdk:loader:destroy", false);
Services.obs.addObserver(gDevToolsBrowser, "lightweight-theme-changed", false);
// Fake end of browser window load event for all already opened windows
// that is already fully loaded.

View File

@ -75,6 +75,7 @@ skip-if = e10s # Bug 1069044 - destroyInspector may hang during shutdown
[browser_toolbox_target.js]
[browser_toolbox_tabsswitch_shortcuts.js]
[browser_toolbox_textbox_context_menu.js]
[browser_toolbox_theme.js]
[browser_toolbox_theme_registration.js]
[browser_toolbox_toggle.js]
[browser_toolbox_tool_ready.js]

View File

@ -0,0 +1,76 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
const COMPACT_LIGHT_ID = "firefox-compact-light@mozilla.org";
const COMPACT_DARK_ID = "firefox-compact-dark@mozilla.org";
const PREF_DEVTOOLS_THEME = "devtools.theme";
const {LightweightThemeManager} = Components.utils.import("resource://gre/modules/LightweightThemeManager.jsm", {});
registerCleanupFunction(() => {
// Set preferences back to their original values
Services.prefs.clearUserPref(PREF_DEVTOOLS_THEME);
LightweightThemeManager.currentTheme = null;
});
add_task(function* testDevtoolsTheme() {
info("Checking stylesheet and :root attributes based on devtools theme.");
Services.prefs.setCharPref(PREF_DEVTOOLS_THEME, "light");
is(document.documentElement.getAttribute("devtoolstheme"), "light",
"The documentElement has an attribute based on devtools theme.");
Services.prefs.setCharPref(PREF_DEVTOOLS_THEME, "dark");
is(document.documentElement.getAttribute("devtoolstheme"), "dark",
"The documentElement has an attribute based on devtools theme.");
Services.prefs.setCharPref(PREF_DEVTOOLS_THEME, "firebug");
is(document.documentElement.getAttribute("devtoolstheme"), "light",
"The documentElement has 'light' as a default for the devtoolstheme attribute");
});
add_task(function* testDevtoolsAndCompactThemeSyncing() {
if (!AppConstants.INSTALL_COMPACT_THEMES) {
ok(true, "No need to run this test since themes aren't installed");
return;
}
info("Devtools theme light -> dark when dark compact applied");
Services.prefs.setCharPref(PREF_DEVTOOLS_THEME, "light");
LightweightThemeManager.currentTheme = LightweightThemeManager.getUsedTheme(COMPACT_DARK_ID);
is(Services.prefs.getCharPref(PREF_DEVTOOLS_THEME), "dark");
info("Devtools theme dark -> light when light compact applied");
Services.prefs.setCharPref(PREF_DEVTOOLS_THEME, "dark");
LightweightThemeManager.currentTheme = LightweightThemeManager.getUsedTheme(COMPACT_LIGHT_ID);
is(Services.prefs.getCharPref(PREF_DEVTOOLS_THEME), "light");
info("Devtools theme shouldn't change if it wasn't light or dark during lwt change");
Services.prefs.setCharPref(PREF_DEVTOOLS_THEME, "firebug");
LightweightThemeManager.currentTheme = LightweightThemeManager.getUsedTheme(COMPACT_DARK_ID);
is(Services.prefs.getCharPref(PREF_DEVTOOLS_THEME), "firebug");
info("Compact theme dark -> light when devtools changes dark -> light");
LightweightThemeManager.currentTheme = LightweightThemeManager.getUsedTheme(COMPACT_DARK_ID);
Services.prefs.setCharPref(PREF_DEVTOOLS_THEME, "dark");
Services.prefs.setCharPref(PREF_DEVTOOLS_THEME, "light");
is(LightweightThemeManager.currentTheme, LightweightThemeManager.getUsedTheme(COMPACT_LIGHT_ID));
info("Compact theme dark -> light when devtools changes dark -> firebug");
LightweightThemeManager.currentTheme = LightweightThemeManager.getUsedTheme(COMPACT_DARK_ID);
Services.prefs.setCharPref(PREF_DEVTOOLS_THEME, "dark");
Services.prefs.setCharPref(PREF_DEVTOOLS_THEME, "firebug");
is(LightweightThemeManager.currentTheme, LightweightThemeManager.getUsedTheme(COMPACT_LIGHT_ID));
info("Compact theme light -> dark when devtools changes light -> dark");
LightweightThemeManager.currentTheme = LightweightThemeManager.getUsedTheme(COMPACT_LIGHT_ID);
Services.prefs.setCharPref(PREF_DEVTOOLS_THEME, "light");
Services.prefs.setCharPref(PREF_DEVTOOLS_THEME, "dark");
is(LightweightThemeManager.currentTheme, LightweightThemeManager.getUsedTheme(COMPACT_DARK_ID));
info("Compact theme shouldn't change if it wasn't set during devtools change");
LightweightThemeManager.currentTheme = null;
Services.prefs.setCharPref(PREF_DEVTOOLS_THEME, "light");
Services.prefs.setCharPref(PREF_DEVTOOLS_THEME, "dark");
is(LightweightThemeManager.currentTheme, null);
});

View File

@ -21,8 +21,8 @@ Services.prefs.setBoolPref(NET_INFO_PREF, true);
Services.prefs.setBoolPref(NET_XHR_PREF, true);
registerCleanupFunction(() => {
Services.prefs.clearUserPref(NET_INFO_PREF, true);
Services.prefs.clearUserPref(NET_XHR_PREF, true);
Services.prefs.clearUserPref(NET_INFO_PREF);
Services.prefs.clearUserPref(NET_XHR_PREF);
});
// Use the old webconsole since the new one doesn't yet support

View File

@ -69,21 +69,10 @@
#include "nsIDOMEventTarget.h"
// CSS related includes
#include "nsCSSRules.h"
#include "nsIDOMCSSRule.h"
#include "nsMemory.h"
// includes needed for the prototype chain interfaces
#include "nsIDOMCSSKeyframeRule.h"
#include "nsIDOMCSSKeyframesRule.h"
#include "nsIDOMCSSImportRule.h"
#include "nsIDOMCSSMediaRule.h"
#include "nsIDOMCSSFontFaceRule.h"
#include "nsIDOMCSSMozDocumentRule.h"
#include "nsIDOMCSSSupportsRule.h"
#include "nsIDOMCSSCounterStyleRule.h"
#include "nsIDOMCSSPageRule.h"
#include "nsIDOMCSSStyleRule.h"
#include "nsIDOMXULCommandDispatcher.h"
#include "nsIControllers.h"
#ifdef MOZ_XUL
@ -189,16 +178,6 @@ static nsDOMClassInfoData sClassInfoData[] = {
// Misc Core related classes
// CSS classes
NS_DEFINE_CLASSINFO_DATA(CSSStyleRule, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(CSSImportRule, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(CSSMediaRule, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(CSSNameSpaceRule, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
// XUL classes
#ifdef MOZ_XUL
NS_DEFINE_CHROME_XBL_CLASSINFO_DATA(XULCommandDispatcher, nsDOMGenericSH,
@ -221,15 +200,6 @@ static nsDOMClassInfoData sClassInfoData[] = {
DEFAULT_SCRIPTABLE_FLAGS)
#endif
NS_DEFINE_CLASSINFO_DATA(CSSMozDocumentRule, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(CSSSupportsRule, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(CSSFontFaceRule, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CHROME_ONLY_CLASSINFO_DATA(ContentFrameMessageManager,
nsMessageManagerSH<nsEventTargetSH>,
DOM_DEFAULT_SCRIPTABLE_FLAGS |
@ -246,20 +216,6 @@ static nsDOMClassInfoData sClassInfoData[] = {
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(CSSKeyframeRule, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(CSSKeyframesRule, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(CSSCounterStyleRule, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(CSSPageRule, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(CSSFontFeatureValuesRule, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CHROME_XBL_CLASSINFO_DATA(XULControlElement, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CHROME_XBL_CLASSINFO_DATA(XULLabeledControlElement, nsDOMGenericSH,
@ -512,22 +468,6 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_MAP_ENTRY(nsIDOMDOMConstructor)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(CSSStyleRule, nsIDOMCSSStyleRule)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMCSSStyleRule)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(CSSImportRule, nsIDOMCSSImportRule)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMCSSImportRule)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(CSSMediaRule, nsIDOMCSSMediaRule)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMCSSMediaRule)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN_NO_CLASS_IF(CSSNameSpaceRule, nsIDOMCSSRule)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMCSSRule)
DOM_CLASSINFO_MAP_END
#ifdef MOZ_XUL
DOM_CLASSINFO_MAP_BEGIN(XULCommandDispatcher, nsIDOMXULCommandDispatcher)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMXULCommandDispatcher)
@ -561,18 +501,6 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_MAP_END
#endif
DOM_CLASSINFO_MAP_BEGIN(CSSMozDocumentRule, nsIDOMCSSMozDocumentRule)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMCSSMozDocumentRule)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(CSSSupportsRule, nsIDOMCSSSupportsRule)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMCSSSupportsRule)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(CSSFontFaceRule, nsIDOMCSSFontFaceRule)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMCSSFontFaceRule)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN_NO_CLASS_IF(ContentFrameMessageManager, nsISupports)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
DOM_CLASSINFO_MAP_ENTRY(nsIMessageListenerManager)
@ -603,26 +531,6 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_MAP_ENTRY(nsIMessageSender)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(CSSKeyframeRule, nsIDOMCSSKeyframeRule)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMCSSKeyframeRule)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(CSSKeyframesRule, nsIDOMCSSKeyframesRule)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMCSSKeyframesRule)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(CSSCounterStyleRule, nsIDOMCSSCounterStyleRule)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMCSSCounterStyleRule)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(CSSPageRule, nsIDOMCSSPageRule)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMCSSPageRule)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(CSSFontFeatureValuesRule, nsIDOMCSSFontFeatureValuesRule)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMCSSFontFeatureValuesRule)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN_NO_CLASS_IF(XULControlElement, nsIDOMXULControlElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMXULControlElement)
DOM_CLASSINFO_MAP_END

View File

@ -19,12 +19,6 @@ enum nsDOMClassInfoID
eDOMClassInfo_DOMPrototype_id,
eDOMClassInfo_DOMConstructor_id,
// CSS classes
eDOMClassInfo_CSSStyleRule_id,
eDOMClassInfo_CSSImportRule_id,
eDOMClassInfo_CSSMediaRule_id,
eDOMClassInfo_CSSNameSpaceRule_id,
// XUL classes
#ifdef MOZ_XUL
eDOMClassInfo_XULCommandDispatcher_id,
@ -40,27 +34,11 @@ enum nsDOMClassInfoID
eDOMClassInfo_XULTreeBuilder_id,
#endif
eDOMClassInfo_CSSMozDocumentRule_id,
eDOMClassInfo_CSSSupportsRule_id,
// @font-face in CSS
eDOMClassInfo_CSSFontFaceRule_id,
eDOMClassInfo_ContentFrameMessageManager_id,
eDOMClassInfo_ContentProcessMessageManager_id,
eDOMClassInfo_ChromeMessageBroadcaster_id,
eDOMClassInfo_ChromeMessageSender_id,
eDOMClassInfo_CSSKeyframeRule_id,
eDOMClassInfo_CSSKeyframesRule_id,
// @counter-style in CSS
eDOMClassInfo_CSSCounterStyleRule_id,
eDOMClassInfo_CSSPageRule_id,
eDOMClassInfo_CSSFontFeatureValuesRule_id,
eDOMClassInfo_XULControlElement_id,
eDOMClassInfo_XULLabeledControlElement_id,
eDOMClassInfo_XULButtonElement_id,

View File

@ -5180,7 +5180,7 @@ nsDocument::StyleRuleChanged(StyleSheet* aSheet,
DO_STYLESHEET_NOTIFICATION(StyleRuleChangeEvent,
"StyleRuleChanged",
mRule,
aStyleRule ? aStyleRule->GetDOMRule() : nullptr);
aStyleRule);
}
}
@ -5194,8 +5194,7 @@ nsDocument::StyleRuleAdded(StyleSheet* aSheet,
DO_STYLESHEET_NOTIFICATION(StyleRuleChangeEvent,
"StyleRuleAdded",
mRule,
aStyleRule ? aStyleRule->GetDOMRule()
: nullptr);
aStyleRule);
}
}
@ -5209,8 +5208,7 @@ nsDocument::StyleRuleRemoved(StyleSheet* aSheet,
DO_STYLESHEET_NOTIFICATION(StyleRuleChangeEvent,
"StyleRuleRemoved",
mRule,
aStyleRule ? aStyleRule->GetDOMRule()
: nullptr);
aStyleRule);
}
}

View File

@ -272,6 +272,9 @@ protected:
}
private:
// Friend declarations for things that need to be able to call
// SetIsNotDOMBinding(). The goal is to get rid of all of these, and
// SetIsNotDOMBinding() too.
friend class mozilla::dom::TabChildGlobal;
friend class mozilla::dom::ProcessGlobal;
friend class SandboxPrivate;

View File

@ -196,23 +196,96 @@ DOMInterfaces = {
'nativeType': 'nsDOMCSSDeclaration'
},
'CSSConditionRule': {
'concrete': False,
'nativeType': 'mozilla::css::ConditionRule',
'headerFile': 'mozilla/css/GroupRule.h',
},
'CSSCounterStyleRule': {
'nativeType': 'nsCSSCounterStyleRule',
'headerFile': 'nsCSSRules.h',
},
'CSSFontFaceRule': {
'nativeType': 'nsCSSFontFaceRule',
'headerFile': 'nsCSSRules.h',
},
'CSSFontFeatureValuesRule': {
'nativeType': 'nsCSSFontFeatureValuesRule',
'headerFile': 'nsCSSRules.h',
},
'CSSGroupingRule': {
'concrete': False,
'nativeType': 'mozilla::css::GroupRule',
},
'CSSImportRule': {
'nativeType': 'mozilla::css::ImportRule',
},
'CSSKeyframeRule': {
'nativeType': 'nsCSSKeyframeRule',
'headerFile': 'nsCSSRules.h',
},
'CSSKeyframesRule': {
'nativeType': 'nsCSSKeyframesRule',
'headerFile': 'nsCSSRules.h',
},
'CSSLexer': {
'wrapperCache': False
},
'CSSMediaRule': {
'nativeType': 'mozilla::css::MediaRule',
'headerFile': 'nsCSSRules.h',
},
'CSSMozDocumentRule': {
'nativeType': 'mozilla::css::DocumentRule',
'headerFile': 'nsCSSRules.h',
},
'CSSNamespaceRule': {
'nativeType': 'mozilla::css::NameSpaceRule',
},
'CSSPageRule': {
'nativeType': 'nsCSSPageRule',
'headerFile': 'nsCSSRules.h',
},
'CSSPrimitiveValue': {
'nativeType': 'nsROCSSPrimitiveValue',
},
'CSSRule': {
'concrete': False,
'nativeType': 'mozilla::css::Rule'
},
'CSSStyleDeclaration': {
'nativeType': 'nsICSSDeclaration'
},
'CSSStyleRule': {
'nativeType': 'mozilla::BindingStyleRule',
},
'CSSStyleSheet': {
'nativeType': 'mozilla::StyleSheet',
'binaryNames': { 'ownerRule': 'DOMOwnerRule' },
},
'CSSSupportsRule': {
'nativeType': 'mozilla::CSSSupportsRule',
'headerFile': 'nsCSSRules.h',
},
'CSSValue': {
'concrete': False
},
@ -1660,7 +1733,6 @@ def addExternalIface(iface, nativeType=None, headerFile=None,
addExternalIface('ApplicationCache', nativeType='nsIDOMOfflineResourceList')
addExternalIface('Counter')
addExternalIface('CSSRule')
addExternalIface('RTCDataChannel', nativeType='nsIDOMDataChannel')
addExternalIface('HitRegionOptions', nativeType='nsISupports')
addExternalIface('imgINotificationObserver', nativeType='imgINotificationObserver')

View File

@ -477,9 +477,13 @@ DataTransferItem::Data(nsIPrincipal* aPrincipal, ErrorResult& aRv)
// source of the drag is in a child frame of the caller. In that case,
// we only allow access to data of the same principal. During other events,
// only allow access to the data with the same principal.
//
// We don't want to fail with an exception in this siutation, rather we want
// to just pretend as though the stored data is "nullptr". This is consistent
// with Chrome's behavior and is less surprising for web applications which
// don't expect execptions to be raised when performing certain operations.
if (Principal() && checkItemPrincipal &&
!aPrincipal->Subsumes(Principal())) {
aRv.Throw(NS_ERROR_DOM_SECURITY_ERR);
return nullptr;
}
@ -494,13 +498,11 @@ DataTransferItem::Data(nsIPrincipal* aPrincipal, ErrorResult& aRv)
if (pt) {
nsIScriptContext* c = pt->GetContextForEventHandlers(&rv);
if (NS_WARN_IF(NS_FAILED(rv) || !c)) {
aRv.Throw(NS_ERROR_DOM_SECURITY_ERR);
return nullptr;
}
nsIGlobalObject* go = c->GetGlobalObject();
if (NS_WARN_IF(!go)) {
aRv.Throw(NS_ERROR_DOM_SECURITY_ERR);
return nullptr;
}
@ -509,7 +511,6 @@ DataTransferItem::Data(nsIPrincipal* aPrincipal, ErrorResult& aRv)
nsIPrincipal* dataPrincipal = sp->GetPrincipal();
if (NS_WARN_IF(!dataPrincipal || !aPrincipal->Equals(dataPrincipal))) {
aRv.Throw(NS_ERROR_DOM_SECURITY_ERR);
return nullptr;
}
}

View File

@ -4,10 +4,10 @@
* 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 "nsIDOMCSSRule.idl"
#include "nsISupports.idl"
[scriptable, uuid(9b5e48ce-d84c-4e31-aff5-34e9f4141313)]
interface nsIDOMCSSCounterStyleRule : nsIDOMCSSRule
interface nsIDOMCSSCounterStyleRule : nsISupports
{
attribute DOMString name;
attribute DOMString system;

View File

@ -3,10 +3,12 @@
* 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 "nsIDOMCSSRule.idl"
#include "nsISupports.idl"
interface nsIDOMCSSStyleDeclaration;
[scriptable, uuid(db971017-fe0c-4529-972c-8217f2fee217)]
interface nsIDOMCSSFontFaceRule : nsIDOMCSSRule
interface nsIDOMCSSFontFaceRule : nsISupports
{
readonly attribute nsIDOMCSSStyleDeclaration style;
};

View File

@ -3,10 +3,10 @@
* 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 "nsIDOMCSSRule.idl"
#include "nsISupports.idl"
[scriptable, uuid(a343d27f-1da6-4fc3-9355-d4ca434f958e)]
interface nsIDOMCSSFontFeatureValuesRule : nsIDOMCSSRule
interface nsIDOMCSSFontFeatureValuesRule : nsISupports
{
attribute DOMString fontFamily;
// raises(DOMException) on setting

View File

@ -3,13 +3,15 @@
* 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 "nsIDOMCSSRule.idl"
#include "nsISupports.idl"
interface nsIDOMCSSRuleList;
/**
* Interface for at-rules that have child rules in the CSS OM.
*/
[scriptable, uuid(a0e3324a-f911-4baf-9591-5322c76cbb0d)]
interface nsIDOMCSSGroupingRule : nsIDOMCSSRule
interface nsIDOMCSSGroupingRule : nsISupports
{
readonly attribute nsIDOMCSSRuleList cssRules;

View File

@ -3,10 +3,13 @@
* 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 "nsIDOMCSSRule.idl"
#include "nsISupports.idl"
interface nsIDOMMediaList;
interface nsIDOMCSSStyleSheet;
[scriptable, uuid(d3b2b914-01ef-4663-beda-a6475a26f491)]
interface nsIDOMCSSImportRule : nsIDOMCSSRule
interface nsIDOMCSSImportRule : nsISupports
{
readonly attribute DOMString href;
readonly attribute nsIDOMMediaList media;

View File

@ -3,10 +3,12 @@
* 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 "nsIDOMCSSRule.idl"
#include "nsISupports.idl"
interface nsIDOMCSSStyleDeclaration;
[scriptable, uuid(a281a8b4-eaa2-49a8-8b97-acc2814a57c9)]
interface nsIDOMCSSKeyframeRule : nsIDOMCSSRule
interface nsIDOMCSSKeyframeRule : nsISupports
{
attribute DOMString keyText;
readonly attribute nsIDOMCSSStyleDeclaration style;

View File

@ -3,10 +3,13 @@
* 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 "nsIDOMCSSRule.idl"
#include "nsISupports.idl"
interface nsIDOMCSSRuleList;
interface nsIDOMCSSKeyframeRule;
[scriptable, uuid(400f4b70-ad0a-4047-aba4-ee8019f6b907)]
interface nsIDOMCSSKeyframesRule : nsIDOMCSSRule
interface nsIDOMCSSKeyframesRule : nsISupports
{
attribute DOMString name;
readonly attribute nsIDOMCSSRuleList cssRules;

View File

@ -5,6 +5,8 @@
#include "nsIDOMCSSConditionRule.idl"
interface nsIDOMMediaList;
/**
* Interface for @media rules in the CSS OM.
*/

View File

@ -3,10 +3,12 @@
* 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 "nsIDOMCSSRule.idl"
#include "nsISupports.idl"
interface nsIDOMCSSStyleDeclaration;
[scriptable, uuid(c119072b-7d2f-4aeb-a90d-e2d6b606c32a)]
interface nsIDOMCSSPageRule : nsIDOMCSSRule
interface nsIDOMCSSPageRule : nsISupports
{
//attribute DOMString selectorText;
// raises(DOMException) on setting

View File

@ -3,10 +3,12 @@
* 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 "nsIDOMCSSRule.idl"
#include "nsISupports.idl"
interface nsIDOMCSSStyleDeclaration;
[scriptable, uuid(b5e9af48-a7c2-4f88-aae3-58307af4b5a5)]
interface nsIDOMCSSStyleRule : nsIDOMCSSRule
interface nsIDOMCSSStyleRule : nsISupports
{
attribute DOMString selectorText;
// raises(DOMException) on setting

View File

@ -3,9 +3,9 @@
* 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 "nsIDOMCSSRule.idl"
#include "nsISupports.idl"
[scriptable, uuid(98f4c27b-fb35-4355-8fd9-546c4697d71a)]
interface nsIDOMCSSUnknownRule : nsIDOMCSSRule
interface nsIDOMCSSUnknownRule : nsISupports
{
};

View File

@ -1717,6 +1717,10 @@ MediaStreamGraphImpl::RunInStableState(bool aSourceIsMSG)
RefPtr<GraphDriver> driver = CurrentDriver();
MonitorAutoUnlock unlock(mMonitor);
driver->Start();
// It's not safe to Shutdown() a thread from StableState, and
// releasing this may shutdown a SystemClockDriver thread.
// Proxy the release to outside of StableState.
NS_ReleaseOnMainThread(driver.forget(), true); // always proxy
}
}

View File

@ -15,6 +15,7 @@
#include "nsTArray.h"
#include "js/TypeDecls.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/dom/TypedArray.h"
namespace mozilla {

View File

@ -249,7 +249,7 @@ var interfaceNamesInGlobalScope =
// IMPORTANT: Do not change this list without review from a DOM peer!
"CSSMozDocumentRule",
// IMPORTANT: Do not change this list without review from a DOM peer!
"CSSNameSpaceRule",
"CSSNamespaceRule",
// IMPORTANT: Do not change this list without review from a DOM peer!
"CSSPageRule",
// IMPORTANT: Do not change this list without review from a DOM peer!

View File

@ -0,0 +1,14 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/.
*
* The origin of this IDL file is
* https://drafts.csswg.org/css-conditional/#the-cssconditionrule-interface
*/
// https://drafts.csswg.org/css-conditional/#the-cssconditionrule-interface
interface CSSConditionRule : CSSGroupingRule {
[SetterThrows]
attribute DOMString conditionText;
};

View File

@ -0,0 +1,23 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/.
*
* The origin of this IDL file is
* https://drafts.csswg.org/css-counter-styles-3/#the-csscounterstylerule-interface
*/
// https://drafts.csswg.org/css-counter-styles-3/#the-csscounterstylerule-interface
interface CSSCounterStyleRule : CSSRule {
attribute DOMString name;
attribute DOMString system;
attribute DOMString symbols;
attribute DOMString additiveSymbols;
attribute DOMString negative;
attribute DOMString prefix;
attribute DOMString suffix;
attribute DOMString range;
attribute DOMString pad;
attribute DOMString speakAs;
attribute DOMString fallback;
};

View File

@ -0,0 +1,15 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/.
*
* The origin of this IDL file is
* https://drafts.csswg.org/css-fonts/#om-fontface
*/
// https://drafts.csswg.org/css-fonts/#om-fontface
// But we implement a very old draft, apparently....
// See bug 1058408 for implementing the current spec.
interface CSSFontFaceRule : CSSRule {
[SameObject] readonly attribute CSSStyleDeclaration style;
};

View File

@ -0,0 +1,29 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/.
*
* The origin of this IDL file is
* https://drafts.csswg.org/css-fonts/#om-fontfeaturevalues
*/
// https://drafts.csswg.org/css-fonts/#om-fontfeaturevalues
// but we don't implement anything remotely resembling the spec.
interface CSSFontFeatureValuesRule : CSSRule {
[SetterThrows]
attribute DOMString fontFamily;
// Not yet implemented
// readonly attribute CSSFontFeatureValuesMap annotation;
// readonly attribute CSSFontFeatureValuesMap ornaments;
// readonly attribute CSSFontFeatureValuesMap stylistic;
// readonly attribute CSSFontFeatureValuesMap swash;
// readonly attribute CSSFontFeatureValuesMap characterVariant;
// readonly attribute CSSFontFeatureValuesMap styleset;
};
partial interface CSSFontFeatureValuesRule {
// Gecko addition?
[SetterThrows]
attribute DOMString valueText;
};

View File

@ -0,0 +1,17 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/.
*
* The origin of this IDL file is
* https://drafts.csswg.org/cssom/#cssgroupingrule
*/
// https://drafts.csswg.org/cssom/#cssgroupingrule
interface CSSGroupingRule : CSSRule {
[SameObject] readonly attribute CSSRuleList cssRules;
[Throws]
unsigned long insertRule(DOMString rule, unsigned long index);
[Throws]
void deleteRule(unsigned long index);
};

View File

@ -0,0 +1,17 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/.
*
* The origin of this IDL file is
* https://drafts.csswg.org/cssom/#cssimportrule
*/
// https://drafts.csswg.org/cssom/#cssimportrule
interface CSSImportRule : CSSRule {
readonly attribute DOMString href;
[SameObject, PutForwards=mediaText] readonly attribute MediaList media;
// Per spec, the .styleSheet is never null, but in our implementation it can
// be. See <https://bugzilla.mozilla.org/show_bug.cgi?id=1326509>.
[SameObject] readonly attribute CSSStyleSheet? styleSheet;
};

View File

@ -0,0 +1,14 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/.
*
* The origin of this IDL file is
* https://drafts.csswg.org/css-animations/#interface-csskeyframerule
*/
// https://drafts.csswg.org/css-animations/#interface-csskeyframerule
interface CSSKeyframeRule : CSSRule {
attribute DOMString keyText;
readonly attribute CSSStyleDeclaration style;
};

View File

@ -0,0 +1,18 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/.
*
* The origin of this IDL file is
* https://drafts.csswg.org/css-animations/#interface-csskeyframesrule
*/
// https://drafts.csswg.org/css-animations/#interface-csskeyframesrule
interface CSSKeyframesRule : CSSRule {
attribute DOMString name;
readonly attribute CSSRuleList cssRules;
void appendRule(DOMString rule);
void deleteRule(DOMString select);
CSSKeyframeRule? findRule(DOMString select);
};

View File

@ -0,0 +1,17 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/.
*
* The origin of this IDL file is
* https://drafts.csswg.org/cssom/#the-cssmediarule-interface
* https://drafts.csswg.org/css-conditional/#the-cssmediarule-interface
*/
// https://drafts.csswg.org/cssom/#the-cssmediarule-interface and
// https://drafts.csswg.org/css-conditional/#the-cssmediarule-interface
// except they disagree with each other. We're taking the inheritance from
// css-conditional and the PutForwards behavior from cssom.
interface CSSMediaRule : CSSConditionRule {
[SameObject, PutForwards=mediaText] readonly attribute MediaList media;
};

View File

@ -0,0 +1,10 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/.
*/
// This is a non-standard interface for @-moz-document rules
interface CSSMozDocumentRule : CSSConditionRule {
// XXX Add access to the URL list.
};

View File

@ -0,0 +1,16 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/.
*
* The origin of this IDL file is
* https://drafts.csswg.org/cssom/#cssnamespacerule
*/
// https://drafts.csswg.org/cssom/#cssnamespacerule
interface CSSNamespaceRule : CSSRule {
// Not implemented yet. <See
// https://bugzilla.mozilla.org/show_bug.cgi?id=1326514>.
// readonly attribute DOMString namespaceURI;
// readonly attribute DOMString prefix;
};

View File

@ -0,0 +1,17 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/.
*
* The origin of this IDL file is
* https://drafts.csswg.org/cssom/#the-csspagerule-interface
*/
// https://drafts.csswg.org/cssom/#the-csspagerule-interface
// Per spec, this should inherit from CSSGroupingRule, but we don't
// implement this yet.
interface CSSPageRule : CSSRule {
// selectorText not implemented yet
// attribute DOMString selectorText;
[SameObject, PutForwards=cssText] readonly attribute CSSStyleDeclaration style;
};

52
dom/webidl/CSSRule.webidl Normal file
View File

@ -0,0 +1,52 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/.
*
* The origin of this IDL file is
* https://drafts.csswg.org/cssom/#the-cssrule-interface
* https://drafts.csswg.org/css-animations/#interface-cssrule
* https://drafts.csswg.org/css-counter-styles-3/#extentions-to-cssrule-interface
* https://drafts.csswg.org/css-conditional-3/#extentions-to-cssrule-interface
* https://drafts.csswg.org/css-fonts-3/#om-fontfeaturevalues
*/
// https://drafts.csswg.org/cssom/#the-cssrule-interface
interface CSSRule {
const unsigned short STYLE_RULE = 1;
const unsigned short CHARSET_RULE = 2; // historical
const unsigned short IMPORT_RULE = 3;
const unsigned short MEDIA_RULE = 4;
const unsigned short FONT_FACE_RULE = 5;
const unsigned short PAGE_RULE = 6;
// FIXME: We don't support MARGIN_RULE yet.
// XXXbz Should we expose the constant anyway?
// const unsigned short MARGIN_RULE = 9;
const unsigned short NAMESPACE_RULE = 10;
readonly attribute unsigned short type;
attribute DOMString cssText;
readonly attribute CSSRule? parentRule;
readonly attribute CSSStyleSheet? parentStyleSheet;
};
// https://drafts.csswg.org/css-animations/#interface-cssrule
partial interface CSSRule {
const unsigned short KEYFRAMES_RULE = 7;
const unsigned short KEYFRAME_RULE = 8;
};
// https://drafts.csswg.org/css-counter-styles-3/#extentions-to-cssrule-interface
partial interface CSSRule {
const unsigned short COUNTER_STYLE_RULE = 11;
};
// https://drafts.csswg.org/css-conditional-3/#extentions-to-cssrule-interface
partial interface CSSRule {
const unsigned short SUPPORTS_RULE = 12;
};
// https://drafts.csswg.org/css-fonts-3/#om-fontfeaturevalues
partial interface CSSRule {
const unsigned short FONT_FEATURE_VALUES_RULE = 14;
};

View File

@ -7,8 +7,6 @@
* http://dev.w3.org/csswg/cssom/
*/
interface CSSRule;
interface CSSStyleDeclaration {
[SetterThrows]
attribute DOMString cssText;

View File

@ -0,0 +1,14 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/.
*
* The origin of this IDL file is
* https://drafts.csswg.org/cssom/#the-cssstylerule-interface
*/
// https://drafts.csswg.org/cssom/#the-cssstylerule-interface
interface CSSStyleRule : CSSRule {
attribute DOMString selectorText;
[SameObject, PutForwards=cssText] readonly attribute CSSStyleDeclaration style;
};

View File

@ -7,8 +7,6 @@
* http://dev.w3.org/csswg/cssom/
*/
interface CSSRule;
enum CSSStyleSheetParsingMode {
"author",
"user",

View File

@ -0,0 +1,12 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/.
*
* The origin of this IDL file is
* https://drafts.csswg.org/css-conditional/#the-csssupportsrule-interface
*/
// https://drafts.csswg.org/css-conditional/#the-csssupportsrule-interface
interface CSSSupportsRule : CSSConditionRule {
};

View File

@ -24,8 +24,10 @@ BoxObject implements LegacyQueryInterface;
CaretPosition implements LegacyQueryInterface;
Comment implements LegacyQueryInterface;
Crypto implements LegacyQueryInterface;
CSSMozDocumentRule implements LegacyQueryInterface;
CSSPrimitiveValue implements LegacyQueryInterface;
CSSStyleDeclaration implements LegacyQueryInterface;
CSSStyleRule implements LegacyQueryInterface;
CSSValueList implements LegacyQueryInterface;
DOMImplementation implements LegacyQueryInterface;
DOMParser implements LegacyQueryInterface;

View File

@ -3,8 +3,6 @@
* 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/.
*/
interface CSSRule;
[ChromeOnly, Constructor(DOMString type, optional StyleRuleChangeEventInit eventInitDict)]
interface StyleRuleChangeEvent : Event
{

View File

@ -7,8 +7,6 @@
* http://dev.w3.org/csswg/cssom/
*/
interface CSSRule;
interface StyleSheet {
[Constant]
readonly attribute DOMString type;

View File

@ -89,12 +89,27 @@ WEBIDL_FILES = [
'CSPReport.webidl',
'CSS.webidl',
'CSSAnimation.webidl',
'CSSConditionRule.webidl',
'CSSCounterStyleRule.webidl',
'CSSFontFaceRule.webidl',
'CSSFontFeatureValuesRule.webidl',
'CSSGroupingRule.webidl',
'CSSImportRule.webidl',
'CSSKeyframeRule.webidl',
'CSSKeyframesRule.webidl',
'CSSLexer.webidl',
'CSSMediaRule.webidl',
'CSSMozDocumentRule.webidl',
'CSSNamespaceRule.webidl',
'CSSPageRule.webidl',
'CSSPrimitiveValue.webidl',
'CSSPseudoElement.webidl',
'CSSRule.webidl',
'CSSRuleList.webidl',
'CSSStyleDeclaration.webidl',
'CSSStyleRule.webidl',
'CSSStyleSheet.webidl',
'CSSSupportsRule.webidl',
'CSSTransition.webidl',
'CSSValue.webidl',
'CSSValueList.webidl',

View File

@ -36,6 +36,7 @@
#include "mozilla/Telemetry.h"
#include "mozilla/dom/BindingUtils.h"
#include "mozilla/dom/ContentParent.h"
#include "mozilla/dom/ContentChild.h"
#include "mozilla/dom/DOMError.h"
#include "mozilla/dom/ErrorEvent.h"
#include "mozilla/dom/Headers.h"
@ -678,6 +679,17 @@ ServiceWorkerManager::Register(mozIDOMWindow* aWindow,
AssertIsOnMainThread();
Telemetry::Accumulate(Telemetry::SERVICE_WORKER_REGISTRATIONS, 1);
ContentChild* contentChild = ContentChild::GetSingleton();
if (contentChild &&
contentChild->GetRemoteType().EqualsLiteral(FILE_REMOTE_TYPE)) {
nsString message(NS_LITERAL_STRING("ServiceWorker registered by document "
"embedded in a file:/// URI. This may "
"result in unexpected behavior."));
ReportToAllClients(cleanedScope, message, EmptyString(),
EmptyString(), 0, 0, nsIScriptError::warningFlag);
Telemetry::Accumulate(Telemetry::FILE_EMBEDDED_SERVICEWORKERS, 1);
}
promise.forget(aPromise);
return NS_OK;
}

View File

@ -97,6 +97,32 @@ BufferRecycleBin::ClearRecycledBuffers()
mRecycledBufferSize = 0;
}
ImageContainerListener::ImageContainerListener(ImageContainer* aImageContainer)
: mLock("mozilla.layers.ImageContainerListener.mLock")
, mImageContainer(aImageContainer)
{
}
ImageContainerListener::~ImageContainerListener()
{
}
void
ImageContainerListener::NotifyComposite(const ImageCompositeNotification& aNotification)
{
MutexAutoLock lock(mLock);
if (mImageContainer) {
mImageContainer->NotifyComposite(aNotification);
}
}
void
ImageContainerListener::ClearImageContainer()
{
MutexAutoLock lock(mLock);
mImageContainer = nullptr;
}
void
ImageContainer::EnsureImageClient(bool aCreate)
{
@ -111,6 +137,7 @@ ImageContainer::EnsureImageClient(bool aCreate)
mImageClient = imageBridge->CreateImageClient(CompositableType::IMAGE, this);
if (mImageClient) {
mAsyncContainerID = mImageClient->GetAsyncID();
mNotifyCompositeListener = new ImageContainerListener(this);
}
}
}
@ -146,6 +173,9 @@ ImageContainer::ImageContainer(uint64_t aAsyncContainerID)
ImageContainer::~ImageContainer()
{
if (mNotifyCompositeListener) {
mNotifyCompositeListener->ClearImageContainer();
}
if (mAsyncContainerID) {
if (RefPtr<ImageBridgeChild> imageBridge = ImageBridgeChild::GetSingleton()) {
imageBridge->ForgetImageContainer(mAsyncContainerID);

View File

@ -145,6 +145,7 @@ namespace layers {
class ImageClient;
class ImageCompositeNotification;
class ImageContainer;
class ImageContainerChild;
class PImageContainerChild;
class SharedPlanarYCbCrImage;
@ -323,6 +324,24 @@ protected:
const gfx::IntSize& aScaleHint,
BufferRecycleBin *aRecycleBin);
};
// Used to notify ImageContainer::NotifyComposite()
class ImageContainerListener final {
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(ImageContainerListener)
public:
explicit ImageContainerListener(ImageContainer* aImageContainer);
void NotifyComposite(const ImageCompositeNotification& aNotification);
void ClearImageContainer();
private:
typedef mozilla::Mutex Mutex;
~ImageContainerListener();
Mutex mLock;
ImageContainer* mImageContainer;
};
/**
* A class that manages Images for an ImageLayer. The only reason
@ -566,6 +585,11 @@ public:
PImageContainerChild* GetPImageContainerChild();
ImageContainerListener* GetImageContainerListener()
{
return mNotifyCompositeListener;
}
/**
* Main thread only.
*/
@ -632,6 +656,8 @@ private:
// mFrameIDsNotYetComposited
ProducerID mCurrentProducerID;
RefPtr<ImageContainerListener> mNotifyCompositeListener;
static mozilla::Atomic<uint32_t> sGenerationCounter;
};

View File

@ -1105,13 +1105,17 @@ mozilla::ipc::IPCResult
ImageBridgeChild::RecvDidComposite(InfallibleTArray<ImageCompositeNotification>&& aNotifications)
{
for (auto& n : aNotifications) {
RefPtr<ImageContainer> imageContainer;
RefPtr<ImageContainerListener> listener;
{
MutexAutoLock lock(mContainerMapLock);
ImageContainer* imageContainer;
imageContainer = mImageContainers.Get(n.asyncCompositableID());
if (imageContainer) {
listener = imageContainer->GetImageContainerListener();
}
}
if (imageContainer) {
imageContainer->NotifyComposite(n);
if (listener) {
listener->NotifyComposite(n);
}
}
return IPC_OK();

View File

@ -19,9 +19,6 @@
#include "base/win_util.h"
#include <algorithm>
#include "prenv.h"
#include "mozilla/WindowsVersion.h"
namespace {
@ -280,13 +277,11 @@ bool LaunchApp(const std::wstring& cmdline,
// We want to inherit the std handles so dump() statements and assertion
// messages in the child process can be seen - but we *do not* want to
// blindly have all handles inherited. Vista and later has a technique
// where only specified handles are inherited - so we use this technique if
// we can. If that technique isn't available (or it fails), we just don't
// inherit anything. This can cause us a problem for Windows XP testing,
// because we sometimes need the handles to get inherited for test logging to
// work. So we also inherit when a specific environment variable is set.
// where only specified handles are inherited - so we use this technique.
// If that fails we just don't inherit anything.
DWORD dwCreationFlags = 0;
BOOL bInheritHandles = FALSE;
// We use a STARTUPINFOEX, but if we can't do the thread attribute thing, we
// just pass the size of a STARTUPINFO.
STARTUPINFOEX startup_info_ex;
@ -302,40 +297,29 @@ bool LaunchApp(const std::wstring& cmdline,
HANDLE handlesToInherit[2];
int handleCount = 0;
// Don't even bother trying pre-Vista...
if (mozilla::IsVistaOrLater()) {
// setup our handle array first - if we end up with no handles that can
// be inherited we can avoid trying to do the ThreadAttributeList dance...
HANDLE stdOut = ::GetStdHandle(STD_OUTPUT_HANDLE);
HANDLE stdErr = ::GetStdHandle(STD_ERROR_HANDLE);
// setup our handle array first - if we end up with no handles that can
// be inherited we can avoid trying to do the ThreadAttributeList dance...
HANDLE stdOut = ::GetStdHandle(STD_OUTPUT_HANDLE);
HANDLE stdErr = ::GetStdHandle(STD_ERROR_HANDLE);
if (IsInheritableHandle(stdOut))
handlesToInherit[handleCount++] = stdOut;
if (stdErr != stdOut && IsInheritableHandle(stdErr))
handlesToInherit[handleCount++] = stdErr;
if (IsInheritableHandle(stdOut))
handlesToInherit[handleCount++] = stdOut;
if (stdErr != stdOut && IsInheritableHandle(stdErr))
handlesToInherit[handleCount++] = stdErr;
if (handleCount) {
lpAttributeList = CreateThreadAttributeList(handlesToInherit, handleCount);
if (lpAttributeList) {
// it's safe to inherit handles, so arrange for that...
startup_info.cb = sizeof(startup_info_ex);
startup_info.dwFlags |= STARTF_USESTDHANDLES;
startup_info.hStdOutput = stdOut;
startup_info.hStdError = stdErr;
startup_info.hStdInput = INVALID_HANDLE_VALUE;
startup_info_ex.lpAttributeList = lpAttributeList;
dwCreationFlags |= EXTENDED_STARTUPINFO_PRESENT;
bInheritHandles = TRUE;
}
if (handleCount) {
lpAttributeList = CreateThreadAttributeList(handlesToInherit, handleCount);
if (lpAttributeList) {
// it's safe to inherit handles, so arrange for that...
startup_info.cb = sizeof(startup_info_ex);
startup_info.dwFlags |= STARTF_USESTDHANDLES;
startup_info.hStdOutput = stdOut;
startup_info.hStdError = stdErr;
startup_info.hStdInput = INVALID_HANDLE_VALUE;
startup_info_ex.lpAttributeList = lpAttributeList;
dwCreationFlags |= EXTENDED_STARTUPINFO_PRESENT;
bInheritHandles = TRUE;
}
} else if (PR_GetEnv("MOZ_WIN_INHERIT_STD_HANDLES_PRE_VISTA")) {
// Even if we can't limit what gets inherited, we sometimes want to inherit
// stdout/err for testing purposes.
startup_info.dwFlags |= STARTF_USESTDHANDLES;
startup_info.hStdOutput = ::GetStdHandle(STD_OUTPUT_HANDLE);
startup_info.hStdError = ::GetStdHandle(STD_ERROR_HANDLE);
startup_info.hStdInput = INVALID_HANDLE_VALUE;
bInheritHandles = TRUE;
}
PROCESS_INFORMATION process_info;

View File

@ -19,7 +19,6 @@
#include "mozilla/ArrayUtils.h"
#include "mozilla/ipc/ProtocolUtils.h"
#include "mozilla/PaintTracker.h"
#include "mozilla/WindowsVersion.h"
using namespace mozilla;
using namespace mozilla::ipc;
@ -1022,7 +1021,7 @@ MessageChannel::WaitForSyncNotify(bool aHandleWindowsMessages)
MOZ_ASSERT(gUIThreadId, "InitUIThread was not called!");
#if defined(ACCESSIBILITY)
if (IsVistaOrLater() && (mFlags & REQUIRE_A11Y_REENTRY)) {
if ((mFlags & REQUIRE_A11Y_REENTRY)) {
MOZ_ASSERT(!(mFlags & REQUIRE_DEFERRED_MESSAGE_PROTECTION));
return WaitForSyncNotifyWithA11yReentry();
}

View File

@ -10,7 +10,6 @@
#include "mozilla/Assertions.h"
#include "mozilla/RefPtr.h"
#include "mozilla/UniquePtr.h"
#include "mozilla/WindowsVersion.h"
#include "nsDebug.h"
#include "nsWindowsHelpers.h"
@ -44,13 +43,6 @@ MainThreadRuntime::MainThreadRuntime()
return;
}
// Windows XP doesn't support setting of the COM exception policy, so we'll
// just stop here in that case.
if (!IsVistaOrLater()) {
mInitResult = S_OK;
return;
}
// We are required to initialize security in order to configure global options.
mInitResult = InitializeSecurity();
MOZ_ASSERT(SUCCEEDED(mInitResult));
@ -67,12 +59,8 @@ MainThreadRuntime::MainThreadRuntime()
return;
}
// Windows 7 has a policy that is even more strict. We should use that one
// whenever possible.
ULONG_PTR exceptionSetting = IsWin7OrLater() ?
COMGLB_EXCEPTION_DONOT_HANDLE_ANY :
COMGLB_EXCEPTION_DONOT_HANDLE;
mInitResult = globalOpts->Set(COMGLB_EXCEPTION_HANDLING, exceptionSetting);
mInitResult = globalOpts->Set(COMGLB_EXCEPTION_HANDLING,
COMGLB_EXCEPTION_DONOT_HANDLE_ANY);
MOZ_ASSERT(SUCCEEDED(mInitResult));
}
@ -177,4 +165,3 @@ MainThreadRuntime::InitializeSecurity()
} // namespace mscom
} // namespace mozilla

View File

@ -1141,9 +1141,11 @@ IonBuilder::initEnvironmentChain(MDefinition* callee)
current->add(env);
// This reproduce what is done in CallObject::createForFunction. Skip
// this for analyses, as the script might not have a baseline script
// with template objects yet.
if (fun->needsSomeEnvironmentObject() && !info().isAnalysis()) {
// this for the arguments analysis, as the script might not have a
// baseline script with template objects yet.
if (fun->needsSomeEnvironmentObject() &&
info().analysisMode() != Analysis_ArgumentsUsage)
{
if (fun->needsNamedLambdaEnvironment())
env = createNamedLambdaObject(callee, env);

View File

@ -87,10 +87,6 @@ js::StartOffThreadWasmCompile(wasm::CompileTask* task)
{
AutoLockHelperThreadState lock;
// Don't append this task if another failed.
if (HelperThreadState().wasmFailed(lock))
return false;
if (!HelperThreadState().wasmWorklist(lock).append(task))
return false;

View File

@ -229,7 +229,7 @@ class GlobalHelperThreadState
}
void setWasmError(const AutoLockHelperThreadState&, UniqueChars error) {
if (!firstWasmError)
firstWasmError = Move(error);
firstWasmError = Move(error);
}
bool wasmFailed(const AutoLockHelperThreadState&) {
return bool(numWasmFailedJobs);

View File

@ -247,8 +247,8 @@ ModuleGenerator::finishOutstandingTask()
if (HelperThreadState().wasmFailed(lock)) {
if (error_) {
MOZ_ASSERT(!*error_, "Should have stopped earlier");
*error_ = Move(HelperThreadState().harvestWasmError(lock));
MOZ_ASSERT(!*error_, "Should have stopped earlier");
*error_ = Move(HelperThreadState().harvestWasmError(lock));
}
return false;
}

View File

@ -3667,7 +3667,7 @@ wasm::IonCompileFunction(CompileTask* task, FuncCompileUnit* unit, UniqueChars*
if (!env.isAsmJS()) {
if (!ValidateFunctionBody(task->env(), func.index(), bodySize, d))
return false;
return false;
d.rollbackPosition(d.begin());
}

View File

@ -214,28 +214,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=668855
make_live_map();
let unpreservable_native_key = function () {
// We only allow natives that support wrapper preservation to be used as weak
// map keys. We should be able to try to add unpreservable natives as keys without
// crashing (bug 711616), but we should throw an error (bug 761620).
let dummy_test_map = new WeakMap;
let rule_fail = false;
let got_rule = false;
try {
var rule = document.styleSheets[0].cssRules[0];
got_rule = true;
dummy_test_map.set(rule, 1);
} catch (e) {
rule_fail = true;
}
ok(got_rule, "Got the CSS rule");
ok(rule_fail, "Using a CSS rule as a weak map key should produce an exception because it can't be wrapper preserved.");
}
unpreservable_native_key();
// We're out of ideas for unpreservable natives, now that just about
// everything is on webidl, so just don't test those.
/* set up for running precise GC/CC then checking the results */

View File

@ -1,7 +1,6 @@
<!DOCTYPE HTML>
<html>
<head>
<link rel="stylesheet" href="data:text/css,div {}">
<title>Test Cross-Compartment DOM WeakMaps</title>
</head>
<body>

View File

@ -15,14 +15,6 @@ function setup() {
var item = window.frames[0].document.querySelector("body");
my_map.set(item, "success_string");
var rule_fail = false;
try {
my_map.set(window.frames[0].document.styleSheets[0].cssRules[0], 1);
} catch (e) {
rule_fail = true;
}
ok(rule_fail, "Using rule as a weak map key across compartments should produce an exception because it can't be wrapper preserved.");
}
function runTest() {

View File

@ -3678,6 +3678,7 @@ MeasuringReflow(nsIFrame* aChild,
const ReflowInput* aReflowInput,
nsRenderingContext* aRC,
const LogicalSize& aAvailableSize,
const LogicalSize& aCBSize,
nscoord aIMinSizeClamp = NS_MAXSIZE,
nscoord aBMinSizeClamp = NS_MAXSIZE)
{
@ -3710,7 +3711,7 @@ MeasuringReflow(nsIFrame* aChild,
} else {
aChild->Properties().Delete(nsIFrame::BClampMarginBoxMinSizeProperty());
}
ReflowInput childRI(pc, *rs, aChild, aAvailableSize, nullptr, riFlags);
ReflowInput childRI(pc, *rs, aChild, aAvailableSize, &aCBSize, riFlags);
ReflowOutput childSize(childRI);
nsReflowStatus childStatus;
const uint32_t flags = NS_FRAME_NO_MOVE_FRAME | NS_FRAME_NO_SIZE_VIEW;
@ -3748,22 +3749,25 @@ ContentContribution(const GridItemInfo& aGridItem,
if (size == NS_INTRINSIC_WIDTH_UNKNOWN) {
// We need to reflow the child to find its BSize contribution.
// XXX this will give mostly correct results for now (until bug 1174569).
nscoord cbISize = INFINITE_ISIZE_COORD;
nscoord cbBSize = NS_UNCONSTRAINEDSIZE;
nscoord availISize = INFINITE_ISIZE_COORD;
nscoord availBSize = NS_UNCONSTRAINEDSIZE;
auto childWM = child->GetWritingMode();
const bool isOrthogonal = childWM.IsOrthogonalTo(aCBWM);
// The next two variables are MinSizeClamp values in the child's axes.
nscoord iMinSizeClamp = NS_MAXSIZE;
nscoord bMinSizeClamp = NS_MAXSIZE;
LogicalSize cbSize(childWM, 0, 0);
if (aState.mCols.mCanResolveLineRangeSize) {
nscoord sz = aState.mCols.ResolveSize(aGridItem.mArea.mCols);
if (isOrthogonal) {
cbBSize = sz;
availBSize = sz;
cbSize.BSize(childWM) = sz;
if (aGridItem.mState[aAxis] & ItemState::eClampMarginBoxMinSize) {
bMinSizeClamp = sz;
}
} else {
cbISize = sz;
availISize = sz;
cbSize.ISize(childWM) = sz;
if (aGridItem.mState[aAxis] & ItemState::eClampMarginBoxMinSize) {
iMinSizeClamp = sz;
}
@ -3774,16 +3778,15 @@ ContentContribution(const GridItemInfo& aGridItem,
} else {
iMinSizeClamp = aMinSizeClamp;
}
LogicalSize availableSize(childWM, cbISize, cbBSize);
LogicalSize availableSize(childWM, availISize, availBSize);
size = ::MeasuringReflow(child, aState.mReflowInput, aRC, availableSize,
iMinSizeClamp, bMinSizeClamp);
cbSize, iMinSizeClamp, bMinSizeClamp);
nsIFrame::IntrinsicISizeOffsetData offsets = child->IntrinsicBSizeOffsets();
size += offsets.hMargin;
auto percent = offsets.hPctMargin;
if (!aState.mReflowInput) {
// We always want to add in percent padding too, but during Reflow we
// always have a definite percentage basis (the grid area) so any percent
// padding is already resolved and baked in to 'size' at this point.
if (availBSize == NS_UNCONSTRAINEDSIZE) {
// We always want to add in percent padding too, unless we already did so
// using a resolved column size above.
percent += offsets.hPctPadding;
}
size = nsLayoutUtils::AddPercents(size, percent);
@ -4199,7 +4202,15 @@ nsGridContainerFrame::Tracks::InitializeItemBaselines(
auto* rc = &aState.mRenderingContext;
// XXX figure out if we can avoid/merge this reflow with the main reflow.
// XXX (after bug 1174569 is sorted out)
::MeasuringReflow(child, aState.mReflowInput, rc, avail);
//
// XXX How should we handle percentage padding here? (bug 1330866)
// XXX (see ::ContentContribution and how it deals with percentages)
// XXX What if the true baseline after line-breaking differs from this
// XXX hypothetical baseline based on an infinite inline size?
// XXX Maybe we should just call ::ContentContribution here instead?
// XXX For now we just pass a zero-sized CB:
LogicalSize cbSize(childWM, 0, 0);
::MeasuringReflow(child, aState.mReflowInput, rc, avail, cbSize);
nscoord baseline;
nsGridContainerFrame* grid = do_QueryFrame(child);
if (state & ItemState::eFirstBaseline) {

View File

@ -18,6 +18,7 @@
#include "nsIDOMCSSImportRule.h"
#include "nsIDOMCSSMediaRule.h"
#include "nsIDOMCSSSupportsRule.h"
#include "nsIDOMCSSRule.h"
#include "nsIURI.h"
#include "nsIDocument.h"
#include "nsNetUtil.h"

View File

@ -253,13 +253,9 @@ inDOMUtils::GetCSSStyleRules(nsIDOMElement *aElement,
for (nsRuleNode* ruleNode : Reversed(ruleNodes)) {
RefPtr<Declaration> decl = do_QueryObject(ruleNode->GetRule());
if (decl) {
RefPtr<mozilla::css::StyleRule> styleRule =
do_QueryObject(decl->GetOwningRule());
if (styleRule) {
nsCOMPtr<nsIDOMCSSRule> domRule = styleRule->GetDOMRule();
if (domRule) {
rules->AppendElement(domRule, /*weak =*/ false);
}
css::Rule* owningRule = decl->GetOwningRule();
if (owningRule) {
rules->AppendElement(owningRule, /*weak =*/ false);
}
}
}

View File

@ -0,0 +1,136 @@
<!DOCTYPE html>
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<html><head>
<title>Reference: Testing grid item percent sizes</title>
<link rel="author" title="Mats Palmgren" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1330380">
<meta charset="utf-8">
<style type="text/css">
body,html { color:black; background:white; font:16px/1 monospace; padding:0; margin:0; }
* { vertical-align:top; line-height:4px; }
.grid {
display: grid;
position: relative;
float: left;
background-color: grey;
grid-template-columns: 50px 100px;
justify-items: start;
align-items: start;
clear: both;
}
.item {
background: pink;
grid-area: 1 / 1 / 2 / 2;
background-clip: content-box;
min-width: 0;
min-height: 0;
z-index: 1;
}
.c1 {
width: 60px;
height: 60%;
grid-area: 1 / 1 / 3 / 3;
}
.c2 {
grid-area: 1 / 1 / 3 / 3;
}
.pbox {
box-sizing: border-box;
}
.maxw .item { max-width: 25px; }
.minw .item { min-width: 25px; }
.maxw .c1.item { max-width: 75px; }
.minw .c1.item { min-width: 75px; }
.maxw .c2.item { max-width: 75px; }
.minw .c2.item { min-width: 75px; }
.p { padding:3px 5px 10% 10px; }
.c1.p, .c2.p { padding:3px 5px 10% 30px; }
.m { margin:3px 5px 10% 5px; }
.c1.m, .c2.m { margin:3px 5px 10% 15px; }
.b { border:solid black; }
x { display:inline-block; width:10px; height:4px; background: silver; }
a {
grid-area: 1 / 1 / 2 / 2;
width:100%; height:100%;
background: blue;
}
</style>
</head>
<body>
<div style="float:left">
<div class="grid" style="grid-template-rows:calc(4px)"><div class="item"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-rows:calc(7px/.9)"><div class="item pbox p"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-rows:0 calc(7px/.9)"><div class="item c1 p"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-rows:0 calc(11px/.9)"><div class="item c1 pbox p"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-rows:0 calc(7px/.9)"><div class="item c2 pbox p"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-rows:calc(10px)"><div class="item pbox b"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-rows:calc(17px/.9)"><div class="item pbox p b"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-rows:0 calc(21px/.9)"><div class="item c1 pbox p b"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-rows:0 calc(13px/.9)"><div class="item c2 pbox p b"><x></x><x></x><x></x></div><a></a></div>
</div>
<div style="float:left" class="maxw">
<div class="grid" style="grid-template-rows:calc(8px)"><div class="item"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-rows:calc(15px/.9)"><div class="item pbox p"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-rows:0 calc(7px/.9)"><div class="item c1 p"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-rows:0 calc(11px/.9)"><div class="item c1 pbox p"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-rows:0 calc(7px/.9)"><div class="item c2 pbox p"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-rows:calc(18px)"><div class="item pbox b"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-rows:calc(21px/.9)"><div class="item pbox p b"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-rows:0 calc(21px/.9)"><div class="item c1 pbox p b"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-rows:0 calc(13px/.9)"><div class="item c2 pbox p b"><x></x><x></x><x></x></div><a></a></div>
</div>
<div style="float:left" class="minw">
<div class="grid" style="grid-template-rows:calc(4px)"><div class="item"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-rows:calc(7px/.9)"><div class="item pbox p"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-rows:0 calc(7px/.9)"><div class="item c1 p"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-rows:0 calc(7px/.9)"><div class="item c1 pbox p"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-rows:0 calc(7px/.9)"><div class="item c2 pbox p"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-rows:calc(10px)"><div class="item pbox b"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-rows:calc(17px/.9)"><div class="item pbox p b"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-rows:0 calc(13px/.9)"><div class="item c1 pbox p b"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-rows:0 calc(13px/.9)"><div class="item c2 pbox p b"><x></x><x></x><x></x></div><a></a></div>
</div>
<div style="float:left">
<div class="grid" style="grid-template-rows:calc(7px/.9)"><div class="item pbox m"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-rows:0 calc(7px/.9)"><div class="item c1 pbox m"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-rows:0 calc(7px/.9)"><div class="item c2 pbox m"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-rows:calc(17.5px)"><div class="item pbox p m"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-rows:calc(30px)"><div class="item pbox p b m"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-rows:0 calc(20px)"><div class="item c2 pbox p b m"><x></x><x></x><x></x></div><a></a></div>
</div>
<br clear="all">
<div style="float:left" class="maxw">
<div class="grid" style="grid-template-rows:calc(11px/.9)"><div class="item pbox m"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-rows:0 calc(7px/.9)"><div class="item c1 pbox m"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-rows:0 calc(7px/.9)"><div class="item c2 pbox m"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-rows:calc(22.5px)"><div class="item pbox p m"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-rows:calc(30px)"><div class="item pbox p b m"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-rows:0 calc(20px)"><div class="item c2 pbox p b m"><x></x><x></x><x></x></div><a></a></div>
</div>
<div style="float:left" class="minw">
<div class="grid" style="grid-template-rows:calc(7px/.9)"><div class="item pbox m"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-rows:0 calc(7px/.9)"><div class="item c1 pbox m"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-rows:0 calc(7px/.9)"><div class="item c2 pbox m"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-rows:calc(17.5px)"><div class="item pbox p m"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-rows:calc(30px)"><div class="item pbox p b m"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-rows:0 calc(20px)"><div class="item c2 pbox p b m"><x></x><x></x><x></x></div><a></a></div>
</div>
</body>
</html>

View File

@ -0,0 +1,138 @@
<!DOCTYPE html>
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<html><head>
<title>CSS Test: Testing grid item percent sizes</title>
<link rel="author" title="Mats Palmgren" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1330380">
<link rel="help" href="http://dev.w3.org/csswg/css-grid/">
<link rel="match" href="grid-item-sizing-percent-002-ref.html">
<meta charset="utf-8">
<style type="text/css">
body,html { color:black; background:white; font:16px/1 monospace; padding:0; margin:0; }
* { vertical-align:top; line-height:4px; }
.grid {
display: grid;
position: relative;
float: left;
background-color: grey;
grid-template-columns: 50px 100px;
justify-items: start;
align-items: start;
clear: both;
}
.item {
background: pink;
grid-area: 1 / 1 / 2 / 2;
background-clip: content-box;
min-width: 0;
min-height: 0;
z-index: 1;
}
.c1 {
width: 40%;
height: 60%;
grid-area: 1 / 1 / 3 / 3;
}
.c2 {
grid-area: 1 / 1 / 3 / 3;
}
.pbox {
box-sizing: border-box;
}
.maxw .item { max-width: 50%; }
.minw .item { min-width: 50%; }
.p { padding:3px 5px 10% 20%; }
.m { margin:3px 5px 10% 10%; }
.b { border:solid black; }
x { display:inline-block; width:10px; height:4px; background: silver; }
a {
grid-area: 1 / 1 / 2 / 2;
width:100%; height:100%;
background: blue;
}
</style>
</head>
<body>
<div style="float:left">
<div class="grid"><div class="item"><x></x><x></x><x></x></div><a></a></div>
<div class="grid"><div class="item pbox p"><x></x><x></x><x></x></div><a></a></div>
<div class="grid"><div class="item c1 p"><x></x><x></x><x></x></div><a></a></div>
<div class="grid"><div class="item c1 pbox p"><x></x><x></x><x></x></div><a></a></div>
<div class="grid"><div class="item c2 pbox p"><x></x><x></x><x></x></div><a></a></div>
<div class="grid"><div class="item pbox b"><x></x><x></x><x></x></div><a></a></div>
<div class="grid"><div class="item pbox p b"><x></x><x></x><x></x></div><a></a></div>
<div class="grid"><div class="item c1 pbox p b"><x></x><x></x><x></x></div><a></a></div>
<div class="grid"><div class="item c2 pbox p b"><x></x><x></x><x></x></div><a></a></div>
</div>
<div style="float:left" class="maxw">
<div class="grid"><div class="item"><x></x><x></x><x></x></div><a></a></div>
<div class="grid"><div class="item pbox p"><x></x><x></x><x></x></div><a></a></div>
<div class="grid"><div class="item c1 p"><x></x><x></x><x></x></div><a></a></div>
<div class="grid"><div class="item c1 pbox p"><x></x><x></x><x></x></div><a></a></div>
<div class="grid"><div class="item c2 pbox p"><x></x><x></x><x></x></div><a></a></div>
<div class="grid"><div class="item pbox b"><x></x><x></x><x></x></div><a></a></div>
<div class="grid"><div class="item pbox p b"><x></x><x></x><x></x></div><a></a></div>
<div class="grid"><div class="item c1 pbox p b"><x></x><x></x><x></x></div><a></a></div>
<div class="grid"><div class="item c2 pbox p b"><x></x><x></x><x></x></div><a></a></div>
</div>
<div style="float:left" class="minw">
<div class="grid"><div class="item"><x></x><x></x><x></x></div><a></a></div>
<div class="grid"><div class="item pbox p"><x></x><x></x><x></x></div><a></a></div>
<div class="grid"><div class="item c1 p"><x></x><x></x><x></x></div><a></a></div>
<div class="grid"><div class="item c1 pbox p"><x></x><x></x><x></x></div><a></a></div>
<div class="grid"><div class="item c2 pbox p"><x></x><x></x><x></x></div><a></a></div>
<div class="grid"><div class="item pbox b"><x></x><x></x><x></x></div><a></a></div>
<div class="grid"><div class="item pbox p b"><x></x><x></x><x></x></div><a></a></div>
<div class="grid"><div class="item c1 pbox p b"><x></x><x></x><x></x></div><a></a></div>
<div class="grid"><div class="item c2 pbox p b"><x></x><x></x><x></x></div><a></a></div>
</div>
<div style="float:left">
<div class="grid"><div class="item pbox m"><x></x><x></x><x></x></div><a></a></div>
<div class="grid"><div class="item c1 pbox m"><x></x><x></x><x></x></div><a></a></div>
<div class="grid"><div class="item c2 pbox m"><x></x><x></x><x></x></div><a></a></div>
<div class="grid"><div class="item pbox p m"><x></x><x></x><x></x></div><a></a></div>
<div class="grid"><div class="item pbox p b m"><x></x><x></x><x></x></div><a></a></div>
<div class="grid"><div class="item c2 pbox p b m"><x></x><x></x><x></x></div><a></a></div>
</div>
<br clear="all">
<div style="float:left" class="maxw">
<div class="grid"><div class="item pbox m"><x></x><x></x><x></x></div><a></a></div>
<div class="grid"><div class="item c1 pbox m"><x></x><x></x><x></x></div><a></a></div>
<div class="grid"><div class="item c2 pbox m"><x></x><x></x><x></x></div><a></a></div>
<div class="grid"><div class="item pbox p m"><x></x><x></x><x></x></div><a></a></div>
<div class="grid"><div class="item pbox p b m"><x></x><x></x><x></x></div><a></a></div>
<div class="grid"><div class="item c2 pbox p b m"><x></x><x></x><x></x></div><a></a></div>
</div>
<div style="float:left" class="minw">
<div class="grid"><div class="item pbox m"><x></x><x></x><x></x></div><a></a></div>
<div class="grid"><div class="item c1 pbox m"><x></x><x></x><x></x></div><a></a></div>
<div class="grid"><div class="item c2 pbox m"><x></x><x></x><x></x></div><a></a></div>
<div class="grid"><div class="item pbox p m"><x></x><x></x><x></x></div><a></a></div>
<div class="grid"><div class="item pbox p b m"><x></x><x></x><x></x></div><a></a></div>
<div class="grid"><div class="item c2 pbox p b m"><x></x><x></x><x></x></div><a></a></div>
</div>
<script>
var grids = [].slice.call(document.querySelectorAll('.grid'));
grids.forEach((grid) => {
console.log(window.getComputedStyle(grid).gridTemplateRows);
});
</script>
</body>
</html>

View File

@ -0,0 +1,137 @@
<!DOCTYPE html>
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<html><head>
<title>Reference: Testing grid item percent sizes</title>
<link rel="author" title="Mats Palmgren" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1330380">
<meta charset="utf-8">
<style type="text/css">
body,html { color:black; background:white; font:16px/1 monospace; padding:0; margin:0; }
* { vertical-align:top; line-height:4px; }
.grid {
display: grid;
position: relative;
float: left;
background-color: grey;
grid-template-columns: 50px 100px;
justify-items: start;
align-items: start;
clear: both;
}
.item {
background: pink;
grid-area: 1 / 1 / 2 / 2;
background-clip: content-box;
min-width: 0;
min-height: 0;
z-index: 1;
writing-mode: vertical-rl;
}
.c1 {
width: 40%;
height: 60%;
grid-area: 1 / 1 / 3 / 3;
}
.c2 {
grid-area: 1 / 1 / 3 / 3;
}
.pbox {
box-sizing: border-box;
}
.maxw .item { max-width: 25px; }
.minw .item { min-width: 25px; }
.maxw .c1.item { max-width: 75px; }
.minw .c1.item { min-width: 75px; }
.maxw .c2.item { max-width: 75px; }
.minw .c2.item { min-width: 75px; }
.p { padding:3px 5px 10% 10px; }
.c1.p, .c2.p { padding:3px 5px 10% 30px; }
.m { margin:3px 5px 10% 5px; }
.c1.m, .c2.m { margin:3px 5px 10% 15px; }
.b { border:solid black; }
x { display:inline-block; width:10px; height:4px; background: silver; }
a {
grid-area: 1 / 1 / 2 / 2;
width:100%; height:100%;
background: blue;
}
</style>
</head>
<body>
<div style="float:left">
<div class="grid" style="grid-template-rows:calc(12px)"><div class="item"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-rows:calc(15px/.9)"><div class="item pbox p"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-rows:0 calc(15px/.9)"><div class="item c1 p"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-rows:0 calc(15px/.9)"><div class="item c1 pbox p"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-rows:0 calc(15px/.9)"><div class="item c2 pbox p"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-rows:calc(18px)"><div class="item pbox b"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-rows:calc(21px/0.9)"><div class="item pbox p b"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-rows:0 calc(21px/.9)"><div class="item c1 pbox p b"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-rows:0 calc(21px/.9)"><div class="item c2 pbox p b"><x></x><x></x><x></x></div><a></a></div>
</div>
<div style="float:left" class="maxw">
<div class="grid" style="grid-template-rows:calc(12px)"><div class="item"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-rows:calc(15px/.9)"><div class="item pbox p"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-rows:0 calc(15px/.9)"><div class="item c1 p"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-rows:0 calc(15px/.9)"><div class="item c1 pbox p"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-rows:0 calc(15px/.9)"><div class="item c2 pbox p"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-rows:calc(18px)"><div class="item pbox b"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-rows:calc(21px/.9)"><div class="item pbox p b"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-rows:0 calc(21px/.9)"><div class="item c1 pbox p b"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-rows:0 calc(21px/.9)"><div class="item c2 pbox p b"><x></x><x></x><x></x></div><a></a></div>
</div>
<div style="float:left" class="minw">
<div class="grid" style="grid-template-rows:calc(12px)"><div class="item"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-rows:calc(15px/.9)"><div class="item pbox p"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-rows:0 calc(15px/.9)"><div class="item c1 p"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-rows:0 calc(15px/.9)"><div class="item c1 pbox p"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-rows:0 calc(15px/.9)"><div class="item c2 pbox p"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-rows:calc(18px)"><div class="item pbox b"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-rows:calc(21px/.9)"><div class="item pbox p b"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-rows:0 calc(21px/.9)"><div class="item c1 pbox p b"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-rows:0 calc(21px/.9)"><div class="item c2 pbox p b"><x></x><x></x><x></x></div><a></a></div>
</div>
<div style="float:left">
<div class="grid" style="grid-template-rows:calc(15px/.9)"><div class="item pbox m"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-rows:0 calc(15px/.9)"><div class="item c1 pbox m"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-rows:0 calc(15px/.9)"><div class="item c2 pbox m"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-rows:calc(22.5px)"><div class="item pbox p m"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-rows:calc(30px)"><div class="item pbox p b m"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-rows:0 calc(30px)"><div class="item c2 pbox p b m"><x></x><x></x><x></x></div><a></a></div>
</div>
<br clear="all">
<div style="float:left" class="maxw">
<div class="grid" style="grid-template-rows:calc(15px/.9)"><div class="item pbox m"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-rows:0 calc(15px/.9)"><div class="item c1 pbox m"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-rows:0 calc(15px/.9)"><div class="item c2 pbox m"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-rows:calc(22.5px)"><div class="item pbox p m"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-rows:calc(30px)"><div class="item pbox p b m"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-rows:0 calc(30px)"><div class="item c2 pbox p b m"><x></x><x></x><x></x></div><a></a></div>
</div>
<div style="float:left" class="minw">
<div class="grid" style="grid-template-rows:calc(15px/.9)"><div class="item pbox m"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-rows:0 calc(15px/.9)"><div class="item c1 pbox m"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-rows:0 calc(15px/.9)"><div class="item c2 pbox m"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-rows:calc(22.5px)"><div class="item pbox p m"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-rows:calc(30px)"><div class="item pbox p b m"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-rows:0 calc(30px)"><div class="item c2 pbox p b m"><x></x><x></x><x></x></div><a></a></div>
</div>
</body>
</html>

View File

@ -0,0 +1,139 @@
<!DOCTYPE html>
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<html><head>
<title>CSS Test: Testing grid item percent sizes</title>
<link rel="author" title="Mats Palmgren" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1330380">
<link rel="help" href="http://dev.w3.org/csswg/css-grid/">
<link rel="match" href="grid-item-sizing-percent-003-ref.html">
<meta charset="utf-8">
<style type="text/css">
body,html { color:black; background:white; font:16px/1 monospace; padding:0; margin:0; }
* { vertical-align:top; line-height:4px; }
.grid {
display: grid;
position: relative;
float: left;
background-color: grey;
grid-template-columns: 50px 100px;
justify-items: start;
align-items: start;
clear: both;
}
.item {
background: pink;
grid-area: 1 / 1 / 2 / 2;
background-clip: content-box;
min-width: 0;
min-height: 0;
z-index: 1;
writing-mode: vertical-rl;
}
.c1 {
width: 40%;
height: 60%;
grid-area: 1 / 1 / 3 / 3;
}
.c2 {
grid-area: 1 / 1 / 3 / 3;
}
.pbox {
box-sizing: border-box;
}
.maxw .item { max-width: 50%; }
.minw .item { min-width: 50%; }
.p { padding:3px 5px 10% 20%; }
.m { margin:3px 5px 10% 10%; }
.b { border:solid black; }
x { display:inline-block; width:10px; height:4px; background: silver; }
a {
grid-area: 1 / 1 / 2 / 2;
width:100%; height:100%;
background: blue;
}
</style>
</head>
<body>
<div style="float:left">
<div class="grid"><div class="item"><x></x><x></x><x></x></div><a></a></div>
<div class="grid"><div class="item pbox p"><x></x><x></x><x></x></div><a></a></div>
<div class="grid"><div class="item c1 p"><x></x><x></x><x></x></div><a></a></div>
<div class="grid"><div class="item c1 pbox p"><x></x><x></x><x></x></div><a></a></div>
<div class="grid"><div class="item c2 pbox p"><x></x><x></x><x></x></div><a></a></div>
<div class="grid"><div class="item pbox b"><x></x><x></x><x></x></div><a></a></div>
<div class="grid"><div class="item pbox p b"><x></x><x></x><x></x></div><a></a></div>
<div class="grid"><div class="item c1 pbox p b"><x></x><x></x><x></x></div><a></a></div>
<div class="grid"><div class="item c2 pbox p b"><x></x><x></x><x></x></div><a></a></div>
</div>
<div style="float:left" class="maxw">
<div class="grid"><div class="item"><x></x><x></x><x></x></div><a></a></div>
<div class="grid"><div class="item pbox p"><x></x><x></x><x></x></div><a></a></div>
<div class="grid"><div class="item c1 p"><x></x><x></x><x></x></div><a></a></div>
<div class="grid"><div class="item c1 pbox p"><x></x><x></x><x></x></div><a></a></div>
<div class="grid"><div class="item c2 pbox p"><x></x><x></x><x></x></div><a></a></div>
<div class="grid"><div class="item pbox b"><x></x><x></x><x></x></div><a></a></div>
<div class="grid"><div class="item pbox p b"><x></x><x></x><x></x></div><a></a></div>
<div class="grid"><div class="item c1 pbox p b"><x></x><x></x><x></x></div><a></a></div>
<div class="grid"><div class="item c2 pbox p b"><x></x><x></x><x></x></div><a></a></div>
</div>
<div style="float:left" class="minw">
<div class="grid"><div class="item"><x></x><x></x><x></x></div><a></a></div>
<div class="grid"><div class="item pbox p"><x></x><x></x><x></x></div><a></a></div>
<div class="grid"><div class="item c1 p"><x></x><x></x><x></x></div><a></a></div>
<div class="grid"><div class="item c1 pbox p"><x></x><x></x><x></x></div><a></a></div>
<div class="grid"><div class="item c2 pbox p"><x></x><x></x><x></x></div><a></a></div>
<div class="grid"><div class="item pbox b"><x></x><x></x><x></x></div><a></a></div>
<div class="grid"><div class="item pbox p b"><x></x><x></x><x></x></div><a></a></div>
<div class="grid"><div class="item c1 pbox p b"><x></x><x></x><x></x></div><a></a></div>
<div class="grid"><div class="item c2 pbox p b"><x></x><x></x><x></x></div><a></a></div>
</div>
<div style="float:left">
<div class="grid"><div class="item pbox m"><x></x><x></x><x></x></div><a></a></div>
<div class="grid"><div class="item c1 pbox m"><x></x><x></x><x></x></div><a></a></div>
<div class="grid"><div class="item c2 pbox m"><x></x><x></x><x></x></div><a></a></div>
<div class="grid"><div class="item pbox p m"><x></x><x></x><x></x></div><a></a></div>
<div class="grid"><div class="item pbox p b m"><x></x><x></x><x></x></div><a></a></div>
<div class="grid"><div class="item c2 pbox p b m"><x></x><x></x><x></x></div><a></a></div>
</div>
<br clear="all">
<div style="float:left" class="maxw">
<div class="grid"><div class="item pbox m"><x></x><x></x><x></x></div><a></a></div>
<div class="grid"><div class="item c1 pbox m"><x></x><x></x><x></x></div><a></a></div>
<div class="grid"><div class="item c2 pbox m"><x></x><x></x><x></x></div><a></a></div>
<div class="grid"><div class="item pbox p m"><x></x><x></x><x></x></div><a></a></div>
<div class="grid"><div class="item pbox p b m"><x></x><x></x><x></x></div><a></a></div>
<div class="grid"><div class="item c2 pbox p b m"><x></x><x></x><x></x></div><a></a></div>
</div>
<div style="float:left" class="minw">
<div class="grid"><div class="item pbox m"><x></x><x></x><x></x></div><a></a></div>
<div class="grid"><div class="item c1 pbox m"><x></x><x></x><x></x></div><a></a></div>
<div class="grid"><div class="item c2 pbox m"><x></x><x></x><x></x></div><a></a></div>
<div class="grid"><div class="item pbox p m"><x></x><x></x><x></x></div><a></a></div>
<div class="grid"><div class="item pbox p b m"><x></x><x></x><x></x></div><a></a></div>
<div class="grid"><div class="item c2 pbox p b m"><x></x><x></x><x></x></div><a></a></div>
</div>
<script>
var grids = [].slice.call(document.querySelectorAll('.grid'));
grids.forEach((grid) => {
console.log(window.getComputedStyle(grid).gridTemplateRows);
});
</script>
</body>
</html>

View File

@ -0,0 +1,134 @@
<!DOCTYPE html>
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<html><head>
<title>Reference: Testing grid item percent sizes</title>
<link rel="author" title="Mats Palmgren" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1330380">
<meta charset="utf-8">
<style type="text/css">
body,html { color:black; background:white; font:16px/1 monospace; padding:0; margin:0; }
* { vertical-align:top; line-height:4px; }
.grid {
display: inline-grid;
position: relative;
background-color: grey;
grid-template-rows: 50px 100px;
justify-items: start;
align-items: start;
clear: both;
}
.item {
background: pink;
grid-area: 1 / 1 / 2 / 2;
background-clip: content-box;
min-width: 0;
min-height: 0;
z-index: 1;
writing-mode: vertical-rl;
}
.c1 {
width: 40%;
height: 90px;
grid-area: 1 / 1 / 3 / 3;
}
.c2 {
grid-area: 1 / 1 / 3 / 3;
}
.pbox {
box-sizing: border-box;
}
.maxw .item { max-height: 50%; }
.minw .item { min-height: 50%; }
.p { padding:3px 5px 10% 20%; }
.m { margin:3px 5px 10% 10%; }
.b { border:solid black; }
x { display:inline-block; width:10px; height:4px; background: silver; }
a {
grid-area: 1 / 1 / 2 / 2;
width:100%; height:100%;
background: blue;
}
</style>
</head>
<body>
<div style="float:left">
<div class="grid" style="grid-template-columns:calc(10px)"><div class="item"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-columns:calc(18.75px)"><div class="item pbox p"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-columns:0 calc(43.75px)"><div class="item c1 p"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-columns:0 calc(43.75px)"><div class="item c1 pbox p"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-columns:0 calc(18.75px)"><div class="item c2 pbox p"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-columns:calc(16px)"><div class="item pbox b"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-columns:calc(26.25px)"><div class="item pbox p b"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-columns:0 calc(51.25px)"><div class="item c1 pbox p b"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-columns:0 calc(26.25px)"><div class="item c2 pbox p b"><x></x><x></x><x></x></div><a></a></div>
</div>
<br clear="all">
<div style="float:left" class="maxw">
<div class="grid" style="grid-template-columns:calc(30px)"><div class="item"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-columns:calc(43.75px)"><div class="item pbox p"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-columns:0 calc(43.75px)"><div class="item c1 p"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-columns:0 calc(43.75px)"><div class="item c1 pbox p"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-columns:0 calc(43.75px)"><div class="item c2 pbox p"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-columns:calc(36px)"><div class="item pbox b"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-columns:calc(51.25px)"><div class="item pbox p b"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-columns:0 calc(51.25px)"><div class="item c1 pbox p b"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-columns:0 calc(51.25px)"><div class="item c2 pbox p b"><x></x><x></x><x></x></div><a></a></div>
</div>
<br clear="all">
<div style="float:left" class="minw">
<div class="grid" style="grid-template-columns:calc(10px)"><div class="item"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-columns:calc(18.75px)"><div class="item pbox p"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-columns:0 calc(43.75px)"><div class="item c1 p"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-columns:0 calc(43.75px)"><div class="item c1 pbox p"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-columns:0 calc(18.75px)"><div class="item c2 pbox p"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-columns:calc(16px)"><div class="item pbox b"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-columns:calc(26.25px)"><div class="item pbox p b"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-columns:0 calc(51.25px)"><div class="item c1 pbox p b"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-columns:0 calc(26.25px)"><div class="item c2 pbox p b"><x></x><x></x><x></x></div><a></a></div>
</div>
<div style="float:left">
<div class="grid" style="grid-template-columns:calc(15px/.9)"><div class="item pbox m"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-columns:0 calc(35px/.9)"><div class="item c1 pbox m"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-columns:0 calc(15px/.9)"><div class="item c2 pbox m"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-columns:calc(20px/.7)"><div class="item pbox p m"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-columns:calc(37.15px)"><div class="item pbox p b m"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-columns:0 calc(37.15px)"><div class="item c2 pbox p b m"><x></x><x></x><x></x></div><a></a></div>
</div>
<br clear="all">
<div style="float:left" class="maxw">
<div class="grid" style="grid-template-columns:calc(35px/.9)"><div class="item pbox m"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-columns:0 calc(35px/.9)"><div class="item c1 pbox m"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-columns:0 calc(35px/.9)"><div class="item c2 pbox m"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-columns:calc(57.15px)"><div class="item pbox p m"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-columns:calc(46px/.7)"><div class="item pbox p b m"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-columns:0 calc(46px/.7)"><div class="item c2 pbox p b m"><x></x><x></x><x></x></div><a></a></div>
</div>
<div style="float:left" class="minw">
<div class="grid" style="grid-template-columns:calc(15px/.9)"><div class="item pbox m"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-columns:0 calc(35px/.9)"><div class="item c1 pbox m"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-columns:0 calc(15px/.9)"><div class="item c2 pbox m"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-columns:calc(20px/.7)"><div class="item pbox p m"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-columns:calc(37.15px)"><div class="item pbox p b m"><x></x><x></x><x></x></div><a></a></div>
<div class="grid" style="grid-template-columns:0 calc(37.15px)"><div class="item c2 pbox p b m"><x></x><x></x><x></x></div><a></a></div>
</div>
</body>
</html>

Some files were not shown because too many files have changed in this diff Show More