mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-10 13:54:27 +00:00
Bug 898209 patch 9: Create and use ElementRestyler::mParentFrameHintsNotHandledForDescendants and mHintsNotHandledForDescendants. r=heycam
This commit is contained in:
parent
82a0a650a6
commit
bec12fb9f3
@ -1922,6 +1922,8 @@ ElementRestyler::ElementRestyler(nsPresContext* aPresContext,
|
|||||||
, mChangeList(aChangeList)
|
, mChangeList(aChangeList)
|
||||||
, mHintsHandled(NS_SubtractHint(aHintsHandledByAncestors,
|
, mHintsHandled(NS_SubtractHint(aHintsHandledByAncestors,
|
||||||
NS_HintsNotHandledForDescendantsIn(aHintsHandledByAncestors)))
|
NS_HintsNotHandledForDescendantsIn(aHintsHandledByAncestors)))
|
||||||
|
, mParentFrameHintsNotHandledForDescendants(nsChangeHint(0))
|
||||||
|
, mHintsNotHandledForDescendants(nsChangeHint(0))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1936,6 +1938,9 @@ ElementRestyler::ElementRestyler(const ElementRestyler& aParentRestyler,
|
|||||||
, mChangeList(aParentRestyler.mChangeList)
|
, mChangeList(aParentRestyler.mChangeList)
|
||||||
, mHintsHandled(NS_SubtractHint(aParentRestyler.mHintsHandled,
|
, mHintsHandled(NS_SubtractHint(aParentRestyler.mHintsHandled,
|
||||||
NS_HintsNotHandledForDescendantsIn(aParentRestyler.mHintsHandled)))
|
NS_HintsNotHandledForDescendantsIn(aParentRestyler.mHintsHandled)))
|
||||||
|
, mParentFrameHintsNotHandledForDescendants(
|
||||||
|
aParentRestyler.mHintsNotHandledForDescendants)
|
||||||
|
, mHintsNotHandledForDescendants(nsChangeHint(0))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1951,18 +1956,20 @@ ElementRestyler::ElementRestyler(ParentContextFromChildFrame,
|
|||||||
, mChangeList(aParentRestyler.mChangeList)
|
, mChangeList(aParentRestyler.mChangeList)
|
||||||
, mHintsHandled(NS_SubtractHint(aParentRestyler.mHintsHandled,
|
, mHintsHandled(NS_SubtractHint(aParentRestyler.mHintsHandled,
|
||||||
NS_HintsNotHandledForDescendantsIn(aParentRestyler.mHintsHandled)))
|
NS_HintsNotHandledForDescendantsIn(aParentRestyler.mHintsHandled)))
|
||||||
|
, mParentFrameHintsNotHandledForDescendants(
|
||||||
|
// assume the worst
|
||||||
|
nsChangeHint_Hints_NotHandledForDescendants)
|
||||||
|
, mHintsNotHandledForDescendants(nsChangeHint(0))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ElementRestyler::CaptureChange(nsStyleContext* aOldContext,
|
ElementRestyler::CaptureChange(nsStyleContext* aOldContext,
|
||||||
nsStyleContext* aNewContext,
|
nsStyleContext* aNewContext,
|
||||||
/*in*/nsChangeHint aParentHintsNotHandledForDescendants,
|
|
||||||
/*out*/nsChangeHint &aHintsNotHandledForDescendants,
|
|
||||||
nsChangeHint aChangeToAssume)
|
nsChangeHint aChangeToAssume)
|
||||||
{
|
{
|
||||||
nsChangeHint ourChange = aOldContext->CalcStyleDifference(aNewContext,
|
nsChangeHint ourChange = aOldContext->CalcStyleDifference(aNewContext,
|
||||||
aParentHintsNotHandledForDescendants);
|
mParentFrameHintsNotHandledForDescendants);
|
||||||
NS_ASSERTION(!(ourChange & nsChangeHint_AllReflowHints) ||
|
NS_ASSERTION(!(ourChange & nsChangeHint_AllReflowHints) ||
|
||||||
(ourChange & nsChangeHint_NeedReflow),
|
(ourChange & nsChangeHint_NeedReflow),
|
||||||
"Reflow hint bits set without actually asking for a reflow");
|
"Reflow hint bits set without actually asking for a reflow");
|
||||||
@ -1981,7 +1988,8 @@ ElementRestyler::CaptureChange(nsStyleContext* aOldContext,
|
|||||||
mChangeList->AppendChange(mFrame, mContent, ourChange);
|
mChangeList->AppendChange(mFrame, mContent, ourChange);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
aHintsNotHandledForDescendants = NS_HintsNotHandledForDescendantsIn(ourChange);
|
NS_UpdateHint(mHintsNotHandledForDescendants,
|
||||||
|
NS_HintsNotHandledForDescendantsIn(ourChange));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1991,13 +1999,9 @@ ElementRestyler::CaptureChange(nsStyleContext* aOldContext,
|
|||||||
* context. This means that, for pseudo-elements, it is the content
|
* context. This means that, for pseudo-elements, it is the content
|
||||||
* that should be used for selector matching (rather than the fake
|
* that should be used for selector matching (rather than the fake
|
||||||
* content node attached to the frame).
|
* content node attached to the frame).
|
||||||
*
|
|
||||||
* For aParentFrameHintsNotHandledForDescendants, see
|
|
||||||
* nsStyleContext::CalcStyleDifference.
|
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
ElementRestyler::Restyle(nsChangeHint aParentFrameHintsNotHandledForDescendants,
|
ElementRestyler::Restyle(nsRestyleHint aRestyleHint,
|
||||||
nsRestyleHint aRestyleHint,
|
|
||||||
RestyleTracker& aRestyleTracker,
|
RestyleTracker& aRestyleTracker,
|
||||||
DesiredA11yNotifications aDesiredA11yNotifications,
|
DesiredA11yNotifications aDesiredA11yNotifications,
|
||||||
nsTArray<nsIContent*>& aVisibleKidsOfHiddenElement,
|
nsTArray<nsIContent*>& aVisibleKidsOfHiddenElement,
|
||||||
@ -2086,8 +2090,7 @@ ElementRestyler::Restyle(nsChangeHint aParentFrameHintsNotHandledForDescen
|
|||||||
|
|
||||||
ElementRestyler providerRestyler(PARENT_CONTEXT_FROM_CHILD_FRAME,
|
ElementRestyler providerRestyler(PARENT_CONTEXT_FROM_CHILD_FRAME,
|
||||||
*this, providerFrame);
|
*this, providerFrame);
|
||||||
providerRestyler.Restyle(nsChangeHint_Hints_NotHandledForDescendants,
|
providerRestyler.Restyle(aRestyleHint,
|
||||||
aRestyleHint,
|
|
||||||
aRestyleTracker,
|
aRestyleTracker,
|
||||||
aDesiredA11yNotifications,
|
aDesiredA11yNotifications,
|
||||||
aVisibleKidsOfHiddenElement,
|
aVisibleKidsOfHiddenElement,
|
||||||
@ -2105,7 +2108,7 @@ ElementRestyler::Restyle(nsChangeHint aParentFrameHintsNotHandledForDescen
|
|||||||
if (providerFrame != mFrame->GetParent()) {
|
if (providerFrame != mFrame->GetParent()) {
|
||||||
// We don't actually know what the parent style context's
|
// We don't actually know what the parent style context's
|
||||||
// non-inherited hints were, so assume the worst.
|
// non-inherited hints were, so assume the worst.
|
||||||
aParentFrameHintsNotHandledForDescendants =
|
mParentFrameHintsNotHandledForDescendants =
|
||||||
nsChangeHint_Hints_NotHandledForDescendants;
|
nsChangeHint_Hints_NotHandledForDescendants;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2157,7 +2160,6 @@ ElementRestyler::Restyle(nsChangeHint aParentFrameHintsNotHandledForDescen
|
|||||||
|
|
||||||
// do primary context
|
// do primary context
|
||||||
nsRefPtr<nsStyleContext> newContext;
|
nsRefPtr<nsStyleContext> newContext;
|
||||||
nsChangeHint nonInheritedHints = nsChangeHint(0);
|
|
||||||
nsIFrame *prevContinuation =
|
nsIFrame *prevContinuation =
|
||||||
GetPrevContinuationWithPossiblySameStyle(mFrame);
|
GetPrevContinuationWithPossiblySameStyle(mFrame);
|
||||||
nsStyleContext *prevContinuationContext;
|
nsStyleContext *prevContinuationContext;
|
||||||
@ -2261,9 +2263,7 @@ ElementRestyler::Restyle(nsChangeHint aParentFrameHintsNotHandledForDescen
|
|||||||
oldContext, &newContext);
|
oldContext, &newContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
CaptureChange(oldContext, newContext,
|
CaptureChange(oldContext, newContext, assumeDifferenceHint);
|
||||||
aParentFrameHintsNotHandledForDescendants,
|
|
||||||
nonInheritedHints, assumeDifferenceHint);
|
|
||||||
if (!(mHintsHandled & nsChangeHint_ReconstructFrame)) {
|
if (!(mHintsHandled & nsChangeHint_ReconstructFrame)) {
|
||||||
// if frame gets regenerated, let it keep old context
|
// if frame gets regenerated, let it keep old context
|
||||||
mFrame->SetStyleContext(newContext);
|
mFrame->SetStyleContext(newContext);
|
||||||
@ -2307,12 +2307,7 @@ ElementRestyler::Restyle(nsChangeHint aParentFrameHintsNotHandledForDescen
|
|||||||
}
|
}
|
||||||
if (newExtraContext) {
|
if (newExtraContext) {
|
||||||
if (oldExtraContext != newExtraContext) {
|
if (oldExtraContext != newExtraContext) {
|
||||||
nsChangeHint extraHintsNotHandledForDescendants = nsChangeHint(0);
|
CaptureChange(oldExtraContext, newExtraContext, assumeDifferenceHint);
|
||||||
CaptureChange(oldExtraContext, newExtraContext,
|
|
||||||
aParentFrameHintsNotHandledForDescendants,
|
|
||||||
extraHintsNotHandledForDescendants,
|
|
||||||
assumeDifferenceHint);
|
|
||||||
NS_UpdateHint(nonInheritedHints, extraHintsNotHandledForDescendants);
|
|
||||||
if (!(mHintsHandled & nsChangeHint_ReconstructFrame)) {
|
if (!(mHintsHandled & nsChangeHint_ReconstructFrame)) {
|
||||||
mFrame->SetAdditionalStyleContext(contextIndex, newExtraContext);
|
mFrame->SetAdditionalStyleContext(contextIndex, newExtraContext);
|
||||||
}
|
}
|
||||||
@ -2561,8 +2556,7 @@ ElementRestyler::Restyle(nsChangeHint aParentFrameHintsNotHandledForDescen
|
|||||||
oofRestyler.mHintsHandled =
|
oofRestyler.mHintsHandled =
|
||||||
NS_SubtractHint(oofRestyler.mHintsHandled,
|
NS_SubtractHint(oofRestyler.mHintsHandled,
|
||||||
nsChangeHint_AllReflowHints);
|
nsChangeHint_AllReflowHints);
|
||||||
oofRestyler.Restyle(nonInheritedHints,
|
oofRestyler.Restyle(childRestyleHint,
|
||||||
childRestyleHint,
|
|
||||||
aRestyleTracker,
|
aRestyleTracker,
|
||||||
kidsDesiredA11yNotification,
|
kidsDesiredA11yNotification,
|
||||||
aVisibleKidsOfHiddenElement,
|
aVisibleKidsOfHiddenElement,
|
||||||
@ -2572,8 +2566,7 @@ ElementRestyler::Restyle(nsChangeHint aParentFrameHintsNotHandledForDescen
|
|||||||
// reresolve placeholder's context under the same parent
|
// reresolve placeholder's context under the same parent
|
||||||
// as the out-of-flow frame
|
// as the out-of-flow frame
|
||||||
ElementRestyler phRestyler(*this, child);
|
ElementRestyler phRestyler(*this, child);
|
||||||
phRestyler.Restyle(nonInheritedHints,
|
phRestyler.Restyle(childRestyleHint,
|
||||||
childRestyleHint,
|
|
||||||
aRestyleTracker,
|
aRestyleTracker,
|
||||||
kidsDesiredA11yNotification,
|
kidsDesiredA11yNotification,
|
||||||
aVisibleKidsOfHiddenElement,
|
aVisibleKidsOfHiddenElement,
|
||||||
@ -2582,8 +2575,7 @@ ElementRestyler::Restyle(nsChangeHint aParentFrameHintsNotHandledForDescen
|
|||||||
else { // regular child frame
|
else { // regular child frame
|
||||||
if (child != resolvedChild) {
|
if (child != resolvedChild) {
|
||||||
ElementRestyler childRestyler(*this, child);
|
ElementRestyler childRestyler(*this, child);
|
||||||
childRestyler.Restyle(nonInheritedHints,
|
childRestyler.Restyle(childRestyleHint,
|
||||||
childRestyleHint,
|
|
||||||
aRestyleTracker,
|
aRestyleTracker,
|
||||||
kidsDesiredA11yNotification,
|
kidsDesiredA11yNotification,
|
||||||
aVisibleKidsOfHiddenElement,
|
aVisibleKidsOfHiddenElement,
|
||||||
@ -2670,9 +2662,7 @@ RestyleManager::ComputeStyleChangeFor(nsIFrame* aFrame,
|
|||||||
ElementRestyler restyler(mPresContext, frame, aChangeList,
|
ElementRestyler restyler(mPresContext, frame, aChangeList,
|
||||||
aMinChange);
|
aMinChange);
|
||||||
|
|
||||||
restyler.Restyle(nsChangeHint(0),
|
restyler.Restyle(aRestyleDescendants ? eRestyle_Subtree : eRestyle_Self,
|
||||||
aRestyleDescendants ?
|
|
||||||
eRestyle_Subtree : eRestyle_Self,
|
|
||||||
aRestyleTracker,
|
aRestyleTracker,
|
||||||
ElementRestyler::eSendAllNotifications,
|
ElementRestyler::eSendAllNotifications,
|
||||||
visibleKidsOfHiddenElement,
|
visibleKidsOfHiddenElement,
|
||||||
|
@ -314,8 +314,7 @@ public:
|
|||||||
* nsRestyleHint(0) to mean recompute a new style context for our
|
* nsRestyleHint(0) to mean recompute a new style context for our
|
||||||
* current parent and existing rulenode, and the same for kids.
|
* current parent and existing rulenode, and the same for kids.
|
||||||
*/
|
*/
|
||||||
void Restyle(nsChangeHint aParentFrameHintsNotHandledForDescendants,
|
void Restyle(nsRestyleHint aRestyleHint,
|
||||||
nsRestyleHint aRestyleHint,
|
|
||||||
RestyleTracker& aRestyleTracker,
|
RestyleTracker& aRestyleTracker,
|
||||||
DesiredA11yNotifications aDesiredA11yNotifications,
|
DesiredA11yNotifications aDesiredA11yNotifications,
|
||||||
nsTArray<nsIContent*>& aVisibleKidsOfHiddenElement,
|
nsTArray<nsIContent*>& aVisibleKidsOfHiddenElement,
|
||||||
@ -333,8 +332,6 @@ public:
|
|||||||
private:
|
private:
|
||||||
void CaptureChange(nsStyleContext* aOldContext,
|
void CaptureChange(nsStyleContext* aOldContext,
|
||||||
nsStyleContext* aNewContext,
|
nsStyleContext* aNewContext,
|
||||||
/*in*/nsChangeHint aParentHintsNotHandledForDescendants,
|
|
||||||
/*out*/nsChangeHint &aHintsNotHandledForDescendants,
|
|
||||||
nsChangeHint aChangeToAssume);
|
nsChangeHint aChangeToAssume);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -352,6 +349,9 @@ private:
|
|||||||
// need to generate a new change list entry for the frame when its
|
// need to generate a new change list entry for the frame when its
|
||||||
// style comparision returns a hint other than one of these hints.
|
// style comparision returns a hint other than one of these hints.
|
||||||
nsChangeHint mHintsHandled;
|
nsChangeHint mHintsHandled;
|
||||||
|
// See nsStyleContext::CalcStyleDifference
|
||||||
|
nsChangeHint mParentFrameHintsNotHandledForDescendants;
|
||||||
|
nsChangeHint mHintsNotHandledForDescendants;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
Loading…
Reference in New Issue
Block a user