Bug 1818227 - Prevent drawing backplate when forced-color-adjust is none r=emilio

Prevents backplates from being drawn for any text that has forced-color-adjust: none set by checking the value of StyleText()->mForcedColorAdjust.

Differential Revision: https://phabricator.services.mozilla.com/D173362
This commit is contained in:
Fred Chasen 2023-03-24 16:48:35 +00:00
Родитель b5389d1492
Коммит 3c5da1ddd8
4 изменённых файлов: 37 добавлений и 1 удалений

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

@ -7171,8 +7171,10 @@ void nsBlockFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
// hold:
// (A) the backplate feature is preffed on
// (B) we are not honoring the document colors
// (C) the force color adjust property is set to auto
if (StaticPrefs::browser_display_permit_backplate() &&
PresContext()->ForcingColors() && !IsComboboxControlFrame()) {
PresContext()->ForcingColors() && !IsComboboxControlFrame() &&
StyleText()->mForcedColorAdjust != StyleForcedColorAdjust::None) {
backplateColor.emplace(GetBackplateColor(this));
}

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

@ -0,0 +1,15 @@
<!DOCTYPE html>
<html>
<head>
<title>Reference: Text with forced-color-adjust set to none should not be backplated.</title>
<style>
div {
background-image: url("blue.png");
color: yellow;
}
</style>
</head>
<div>
Yellow Text
</div>
</html>

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

@ -0,0 +1,16 @@
<!DOCTYPE html>
<html>
<head>
<title>Text with forced-color-adjust set to none should not be backplated.</title>
<style>
div {
forced-color-adjust: none;
background-image: url("blue.png");
color: yellow;
}
</style>
</head>
<div>
Yellow Text
</div>
</html>

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

@ -98,3 +98,6 @@ pref(browser.display.use_system_colors,true) pref(browser.display.document_color
pref(layout.css.color-mix.enabled,true) != color-mix.html color-mix-notref.html
test-pref(browser.display.background_color,"black") test-pref(browser.display.foreground_color,"white") test-pref(ui.-moz-fieldtext,"black") test-pref(ui.-moz-fieldtext.dark,"white") pref(ui.use_standins_for_native_colors,false) pref(browser.display.use_system_colors,false) == no-system-colors-color-scheme.html no-system-colors-color-scheme-ref.html
# Forced color adjust
pref(layout.css.forced-color-adjust.enabled,true) == backplate-force-color-adjust.html backplate-force-color-adjust-ref.html