| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> | 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> |
| 3 * 1999 Lars Knoll <knoll@kde.org> | 3 * 1999 Lars Knoll <knoll@kde.org> |
| 4 * 1999 Antti Koivisto <koivisto@kde.org> | 4 * 1999 Antti Koivisto <koivisto@kde.org> |
| 5 * 2000 Dirk Mueller <mueller@kde.org> | 5 * 2000 Dirk Mueller <mueller@kde.org> |
| 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. |
| 7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) | 7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) |
| 8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) | 8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) |
| 9 * Copyright (C) 2009 Google Inc. All rights reserved. | 9 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 10 * | 10 * |
| (...skipping 1344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1355 #if DCHECK_IS_ON() | 1355 #if DCHECK_IS_ON() |
| 1356 // Post-layout assert that nobody was re-marked as needing layout during | 1356 // Post-layout assert that nobody was re-marked as needing layout during |
| 1357 // layout. | 1357 // layout. |
| 1358 GetLayoutView()->AssertSubtreeIsLaidOut(); | 1358 GetLayoutView()->AssertSubtreeIsLaidOut(); |
| 1359 #endif | 1359 #endif |
| 1360 | 1360 |
| 1361 GetFrame().GetDocument()->LayoutUpdated(); | 1361 GetFrame().GetDocument()->LayoutUpdated(); |
| 1362 CheckDoesNotNeedLayout(); | 1362 CheckDoesNotNeedLayout(); |
| 1363 } | 1363 } |
| 1364 | 1364 |
| 1365 void FrameView::InvalidateTreeIfNeeded( | 1365 void FrameView::DeprecatedInvalidateTree( |
| 1366 const PaintInvalidationState& paint_invalidation_state) { | 1366 const PaintInvalidationState& paint_invalidation_state) { |
| 1367 DCHECK(!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()); | 1367 DCHECK(!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()); |
| 1368 | 1368 |
| 1369 if (ShouldThrottleRendering()) | 1369 if (ShouldThrottleRendering()) |
| 1370 return; | 1370 return; |
| 1371 | 1371 |
| 1372 Lifecycle().AdvanceTo(DocumentLifecycle::kInPaintInvalidation); | 1372 Lifecycle().AdvanceTo(DocumentLifecycle::kInPaintInvalidation); |
| 1373 | 1373 |
| 1374 RELEASE_ASSERT(!GetLayoutViewItem().IsNull()); | 1374 RELEASE_ASSERT(!GetLayoutViewItem().IsNull()); |
| 1375 LayoutViewItem root_for_paint_invalidation = GetLayoutViewItem(); | 1375 LayoutViewItem root_for_paint_invalidation = GetLayoutViewItem(); |
| 1376 ASSERT(!root_for_paint_invalidation.NeedsLayout()); | 1376 ASSERT(!root_for_paint_invalidation.NeedsLayout()); |
| 1377 | 1377 |
| 1378 TRACE_EVENT1("blink", "FrameView::invalidateTree", "root", | 1378 TRACE_EVENT1("blink", "FrameView::invalidateTree", "root", |
| 1379 root_for_paint_invalidation.DebugName().Ascii()); | 1379 root_for_paint_invalidation.DebugName().Ascii()); |
| 1380 | 1380 |
| 1381 InvalidatePaint(paint_invalidation_state); | 1381 InvalidatePaint(paint_invalidation_state); |
| 1382 root_for_paint_invalidation.InvalidateTreeIfNeeded(paint_invalidation_state); | 1382 root_for_paint_invalidation.DeprecatedInvalidateTree( |
| 1383 paint_invalidation_state); |
| 1383 | 1384 |
| 1384 #if DCHECK_IS_ON() | 1385 #if DCHECK_IS_ON() |
| 1385 GetLayoutView()->AssertSubtreeClearedPaintInvalidationFlags(); | 1386 GetLayoutView()->AssertSubtreeClearedPaintInvalidationFlags(); |
| 1386 #endif | 1387 #endif |
| 1387 | 1388 |
| 1388 Lifecycle().AdvanceTo(DocumentLifecycle::kPaintInvalidationClean); | 1389 Lifecycle().AdvanceTo(DocumentLifecycle::kPaintInvalidationClean); |
| 1389 } | 1390 } |
| 1390 | 1391 |
| 1391 void FrameView::InvalidatePaint( | 1392 void FrameView::InvalidatePaint( |
| 1392 const PaintInvalidationState& paint_invalidation_state) { | 1393 const PaintInvalidationState& paint_invalidation_state) { |
| (...skipping 1749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3142 } | 3143 } |
| 3143 | 3144 |
| 3144 ScrollContentsIfNeededRecursive(); | 3145 ScrollContentsIfNeededRecursive(); |
| 3145 DCHECK(RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled() || | 3146 DCHECK(RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled() || |
| 3146 Lifecycle().GetState() >= DocumentLifecycle::kCompositingClean); | 3147 Lifecycle().GetState() >= DocumentLifecycle::kCompositingClean); |
| 3147 | 3148 |
| 3148 frame_->GetPage()->GlobalRootScrollerController().DidUpdateCompositing(); | 3149 frame_->GetPage()->GlobalRootScrollerController().DidUpdateCompositing(); |
| 3149 | 3150 |
| 3150 if (target_state >= DocumentLifecycle::kPrePaintClean) { | 3151 if (target_state >= DocumentLifecycle::kPrePaintClean) { |
| 3151 if (!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) | 3152 if (!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) |
| 3152 InvalidateTreeIfNeededRecursive(); | 3153 DeprecatedInvalidateTreeRecursive(); |
| 3153 | 3154 |
| 3154 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 3155 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
| 3155 if (view.Compositor()->InCompositingMode()) | 3156 if (view.Compositor()->InCompositingMode()) |
| 3156 GetScrollingCoordinator()->UpdateAfterCompositingChangeIfNeeded(); | 3157 GetScrollingCoordinator()->UpdateAfterCompositingChangeIfNeeded(); |
| 3157 } | 3158 } |
| 3158 | 3159 |
| 3159 if (LocalFrame* local_frame = frame_->LocalFrameRoot()) { | 3160 if (LocalFrame* local_frame = frame_->LocalFrameRoot()) { |
| 3160 // This is needed since, at present, the ScrollingCoordinator doesn't | 3161 // This is needed since, at present, the ScrollingCoordinator doesn't |
| 3161 // send rects for oopif sub-frames. | 3162 // send rects for oopif sub-frames. |
| 3162 // TODO(wjmaclean): Remove this pathway when ScrollingCoordinator | 3163 // TODO(wjmaclean): Remove this pathway when ScrollingCoordinator |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3435 // Ensure that we become visually non-empty eventually. | 3436 // Ensure that we become visually non-empty eventually. |
| 3436 // TODO(esprehn): This should check isRenderingReady() instead. | 3437 // TODO(esprehn): This should check isRenderingReady() instead. |
| 3437 if (GetFrame().GetDocument()->HasFinishedParsing() && | 3438 if (GetFrame().GetDocument()->HasFinishedParsing() && |
| 3438 GetFrame().Loader().StateMachine()->CommittedFirstRealDocumentLoad()) | 3439 GetFrame().Loader().StateMachine()->CommittedFirstRealDocumentLoad()) |
| 3439 is_visually_non_empty_ = true; | 3440 is_visually_non_empty_ = true; |
| 3440 | 3441 |
| 3441 GetFrame().Selection().UpdateStyleAndLayoutIfNeeded(); | 3442 GetFrame().Selection().UpdateStyleAndLayoutIfNeeded(); |
| 3442 GetFrame().GetPage()->GetDragCaret().UpdateStyleAndLayoutIfNeeded(); | 3443 GetFrame().GetPage()->GetDragCaret().UpdateStyleAndLayoutIfNeeded(); |
| 3443 } | 3444 } |
| 3444 | 3445 |
| 3445 void FrameView::InvalidateTreeIfNeededRecursive() { | 3446 void FrameView::DeprecatedInvalidateTreeRecursive() { |
| 3446 SCOPED_BLINK_UMA_HISTOGRAM_TIMER("Blink.PaintInvalidation.UpdateTime"); | 3447 SCOPED_BLINK_UMA_HISTOGRAM_TIMER("Blink.PaintInvalidation.UpdateTime"); |
| 3447 { | 3448 { |
| 3448 // For comparison to SlimmingPaintInvalidation. | 3449 // For comparison to SlimmingPaintInvalidation. |
| 3449 SCOPED_BLINK_UMA_HISTOGRAM_TIMER("Blink.PrePaint.UpdateTime"); | 3450 SCOPED_BLINK_UMA_HISTOGRAM_TIMER("Blink.PrePaint.UpdateTime"); |
| 3450 InvalidateTreeIfNeededRecursiveInternal(); | 3451 DeprecatedInvalidateTreeRecursiveInternal(); |
| 3451 } | 3452 } |
| 3452 } | 3453 } |
| 3453 | 3454 |
| 3454 void FrameView::InvalidateTreeIfNeededRecursiveInternal() { | 3455 void FrameView::DeprecatedInvalidateTreeRecursiveInternal() { |
| 3455 DCHECK(!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()); | 3456 DCHECK(!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()); |
| 3456 CHECK(GetLayoutView()); | 3457 CHECK(GetLayoutView()); |
| 3457 | 3458 |
| 3458 // We need to stop recursing here since a child frame view might not be | 3459 // We need to stop recursing here since a child frame view might not be |
| 3459 // throttled even though we are (e.g., it didn't compute its visibility yet). | 3460 // throttled even though we are (e.g., it didn't compute its visibility yet). |
| 3460 if (ShouldThrottleRendering()) | 3461 if (ShouldThrottleRendering()) |
| 3461 return; | 3462 return; |
| 3462 TRACE_EVENT0("blink", "FrameView::invalidateTreeIfNeededRecursiveInternal"); | 3463 TRACE_EVENT0("blink", "FrameView::invalidateTreeIfNeededRecursiveInternal"); |
| 3463 | 3464 |
| 3464 Vector<const LayoutObject*> pending_delayed_paint_invalidations; | 3465 Vector<const LayoutObject*> pending_delayed_paint_invalidations; |
| 3465 PaintInvalidationState root_paint_invalidation_state( | 3466 PaintInvalidationState root_paint_invalidation_state( |
| 3466 *GetLayoutView(), pending_delayed_paint_invalidations); | 3467 *GetLayoutView(), pending_delayed_paint_invalidations); |
| 3467 | 3468 |
| 3468 if (Lifecycle().GetState() < DocumentLifecycle::kPaintInvalidationClean) | 3469 if (Lifecycle().GetState() < DocumentLifecycle::kPaintInvalidationClean) |
| 3469 InvalidateTreeIfNeeded(root_paint_invalidation_state); | 3470 DeprecatedInvalidateTree(root_paint_invalidation_state); |
| 3470 | 3471 |
| 3471 // Some frames may be not reached during the above invalidateTreeIfNeeded | 3472 // Some frames may be not reached during the above DeprecatedInvalidateTree |
| 3472 // because | 3473 // because |
| 3473 // - the frame is a detached frame; or | 3474 // - the frame is a detached frame; or |
| 3474 // - it didn't need paint invalidation. | 3475 // - it didn't need paint invalidation. |
| 3475 // We need to call invalidateTreeIfNeededRecursiveInternal() for such frames | 3476 // We need to call invalidateTreeIfNeededRecursiveInternal() for such frames |
| 3476 // to finish required paint invalidation and advance their life cycle state. | 3477 // to finish required paint invalidation and advance their life cycle state. |
| 3477 for (Frame* child = frame_->Tree().FirstChild(); child; | 3478 for (Frame* child = frame_->Tree().FirstChild(); child; |
| 3478 child = child->Tree().NextSibling()) { | 3479 child = child->Tree().NextSibling()) { |
| 3479 if (child->IsLocalFrame()) { | 3480 if (child->IsLocalFrame()) { |
| 3480 FrameView& child_frame_view = *ToLocalFrame(child)->View(); | 3481 FrameView& child_frame_view = *ToLocalFrame(child)->View(); |
| 3481 // The children frames can be in any state, including stopping. | 3482 // The children frames can be in any state, including stopping. |
| 3482 // Thus we have to check that it makes sense to do paint | 3483 // Thus we have to check that it makes sense to do paint |
| 3483 // invalidation onto them here. | 3484 // invalidation onto them here. |
| 3484 if (!child_frame_view.GetLayoutView()) | 3485 if (!child_frame_view.GetLayoutView()) |
| 3485 continue; | 3486 continue; |
| 3486 child_frame_view.InvalidateTreeIfNeededRecursiveInternal(); | 3487 child_frame_view.DeprecatedInvalidateTreeRecursiveInternal(); |
| 3487 } | 3488 } |
| 3488 } | 3489 } |
| 3489 | 3490 |
| 3490 // Process objects needing paint invalidation on the next frame. See the | 3491 // Process objects needing paint invalidation on the next frame. See the |
| 3491 // definition of PaintInvalidationDelayedFull for more details. | 3492 // definition of PaintInvalidationDelayedFull for more details. |
| 3492 for (auto& target : pending_delayed_paint_invalidations) | 3493 for (auto& target : pending_delayed_paint_invalidations) |
| 3493 target->GetMutableForPainting().SetShouldDoFullPaintInvalidation( | 3494 target->GetMutableForPainting().SetShouldDoFullPaintInvalidation( |
| 3494 kPaintInvalidationDelayedFull); | 3495 kPaintInvalidationDelayedFull); |
| 3495 } | 3496 } |
| 3496 | 3497 |
| (...skipping 1897 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5394 void FrameView::SetAnimationHost( | 5395 void FrameView::SetAnimationHost( |
| 5395 std::unique_ptr<CompositorAnimationHost> host) { | 5396 std::unique_ptr<CompositorAnimationHost> host) { |
| 5396 animation_host_ = std::move(host); | 5397 animation_host_ = std::move(host); |
| 5397 } | 5398 } |
| 5398 | 5399 |
| 5399 LayoutUnit FrameView::CaretWidth() const { | 5400 LayoutUnit FrameView::CaretWidth() const { |
| 5400 return LayoutUnit(GetChromeClient()->WindowToViewportScalar(1)); | 5401 return LayoutUnit(GetChromeClient()->WindowToViewportScalar(1)); |
| 5401 } | 5402 } |
| 5402 | 5403 |
| 5403 } // namespace blink | 5404 } // namespace blink |
| OLD | NEW |