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,13 +59,13 @@ nsFirstLetterFrame::Init(nsIContent* aContent,
if (aPrevInFlow) { if (aPrevInFlow) {
// Get proper style context for ourselves. We're creating the frame // Get proper style context for ourselves. We're creating the frame
// that represents everything *except* the first letter, so just create // that represents everything *except* the first letter, so just create
// a style context like we would for a text node. // a style context that inherits from our style parent, with no extra rules.
nsStyleContext* parentStyleContext = mStyleContext->GetParentAllowServo(); nsIFrame* styleParent =
if (parentStyleContext) { CorrectStyleParentFrame(aParent, nsCSSPseudoElements::firstLetter);
newSC = PresContext()->StyleSet()-> nsStyleContext* parentStyleContext = styleParent->StyleContext();
ResolveStyleForFirstLetterContinuation(parentStyleContext); newSC = PresContext()->StyleSet()->
SetStyleContextWithoutNotification(newSC); ResolveStyleForFirstLetterContinuation(parentStyleContext);
} SetStyleContextWithoutNotification(newSC);
} }
nsContainerFrame::Init(aContent, aParent, aPrevInFlow); nsContainerFrame::Init(aContent, aParent, aPrevInFlow);
@ -378,14 +378,23 @@ nsFirstLetterFrame::DrainOverflowFrames(nsPresContext* aPresContext)
// are reflowed) // are reflowed)
nsIFrame* kid = mFrames.FirstChild(); nsIFrame* kid = mFrames.FirstChild();
if (kid) { if (kid) {
RefPtr<nsStyleContext> sc;
nsIContent* kidContent = kid->GetContent(); nsIContent* kidContent = kid->GetContent();
if (kidContent) { if (kidContent) {
NS_ASSERTION(kidContent->IsNodeOfType(nsINode::eTEXT), NS_ASSERTION(kidContent->IsNodeOfType(nsINode::eTEXT),
"should contain only text nodes"); "should contain only text nodes");
nsStyleContext* parentSC = prevInFlow ? mStyleContext->GetParentAllowServo() : nsStyleContext* parentSC;
mStyleContext; if (prevInFlow) {
sc = aPresContext->StyleSet()->ResolveStyleForText(kidContent, parentSC); // 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); kid->SetStyleContext(sc);
nsLayoutUtils::MarkDescendantsDirty(kid); nsLayoutUtils::MarkDescendantsDirty(kid);
} }