Bug 1384542: Remove the use of GetParentAllowServo in nsFirstLetterFrame. r=heycam

MozReview-Commit-ID: Gt9MX8t3vUh
This commit is contained in:
Boris Zbarsky 2017-06-24 03:17:37 -04:00 коммит произвёл Emilio Cobos Álvarez
Родитель 22dfa54ef4
Коммит 53455d52aa
1 изменённых файлов: 20 добавлений и 11 удалений

Просмотреть файл

@ -59,14 +59,14 @@ nsFirstLetterFrame::Init(nsIContent* aContent,
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->GetParentAllowServo();
if (parentStyleContext) {
// a style context that inherits from our style parent, with no extra rules.
nsIFrame* styleParent =
CorrectStyleParentFrame(aParent, nsCSSPseudoElements::firstLetter);
nsStyleContext* parentStyleContext = styleParent->StyleContext();
newSC = PresContext()->StyleSet()->
ResolveStyleForFirstLetterContinuation(parentStyleContext);
SetStyleContextWithoutNotification(newSC);
}
}
nsContainerFrame::Init(aContent, aParent, aPrevInFlow);
}
@ -378,14 +378,23 @@ nsFirstLetterFrame::DrainOverflowFrames(nsPresContext* aPresContext)
// 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->GetParentAllowServo() :
mStyleContext;
sc = aPresContext->StyleSet()->ResolveStyleForText(kidContent, parentSC);
nsStyleContext* parentSC;
if (prevInFlow) {
// This is for the rest of the content not in the first-letter.
nsIFrame* styleParent =
CorrectStyleParentFrame(GetParent(),
nsCSSPseudoElements::firstLetter);
parentSC = styleParent->StyleContext();
} else {
// And this for the first-letter style.
parentSC = mStyleContext;
}
RefPtr<nsStyleContext> sc =
aPresContext->StyleSet()->ResolveStyleForText(kidContent, parentSC);
kid->SetStyleContext(sc);
nsLayoutUtils::MarkDescendantsDirty(kid);
}