Bug 1270741 - Correctly resolve styles for non-elements. r=bholley
authorCameron McCormack <cam@mcc.id.au>
Fri, 06 May 2016 00:32:00 +0200
changeset 296352 35232e0db8b87969fcff58faac20e6b915a4f827
parent 296351 31dc08c9c5054824e8207ab2cc9af0f91139e766
child 296353 e7a089b9813a7c556d13226d51c8ab4df1aec239
push id76306
push usercbook@mozilla.com
push dateFri, 06 May 2016 09:16:54 +0000
treeherdermozilla-inbound@35232e0db8b8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbholley
bugs1270741
milestone49.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1270741 - Correctly resolve styles for non-elements. r=bholley
layout/style/ServoBindings.cpp
layout/style/ServoBindings.h
layout/style/ServoStyleSet.cpp
--- a/layout/style/ServoBindings.cpp
+++ b/layout/style/ServoBindings.cpp
@@ -291,16 +291,23 @@ Servo_GetComputedValuesForPseudoElement(
                                         nsIAtom* pseudo_tag,
                                         RawServoStyleSet* set,
                                         bool is_probe)
 {
   MOZ_CRASH("stylo: shouldn't be calling Servo_GetComputedValuesForPseudoElement in a "
             "non-MOZ_STYLO build");
 }
 
+ServoComputedValues*
+Servo_InheritComputedValues(ServoComputedValues* parent_style)
+{
+  MOZ_CRASH("stylo: shouldn't be calling Servo_InheritComputedValues in a "
+            "non-MOZ_STYLO build");
+}
+
 void
 Servo_AddRefComputedValues(ServoComputedValues*)
 {
   MOZ_CRASH("stylo: shouldn't be calling Servo_AddRefComputedValues in a "
             "non-MOZ_STYLO build");
 }
 
 void
--- a/layout/style/ServoBindings.h
+++ b/layout/style/ServoBindings.h
@@ -90,16 +90,17 @@ ServoComputedValues* Servo_GetComputedVa
 ServoComputedValues* Servo_GetComputedValuesForAnonymousBox(ServoComputedValues* parentStyleOrNull,
                                                             nsIAtom* pseudoTag,
                                                             RawServoStyleSet* set);
 ServoComputedValues* Servo_GetComputedValuesForPseudoElement(ServoComputedValues* parent_style,
                                                              RawGeckoElement* match_element,
                                                              nsIAtom* pseudo_tag,
                                                              RawServoStyleSet* set,
                                                              bool is_probe);
+ServoComputedValues* Servo_InheritComputedValues(ServoComputedValues* parent_style);
 void Servo_AddRefComputedValues(ServoComputedValues*);
 void Servo_ReleaseComputedValues(ServoComputedValues*);
 
 // Initialize Servo components. Should be called exactly once at startup.
 void Servo_Initialize();
 
 // Restyle the given document.
 void Servo_RestyleDocument(RawGeckoDocument* doc, RawServoStyleSet* set);
--- a/layout/style/ServoStyleSet.cpp
+++ b/layout/style/ServoStyleSet.cpp
@@ -123,17 +123,24 @@ ServoStyleSet::ResolveStyleForText(nsICo
   MOZ_ASSERT(aTextNode && aTextNode->IsNodeOfType(nsINode::eTEXT));
   return GetContext(aTextNode, aParentContext, nsCSSAnonBoxes::mozText,
                     CSSPseudoElementType::AnonBox);
 }
 
 already_AddRefed<nsStyleContext>
 ServoStyleSet::ResolveStyleForOtherNonElement(nsStyleContext* aParentContext)
 {
-  MOZ_CRASH("stylo: not implemented");
+  RefPtr<ServoComputedValues> computedValues =
+    Servo_InheritComputedValues(
+      aParentContext->StyleSource().AsServoComputedValues());
+  MOZ_ASSERT(computedValues);
+
+  return GetContext(computedValues.forget(), aParentContext,
+                    nsCSSAnonBoxes::mozOtherNonElement,
+                    CSSPseudoElementType::AnonBox);
 }
 
 already_AddRefed<nsStyleContext>
 ServoStyleSet::ResolvePseudoElementStyle(Element* aParentElement,
                                          CSSPseudoElementType aType,
                                          nsStyleContext* aParentContext,
                                          Element* aPseudoElement)
 {