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/PaintInvalidator.h" | 5 #include "core/paint/PaintInvalidator.h" |
6 | 6 |
7 #include "core/editing/FrameSelection.h" | 7 #include "core/editing/FrameSelection.h" |
8 #include "core/frame/FrameView.h" | 8 #include "core/frame/FrameView.h" |
9 #include "core/frame/LocalFrame.h" | 9 #include "core/frame/LocalFrame.h" |
10 #include "core/frame/Settings.h" | 10 #include "core/frame/Settings.h" |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 context.forcedSubtreeInvalidationFlags |= | 360 context.forcedSubtreeInvalidationFlags |= |
361 PaintInvalidatorContext::ForcedSubtreeSlowPathRect; | 361 PaintInvalidatorContext::ForcedSubtreeSlowPathRect; |
362 } | 362 } |
363 | 363 |
364 ObjectPaintInvalidator objectPaintInvalidator(object); | 364 ObjectPaintInvalidator objectPaintInvalidator(object); |
365 context.oldVisualRect = object.visualRect(); | 365 context.oldVisualRect = object.visualRect(); |
366 context.oldLocation = objectPaintInvalidator.locationInBacking(); | 366 context.oldLocation = objectPaintInvalidator.locationInBacking(); |
367 | 367 |
368 IntSize adjustment = object.scrollAdjustmentForPaintInvalidation( | 368 IntSize adjustment = object.scrollAdjustmentForPaintInvalidation( |
369 *context.paintInvalidationContainer); | 369 *context.paintInvalidationContainer); |
370 context.newVisualRect = computeVisualRectInBacking(object, context); | 370 LayoutRect newVisualRect = computeVisualRectInBacking(object, context); |
371 context.newVisualRect.move(adjustment); | 371 newVisualRect.move(adjustment); |
372 | 372 |
373 if (object.isText()) { | 373 if (object.isText()) { |
374 // Use visual rect location for LayoutTexts because it suffices to check | 374 // Use visual rect location for LayoutTexts because it suffices to check |
375 // whether a visual rect changes for layout caused invalidation. | 375 // whether a visual rect changes for layout caused invalidation. |
376 context.newLocation = context.newVisualRect.location(); | 376 context.newLocation = newVisualRect.location(); |
377 } else { | 377 } else { |
378 context.newLocation = computeLocationInBacking(object, context); | 378 context.newLocation = computeLocationInBacking(object, context); |
379 context.newLocation.move(adjustment); | 379 context.newLocation.move(adjustment); |
380 | 380 |
381 // Location of empty visual rect doesn't affect paint invalidation. Set it | 381 // Location of empty visual rect doesn't affect paint invalidation. Set it |
382 // to newLocation to avoid saving the previous location separately in | 382 // to newLocation to avoid saving the previous location separately in |
383 // ObjectPaintInvalidator. | 383 // ObjectPaintInvalidator. |
384 if (context.newVisualRect.isEmpty()) | 384 if (newVisualRect.isEmpty()) |
385 context.newVisualRect.setLocation(context.newLocation); | 385 newVisualRect.setLocation(context.newLocation); |
386 } | 386 } |
387 | 387 |
388 object.getMutableForPainting().setVisualRect(context.newVisualRect); | 388 object.getMutableForPainting().setVisualRect(newVisualRect); |
389 objectPaintInvalidator.setLocationInBacking(context.newLocation); | 389 objectPaintInvalidator.setLocationInBacking(context.newLocation); |
390 } | 390 } |
391 | 391 |
392 void PaintInvalidator::invalidatePaintIfNeeded( | 392 void PaintInvalidator::invalidatePaintIfNeeded( |
393 FrameView& frameView, | 393 FrameView& frameView, |
394 PaintInvalidatorContext& context) { | 394 PaintInvalidatorContext& context) { |
395 LayoutView* layoutView = frameView.layoutView(); | 395 LayoutView* layoutView = frameView.layoutView(); |
396 CHECK(layoutView); | 396 CHECK(layoutView); |
397 | 397 |
398 context.paintInvalidationContainer = | 398 context.paintInvalidationContainer = |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 } | 491 } |
492 } | 492 } |
493 | 493 |
494 void PaintInvalidator::processPendingDelayedPaintInvalidations() { | 494 void PaintInvalidator::processPendingDelayedPaintInvalidations() { |
495 for (auto target : m_pendingDelayedPaintInvalidations) | 495 for (auto target : m_pendingDelayedPaintInvalidations) |
496 target->getMutableForPainting().setShouldDoFullPaintInvalidation( | 496 target->getMutableForPainting().setShouldDoFullPaintInvalidation( |
497 PaintInvalidationDelayedFull); | 497 PaintInvalidationDelayedFull); |
498 } | 498 } |
499 | 499 |
500 } // namespace blink | 500 } // namespace blink |
OLD | NEW |