Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(546)

Unified Diff: third_party/WebKit/Source/core/paint/ObjectPaintInvalidator.cpp

Issue 2442383002: Simplify ObjectPaintInvalidatorW/C::computePaintInvalidationReason() (Closed)
Patch Set: rebaseline-cl Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/platform/win7/paint/invalidation/japanese-rl-selection-repaint-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/paint/ObjectPaintInvalidator.cpp
diff --git a/third_party/WebKit/Source/core/paint/ObjectPaintInvalidator.cpp b/third_party/WebKit/Source/core/paint/ObjectPaintInvalidator.cpp
index 910f0acb6335499ff75a55498a92e19851a02341..3f038a5aca64e81064dd9141112a696be001da35 100644
--- a/third_party/WebKit/Source/core/paint/ObjectPaintInvalidator.cpp
+++ b/third_party/WebKit/Source/core/paint/ObjectPaintInvalidator.cpp
@@ -429,19 +429,6 @@ ObjectPaintInvalidatorWithContext::computePaintInvalidationReason() {
if (style.hasOutline())
return PaintInvalidationOutline;
- bool locationChanged = m_context.newLocation != m_context.oldLocation;
-
- // If the bounds are the same then we know that none of the statements below
- // can match, so we can early out. However, we can't return
- // PaintInvalidationNone even if !locationChagned, but conservatively return
- // PaintInvalidationIncremental because we are not sure whether paint
- // invalidation is actually needed just based on information known to
- // LayoutObject. For example, a LayoutBox may need paint invalidation if
- // border box changes.
- if (m_context.oldBounds == m_context.newBounds)
- return locationChanged ? PaintInvalidationLocationChange
- : PaintInvalidationIncremental;
-
// If the size is zero on one of our bounds then we know we're going to have
// to do a full invalidation of either old bounds or new bounds.
if (m_context.oldBounds.isEmpty())
@@ -456,10 +443,19 @@ ObjectPaintInvalidatorWithContext::computePaintInvalidationReason() {
if (m_context.newBounds.location() != m_context.oldBounds.location())
return PaintInvalidationBoundsChange;
- if (locationChanged)
+ if (m_context.newLocation != m_context.oldLocation)
return PaintInvalidationLocationChange;
- return PaintInvalidationIncremental;
+ // Incremental invalidation is only applicable to LayoutBoxes. Return
+ // PaintInvalidationIncremental no matter if oldBounds and newBounds are equal
+ // because a LayoutBox may need paint invalidation if its border box changes.
+ if (m_object.isBox())
+ return PaintInvalidationIncremental;
+
+ if (m_context.oldBounds != m_context.newBounds)
+ return PaintInvalidationBoundsChange;
+
+ return PaintInvalidationNone;
}
void ObjectPaintInvalidatorWithContext::invalidateSelectionIfNeeded(
@@ -499,11 +495,6 @@ ObjectPaintInvalidatorWithContext::invalidatePaintIfNeededWithComputedReason(
// selection rect regardless.
invalidateSelectionIfNeeded(reason);
- if (reason == PaintInvalidationIncremental) {
- reason = m_context.oldBounds == m_context.newBounds ? PaintInvalidationNone
- : PaintInvalidationFull;
- }
-
switch (reason) {
case PaintInvalidationNone:
// TODO(trchen): Currently we don't keep track of paint offset of layout
« no previous file with comments | « third_party/WebKit/LayoutTests/platform/win7/paint/invalidation/japanese-rl-selection-repaint-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698