Bug 1375674: Don't use the table change hints for the table wrapper frame. r?heycam
MozReview-Commit-ID: 7Qe07N6zvIt
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -10249,17 +10249,17 @@ nsIFrame::UpdateStyleOfOwnedChildFrame(n
nsStyleContext* aNewStyleContext,
ServoRestyleState& aRestyleState)
{
// Figure out whether we have an actual change. It's important that we do
// this, for several reasons:
//
// 1) Even if all the child's changes are due to properties it inherits from
// us, it's possible that no one ever asked us for those style structs and
- // hence changes to them aren't reflected in aHintForThisFrame at all.
+ // hence changes to them aren't reflected in the changes handled at all.
//
// 2) Content can change stylesheets that change the styles of pseudos, and
// extensions can add/remove stylesheets that change the styles of
// anonymous boxes directly.
uint32_t equalStructs, samePointerStructs; // Not used, actually.
nsChangeHint childHint = aChildFrame->StyleContext()->CalcStyleDifference(
aNewStyleContext,
&equalStructs,
--- a/layout/tables/nsTableFrame.cpp
+++ b/layout/tables/nsTableFrame.cpp
@@ -8025,24 +8025,30 @@ nsTableFrame::UpdateStyleOfOwnedAnonBoxe
RefPtr<nsStyleContext> newContext =
aRestyleState.StyleSet().ResolveInheritingAnonymousBoxStyle(
nsCSSAnonBoxes::tableWrapper, aOwningFrame->StyleContext());
// Figure out whether we have an actual change. It's important that we do
// this, even though all the wrapper's changes are due to properties it
// inherits from us, because it's possible that no one ever asked us for those
// style structs and hence changes to them aren't reflected in
- // aHintForThisFrame at all.
+ // the handled changes at all.
+ //
+ // Also note that extensions can add/remove stylesheets that change the styles
+ // of anonymous boxes directly, so we need to handle that potential change
+ // here.
+ //
+ // NOTE(emilio): We can't use the ChangesHandledFor optimization (and we
+ // assert against that), because the table wrapper is up in the frame tree
+ // compared to the owner frame.
uint32_t equalStructs, samePointerStructs; // Not used, actually.
nsChangeHint wrapperHint = aWrapperFrame->StyleContext()->CalcStyleDifference(
newContext,
&equalStructs,
&samePointerStructs);
- wrapperHint =
- NS_RemoveSubsumedHints(wrapperHint, aRestyleState.ChangesHandled());
if (wrapperHint) {
aRestyleState.ChangeList().AppendChange(
aWrapperFrame, aWrapperFrame->GetContent(), wrapperHint);
}
for (nsIFrame* cur = aWrapperFrame; cur; cur = cur->GetNextContinuation()) {
cur->SetStyleContext(newContext);
}