diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index 7037bd28916e..da16ff113916 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -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& 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; diff --git a/layout/generic/nsIFrame.h b/layout/generic/nsIFrame.h index cae792d3b588..8c9d7737900d 100644 --- a/layout/generic/nsIFrame.h +++ b/layout/generic/nsIFrame.h @@ -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& aContinuationStyleContext = Nothing()); struct OwnedAnonBox {