зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1339394 - Don't serialize transparent color to transparent keyword when not necessary. r=heycam,jaws
MozReview-Commit-ID: 59cmaCoFJMR --HG-- extra : source : d4ae926f5c056e734f4ecc035fab25f5ea7b6ac1
This commit is contained in:
Родитель
b35eaa5cbb
Коммит
8beb97c7da
|
@ -269,7 +269,7 @@ function buildDefaultTextAttrs(aID, aFontSize, aFontWeight, aFontFamily)
|
||||||
{
|
{
|
||||||
var elm = getNode(aID);
|
var elm = getNode(aID);
|
||||||
var computedStyle = document.defaultView.getComputedStyle(elm);
|
var computedStyle = document.defaultView.getComputedStyle(elm);
|
||||||
var bgColor = computedStyle.backgroundColor == "transparent" ?
|
var bgColor = computedStyle.backgroundColor == "rgba(0, 0, 0, 0)" ?
|
||||||
"rgb(255, 255, 255)" : computedStyle.backgroundColor;
|
"rgb(255, 255, 255)" : computedStyle.backgroundColor;
|
||||||
|
|
||||||
var defAttrs = {
|
var defAttrs = {
|
||||||
|
|
|
@ -90,9 +90,9 @@ const PAGECONTENT_COLORS =
|
||||||
' <option value="One" style="color: #fff; background-color: #f00;">{"color": "rgb(255, 255, 255)", "backgroundColor": "rgb(255, 0, 0)"}</option>' +
|
' <option value="One" style="color: #fff; background-color: #f00;">{"color": "rgb(255, 255, 255)", "backgroundColor": "rgb(255, 0, 0)"}</option>' +
|
||||||
' <option value="Two" class="blue">{"color": "rgb(255, 255, 255)", "backgroundColor": "rgb(0, 0, 255)"}</option>' +
|
' <option value="Two" class="blue">{"color": "rgb(255, 255, 255)", "backgroundColor": "rgb(0, 0, 255)"}</option>' +
|
||||||
' <option value="Three" class="green">{"color": "rgb(128, 0, 128)", "backgroundColor": "rgb(0, 128, 0)"}</option>' +
|
' <option value="Three" class="green">{"color": "rgb(128, 0, 128)", "backgroundColor": "rgb(0, 128, 0)"}</option>' +
|
||||||
' <option value="Four" class="defaultColor defaultBackground">{"color": "-moz-ComboboxText", "backgroundColor": "transparent", "unstyled": "true"}</option>' +
|
' <option value="Four" class="defaultColor defaultBackground">{"color": "-moz-ComboboxText", "backgroundColor": "rgba(0, 0, 0, 0)", "unstyled": "true"}</option>' +
|
||||||
' <option value="Five" class="defaultColor">{"color": "-moz-ComboboxText", "backgroundColor": "transparent", "unstyled": "true"}</option>' +
|
' <option value="Five" class="defaultColor">{"color": "-moz-ComboboxText", "backgroundColor": "rgba(0, 0, 0, 0)", "unstyled": "true"}</option>' +
|
||||||
' <option value="Six" class="defaultBackground">{"color": "-moz-ComboboxText", "backgroundColor": "transparent", "unstyled": "true"}</option>' +
|
' <option value="Six" class="defaultBackground">{"color": "-moz-ComboboxText", "backgroundColor": "rgba(0, 0, 0, 0)", "unstyled": "true"}</option>' +
|
||||||
' <option value="Seven" selected="true">{"unstyled": "true"}</option>' +
|
' <option value="Seven" selected="true">{"unstyled": "true"}</option>' +
|
||||||
"</select></body></html>";
|
"</select></body></html>";
|
||||||
|
|
||||||
|
@ -101,9 +101,9 @@ const PAGECONTENT_COLORS_ON_SELECT =
|
||||||
" #one { background-color: #7E3A3A; color: #fff }" +
|
" #one { background-color: #7E3A3A; color: #fff }" +
|
||||||
"</style>" +
|
"</style>" +
|
||||||
"<body><select id='one'>" +
|
"<body><select id='one'>" +
|
||||||
' <option value="One">{"color": "rgb(255, 255, 255)", "backgroundColor": "transparent"}</option>' +
|
' <option value="One">{"color": "rgb(255, 255, 255)", "backgroundColor": "rgba(0, 0, 0, 0)"}</option>' +
|
||||||
' <option value="Two">{"color": "rgb(255, 255, 255)", "backgroundColor": "transparent"}</option>' +
|
' <option value="Two">{"color": "rgb(255, 255, 255)", "backgroundColor": "rgba(0, 0, 0, 0)"}</option>' +
|
||||||
' <option value="Three">{"color": "rgb(255, 255, 255)", "backgroundColor": "transparent"}</option>' +
|
' <option value="Three">{"color": "rgb(255, 255, 255)", "backgroundColor": "rgba(0, 0, 0, 0)"}</option>' +
|
||||||
' <option value="Four" selected="true">{"end": "true"}</option>' +
|
' <option value="Four" selected="true">{"end": "true"}</option>' +
|
||||||
"</select></body></html>";
|
"</select></body></html>";
|
||||||
|
|
||||||
|
|
|
@ -46,10 +46,10 @@ function reallyRunTests() {
|
||||||
|
|
||||||
switch (colorChangeNotifications) {
|
switch (colorChangeNotifications) {
|
||||||
case 1:
|
case 1:
|
||||||
is(message.data.color, "transparent", "first window initial");
|
is(message.data.color, "rgba(0, 0, 0, 0)", "first window initial");
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
is(message.data.color, "transparent", "second window initial");
|
is(message.data.color, "rgba(0, 0, 0, 0)", "second window initial");
|
||||||
runOtherWindowTests();
|
runOtherWindowTests();
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
|
@ -61,17 +61,17 @@ function reallyRunTests() {
|
||||||
otherWindow.close();
|
otherWindow.close();
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
is(message.data.color, "transparent", "first window raised");
|
is(message.data.color, "rgba(0, 0, 0, 0)", "first window raised");
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
is(message.data.color, "transparent", "second window raised");
|
is(message.data.color, "rgba(0, 0, 0, 0)", "second window raised");
|
||||||
gBrowser.selectedTab = tab2;
|
gBrowser.selectedTab = tab2;
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
is(message.data.color, "transparent", "first window after tab switch");
|
is(message.data.color, "rgba(0, 0, 0, 0)", "first window after tab switch");
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
is(message.data.color, "transparent", "second window after tab switch");
|
is(message.data.color, "rgba(0, 0, 0, 0)", "second window after tab switch");
|
||||||
finishTest();
|
finishTest();
|
||||||
break;
|
break;
|
||||||
case 9:
|
case 9:
|
||||||
|
|
|
@ -22,7 +22,7 @@ add_task(function* testPageActionPopup() {
|
||||||
"popup-a.js": function() {
|
"popup-a.js": function() {
|
||||||
window.onload = () => {
|
window.onload = () => {
|
||||||
let background = window.getComputedStyle(document.body).backgroundColor;
|
let background = window.getComputedStyle(document.body).backgroundColor;
|
||||||
browser.test.assertEq("transparent", background);
|
browser.test.assertEq("rgba(0, 0, 0, 0)", background);
|
||||||
browser.runtime.sendMessage("from-popup-a");
|
browser.runtime.sendMessage("from-popup-a");
|
||||||
};
|
};
|
||||||
browser.runtime.onMessage.addListener(msg => {
|
browser.runtime.onMessage.addListener(msg => {
|
||||||
|
|
|
@ -13,7 +13,7 @@ add_task(function* testExecuteScript() {
|
||||||
async function background() {
|
async function background() {
|
||||||
let tasks = [
|
let tasks = [
|
||||||
{
|
{
|
||||||
background: "transparent",
|
background: "rgba(0, 0, 0, 0)",
|
||||||
foreground: "rgb(0, 113, 4)",
|
foreground: "rgb(0, 113, 4)",
|
||||||
promise: () => {
|
promise: () => {
|
||||||
return browser.tabs.insertCSS({
|
return browser.tabs.insertCSS({
|
||||||
|
|
|
@ -9,7 +9,7 @@ add_task(function* testExecuteScript() {
|
||||||
let tasks = [
|
let tasks = [
|
||||||
// Insert CSS file.
|
// Insert CSS file.
|
||||||
{
|
{
|
||||||
background: "transparent",
|
background: "rgba(0, 0, 0, 0)",
|
||||||
foreground: "rgb(0, 113, 4)",
|
foreground: "rgb(0, 113, 4)",
|
||||||
promise: () => {
|
promise: () => {
|
||||||
return browser.tabs.insertCSS({
|
return browser.tabs.insertCSS({
|
||||||
|
@ -29,7 +29,7 @@ add_task(function* testExecuteScript() {
|
||||||
},
|
},
|
||||||
// Remove CSS code again.
|
// Remove CSS code again.
|
||||||
{
|
{
|
||||||
background: "transparent",
|
background: "rgba(0, 0, 0, 0)",
|
||||||
foreground: "rgb(0, 113, 4)",
|
foreground: "rgb(0, 113, 4)",
|
||||||
promise: () => {
|
promise: () => {
|
||||||
return browser.tabs.removeCSS({
|
return browser.tabs.removeCSS({
|
||||||
|
@ -39,7 +39,7 @@ add_task(function* testExecuteScript() {
|
||||||
},
|
},
|
||||||
// Remove CSS file again.
|
// Remove CSS file again.
|
||||||
{
|
{
|
||||||
background: "transparent",
|
background: "rgba(0, 0, 0, 0)",
|
||||||
foreground: "rgb(0, 0, 0)",
|
foreground: "rgb(0, 0, 0)",
|
||||||
promise: () => {
|
promise: () => {
|
||||||
return browser.tabs.removeCSS({
|
return browser.tabs.removeCSS({
|
||||||
|
@ -60,7 +60,7 @@ add_task(function* testExecuteScript() {
|
||||||
},
|
},
|
||||||
// Remove CSS code again.
|
// Remove CSS code again.
|
||||||
{
|
{
|
||||||
background: "transparent",
|
background: "rgba(0, 0, 0, 0)",
|
||||||
foreground: "rgb(0, 0, 0)",
|
foreground: "rgb(0, 0, 0)",
|
||||||
promise: () => {
|
promise: () => {
|
||||||
return browser.tabs.removeCSS({
|
return browser.tabs.removeCSS({
|
||||||
|
|
|
@ -56,7 +56,7 @@ add_task(function* () {
|
||||||
info("Disabling the first property too and checking the applied style");
|
info("Disabling the first property too and checking the applied style");
|
||||||
yield togglePropStatus(view, firstProp);
|
yield togglePropStatus(view, firstProp);
|
||||||
|
|
||||||
is((yield getValue("#testid", "background-color")), "transparent",
|
is((yield getValue("#testid", "background-color")), "rgba(0, 0, 0, 0)",
|
||||||
"After disabling both properties, value should be empty.");
|
"After disabling both properties, value should be empty.");
|
||||||
|
|
||||||
info("Re-enabling the second propertyt and checking the applied style");
|
info("Re-enabling the second propertyt and checking the applied style");
|
||||||
|
|
|
@ -100,7 +100,7 @@ function runTest2() {
|
||||||
seenLoadEnd = true;
|
seenLoadEnd = true;
|
||||||
ok(seenLoadStart, 'Load end after load start.');
|
ok(seenLoadStart, 'Load end after load start.');
|
||||||
ok(seenLocationChange, 'Load end after location change.');
|
ok(seenLocationChange, 'Load end after location change.');
|
||||||
is(e.detail.backgroundColor, 'transparent', 'Expected background color reported')
|
is(e.detail.backgroundColor, 'rgba(0, 0, 0, 0)', 'Expected background color reported')
|
||||||
});
|
});
|
||||||
|
|
||||||
iframe.src = browserElementTestHelpers.emptyPage2;
|
iframe.src = browserElementTestHelpers.emptyPage2;
|
||||||
|
|
|
@ -41,7 +41,7 @@ function checkResultsBlocked() {
|
||||||
// stylesheet: default background color within FF is transparent
|
// stylesheet: default background color within FF is transparent
|
||||||
var bgcolor = window.getComputedStyle(writemetacspframe.contentDocument.body)
|
var bgcolor = window.getComputedStyle(writemetacspframe.contentDocument.body)
|
||||||
.getPropertyValue("background-color");
|
.getPropertyValue("background-color");
|
||||||
is(bgcolor, "transparent", "inital background value in FF should be 'transparent'");
|
is(bgcolor, "rgba(0, 0, 0, 0)", "inital background value in FF should be 'transparent'");
|
||||||
|
|
||||||
// image: make sure image is blocked
|
// image: make sure image is blocked
|
||||||
var img = writemetacspframe.contentDocument.getElementById("testimage");
|
var img = writemetacspframe.contentDocument.getElementById("testimage");
|
||||||
|
|
|
@ -44,9 +44,9 @@
|
||||||
}},
|
}},
|
||||||
|
|
||||||
testDisposesProperly: function() { with(this) {
|
testDisposesProperly: function() { with(this) {
|
||||||
assertEqual("transparent", Element.getStyle('tobeedited','background-color'));
|
assertEqual("rgba(0, 0, 0, 0)", Element.getStyle('tobeedited','background-color'));
|
||||||
inPlaceEditor.dispose();
|
inPlaceEditor.dispose();
|
||||||
assertEqual("transparent", Element.getStyle('tobeedited','background-color'));
|
assertEqual("rgba(0, 0, 0, 0)", Element.getStyle('tobeedited','background-color'));
|
||||||
assertVisible($('tobeedited'));
|
assertVisible($('tobeedited'));
|
||||||
Event.simulateMouse('tobeedited','click');
|
Event.simulateMouse('tobeedited','click');
|
||||||
assertVisible($('tobeedited'));
|
assertVisible($('tobeedited'));
|
||||||
|
@ -84,7 +84,7 @@
|
||||||
testCantEditWhileSaving: function() { with(this) {
|
testCantEditWhileSaving: function() { with(this) {
|
||||||
inPlaceEditor.onLoading();
|
inPlaceEditor.onLoading();
|
||||||
Event.simulateMouse('tobeedited','mouseover');
|
Event.simulateMouse('tobeedited','mouseover');
|
||||||
assertEqual("transparent", Element.getStyle('tobeedited','background-color'));
|
assertEqual("rgba(0, 0, 0, 0)", Element.getStyle('tobeedited','background-color'));
|
||||||
Event.simulateMouse('tobeedited','click');
|
Event.simulateMouse('tobeedited','click');
|
||||||
assertVisible($('tobeedited'));
|
assertVisible($('tobeedited'));
|
||||||
}},
|
}},
|
||||||
|
|
|
@ -1660,38 +1660,31 @@ nsCSSValue::AppendToString(nsCSSPropertyID aProperty, nsAString& aResult,
|
||||||
unit == eCSSUnit_RGBColor ||
|
unit == eCSSUnit_RGBColor ||
|
||||||
unit == eCSSUnit_RGBAColor) {
|
unit == eCSSUnit_RGBAColor) {
|
||||||
nscolor color = GetColorValue();
|
nscolor color = GetColorValue();
|
||||||
if (aSerialization == eNormalized &&
|
// For brevity, we omit the alpha component if it's equal to 255 (full
|
||||||
color == NS_RGBA(0, 0, 0, 0)) {
|
// opaque). Also, we try to preserve the author-specified function name,
|
||||||
// Use the strictest match for 'transparent' so we do correct
|
// unless it's rgba() and we're omitting the alpha component - then we
|
||||||
// round-tripping of all other rgba() values.
|
// use rgb().
|
||||||
aResult.AppendLiteral("transparent");
|
uint8_t a = NS_GET_A(color);
|
||||||
|
bool showAlpha = (a != 255);
|
||||||
|
|
||||||
|
if (unit == eCSSUnit_RGBAColor && showAlpha) {
|
||||||
|
aResult.AppendLiteral("rgba(");
|
||||||
} else {
|
} else {
|
||||||
// For brevity, we omit the alpha component if it's equal to 255 (full
|
aResult.AppendLiteral("rgb(");
|
||||||
// opaque). Also, we try to preserve the author-specified function name,
|
|
||||||
// unless it's rgba() and we're omitting the alpha component - then we
|
|
||||||
// use rgb().
|
|
||||||
uint8_t a = NS_GET_A(color);
|
|
||||||
bool showAlpha = (a != 255);
|
|
||||||
|
|
||||||
if (unit == eCSSUnit_RGBAColor && showAlpha) {
|
|
||||||
aResult.AppendLiteral("rgba(");
|
|
||||||
} else {
|
|
||||||
aResult.AppendLiteral("rgb(");
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_NAMED_LITERAL_STRING(comma, ", ");
|
|
||||||
|
|
||||||
aResult.AppendInt(NS_GET_R(color), 10);
|
|
||||||
aResult.Append(comma);
|
|
||||||
aResult.AppendInt(NS_GET_G(color), 10);
|
|
||||||
aResult.Append(comma);
|
|
||||||
aResult.AppendInt(NS_GET_B(color), 10);
|
|
||||||
if (showAlpha) {
|
|
||||||
aResult.Append(comma);
|
|
||||||
aResult.AppendFloat(nsStyleUtil::ColorComponentToFloat(a));
|
|
||||||
}
|
|
||||||
aResult.Append(char16_t(')'));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_NAMED_LITERAL_STRING(comma, ", ");
|
||||||
|
|
||||||
|
aResult.AppendInt(NS_GET_R(color), 10);
|
||||||
|
aResult.Append(comma);
|
||||||
|
aResult.AppendInt(NS_GET_G(color), 10);
|
||||||
|
aResult.Append(comma);
|
||||||
|
aResult.AppendInt(NS_GET_B(color), 10);
|
||||||
|
if (showAlpha) {
|
||||||
|
aResult.Append(comma);
|
||||||
|
aResult.AppendFloat(nsStyleUtil::ColorComponentToFloat(a));
|
||||||
|
}
|
||||||
|
aResult.Append(char16_t(')'));
|
||||||
} else if (eCSSUnit_HexColor == unit ||
|
} else if (eCSSUnit_HexColor == unit ||
|
||||||
eCSSUnit_HexColorAlpha == unit) {
|
eCSSUnit_HexColorAlpha == unit) {
|
||||||
nscolor color = GetColorValue();
|
nscolor color = GetColorValue();
|
||||||
|
|
|
@ -1116,11 +1116,6 @@ void
|
||||||
nsComputedDOMStyle::SetToRGBAColor(nsROCSSPrimitiveValue* aValue,
|
nsComputedDOMStyle::SetToRGBAColor(nsROCSSPrimitiveValue* aValue,
|
||||||
nscolor aColor)
|
nscolor aColor)
|
||||||
{
|
{
|
||||||
if (NS_GET_A(aColor) == 0) {
|
|
||||||
aValue->SetIdent(eCSSKeyword_transparent);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsROCSSPrimitiveValue *red = new nsROCSSPrimitiveValue;
|
nsROCSSPrimitiveValue *red = new nsROCSSPrimitiveValue;
|
||||||
nsROCSSPrimitiveValue *green = new nsROCSSPrimitiveValue;
|
nsROCSSPrimitiveValue *green = new nsROCSSPrimitiveValue;
|
||||||
nsROCSSPrimitiveValue *blue = new nsROCSSPrimitiveValue;
|
nsROCSSPrimitiveValue *blue = new nsROCSSPrimitiveValue;
|
||||||
|
|
|
@ -65,7 +65,7 @@ function step1() {
|
||||||
synthesizeMouse(divone, 5, 7, moveEvent, window);
|
synthesizeMouse(divone, 5, 7, moveEvent, window);
|
||||||
is(getComputedStyle(divone, "").backgroundColor, "rgb(0, 0, 255)",
|
is(getComputedStyle(divone, "").backgroundColor, "rgb(0, 0, 255)",
|
||||||
":hover applies");
|
":hover applies");
|
||||||
is(getComputedStyle(divone.firstChild, "").backgroundColor, "transparent",
|
is(getComputedStyle(divone.firstChild, "").backgroundColor, "rgba(0, 0, 0, 0)",
|
||||||
":hover does not apply");
|
":hover does not apply");
|
||||||
synthesizeMouse(divone, 5, 2, moveEvent, window);
|
synthesizeMouse(divone, 5, 2, moveEvent, window);
|
||||||
is(getComputedStyle(divone, "").backgroundColor, "rgb(0, 0, 255)",
|
is(getComputedStyle(divone, "").backgroundColor, "rgb(0, 0, 255)",
|
||||||
|
@ -73,9 +73,9 @@ function step1() {
|
||||||
is(getComputedStyle(divone.firstChild, "").backgroundColor, "rgb(255, 0, 0)",
|
is(getComputedStyle(divone.firstChild, "").backgroundColor, "rgb(255, 0, 0)",
|
||||||
":hover applies");
|
":hover applies");
|
||||||
synthesizeMouse(divone, 15, 7, moveEvent, window);
|
synthesizeMouse(divone, 15, 7, moveEvent, window);
|
||||||
is(getComputedStyle(divone, "").backgroundColor, "transparent",
|
is(getComputedStyle(divone, "").backgroundColor, "rgba(0, 0, 0, 0)",
|
||||||
":hover does not apply");
|
":hover does not apply");
|
||||||
is(getComputedStyle(divone.firstChild, "").backgroundColor, "transparent",
|
is(getComputedStyle(divone.firstChild, "").backgroundColor, "rgba(0, 0, 0, 0)",
|
||||||
":hover does not apply");
|
":hover does not apply");
|
||||||
synthesizeMouse(divone, 15, 2, moveEvent, window);
|
synthesizeMouse(divone, 15, 2, moveEvent, window);
|
||||||
is(getComputedStyle(divone, "").backgroundColor, "rgb(0, 0, 255)",
|
is(getComputedStyle(divone, "").backgroundColor, "rgb(0, 0, 255)",
|
||||||
|
@ -115,7 +115,7 @@ function step3() {
|
||||||
step4();
|
step4();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
is(getComputedStyle(divtwo, "").backgroundColor, "transparent",
|
is(getComputedStyle(divtwo, "").backgroundColor, "rgba(0, 0, 0, 0)",
|
||||||
":hover does not apply");
|
":hover does not apply");
|
||||||
setResize("step4()");
|
setResize("step4()");
|
||||||
/* expect to get a second resize from the oscillation */
|
/* expect to get a second resize from the oscillation */
|
||||||
|
@ -144,7 +144,7 @@ var step6called = false;
|
||||||
function step6() {
|
function step6() {
|
||||||
is(step6called, false, "step6 called only once");
|
is(step6called, false, "step6 called only once");
|
||||||
step6called = true;
|
step6called = true;
|
||||||
is(getComputedStyle(divtwo, "").backgroundColor, "transparent",
|
is(getComputedStyle(divtwo, "").backgroundColor, "rgba(0, 0, 0, 0)",
|
||||||
":hover does not apply");
|
":hover does not apply");
|
||||||
synthesizeMouse(divtwoparent, 2, 5, moveEvent, window);
|
synthesizeMouse(divtwoparent, 2, 5, moveEvent, window);
|
||||||
setTimeout(step7, 500); // time to detect oscillations if they exist
|
setTimeout(step7, 500); // time to detect oscillations if they exist
|
||||||
|
@ -156,7 +156,7 @@ function step7() {
|
||||||
if (step7called)
|
if (step7called)
|
||||||
return;
|
return;
|
||||||
step7called = true;
|
step7called = true;
|
||||||
is(getComputedStyle(divtwo, "").backgroundColor, "transparent",
|
is(getComputedStyle(divtwo, "").backgroundColor, "rgba(0, 0, 0, 0)",
|
||||||
":hover does not apply");
|
":hover does not apply");
|
||||||
setTimeout(step8, 500); // time to detect oscillations if they exist
|
setTimeout(step8, 500); // time to detect oscillations if they exist
|
||||||
}
|
}
|
||||||
|
@ -195,7 +195,7 @@ function step10() {
|
||||||
step11();
|
step11();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
is(getComputedStyle(divtwo, "").backgroundColor, "transparent",
|
is(getComputedStyle(divtwo, "").backgroundColor, "rgba(0, 0, 0, 0)",
|
||||||
":hover does not apply");
|
":hover does not apply");
|
||||||
setResize("step11()");
|
setResize("step11()");
|
||||||
/* expect to get a second resize from the oscillation */
|
/* expect to get a second resize from the oscillation */
|
||||||
|
@ -224,7 +224,7 @@ var step13called = false;
|
||||||
function step13() {
|
function step13() {
|
||||||
is(step13called, false, "step13 called only once");
|
is(step13called, false, "step13 called only once");
|
||||||
step13called = true;
|
step13called = true;
|
||||||
is(getComputedStyle(divtwo, "").backgroundColor, "transparent",
|
is(getComputedStyle(divtwo, "").backgroundColor, "rgba(0, 0, 0, 0)",
|
||||||
":hover does not apply");
|
":hover does not apply");
|
||||||
setResize("step14()");
|
setResize("step14()");
|
||||||
divtwoparent.scrollLeft = 0; /* mouse now over 2,5 */
|
divtwoparent.scrollLeft = 0; /* mouse now over 2,5 */
|
||||||
|
@ -251,7 +251,7 @@ function step15() {
|
||||||
if (step15called)
|
if (step15called)
|
||||||
return;
|
return;
|
||||||
step15called = true;
|
step15called = true;
|
||||||
is(getComputedStyle(divtwo, "").backgroundColor, "transparent",
|
is(getComputedStyle(divtwo, "").backgroundColor, "rgba(0, 0, 0, 0)",
|
||||||
":hover does not apply");
|
":hover does not apply");
|
||||||
setTimeout(finish, 500); // time to detect oscillations if they exist
|
setTimeout(finish, 500); // time to detect oscillations if they exist
|
||||||
}
|
}
|
||||||
|
|
|
@ -2235,8 +2235,8 @@ var gCSSProperties = {
|
||||||
domProp: "backgroundColor",
|
domProp: "backgroundColor",
|
||||||
inherited: false,
|
inherited: false,
|
||||||
type: CSS_TYPE_LONGHAND,
|
type: CSS_TYPE_LONGHAND,
|
||||||
initial_values: [ "transparent", "rgba(255, 127, 15, 0)", "hsla(240, 97%, 50%, 0.0)", "rgba(0, 0, 0, 0)", "rgba(255,255,255,-3.7)" ],
|
initial_values: [ "transparent", "rgba(0, 0, 0, 0)" ],
|
||||||
other_values: [ "green", "rgb(255, 0, 128)", "#fc2", "#96ed2a", "black", "rgba(255,255,0,3)", "hsl(240, 50%, 50%)", "rgb(50%, 50%, 50%)", "-moz-default-background-color", "rgb(100, 100.0, 100)" ],
|
other_values: [ "green", "rgb(255, 0, 128)", "#fc2", "#96ed2a", "black", "rgba(255,255,0,3)", "hsl(240, 50%, 50%)", "rgb(50%, 50%, 50%)", "-moz-default-background-color", "rgb(100, 100.0, 100)", "rgba(255, 127, 15, 0)", "hsla(240, 97%, 50%, 0.0)", "rgba(255,255,255,-3.7)" ],
|
||||||
invalid_values: [ "#0", "#00", "#00000", "#0000000", "#000000000", "rgb(100, 100%, 100)" ],
|
invalid_values: [ "#0", "#00", "#00000", "#0000000", "#000000000", "rgb(100, 100%, 100)" ],
|
||||||
quirks_values: { "000000": "#000000", "96ed2a": "#96ed2a" },
|
quirks_values: { "000000": "#000000", "96ed2a": "#96ed2a" },
|
||||||
},
|
},
|
||||||
|
|
|
@ -205,7 +205,7 @@ function loadAndCheck(win, firstType, secondType, swap, result1, result2)
|
||||||
secondType.removeRules(win, secondStyle);
|
secondType.removeRules(win, secondStyle);
|
||||||
|
|
||||||
is(cs.getPropertyValue('color'), 'rgb(0, 0, 0)', firstType.type + " vs " + secondType.type + " 3");
|
is(cs.getPropertyValue('color'), 'rgb(0, 0, 0)', firstType.type + " vs " + secondType.type + " 3");
|
||||||
is(cs.getPropertyValue('background-color'), 'transparent', firstType.type + " vs " + secondType.type + " 4");
|
is(cs.getPropertyValue('background-color'), 'rgba(0, 0, 0, 0)', firstType.type + " vs " + secondType.type + " 4");
|
||||||
}
|
}
|
||||||
|
|
||||||
// There are 8 cases. Regular against regular, regular against important, important
|
// There are 8 cases. Regular against regular, regular against important, important
|
||||||
|
|
|
@ -45,7 +45,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=229915
|
||||||
|
|
||||||
const GREEN = "rgb(0, 128, 0)";
|
const GREEN = "rgb(0, 128, 0)";
|
||||||
const BLACK = "rgb(0, 0, 0)";
|
const BLACK = "rgb(0, 0, 0)";
|
||||||
const TRANSPARENT = "transparent";
|
const TRANSPARENT = "rgba(0, 0, 0, 0)";
|
||||||
const WHITE = "rgb(255, 255, 255)";
|
const WHITE = "rgb(255, 255, 255)";
|
||||||
|
|
||||||
function make_prev() {
|
function make_prev() {
|
||||||
|
|
|
@ -35,18 +35,12 @@ for (i = 0; i < colors.length; ++i) {
|
||||||
is(style2.color, color, "Rule style color roundtripping failed at color " + i);
|
is(style2.color, color, "Rule style color roundtripping failed at color " + i);
|
||||||
}
|
}
|
||||||
|
|
||||||
// This code is only here because of bug 372783. Once that's fixed, this test
|
|
||||||
// for "rgba(0, 0, 0, 0)" will fail.
|
|
||||||
style1.color = "rgba(0, 0, 0, 0)";
|
style1.color = "rgba(0, 0, 0, 0)";
|
||||||
style2.color = "rgba(0, 0, 0, 0)";
|
style2.color = "rgba(0, 0, 0, 0)";
|
||||||
is(style1.color, "transparent",
|
is(style1.color, "rgba(0, 0, 0, 0)",
|
||||||
"Inline style should give transparent for rgba(0,0,0,0)");
|
"Inline style should round-trip black transparent color correctly");
|
||||||
is(style2.color, "transparent",
|
is(style2.color, "rgba(0, 0, 0, 0)",
|
||||||
"Rule style should give transparent for rgba(0,0,0,0)");
|
"Rule style should round-trip black transparent color correctly");
|
||||||
todo(style1.color == "rgba(0, 0, 0, 0)",
|
|
||||||
"Inline style should round-trip black transparent color correctly");
|
|
||||||
todo(style2.color == "rgba(0, 0, 0, 0)",
|
|
||||||
"Rule style should round-trip black transparent color correctly");
|
|
||||||
|
|
||||||
for (var i = 0; i <= 100; ++i) {
|
for (var i = 0; i <= 100; ++i) {
|
||||||
if (i == 70 || i == 90) {
|
if (i == 70 || i == 90) {
|
||||||
|
|
|
@ -36,7 +36,7 @@ window.addEventListener("load", function() {
|
||||||
cases.forEach(function(aCase, aIndex) {
|
cases.forEach(function(aCase, aIndex) {
|
||||||
is(window.getComputedStyle(aCase)
|
is(window.getComputedStyle(aCase)
|
||||||
.getPropertyValue("background-color"),
|
.getPropertyValue("background-color"),
|
||||||
"transparent",
|
"rgba(0, 0, 0, 0)",
|
||||||
aCase.textContent);
|
aCase.textContent);
|
||||||
});
|
});
|
||||||
SimpleTest.finish();
|
SimpleTest.finish();
|
||||||
|
|
|
@ -361,8 +361,8 @@ var noframe_container = document.getElementById("content");
|
||||||
"markerEnd" : "",
|
"markerEnd" : "",
|
||||||
"clipPath" : "",
|
"clipPath" : "",
|
||||||
"filter" : "",
|
"filter" : "",
|
||||||
"fill" : " transparent",
|
"fill" : " rgba(0, 0, 0, 0)",
|
||||||
"stroke" : " transparent",
|
"stroke" : " rgba(0, 0, 0, 0)",
|
||||||
};
|
};
|
||||||
|
|
||||||
for (var prop in testStyles) {
|
for (var prop in testStyles) {
|
||||||
|
|
|
@ -45,7 +45,7 @@ is(cs_pseudo.display, "block", "Our ::before is block");
|
||||||
// And now our actual tests
|
// And now our actual tests
|
||||||
is(cs_default.display, "block", "We have block display by default");
|
is(cs_default.display, "block", "We have block display by default");
|
||||||
is(cs_default.marginTop, "16px", "We have 16px margin by default");
|
is(cs_default.marginTop, "16px", "We have 16px margin by default");
|
||||||
is(cs_default.backgroundColor, "transparent",
|
is(cs_default.backgroundColor, "rgba(0, 0, 0, 0)",
|
||||||
"We have transparent background by default");
|
"We have transparent background by default");
|
||||||
is(cs_default.color, "rgb(0, 0, 0)", "We have black text by default");
|
is(cs_default.color, "rgb(0, 0, 0)", "We have black text by default");
|
||||||
is(cs_default_pseudo.content, "none", "We have no content by default");
|
is(cs_default_pseudo.content, "none", "We have no content by default");
|
||||||
|
|
|
@ -19,7 +19,7 @@ add_task(function* testExecuteScript() {
|
||||||
async function background() {
|
async function background() {
|
||||||
let tasks = [
|
let tasks = [
|
||||||
{
|
{
|
||||||
background: "transparent",
|
background: "rgba(0, 0, 0, 0)",
|
||||||
foreground: "rgb(0, 113, 4)",
|
foreground: "rgb(0, 113, 4)",
|
||||||
promise: () => {
|
promise: () => {
|
||||||
return browser.tabs.insertCSS({
|
return browser.tabs.insertCSS({
|
||||||
|
|
|
@ -20,4 +20,4 @@ class TestChromeElementCSS(MarionetteTestCase):
|
||||||
element = self.marionette.find_element(By.ID, "identity-box")
|
element = self.marionette.find_element(By.ID, "identity-box")
|
||||||
background_colour = element.value_of_css_property("background-color")
|
background_colour = element.value_of_css_property("background-color")
|
||||||
|
|
||||||
self.assertEqual("transparent", background_colour)
|
self.assertEqual("rgba(0, 0, 0, 0)", background_colour)
|
||||||
|
|
|
@ -102,9 +102,6 @@
|
||||||
[[["stylewithcss","false"\],["forecolor","rgb( 0 ,0 ,255)"\]\] "foo[bar\]baz" queryCommandValue("forecolor") after]
|
[[["stylewithcss","false"\],["forecolor","rgb( 0 ,0 ,255)"\]\] "foo[bar\]baz" queryCommandValue("forecolor") after]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[[["stylewithcss","true"\],["forecolor","rgba(0, 0, 255, 0.0)"\]\] "foo[bar\]baz" queryCommandValue("forecolor") after]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[[["stylewithcss","false"\],["forecolor","rgba(0, 0, 255, 0.0)"\]\] "foo[bar\]baz" compare innerHTML]
|
[[["stylewithcss","false"\],["forecolor","rgba(0, 0, 255, 0.0)"\]\] "foo[bar\]baz" compare innerHTML]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
|
@ -228,15 +225,9 @@
|
||||||
[[["stylewithcss","false"\],["forecolor","#0000FF"\]\] "<span style=\\"color: rgb( 0 ,0 ,255)\\">[foo\]</span>" compare innerHTML]
|
[[["stylewithcss","false"\],["forecolor","#0000FF"\]\] "<span style=\\"color: rgb( 0 ,0 ,255)\\">[foo\]</span>" compare innerHTML]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[[["stylewithcss","true"\],["forecolor","#0000FF"\]\] "<span style=\\"color: rgba(0, 0, 255, 0.0)\\">[foo\]</span>" queryCommandValue("forecolor") before]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[[["stylewithcss","false"\],["forecolor","#0000FF"\]\] "<span style=\\"color: rgba(0, 0, 255, 0.0)\\">[foo\]</span>" compare innerHTML]
|
[[["stylewithcss","false"\],["forecolor","#0000FF"\]\] "<span style=\\"color: rgba(0, 0, 255, 0.0)\\">[foo\]</span>" compare innerHTML]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[[["stylewithcss","false"\],["forecolor","#0000FF"\]\] "<span style=\\"color: rgba(0, 0, 255, 0.0)\\">[foo\]</span>" queryCommandValue("forecolor") before]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[[["stylewithcss","false"\],["forecolor","#0000FF"\]\] "<span style=\\"color: rgb(15, -10, 375)\\">[foo\]</span>" compare innerHTML]
|
[[["stylewithcss","false"\],["forecolor","#0000FF"\]\] "<span style=\\"color: rgb(15, -10, 375)\\">[foo\]</span>" compare innerHTML]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
|
|
|
@ -309,9 +309,15 @@
|
||||||
[[["stylewithcss","false"\],["hilitecolor","#00FFFF"\]\] "<span style=background-color:tan>fo[o<span style=background-color:transparent>b\]ar</span></span>" queryCommandValue("hilitecolor") after]
|
[[["stylewithcss","false"\],["hilitecolor","#00FFFF"\]\] "<span style=background-color:tan>fo[o<span style=background-color:transparent>b\]ar</span></span>" queryCommandValue("hilitecolor") after]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
|
[[["stylewithcss","true"\],["hilitecolor","#00FFFF"\]\] "<font size=6>[foo\]</font>" queryCommandValue("hilitecolor") after]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
[[["stylewithcss","false"\],["hilitecolor","#00FFFF"\]\] "<font size=6>[foo\]</font>" queryCommandValue("hilitecolor") after]
|
[[["stylewithcss","false"\],["hilitecolor","#00FFFF"\]\] "<font size=6>[foo\]</font>" queryCommandValue("hilitecolor") after]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
|
[[["stylewithcss","true"\],["hilitecolor","#00FFFF"\]\] "<span style=font-size:xx-large>[foo\]</span>" queryCommandValue("hilitecolor") after]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
[[["stylewithcss","false"\],["hilitecolor","#00FFFF"\]\] "<span style=font-size:xx-large>[foo\]</span>" queryCommandValue("hilitecolor") after]
|
[[["stylewithcss","false"\],["hilitecolor","#00FFFF"\]\] "<span style=font-size:xx-large>[foo\]</span>" queryCommandValue("hilitecolor") after]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
|
|
|
@ -103,7 +103,7 @@ add_task(function* test_contentscript_about_blank() {
|
||||||
let a_b = win.document.getElementById("a_b");
|
let a_b = win.document.getElementById("a_b");
|
||||||
style = a_b.contentWindow.getComputedStyle(a_b.contentDocument.body);
|
style = a_b.contentWindow.getComputedStyle(a_b.contentDocument.body);
|
||||||
is(style.color, "rgb(255, 0, 0)", "about:blank iframe text color is red");
|
is(style.color, "rgb(255, 0, 0)", "about:blank iframe text color is red");
|
||||||
is(style.backgroundColor, "transparent", "about:blank iframe background is transparent");
|
is(style.backgroundColor, "rgba(0, 0, 0, 0)", "about:blank iframe background is transparent");
|
||||||
is(style.textAlign, "right", "about:blank text is right-aligned");
|
is(style.textAlign, "right", "about:blank text is right-aligned");
|
||||||
|
|
||||||
is(count, 10, "exactly 7 more scripts ran");
|
is(count, 10, "exactly 7 more scripts ran");
|
||||||
|
|
|
@ -231,7 +231,7 @@ function populateChildren(menulist, options, selectedIndex, zoom,
|
||||||
|
|
||||||
let ruleBody = "";
|
let ruleBody = "";
|
||||||
if (option.backgroundColor &&
|
if (option.backgroundColor &&
|
||||||
option.backgroundColor != "transparent" &&
|
option.backgroundColor != "rgba(0, 0, 0, 0)" &&
|
||||||
option.backgroundColor != uaBackgroundColor) {
|
option.backgroundColor != uaBackgroundColor) {
|
||||||
ruleBody = `background-color: ${option.backgroundColor};`;
|
ruleBody = `background-color: ${option.backgroundColor};`;
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче