Changeset 245977 in webkit
- Timestamp:
- May 31, 2019, 12:07:30 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 6 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/compositing/overflow/stacking-context-composited-scroller-with-foreground-paint-phases-expected.txt (added)
-
LayoutTests/compositing/overflow/stacking-context-composited-scroller-with-foreground-paint-phases.html (added)
-
LayoutTests/platform/ios-wk2/compositing/overflow/stacking-context-composited-scroller-with-foreground-paint-phases-expected.txt (added)
-
LayoutTests/platform/mac-wk1/compositing/overflow/stacking-context-composited-scroller-with-foreground-paint-phases-expected.txt (added)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/platform/graphics/GraphicsLayer.cpp (modified) (1 diff)
-
Source/WebCore/platform/graphics/GraphicsLayer.h (modified) (1 diff)
-
Source/WebCore/rendering/RenderLayerBacking.cpp (modified) (12 diffs)
-
Source/WebCore/rendering/RenderLayerBacking.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r245974 r245977 1 2019-05-31 Simon Fraser <simon.fraser@apple.com> 2 3 Move code that sets compositing paint phases into a single function 4 https://bugs.webkit.org/show_bug.cgi?id=198420 5 6 Reviewed by Zalan Bujtas. 7 8 * compositing/overflow/stacking-context-composited-scroller-with-foreground-paint-phases-expected.txt: Added. 9 * compositing/overflow/stacking-context-composited-scroller-with-foreground-paint-phases.html: Added. 10 * platform/ios-wk2/compositing/overflow/stacking-context-composited-scroller-with-foreground-paint-phases-expected.txt: Added. 11 * platform/mac-wk1/compositing/overflow/stacking-context-composited-scroller-with-foreground-paint-phases-expected.txt: Added. 12 1 13 2019-05-31 Saam Barati <sbarati@apple.com> 2 14 -
trunk/Source/WebCore/ChangeLog
r245974 r245977 1 2019-05-31 Simon Fraser <simon.fraser@apple.com> 2 3 Move code that sets compositing paint phases into a single function 4 https://bugs.webkit.org/show_bug.cgi?id=198420 5 6 Reviewed by Zalan Bujtas. 7 8 To compute the correct paint phases for the various GraphicsLayers in a RenderLayerBacking, 9 we have to know which set of layers we've created (m_scrollContainerLayer, m_foregroundLayer etc). 10 So move the code that sets phases into a single function which is called when that 11 set of layers changes. 12 13 The test dumps paint phases for a stacking-context-composited scroller with a negative z-index child. 14 15 Also have GraphicsLayer::setPaintingPhase() trigger the necessary repaint when the paint phase changes. 16 17 Test: compositing/overflow/stacking-context-composited-scroller-with-foreground-paint-phases.html 18 19 * platform/graphics/GraphicsLayer.cpp: 20 (WebCore::GraphicsLayer::setPaintingPhase): 21 * platform/graphics/GraphicsLayer.h: 22 (WebCore::GraphicsLayer::setPaintingPhase): Deleted. 23 * rendering/RenderLayerBacking.cpp: 24 (WebCore::RenderLayerBacking::updateConfiguration): 25 (WebCore::RenderLayerBacking::updateForegroundLayer): 26 (WebCore::RenderLayerBacking::updateBackgroundLayer): 27 (WebCore::RenderLayerBacking::updateMaskingLayer): 28 (WebCore::RenderLayerBacking::updateScrollingLayers): 29 (WebCore::RenderLayerBacking::updatePaintingPhases): 30 (WebCore::RenderLayerBacking::paintingPhaseForPrimaryLayer const): Deleted. 31 * rendering/RenderLayerBacking.h: 32 1 33 2019-05-31 Saam Barati <sbarati@apple.com> 2 34 -
trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp
r245974 r245977 490 490 { 491 491 m_backgroundColor = color; 492 } 493 494 void GraphicsLayer::setPaintingPhase(OptionSet<GraphicsLayerPaintingPhase> phase) 495 { 496 if (phase == m_paintingPhase) 497 return; 498 499 setNeedsDisplay(); 500 m_paintingPhase = phase; 492 501 } 493 502 -
trunk/Source/WebCore/platform/graphics/GraphicsLayer.h
r245974 r245977 416 416 // Some GraphicsLayers paint only the foreground or the background content 417 417 OptionSet<GraphicsLayerPaintingPhase> paintingPhase() const { return m_paintingPhase; } 418 void setPaintingPhase(OptionSet<GraphicsLayerPaintingPhase> phase) { m_paintingPhase = phase; }418 void setPaintingPhase(OptionSet<GraphicsLayerPaintingPhase>); 419 419 420 420 enum ShouldClipToLayer { -
trunk/Source/WebCore/rendering/RenderLayerBacking.cpp
r245950 r245977 820 820 } 821 821 822 updateMaskingLayer(renderer().hasMask(), renderer().hasClipPath()); 822 if (updateMaskingLayer(renderer().hasMask(), renderer().hasClipPath())) 823 layerConfigChanged = true; 823 824 824 825 updateChildClippingStrategy(needsDescendantsClippingLayer); … … 888 889 } 889 890 } 891 892 if (layerConfigChanged) 893 updatePaintingPhases(); 890 894 891 895 return layerConfigChanged; … … 1710 1714 m_foregroundLayer = createGraphicsLayer(layerName); 1711 1715 m_foregroundLayer->setDrawsContent(true); 1712 m_foregroundLayer->setPaintingPhase({ GraphicsLayerPaintingPhase::Foreground });1713 1716 layerChanged = true; 1714 1717 } … … 1717 1720 GraphicsLayer::unparentAndClear(m_foregroundLayer); 1718 1721 layerChanged = true; 1719 }1720 1721 if (layerChanged) {1722 m_graphicsLayer->setNeedsDisplay();1723 m_graphicsLayer->setPaintingPhase(paintingPhaseForPrimaryLayer());1724 1722 } 1725 1723 … … 1736 1734 m_backgroundLayer->setDrawsContent(true); 1737 1735 m_backgroundLayer->setAnchorPoint(FloatPoint3D()); 1738 m_backgroundLayer->setPaintingPhase({ GraphicsLayerPaintingPhase::Background });1739 1736 layerChanged = true; 1740 1737 } … … 1760 1757 } 1761 1758 } 1762 1763 if (layerChanged) 1764 m_graphicsLayer->setNeedsDisplay(); 1765 1759 1766 1760 return layerChanged; 1767 1761 } 1768 1762 1769 1763 // Masking layer is used for masks or clip-path. 1770 voidRenderLayerBacking::updateMaskingLayer(bool hasMask, bool hasClipPath)1764 bool RenderLayerBacking::updateMaskingLayer(bool hasMask, bool hasClipPath) 1771 1765 { 1772 1766 bool layerChanged = false; … … 1806 1800 } 1807 1801 1808 if (layerChanged) 1809 m_graphicsLayer->setPaintingPhase(paintingPhaseForPrimaryLayer()); 1802 return layerChanged; 1810 1803 } 1811 1804 … … 1847 1840 1848 1841 if (!m_scrollContainerLayer) { 1849 // Outer layer which corresponds with the scroll view. 1842 // Outer layer which corresponds with the scroll view. This never paints content. 1850 1843 m_scrollContainerLayer = createGraphicsLayer("scroll container", GraphicsLayer::Type::ScrollContainer); 1844 m_scrollContainerLayer->setPaintingPhase({ }); 1851 1845 m_scrollContainerLayer->setDrawsContent(false); 1852 1846 m_scrollContainerLayer->setMasksToBounds(true); … … 1856 1850 m_scrolledContentsLayer->setDrawsContent(true); 1857 1851 m_scrolledContentsLayer->setAnchorPoint({ }); 1858 1859 OptionSet<GraphicsLayerPaintingPhase> paintPhases = { GraphicsLayerPaintingPhase::OverflowContents, GraphicsLayerPaintingPhase::CompositedScroll };1860 if (!m_foregroundLayer)1861 paintPhases.add(GraphicsLayerPaintingPhase::Foreground);1862 m_scrolledContentsLayer->setPaintingPhase(paintPhases);1863 1852 m_scrollContainerLayer->addChild(*m_scrolledContentsLayer); 1864 1853 } else { … … 1872 1861 } 1873 1862 1874 m_graphicsLayer->setPaintingPhase(paintingPhaseForPrimaryLayer());1875 m_graphicsLayer->setNeedsDisplay(); // Because painting phases changed.1876 1877 1863 if (m_scrollContainerLayer) 1878 1864 compositor().didAddScrollingLayer(m_owningLayer); … … 1938 1924 { 1939 1925 m_graphicsLayer->setIsViewportConstrained(viewportCoordinated); 1940 }1941 1942 OptionSet<GraphicsLayerPaintingPhase> RenderLayerBacking::paintingPhaseForPrimaryLayer() const1943 {1944 OptionSet<GraphicsLayerPaintingPhase> phases;1945 if (!m_backgroundLayer)1946 phases.add(GraphicsLayerPaintingPhase::Background);1947 if (!m_foregroundLayer)1948 phases.add(GraphicsLayerPaintingPhase::Foreground);1949 1950 if (m_scrolledContentsLayer) {1951 phases.remove(GraphicsLayerPaintingPhase::Foreground);1952 phases.add(GraphicsLayerPaintingPhase::CompositedScroll);1953 }1954 1955 return phases;1956 1926 } 1957 1927 … … 2122 2092 m_graphicsLayer->setContentsOpaque(!viewIsTransparent); 2123 2093 } 2094 } 2095 2096 void RenderLayerBacking::updatePaintingPhases() 2097 { 2098 // Phases for m_childClippingMaskLayer and m_maskLayer are set elsewhere. 2099 OptionSet<GraphicsLayerPaintingPhase> primaryLayerPhases = { GraphicsLayerPaintingPhase::Background, GraphicsLayerPaintingPhase::Foreground }; 2100 2101 if (m_foregroundLayer) { 2102 OptionSet<GraphicsLayerPaintingPhase> foregroundLayerPhases { GraphicsLayerPaintingPhase::Foreground }; 2103 m_foregroundLayer->setPaintingPhase(foregroundLayerPhases); 2104 primaryLayerPhases.remove(GraphicsLayerPaintingPhase::Foreground); 2105 } 2106 2107 if (m_backgroundLayer) { 2108 m_backgroundLayer->setPaintingPhase(GraphicsLayerPaintingPhase::Background); 2109 primaryLayerPhases.remove(GraphicsLayerPaintingPhase::Background); 2110 } 2111 2112 if (m_scrolledContentsLayer) { 2113 OptionSet<GraphicsLayerPaintingPhase> scrolledContentLayerPhases = { GraphicsLayerPaintingPhase::OverflowContents, GraphicsLayerPaintingPhase::CompositedScroll }; 2114 if (!m_foregroundLayer) 2115 scrolledContentLayerPhases.add(GraphicsLayerPaintingPhase::Foreground); 2116 m_scrolledContentsLayer->setPaintingPhase(scrolledContentLayerPhases); 2117 2118 primaryLayerPhases.remove(GraphicsLayerPaintingPhase::Foreground); 2119 primaryLayerPhases.add(GraphicsLayerPaintingPhase::CompositedScroll); 2120 } 2121 2122 m_graphicsLayer->setPaintingPhase(primaryLayerPhases); 2124 2123 } 2125 2124 -
trunk/Source/WebCore/rendering/RenderLayerBacking.h
r245950 r245977 317 317 bool updateForegroundLayer(bool needsForegroundLayer); 318 318 bool updateBackgroundLayer(bool needsBackgroundLayer); 319 voidupdateMaskingLayer(bool hasMask, bool hasClipPath);319 bool updateMaskingLayer(bool hasMask, bool hasClipPath); 320 320 bool requiresHorizontalScrollbarLayer() const; 321 321 bool requiresVerticalScrollbarLayer() const; … … 327 327 328 328 void updateChildClippingStrategy(bool needsDescendantsClippingLayer); 329 330 329 void updateMaskingLayerGeometry(); 331 332 330 void updateRootLayerConfiguration(); 331 void updatePaintingPhases(); 333 332 334 333 void setBackgroundLayerPaintsFixedRootBackground(bool); 335 334 336 OptionSet<GraphicsLayerPaintingPhase> paintingPhaseForPrimaryLayer() const;337 338 335 LayoutSize contentOffsetInCompositingLayer() const; 339 336 // Result is transform origin in device pixels.
Note:
See TracChangeset
for help on using the changeset viewer.