Bug 1384691 - Unconditionally set mHasSelectionShadow when -moz-selection pseudo element is used. r?jfkthame draft
authorXidorn Quan <me@upsuper.org>
Wed, 13 Sep 2017 14:30:58 +1000
changeset 663676 27f807beb20c00e24dc033556ccb3977718fd682
parent 663674 94176d9d8261a4110a1d936207324879eb845425
child 731268 2d15d1998a4d362588643c952c590df24e3bb40e
push id79508
push userxquan@mozilla.com
push dateWed, 13 Sep 2017 09:15:28 +0000
reviewersjfkthame
bugs1384691, 721750
milestone57.0a1
Bug 1384691 - Unconditionally set mHasSelectionShadow when -moz-selection pseudo element is used. r?jfkthame The HasAuthorSpecifiedRules check was from the initial implementation of text-shadow support on ::-moz-selection in bug721750. There doesn't seem to be anything mentioning why this check is necessary. Also given text-shadow is inherited by default, it doesn't seems this change would lead to any difference. MozReview-Commit-ID: 6Qbotdxykwi
layout/generic/nsTextFrame.cpp
--- a/layout/generic/nsTextFrame.cpp
+++ b/layout/generic/nsTextFrame.cpp
@@ -4108,32 +4108,18 @@ nsTextPaintStyle::InitSelectionColorsAnd
                                 CSSPseudoElementType::mozSelection,
                                 mFrame->StyleContext());
     // Use -moz-selection pseudo class.
     if (sc) {
       mSelectionBGColor =
         sc->GetVisitedDependentColor(&nsStyleBackground::mBackgroundColor);
       mSelectionTextColor =
         sc->GetVisitedDependentColor(&nsStyleText::mWebkitTextFillColor);
-      if (auto* geckoStyleContext = sc->GetAsGecko()) {
-        mHasSelectionShadow =
-          nsRuleNode::HasAuthorSpecifiedRules(geckoStyleContext,
-                                              NS_AUTHOR_SPECIFIED_TEXT_SHADOW,
-                                              true);
-      } else {
-        NS_WARNING("stylo: Need a way to get HasAuthorSpecifiedRules from a "
-                   "raw style context");
-        // Or at least an element and a pseudo-style, which is probably a bit
-        // more doable, since we know that, at least when not in the presence of
-        // first-line / first-letter, we're inheriting from selectionElement.
-        mHasSelectionShadow = true;
-      }
-      if (mHasSelectionShadow) {
-        mSelectionShadow = sc->StyleText()->mTextShadow;
-      }
+      mHasSelectionShadow = true;
+      mSelectionShadow = sc->StyleText()->mTextShadow;
       return true;
     }
   }
 
   nscolor selectionBGColor =
     LookAndFeel::GetColor(LookAndFeel::eColorID_TextSelectBackground);
 
   if (selectionStatus == nsISelectionController::SELECTION_ATTENTION) {