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/DocumentMarkerController.h" | 36 #include "core/dom/DocumentMarkerController.h" |
36 #include "core/dom/Fullscreen.h" | 37 #include "core/dom/Fullscreen.h" |
37 #include "core/editing/EditingUtilities.h" | 38 #include "core/editing/EditingUtilities.h" |
38 #include "core/editing/FrameSelection.h" | 39 #include "core/editing/FrameSelection.h" |
39 #include "core/editing/RenderedPosition.h" | 40 #include "core/editing/RenderedPosition.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 2327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2432 m_needsUpdateWidgetPositions = false; | 2434 m_needsUpdateWidgetPositions = false; |
2433 | 2435 |
2434 updateWidgetPositions(); | 2436 updateWidgetPositions(); |
2435 } | 2437 } |
2436 | 2438 |
2437 void FrameView::updateAllLifecyclePhases() | 2439 void FrameView::updateAllLifecyclePhases() |
2438 { | 2440 { |
2439 frame().localFrameRoot()->view()->updateAllLifecyclePhasesInternal(); | 2441 frame().localFrameRoot()->view()->updateAllLifecyclePhasesInternal(); |
2440 } | 2442 } |
2441 | 2443 |
2442 // TODO(chrishtr): add a scrolling update lifecycle phase, after compositing and before invalidation. | 2444 // TODO(chrishtr): add a scrolling update lifecycle phase. |
2443 void FrameView::updateLifecycleToCompositingCleanPlusScrolling() | 2445 void FrameView::updateLifecycleToCompositingCleanPlusScrolling() |
2444 { | 2446 { |
2445 frame().localFrameRoot()->view()->updateStyleAndLayoutIfNeededRecursive(); | 2447 frame().localFrameRoot()->view()->updateStyleAndLayoutIfNeededRecursive(); |
2446 LayoutView* view = layoutView(); | 2448 LayoutView* view = layoutView(); |
2447 if (view) | 2449 if (view) { |
2450 // For SlimmingPaintV2, we still need this to set up the root layer(s). | |
2448 view->compositor()->updateIfNeededRecursive(); | 2451 view->compositor()->updateIfNeededRecursive(); |
chrishtr
2015/08/13 21:33:16
Change comment to say that this is just needed in
pdr.
2015/08/14 00:10:29
Done
| |
2452 } | |
2453 | |
2449 scrollContentsIfNeededRecursive(); | 2454 scrollContentsIfNeededRecursive(); |
2450 | 2455 |
2456 if (view && RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | |
2457 paintForSlimmingPaintV2(); | |
2458 compositeForSlimmingPaintV2(); | |
2459 } | |
2460 | |
2451 ASSERT(lifecycle().state() >= DocumentLifecycle::CompositingClean); | 2461 ASSERT(lifecycle().state() >= DocumentLifecycle::CompositingClean); |
2452 } | 2462 } |
2453 | 2463 |
2454 void FrameView::updateAllLifecyclePhasesInternal() | 2464 void FrameView::updateAllLifecyclePhasesInternal() |
2455 { | 2465 { |
2456 // This must be called from the root frame, since it recurses down, not up. Otherwise the lifecycles of the frames might be out of sync. | 2466 // This must be called from the root frame, since it recurses down, not up. Otherwise the lifecycles of the frames might be out of sync. |
2457 ASSERT(frame() == page()->mainFrame() || (!frame().tree().parent()->isLocalF rame())); | 2467 ASSERT(frame() == page()->mainFrame() || (!frame().tree().parent()->isLocalF rame())); |
2458 | 2468 |
2459 // Updating layout can run script, which can tear down the FrameView. | 2469 // Updating layout can run script, which can tear down the FrameView. |
2460 RefPtrWillBeRawPtr<FrameView> protector(this); | 2470 RefPtrWillBeRawPtr<FrameView> protector(this); |
2461 | 2471 |
2462 updateStyleAndLayoutIfNeededRecursive(); | 2472 updateStyleAndLayoutIfNeededRecursive(); |
2463 | 2473 |
2464 LayoutView* view = layoutView(); | 2474 LayoutView* view = layoutView(); |
2465 if (view) { | 2475 if (view) { |
2466 TRACE_EVENT1("devtools.timeline", "UpdateLayerTree", "data", InspectorUp dateLayerTreeEvent::data(m_frame.get())); | 2476 TRACE_EVENT1("devtools.timeline", "UpdateLayerTree", "data", InspectorUp dateLayerTreeEvent::data(m_frame.get())); |
2467 | 2477 |
2478 // For SlimmingPaintV2, we still need this to set up the root layer(s). | |
chrishtr
2015/08/13 21:33:16
Fix comment like above.
pdr.
2015/08/14 00:10:29
Done
| |
2468 view->compositor()->updateIfNeededRecursive(); | 2479 view->compositor()->updateIfNeededRecursive(); |
2469 scrollContentsIfNeededRecursive(); | 2480 scrollContentsIfNeededRecursive(); |
2470 invalidateTreeIfNeededRecursive(); | 2481 invalidateTreeIfNeededRecursive(); |
2482 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | |
2483 paintForSlimmingPaintV2(); | |
2484 compositeForSlimmingPaintV2(); | |
2485 } | |
2471 updatePostLifecycleData(); | 2486 updatePostLifecycleData(); |
2472 | 2487 |
2473 ASSERT(!view->hasPendingSelection()); | 2488 ASSERT(!view->hasPendingSelection()); |
2474 } | 2489 } |
2475 | 2490 |
2476 ASSERT(lifecycle().state() == DocumentLifecycle::PaintInvalidationClean); | 2491 ASSERT(lifecycle().state() == DocumentLifecycle::PaintInvalidationClean |
2492 || (RuntimeEnabledFeatures::slimmingPaintV2Enabled() && lifecycle().stat e() == DocumentLifecycle::CompositingForSlimmingPaintV2Clean)); | |
2493 } | |
2494 | |
2495 void FrameView::paintForSlimmingPaintV2() | |
2496 { | |
2497 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); | |
2498 ASSERT(frame() == page()->mainFrame() || (!frame().tree().parent()->isLocalF rame())); | |
2499 | |
2500 LayoutView* view = layoutView(); | |
2501 ASSERT(view); | |
2502 GraphicsLayer* rootGraphicsLayer = view->layer()->graphicsLayerBacking(); | |
2503 | |
2504 // Detached frames can have no root graphics layer. | |
2505 if (!rootGraphicsLayer) | |
2506 return; | |
2507 | |
2508 lifecycle().advanceTo(DocumentLifecycle::InPaintForSlimmingPaintV2); | |
2509 | |
2510 // TODO: Update callers to pass in the interest rect. | |
chrishtr
2015/08/13 21:33:16
TODO(pdr)
pdr.
2015/08/14 00:10:29
Done
| |
2511 IntRect interestRect = LayoutRect::infiniteIntRect(); | |
2512 GraphicsContext context(rootGraphicsLayer->displayItemList()); | |
2513 rootGraphicsLayer->paint(context, interestRect); | |
2514 | |
2515 lifecycle().advanceTo(DocumentLifecycle::PaintForSlimmingPaintV2Clean); | |
2516 } | |
2517 | |
2518 void FrameView::compositeForSlimmingPaintV2() | |
2519 { | |
2520 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); | |
2521 ASSERT(frame() == page()->mainFrame() || (!frame().tree().parent()->isLocalF rame())); | |
2522 | |
2523 GraphicsLayer* rootGraphicsLayer = layoutView()->layer()->graphicsLayerBacki ng(); | |
2524 | |
2525 // Detached frames can have no root graphics layer. | |
2526 if (!rootGraphicsLayer) | |
2527 return; | |
2528 | |
2529 lifecycle().advanceTo(DocumentLifecycle::InCompositingForSlimmingPaintV2); | |
2530 | |
2531 DisplayListDiff displayListDiff; | |
2532 rootGraphicsLayer->displayItemList()->commitNewDisplayItems(&displayListDiff ); | |
2533 | |
2534 CompositedDisplayList compositedDisplayList(*rootGraphicsLayer->displayItemL ist(), displayListDiff, *rootGraphicsLayer); | |
2535 DisplayListCompositingBuilder compositingBuilder(compositedDisplayList); | |
2536 compositingBuilder.build(); | |
2537 | |
2538 lifecycle().advanceTo(DocumentLifecycle::CompositingForSlimmingPaintV2Clean) ; | |
2477 } | 2539 } |
2478 | 2540 |
2479 void FrameView::updatePostLifecycleData() | 2541 void FrameView::updatePostLifecycleData() |
2480 { | 2542 { |
2481 LayoutView* view = layoutView(); | 2543 LayoutView* view = layoutView(); |
2482 ASSERT(view); | 2544 ASSERT(view); |
2483 | 2545 |
2484 if (view->compositor()->inCompositingMode() && m_frame->isLocalRoot()) | 2546 if (view->compositor()->inCompositingMode() && m_frame->isLocalRoot()) |
2485 scrollingCoordinator()->updateAfterCompositingChangeIfNeeded(); | 2547 scrollingCoordinator()->updateAfterCompositingChangeIfNeeded(); |
2486 | 2548 |
(...skipping 1447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3934 | 3996 |
3935 if (!graphicsLayer) | 3997 if (!graphicsLayer) |
3936 return; | 3998 return; |
3937 | 3999 |
3938 DeprecatedPaintLayer::mapRectToPaintInvalidationBacking(localFrame->contentL ayoutObject(), paintInvalidationContainer, viewRect); | 4000 DeprecatedPaintLayer::mapRectToPaintInvalidationBacking(localFrame->contentL ayoutObject(), paintInvalidationContainer, viewRect); |
3939 | 4001 |
3940 graphicsLayerTimingRequests.add(graphicsLayer, Vector<std::pair<int64_t, Web Rect>>()).storedValue->value.append(std::make_pair(m_frame->frameID(), enclosing IntRect(viewRect))); | 4002 graphicsLayerTimingRequests.add(graphicsLayer, Vector<std::pair<int64_t, Web Rect>>()).storedValue->value.append(std::make_pair(m_frame->frameID(), enclosing IntRect(viewRect))); |
3941 } | 4003 } |
3942 | 4004 |
3943 } // namespace blink | 4005 } // namespace blink |
OLD | NEW |