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 11 matching lines...) Expand all Loading... |
22 * along with this library; see the file COPYING.LIB. If not, write to | 22 * along with this library; see the file COPYING.LIB. If not, write to |
23 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 23 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
24 * Boston, MA 02110-1301, USA. | 24 * Boston, MA 02110-1301, USA. |
25 */ | 25 */ |
26 | 26 |
27 #include "config.h" | 27 #include "config.h" |
28 #include "core/frame/FrameView.h" | 28 #include "core/frame/FrameView.h" |
29 | 29 |
30 #include "core/HTMLNames.h" | 30 #include "core/HTMLNames.h" |
31 #include "core/MediaTypeNames.h" | 31 #include "core/MediaTypeNames.h" |
| 32 #include "core/compositing/DisplayListCompositingBuilder.h" |
32 #include "core/css/FontFaceSet.h" | 33 #include "core/css/FontFaceSet.h" |
33 #include "core/css/resolver/StyleResolver.h" | 34 #include "core/css/resolver/StyleResolver.h" |
34 #include "core/dom/AXObjectCache.h" | 35 #include "core/dom/AXObjectCache.h" |
35 #include "core/dom/Fullscreen.h" | 36 #include "core/dom/Fullscreen.h" |
36 #include "core/editing/EditingUtilities.h" | 37 #include "core/editing/EditingUtilities.h" |
37 #include "core/editing/FrameSelection.h" | 38 #include "core/editing/FrameSelection.h" |
38 #include "core/editing/RenderedPosition.h" | 39 #include "core/editing/RenderedPosition.h" |
39 #include "core/editing/markers/DocumentMarkerController.h" | 40 #include "core/editing/markers/DocumentMarkerController.h" |
40 #include "core/fetch/ResourceFetcher.h" | 41 #include "core/fetch/ResourceFetcher.h" |
41 #include "core/fetch/ResourceLoadPriorityOptimizer.h" | 42 #include "core/fetch/ResourceLoadPriorityOptimizer.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 #include "platform/ScriptForbiddenScope.h" | 86 #include "platform/ScriptForbiddenScope.h" |
86 #include "platform/TraceEvent.h" | 87 #include "platform/TraceEvent.h" |
87 #include "platform/TracedValue.h" | 88 #include "platform/TracedValue.h" |
88 #include "platform/fonts/FontCache.h" | 89 #include "platform/fonts/FontCache.h" |
89 #include "platform/geometry/DoubleRect.h" | 90 #include "platform/geometry/DoubleRect.h" |
90 #include "platform/geometry/FloatRect.h" | 91 #include "platform/geometry/FloatRect.h" |
91 #include "platform/geometry/LayoutRect.h" | 92 #include "platform/geometry/LayoutRect.h" |
92 #include "platform/graphics/GraphicsContext.h" | 93 #include "platform/graphics/GraphicsContext.h" |
93 #include "platform/graphics/GraphicsLayer.h" | 94 #include "platform/graphics/GraphicsLayer.h" |
94 #include "platform/graphics/GraphicsLayerDebugInfo.h" | 95 #include "platform/graphics/GraphicsLayerDebugInfo.h" |
| 96 #include "platform/graphics/paint/DisplayItemList.h" |
95 #include "platform/scroll/ScrollAnimator.h" | 97 #include "platform/scroll/ScrollAnimator.h" |
96 #include "platform/text/TextStream.h" | 98 #include "platform/text/TextStream.h" |
97 #include "wtf/CurrentTime.h" | 99 #include "wtf/CurrentTime.h" |
98 #include "wtf/StdLibExtras.h" | 100 #include "wtf/StdLibExtras.h" |
99 #include "wtf/TemporaryChange.h" | 101 #include "wtf/TemporaryChange.h" |
100 | 102 |
101 namespace blink { | 103 namespace blink { |
102 | 104 |
103 using namespace HTMLNames; | 105 using namespace HTMLNames; |
104 | 106 |
(...skipping 2322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2427 m_needsUpdateWidgetPositions = false; | 2429 m_needsUpdateWidgetPositions = false; |
2428 | 2430 |
2429 updateWidgetPositions(); | 2431 updateWidgetPositions(); |
2430 } | 2432 } |
2431 | 2433 |
2432 void FrameView::updateAllLifecyclePhases() | 2434 void FrameView::updateAllLifecyclePhases() |
2433 { | 2435 { |
2434 frame().localFrameRoot()->view()->updateLifecyclePhasesInternal(AllPhases); | 2436 frame().localFrameRoot()->view()->updateLifecyclePhasesInternal(AllPhases); |
2435 } | 2437 } |
2436 | 2438 |
2437 // TODO(chrishtr): add a scrolling update lifecycle phase, after compositing and
before invalidation. | 2439 // TODO(chrishtr): add a scrolling update lifecycle phase. |
2438 void FrameView::updateLifecycleToCompositingCleanPlusScrolling() | 2440 void FrameView::updateLifecycleToCompositingCleanPlusScrolling() |
2439 { | 2441 { |
2440 frame().localFrameRoot()->view()->updateLifecyclePhasesInternal(OnlyUpToComp
ositingCleanPlusScrolling); | 2442 frame().localFrameRoot()->view()->updateLifecyclePhasesInternal(OnlyUpToComp
ositingCleanPlusScrolling); |
2441 } | 2443 } |
2442 | 2444 |
2443 void FrameView::updateLifecyclePhasesInternal(LifeCycleUpdateOption phases) | 2445 void FrameView::updateLifecyclePhasesInternal(LifeCycleUpdateOption phases) |
2444 { | 2446 { |
2445 // This must be called from the root frame, since it recurses down, not up. | 2447 // This must be called from the root frame, since it recurses down, not up. |
2446 // Otherwise the lifecycles of the frames might be out of sync. | 2448 // Otherwise the lifecycles of the frames might be out of sync. |
2447 ASSERT(m_frame->isLocalRoot()); | 2449 ASSERT(m_frame->isLocalRoot()); |
2448 | 2450 |
2449 // Updating layout can run script, which can tear down the FrameView. | 2451 // Updating layout can run script, which can tear down the FrameView. |
2450 RefPtrWillBeRawPtr<FrameView> protector(this); | 2452 RefPtrWillBeRawPtr<FrameView> protector(this); |
2451 | 2453 |
2452 updateStyleAndLayoutIfNeededRecursive(); | 2454 updateStyleAndLayoutIfNeededRecursive(); |
2453 | 2455 |
2454 if (LayoutView* view = layoutView()) { | 2456 if (LayoutView* view = layoutView()) { |
2455 TRACE_EVENT1("devtools.timeline", "UpdateLayerTree", "data", InspectorUp
dateLayerTreeEvent::data(m_frame.get())); | 2457 TRACE_EVENT1("devtools.timeline", "UpdateLayerTree", "data", InspectorUp
dateLayerTreeEvent::data(m_frame.get())); |
2456 | 2458 |
| 2459 // This was required for slimming paint v1 but is only temporarily |
| 2460 // needed for slimming paint v2. |
2457 view->compositor()->updateIfNeededRecursive(); | 2461 view->compositor()->updateIfNeededRecursive(); |
2458 scrollContentsIfNeededRecursive(); | 2462 scrollContentsIfNeededRecursive(); |
2459 | 2463 |
2460 ASSERT(lifecycle().state() >= DocumentLifecycle::CompositingClean); | 2464 ASSERT(lifecycle().state() >= DocumentLifecycle::CompositingClean); |
2461 | 2465 |
2462 if (phases == AllPhases) { | 2466 if (phases == AllPhases) { |
2463 invalidateTreeIfNeededRecursive(); | 2467 invalidateTreeIfNeededRecursive(); |
2464 | 2468 |
2465 if (view->compositor()->inCompositingMode()) | 2469 if (view->compositor()->inCompositingMode()) |
2466 scrollingCoordinator()->updateAfterCompositingChangeIfNeeded(); | 2470 scrollingCoordinator()->updateAfterCompositingChangeIfNeeded(); |
2467 | 2471 |
2468 updateCompositedSelectionIfNeeded(); | 2472 updateCompositedSelectionIfNeeded(); |
| 2473 |
| 2474 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
| 2475 paintForSlimmingPaintV2(); |
| 2476 compositeForSlimmingPaintV2(); |
| 2477 } |
| 2478 |
2469 if (RuntimeEnabledFeatures::frameTimingSupportEnabled()) | 2479 if (RuntimeEnabledFeatures::frameTimingSupportEnabled()) |
2470 updateFrameTimingRequestsIfNeeded(); | 2480 updateFrameTimingRequestsIfNeeded(); |
2471 | 2481 |
2472 ASSERT(!view->hasPendingSelection()); | 2482 ASSERT(!view->hasPendingSelection()); |
2473 ASSERT(lifecycle().state() == DocumentLifecycle::PaintInvalidationCl
ean); | 2483 ASSERT(lifecycle().state() == DocumentLifecycle::PaintInvalidationCl
ean |
| 2484 || (RuntimeEnabledFeatures::slimmingPaintV2Enabled() && lifecycl
e().state() == DocumentLifecycle::CompositingForSlimmingPaintV2Clean)); |
2474 } | 2485 } |
2475 } | 2486 } |
2476 } | 2487 } |
2477 | 2488 |
| 2489 void FrameView::paintForSlimmingPaintV2() |
| 2490 { |
| 2491 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); |
| 2492 ASSERT(frame() == page()->mainFrame() || (!frame().tree().parent()->isLocalF
rame())); |
| 2493 |
| 2494 LayoutView* view = layoutView(); |
| 2495 ASSERT(view); |
| 2496 GraphicsLayer* rootGraphicsLayer = view->layer()->graphicsLayerBacking(); |
| 2497 |
| 2498 // Detached frames can have no root graphics layer. |
| 2499 if (!rootGraphicsLayer) |
| 2500 return; |
| 2501 |
| 2502 lifecycle().advanceTo(DocumentLifecycle::InPaintForSlimmingPaintV2); |
| 2503 |
| 2504 // TODO(pdr): Update callers to pass in the interest rect. |
| 2505 IntRect interestRect = LayoutRect::infiniteIntRect(); |
| 2506 GraphicsContext context(rootGraphicsLayer->displayItemList()); |
| 2507 rootGraphicsLayer->paint(context, interestRect); |
| 2508 |
| 2509 lifecycle().advanceTo(DocumentLifecycle::PaintForSlimmingPaintV2Clean); |
| 2510 } |
| 2511 |
| 2512 void FrameView::compositeForSlimmingPaintV2() |
| 2513 { |
| 2514 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); |
| 2515 ASSERT(frame() == page()->mainFrame() || (!frame().tree().parent()->isLocalF
rame())); |
| 2516 |
| 2517 GraphicsLayer* rootGraphicsLayer = layoutView()->layer()->graphicsLayerBacki
ng(); |
| 2518 |
| 2519 // Detached frames can have no root graphics layer. |
| 2520 if (!rootGraphicsLayer) |
| 2521 return; |
| 2522 |
| 2523 lifecycle().advanceTo(DocumentLifecycle::InCompositingForSlimmingPaintV2); |
| 2524 |
| 2525 DisplayListDiff displayListDiff; |
| 2526 rootGraphicsLayer->displayItemList()->commitNewDisplayItems(&displayListDiff
); |
| 2527 |
| 2528 DisplayListCompositingBuilder compositingBuilder(*rootGraphicsLayer->display
ItemList(), displayListDiff); |
| 2529 OwnPtr<CompositedDisplayList> compositedDisplayList = adoptPtr(new Composite
dDisplayList()); |
| 2530 compositingBuilder.build(*compositedDisplayList); |
| 2531 layoutView()->setCompositedDisplayList(compositedDisplayList.release()); |
| 2532 |
| 2533 lifecycle().advanceTo(DocumentLifecycle::CompositingForSlimmingPaintV2Clean)
; |
| 2534 } |
| 2535 |
2478 void FrameView::updateFrameTimingRequestsIfNeeded() | 2536 void FrameView::updateFrameTimingRequestsIfNeeded() |
2479 { | 2537 { |
2480 GraphicsLayerFrameTimingRequests graphicsLayerTimingRequests; | 2538 GraphicsLayerFrameTimingRequests graphicsLayerTimingRequests; |
2481 // TODO(mpb) use a 'dirty' bit to not call this every time. | 2539 // TODO(mpb) use a 'dirty' bit to not call this every time. |
2482 collectFrameTimingRequestsRecursive(graphicsLayerTimingRequests); | 2540 collectFrameTimingRequestsRecursive(graphicsLayerTimingRequests); |
2483 | 2541 |
2484 for (const auto& iter : graphicsLayerTimingRequests) { | 2542 for (const auto& iter : graphicsLayerTimingRequests) { |
2485 const GraphicsLayer* graphicsLayer = iter.key; | 2543 const GraphicsLayer* graphicsLayer = iter.key; |
2486 graphicsLayer->platformLayer()->setFrameTimingRequests(iter.value); | 2544 graphicsLayer->platformLayer()->setFrameTimingRequests(iter.value); |
2487 } | 2545 } |
(...skipping 1432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3920 | 3978 |
3921 if (!graphicsLayer) | 3979 if (!graphicsLayer) |
3922 return; | 3980 return; |
3923 | 3981 |
3924 DeprecatedPaintLayer::mapRectToPaintInvalidationBacking(localFrame->contentL
ayoutObject(), paintInvalidationContainer, viewRect); | 3982 DeprecatedPaintLayer::mapRectToPaintInvalidationBacking(localFrame->contentL
ayoutObject(), paintInvalidationContainer, viewRect); |
3925 | 3983 |
3926 graphicsLayerTimingRequests.add(graphicsLayer, Vector<std::pair<int64_t, Web
Rect>>()).storedValue->value.append(std::make_pair(m_frame->frameID(), enclosing
IntRect(viewRect))); | 3984 graphicsLayerTimingRequests.add(graphicsLayer, Vector<std::pair<int64_t, Web
Rect>>()).storedValue->value.append(std::make_pair(m_frame->frameID(), enclosing
IntRect(viewRect))); |
3927 } | 3985 } |
3928 | 3986 |
3929 } // namespace blink | 3987 } // namespace blink |
OLD | NEW |