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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
218 m_isPainting = false; | 218 m_isPainting = false; |
219 m_visuallyNonEmptyCharacterCount = 0; | 219 m_visuallyNonEmptyCharacterCount = 0; |
220 m_visuallyNonEmptyPixelCount = 0; | 220 m_visuallyNonEmptyPixelCount = 0; |
221 m_isVisuallyNonEmpty = false; | 221 m_isVisuallyNonEmpty = false; |
222 clearScrollAnchor(); | 222 clearScrollAnchor(); |
223 m_viewportConstrainedObjects.clear(); | 223 m_viewportConstrainedObjects.clear(); |
224 m_layoutSubtreeRootList.clear(); | 224 m_layoutSubtreeRootList.clear(); |
225 } | 225 } |
226 | 226 |
227 template <typename Function> | 227 template <typename Function> |
228 void FrameView::forAllFrameViews(Function function) | 228 void FrameView::forAllNonThrottledFrameViews(Function function) |
229 { | 229 { |
230 for (Frame* frame = m_frame.get(); frame; frame = frame->tree().traverseNext (m_frame.get())) { | 230 if (shouldThrottleRendering()) |
231 if (!frame->isLocalFrame()) | 231 return; |
232 | |
233 function(*this); | |
234 | |
235 for (Frame* child = m_frame->tree().firstChild(); child; child = child->tree ().nextSibling()) { | |
236 if (!child->isLocalFrame()) | |
232 continue; | 237 continue; |
233 if (FrameView* view = toLocalFrame(frame)->view()) | 238 if (FrameView* childView = toLocalFrame(child)->view()) |
234 function(*view); | 239 childView->forAllNonThrottledFrameViews(function); |
235 } | 240 } |
236 } | 241 } |
237 | 242 |
238 void FrameView::removeFromAXObjectCache() | 243 void FrameView::removeFromAXObjectCache() |
239 { | 244 { |
240 if (AXObjectCache* cache = axObjectCache()) { | 245 if (AXObjectCache* cache = axObjectCache()) { |
241 cache->remove(this); | 246 cache->remove(this); |
242 cache->childrenChanged(m_frame->pagePopupOwner()); | 247 cache->childrenChanged(m_frame->pagePopupOwner()); |
243 } | 248 } |
244 } | 249 } |
(...skipping 1040 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1285 } | 1290 } |
1286 | 1291 |
1287 bool FrameView::shouldSetCursor() const | 1292 bool FrameView::shouldSetCursor() const |
1288 { | 1293 { |
1289 Page* page = frame().page(); | 1294 Page* page = frame().page(); |
1290 return page && page->visibilityState() != PageVisibilityStateHidden && page- >focusController().isActive() && page->settings().deviceSupportsMouse(); | 1295 return page && page->visibilityState() != PageVisibilityStateHidden && page- >focusController().isActive() && page->settings().deviceSupportsMouse(); |
1291 } | 1296 } |
1292 | 1297 |
1293 void FrameView::scrollContentsIfNeededRecursive() | 1298 void FrameView::scrollContentsIfNeededRecursive() |
1294 { | 1299 { |
1295 forAllFrameViews([](FrameView& frameView) { | 1300 forAllNonThrottledFrameViews([](FrameView& frameView) { |
1296 if (frameView.shouldThrottleRendering()) | |
1297 return; | |
1298 frameView.scrollContentsIfNeeded(); | 1301 frameView.scrollContentsIfNeeded(); |
1299 }); | 1302 }); |
1300 } | 1303 } |
1301 | 1304 |
1302 void FrameView::invalidateBackgroundAttachmentFixedObjects() | 1305 void FrameView::invalidateBackgroundAttachmentFixedObjects() |
1303 { | 1306 { |
1304 for (const auto& layoutObject : m_backgroundAttachmentFixedObjects) | 1307 for (const auto& layoutObject : m_backgroundAttachmentFixedObjects) |
1305 layoutObject->setShouldDoFullPaintInvalidation(); | 1308 layoutObject->setShouldDoFullPaintInvalidation(); |
1306 } | 1309 } |
1307 | 1310 |
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1817 CompositedLayerMapping* compositedLayerMapping = layoutView()->layer()-> compositedLayerMapping(); | 1820 CompositedLayerMapping* compositedLayerMapping = layoutView()->layer()-> compositedLayerMapping(); |
1818 compositedLayerMapping->updateContentsOpaque(); | 1821 compositedLayerMapping->updateContentsOpaque(); |
1819 if (compositedLayerMapping->mainGraphicsLayer()) | 1822 if (compositedLayerMapping->mainGraphicsLayer()) |
1820 compositedLayerMapping->mainGraphicsLayer()->setNeedsDisplay(); | 1823 compositedLayerMapping->mainGraphicsLayer()->setNeedsDisplay(); |
1821 } | 1824 } |
1822 recalculateScrollbarOverlayStyle(); | 1825 recalculateScrollbarOverlayStyle(); |
1823 } | 1826 } |
1824 | 1827 |
1825 void FrameView::updateBackgroundRecursively(const Color& backgroundColor, bool t ransparent) | 1828 void FrameView::updateBackgroundRecursively(const Color& backgroundColor, bool t ransparent) |
1826 { | 1829 { |
1827 forAllFrameViews([backgroundColor, transparent](FrameView& frameView) { | 1830 forAllNonThrottledFrameViews([backgroundColor, transparent](FrameView& frame View) { |
1828 frameView.setTransparent(transparent); | 1831 frameView.setTransparent(transparent); |
1829 frameView.setBaseBackgroundColor(backgroundColor); | 1832 frameView.setBaseBackgroundColor(backgroundColor); |
1830 }); | 1833 }); |
1831 } | 1834 } |
1832 | 1835 |
1833 void FrameView::scrollToAnchor() | 1836 void FrameView::scrollToAnchor() |
1834 { | 1837 { |
1835 RefPtrWillBeRawPtr<Node> anchorNode = m_scrollAnchor; | 1838 RefPtrWillBeRawPtr<Node> anchorNode = m_scrollAnchor; |
1836 if (!anchorNode) | 1839 if (!anchorNode) |
1837 return; | 1840 return; |
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2450 invalidateTreeIfNeededRecursive(); | 2453 invalidateTreeIfNeededRecursive(); |
2451 | 2454 |
2452 if (view->compositor()->inCompositingMode()) | 2455 if (view->compositor()->inCompositingMode()) |
2453 scrollingCoordinator()->updateAfterCompositingChangeIfNeeded(); | 2456 scrollingCoordinator()->updateAfterCompositingChangeIfNeeded(); |
2454 | 2457 |
2455 updateCompositedSelectionIfNeeded(); | 2458 updateCompositedSelectionIfNeeded(); |
2456 | 2459 |
2457 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) | 2460 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) |
2458 updatePaintProperties(); | 2461 updatePaintProperties(); |
2459 | 2462 |
2460 if (RuntimeEnabledFeatures::slimmingPaintSynchronizedPaintingEnabled ()) { | 2463 if (RuntimeEnabledFeatures::slimmingPaintSynchronizedPaintingEnabled () && !m_frame->document()->printing()) { |
2461 synchronizedPaint(); | 2464 synchronizedPaint(); |
2462 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) | 2465 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) |
2463 compositeForSlimmingPaintV2(); | 2466 compositeForSlimmingPaintV2(); |
2464 } | 2467 } |
2465 | 2468 |
2466 if (RuntimeEnabledFeatures::frameTimingSupportEnabled()) | 2469 if (RuntimeEnabledFeatures::frameTimingSupportEnabled()) |
2467 updateFrameTimingRequestsIfNeeded(); | 2470 updateFrameTimingRequestsIfNeeded(); |
2468 | 2471 |
2469 ASSERT(!view->hasPendingSelection()); | 2472 ASSERT(!view->hasPendingSelection()); |
2470 ASSERT(lifecycle().state() == DocumentLifecycle::PaintInvalidationCl ean | 2473 ASSERT(lifecycle().state() == DocumentLifecycle::PaintInvalidationCl ean |
2471 || (RuntimeEnabledFeatures::slimmingPaintV2Enabled() && lifecycl e().state() == DocumentLifecycle::CompositingForSlimmingPaintV2Clean) | 2474 || (RuntimeEnabledFeatures::slimmingPaintV2Enabled() && lifecycl e().state() == DocumentLifecycle::CompositingForSlimmingPaintV2Clean) |
2472 || (RuntimeEnabledFeatures::slimmingPaintSynchronizedPaintingEna bled() && lifecycle().state() == DocumentLifecycle::PaintClean)); | 2475 || (RuntimeEnabledFeatures::slimmingPaintSynchronizedPaintingEna bled() && lifecycle().state() == DocumentLifecycle::PaintClean)); |
2473 } | 2476 } |
2474 } | 2477 } |
2475 | 2478 |
2476 updateViewportIntersectionsForSubtree(); | 2479 updateViewportIntersectionsForSubtree(); |
2477 } | 2480 } |
2478 | 2481 |
2479 void FrameView::updatePaintProperties() | 2482 void FrameView::updatePaintProperties() |
2480 { | 2483 { |
2481 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); | 2484 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); |
2482 | 2485 |
2483 forAllFrameViews([](FrameView& frameView) { frameView.lifecycle().advanceTo( DocumentLifecycle::InUpdatePaintProperties); }); | 2486 forAllNonThrottledFrameViews([](FrameView& frameView) { frameView.lifecycle( ).advanceTo(DocumentLifecycle::InUpdatePaintProperties); }); |
2484 PaintPropertyTreeBuilder().buildPropertyTrees(*this); | 2487 PaintPropertyTreeBuilder().buildPropertyTrees(*this); |
2485 forAllFrameViews([](FrameView& frameView) { frameView.lifecycle().advanceTo( DocumentLifecycle::UpdatePaintPropertiesClean); }); | 2488 forAllNonThrottledFrameViews([](FrameView& frameView) { frameView.lifecycle( ).advanceTo(DocumentLifecycle::UpdatePaintPropertiesClean); }); |
2486 } | 2489 } |
2487 | 2490 |
2488 void FrameView::synchronizedPaint() | 2491 void FrameView::synchronizedPaint() |
2489 { | 2492 { |
2490 ASSERT(RuntimeEnabledFeatures::slimmingPaintSynchronizedPaintingEnabled()); | 2493 ASSERT(RuntimeEnabledFeatures::slimmingPaintSynchronizedPaintingEnabled()); |
2491 ASSERT(frame() == page()->mainFrame() || (!frame().tree().parent()->isLocalF rame())); | 2494 ASSERT(frame() == page()->mainFrame() || (!frame().tree().parent()->isLocalF rame())); |
2492 | 2495 |
2493 LayoutView* view = layoutView(); | 2496 LayoutView* view = layoutView(); |
2494 ASSERT(view); | 2497 ASSERT(view); |
2495 // TODO(chrishtr): figure out if there can be any GraphicsLayer above this o ne that draws content. | 2498 forAllNonThrottledFrameViews([](FrameView& frameView) { frameView.lifecycle( ).advanceTo(DocumentLifecycle::InPaint); }); |
2496 GraphicsLayer* rootGraphicsLayer = view->layer()->graphicsLayerBacking(); | |
2497 forAllFrameViews([](FrameView& frameView) { frameView.lifecycle().advanceTo( DocumentLifecycle::InPaint); }); | |
2498 | 2499 |
2499 // A null graphics layer can occur for painting of SVG images that are not p arented into the main frame tree. | 2500 // A null graphics layer can occur for painting of SVG images that are not p arented into the main frame tree. |
2500 if (rootGraphicsLayer) { | 2501 if (GraphicsLayer* rootGraphicsLayer = view->layer()->graphicsLayerBacking() ) { |
2501 synchronizedPaintRecursively(rootGraphicsLayer); | 2502 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
2503 GraphicsContext context(*rootGraphicsLayer->paintController()); | |
2504 rootGraphicsLayer->paint(context, nullptr); | |
2505 } else { | |
2506 while (GraphicsLayer* parent = rootGraphicsLayer->parent()) | |
chrishtr
2015/10/30 19:01:13
Why this while loop?
Xianzhu
2015/10/30 19:28:56
There may be other paintable layers (e.g. frame sc
| |
2507 rootGraphicsLayer = parent; | |
2508 synchronizedPaintRecursively(rootGraphicsLayer); | |
2509 } | |
2502 } | 2510 } |
2503 | 2511 |
2504 forAllFrameViews([](FrameView& frameView) { | 2512 forAllNonThrottledFrameViews([](FrameView& frameView) { |
2505 frameView.lifecycle().advanceTo(DocumentLifecycle::PaintClean); | 2513 frameView.lifecycle().advanceTo(DocumentLifecycle::PaintClean); |
2506 frameView.layoutView()->layer()->clearNeedsRepaintRecursively(); | 2514 frameView.layoutView()->layer()->clearNeedsRepaintRecursively(); |
2507 }); | 2515 }); |
2508 } | 2516 } |
2509 | 2517 |
2510 void FrameView::synchronizedPaintRecursively(GraphicsLayer* graphicsLayer) | 2518 void FrameView::synchronizedPaintRecursively(GraphicsLayer* graphicsLayer) |
2511 { | 2519 { |
2520 ASSERT(!RuntimeEnabledFeatures::slimmingPaintV2Enabled()); | |
2512 ASSERT(graphicsLayer->paintController()); | 2521 ASSERT(graphicsLayer->paintController()); |
2513 GraphicsContext context(*graphicsLayer->paintController()); | 2522 GraphicsContext context(*graphicsLayer->paintController()); |
2514 | 2523 |
2524 if (GraphicsLayer* maskLayer = graphicsLayer->maskLayer()) | |
2525 synchronizedPaintRecursively(maskLayer); | |
2526 if (GraphicsLayer* contentsClippingMaskLayer = graphicsLayer->contentsClippi ngMaskLayer()) | |
2527 synchronizedPaintRecursively(contentsClippingMaskLayer); | |
2528 if (GraphicsLayer* replicaLayer = graphicsLayer->replicaLayer()) | |
2529 synchronizedPaintRecursively(replicaLayer); | |
2530 | |
2531 // TODO(chrishtr): fix unit tests to not inject one-off interest rects. | |
2515 graphicsLayer->paint(context, nullptr); | 2532 graphicsLayer->paint(context, nullptr); |
2516 | 2533 graphicsLayer->paintController()->commitNewDisplayItems(); |
2517 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) | |
2518 graphicsLayer->paintController()->commitNewDisplayItems(); | |
2519 | 2534 |
2520 for (auto& child : graphicsLayer->children()) | 2535 for (auto& child : graphicsLayer->children()) |
2521 synchronizedPaintRecursively(child); | 2536 synchronizedPaintRecursively(child); |
2522 } | 2537 } |
2523 | 2538 |
2524 void FrameView::compositeForSlimmingPaintV2() | 2539 void FrameView::compositeForSlimmingPaintV2() |
2525 { | 2540 { |
2526 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); | 2541 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); |
2527 ASSERT(frame() == page()->mainFrame() || (!frame().tree().parent()->isLocalF rame())); | 2542 ASSERT(frame() == page()->mainFrame() || (!frame().tree().parent()->isLocalF rame())); |
2528 | 2543 |
2529 forAllFrameViews([](FrameView& frameView) { frameView.lifecycle().advanceTo( DocumentLifecycle::InCompositingForSlimmingPaintV2); }); | 2544 forAllNonThrottledFrameViews([](FrameView& frameView) { frameView.lifecycle( ).advanceTo(DocumentLifecycle::InCompositingForSlimmingPaintV2); }); |
2530 | 2545 |
2531 // Detached frames can have no root graphics layer. | |
2532 if (GraphicsLayer* rootGraphicsLayer = layoutView()->layer()->graphicsLayerB acking()) | 2546 if (GraphicsLayer* rootGraphicsLayer = layoutView()->layer()->graphicsLayerB acking()) |
2533 rootGraphicsLayer->paintController()->commitNewDisplayItems(); | 2547 rootGraphicsLayer->paintController()->commitNewDisplayItems(); |
2534 | 2548 |
2535 forAllFrameViews([](FrameView& frameView) { frameView.lifecycle().advanceTo( DocumentLifecycle::CompositingForSlimmingPaintV2Clean); }); | 2549 forAllNonThrottledFrameViews([](FrameView& frameView) { frameView.lifecycle( ).advanceTo(DocumentLifecycle::CompositingForSlimmingPaintV2Clean); }); |
2536 } | 2550 } |
2537 | 2551 |
2538 void FrameView::updateFrameTimingRequestsIfNeeded() | 2552 void FrameView::updateFrameTimingRequestsIfNeeded() |
2539 { | 2553 { |
2540 GraphicsLayerFrameTimingRequests graphicsLayerTimingRequests; | 2554 GraphicsLayerFrameTimingRequests graphicsLayerTimingRequests; |
2541 // TODO(mpb) use a 'dirty' bit to not call this every time. | 2555 // TODO(mpb) use a 'dirty' bit to not call this every time. |
2542 collectFrameTimingRequestsRecursive(graphicsLayerTimingRequests); | 2556 collectFrameTimingRequestsRecursive(graphicsLayerTimingRequests); |
2543 | 2557 |
2544 for (const auto& iter : graphicsLayerTimingRequests) { | 2558 for (const auto& iter : graphicsLayerTimingRequests) { |
2545 const GraphicsLayer* graphicsLayer = iter.key; | 2559 const GraphicsLayer* graphicsLayer = iter.key; |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2609 | 2623 |
2610 // We need to stop recursing here since a child frame view might not be thro ttled | 2624 // We need to stop recursing here since a child frame view might not be thro ttled |
2611 // even though we are (e.g., it didn't compute its visibility yet). | 2625 // even though we are (e.g., it didn't compute its visibility yet). |
2612 if (shouldThrottleRendering()) | 2626 if (shouldThrottleRendering()) |
2613 return; | 2627 return; |
2614 TRACE_EVENT1("blink", "FrameView::invalidateTreeIfNeededRecursive", "root", layoutView()->debugName().ascii()); | 2628 TRACE_EVENT1("blink", "FrameView::invalidateTreeIfNeededRecursive", "root", layoutView()->debugName().ascii()); |
2615 | 2629 |
2616 Vector<LayoutObject*> pendingDelayedPaintInvalidations; | 2630 Vector<LayoutObject*> pendingDelayedPaintInvalidations; |
2617 PaintInvalidationState rootPaintInvalidationState(*layoutView(), pendingDela yedPaintInvalidations); | 2631 PaintInvalidationState rootPaintInvalidationState(*layoutView(), pendingDela yedPaintInvalidations); |
2618 | 2632 |
2619 invalidateTreeIfNeeded(rootPaintInvalidationState); | 2633 if (lifecycle().state() < DocumentLifecycle::PaintInvalidationClean) |
2634 invalidateTreeIfNeeded(rootPaintInvalidationState); | |
2620 | 2635 |
2621 // Some frames may be not reached during the above invalidateTreeIfNeeded be cause | 2636 // Some frames may be not reached during the above invalidateTreeIfNeeded be cause |
2622 // - the frame is a detached frame; or | 2637 // - the frame is a detached frame; or |
2623 // - it didn't need paint invalidation. | 2638 // - it didn't need paint invalidation. |
2624 // We need to call invalidateTreeIfNeededRecursive() for such frames to fini sh required | 2639 // We need to call invalidateTreeIfNeededRecursive() for such frames to fini sh required |
2625 // paint invalidation and advance their life cycle state. | 2640 // paint invalidation and advance their life cycle state. |
2626 for (Frame* child = m_frame->tree().firstChild(); child; child = child->tree ().nextSibling()) { | 2641 for (Frame* child = m_frame->tree().firstChild(); child; child = child->tree ().nextSibling()) { |
2627 if (!child->isLocalFrame()) | 2642 if (child->isLocalFrame()) |
2628 continue; | 2643 toLocalFrame(child)->view()->invalidateTreeIfNeededRecursive(); |
2629 FrameView* childFrameView = toLocalFrame(child)->view(); | |
2630 if (childFrameView->lifecycle().state() < DocumentLifecycle::PaintInvali dationClean) | |
2631 childFrameView->invalidateTreeIfNeededRecursive(); | |
2632 } | 2644 } |
2633 | 2645 |
2634 // Process objects needing paint invalidation on the next frame. See the def inition of PaintInvalidationDelayedFull for more details. | 2646 // Process objects needing paint invalidation on the next frame. See the def inition of PaintInvalidationDelayedFull for more details. |
2635 for (auto& target : pendingDelayedPaintInvalidations) | 2647 for (auto& target : pendingDelayedPaintInvalidations) |
2636 target->setShouldDoFullPaintInvalidation(PaintInvalidationDelayedFull); | 2648 target->setShouldDoFullPaintInvalidation(PaintInvalidationDelayedFull); |
2637 } | 2649 } |
2638 | 2650 |
2639 void FrameView::enableAutoSizeMode(const IntSize& minSize, const IntSize& maxSiz e) | 2651 void FrameView::enableAutoSizeMode(const IntSize& minSize, const IntSize& maxSiz e) |
2640 { | 2652 { |
2641 if (!m_autoSizeInfo) | 2653 if (!m_autoSizeInfo) |
(...skipping 1433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4075 } | 4087 } |
4076 | 4088 |
4077 bool FrameView::canThrottleRendering() const | 4089 bool FrameView::canThrottleRendering() const |
4078 { | 4090 { |
4079 if (!RuntimeEnabledFeatures::renderingPipelineThrottlingEnabled()) | 4091 if (!RuntimeEnabledFeatures::renderingPipelineThrottlingEnabled()) |
4080 return false; | 4092 return false; |
4081 return m_hiddenForThrottling && m_crossOriginForThrottling; | 4093 return m_hiddenForThrottling && m_crossOriginForThrottling; |
4082 } | 4094 } |
4083 | 4095 |
4084 } // namespace blink | 4096 } // namespace blink |
OLD | NEW |