Bug 1364412: Don't ignore the pseudo-element argument in ResolvePseudoElementStyle. r?heycam draft
authorEmilio Cobos Álvarez <emilio@crisal.io>
Sat, 13 May 2017 19:29:14 +0200
changeset 578207 cf25681a38d718d3bda464f7191de60441359aaa
parent 578206 4093572f18d3eb812bd457774ceaeb32fddf2758
child 578208 9c23b518a19d9bf3c6fdb16359984459b30b5fdd
push id58929
push userbmo:emilio+bugs@crisal.io
push dateTue, 16 May 2017 02:57:42 +0000
reviewersheycam
bugs1364412
milestone55.0a1
Bug 1364412: Don't ignore the pseudo-element argument in ResolvePseudoElementStyle. r?heycam MozReview-Commit-ID: 4KA4bj2Ww5W Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
layout/style/ServoStyleSet.cpp
--- a/layout/style/ServoStyleSet.cpp
+++ b/layout/style/ServoStyleSet.cpp
@@ -431,31 +431,37 @@ ServoStyleSet::ResolveStyleForPlaceholde
 }
 
 already_AddRefed<nsStyleContext>
 ServoStyleSet::ResolvePseudoElementStyle(Element* aOriginatingElement,
                                          CSSPseudoElementType aType,
                                          nsStyleContext* aParentContext,
                                          Element* aPseudoElement)
 {
-  if (aPseudoElement) {
-    NS_WARNING("stylo: We don't support CSS_PSEUDO_ELEMENT_SUPPORTS_USER_ACTION_STATE yet");
-  }
-
   MaybeRebuildStylist();
 
   // NB: We ignore aParentContext, on the assumption that pseudo element styles
   // should just inherit from aOriginatingElement's primary style, which Servo
   // already knows.
   MOZ_ASSERT(aType < CSSPseudoElementType::Count);
   nsIAtom* pseudoTag = nsCSSPseudoElements::GetPseudoAtom(aType);
 
-  RefPtr<ServoComputedValues> computedValues =
-    Servo_ResolvePseudoStyle(aOriginatingElement, pseudoTag,
-                             /* is_probe = */ false, mRawSet.get()).Consume();
+  RefPtr<ServoComputedValues> computedValues;
+  if (aPseudoElement) {
+    MOZ_ASSERT(aType == aPseudoElement->GetPseudoElementType());
+    computedValues = Servo_ResolveStyle(aPseudoElement, mRawSet.get(),
+                                        mAllowResolveStaleStyles).Consume();
+  } else {
+    computedValues =
+      Servo_ResolvePseudoStyle(aOriginatingElement,
+                               pseudoTag,
+                               /* is_probe = */ false,
+                               mRawSet.get()).Consume();
+  }
+
   MOZ_ASSERT(computedValues);
 
   bool isBeforeOrAfter = aType == CSSPseudoElementType::before ||
                          aType == CSSPseudoElementType::after;
   return GetContext(computedValues.forget(), aParentContext, pseudoTag, aType,
                     isBeforeOrAfter ? aOriginatingElement : nullptr);
 }