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 // This was required for slimming paint v1 but is only temporarily |
| 2451 // needed for slimming paint v2. |
2448 view->compositor()->updateIfNeededRecursive(); | 2452 view->compositor()->updateIfNeededRecursive(); |
| 2453 } |
| 2454 |
2449 scrollContentsIfNeededRecursive(); | 2455 scrollContentsIfNeededRecursive(); |
2450 | 2456 |
| 2457 if (view && RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
| 2458 paintForSlimmingPaintV2(); |
| 2459 compositeForSlimmingPaintV2(); |
| 2460 } |
| 2461 |
2451 ASSERT(lifecycle().state() >= DocumentLifecycle::CompositingClean); | 2462 ASSERT(lifecycle().state() >= DocumentLifecycle::CompositingClean); |
2452 } | 2463 } |
2453 | 2464 |
2454 void FrameView::updateAllLifecyclePhasesInternal() | 2465 void FrameView::updateAllLifecyclePhasesInternal() |
2455 { | 2466 { |
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. | 2467 // 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())); | 2468 ASSERT(frame() == page()->mainFrame() || (!frame().tree().parent()->isLocalF
rame())); |
2458 | 2469 |
2459 // Updating layout can run script, which can tear down the FrameView. | 2470 // Updating layout can run script, which can tear down the FrameView. |
2460 RefPtrWillBeRawPtr<FrameView> protector(this); | 2471 RefPtrWillBeRawPtr<FrameView> protector(this); |
2461 | 2472 |
2462 updateStyleAndLayoutIfNeededRecursive(); | 2473 updateStyleAndLayoutIfNeededRecursive(); |
2463 | 2474 |
2464 LayoutView* view = layoutView(); | 2475 LayoutView* view = layoutView(); |
2465 if (view) { | 2476 if (view) { |
2466 TRACE_EVENT1("devtools.timeline", "UpdateLayerTree", "data", InspectorUp
dateLayerTreeEvent::data(m_frame.get())); | 2477 TRACE_EVENT1("devtools.timeline", "UpdateLayerTree", "data", InspectorUp
dateLayerTreeEvent::data(m_frame.get())); |
2467 | 2478 |
| 2479 // This was required for slimming paint v1 but is only temporarily |
| 2480 // needed for slimming paint v2. |
2468 view->compositor()->updateIfNeededRecursive(); | 2481 view->compositor()->updateIfNeededRecursive(); |
2469 scrollContentsIfNeededRecursive(); | 2482 scrollContentsIfNeededRecursive(); |
2470 invalidateTreeIfNeededRecursive(); | 2483 invalidateTreeIfNeededRecursive(); |
| 2484 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
| 2485 paintForSlimmingPaintV2(); |
| 2486 compositeForSlimmingPaintV2(); |
| 2487 } |
2471 updatePostLifecycleData(); | 2488 updatePostLifecycleData(); |
2472 | 2489 |
2473 ASSERT(!view->hasPendingSelection()); | 2490 ASSERT(!view->hasPendingSelection()); |
2474 } | 2491 } |
2475 | 2492 |
2476 ASSERT(lifecycle().state() == DocumentLifecycle::PaintInvalidationClean); | 2493 ASSERT(lifecycle().state() == DocumentLifecycle::PaintInvalidationClean |
| 2494 || (RuntimeEnabledFeatures::slimmingPaintV2Enabled() && lifecycle().stat
e() == DocumentLifecycle::CompositingForSlimmingPaintV2Clean)); |
| 2495 } |
| 2496 |
| 2497 void FrameView::paintForSlimmingPaintV2() |
| 2498 { |
| 2499 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); |
| 2500 ASSERT(frame() == page()->mainFrame() || (!frame().tree().parent()->isLocalF
rame())); |
| 2501 |
| 2502 LayoutView* view = layoutView(); |
| 2503 ASSERT(view); |
| 2504 GraphicsLayer* rootGraphicsLayer = view->layer()->graphicsLayerBacking(); |
| 2505 |
| 2506 // Detached frames can have no root graphics layer. |
| 2507 if (!rootGraphicsLayer) |
| 2508 return; |
| 2509 |
| 2510 lifecycle().advanceTo(DocumentLifecycle::InPaintForSlimmingPaintV2); |
| 2511 |
| 2512 // TODO(pdr): Update callers to pass in the interest rect. |
| 2513 IntRect interestRect = LayoutRect::infiniteIntRect(); |
| 2514 GraphicsContext context(rootGraphicsLayer->displayItemList()); |
| 2515 rootGraphicsLayer->paint(context, interestRect); |
| 2516 |
| 2517 lifecycle().advanceTo(DocumentLifecycle::PaintForSlimmingPaintV2Clean); |
| 2518 } |
| 2519 |
| 2520 void FrameView::compositeForSlimmingPaintV2() |
| 2521 { |
| 2522 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); |
| 2523 ASSERT(frame() == page()->mainFrame() || (!frame().tree().parent()->isLocalF
rame())); |
| 2524 |
| 2525 GraphicsLayer* rootGraphicsLayer = layoutView()->layer()->graphicsLayerBacki
ng(); |
| 2526 |
| 2527 // Detached frames can have no root graphics layer. |
| 2528 if (!rootGraphicsLayer) |
| 2529 return; |
| 2530 |
| 2531 lifecycle().advanceTo(DocumentLifecycle::InCompositingForSlimmingPaintV2); |
| 2532 |
| 2533 DisplayListDiff displayListDiff; |
| 2534 rootGraphicsLayer->displayItemList()->commitNewDisplayItems(&displayListDiff
); |
| 2535 |
| 2536 DisplayListCompositingBuilder compositingBuilder(*rootGraphicsLayer->display
ItemList(), displayListDiff); |
| 2537 CompositedDisplayList compositedDisplayList; |
| 2538 compositingBuilder.build(compositedDisplayList); |
| 2539 layoutView()->setTransformTree(compositedDisplayList.transformTree.release()
); |
| 2540 |
| 2541 lifecycle().advanceTo(DocumentLifecycle::CompositingForSlimmingPaintV2Clean)
; |
2477 } | 2542 } |
2478 | 2543 |
2479 void FrameView::updatePostLifecycleData() | 2544 void FrameView::updatePostLifecycleData() |
2480 { | 2545 { |
2481 LayoutView* view = layoutView(); | 2546 LayoutView* view = layoutView(); |
2482 ASSERT(view); | 2547 ASSERT(view); |
2483 | 2548 |
2484 if (view->compositor()->inCompositingMode() && m_frame->isLocalRoot()) | 2549 if (view->compositor()->inCompositingMode() && m_frame->isLocalRoot()) |
2485 scrollingCoordinator()->updateAfterCompositingChangeIfNeeded(); | 2550 scrollingCoordinator()->updateAfterCompositingChangeIfNeeded(); |
2486 | 2551 |
(...skipping 1447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3934 | 3999 |
3935 if (!graphicsLayer) | 4000 if (!graphicsLayer) |
3936 return; | 4001 return; |
3937 | 4002 |
3938 DeprecatedPaintLayer::mapRectToPaintInvalidationBacking(localFrame->contentL
ayoutObject(), paintInvalidationContainer, viewRect); | 4003 DeprecatedPaintLayer::mapRectToPaintInvalidationBacking(localFrame->contentL
ayoutObject(), paintInvalidationContainer, viewRect); |
3939 | 4004 |
3940 graphicsLayerTimingRequests.add(graphicsLayer, Vector<std::pair<int64_t, Web
Rect>>()).storedValue->value.append(std::make_pair(m_frame->frameID(), enclosing
IntRect(viewRect))); | 4005 graphicsLayerTimingRequests.add(graphicsLayer, Vector<std::pair<int64_t, Web
Rect>>()).storedValue->value.append(std::make_pair(m_frame->frameID(), enclosing
IntRect(viewRect))); |
3941 } | 4006 } |
3942 | 4007 |
3943 } // namespace blink | 4008 } // namespace blink |
OLD | NEW |