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 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 } else { | 400 } else { |
401 // Use visual rect location for non-LayoutBoxModelObject because it suffices | 401 // Use visual rect location for non-LayoutBoxModelObject because it suffices |
402 // to check whether a visual rect changes for layout caused invalidation. | 402 // to check whether a visual rect changes for layout caused invalidation. |
403 context.new_location = new_visual_rect.Location(); | 403 context.new_location = new_visual_rect.Location(); |
404 } | 404 } |
405 | 405 |
406 object.GetMutableForPainting().SetVisualRect(new_visual_rect); | 406 object.GetMutableForPainting().SetVisualRect(new_visual_rect); |
407 ObjectPaintInvalidator(object).SetLocationInBacking(context.new_location); | 407 ObjectPaintInvalidator(object).SetLocationInBacking(context.new_location); |
408 } | 408 } |
409 | 409 |
410 void PaintInvalidator::InvalidatePaintIfNeeded( | 410 void PaintInvalidator::InvalidatePaint(FrameView& frame_view, |
411 FrameView& frame_view, | 411 PaintInvalidatorContext& context) { |
412 PaintInvalidatorContext& context) { | |
413 LayoutView* layout_view = frame_view.GetLayoutView(); | 412 LayoutView* layout_view = frame_view.GetLayoutView(); |
414 CHECK(layout_view); | 413 CHECK(layout_view); |
415 | 414 |
416 context.paint_invalidation_container = | 415 context.paint_invalidation_container = |
417 context.paint_invalidation_container_for_stacked_contents = | 416 context.paint_invalidation_container_for_stacked_contents = |
418 &layout_view->ContainerForPaintInvalidation(); | 417 &layout_view->ContainerForPaintInvalidation(); |
419 context.painting_layer = layout_view->Layer(); | 418 context.painting_layer = layout_view->Layer(); |
420 | 419 |
421 if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { | 420 if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { |
422 Optional<ScopedUndoFrameViewContentClipAndScroll> undo; | 421 Optional<ScopedUndoFrameViewContentClipAndScroll> undo; |
423 if (context.tree_builder_context_) | 422 if (context.tree_builder_context_) |
424 undo.emplace(frame_view, *context.tree_builder_context_); | 423 undo.emplace(frame_view, *context.tree_builder_context_); |
425 frame_view.InvalidatePaintOfScrollControlsIfNeeded(context); | 424 frame_view.InvalidatePaintOfScrollControlsIfNeeded(context); |
426 } | 425 } |
427 } | 426 } |
428 | 427 |
429 void PaintInvalidator::InvalidatePaintIfNeeded( | 428 void PaintInvalidator::InvalidatePaint(const LayoutObject& object, |
430 const LayoutObject& object, | 429 PaintInvalidatorContext& context) { |
431 PaintInvalidatorContext& context) { | |
432 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), | 430 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), |
433 "PaintInvalidator::invalidatePaintIfNeeded()", "object", | 431 "PaintInvalidator::invalidatePaintIfNeeded()", "object", |
434 object.DebugName().Ascii()); | 432 object.DebugName().Ascii()); |
435 | 433 |
436 object.GetMutableForPainting().EnsureIsReadyForPaintInvalidation(); | 434 object.GetMutableForPainting().EnsureIsReadyForPaintInvalidation(); |
437 | 435 |
438 UpdatePaintingLayer(object, context); | 436 UpdatePaintingLayer(object, context); |
439 | 437 |
440 if (object.GetDocument().Printing() && | 438 if (object.GetDocument().Printing() && |
441 !RuntimeEnabledFeatures::printBrowserEnabled()) | 439 !RuntimeEnabledFeatures::printBrowserEnabled()) |
(...skipping 16 matching lines...) Expand all Loading... |
458 // We are done updating anything needed. No other paint invalidation work to | 456 // We are done updating anything needed. No other paint invalidation work to |
459 // do for this object. | 457 // do for this object. |
460 return; | 458 return; |
461 } | 459 } |
462 | 460 |
463 if (object.IsSVGHiddenContainer()) { | 461 if (object.IsSVGHiddenContainer()) { |
464 context.forced_subtree_invalidation_flags |= | 462 context.forced_subtree_invalidation_flags |= |
465 PaintInvalidatorContext::kForcedSubtreeNoRasterInvalidation; | 463 PaintInvalidatorContext::kForcedSubtreeNoRasterInvalidation; |
466 } | 464 } |
467 | 465 |
468 PaintInvalidationReason reason = object.InvalidatePaintIfNeeded(context); | 466 PaintInvalidationReason reason = object.InvalidatePaint(context); |
469 switch (reason) { | 467 switch (reason) { |
470 case kPaintInvalidationDelayedFull: | 468 case kPaintInvalidationDelayedFull: |
471 pending_delayed_paint_invalidations_.push_back(&object); | 469 pending_delayed_paint_invalidations_.push_back(&object); |
472 break; | 470 break; |
473 case kPaintInvalidationSubtree: | 471 case kPaintInvalidationSubtree: |
474 context.forced_subtree_invalidation_flags |= | 472 context.forced_subtree_invalidation_flags |= |
475 (PaintInvalidatorContext::kForcedSubtreeFullInvalidation | | 473 (PaintInvalidatorContext::kForcedSubtreeFullInvalidation | |
476 PaintInvalidatorContext:: | 474 PaintInvalidatorContext:: |
477 kForcedSubtreeFullInvalidationForStackedContents); | 475 kForcedSubtreeFullInvalidationForStackedContents); |
478 break; | 476 break; |
(...skipping 26 matching lines...) Expand all Loading... |
505 } | 503 } |
506 | 504 |
507 void PaintInvalidator::ProcessPendingDelayedPaintInvalidations() { | 505 void PaintInvalidator::ProcessPendingDelayedPaintInvalidations() { |
508 for (auto target : pending_delayed_paint_invalidations_) { | 506 for (auto target : pending_delayed_paint_invalidations_) { |
509 target->GetMutableForPainting().SetShouldDoFullPaintInvalidation( | 507 target->GetMutableForPainting().SetShouldDoFullPaintInvalidation( |
510 kPaintInvalidationDelayedFull); | 508 kPaintInvalidationDelayedFull); |
511 } | 509 } |
512 } | 510 } |
513 | 511 |
514 } // namespace blink | 512 } // namespace blink |
OLD | NEW |