Bug 875037 - Fix lots of bugs in nsStyleSVG/nsSVGStyleReset::CalcDifference so that they return the correct hints. r=roc

This commit is contained in:
Jonathan Watt 2013-05-24 18:31:33 +01:00
parent 99a1385538
commit c44e28a47c
2 changed files with 58 additions and 26 deletions

View File

@ -900,17 +900,16 @@ nsChangeHint nsStyleSVG::CalcDifference(const nsStyleSVG& aOther) const
{
nsChangeHint hint = nsChangeHint(0);
if (mTextRendering != aOther.mTextRendering) {
NS_UpdateHint(hint, nsChangeHint_RepaintFrame);
// May be needed for non-svg frames
NS_UpdateHint(hint, nsChangeHint_AllReflowHints);
}
if (!EqualURIs(mMarkerEnd, aOther.mMarkerEnd) ||
!EqualURIs(mMarkerMid, aOther.mMarkerMid) ||
!EqualURIs(mMarkerStart, aOther.mMarkerStart)) {
NS_UpdateHint(hint, nsChangeHint_RepaintFrame);
// Markers currently contribute to nsSVGPathGeometryFrame::mRect,
// so we need a reflow as well as a repaint. No intrinsic sizes need
// to change, so nsChangeHint_NeedReflow is sufficient.
NS_UpdateHint(hint, nsChangeHint_UpdateEffects);
NS_UpdateHint(hint, nsChangeHint_NeedReflow);
NS_UpdateHint(hint, nsChangeHint_NeedDirtyReflow); // XXX remove me: bug 876085
NS_UpdateHint(hint, nsChangeHint_RepaintFrame);
return hint;
}
@ -921,17 +920,33 @@ nsChangeHint nsStyleSVG::CalcDifference(const nsStyleSVG& aOther) const
PaintURIChanged(mStroke, aOther.mStroke)) {
NS_UpdateHint(hint, nsChangeHint_UpdateEffects);
}
// Nothing more to do, below we can only set "repaint"
}
// Stroke currently contributes to nsSVGPathGeometryFrame::mRect, so
// we need a reflow here. No intrinsic sizes need to change, so
// nsChangeHint_NeedReflow is sufficient.
// Note that stroke-dashoffset does not affect nsSVGPathGeometryFrame::mRect.
// text-anchor and text-rendering changes also require a reflow since they
// change frames' rects.
if (mStrokeWidth != aOther.mStrokeWidth ||
mStrokeMiterlimit != aOther.mStrokeMiterlimit ||
mStrokeLinecap != aOther.mStrokeLinecap ||
mStrokeLinejoin != aOther.mStrokeLinejoin ||
mTextAnchor != aOther.mTextAnchor ||
mTextRendering != aOther.mTextRendering) {
NS_UpdateHint(hint, nsChangeHint_NeedReflow);
NS_UpdateHint(hint, nsChangeHint_NeedDirtyReflow); // XXX remove me: bug 876085
NS_UpdateHint(hint, nsChangeHint_RepaintFrame);
return hint;
}
if (hint & nsChangeHint_RepaintFrame) {
return hint; // we don't add anything else below
}
if ( mStrokeDashoffset != aOther.mStrokeDashoffset ||
mStrokeWidth != aOther.mStrokeWidth ||
mFillOpacity != aOther.mFillOpacity ||
mStrokeMiterlimit != aOther.mStrokeMiterlimit ||
mStrokeOpacity != aOther.mStrokeOpacity ||
mClipRule != aOther.mClipRule ||
mColorInterpolation != aOther.mColorInterpolation ||
mColorInterpolationFilters != aOther.mColorInterpolationFilters ||
@ -940,9 +955,6 @@ nsChangeHint nsStyleSVG::CalcDifference(const nsStyleSVG& aOther) const
mPaintOrder != aOther.mPaintOrder ||
mShapeRendering != aOther.mShapeRendering ||
mStrokeDasharrayLength != aOther.mStrokeDasharrayLength ||
mStrokeLinecap != aOther.mStrokeLinecap ||
mStrokeLinejoin != aOther.mStrokeLinejoin ||
mTextAnchor != aOther.mTextAnchor ||
mFillOpacitySource != aOther.mFillOpacitySource ||
mStrokeOpacitySource != aOther.mStrokeOpacitySource ||
mStrokeDasharrayFromObject != aOther.mStrokeDasharrayFromObject ||
@ -1010,18 +1022,29 @@ nsChangeHint nsStyleSVGReset::CalcDifference(const nsStyleSVGReset& aOther) cons
!EqualURIs(mFilter, aOther.mFilter) ||
!EqualURIs(mMask, aOther.mMask)) {
NS_UpdateHint(hint, nsChangeHint_UpdateEffects);
NS_UpdateHint(hint, nsChangeHint_AllReflowHints);
NS_UpdateHint(hint, nsChangeHint_RepaintFrame);
} else if (mDominantBaseline != aOther.mDominantBaseline) {
}
if (mDominantBaseline != aOther.mDominantBaseline) {
// XXXjwatt: why NS_STYLE_HINT_REFLOW? Isn't that excessive?
NS_UpdateHint(hint, NS_STYLE_HINT_REFLOW);
} else if (mVectorEffect != aOther.mVectorEffect) {
// Stroke currently affects nsSVGPathGeometryFrame::mRect, and
// vector-effect affect stroke. As a result we need to reflow if
// vector-effect changes in order to have nsSVGPathGeometryFrame::
// ReflowSVG called to update its mRect. No intrinsic sizes need
// to change so nsChangeHint_NeedReflow is sufficient.
NS_UpdateHint(hint, nsChangeHint_NeedReflow);
NS_UpdateHint(hint, nsChangeHint_NeedDirtyReflow); // XXX remove me: bug 876085
NS_UpdateHint(hint, nsChangeHint_RepaintFrame);
} else if (mStopColor != aOther.mStopColor ||
mFloodColor != aOther.mFloodColor ||
mLightingColor != aOther.mLightingColor ||
mStopOpacity != aOther.mStopOpacity ||
mFloodOpacity != aOther.mFloodOpacity ||
mVectorEffect != aOther.mVectorEffect ||
mMaskType != aOther.mMaskType)
mMaskType != aOther.mMaskType) {
NS_UpdateHint(hint, nsChangeHint_RepaintFrame);
}
return hint;
}
@ -2296,12 +2319,21 @@ nsChangeHint nsStyleVisibility::CalcDifference(const nsStyleVisibility& aOther)
if (mDirection != aOther.mDirection) {
NS_UpdateHint(hint, nsChangeHint_ReconstructFrame);
} else if (mVisible != aOther.mVisible) {
if ((NS_STYLE_VISIBILITY_COLLAPSE == mVisible) ||
(NS_STYLE_VISIBILITY_COLLAPSE == aOther.mVisible)) {
NS_UpdateHint(hint, NS_STYLE_HINT_REFLOW);
} else {
NS_UpdateHint(hint, NS_STYLE_HINT_VISUAL);
} else {
if (mVisible != aOther.mVisible) {
if ((NS_STYLE_VISIBILITY_COLLAPSE == mVisible) ||
(NS_STYLE_VISIBILITY_COLLAPSE == aOther.mVisible)) {
NS_UpdateHint(hint, NS_STYLE_HINT_REFLOW);
} else {
NS_UpdateHint(hint, NS_STYLE_HINT_VISUAL);
}
}
if (mPointerEvents != aOther.mPointerEvents) {
// nsSVGPathGeometryFrame's mRect depends on stroke _and_ on the value
// of pointer-events. See nsSVGPathGeometryFrame::ReflowSVG's use of
// GetHitTestFlags. (Only a reflow, no visual change.)
NS_UpdateHint(hint, nsChangeHint_NeedReflow);
NS_UpdateHint(hint, nsChangeHint_NeedDirtyReflow); // XXX remove me: bug 876085
}
}
return hint;

View File

@ -2202,7 +2202,7 @@ struct nsStyleSVG {
nsChangeHint CalcDifference(const nsStyleSVG& aOther) const;
static nsChangeHint MaxDifference() {
return NS_CombineHint(NS_CombineHint(nsChangeHint_UpdateEffects,
nsChangeHint_AllReflowHints),
NS_CombineHint(nsChangeHint_NeedReflow, nsChangeHint_NeedDirtyReflow)), // XXX remove nsChangeHint_NeedDirtyReflow: bug 876085
nsChangeHint_RepaintFrame);
}