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/FrameSelection.h" | 38 #include "core/editing/FrameSelection.h" |
38 #include "core/editing/RenderedPosition.h" | 39 #include "core/editing/RenderedPosition.h" |
39 #include "core/editing/htmlediting.h" | 40 #include "core/editing/htmlediting.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(); |
| 2452 } |
| 2453 |
2449 scrollContentsIfNeededRecursive(); | 2454 scrollContentsIfNeededRecursive(); |
2450 | 2455 |
| 2456 if (view && RuntimeEnabledFeatures::slimmingPaintV2Enabled()) |
| 2457 paintAndComposite(); |
| 2458 |
2451 ASSERT(lifecycle().state() >= DocumentLifecycle::CompositingClean); | 2459 ASSERT(lifecycle().state() >= DocumentLifecycle::CompositingClean); |
2452 } | 2460 } |
2453 | 2461 |
2454 void FrameView::updateAllLifecyclePhasesInternal() | 2462 void FrameView::updateAllLifecyclePhasesInternal() |
2455 { | 2463 { |
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. | 2464 // 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())); | 2465 ASSERT(frame() == page()->mainFrame() || (!frame().tree().parent()->isLocalF
rame())); |
2458 | 2466 |
2459 // Updating layout can run script, which can tear down the FrameView. | 2467 // Updating layout can run script, which can tear down the FrameView. |
2460 RefPtrWillBeRawPtr<FrameView> protector(this); | 2468 RefPtrWillBeRawPtr<FrameView> protector(this); |
2461 | 2469 |
2462 updateStyleAndLayoutIfNeededRecursive(); | 2470 updateStyleAndLayoutIfNeededRecursive(); |
2463 | 2471 |
2464 LayoutView* view = layoutView(); | 2472 LayoutView* view = layoutView(); |
2465 if (view) { | 2473 if (view) { |
2466 TRACE_EVENT1("devtools.timeline", "UpdateLayerTree", "data", InspectorUp
dateLayerTreeEvent::data(m_frame.get())); | 2474 TRACE_EVENT1("devtools.timeline", "UpdateLayerTree", "data", InspectorUp
dateLayerTreeEvent::data(m_frame.get())); |
2467 | 2475 |
| 2476 // For SlimmingPaintV2, we still need this to set up the root layer(s). |
2468 view->compositor()->updateIfNeededRecursive(); | 2477 view->compositor()->updateIfNeededRecursive(); |
2469 scrollContentsIfNeededRecursive(); | 2478 scrollContentsIfNeededRecursive(); |
2470 invalidateTreeIfNeededRecursive(); | 2479 invalidateTreeIfNeededRecursive(); |
| 2480 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) |
| 2481 paintAndComposite(); |
2471 updatePostLifecycleData(); | 2482 updatePostLifecycleData(); |
2472 | 2483 |
2473 ASSERT(!view->hasPendingSelection()); | 2484 ASSERT(!view->hasPendingSelection()); |
2474 } | 2485 } |
2475 | 2486 |
2476 ASSERT(lifecycle().state() == DocumentLifecycle::PaintInvalidationClean); | 2487 ASSERT(lifecycle().state() == DocumentLifecycle::PaintInvalidationClean |
| 2488 || (RuntimeEnabledFeatures::slimmingPaintV2Enabled() && lifecycle().stat
e() == DocumentLifecycle::CompositingClean)); |
| 2489 } |
| 2490 |
| 2491 void FrameView::paintAndComposite() |
| 2492 { |
| 2493 ASSERT(frame() == page()->mainFrame() || (!frame().tree().parent()->isLocalF
rame())); |
| 2494 |
| 2495 LayoutView* view = layoutView(); |
| 2496 ASSERT(view); |
| 2497 |
| 2498 GraphicsLayer* rootGraphicsLayer = view->layer()->graphicsLayerBacking(); |
| 2499 |
| 2500 // Detached frames can have no root graphics layer. |
| 2501 if (!rootGraphicsLayer) |
| 2502 return; |
| 2503 |
| 2504 // TODO: 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 DisplayListDiff displayListDiff; |
| 2510 rootGraphicsLayer->displayItemList()->commitNewDisplayItems(&displayListDiff
); |
| 2511 lifecycle().advanceTo(DocumentLifecycle::InCompositingUpdate); |
| 2512 |
| 2513 DisplayListCompositingBuilder compositingBuilder(*rootGraphicsLayer->display
ItemList(), displayListDiff, *rootGraphicsLayer); |
| 2514 compositingBuilder.build(); |
| 2515 |
| 2516 lifecycle().advanceTo(DocumentLifecycle::CompositingClean); |
2477 } | 2517 } |
2478 | 2518 |
2479 void FrameView::updatePostLifecycleData() | 2519 void FrameView::updatePostLifecycleData() |
2480 { | 2520 { |
2481 LayoutView* view = layoutView(); | 2521 LayoutView* view = layoutView(); |
2482 ASSERT(view); | 2522 ASSERT(view); |
2483 | 2523 |
2484 if (view->compositor()->inCompositingMode() && m_frame->isLocalRoot()) | 2524 if (view->compositor()->inCompositingMode() && m_frame->isLocalRoot()) |
2485 scrollingCoordinator()->updateAfterCompositingChangeIfNeeded(); | 2525 scrollingCoordinator()->updateAfterCompositingChangeIfNeeded(); |
2486 | 2526 |
(...skipping 1447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3934 | 3974 |
3935 if (!graphicsLayer) | 3975 if (!graphicsLayer) |
3936 return; | 3976 return; |
3937 | 3977 |
3938 DeprecatedPaintLayer::mapRectToPaintInvalidationBacking(localFrame->contentL
ayoutObject(), paintInvalidationContainer, viewRect); | 3978 DeprecatedPaintLayer::mapRectToPaintInvalidationBacking(localFrame->contentL
ayoutObject(), paintInvalidationContainer, viewRect); |
3939 | 3979 |
3940 graphicsLayerTimingRequests.add(graphicsLayer, Vector<std::pair<int64_t, Web
Rect>>()).storedValue->value.append(std::make_pair(m_frame->frameID(), enclosing
IntRect(viewRect))); | 3980 graphicsLayerTimingRequests.add(graphicsLayer, Vector<std::pair<int64_t, Web
Rect>>()).storedValue->value.append(std::make_pair(m_frame->frameID(), enclosing
IntRect(viewRect))); |
3941 } | 3981 } |
3942 | 3982 |
3943 } // namespace blink | 3983 } // namespace blink |
OLD | NEW |