Bug 1038781 - Don't reflow/repaint frame when clip changes. r=roc

If an element's existing clip changes, just update overflow areas and let
DLBI handle invalidation.
This commit is contained in:
Chris Lord 2014-07-16 13:28:50 +02:00
Родитель 7be232e980
Коммит e999475d51
3 изменённых файлов: 28 добавлений и 8 удалений

Просмотреть файл

@ -83,8 +83,9 @@ DoApplyRenderingChangeToTree(nsIFrame* aFrame,
* if aChange has nsChangeHint_SyncFrameView.
* Calls DoApplyRenderingChangeToTree on all aFrame's out-of-flow descendants
* (following placeholders), if aChange has nsChangeHint_RepaintFrame.
* aFrame should be some combination of nsChangeHint_SyncFrameView and
* nsChangeHint_RepaintFrame and nsChangeHint_UpdateOpacityLayer, nothing else.
* aFrame should be some combination of nsChangeHint_SyncFrameView,
* nsChangeHint_RepaintFrame, nsChangeHint_UpdateOpacityLayer and
* nsChangeHint_SchedulePaint, nothing else.
*/
static void
SyncViewsAndInvalidateDescendants(nsIFrame* aFrame,
@ -94,7 +95,8 @@ SyncViewsAndInvalidateDescendants(nsIFrame* aFrame,
"should only be called within ApplyRenderingChangeToTree");
NS_ASSERTION(aChange == (aChange & (nsChangeHint_RepaintFrame |
nsChangeHint_SyncFrameView |
nsChangeHint_UpdateOpacityLayer)),
nsChangeHint_UpdateOpacityLayer |
nsChangeHint_SchedulePaint)),
"Invalid change flag");
nsView* view = aFrame->GetView();
@ -184,7 +186,8 @@ DoApplyRenderingChangeToTree(nsIFrame* aFrame,
SyncViewsAndInvalidateDescendants(aFrame,
nsChangeHint(aChange & (nsChangeHint_RepaintFrame |
nsChangeHint_SyncFrameView |
nsChangeHint_UpdateOpacityLayer)));
nsChangeHint_UpdateOpacityLayer |
nsChangeHint_SchedulePaint)));
// This must be set to true if the rendering change needs to
// invalidate content. If it's false, a composite-only paint
// (empty transaction) will be scheduled.
@ -261,6 +264,9 @@ DoApplyRenderingChangeToTree(nsIFrame* aFrame,
ActiveLayerTracker::NotifyRestyle(childFrame, eCSSProperty_transform);
}
}
if (aChange & nsChangeHint_SchedulePaint) {
needInvalidatingPaint = true;
}
aFrame->SchedulePaint(needInvalidatingPaint ?
nsIFrame::PAINT_DEFAULT :
nsIFrame::PAINT_COMPOSITE_ONLY);
@ -735,7 +741,7 @@ RestyleManager::ProcessRestyledFrames(nsStyleChangeList& aChangeList)
if (hint & (nsChangeHint_RepaintFrame | nsChangeHint_SyncFrameView |
nsChangeHint_UpdateOpacityLayer | nsChangeHint_UpdateTransformLayer |
nsChangeHint_ChildrenOnlyTransform)) {
nsChangeHint_ChildrenOnlyTransform | nsChangeHint_SchedulePaint)) {
ApplyRenderingChangeToTree(mPresContext, frame, hint);
}
if ((hint & nsChangeHint_RecomputePosition) && !didReflowThisFrame) {

Просмотреть файл

@ -127,7 +127,13 @@ enum nsChangeHint {
* SVG textPath needs to be recomputed because the path has changed.
* This means that the glyph positions of the text need to be recomputed.
*/
nsChangeHint_UpdateTextPath = 0x40000
nsChangeHint_UpdateTextPath = 0x40000,
/**
* This will schedule an invalidating paint. This is useful if something
* has changed which will be invalidated by DLBI.
*/
nsChangeHint_SchedulePaint = 0x80000
// IMPORTANT NOTE: When adding new hints, consider whether you need to
// add them to NS_HintsNotHandledForDescendantsIn() below.
@ -228,7 +234,8 @@ inline nsChangeHint NS_HintsNotHandledForDescendantsIn(nsChangeHint aChangeHint)
#define NS_STYLE_HINT_NONE \
nsChangeHint(0)
#define NS_STYLE_HINT_VISUAL \
nsChangeHint(nsChangeHint_RepaintFrame | nsChangeHint_SyncFrameView)
nsChangeHint(nsChangeHint_RepaintFrame | nsChangeHint_SyncFrameView | \
nsChangeHint_SchedulePaint)
#define nsChangeHint_AllReflowHints \
nsChangeHint(nsChangeHint_NeedReflow | \
nsChangeHint_ClearAncestorIntrinsics | \

Просмотреть файл

@ -2501,10 +2501,17 @@ nsChangeHint nsStyleDisplay::CalcDifference(const nsStyleDisplay& aOther) const
|| mAppearance != aOther.mAppearance
|| mOrient != aOther.mOrient
|| mOverflowClipBox != aOther.mOverflowClipBox
|| mClipFlags != aOther.mClipFlags || !mClip.IsEqualInterior(aOther.mClip))
|| mClipFlags != aOther.mClipFlags)
NS_UpdateHint(hint, NS_CombineHint(nsChangeHint_AllReflowHints,
nsChangeHint_RepaintFrame));
if (!mClip.IsEqualInterior(aOther.mClip)) {
// If the clip has changed, we just need to update overflow areas. DLBI
// will handle the invalidation.
NS_UpdateHint(hint, NS_CombineHint(nsChangeHint_UpdateOverflow,
nsChangeHint_SchedulePaint));
}
if (mOpacity != aOther.mOpacity) {
// If we're going from the optimized >=0.99 opacity value to 1.0 or back, then
// repaint the frame because DLBI will not catch the invalidation. Otherwise,