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

--HG--
extra : rebase_source : 52286f984973b9d0e1a1ea51c439e599eae00a38
This commit is contained in:
Boris Zbarsky 2017-06-26 23:35:08 -07:00
Родитель af8c5f3819
Коммит 0da68a43f6
2 изменённых файлов: 18 добавлений и 6 удалений

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

@ -10245,9 +10245,11 @@ nsIFrame::UpdateStyleOfChildAnonBox(nsIFrame* aChildFrame,
}
nsChangeHint
nsIFrame::UpdateStyleOfOwnedChildFrame(nsIFrame* aChildFrame,
nsStyleContext* aNewStyleContext,
ServoRestyleState& aRestyleState)
nsIFrame::UpdateStyleOfOwnedChildFrame(
nsIFrame* aChildFrame,
nsStyleContext* aNewStyleContext,
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;

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

@ -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
{