diff --git a/layout/generic/nsBlockFrame.cpp b/layout/generic/nsBlockFrame.cpp index c4f50d022b01..11c3705c29ee 100644 --- a/layout/generic/nsBlockFrame.cpp +++ b/layout/generic/nsBlockFrame.cpp @@ -235,13 +235,15 @@ static Maybe GetBackplateColor(nsIFrame* aFrame) { if (!drawColor && !drawImage) { continue; } - if (NS_GET_A(backgroundColor) != 0) { - // 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))); + if (NS_GET_A(backgroundColor) == 0) { + // Even if there's a background image, if there's no background color we + // keep going up the frame tree, see bug 1723938. + continue; } - 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()); } diff --git a/layout/reftests/high-contrast/bg-image-div-002-ref.html b/layout/reftests/high-contrast/bg-image-div-002-ref.html new file mode 100644 index 000000000000..c76530b9c448 --- /dev/null +++ b/layout/reftests/high-contrast/bg-image-div-002-ref.html @@ -0,0 +1,15 @@ + + +
+
Some text
+
diff --git a/layout/reftests/high-contrast/bg-image-div-002.html b/layout/reftests/high-contrast/bg-image-div-002.html new file mode 100644 index 000000000000..000ac7f2e5eb --- /dev/null +++ b/layout/reftests/high-contrast/bg-image-div-002.html @@ -0,0 +1,17 @@ + + +
+
Some text
+
diff --git a/layout/reftests/high-contrast/reftest.list b/layout/reftests/high-contrast/reftest.list index c9b6b5e39f89..5cb3480e9850 100644 --- a/layout/reftests/high-contrast/reftest.list +++ b/layout/reftests/high-contrast/reftest.list @@ -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 == 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 pref(browser.display.document_color_use,0) needs-focus != selection-001.html selection-001-ref.html