Backed out changeset 25462849adcc (bug 502288) to get some talos cycles for the tracemonkey merge without this patch in.

--HG--
extra : rebase_source : bff86f8ab792af6109b1862d601e2ba560dc4ba1
This commit is contained in:
Boris Zbarsky 2009-08-03 15:10:09 -04:00
parent 89fea00157
commit bc219716a8
5 changed files with 37 additions and 123 deletions

View File

@ -7571,8 +7571,7 @@ InvalidateCanvasIfNeeded(nsIPresShell* presShell, nsIContent* node)
}
nsresult
nsCSSFrameConstructor::StyleChangeReflow(nsIFrame* aFrame,
nsChangeHint aHint)
nsCSSFrameConstructor::StyleChangeReflow(nsIFrame* aFrame)
{
// If the frame hasn't even received an initial reflow, then don't
// send it a style-change reflow!
@ -7587,27 +7586,17 @@ nsCSSFrameConstructor::StyleChangeReflow(nsIFrame* aFrame,
}
#endif
nsIPresShell::IntrinsicDirty dirtyType;
if (aHint & nsChangeHint_ClearDescendantIntrinsics) {
NS_ASSERTION(aHint & nsChangeHint_ClearAncestorIntrinsics,
"Please read the comments in nsChangeHint.h");
dirtyType = nsIPresShell::eStyleChange;
} else if (aHint & nsChangeHint_ClearAncestorIntrinsics) {
dirtyType = nsIPresShell::eTreeChange;
} else {
dirtyType = nsIPresShell::eResize;
}
nsFrameState dirtyBits;
if (aHint & nsChangeHint_NeedDirtyReflow) {
dirtyBits = NS_FRAME_IS_DIRTY;
} else {
dirtyBits = NS_FRAME_HAS_DIRTY_CHILDREN;
}
// If the frame is part of a split block-in-inline hierarchy, then
// target the style-change reflow at the first ``normal'' ancestor
// so we're sure that the style change will propagate to any
// anonymously created siblings.
if (IsFrameSpecial(aFrame))
aFrame = GetIBContainingBlockFor(aFrame);
do {
mPresShell->FrameNeedsReflow(aFrame, dirtyType, dirtyBits);
aFrame = nsLayoutUtils::GetNextContinuationOrSpecialSibling(aFrame);
mPresShell->FrameNeedsReflow(aFrame, nsIPresShell::eStyleChange,
NS_FRAME_IS_DIRTY);
aFrame = aFrame->GetNextContinuation();
} while (aFrame);
return NS_OK;
@ -7729,11 +7718,6 @@ nsCSSFrameConstructor::ProcessRestyledFrames(nsStyleChangeList& aChangeList)
nsIContent* content;
nsChangeHint hint;
aChangeList.ChangeAt(index, frame, content, hint);
NS_ASSERTION(!(hint & nsChangeHint_ReflowFrame) ||
(hint & nsChangeHint_NeedReflow),
"Reflow hint bits set without actually asking for a reflow");
if (frame && frame->GetContent() != content) {
// XXXbz this is due to image maps messing with the primary frame map.
// See bug 135040. Remove this block once that's fixed.
@ -7762,8 +7746,8 @@ nsCSSFrameConstructor::ProcessRestyledFrames(nsStyleChangeList& aChangeList)
nsSVGEffects::UpdateEffects(frame);
}
#endif
if (hint & nsChangeHint_NeedReflow) {
StyleChangeReflow(frame, hint);
if (hint & nsChangeHint_ReflowFrame) {
StyleChangeReflow(frame);
didReflow = PR_TRUE;
}
if (hint & (nsChangeHint_RepaintFrame | nsChangeHint_SyncFrameView)) {

View File

@ -1541,7 +1541,7 @@ private:
nsresult ReframeContainingBlock(nsIFrame* aFrame);
nsresult StyleChangeReflow(nsIFrame* aFrame, nsChangeHint aHint);
nsresult StyleChangeReflow(nsIFrame* aFrame);
/** Helper function that searches the immediate child frames
* (and their children if the frames are "special")

View File

@ -45,32 +45,10 @@
// Defines for various style related constants
enum nsChangeHint {
// change was visual only (e.g., COLOR=)
nsChangeHint_RepaintFrame = 0x01,
// For reflow, we want flags to give us arbitrary FrameNeedsReflow behavior.
// just do a FrameNeedsReflow
nsChangeHint_NeedReflow = 0x02,
// Invalidate intrinsic widths on the frame's ancestors. Must not be set
// without setting nsChangeHint_NeedReflow.
nsChangeHint_ClearAncestorIntrinsics = 0x04,
// Invalidate intrinsic widths on the frame's descendants. Must not be set
// without also setting nsChangeHint_ClearAncestorIntrinsics.
nsChangeHint_ClearDescendantIntrinsics = 0x08,
// Force unconditional reflow of all descendants. Must not be set without
// setting nsChangeHint_NeedReflow, but is independent of both the
// Clear*Intrinsics flags.
nsChangeHint_NeedDirtyReflow = 0x10,
// change requires view to be updated, if there is one (e.g., clip:)
nsChangeHint_SyncFrameView = 0x20,
// The currently shown mouse cursor needs to be updated
nsChangeHint_UpdateCursor = 0x40,
nsChangeHint_RepaintFrame = 0x01, // change was visual only (e.g., COLOR=)
nsChangeHint_ReflowFrame = 0x02, // change requires reflow (e.g., WIDTH=)
nsChangeHint_SyncFrameView = 0x04, // change requires view to be updated, if there is one (e.g., clip:)
nsChangeHint_UpdateCursor = 0x08, // The currently shown mouse cursor needs to be updated
/**
* SVG filter/mask/clip effects need to be recomputed because the URI
* in the filter/mask/clip-path property has changed. This wipes
@ -80,13 +58,14 @@ enum nsChangeHint {
* bounding-box for the filter result so that if the filter changes we can
* invalidate the old covered area.
*/
nsChangeHint_UpdateEffects = 0x80,
// change requires frame change (e.g., display:).
// This subsumes all the above.
nsChangeHint_ReconstructFrame = 0x100
nsChangeHint_UpdateEffects = 0x10,
nsChangeHint_ReconstructFrame = 0x20 // change requires frame change (e.g., display:)
// This subsumes all the above
// TBD: add nsChangeHint_ForceFrameView to force frame reconstruction if the frame doesn't yet
// have a view
};
#ifdef DEBUG_roc
// Redefine these operators to return nothing. This will catch any use
// of these operators on hints. We should not be using these operators
// on nsChangeHints
@ -96,6 +75,7 @@ inline void operator!=(nsChangeHint s1, nsChangeHint s2) {}
inline void operator==(nsChangeHint s1, nsChangeHint s2) {}
inline void operator<=(nsChangeHint s1, nsChangeHint s2) {}
inline void operator>=(nsChangeHint s1, nsChangeHint s2) {}
#endif
// Operators on nsChangeHints
@ -128,16 +108,12 @@ inline PRBool NS_IsHintSubset(nsChangeHint aSubset, nsChangeHint aSuperSet) {
nsChangeHint(0)
#define NS_STYLE_HINT_VISUAL \
nsChangeHint(nsChangeHint_RepaintFrame | nsChangeHint_SyncFrameView)
#define nsChangeHint_ReflowFrame \
nsChangeHint(nsChangeHint_NeedReflow | \
nsChangeHint_ClearAncestorIntrinsics | \
nsChangeHint_ClearDescendantIntrinsics | \
nsChangeHint_NeedDirtyReflow)
#define NS_STYLE_HINT_REFLOW \
nsChangeHint(NS_STYLE_HINT_VISUAL | nsChangeHint_ReflowFrame)
#define NS_STYLE_HINT_FRAMECHANGE \
nsChangeHint(NS_STYLE_HINT_REFLOW | nsChangeHint_ReconstructFrame)
/**
* |nsReStyleHint| is a bitfield for the result of |HasStateDependentStyle|
* and |HasAttributeDependentStyle|. All values have an implied "and

View File

@ -1085,16 +1085,6 @@ nsFrameManager::ReResolveStyleContext(nsPresContext *aPresContext,
nsChangeHint aMinChange,
PRBool aFireAccessibilityEvents)
{
// If aMinChange doesn't include nsChangeHint_NeedDirtyReflow, clear out the
// nsChangeHint_NeedReflow bit from it, so that we'll make sure to append a
// change to the list for ourselves if we need a reflow. Need this because
// the parent may or may not actually end up reflowing us otherwise. This
// works because any reflow hint will include nsChangeHint_NeedReflow, which
// will be missing from aMinChange.
if (!NS_IsHintSubset(nsChangeHint_NeedDirtyReflow, aMinChange)) {
aMinChange = NS_SubtractHint(aMinChange, nsChangeHint_NeedReflow);
}
// It would be nice if we could make stronger assertions here; they
// would let us simplify the ?: expressions below setting |content|
// and |pseudoContent| in sensible ways as well as making what

View File

@ -289,20 +289,14 @@ nsChangeHint nsStyleMargin::CalcDifference(const nsStyleMargin& aOther) const
if (mMargin == aOther.mMargin) {
return NS_STYLE_HINT_NONE;
}
// Margin differences can't affect descendant intrinsic sizes and
// don't need to force children to reflow.
return NS_SubtractHint(NS_STYLE_HINT_REFLOW,
NS_CombineHint(nsChangeHint_ClearDescendantIntrinsics,
nsChangeHint_NeedDirtyReflow));
return NS_STYLE_HINT_REFLOW;
}
#ifdef DEBUG
/* static */
nsChangeHint nsStyleMargin::MaxDifference()
{
return NS_SubtractHint(NS_STYLE_HINT_REFLOW,
NS_CombineHint(nsChangeHint_ClearDescendantIntrinsics,
nsChangeHint_NeedDirtyReflow));
return NS_STYLE_HINT_REFLOW;
}
#endif
@ -350,20 +344,14 @@ nsChangeHint nsStylePadding::CalcDifference(const nsStylePadding& aOther) const
if (mPadding == aOther.mPadding) {
return NS_STYLE_HINT_NONE;
}
// Padding differences can't affect descendant intrinsic sizes and
// don't need to force children to reflow.
return NS_SubtractHint(NS_STYLE_HINT_REFLOW,
NS_CombineHint(nsChangeHint_ClearDescendantIntrinsics,
nsChangeHint_NeedDirtyReflow));
return NS_STYLE_HINT_REFLOW;
}
#ifdef DEBUG
/* static */
nsChangeHint nsStylePadding::MaxDifference()
{
return NS_SubtractHint(NS_STYLE_HINT_REFLOW,
NS_CombineHint(nsChangeHint_ClearDescendantIntrinsics,
nsChangeHint_NeedDirtyReflow));
return NS_STYLE_HINT_REFLOW;
}
#endif
@ -471,8 +459,6 @@ nsChangeHint nsStyleBorder::CalcDifference(const nsStyleBorder& aOther) const
// Note that differences in mBorder don't affect rendering (which should only
// use mComputedBorder), so don't need to be tested for here.
// XXXbz we should be able to return a more specific change hint for
// at least GetActualBorder() differences...
if (mTwipsPerPixel != aOther.mTwipsPerPixel ||
GetActualBorder() != aOther.GetActualBorder() ||
mFloatEdge != aOther.mFloatEdge ||
@ -1069,34 +1055,20 @@ nsStylePosition::nsStylePosition(const nsStylePosition& aSource)
nsChangeHint nsStylePosition::CalcDifference(const nsStylePosition& aOther) const
{
if (mZIndex != aOther.mZIndex) {
// FIXME: Bug 507764. Why do we need reflow here?
return NS_STYLE_HINT_REFLOW;
}
if ((mWidth == aOther.mWidth) &&
if ((mOffset == aOther.mOffset) &&
(mWidth == aOther.mWidth) &&
(mMinWidth == aOther.mMinWidth) &&
(mMaxWidth == aOther.mMaxWidth) &&
(mHeight == aOther.mHeight) &&
(mMinHeight == aOther.mMinHeight) &&
(mMaxHeight == aOther.mMaxHeight) &&
(mBoxSizing == aOther.mBoxSizing)) {
if (mOffset == aOther.mOffset) {
return NS_STYLE_HINT_NONE;
} else {
// Offset changes only affect positioned content, and can't affect any
// intrinsic widths (except, XXXbz, stacks! So for now have to clear
// ancestor intrinsic widths). They also don't need to force reflow of
// descendants.
return NS_CombineHint(nsChangeHint_NeedReflow,
nsChangeHint_ClearAncestorIntrinsics);
}
}
// None of our differences can affect descendant intrinsic sizes and none of
// them need to force children to reflow.
return NS_SubtractHint(nsChangeHint_ReflowFrame,
NS_CombineHint(nsChangeHint_ClearDescendantIntrinsics,
nsChangeHint_NeedDirtyReflow));
(mBoxSizing == aOther.mBoxSizing))
return NS_STYLE_HINT_NONE;
return nsChangeHint_ReflowFrame;
}
#ifdef DEBUG
@ -1607,16 +1579,10 @@ nsChangeHint nsStyleDisplay::CalcDifference(const nsStyleDisplay& aOther) const
|| mOverflowY != aOther.mOverflowY)
NS_UpdateHint(hint, nsChangeHint_ReconstructFrame);
if (mFloats != aOther.mFloats) {
// Changing which side we float on doesn't affect descendants directly
NS_UpdateHint(hint,
NS_SubtractHint(nsChangeHint_ReflowFrame,
NS_CombineHint(nsChangeHint_ClearDescendantIntrinsics,
nsChangeHint_NeedDirtyReflow)));
}
if (mFloats != aOther.mFloats)
NS_UpdateHint(hint, nsChangeHint_ReflowFrame);
if (mClipFlags != aOther.mClipFlags || mClip != aOther.mClip) {
// FIXME: Bug 507764. Could we use a more precise hint here?
NS_UpdateHint(hint, nsChangeHint_ReflowFrame);
}
// XXX the following is conservative, for now: changing float breaking shouldn't
@ -2039,8 +2005,6 @@ nsCSSShadowArray::Release()
// Allowed to return one of NS_STYLE_HINT_NONE, NS_STYLE_HINT_REFLOW
// or NS_STYLE_HINT_VISUAL. Currently we just return NONE or REFLOW, though.
// XXXbz can this not return a more specific hint? If that's ever
// changed, nsStyleBorder::CalcDifference will need changing too.
static nsChangeHint
CalcShadowDifference(nsCSSShadowArray* lhs,
nsCSSShadowArray* rhs)