Bug 1322570 Part 5 - Use GetParentAllowServo() related to first letter frame. draft
authorTing-Yu Lin <tlin@mozilla.com>
Mon, 20 Mar 2017 14:13:32 +0800
changeset 504313 af997c214f2861aab9d1666e22cf423a11fc85b9
parent 504312 0d7a157692c2e52d068cf600b6c1f2844c30c152
child 504314 6e585573c65944ed4f9cda2fbbf121b6a9ed6ed4
push id50776
push userbmo:tlin@mozilla.com
push dateFri, 24 Mar 2017 06:09:16 +0000
bugs1322570, 1324618
milestone55.0a1
Bug 1322570 Part 5 - Use GetParentAllowServo() related to first letter frame. ::first-letter is not support by stylo yet. (bug 1324618) MozReview-Commit-ID: KwQk2jhn53c
layout/base/nsCSSFrameConstructor.cpp
layout/generic/nsFirstLetterFrame.cpp
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -11490,17 +11490,17 @@ nsCSSFrameConstructor::CreateFloatingLet
   // more than just the first-letter text or not?) If it does, then we
   // create (in advance) a continuation frame for it.
   nsIFrame* nextTextFrame = nullptr;
   if (NeedFirstLetterContinuation(aTextContent)) {
     // Create continuation
     nextTextFrame =
       CreateContinuingFrame(aState.mPresContext, aTextFrame, aParentFrame);
     // Repair the continuations style context
-    nsStyleContext* parentStyleContext = aStyleContext->GetParent();
+    nsStyleContext* parentStyleContext = aStyleContext->GetParentAllowServo();
     if (parentStyleContext) {
       RefPtr<nsStyleContext> newSC = styleSet->
         ResolveStyleForText(aTextContent, parentStyleContext);
       nextTextFrame->SetStyleContext(newSC);
     }
   }
 
   NS_ASSERTION(aResult.IsEmpty(), "aResult should be an empty nsFrameItems!");
--- a/layout/generic/nsFirstLetterFrame.cpp
+++ b/layout/generic/nsFirstLetterFrame.cpp
@@ -61,17 +61,17 @@ nsFirstLetterFrame::Init(nsIContent*    
                          nsContainerFrame* aParent,
                          nsIFrame*         aPrevInFlow)
 {
   RefPtr<nsStyleContext> newSC;
   if (aPrevInFlow) {
     // Get proper style context for ourselves.  We're creating the frame
     // that represents everything *except* the first letter, so just create
     // a style context like we would for a text node.
-    nsStyleContext* parentStyleContext = mStyleContext->GetParent();
+    nsStyleContext* parentStyleContext = mStyleContext->GetParentAllowServo();
     if (parentStyleContext) {
       newSC = PresContext()->StyleSet()->
         ResolveStyleForFirstLetterContinuation(parentStyleContext);
       SetStyleContextWithoutNotification(newSC);
     }
   }
 
   nsContainerFrame::Init(aContent, aParent, aPrevInFlow);
@@ -326,17 +326,17 @@ nsFirstLetterFrame::CreateContinuationFo
   nsContainerFrame* parent = placeholderFrame->GetParent();
 
   nsIFrame* continuation = presShell->FrameConstructor()->
     CreateContinuingFrame(aPresContext, aChild, parent, aIsFluid);
 
   // The continuation will have gotten the first letter style from its
   // prev continuation, so we need to repair the style context so it
   // doesn't have the first letter styling.
-  nsStyleContext* parentSC = this->StyleContext()->GetParent();
+  nsStyleContext* parentSC = this->StyleContext()->GetParentAllowServo();
   if (parentSC) {
     RefPtr<nsStyleContext> newSC;
     newSC = presShell->StyleSet()->ResolveStyleForFirstLetterContinuation(parentSC);
     continuation->SetStyleContext(newSC);
     nsLayoutUtils::MarkDescendantsDirty(continuation);
   }
 
   //XXX Bidi may not be involved but we have to use the list name
@@ -381,17 +381,17 @@ nsFirstLetterFrame::DrainOverflowFrames(
   // are reflowed)
   nsIFrame* kid = mFrames.FirstChild();
   if (kid) {
     RefPtr<nsStyleContext> sc;
     nsIContent* kidContent = kid->GetContent();
     if (kidContent) {
       NS_ASSERTION(kidContent->IsNodeOfType(nsINode::eTEXT),
                    "should contain only text nodes");
-      nsStyleContext* parentSC = prevInFlow ? mStyleContext->GetParent() :
+      nsStyleContext* parentSC = prevInFlow ? mStyleContext->GetParentAllowServo() :
                                               mStyleContext;
       sc = aPresContext->StyleSet()->ResolveStyleForText(kidContent, parentSC);
       kid->SetStyleContext(sc);
       nsLayoutUtils::MarkDescendantsDirty(kid);
     }
   }
 }