ported from UXP: Issue #1671 - Unprefix ::-moz-selection (e3f6690e)

This commit is contained in:
2022-04-18 12:15:54 +08:00
parent 4dfce2a016
commit 34509915b9
5 changed files with 17 additions and 5 deletions
@@ -30,7 +30,7 @@ function* testTopLeft(inspector, view) {
elementRulesNb: 4,
firstLineRulesNb: 2,
firstLetterRulesNb: 1,
selectionRulesNb: 0,
selectionRulesNb: 1,
afterRulesNb: 1,
beforeRulesNb: 2
}
@@ -167,7 +167,7 @@ function* testParagraph(inspector, view) {
elementRulesNb: 3,
firstLineRulesNb: 1,
firstLetterRulesNb: 1,
selectionRulesNb: 1,
selectionRulesNb: 2,
beforeRulesNb: 0,
afterRulesNb: 0
});
@@ -217,7 +217,7 @@ function* assertPseudoElementRulesNumbers(selector, inspector, view, ruleNbs) {
firstLetterRules: elementStyle.rules.filter(rule =>
rule.pseudoElement === ":first-letter"),
selectionRules: elementStyle.rules.filter(rule =>
rule.pseudoElement === ":-moz-selection"),
rule.pseudoElement === ":selection"),
beforeRules: elementStyle.rules.filter(rule =>
rule.pseudoElement === ":before"),
afterRules: elementStyle.rules.filter(rule =>
@@ -9317,6 +9317,7 @@ exports.PSEUDO_ELEMENTS = [
":backdrop",
":first-letter",
":first-line",
":selection",
":-moz-selection",
":-moz-focus-inner",
":-moz-focus-outer",
+9 -2
View File
@@ -3966,11 +3966,18 @@ nsTextPaintStyle::InitSelectionColorsAndShadow()
if (selectionElement &&
selectionStatus == nsISelectionController::SELECTION_ON) {
RefPtr<nsStyleContext> sc = nullptr;
// Probe for both selection and -moz-selection
sc = mPresContext->StyleSet()->
ProbePseudoElementStyle(selectionElement,
CSSPseudoElementType::mozSelection,
CSSPseudoElementType::selection,
mFrame->StyleContext());
// Use -moz-selection pseudo class.
if (!sc) {
sc = mPresContext->StyleSet()->
ProbePseudoElementStyle(selectionElement,
CSSPseudoElementType::mozSelection,
mFrame->StyleContext());
}
// Use selection pseudo class.
if (sc) {
mSelectionBGColor =
sc->GetVisitedDependentColor(&nsStyleBackground::mBackgroundColor);
@@ -16,6 +16,7 @@
":first-letter",
":first-line",
":placeholder",
":selection",
":-moz-color-swatch",
":-moz-focus-inner",
":-moz-focus-outer",
+3
View File
@@ -37,6 +37,9 @@ CSS_PSEUDO_ELEMENT(firstLine, ":first-line",
CSS_PSEUDO_ELEMENT_IS_CSS2 |
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_CONTAINS_ELEMENTS)