Bug 1723938 - Keep looking for background-colors when finding a background-image with transparent background-color. r=morgan
Differential Revision: https://phabricator.services.mozilla.com/D121770
This commit is contained in:
@@ -235,13 +235,15 @@ static Maybe<nscolor> GetBackplateColor(nsIFrame* aFrame) {
|
|||||||
if (!drawColor && !drawImage) {
|
if (!drawColor && !drawImage) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (NS_GET_A(backgroundColor) != 0) {
|
if (NS_GET_A(backgroundColor) == 0) {
|
||||||
// NOTE: We intentionally disregard the alpha channel here for the purpose
|
// Even if there's a background image, if there's no background color we
|
||||||
// of the backplate, in order to guarantee contrast.
|
// keep going up the frame tree, see bug 1723938.
|
||||||
return Some(NS_RGB(NS_GET_R(backgroundColor), NS_GET_G(backgroundColor),
|
continue;
|
||||||
NS_GET_B(backgroundColor)));
|
|
||||||
}
|
}
|
||||||
break;
|
// NOTE: We intentionally disregard the alpha channel here for the purpose
|
||||||
|
// of the backplate, in order to guarantee contrast.
|
||||||
|
return Some(NS_RGB(NS_GET_R(backgroundColor), NS_GET_G(backgroundColor),
|
||||||
|
NS_GET_B(backgroundColor)));
|
||||||
}
|
}
|
||||||
return Some(aFrame->PresContext()->DefaultBackgroundColor());
|
return Some(aFrame->PresContext()->DefaultBackgroundColor());
|
||||||
}
|
}
|
||||||
|
|||||||
15
layout/reftests/high-contrast/bg-image-div-002-ref.html
Normal file
15
layout/reftests/high-contrast/bg-image-div-002-ref.html
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<style>
|
||||||
|
.outer {
|
||||||
|
/* Invert color/background so that it has more chances to disagree with the default background-color. */
|
||||||
|
color: Menu;
|
||||||
|
background-color: MenuText;
|
||||||
|
}
|
||||||
|
.inner {
|
||||||
|
height: 100px;
|
||||||
|
width: 100px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<div class="outer">
|
||||||
|
<div class="size url">Some text</div>
|
||||||
|
</div>
|
||||||
17
layout/reftests/high-contrast/bg-image-div-002.html
Normal file
17
layout/reftests/high-contrast/bg-image-div-002.html
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<style>
|
||||||
|
.outer {
|
||||||
|
/* Invert color/background so that it has more chances to disagree with the default background-color. */
|
||||||
|
color: Menu;
|
||||||
|
background-color: MenuText;
|
||||||
|
}
|
||||||
|
.inner {
|
||||||
|
height: 100px;
|
||||||
|
width: 100px;
|
||||||
|
background-image: url("green.png");
|
||||||
|
background-size: 0 0;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<div class="outer">
|
||||||
|
<div class="size url">Some text</div>
|
||||||
|
</div>
|
||||||
@@ -27,6 +27,7 @@ test-pref(browser.display.suppress_canvas_background_image_on_forced_colors,true
|
|||||||
test-pref(browser.display.suppress_canvas_background_image_on_forced_colors,false) != bg-image-root-001.html bg-image-root-001-ref.html
|
test-pref(browser.display.suppress_canvas_background_image_on_forced_colors,false) != bg-image-root-001.html bg-image-root-001-ref.html
|
||||||
|
|
||||||
== bg-image-div-001.html bg-image-div-001-ref.html
|
== bg-image-div-001.html bg-image-div-001-ref.html
|
||||||
|
== bg-image-div-002.html bg-image-div-002-ref.html
|
||||||
|
|
||||||
needs-focus == selection-001.html selection-001-ref.html
|
needs-focus == selection-001.html selection-001-ref.html
|
||||||
pref(browser.display.document_color_use,0) needs-focus != selection-001.html selection-001-ref.html
|
pref(browser.display.document_color_use,0) needs-focus != selection-001.html selection-001-ref.html
|
||||||
|
|||||||
Reference in New Issue
Block a user