зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1596050 - When ignoring document colors, ignore ::selection styles altogether. r=morgan
Differential Revision: https://phabricator.services.mozilla.com/D53171 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
33766e4d76
Коммит
fb57a6c09f
|
@ -2373,13 +2373,18 @@ already_AddRefed<ComputedStyle> nsIFrame::ComputeSelectionStyle(
|
|||
aSelectionStatus != nsISelectionController::SELECTION_DISABLED) {
|
||||
return nullptr;
|
||||
}
|
||||
// When in high-contrast mode, the style system ends up ignoring the color
|
||||
// declarations, which means that the ::selection style becomes the inherited
|
||||
// color, and default background. That's no good.
|
||||
if (!PresContext()->PrefSheetPrefs().mUseDocumentColors) {
|
||||
return nullptr;
|
||||
}
|
||||
Element* element = FindElementAncestorForMozSelection(GetContent());
|
||||
if (!element) {
|
||||
return nullptr;
|
||||
}
|
||||
RefPtr<ComputedStyle> sc = PresContext()->StyleSet()->ProbePseudoElementStyle(
|
||||
return PresContext()->StyleSet()->ProbePseudoElementStyle(
|
||||
*element, PseudoStyleType::selection, Style());
|
||||
return sc.forget();
|
||||
}
|
||||
|
||||
/********************************************************
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
default-preferences test-pref(browser.display.document_color_use,2) test-pref(browser.display.permit_backplate,true)
|
||||
|
||||
# There are several platform-specific fuzzy-if notations below due to
|
||||
# anti-aliasing, extra visual overflow, and slightly inacurrate reftest
|
||||
# anti-aliasing, extra visual overflow, and slightly inacurate reftest
|
||||
# mocking. You can read more about the annotations and their specifics here:
|
||||
# https://bugzilla.mozilla.org/show_bug.cgi?id=1539212#c25
|
||||
|
||||
|
@ -16,3 +16,6 @@ fuzzy-if(cocoaWidget,255-255,52-52) fuzzy-if(winWidget,15-15,48-48) == backplate
|
|||
fuzzy-if(cocoaWidget,255-255,2842-2842) fuzzy-if(gtkWidget,255-255,620-620) fuzzy-if(winWidget||Android,255-255,480-481) == backplate-bg-image-008.html backplate-bg-image-008-ref.html
|
||||
fuzzy-if(cocoaWidget,255-255,504-504) fuzzy-if(gtkWidget,255-255,1050-1050) fuzzy-if(winWidget||Android,255-255,480-480) == backplate-bg-image-009.html backplate-bg-image-009-ref.html
|
||||
fuzzy-if(cocoaWidget,255-255,621-621) fuzzy-if(winWidget,255-255,128-128) fuzzy-if(Android,255-255,240-240) == backplate-bg-image-010.html backplate-bg-image-010-ref.html
|
||||
|
||||
== selection-001.html selection-001-ref.html
|
||||
pref(browser.display.document_color_use,0) != selection-001.html selection-001-ref.html
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
<!doctype html>
|
||||
<title>Test reference</title>
|
||||
<p>
|
||||
Some selected text
|
||||
</p>
|
||||
<script>
|
||||
onload = function() {
|
||||
getSelection().removeAllRanges();
|
||||
let r = document.createRange();
|
||||
r.selectNode(document.documentElement);
|
||||
getSelection().addRange(r);
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,19 @@
|
|||
<!doctype html>
|
||||
<title>::selection should use native colors in high contrast mode</title>
|
||||
<style>
|
||||
::selection {
|
||||
background: purple;
|
||||
color: blue;
|
||||
}
|
||||
</style>
|
||||
<p>
|
||||
Some selected text
|
||||
</p>
|
||||
<script>
|
||||
onload = function() {
|
||||
getSelection().removeAllRanges();
|
||||
let r = document.createRange();
|
||||
r.selectNode(document.documentElement);
|
||||
getSelection().addRange(r);
|
||||
}
|
||||
</script>
|
Загрузка…
Ссылка в новой задаче