Bug 1324618 part 5. Add a way to pass a different style context for later continuations to UpdateStyleOfOwnedChildFrame. r=emilio

We're going to want this for first-letter, because the primary frame and its continuations have different styles.

MozReview-Commit-ID: 6ZjtnRWXgd9
This commit is contained in:
Boris Zbarsky 2017-06-26 23:35:08 -07:00
parent 955487f7ab
commit 1a3c859dec
2 changed files with 18 additions and 6 deletions

View File

@ -10245,9 +10245,11 @@ nsIFrame::UpdateStyleOfChildAnonBox(nsIFrame* aChildFrame,
}
nsChangeHint
nsIFrame::UpdateStyleOfOwnedChildFrame(nsIFrame* aChildFrame,
nsIFrame::UpdateStyleOfOwnedChildFrame(
nsIFrame* aChildFrame,
nsStyleContext* aNewStyleContext,
ServoRestyleState& aRestyleState)
ServoRestyleState& aRestyleState,
const Maybe<nsStyleContext*>& aContinuationStyleContext)
{
// Figure out whether we have an actual change. It's important that we do
// this, for several reasons:
@ -10276,8 +10278,13 @@ nsIFrame::UpdateStyleOfOwnedChildFrame(nsIFrame* aChildFrame,
aChildFrame, aChildFrame->GetContent(), childHint);
}
for (nsIFrame* kid = aChildFrame; kid; kid = kid->GetNextContinuation()) {
kid->SetStyleContext(aNewStyleContext);
aChildFrame->SetStyleContext(aNewStyleContext);
nsStyleContext* continuationStyle =
aContinuationStyleContext ? *aContinuationStyleContext : aNewStyleContext;
for (nsIFrame* kid = aChildFrame->GetNextContinuation();
kid;
kid = kid->GetNextContinuation()) {
kid->SetStyleContext(continuationStyle);
}
return childHint;

View File

@ -3329,11 +3329,16 @@ public:
// `aChildFrame`, and takes care of updating it, calling CalcStyleDifference,
// and adding to the change list as appropriate.
//
// If aContinuationStyleContext is not Nothing, it should be used for
// continuations instead of aNewStyleContext. In either case, changehints are
// only computed based on aNewStyleContext.
//
// Returns the generated change hint for the frame.
nsChangeHint UpdateStyleOfOwnedChildFrame(
nsIFrame* aChildFrame,
nsStyleContext* aNewStyleContext,
mozilla::ServoRestyleState& aRestyleState);
mozilla::ServoRestyleState& aRestyleState,
const Maybe<nsStyleContext*>& aContinuationStyleContext = Nothing());
struct OwnedAnonBox
{