OLD | NEW |
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/layout/compositing/CompositedLayerMapping.h" | 9 #include "core/layout/compositing/CompositedLayerMapping.h" |
10 #include "core/paint/ObjectPaintInvalidator.h" | 10 #include "core/paint/ObjectPaintInvalidator.h" |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 } | 239 } |
240 | 240 |
241 context_.painting_layer->SetNeedsRepaint(); | 241 context_.painting_layer->SetNeedsRepaint(); |
242 // Currently we use CompositedLayerMapping as the DisplayItemClient to paint | 242 // Currently we use CompositedLayerMapping as the DisplayItemClient to paint |
243 // background on the scrolling contents layer. | 243 // background on the scrolling contents layer. |
244 ObjectPaintInvalidator(box_).InvalidateDisplayItemClient( | 244 ObjectPaintInvalidator(box_).InvalidateDisplayItemClient( |
245 *box_.Layer()->GetCompositedLayerMapping()->ScrollingContentsLayer(), | 245 *box_.Layer()->GetCompositedLayerMapping()->ScrollingContentsLayer(), |
246 kPaintInvalidationBackgroundOnScrollingContentsLayer); | 246 kPaintInvalidationBackgroundOnScrollingContentsLayer); |
247 } | 247 } |
248 | 248 |
249 PaintInvalidationReason BoxPaintInvalidator::InvalidatePaintIfNeeded() { | 249 PaintInvalidationReason BoxPaintInvalidator::InvalidatePaint() { |
250 InvalidateScrollingContentsBackgroundIfNeeded(); | 250 InvalidateScrollingContentsBackgroundIfNeeded(); |
251 | 251 |
252 PaintInvalidationReason reason = ComputePaintInvalidationReason(); | 252 PaintInvalidationReason reason = ComputePaintInvalidationReason(); |
253 if (reason == kPaintInvalidationIncremental) { | 253 if (reason == kPaintInvalidationIncremental) { |
254 bool invalidated; | 254 bool invalidated; |
255 if (box_.IsLayoutView() && | 255 if (box_.IsLayoutView() && |
256 !RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { | 256 !RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { |
257 invalidated = IncrementallyInvalidatePaint( | 257 invalidated = IncrementallyInvalidatePaint( |
258 reason, context_.old_visual_rect, box_.VisualRect()); | 258 reason, context_.old_visual_rect, box_.VisualRect()); |
259 } else { | 259 } else { |
260 invalidated = IncrementallyInvalidatePaint( | 260 invalidated = IncrementallyInvalidatePaint( |
261 reason, LayoutRect(context_.old_location, box_.PreviousSize()), | 261 reason, LayoutRect(context_.old_location, box_.PreviousSize()), |
262 LayoutRect(context_.new_location, box_.Size())); | 262 LayoutRect(context_.new_location, box_.Size())); |
263 } | 263 } |
264 if (invalidated) { | 264 if (invalidated) { |
265 context_.painting_layer->SetNeedsRepaint(); | 265 context_.painting_layer->SetNeedsRepaint(); |
266 box_.InvalidateDisplayItemClients(reason); | 266 box_.InvalidateDisplayItemClients(reason); |
267 } else { | 267 } else { |
268 reason = kPaintInvalidationNone; | 268 reason = kPaintInvalidationNone; |
269 } | 269 } |
270 | 270 |
271 // Though we have done incremental invalidation, we still need to call | 271 // Though we have done incremental invalidation, we still need to call |
272 // ObjectPaintInvalidator with PaintInvalidationNone to do any other | 272 // ObjectPaintInvalidator with PaintInvalidationNone to do any other |
273 // required operations. | 273 // required operations. |
274 reason = std::max(reason, ObjectPaintInvalidatorWithContext(box_, context_) | 274 reason = std::max( |
275 .InvalidatePaintIfNeededWithComputedReason( | 275 reason, ObjectPaintInvalidatorWithContext(box_, context_) |
276 kPaintInvalidationNone)); | 276 .InvalidatePaintWithComputedReason(kPaintInvalidationNone)); |
277 } else { | 277 } else { |
278 reason = ObjectPaintInvalidatorWithContext(box_, context_) | 278 reason = ObjectPaintInvalidatorWithContext(box_, context_) |
279 .InvalidatePaintIfNeededWithComputedReason(reason); | 279 .InvalidatePaintWithComputedReason(reason); |
280 } | 280 } |
281 | 281 |
282 if (PaintLayerScrollableArea* area = box_.GetScrollableArea()) | 282 if (PaintLayerScrollableArea* area = box_.GetScrollableArea()) |
283 area->InvalidatePaintOfScrollControlsIfNeeded(context_); | 283 area->InvalidatePaintOfScrollControlsIfNeeded(context_); |
284 | 284 |
285 // This is for the next invalidatePaintIfNeeded so must be at the end. | 285 // This is for the next invalidatePaintIfNeeded so must be at the end. |
286 SavePreviousBoxGeometriesIfNeeded(); | 286 SavePreviousBoxGeometriesIfNeeded(); |
287 | 287 |
288 return reason; | 288 return reason; |
289 } | 289 } |
(...skipping 30 matching lines...) Expand all Loading... |
320 if (NeedsToSavePreviousContentBoxSizeOrLayoutOverflowRect()) { | 320 if (NeedsToSavePreviousContentBoxSizeOrLayoutOverflowRect()) { |
321 box_.GetMutableForPainting() | 321 box_.GetMutableForPainting() |
322 .SavePreviousContentBoxSizeAndLayoutOverflowRect(); | 322 .SavePreviousContentBoxSizeAndLayoutOverflowRect(); |
323 } else { | 323 } else { |
324 box_.GetMutableForPainting() | 324 box_.GetMutableForPainting() |
325 .ClearPreviousContentBoxSizeAndLayoutOverflowRect(); | 325 .ClearPreviousContentBoxSizeAndLayoutOverflowRect(); |
326 } | 326 } |
327 } | 327 } |
328 | 328 |
329 } // namespace blink | 329 } // namespace blink |
OLD | NEW |