Bug 898888: Transition manager should use SetStyleContext rather than SetStyleContextWithoutNotification. r=nrc

While debugging bug 858937 I noticed that the transition manager was
calling nsIFrame::SetStyleContextWithoutNotification rather than
nsIFrame::SetStyleContext.  SetStyleContextWithoutNotification should
only be used for things that aren't really style changes, but are
instead changes we make during frame construction before things are
really initialized.  Anything that's really a dynamic style change, as
these are, should use SetStyleContext.

I realize I said the opposite in bug 780692 comment 186, and bz said the
same in bug 780692 comment 204, which is why this is the state that it
is.
This commit is contained in:
L. David Baron 2013-07-30 17:36:08 -07:00
parent dec690eacf
commit c857e1a9dd
2 changed files with 11 additions and 5 deletions

View File

@ -759,7 +759,13 @@ public:
oldStyleContext->Release();
}
}
/**
* SetStyleContextWithoutNotification is for changes to the style
* context that should suppress style change processing, in other
* words, those that aren't really changes. This generally means only
* changes that happen during frame construction.
*/
void SetStyleContextWithoutNotification(nsStyleContext* aContext)
{
if (aContext != mStyleContext) {

View File

@ -219,13 +219,13 @@ static void ReparentBeforeAndAfter(dom::Element* aElement,
nsRefPtr<nsStyleContext> beforeStyle =
aStyleSet->ReparentStyleContext(before->StyleContext(),
aNewStyle, aElement);
before->SetStyleContextWithoutNotification(beforeStyle);
before->SetStyleContext(beforeStyle);
}
if (nsIFrame* after = nsLayoutUtils::GetBeforeFrame(aPrimaryFrame)) {
nsRefPtr<nsStyleContext> afterStyle =
aStyleSet->ReparentStyleContext(after->StyleContext(),
aNewStyle, aElement);
after->SetStyleContextWithoutNotification(afterStyle);
after->SetStyleContext(afterStyle);
}
}
@ -318,7 +318,7 @@ nsTransitionManager::UpdateThrottledStyle(dom::Element* aElement,
aChangeList.AppendChange(primaryFrame, primaryFrame->GetContent(),
styleChange);
primaryFrame->SetStyleContextWithoutNotification(newStyle);
primaryFrame->SetStyleContext(newStyle);
ReparentBeforeAndAfter(aElement, primaryFrame, newStyle, mPresContext->PresShell()->StyleSet());
@ -358,7 +358,7 @@ nsTransitionManager::UpdateThrottledStylesForSubtree(nsIContent* aContent,
newStyle = styleSet->ReparentStyleContext(primaryFrame->StyleContext(),
aParentStyle, element);
primaryFrame->SetStyleContextWithoutNotification(newStyle);
primaryFrame->SetStyleContext(newStyle);
ReparentBeforeAndAfter(element, primaryFrame, newStyle, styleSet);
}