| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009, 2010 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 rootFixedBackgroundsChanged(); | 455 rootFixedBackgroundsChanged(); |
| 456 m_needsUpdateFixedBackground = false; | 456 m_needsUpdateFixedBackground = false; |
| 457 } | 457 } |
| 458 | 458 |
| 459 for (unsigned i = 0; i < layersNeedingPaintInvalidation.size(); i++) { | 459 for (unsigned i = 0; i < layersNeedingPaintInvalidation.size(); i++) { |
| 460 forceRecomputeVisualRectsIncludingNonCompositingDescendants( | 460 forceRecomputeVisualRectsIncludingNonCompositingDescendants( |
| 461 layersNeedingPaintInvalidation[i]->layoutObject()); | 461 layersNeedingPaintInvalidation[i]->layoutObject()); |
| 462 } | 462 } |
| 463 | 463 |
| 464 // Inform the inspector that the layer tree has changed. | 464 // Inform the inspector that the layer tree has changed. |
| 465 if (m_layoutView.frame()->isMainFrame()) | 465 if (isMainFrame()) |
| 466 probe::layerTreeDidChange(m_layoutView.frame()); | 466 probe::layerTreeDidChange(m_layoutView.frame()); |
| 467 } | 467 } |
| 468 | 468 |
| 469 void PaintLayerCompositor::updateClippingOnCompositorLayers() { | 469 void PaintLayerCompositor::updateClippingOnCompositorLayers() { |
| 470 bool shouldClip = !rootLayer()->hasRootScrollerAsDescendant(); | 470 bool shouldClip = !rootLayer()->hasRootScrollerAsDescendant(); |
| 471 if (m_rootContentLayer) { | 471 if (m_rootContentLayer) { |
| 472 // FIXME: with rootLayerScrolls, we probably don't even need | 472 // FIXME: with rootLayerScrolls, we probably don't even need |
| 473 // m_rootContentLayer? | 473 // m_rootContentLayer? |
| 474 m_rootContentLayer->setMasksToBounds( | 474 m_rootContentLayer->setMasksToBounds( |
| 475 !RuntimeEnabledFeatures::rootLayerScrollingEnabled() && shouldClip); | 475 !RuntimeEnabledFeatures::rootLayerScrollingEnabled() && shouldClip); |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 716 m_layoutView.frameView()->shouldThrottleRendering()); | 716 m_layoutView.frameView()->shouldThrottleRendering()); |
| 717 | 717 |
| 718 if (!m_rootContentLayer) | 718 if (!m_rootContentLayer) |
| 719 return nullptr; | 719 return nullptr; |
| 720 | 720 |
| 721 // We skip dumping the scroll and clip layers to keep layerTreeAsText output | 721 // We skip dumping the scroll and clip layers to keep layerTreeAsText output |
| 722 // similar between platforms (unless we explicitly request dumping from the | 722 // similar between platforms (unless we explicitly request dumping from the |
| 723 // root. | 723 // root. |
| 724 GraphicsLayer* rootLayer = m_rootContentLayer.get(); | 724 GraphicsLayer* rootLayer = m_rootContentLayer.get(); |
| 725 if (flags & LayerTreeIncludesRootLayer) { | 725 if (flags & LayerTreeIncludesRootLayer) { |
| 726 if (m_layoutView.frame()->isMainFrame()) { | 726 if (isMainFrame()) { |
| 727 while (rootLayer->parent()) | 727 while (rootLayer->parent()) |
| 728 rootLayer = rootLayer->parent(); | 728 rootLayer = rootLayer->parent(); |
| 729 } else { | 729 } else { |
| 730 rootLayer = rootGraphicsLayer(); | 730 rootLayer = rootGraphicsLayer(); |
| 731 } | 731 } |
| 732 } | 732 } |
| 733 | 733 |
| 734 return rootLayer->layerTreeAsJSON(flags); | 734 return rootLayer->layerTreeAsJSON(flags); |
| 735 } | 735 } |
| 736 | 736 |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1039 | 1039 |
| 1040 bool PaintLayerCompositor::requiresScrollCornerLayer() const { | 1040 bool PaintLayerCompositor::requiresScrollCornerLayer() const { |
| 1041 return m_layoutView.frameView()->isScrollCornerVisible(); | 1041 return m_layoutView.frameView()->isScrollCornerVisible(); |
| 1042 } | 1042 } |
| 1043 | 1043 |
| 1044 void PaintLayerCompositor::updateOverflowControlsLayers() { | 1044 void PaintLayerCompositor::updateOverflowControlsLayers() { |
| 1045 GraphicsLayer* controlsParent = m_overflowControlsHostLayer.get(); | 1045 GraphicsLayer* controlsParent = m_overflowControlsHostLayer.get(); |
| 1046 // Main frame scrollbars should always be stuck to the sides of the screen (in | 1046 // Main frame scrollbars should always be stuck to the sides of the screen (in |
| 1047 // overscroll and in pinch-zoom), so make the parent for the scrollbars be the | 1047 // overscroll and in pinch-zoom), so make the parent for the scrollbars be the |
| 1048 // viewport container layer. | 1048 // viewport container layer. |
| 1049 if (m_layoutView.frame()->isMainFrame()) { | 1049 if (isMainFrame()) |
| 1050 VisualViewport& visualViewport = | 1050 controlsParent = visualViewport().containerLayer(); |
| 1051 m_layoutView.frameView()->page()->frameHost().visualViewport(); | |
| 1052 controlsParent = visualViewport.containerLayer(); | |
| 1053 } | |
| 1054 | 1051 |
| 1055 if (requiresHorizontalScrollbarLayer()) { | 1052 if (requiresHorizontalScrollbarLayer()) { |
| 1056 if (!m_layerForHorizontalScrollbar) { | 1053 if (!m_layerForHorizontalScrollbar) { |
| 1057 m_layerForHorizontalScrollbar = GraphicsLayer::create(this); | 1054 m_layerForHorizontalScrollbar = GraphicsLayer::create(this); |
| 1058 } | 1055 } |
| 1059 | 1056 |
| 1060 if (m_layerForHorizontalScrollbar->parent() != controlsParent) { | 1057 if (m_layerForHorizontalScrollbar->parent() != controlsParent) { |
| 1061 controlsParent->addChild(m_layerForHorizontalScrollbar.get()); | 1058 controlsParent->addChild(m_layerForHorizontalScrollbar.get()); |
| 1062 | 1059 |
| 1063 if (ScrollingCoordinator* scrollingCoordinator = | 1060 if (ScrollingCoordinator* scrollingCoordinator = |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1112 m_layoutView.frameView()->positionScrollbarLayers(); | 1109 m_layoutView.frameView()->positionScrollbarLayers(); |
| 1113 } | 1110 } |
| 1114 | 1111 |
| 1115 void PaintLayerCompositor::ensureRootLayer() { | 1112 void PaintLayerCompositor::ensureRootLayer() { |
| 1116 RootLayerAttachment expectedAttachment = | 1113 RootLayerAttachment expectedAttachment = |
| 1117 m_layoutView.frame()->isLocalRoot() ? RootLayerAttachedViaChromeClient | 1114 m_layoutView.frame()->isLocalRoot() ? RootLayerAttachedViaChromeClient |
| 1118 : RootLayerAttachedViaEnclosingFrame; | 1115 : RootLayerAttachedViaEnclosingFrame; |
| 1119 if (expectedAttachment == m_rootLayerAttachment) | 1116 if (expectedAttachment == m_rootLayerAttachment) |
| 1120 return; | 1117 return; |
| 1121 | 1118 |
| 1119 if (isMainFrame()) |
| 1120 visualViewport().createLayerTree(); |
| 1121 |
| 1122 if (!m_rootContentLayer) { | 1122 if (!m_rootContentLayer) { |
| 1123 m_rootContentLayer = GraphicsLayer::create(this); | 1123 m_rootContentLayer = GraphicsLayer::create(this); |
| 1124 IntRect overflowRect = m_layoutView.pixelSnappedLayoutOverflowRect(); | 1124 IntRect overflowRect = m_layoutView.pixelSnappedLayoutOverflowRect(); |
| 1125 m_rootContentLayer->setSize( | 1125 m_rootContentLayer->setSize( |
| 1126 FloatSize(overflowRect.maxX(), overflowRect.maxY())); | 1126 FloatSize(overflowRect.maxX(), overflowRect.maxY())); |
| 1127 m_rootContentLayer->setPosition(FloatPoint()); | 1127 m_rootContentLayer->setPosition(FloatPoint()); |
| 1128 m_rootContentLayer->setOwnerNodeId( | 1128 m_rootContentLayer->setOwnerNodeId( |
| 1129 DOMNodeIds::idForNode(m_layoutView.node())); | 1129 DOMNodeIds::idForNode(m_layoutView.node())); |
| 1130 } | 1130 } |
| 1131 | 1131 |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1323 } | 1323 } |
| 1324 | 1324 |
| 1325 Page* PaintLayerCompositor::page() const { | 1325 Page* PaintLayerCompositor::page() const { |
| 1326 return m_layoutView.frameView()->frame().page(); | 1326 return m_layoutView.frameView()->frame().page(); |
| 1327 } | 1327 } |
| 1328 | 1328 |
| 1329 DocumentLifecycle& PaintLayerCompositor::lifecycle() const { | 1329 DocumentLifecycle& PaintLayerCompositor::lifecycle() const { |
| 1330 return m_layoutView.document().lifecycle(); | 1330 return m_layoutView.document().lifecycle(); |
| 1331 } | 1331 } |
| 1332 | 1332 |
| 1333 bool PaintLayerCompositor::isMainFrame() const { |
| 1334 return m_layoutView.frame()->isMainFrame(); |
| 1335 } |
| 1336 |
| 1337 VisualViewport& PaintLayerCompositor::visualViewport() const { |
| 1338 return m_layoutView.frameView()->page()->frameHost().visualViewport(); |
| 1339 } |
| 1340 |
| 1333 String PaintLayerCompositor::debugName( | 1341 String PaintLayerCompositor::debugName( |
| 1334 const GraphicsLayer* graphicsLayer) const { | 1342 const GraphicsLayer* graphicsLayer) const { |
| 1335 String name; | 1343 String name; |
| 1336 if (graphicsLayer == m_rootContentLayer.get()) { | 1344 if (graphicsLayer == m_rootContentLayer.get()) { |
| 1337 name = "Content Root Layer"; | 1345 name = "Content Root Layer"; |
| 1338 } else if (graphicsLayer == m_overflowControlsHostLayer.get()) { | 1346 } else if (graphicsLayer == m_overflowControlsHostLayer.get()) { |
| 1339 name = "Frame Overflow Controls Host Layer"; | 1347 name = "Frame Overflow Controls Host Layer"; |
| 1340 } else if (graphicsLayer == m_layerForHorizontalScrollbar.get()) { | 1348 } else if (graphicsLayer == m_layerForHorizontalScrollbar.get()) { |
| 1341 name = "Frame Horizontal Scrollbar Layer"; | 1349 name = "Frame Horizontal Scrollbar Layer"; |
| 1342 } else if (graphicsLayer == m_layerForVerticalScrollbar.get()) { | 1350 } else if (graphicsLayer == m_layerForVerticalScrollbar.get()) { |
| 1343 name = "Frame Vertical Scrollbar Layer"; | 1351 name = "Frame Vertical Scrollbar Layer"; |
| 1344 } else if (graphicsLayer == m_layerForScrollCorner.get()) { | 1352 } else if (graphicsLayer == m_layerForScrollCorner.get()) { |
| 1345 name = "Frame Scroll Corner Layer"; | 1353 name = "Frame Scroll Corner Layer"; |
| 1346 } else if (graphicsLayer == m_containerLayer.get()) { | 1354 } else if (graphicsLayer == m_containerLayer.get()) { |
| 1347 name = "Frame Clipping Layer"; | 1355 name = "Frame Clipping Layer"; |
| 1348 } else if (graphicsLayer == m_scrollLayer.get()) { | 1356 } else if (graphicsLayer == m_scrollLayer.get()) { |
| 1349 name = "Frame Scrolling Layer"; | 1357 name = "Frame Scrolling Layer"; |
| 1350 } else { | 1358 } else { |
| 1351 ASSERT_NOT_REACHED(); | 1359 ASSERT_NOT_REACHED(); |
| 1352 } | 1360 } |
| 1353 | 1361 |
| 1354 return name; | 1362 return name; |
| 1355 } | 1363 } |
| 1356 | 1364 |
| 1357 } // namespace blink | 1365 } // namespace blink |
| OLD | NEW |