Bug 479655 part 5. Pass the relevant restyle tracker through to style reresolution. r=dbaron

This commit is contained in:
Boris Zbarsky 2010-06-18 12:23:05 -04:00
parent ecd2c79550
commit ef0bbab82b
5 changed files with 40 additions and 15 deletions

View File

@ -78,7 +78,8 @@ RestyleTracker::ProcessOneRestyle(Element* aElement,
nsIFrame* primaryFrame = aElement->GetPrimaryFrame();
if (aRestyleHint & eRestyle_Self) {
mFrameConstructor->RestyleElement(aElement, primaryFrame, aChangeHint);
mFrameConstructor->RestyleElement(aElement, primaryFrame, aChangeHint,
*this);
} else if (aChangeHint &&
(primaryFrame ||
(aChangeHint & nsChangeHint_ReconstructFrame))) {
@ -97,7 +98,8 @@ RestyleTracker::ProcessOneRestyle(Element* aElement,
mFrameConstructor->RestyleElement(sibling->AsElement(),
sibling->GetPrimaryFrame(),
NS_STYLE_HINT_NONE);
NS_STYLE_HINT_NONE,
*this);
}
}
}

View File

@ -8083,7 +8083,8 @@ nsCSSFrameConstructor::ProcessRestyledFrames(nsStyleChangeList& aChangeList)
void
nsCSSFrameConstructor::RestyleElement(Element *aElement,
nsIFrame *aPrimaryFrame,
nsChangeHint aMinHint)
nsChangeHint aMinHint,
RestyleTracker& aRestyleTracker)
{
NS_ASSERTION(aPrimaryFrame == aElement->GetPrimaryFrame(),
"frame/content mismatch");
@ -8100,7 +8101,8 @@ nsCSSFrameConstructor::RestyleElement(Element *aElement,
} else if (aPrimaryFrame) {
nsStyleChangeList changeList;
mPresShell->FrameManager()->
ComputeStyleChangeFor(aPrimaryFrame, &changeList, aMinHint);
ComputeStyleChangeFor(aPrimaryFrame, &changeList, aMinHint,
aRestyleTracker);
ProcessRestyledFrames(changeList);
} else {
// no frames, reconstruct for content
@ -11623,8 +11625,10 @@ nsCSSFrameConstructor::RebuildAllStyleData(nsChangeHint aExtraHint)
nsStyleChangeList changeList;
// XXX Does it matter that we're passing aExtraHint to the real root
// frame and not the root node's primary frame?
// Note: The restyle tracker we pass in here doesn't matter.
mPresShell->FrameManager()->ComputeStyleChangeFor(mPresShell->GetRootFrame(),
&changeList, aExtraHint);
&changeList, aExtraHint,
mPendingRestyles);
// Process the required changes
ProcessRestyledFrames(changeList);
// Tell the style set it's safe to destroy the old rule tree. We

View File

@ -452,7 +452,8 @@ private:
// XXXbz do we really need the aPrimaryFrame argument here?
void RestyleElement(Element* aElement,
nsIFrame* aPrimaryFrame,
nsChangeHint aMinHint);
nsChangeHint aMinHint,
RestyleTracker& aRestyleTracker);
nsresult InitAndRestoreFrame (const nsFrameConstructorState& aState,
nsIContent* aContent,

View File

@ -91,6 +91,7 @@
#include "nsAutoPtr.h"
#include "imgIRequest.h"
#include "nsTransitionManager.h"
#include "RestyleTracker.h"
#include "nsFrameManager.h"
#ifdef ACCESSIBILITY
@ -961,7 +962,8 @@ nsFrameManager::ReResolveStyleContext(nsPresContext *aPresContext,
nsIContent *aParentContent,
nsStyleChangeList *aChangeList,
nsChangeHint aMinChange,
PRBool aFireAccessibilityEvents)
PRBool aFireAccessibilityEvents,
RestyleTracker& aRestyleTracker)
{
if (!NS_IsHintSubset(nsChangeHint_NeedDirtyReflow, aMinChange)) {
// If aMinChange doesn't include nsChangeHint_NeedDirtyReflow, clear out
@ -1049,7 +1051,8 @@ nsFrameManager::ReResolveStyleContext(nsPresContext *aPresContext,
// frame because it is visible or hidden withitn this frame.
assumeDifferenceHint = ReResolveStyleContext(aPresContext, providerFrame,
aParentContent, aChangeList,
aMinChange, PR_FALSE);
aMinChange, PR_FALSE,
aRestyleTracker);
// The provider's new context becomes the parent context of
// aFrame's context.
@ -1390,19 +1393,22 @@ nsFrameManager::ReResolveStyleContext(nsPresContext *aPresContext,
content, aChangeList,
NS_SubtractHint(aMinChange,
nsChangeHint_ReflowFrame),
fireAccessibilityEvents);
fireAccessibilityEvents,
aRestyleTracker);
// reresolve placeholder's context under the same parent
// as the out-of-flow frame
ReResolveStyleContext(aPresContext, child, content,
aChangeList, aMinChange,
fireAccessibilityEvents);
fireAccessibilityEvents,
aRestyleTracker);
}
else { // regular child frame
if (child != resolvedChild) {
ReResolveStyleContext(aPresContext, child, content,
aChangeList, aMinChange,
fireAccessibilityEvents);
fireAccessibilityEvents,
aRestyleTracker);
} else {
NOISY_TRACE_FRAME("child frame already resolved as descendant, skipping",aFrame);
}
@ -1424,7 +1430,8 @@ nsFrameManager::ReResolveStyleContext(nsPresContext *aPresContext,
void
nsFrameManager::ComputeStyleChangeFor(nsIFrame *aFrame,
nsStyleChangeList *aChangeList,
nsChangeHint aMinChange)
nsChangeHint aMinChange,
RestyleTracker& aRestyleTracker)
{
if (aMinChange) {
aChangeList->AppendChange(aFrame, aFrame->GetContent(), aMinChange);
@ -1449,7 +1456,8 @@ nsFrameManager::ComputeStyleChangeFor(nsIFrame *aFrame,
// Inner loop over next-in-flows of the current frame
nsChangeHint frameChange =
ReResolveStyleContext(GetPresContext(), frame, nsnull,
aChangeList, topLevelChange, PR_TRUE);
aChangeList, topLevelChange, PR_TRUE,
aRestyleTracker);
NS_UpdateHint(topLevelChange, frameChange);
if (topLevelChange & nsChangeHint_ReconstructFrame) {

View File

@ -57,6 +57,12 @@
#include "nsChangeHint.h"
#include "nsFrameManagerBase.h"
namespace mozilla {
namespace css {
class RestyleTracker;
} // namespace css
} // namespace mozilla
/**
* Frame manager interface. The frame manager serves two purposes:
* <li>provides a service for mapping from content to frame and from
@ -70,6 +76,8 @@
class nsFrameManager : public nsFrameManagerBase
{
typedef mozilla::css::RestyleTracker RestyleTracker;
public:
nsFrameManager() NS_HIDDEN;
~nsFrameManager() NS_HIDDEN;
@ -151,7 +159,8 @@ public:
NS_HIDDEN_(void)
ComputeStyleChangeFor(nsIFrame* aFrame,
nsStyleChangeList* aChangeList,
nsChangeHint aMinChange);
nsChangeHint aMinChange,
RestyleTracker& aRestyleTracker);
/*
* Capture/restore frame state for the frame subtree rooted at aFrame.
@ -198,7 +207,8 @@ private:
nsIContent *aParentContent,
nsStyleChangeList *aChangeList,
nsChangeHint aMinChange,
PRBool aFireAccessibilityEvents);
PRBool aFireAccessibilityEvents,
RestyleTracker& aRestyleTracker);
};
#endif