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

Side by Side Diff: third_party/WebKit/Source/core/paint/BoxPaintInvalidator.cpp

Issue 2247543003: Tweak priorities of paint invalidation reasons (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: NeedsRebaseline (for win and mac) Created 4 years, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/paint/BoxPaintInvalidator.h" 5 #include "core/paint/BoxPaintInvalidator.h"
6 6
7 #include "core/frame/Settings.h" 7 #include "core/frame/Settings.h"
8 #include "core/layout/LayoutView.h" 8 #include "core/layout/LayoutView.h"
9 #include "core/paint/ObjectPaintInvalidator.h" 9 #include "core/paint/ObjectPaintInvalidator.h"
10 #include "core/paint/PaintInvalidator.h" 10 #include "core/paint/PaintInvalidator.h"
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 if (!rectClippedByNewBounds.contains(rectClippedByOldBounds)) 98 if (!rectClippedByNewBounds.contains(rectClippedByOldBounds))
99 m_box.invalidatePaintUsingContainer(*m_context.paintInvalidationContaine r, rectClippedByOldBounds, PaintInvalidationIncremental); 99 m_box.invalidatePaintUsingContainer(*m_context.paintInvalidationContaine r, rectClippedByOldBounds, PaintInvalidationIncremental);
100 if (!rectClippedByOldBounds.contains(rectClippedByNewBounds)) 100 if (!rectClippedByOldBounds.contains(rectClippedByNewBounds))
101 m_box.invalidatePaintUsingContainer(*m_context.paintInvalidationContaine r, rectClippedByNewBounds, PaintInvalidationIncremental); 101 m_box.invalidatePaintUsingContainer(*m_context.paintInvalidationContaine r, rectClippedByNewBounds, PaintInvalidationIncremental);
102 } 102 }
103 103
104 PaintInvalidationReason BoxPaintInvalidator::computePaintInvalidationReason() 104 PaintInvalidationReason BoxPaintInvalidator::computePaintInvalidationReason()
105 { 105 {
106 PaintInvalidationReason reason = ObjectPaintInvalidator(m_box, m_context).co mputePaintInvalidationReason(); 106 PaintInvalidationReason reason = ObjectPaintInvalidator(m_box, m_context).co mputePaintInvalidationReason();
107 107
108 if (reason != PaintInvalidationDelayedFull && isFullPaintInvalidationReason( reason)) 108 if (isImmediateFullPaintInvalidationReason(reason) || reason == PaintInvalid ationNone)
109 return reason; 109 return reason;
110 110
111 if (m_box.mayNeedPaintInvalidationAnimatedBackgroundImage() && !m_box.backgr oundIsKnownToBeObscured()) 111 if (m_box.mayNeedPaintInvalidationAnimatedBackgroundImage() && !m_box.backgr oundIsKnownToBeObscured())
112 reason = PaintInvalidationDelayedFull; 112 reason = PaintInvalidationDelayedFull;
113 113
114 // If the current paint invalidation reason is PaintInvalidationDelayedFull, then this paint invalidation can delayed if the 114 // If the current paint invalidation reason is PaintInvalidationDelayedFull, then this paint invalidation can delayed if the
115 // LayoutBox in question is not on-screen. The logic to decide whether this is appropriate exists at the site of the original 115 // LayoutBox in question is not on-screen. The logic to decide whether this is appropriate exists at the site of the original
116 // paint invalidation that chose PaintInvalidationDelayedFull. 116 // paint invalidation that chose PaintInvalidationDelayedFull.
117 if (reason == PaintInvalidationDelayedFull) { 117 if (reason == PaintInvalidationDelayedFull) {
118 // Do regular full paint invalidation if the object is onscreen. 118 // Do regular full paint invalidation if the object is onscreen.
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 if (previousBoxSizesMap().get(&m_box).layoutOverflowRect != m_box.layout OverflowRect()) 157 if (previousBoxSizesMap().get(&m_box).layoutOverflowRect != m_box.layout OverflowRect())
158 return PaintInvalidationLayoutOverflowBoxChange; 158 return PaintInvalidationLayoutOverflowBoxChange;
159 } 159 }
160 160
161 LayoutSize oldBorderBoxSize = computePreviousBorderBoxSize(m_context.oldBoun ds.size()); 161 LayoutSize oldBorderBoxSize = computePreviousBorderBoxSize(m_context.oldBoun ds.size());
162 LayoutSize newBorderBoxSize = m_box.size(); 162 LayoutSize newBorderBoxSize = m_box.size();
163 163
164 if (oldBorderBoxSize == newBorderBoxSize) 164 if (oldBorderBoxSize == newBorderBoxSize)
165 return reason; 165 return reason;
166 166
167 // LayoutBox::incrementallyInvalidatePaint() depends on positionFromPaintInv alidationBacking
168 // which is not available when slimmingPaintOffsetCachingEnabled.
169 if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled() && (style.has BoxDecorations() || style.hasBackground()))
170 return PaintInvalidationBorderBoxChange;
171
172 // See another hasNonCompositedScrollbars() callsite above. 167 // See another hasNonCompositedScrollbars() callsite above.
173 if (m_box.hasNonCompositedScrollbars()) 168 if (m_box.hasNonCompositedScrollbars())
174 return PaintInvalidationBorderBoxChange; 169 return PaintInvalidationBorderBoxChange;
175 170
176 if (style.hasVisualOverflowingEffect() || style.hasAppearance() || style.has FilterInducingProperty() || style.resize() != RESIZE_NONE) 171 if (style.hasVisualOverflowingEffect() || style.hasAppearance() || style.has FilterInducingProperty() || style.resize() != RESIZE_NONE)
177 return PaintInvalidationBorderBoxChange; 172 return PaintInvalidationBorderBoxChange;
178 173
179 if (style.hasBorderRadius()) { 174 if (style.hasBorderRadius()) {
180 // If a border-radius exists and width/height is smaller than radius wid th/height, 175 // If a border-radius exists and width/height is smaller than radius wid th/height,
181 // we need to fully invalidate to cover the changed radius. 176 // we need to fully invalidate to cover the changed radius.
182 FloatRoundedRect oldRoundedRect = style.getRoundedBorderFor(LayoutRect(L ayoutPoint(0, 0), oldBorderBoxSize)); 177 FloatRoundedRect oldRoundedRect = style.getRoundedBorderFor(LayoutRect(L ayoutPoint(0, 0), oldBorderBoxSize));
183 FloatRoundedRect newRoundedRect = style.getRoundedBorderFor(LayoutRect(L ayoutPoint(0, 0), newBorderBoxSize)); 178 FloatRoundedRect newRoundedRect = style.getRoundedBorderFor(LayoutRect(L ayoutPoint(0, 0), newBorderBoxSize));
184 if (oldRoundedRect.getRadii() != newRoundedRect.getRadii()) 179 if (oldRoundedRect.getRadii() != newRoundedRect.getRadii())
185 return PaintInvalidationBorderBoxChange; 180 return PaintInvalidationBorderBoxChange;
186 } 181 }
187 182
188 if (oldBorderBoxSize.width() != newBorderBoxSize.width() && m_box.mustInvali dateBackgroundOrBorderPaintOnWidthChange()) 183 if (oldBorderBoxSize.width() != newBorderBoxSize.width() && m_box.mustInvali dateBackgroundOrBorderPaintOnWidthChange())
189 return PaintInvalidationBorderBoxChange; 184 return PaintInvalidationBorderBoxChange;
190 if (oldBorderBoxSize.height() != newBorderBoxSize.height() && m_box.mustInva lidateBackgroundOrBorderPaintOnHeightChange()) 185 if (oldBorderBoxSize.height() != newBorderBoxSize.height() && m_box.mustInva lidateBackgroundOrBorderPaintOnHeightChange())
191 return PaintInvalidationBorderBoxChange; 186 return PaintInvalidationBorderBoxChange;
192 187
193 if (reason == PaintInvalidationNone && (style.hasBackground() || style.hasBo xDecorations())) 188 if (reason == PaintInvalidationProbablyNone && (style.hasBackground() || sty le.hasBoxDecorations()))
pdr. 2016/08/15 23:37:42 Could we just return PaintInvalidationIncremental
Xianzhu 2016/08/16 01:13:54 Added comments in PaintInvalidationReason.h. For
194 reason = PaintInvalidationIncremental; 189 reason = PaintInvalidationIncremental;
195 190
196 return reason; 191 return reason;
197 } 192 }
198 193
199 PaintInvalidationReason BoxPaintInvalidator::invalidatePaintIfNeeded() 194 PaintInvalidationReason BoxPaintInvalidator::invalidatePaintIfNeeded()
200 { 195 {
201 PaintInvalidationReason reason = ObjectPaintInvalidator(m_box, m_context).in validatePaintIfNeededWithComputedReason(computePaintInvalidationReason()); 196 PaintInvalidationReason reason = ObjectPaintInvalidator(m_box, m_context).in validatePaintIfNeededWithComputedReason(computePaintInvalidationReason());
202 197
203 // For incremental invalidation, ObjectPaintInvalidator::incrementallyInvali datePaint() is 198 // For incremental invalidation, ObjectPaintInvalidator::incrementallyInvali datePaint() is
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 264
270 auto it = previousBoxSizesMap().find(&m_box); 265 auto it = previousBoxSizesMap().find(&m_box);
271 if (it != previousBoxSizesMap().end()) 266 if (it != previousBoxSizesMap().end())
272 return it->value.borderBoxSize; 267 return it->value.borderBoxSize;
273 268
274 // We didn't save the old border box size because it was the same as the siz e of oldBounds. 269 // We didn't save the old border box size because it was the same as the siz e of oldBounds.
275 return previousBoundsSize; 270 return previousBoundsSize;
276 } 271 }
277 272
278 } // namespace blink 273 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698