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
--- 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);
}
}
}