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 2385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2396 void FrameView::updateWidgetPositionsIfNeeded() | 2396 void FrameView::updateWidgetPositionsIfNeeded() |
2397 { | 2397 { |
2398 if (!m_needsUpdateWidgetPositions) | 2398 if (!m_needsUpdateWidgetPositions) |
2399 return; | 2399 return; |
2400 | 2400 |
2401 m_needsUpdateWidgetPositions = false; | 2401 m_needsUpdateWidgetPositions = false; |
2402 | 2402 |
2403 updateWidgetPositions(); | 2403 updateWidgetPositions(); |
2404 } | 2404 } |
2405 | 2405 |
2406 void FrameView::updateAllLifecyclePhases(const LayoutRect* interestRect) | 2406 void FrameView::updateAllLifecyclePhases() |
2407 { | 2407 { |
2408 frame().localFrameRoot()->view()->updateLifecyclePhasesInternal(AllPhases, i
nterestRect); | 2408 frame().localFrameRoot()->view()->updateLifecyclePhasesInternal(AllPhases); |
2409 } | 2409 } |
2410 | 2410 |
2411 // TODO(chrishtr): add a scrolling update lifecycle phase. | 2411 // TODO(chrishtr): add a scrolling update lifecycle phase. |
2412 void FrameView::updateLifecycleToCompositingCleanPlusScrolling() | 2412 void FrameView::updateLifecycleToCompositingCleanPlusScrolling() |
2413 { | 2413 { |
2414 frame().localFrameRoot()->view()->updateLifecyclePhasesInternal(OnlyUpToComp
ositingCleanPlusScrolling, nullptr); | 2414 frame().localFrameRoot()->view()->updateLifecyclePhasesInternal(OnlyUpToComp
ositingCleanPlusScrolling); |
2415 } | 2415 } |
2416 | 2416 |
2417 void FrameView::updateLifecycleToLayoutClean() | 2417 void FrameView::updateLifecycleToLayoutClean() |
2418 { | 2418 { |
2419 frame().localFrameRoot()->view()->updateLifecyclePhasesInternal(OnlyUpToLayo
utClean, nullptr); | 2419 frame().localFrameRoot()->view()->updateLifecyclePhasesInternal(OnlyUpToLayo
utClean); |
2420 } | 2420 } |
2421 | 2421 |
2422 void FrameView::updateLifecyclePhasesInternal(LifeCycleUpdateOption phases, cons
t LayoutRect* interestRect) | 2422 void FrameView::updateLifecyclePhasesInternal(LifeCycleUpdateOption phases) |
2423 { | 2423 { |
2424 // This must be called from the root frame, since it recurses down, not up. | 2424 // This must be called from the root frame, since it recurses down, not up. |
2425 // Otherwise the lifecycles of the frames might be out of sync. | 2425 // Otherwise the lifecycles of the frames might be out of sync. |
2426 ASSERT(m_frame->isLocalRoot()); | 2426 ASSERT(m_frame->isLocalRoot()); |
2427 | 2427 |
2428 // Updating layout can run script, which can tear down the FrameView. | 2428 // Updating layout can run script, which can tear down the FrameView. |
2429 RefPtrWillBeRawPtr<FrameView> protector(this); | 2429 RefPtrWillBeRawPtr<FrameView> protector(this); |
2430 | 2430 |
2431 updateStyleAndLayoutIfNeededRecursive(); | 2431 updateStyleAndLayoutIfNeededRecursive(); |
2432 ASSERT(lifecycle().state() >= DocumentLifecycle::LayoutClean); | 2432 ASSERT(lifecycle().state() >= DocumentLifecycle::LayoutClean); |
(...skipping 18 matching lines...) Expand all Loading... |
2451 | 2451 |
2452 if (view->compositor()->inCompositingMode()) | 2452 if (view->compositor()->inCompositingMode()) |
2453 scrollingCoordinator()->updateAfterCompositingChangeIfNeeded(); | 2453 scrollingCoordinator()->updateAfterCompositingChangeIfNeeded(); |
2454 | 2454 |
2455 updateCompositedSelectionIfNeeded(); | 2455 updateCompositedSelectionIfNeeded(); |
2456 | 2456 |
2457 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) | 2457 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) |
2458 updatePaintProperties(); | 2458 updatePaintProperties(); |
2459 | 2459 |
2460 if (RuntimeEnabledFeatures::slimmingPaintSynchronizedPaintingEnabled
()) { | 2460 if (RuntimeEnabledFeatures::slimmingPaintSynchronizedPaintingEnabled
()) { |
2461 synchronizedPaint(interestRect); | 2461 synchronizedPaint(); |
2462 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) | 2462 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) |
2463 compositeForSlimmingPaintV2(); | 2463 compositeForSlimmingPaintV2(); |
2464 } | 2464 } |
2465 | 2465 |
2466 if (RuntimeEnabledFeatures::frameTimingSupportEnabled()) | 2466 if (RuntimeEnabledFeatures::frameTimingSupportEnabled()) |
2467 updateFrameTimingRequestsIfNeeded(); | 2467 updateFrameTimingRequestsIfNeeded(); |
2468 | 2468 |
2469 ASSERT(!view->hasPendingSelection()); | 2469 ASSERT(!view->hasPendingSelection()); |
2470 ASSERT(lifecycle().state() == DocumentLifecycle::PaintInvalidationCl
ean | 2470 ASSERT(lifecycle().state() == DocumentLifecycle::PaintInvalidationCl
ean |
2471 || (RuntimeEnabledFeatures::slimmingPaintV2Enabled() && lifecycl
e().state() == DocumentLifecycle::CompositingForSlimmingPaintV2Clean) | 2471 || (RuntimeEnabledFeatures::slimmingPaintV2Enabled() && lifecycl
e().state() == DocumentLifecycle::CompositingForSlimmingPaintV2Clean) |
2472 || (RuntimeEnabledFeatures::slimmingPaintSynchronizedPaintingEna
bled() && lifecycle().state() == DocumentLifecycle::PaintClean)); | 2472 || (RuntimeEnabledFeatures::slimmingPaintSynchronizedPaintingEna
bled() && lifecycle().state() == DocumentLifecycle::PaintClean)); |
2473 } | 2473 } |
2474 } | 2474 } |
2475 | 2475 |
2476 updateViewportIntersectionsForSubtree(); | 2476 updateViewportIntersectionsForSubtree(); |
2477 } | 2477 } |
2478 | 2478 |
2479 void FrameView::updatePaintProperties() | 2479 void FrameView::updatePaintProperties() |
2480 { | 2480 { |
2481 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); | 2481 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); |
2482 | 2482 |
2483 forAllFrameViews([](FrameView& frameView) { frameView.lifecycle().advanceTo(
DocumentLifecycle::InUpdatePaintProperties); }); | 2483 forAllFrameViews([](FrameView& frameView) { frameView.lifecycle().advanceTo(
DocumentLifecycle::InUpdatePaintProperties); }); |
2484 PaintPropertyTreeBuilder().buildPropertyTrees(*this); | 2484 PaintPropertyTreeBuilder().buildPropertyTrees(*this); |
2485 forAllFrameViews([](FrameView& frameView) { frameView.lifecycle().advanceTo(
DocumentLifecycle::UpdatePaintPropertiesClean); }); | 2485 forAllFrameViews([](FrameView& frameView) { frameView.lifecycle().advanceTo(
DocumentLifecycle::UpdatePaintPropertiesClean); }); |
2486 } | 2486 } |
2487 | 2487 |
2488 void FrameView::synchronizedPaint(const LayoutRect* interestRect) | 2488 void FrameView::synchronizedPaint() |
2489 { | 2489 { |
2490 ASSERT(RuntimeEnabledFeatures::slimmingPaintSynchronizedPaintingEnabled()); | 2490 ASSERT(RuntimeEnabledFeatures::slimmingPaintSynchronizedPaintingEnabled()); |
2491 ASSERT(frame() == page()->mainFrame() || (!frame().tree().parent()->isLocalF
rame())); | 2491 ASSERT(frame() == page()->mainFrame() || (!frame().tree().parent()->isLocalF
rame())); |
2492 | 2492 |
2493 LayoutView* view = layoutView(); | 2493 LayoutView* view = layoutView(); |
2494 ASSERT(view); | 2494 ASSERT(view); |
2495 // TODO(chrishtr): figure out if there can be any GraphicsLayer above this o
ne that draws content. | 2495 // TODO(chrishtr): figure out if there can be any GraphicsLayer above this o
ne that draws content. |
2496 GraphicsLayer* rootGraphicsLayer = view->layer()->graphicsLayerBacking(); | 2496 GraphicsLayer* rootGraphicsLayer = view->layer()->graphicsLayerBacking(); |
2497 forAllFrameViews([](FrameView& frameView) { frameView.lifecycle().advanceTo(
DocumentLifecycle::InPaint); }); | 2497 forAllFrameViews([](FrameView& frameView) { frameView.lifecycle().advanceTo(
DocumentLifecycle::InPaint); }); |
2498 | 2498 |
2499 // A null graphics layer can occur for painting of SVG images that are not p
arented into the main frame tree. | 2499 // A null graphics layer can occur for painting of SVG images that are not p
arented into the main frame tree. |
2500 if (rootGraphicsLayer) { | 2500 if (rootGraphicsLayer) { |
2501 synchronizedPaintRecursively(rootGraphicsLayer, interestRect); | 2501 synchronizedPaintRecursively(rootGraphicsLayer); |
2502 } | 2502 } |
2503 | 2503 |
2504 forAllFrameViews([](FrameView& frameView) { | 2504 forAllFrameViews([](FrameView& frameView) { |
2505 frameView.lifecycle().advanceTo(DocumentLifecycle::PaintClean); | 2505 frameView.lifecycle().advanceTo(DocumentLifecycle::PaintClean); |
2506 frameView.layoutView()->layer()->clearNeedsRepaintRecursively(); | 2506 frameView.layoutView()->layer()->clearNeedsRepaintRecursively(); |
2507 }); | 2507 }); |
2508 } | 2508 } |
2509 | 2509 |
2510 void FrameView::synchronizedPaintRecursively(GraphicsLayer* graphicsLayer, const
LayoutRect* interestRect) | 2510 void FrameView::synchronizedPaintRecursively(GraphicsLayer* graphicsLayer) |
2511 { | 2511 { |
2512 ASSERT(graphicsLayer->paintController()); | 2512 ASSERT(graphicsLayer->paintController()); |
2513 GraphicsContext context(*graphicsLayer->paintController()); | 2513 GraphicsContext context(*graphicsLayer->paintController()); |
2514 | 2514 |
2515 // TODO(chrishtr): fix unit tests to not inject one-off interest rects. | 2515 graphicsLayer->paint(context, nullptr); |
2516 if (interestRect) | |
2517 graphicsLayer->paint(context, roundedIntRect(*interestRect)); | |
2518 else | |
2519 graphicsLayer->paintIfNeeded(context); | |
2520 | 2516 |
2521 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) | 2517 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) |
2522 graphicsLayer->paintController()->commitNewDisplayItems(); | 2518 graphicsLayer->paintController()->commitNewDisplayItems(); |
2523 | 2519 |
2524 for (auto& child : graphicsLayer->children()) | 2520 for (auto& child : graphicsLayer->children()) |
2525 synchronizedPaintRecursively(child, interestRect); | 2521 synchronizedPaintRecursively(child); |
2526 } | 2522 } |
2527 | 2523 |
2528 void FrameView::compositeForSlimmingPaintV2() | 2524 void FrameView::compositeForSlimmingPaintV2() |
2529 { | 2525 { |
2530 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); | 2526 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); |
2531 ASSERT(frame() == page()->mainFrame() || (!frame().tree().parent()->isLocalF
rame())); | 2527 ASSERT(frame() == page()->mainFrame() || (!frame().tree().parent()->isLocalF
rame())); |
2532 | 2528 |
2533 forAllFrameViews([](FrameView& frameView) { frameView.lifecycle().advanceTo(
DocumentLifecycle::InCompositingForSlimmingPaintV2); }); | 2529 forAllFrameViews([](FrameView& frameView) { frameView.lifecycle().advanceTo(
DocumentLifecycle::InCompositingForSlimmingPaintV2); }); |
2534 | 2530 |
2535 // Detached frames can have no root graphics layer. | 2531 // Detached frames can have no root graphics layer. |
(...skipping 1543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4079 } | 4075 } |
4080 | 4076 |
4081 bool FrameView::canThrottleRendering() const | 4077 bool FrameView::canThrottleRendering() const |
4082 { | 4078 { |
4083 if (!RuntimeEnabledFeatures::renderingPipelineThrottlingEnabled()) | 4079 if (!RuntimeEnabledFeatures::renderingPipelineThrottlingEnabled()) |
4084 return false; | 4080 return false; |
4085 return m_hiddenForThrottling && m_crossOriginForThrottling; | 4081 return m_hiddenForThrottling && m_crossOriginForThrottling; |
4086 } | 4082 } |
4087 | 4083 |
4088 } // namespace blink | 4084 } // namespace blink |
OLD | NEW |