Unprefix ::-moz-selection.

This commit is contained in:
Fedor 2020-10-30 21:47:14 +03:00
parent 4fe446773f
commit 1dd2bb19be
5 changed files with 17 additions and 5 deletions

View File

@ -29,7 +29,7 @@ function* testTopLeft(inspector, view) {
elementRulesNb: 4, elementRulesNb: 4,
firstLineRulesNb: 2, firstLineRulesNb: 2,
firstLetterRulesNb: 1, firstLetterRulesNb: 1,
selectionRulesNb: 0, selectionRulesNb: 1,
afterRulesNb: 1, afterRulesNb: 1,
beforeRulesNb: 2 beforeRulesNb: 2
} }
@ -166,7 +166,7 @@ function* testParagraph(inspector, view) {
elementRulesNb: 3, elementRulesNb: 3,
firstLineRulesNb: 1, firstLineRulesNb: 1,
firstLetterRulesNb: 1, firstLetterRulesNb: 1,
selectionRulesNb: 1, selectionRulesNb: 2,
beforeRulesNb: 0, beforeRulesNb: 0,
afterRulesNb: 0 afterRulesNb: 0
}); });
@ -216,7 +216,7 @@ function* assertPseudoElementRulesNumbers(selector, inspector, view, ruleNbs) {
firstLetterRules: elementStyle.rules.filter(rule => firstLetterRules: elementStyle.rules.filter(rule =>
rule.pseudoElement === ":first-letter"), rule.pseudoElement === ":first-letter"),
selectionRules: elementStyle.rules.filter(rule => selectionRules: elementStyle.rules.filter(rule =>
rule.pseudoElement === ":-moz-selection"), rule.pseudoElement === ":selection"),
beforeRules: elementStyle.rules.filter(rule => beforeRules: elementStyle.rules.filter(rule =>
rule.pseudoElement === ":before"), rule.pseudoElement === ":before"),
afterRules: elementStyle.rules.filter(rule => afterRules: elementStyle.rules.filter(rule =>

View File

@ -9398,6 +9398,7 @@ exports.PSEUDO_ELEMENTS = [
":backdrop", ":backdrop",
":first-letter", ":first-letter",
":first-line", ":first-line",
":selection",
":-moz-selection", ":-moz-selection",
":-moz-focus-inner", ":-moz-focus-inner",
":-moz-focus-outer", ":-moz-focus-outer",

View File

@ -3947,11 +3947,18 @@ nsTextPaintStyle::InitSelectionColorsAndShadow()
if (selectionElement && if (selectionElement &&
selectionStatus == nsISelectionController::SELECTION_ON) { selectionStatus == nsISelectionController::SELECTION_ON) {
RefPtr<nsStyleContext> sc = nullptr; RefPtr<nsStyleContext> sc = nullptr;
// Probe for both selection and -moz-selection
sc = mPresContext->StyleSet()-> sc = mPresContext->StyleSet()->
ProbePseudoElementStyle(selectionElement, ProbePseudoElementStyle(selectionElement,
CSSPseudoElementType::mozSelection, CSSPseudoElementType::selection,
mFrame->StyleContext()); mFrame->StyleContext());
// Use -moz-selection pseudo class. if (!sc) {
sc = mPresContext->StyleSet()->
ProbePseudoElementStyle(selectionElement,
CSSPseudoElementType::mozSelection,
mFrame->StyleContext());
}
// Use selection pseudo class.
if (sc) { if (sc) {
mSelectionBGColor = mSelectionBGColor =
sc->GetVisitedDependentColor(eCSSProperty_background_color); sc->GetVisitedDependentColor(eCSSProperty_background_color);

View File

@ -16,6 +16,7 @@
":first-letter", ":first-letter",
":first-line", ":first-line",
":placeholder", ":placeholder",
":selection",
":-moz-color-swatch", ":-moz-color-swatch",
":-moz-focus-inner", ":-moz-focus-inner",
":-moz-focus-outer", ":-moz-focus-outer",

View File

@ -37,6 +37,9 @@ CSS_PSEUDO_ELEMENT(firstLine, ":first-line",
CSS_PSEUDO_ELEMENT_IS_CSS2 | CSS_PSEUDO_ELEMENT_IS_CSS2 |
CSS_PSEUDO_ELEMENT_CONTAINS_ELEMENTS) CSS_PSEUDO_ELEMENT_CONTAINS_ELEMENTS)
CSS_PSEUDO_ELEMENT(selection, ":selection",
CSS_PSEUDO_ELEMENT_CONTAINS_ELEMENTS)
// Keep the prefixed version for now.
CSS_PSEUDO_ELEMENT(mozSelection, ":-moz-selection", CSS_PSEUDO_ELEMENT(mozSelection, ":-moz-selection",
CSS_PSEUDO_ELEMENT_CONTAINS_ELEMENTS) CSS_PSEUDO_ELEMENT_CONTAINS_ELEMENTS)