diff options
author | Moonchild <moonchild@palemoon.org> | 2020-10-19 19:35:03 +0000 |
---|---|---|
committer | Moonchild <moonchild@palemoon.org> | 2020-10-24 10:37:53 +0000 |
commit | abcee4f85c5320ceab1f16712d26ea059ef67fd9 (patch) | |
tree | ce40920fb6b04d497aa8864f791a1adb3659c66f /layout | |
parent | 67a7e4eabd9b91436cc658431ea1bbd28e480f5b (diff) | |
download | UXP-abcee4f85c5320ceab1f16712d26ea059ef67fd9.tar UXP-abcee4f85c5320ceab1f16712d26ea059ef67fd9.tar.gz UXP-abcee4f85c5320ceab1f16712d26ea059ef67fd9.tar.lz UXP-abcee4f85c5320ceab1f16712d26ea059ef67fd9.tar.xz UXP-abcee4f85c5320ceab1f16712d26ea059ef67fd9.zip |
Issue #1671 - Unprefix ::-moz-selection
This actually keeps both pseudo-elements for now, since the prefixed version is
still used internally, but we need the unprefixed version for web compat.
Note: while unprefixing a non-spec-compliant pseudo here, it's exactly in line
with what other browsers do. Nobody is following the spec here and at least
we'll be doing what everyone else is with our unprefixed version.
Diffstat (limited to 'layout')
-rw-r--r-- | layout/generic/nsTextFrame.cpp | 11 | ||||
-rw-r--r-- | layout/inspector/tests/test_getCSSPseudoElementNames.html | 1 | ||||
-rw-r--r-- | layout/style/nsCSSPseudoElementList.h | 3 |
3 files changed, 13 insertions, 2 deletions
diff --git a/layout/generic/nsTextFrame.cpp b/layout/generic/nsTextFrame.cpp index a47b87e38..c7b55961c 100644 --- a/layout/generic/nsTextFrame.cpp +++ b/layout/generic/nsTextFrame.cpp @@ -3949,11 +3949,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(eCSSProperty_background_color); diff --git a/layout/inspector/tests/test_getCSSPseudoElementNames.html b/layout/inspector/tests/test_getCSSPseudoElementNames.html index cdb4572d4..8879f21dc 100644 --- a/layout/inspector/tests/test_getCSSPseudoElementNames.html +++ b/layout/inspector/tests/test_getCSSPseudoElementNames.html @@ -16,6 +16,7 @@ ":first-letter", ":first-line", ":placeholder", + ":selection", ":-moz-color-swatch", ":-moz-focus-inner", ":-moz-focus-outer", diff --git a/layout/style/nsCSSPseudoElementList.h b/layout/style/nsCSSPseudoElementList.h index 552c76734..b8393d395 100644 --- a/layout/style/nsCSSPseudoElementList.h +++ b/layout/style/nsCSSPseudoElementList.h @@ -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) |