| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009, 2010, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009, 2010, 2011 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 #include "core/page/animation/AnimationController.h" | 43 #include "core/page/animation/AnimationController.h" |
| 44 #include "core/page/scrolling/ScrollingCoordinator.h" | 44 #include "core/page/scrolling/ScrollingCoordinator.h" |
| 45 #include "core/platform/graphics/FontCache.h" | 45 #include "core/platform/graphics/FontCache.h" |
| 46 #include "core/platform/graphics/GraphicsContext.h" | 46 #include "core/platform/graphics/GraphicsContext.h" |
| 47 #include "core/platform/graphics/GraphicsLayer.h" | 47 #include "core/platform/graphics/GraphicsLayer.h" |
| 48 #include "core/plugins/PluginView.h" | 48 #include "core/plugins/PluginView.h" |
| 49 #include "core/rendering/RenderApplet.h" | 49 #include "core/rendering/RenderApplet.h" |
| 50 #include "core/rendering/RenderEmbeddedObject.h" | 50 #include "core/rendering/RenderEmbeddedObject.h" |
| 51 #include "core/rendering/RenderIFrame.h" | 51 #include "core/rendering/RenderIFrame.h" |
| 52 #include "core/rendering/RenderImage.h" | 52 #include "core/rendering/RenderImage.h" |
| 53 #include "core/rendering/RenderLayer.h" |
| 53 #include "core/rendering/RenderLayerCompositor.h" | 54 #include "core/rendering/RenderLayerCompositor.h" |
| 54 #include "core/rendering/RenderVideo.h" | 55 #include "core/rendering/RenderVideo.h" |
| 55 #include "core/rendering/RenderView.h" | 56 #include "core/rendering/RenderView.h" |
| 56 #include "core/rendering/style/KeyframeList.h" | 57 #include "core/rendering/style/KeyframeList.h" |
| 57 #include <wtf/CurrentTime.h> | 58 #include <wtf/CurrentTime.h> |
| 58 #include <wtf/text/StringBuilder.h> | 59 #include <wtf/text/StringBuilder.h> |
| 59 | 60 |
| 60 #include "core/platform/graphics/filters/custom/CustomFilterOperation.h" | 61 #include "core/platform/graphics/filters/custom/CustomFilterOperation.h" |
| 61 #include "core/rendering/FilterEffectRenderer.h" | 62 #include "core/rendering/FilterEffectRenderer.h" |
| 62 | 63 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 { | 116 { |
| 116 updateClippingLayers(false, false); | 117 updateClippingLayers(false, false); |
| 117 updateOverflowControlsLayers(false, false, false); | 118 updateOverflowControlsLayers(false, false, false); |
| 118 updateForegroundLayer(false); | 119 updateForegroundLayer(false); |
| 119 updateBackgroundLayer(false); | 120 updateBackgroundLayer(false); |
| 120 updateMaskLayer(false); | 121 updateMaskLayer(false); |
| 121 updateScrollingLayers(false); | 122 updateScrollingLayers(false); |
| 122 destroyGraphicsLayers(); | 123 destroyGraphicsLayers(); |
| 123 } | 124 } |
| 124 | 125 |
| 125 PassOwnPtr<GraphicsLayer> RenderLayerBacking::createGraphicsLayer(const String&
name) | 126 PassOwnPtr<GraphicsLayer> RenderLayerBacking::createGraphicsLayer(const String&
name, CompositingReasons reasons) |
| 126 { | 127 { |
| 127 GraphicsLayerFactory* graphicsLayerFactory = 0; | 128 GraphicsLayerFactory* graphicsLayerFactory = 0; |
| 128 if (Page* page = renderer()->frame()->page()) | 129 if (Page* page = renderer()->frame()->page()) |
| 129 graphicsLayerFactory = page->chrome()->client()->graphicsLayerFactory(); | 130 graphicsLayerFactory = page->chrome()->client()->graphicsLayerFactory(); |
| 130 | 131 |
| 131 OwnPtr<GraphicsLayer> graphicsLayer = GraphicsLayer::create(graphicsLayerFac
tory, this); | 132 OwnPtr<GraphicsLayer> graphicsLayer = GraphicsLayer::create(graphicsLayerFac
tory, this); |
| 132 | 133 |
| 133 #ifndef NDEBUG | 134 #ifndef NDEBUG |
| 134 graphicsLayer->setName(name); | 135 graphicsLayer->setName(name); |
| 135 #else | 136 #else |
| 136 UNUSED_PARAM(name); | 137 UNUSED_PARAM(name); |
| 137 #endif | 138 #endif |
| 138 | 139 |
| 140 graphicsLayer->setCompositingReasons(reasons); |
| 141 |
| 139 return graphicsLayer.release(); | 142 return graphicsLayer.release(); |
| 140 } | 143 } |
| 141 | 144 |
| 142 void RenderLayerBacking::updateDebugIndicators(bool showBorder, bool showRepaint
Counter) | 145 void RenderLayerBacking::updateDebugIndicators(bool showBorder, bool showRepaint
Counter) |
| 143 { | 146 { |
| 144 m_graphicsLayer->setShowDebugBorder(showBorder); | 147 m_graphicsLayer->setShowDebugBorder(showBorder); |
| 145 m_graphicsLayer->setShowRepaintCounter(showRepaintCounter); | 148 m_graphicsLayer->setShowRepaintCounter(showRepaintCounter); |
| 146 | 149 |
| 147 if (m_ancestorClippingLayer) | 150 if (m_ancestorClippingLayer) |
| 148 m_ancestorClippingLayer->setShowDebugBorder(showBorder); | 151 m_ancestorClippingLayer->setShowDebugBorder(showBorder); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 } | 186 } |
| 184 } | 187 } |
| 185 | 188 |
| 186 void RenderLayerBacking::createPrimaryGraphicsLayer() | 189 void RenderLayerBacking::createPrimaryGraphicsLayer() |
| 187 { | 190 { |
| 188 String layerName; | 191 String layerName; |
| 189 #ifndef NDEBUG | 192 #ifndef NDEBUG |
| 190 layerName = m_owningLayer->debugName(); | 193 layerName = m_owningLayer->debugName(); |
| 191 #endif | 194 #endif |
| 192 | 195 |
| 193 m_graphicsLayer = createGraphicsLayer(layerName); | 196 m_graphicsLayer = createGraphicsLayer(layerName, m_owningLayer->compositingR
easons()); |
| 194 | 197 |
| 195 if (m_isMainFrameRenderViewLayer) | 198 if (m_isMainFrameRenderViewLayer) |
| 196 m_graphicsLayer->setContentsOpaque(true); | 199 m_graphicsLayer->setContentsOpaque(true); |
| 197 | 200 |
| 198 updateOpacity(renderer()->style()); | 201 updateOpacity(renderer()->style()); |
| 199 updateTransform(renderer()->style()); | 202 updateTransform(renderer()->style()); |
| 200 updateFilters(renderer()->style()); | 203 updateFilters(renderer()->style()); |
| 201 | 204 |
| 202 if (RuntimeEnabledFeatures::cssCompositingEnabled()) | 205 if (RuntimeEnabledFeatures::cssCompositingEnabled()) |
| 203 updateLayerBlendMode(renderer()->style()); | 206 updateLayerBlendMode(renderer()->style()); |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 void RenderLayerBacking::updateAfterWidgetResize() | 342 void RenderLayerBacking::updateAfterWidgetResize() |
| 340 { | 343 { |
| 341 if (renderer()->isRenderPart()) { | 344 if (renderer()->isRenderPart()) { |
| 342 if (RenderLayerCompositor* innerCompositor = RenderLayerCompositor::fram
eContentsCompositor(toRenderPart(renderer()))) { | 345 if (RenderLayerCompositor* innerCompositor = RenderLayerCompositor::fram
eContentsCompositor(toRenderPart(renderer()))) { |
| 343 innerCompositor->frameViewDidChangeSize(); | 346 innerCompositor->frameViewDidChangeSize(); |
| 344 innerCompositor->frameViewDidChangeLocation(contentsBox().location()
); | 347 innerCompositor->frameViewDidChangeLocation(contentsBox().location()
); |
| 345 } | 348 } |
| 346 } | 349 } |
| 347 } | 350 } |
| 348 | 351 |
| 352 void RenderLayerBacking::updateCompositingReasons() |
| 353 { |
| 354 // All other layers owned by this backing will have the same compositing rea
son |
| 355 // for their lifetime, so they are initialized only when created. |
| 356 m_graphicsLayer->setCompositingReasons(m_owningLayer->compositingReasons()); |
| 357 } |
| 358 |
| 349 void RenderLayerBacking::updateAfterLayout(UpdateAfterLayoutFlags flags) | 359 void RenderLayerBacking::updateAfterLayout(UpdateAfterLayoutFlags flags) |
| 350 { | 360 { |
| 351 RenderLayerCompositor* layerCompositor = compositor(); | 361 RenderLayerCompositor* layerCompositor = compositor(); |
| 352 if (!layerCompositor->compositingLayersNeedRebuild()) { | 362 if (!layerCompositor->compositingLayersNeedRebuild()) { |
| 353 // Calling updateGraphicsLayerGeometry() here gives incorrect results, b
ecause the | 363 // Calling updateGraphicsLayerGeometry() here gives incorrect results, b
ecause the |
| 354 // position of this layer's GraphicsLayer depends on the position of our
compositing | 364 // position of this layer's GraphicsLayer depends on the position of our
compositing |
| 355 // ancestor's GraphicsLayer. That cannot be determined until all the des
cendant | 365 // ancestor's GraphicsLayer. That cannot be determined until all the des
cendant |
| 356 // RenderLayers of that ancestor have been processed via updateLayerPosi
tions(). | 366 // RenderLayers of that ancestor have been processed via updateLayerPosi
tions(). |
| 357 // | 367 // |
| 358 // The solution is to update compositing children of this layer here, | 368 // The solution is to update compositing children of this layer here, |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 711 } | 721 } |
| 712 | 722 |
| 713 // If this layer was created just for clipping or to apply perspective, it d
oesn't need its own backing store. | 723 // If this layer was created just for clipping or to apply perspective, it d
oesn't need its own backing store. |
| 714 setRequiresOwnBackingStore(compositor()->requiresOwnBackingStore(m_owningLay
er, compAncestor)); | 724 setRequiresOwnBackingStore(compositor()->requiresOwnBackingStore(m_owningLay
er, compAncestor)); |
| 715 | 725 |
| 716 updateContentsRect(isSimpleContainer); | 726 updateContentsRect(isSimpleContainer); |
| 717 updateBackgroundColor(isSimpleContainer); | 727 updateBackgroundColor(isSimpleContainer); |
| 718 updateDrawsContent(isSimpleContainer); | 728 updateDrawsContent(isSimpleContainer); |
| 719 updateAfterWidgetResize(); | 729 updateAfterWidgetResize(); |
| 720 registerScrollingLayers(); | 730 registerScrollingLayers(); |
| 731 |
| 732 updateCompositingReasons(); |
| 721 } | 733 } |
| 722 | 734 |
| 723 void RenderLayerBacking::registerScrollingLayers() | 735 void RenderLayerBacking::registerScrollingLayers() |
| 724 { | 736 { |
| 725 // Register fixed position layers and their containers with the scrolling co
ordinator. | 737 // Register fixed position layers and their containers with the scrolling co
ordinator. |
| 726 ScrollingCoordinator* scrollingCoordinator = scrollingCoordinatorFromLayer(m
_owningLayer); | 738 ScrollingCoordinator* scrollingCoordinator = scrollingCoordinatorFromLayer(m
_owningLayer); |
| 727 if (!scrollingCoordinator) | 739 if (!scrollingCoordinator) |
| 728 return; | 740 return; |
| 729 | 741 |
| 730 compositor()->updateViewportConstraintStatus(m_owningLayer); | 742 compositor()->updateViewportConstraintStatus(m_owningLayer); |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 830 m_backgroundLayer->setDrawsContent(hasPaintedContent); | 842 m_backgroundLayer->setDrawsContent(hasPaintedContent); |
| 831 } | 843 } |
| 832 | 844 |
| 833 // Return true if the layers changed. | 845 // Return true if the layers changed. |
| 834 bool RenderLayerBacking::updateClippingLayers(bool needsAncestorClip, bool needs
DescendantClip) | 846 bool RenderLayerBacking::updateClippingLayers(bool needsAncestorClip, bool needs
DescendantClip) |
| 835 { | 847 { |
| 836 bool layersChanged = false; | 848 bool layersChanged = false; |
| 837 | 849 |
| 838 if (needsAncestorClip) { | 850 if (needsAncestorClip) { |
| 839 if (!m_ancestorClippingLayer) { | 851 if (!m_ancestorClippingLayer) { |
| 840 m_ancestorClippingLayer = createGraphicsLayer("Ancestor clipping Lay
er"); | 852 m_ancestorClippingLayer = createGraphicsLayer("Ancestor clipping Lay
er", CompositingReasonLayerForClip); |
| 841 m_ancestorClippingLayer->setMasksToBounds(true); | 853 m_ancestorClippingLayer->setMasksToBounds(true); |
| 842 layersChanged = true; | 854 layersChanged = true; |
| 843 } | 855 } |
| 844 } else if (m_ancestorClippingLayer) { | 856 } else if (m_ancestorClippingLayer) { |
| 845 m_ancestorClippingLayer->removeFromParent(); | 857 m_ancestorClippingLayer->removeFromParent(); |
| 846 m_ancestorClippingLayer = nullptr; | 858 m_ancestorClippingLayer = nullptr; |
| 847 layersChanged = true; | 859 layersChanged = true; |
| 848 } | 860 } |
| 849 | 861 |
| 850 if (needsDescendantClip) { | 862 if (needsDescendantClip) { |
| 851 if (!m_childContainmentLayer) { | 863 if (!m_childContainmentLayer) { |
| 852 m_childContainmentLayer = createGraphicsLayer("Child clipping Layer"
); | 864 m_childContainmentLayer = createGraphicsLayer("Child clipping Layer"
, CompositingReasonLayerForClip); |
| 853 m_childContainmentLayer->setMasksToBounds(true); | 865 m_childContainmentLayer->setMasksToBounds(true); |
| 854 layersChanged = true; | 866 layersChanged = true; |
| 855 } | 867 } |
| 856 } else if (hasClippingLayer()) { | 868 } else if (hasClippingLayer()) { |
| 857 m_childContainmentLayer->removeFromParent(); | 869 m_childContainmentLayer->removeFromParent(); |
| 858 m_childContainmentLayer = nullptr; | 870 m_childContainmentLayer = nullptr; |
| 859 layersChanged = true; | 871 layersChanged = true; |
| 860 } | 872 } |
| 861 | 873 |
| 862 return layersChanged; | 874 return layersChanged; |
| 863 } | 875 } |
| 864 | 876 |
| 865 void RenderLayerBacking::setBackgroundLayerPaintsFixedRootBackground(bool backgr
oundLayerPaintsFixedRootBackground) | 877 void RenderLayerBacking::setBackgroundLayerPaintsFixedRootBackground(bool backgr
oundLayerPaintsFixedRootBackground) |
| 866 { | 878 { |
| 867 m_backgroundLayerPaintsFixedRootBackground = backgroundLayerPaintsFixedRootB
ackground; | 879 m_backgroundLayerPaintsFixedRootBackground = backgroundLayerPaintsFixedRootB
ackground; |
| 868 } | 880 } |
| 869 | 881 |
| 870 bool RenderLayerBacking::updateOverflowControlsLayers(bool needsHorizontalScroll
barLayer, bool needsVerticalScrollbarLayer, bool needsScrollCornerLayer) | 882 bool RenderLayerBacking::updateOverflowControlsLayers(bool needsHorizontalScroll
barLayer, bool needsVerticalScrollbarLayer, bool needsScrollCornerLayer) |
| 871 { | 883 { |
| 872 bool horizontalScrollbarLayerChanged = false; | 884 bool horizontalScrollbarLayerChanged = false; |
| 873 if (needsHorizontalScrollbarLayer) { | 885 if (needsHorizontalScrollbarLayer) { |
| 874 if (!m_layerForHorizontalScrollbar) { | 886 if (!m_layerForHorizontalScrollbar) { |
| 875 m_layerForHorizontalScrollbar = createGraphicsLayer("horizontal scro
llbar"); | 887 m_layerForHorizontalScrollbar = createGraphicsLayer("horizontal scro
llbar", CompositingReasonLayerForScrollbar); |
| 876 horizontalScrollbarLayerChanged = true; | 888 horizontalScrollbarLayerChanged = true; |
| 877 } | 889 } |
| 878 } else if (m_layerForHorizontalScrollbar) { | 890 } else if (m_layerForHorizontalScrollbar) { |
| 879 m_layerForHorizontalScrollbar = nullptr; | 891 m_layerForHorizontalScrollbar = nullptr; |
| 880 horizontalScrollbarLayerChanged = true; | 892 horizontalScrollbarLayerChanged = true; |
| 881 } | 893 } |
| 882 | 894 |
| 883 bool verticalScrollbarLayerChanged = false; | 895 bool verticalScrollbarLayerChanged = false; |
| 884 if (needsVerticalScrollbarLayer) { | 896 if (needsVerticalScrollbarLayer) { |
| 885 if (!m_layerForVerticalScrollbar) { | 897 if (!m_layerForVerticalScrollbar) { |
| 886 m_layerForVerticalScrollbar = createGraphicsLayer("vertical scrollba
r"); | 898 m_layerForVerticalScrollbar = createGraphicsLayer("vertical scrollba
r", CompositingReasonLayerForScrollbar); |
| 887 verticalScrollbarLayerChanged = true; | 899 verticalScrollbarLayerChanged = true; |
| 888 } | 900 } |
| 889 } else if (m_layerForVerticalScrollbar) { | 901 } else if (m_layerForVerticalScrollbar) { |
| 890 m_layerForVerticalScrollbar = nullptr; | 902 m_layerForVerticalScrollbar = nullptr; |
| 891 verticalScrollbarLayerChanged = true; | 903 verticalScrollbarLayerChanged = true; |
| 892 } | 904 } |
| 893 | 905 |
| 894 bool scrollCornerLayerChanged = false; | 906 bool scrollCornerLayerChanged = false; |
| 895 if (needsScrollCornerLayer) { | 907 if (needsScrollCornerLayer) { |
| 896 if (!m_layerForScrollCorner) { | 908 if (!m_layerForScrollCorner) { |
| 897 m_layerForScrollCorner = createGraphicsLayer("scroll corner"); | 909 m_layerForScrollCorner = createGraphicsLayer("scroll corner", Compos
itingReasonLayerForScrollbar); |
| 898 scrollCornerLayerChanged = true; | 910 scrollCornerLayerChanged = true; |
| 899 } | 911 } |
| 900 } else if (m_layerForScrollCorner) { | 912 } else if (m_layerForScrollCorner) { |
| 901 m_layerForScrollCorner = nullptr; | 913 m_layerForScrollCorner = nullptr; |
| 902 scrollCornerLayerChanged = true; | 914 scrollCornerLayerChanged = true; |
| 903 } | 915 } |
| 904 | 916 |
| 905 if (ScrollingCoordinator* scrollingCoordinator = scrollingCoordinatorFromLay
er(m_owningLayer)) { | 917 if (ScrollingCoordinator* scrollingCoordinator = scrollingCoordinatorFromLay
er(m_owningLayer)) { |
| 906 if (horizontalScrollbarLayerChanged) | 918 if (horizontalScrollbarLayerChanged) |
| 907 scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_owning
Layer, HorizontalScrollbar); | 919 scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_owning
Layer, HorizontalScrollbar); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 964 | 976 |
| 965 bool RenderLayerBacking::updateForegroundLayer(bool needsForegroundLayer) | 977 bool RenderLayerBacking::updateForegroundLayer(bool needsForegroundLayer) |
| 966 { | 978 { |
| 967 bool layerChanged = false; | 979 bool layerChanged = false; |
| 968 if (needsForegroundLayer) { | 980 if (needsForegroundLayer) { |
| 969 if (!m_foregroundLayer) { | 981 if (!m_foregroundLayer) { |
| 970 String layerName; | 982 String layerName; |
| 971 #ifndef NDEBUG | 983 #ifndef NDEBUG |
| 972 layerName = m_owningLayer->debugName() + " (foreground)"; | 984 layerName = m_owningLayer->debugName() + " (foreground)"; |
| 973 #endif | 985 #endif |
| 974 m_foregroundLayer = createGraphicsLayer(layerName); | 986 m_foregroundLayer = createGraphicsLayer(layerName, CompositingReason
LayerForForeground); |
| 975 m_foregroundLayer->setDrawsContent(true); | 987 m_foregroundLayer->setDrawsContent(true); |
| 976 m_foregroundLayer->setPaintingPhase(GraphicsLayerPaintForeground); | 988 m_foregroundLayer->setPaintingPhase(GraphicsLayerPaintForeground); |
| 977 layerChanged = true; | 989 layerChanged = true; |
| 978 } | 990 } |
| 979 } else if (m_foregroundLayer) { | 991 } else if (m_foregroundLayer) { |
| 980 m_foregroundLayer->removeFromParent(); | 992 m_foregroundLayer->removeFromParent(); |
| 981 m_foregroundLayer = nullptr; | 993 m_foregroundLayer = nullptr; |
| 982 layerChanged = true; | 994 layerChanged = true; |
| 983 } | 995 } |
| 984 | 996 |
| 985 if (layerChanged) | 997 if (layerChanged) |
| 986 m_graphicsLayer->setPaintingPhase(paintingPhaseForPrimaryLayer()); | 998 m_graphicsLayer->setPaintingPhase(paintingPhaseForPrimaryLayer()); |
| 987 | 999 |
| 988 return layerChanged; | 1000 return layerChanged; |
| 989 } | 1001 } |
| 990 | 1002 |
| 991 bool RenderLayerBacking::updateBackgroundLayer(bool needsBackgroundLayer) | 1003 bool RenderLayerBacking::updateBackgroundLayer(bool needsBackgroundLayer) |
| 992 { | 1004 { |
| 993 bool layerChanged = false; | 1005 bool layerChanged = false; |
| 994 if (needsBackgroundLayer) { | 1006 if (needsBackgroundLayer) { |
| 995 if (!m_backgroundLayer) { | 1007 if (!m_backgroundLayer) { |
| 996 String layerName; | 1008 String layerName; |
| 997 #ifndef NDEBUG | 1009 #ifndef NDEBUG |
| 998 layerName = m_owningLayer->debugName() + " (background)"; | 1010 layerName = m_owningLayer->debugName() + " (background)"; |
| 999 #endif | 1011 #endif |
| 1000 m_backgroundLayer = createGraphicsLayer(layerName); | 1012 m_backgroundLayer = createGraphicsLayer(layerName, CompositingReason
LayerForBackground); |
| 1001 m_backgroundLayer->setDrawsContent(true); | 1013 m_backgroundLayer->setDrawsContent(true); |
| 1002 m_backgroundLayer->setAnchorPoint(FloatPoint3D()); | 1014 m_backgroundLayer->setAnchorPoint(FloatPoint3D()); |
| 1003 m_backgroundLayer->setPaintingPhase(GraphicsLayerPaintBackground); | 1015 m_backgroundLayer->setPaintingPhase(GraphicsLayerPaintBackground); |
| 1004 layerChanged = true; | 1016 layerChanged = true; |
| 1005 } | 1017 } |
| 1006 | 1018 |
| 1007 if (!m_contentsContainmentLayer) { | 1019 if (!m_contentsContainmentLayer) { |
| 1008 String layerName; | 1020 String layerName; |
| 1009 #ifndef NDEBUG | 1021 #ifndef NDEBUG |
| 1010 layerName = m_owningLayer->debugName() + " (contents containment)"; | 1022 layerName = m_owningLayer->debugName() + " (contents containment)"; |
| 1011 #endif | 1023 #endif |
| 1012 m_contentsContainmentLayer = createGraphicsLayer(layerName); | 1024 m_contentsContainmentLayer = createGraphicsLayer(layerName, Composit
ingReasonLayerForBackground); |
| 1013 layerChanged = true; | 1025 layerChanged = true; |
| 1014 } | 1026 } |
| 1015 } else { | 1027 } else { |
| 1016 if (m_backgroundLayer) { | 1028 if (m_backgroundLayer) { |
| 1017 m_backgroundLayer->removeFromParent(); | 1029 m_backgroundLayer->removeFromParent(); |
| 1018 m_backgroundLayer = nullptr; | 1030 m_backgroundLayer = nullptr; |
| 1019 layerChanged = true; | 1031 layerChanged = true; |
| 1020 } | 1032 } |
| 1021 if (m_contentsContainmentLayer) { | 1033 if (m_contentsContainmentLayer) { |
| 1022 m_contentsContainmentLayer->removeFromParent(); | 1034 m_contentsContainmentLayer->removeFromParent(); |
| 1023 m_contentsContainmentLayer = nullptr; | 1035 m_contentsContainmentLayer = nullptr; |
| 1024 layerChanged = true; | 1036 layerChanged = true; |
| 1025 } | 1037 } |
| 1026 } | 1038 } |
| 1027 | 1039 |
| 1028 return layerChanged; | 1040 return layerChanged; |
| 1029 } | 1041 } |
| 1030 | 1042 |
| 1031 bool RenderLayerBacking::updateMaskLayer(bool needsMaskLayer) | 1043 bool RenderLayerBacking::updateMaskLayer(bool needsMaskLayer) |
| 1032 { | 1044 { |
| 1033 bool layerChanged = false; | 1045 bool layerChanged = false; |
| 1034 if (needsMaskLayer) { | 1046 if (needsMaskLayer) { |
| 1035 if (!m_maskLayer) { | 1047 if (!m_maskLayer) { |
| 1036 m_maskLayer = createGraphicsLayer("Mask"); | 1048 m_maskLayer = createGraphicsLayer("Mask", CompositingReasonLayerForM
ask); |
| 1037 m_maskLayer->setDrawsContent(true); | 1049 m_maskLayer->setDrawsContent(true); |
| 1038 m_maskLayer->setPaintingPhase(GraphicsLayerPaintMask); | 1050 m_maskLayer->setPaintingPhase(GraphicsLayerPaintMask); |
| 1039 layerChanged = true; | 1051 layerChanged = true; |
| 1040 } | 1052 } |
| 1041 } else if (m_maskLayer) { | 1053 } else if (m_maskLayer) { |
| 1042 m_maskLayer = nullptr; | 1054 m_maskLayer = nullptr; |
| 1043 layerChanged = true; | 1055 layerChanged = true; |
| 1044 } | 1056 } |
| 1045 | 1057 |
| 1046 if (layerChanged) | 1058 if (layerChanged) |
| 1047 m_graphicsLayer->setPaintingPhase(paintingPhaseForPrimaryLayer()); | 1059 m_graphicsLayer->setPaintingPhase(paintingPhaseForPrimaryLayer()); |
| 1048 | 1060 |
| 1049 return layerChanged; | 1061 return layerChanged; |
| 1050 } | 1062 } |
| 1051 | 1063 |
| 1052 bool RenderLayerBacking::updateScrollingLayers(bool needsScrollingLayers) | 1064 bool RenderLayerBacking::updateScrollingLayers(bool needsScrollingLayers) |
| 1053 { | 1065 { |
| 1054 ScrollingCoordinator* scrollingCoordinator = scrollingCoordinatorFromLayer(m
_owningLayer); | 1066 ScrollingCoordinator* scrollingCoordinator = scrollingCoordinatorFromLayer(m
_owningLayer); |
| 1055 | 1067 |
| 1056 bool layerChanged = false; | 1068 bool layerChanged = false; |
| 1057 if (needsScrollingLayers) { | 1069 if (needsScrollingLayers) { |
| 1058 if (!m_scrollingLayer) { | 1070 if (!m_scrollingLayer) { |
| 1059 // Outer layer which corresponds with the scroll view. | 1071 // Outer layer which corresponds with the scroll view. |
| 1060 m_scrollingLayer = createGraphicsLayer("Scrolling container"); | 1072 m_scrollingLayer = createGraphicsLayer("Scrolling container", Compos
itingReasonLayerForClip); |
| 1061 m_scrollingLayer->setDrawsContent(false); | 1073 m_scrollingLayer->setDrawsContent(false); |
| 1062 m_scrollingLayer->setMasksToBounds(true); | 1074 m_scrollingLayer->setMasksToBounds(true); |
| 1063 | 1075 |
| 1064 // Inner layer which renders the content that scrolls. | 1076 // Inner layer which renders the content that scrolls. |
| 1065 m_scrollingContentsLayer = createGraphicsLayer("Scrolled Contents"); | 1077 m_scrollingContentsLayer = createGraphicsLayer("Scrolled Contents",
CompositingReasonLayerForScrollingContainer); |
| 1066 m_scrollingContentsLayer->setDrawsContent(true); | 1078 m_scrollingContentsLayer->setDrawsContent(true); |
| 1067 GraphicsLayerPaintingPhase paintPhase = GraphicsLayerPaintOverflowCo
ntents | GraphicsLayerPaintCompositedScroll; | 1079 GraphicsLayerPaintingPhase paintPhase = GraphicsLayerPaintOverflowCo
ntents | GraphicsLayerPaintCompositedScroll; |
| 1068 if (!m_foregroundLayer) | 1080 if (!m_foregroundLayer) |
| 1069 paintPhase |= GraphicsLayerPaintForeground; | 1081 paintPhase |= GraphicsLayerPaintForeground; |
| 1070 m_scrollingContentsLayer->setPaintingPhase(paintPhase); | 1082 m_scrollingContentsLayer->setPaintingPhase(paintPhase); |
| 1071 m_scrollingLayer->addChild(m_scrollingContentsLayer.get()); | 1083 m_scrollingLayer->addChild(m_scrollingContentsLayer.get()); |
| 1072 | 1084 |
| 1073 layerChanged = true; | 1085 layerChanged = true; |
| 1074 if (scrollingCoordinator) | 1086 if (scrollingCoordinator) |
| 1075 scrollingCoordinator->scrollableAreaScrollLayerDidChange(m_ownin
gLayer); | 1087 scrollingCoordinator->scrollableAreaScrollLayerDidChange(m_ownin
gLayer); |
| (...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1955 info.addMember(m_childContainmentLayer, "childContainmentLayer"); | 1967 info.addMember(m_childContainmentLayer, "childContainmentLayer"); |
| 1956 info.addMember(m_maskLayer, "maskLayer"); | 1968 info.addMember(m_maskLayer, "maskLayer"); |
| 1957 info.addMember(m_layerForHorizontalScrollbar, "layerForHorizontalScrollbar")
; | 1969 info.addMember(m_layerForHorizontalScrollbar, "layerForHorizontalScrollbar")
; |
| 1958 info.addMember(m_layerForVerticalScrollbar, "layerForVerticalScrollbar"); | 1970 info.addMember(m_layerForVerticalScrollbar, "layerForVerticalScrollbar"); |
| 1959 info.addMember(m_layerForScrollCorner, "layerForScrollCorner"); | 1971 info.addMember(m_layerForScrollCorner, "layerForScrollCorner"); |
| 1960 info.addMember(m_scrollingLayer, "scrollingLayer"); | 1972 info.addMember(m_scrollingLayer, "scrollingLayer"); |
| 1961 info.addMember(m_scrollingContentsLayer, "scrollingContentsLayer"); | 1973 info.addMember(m_scrollingContentsLayer, "scrollingContentsLayer"); |
| 1962 } | 1974 } |
| 1963 | 1975 |
| 1964 } // namespace WebCore | 1976 } // namespace WebCore |
| OLD | NEW |