WebKit Bugzilla
Attachment 369544 Details for
Bug 197692
: Backing-sharing layers with transforms render incorrectly
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-197692-20190509221851.patch (text/plain), 16.82 KB, created by
Simon Fraser (smfr)
on 2019-05-09 22:18:52 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Simon Fraser (smfr)
Created:
2019-05-09 22:18:52 PDT
Size:
16.82 KB
patch
obsolete
>Subversion Revision: 245170 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 8cb18e7da7c75fd08039c7e663e741ed20889016..b9262b8b069fa293d7a9584aab537b8784cd82c3 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,32 @@ >+2019-05-09 Simon Fraser <simon.fraser@apple.com> >+ >+ Backing-sharing layers with transforms render incorrectly >+ https://bugs.webkit.org/show_bug.cgi?id=197692 >+ <rdar://problem/50652127> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ When layers that paint into shared backing have effects (transform, filter, opacity), we need >+ to paint with those effects. That's different from the primary layer, whose effects are normally >+ mapped to GraphicsLayer properties. (Note that if the primary layer has an effect, that effect will create >+ stacking context, so descendants will also become z-order descendants and there's no need to do sharing.) >+ >+ For some reason reflection painting is broken, so just disable sharing in that case. >+ >+ Tests: compositing/shared-backing/shared-layer-has-filter.html >+ compositing/shared-backing/shared-layer-has-opacity.html >+ compositing/shared-backing/shared-layer-has-reflection.html >+ compositing/shared-backing/shared-layer-has-transform.html >+ >+ * rendering/RenderLayer.cpp: >+ (WebCore::RenderLayer::paintLayer): >+ (WebCore::RenderLayer::paintLayerWithEffects): >+ * rendering/RenderLayer.h: >+ * rendering/RenderLayerBacking.cpp: >+ (WebCore::RenderLayerBacking::paintIntoLayer): >+ * rendering/RenderLayerCompositor.cpp: >+ (WebCore::backingProviderLayerCanIncludeLayer): >+ > 2019-05-09 Simon Fraser <simon.fraser@apple.com> > > Implement backing-sharing in compositing layers, allowing overlap layers to paint into the backing store of another layer >diff --git a/Source/WebCore/rendering/RenderLayer.cpp b/Source/WebCore/rendering/RenderLayer.cpp >index a25dbd1abb909e84c6fe51b68ed414c7129da324..d43b04dfb8b19507999734fbea59b4d4c4882006 100644 >--- a/Source/WebCore/rendering/RenderLayer.cpp >+++ b/Source/WebCore/rendering/RenderLayer.cpp >@@ -4100,13 +4100,18 @@ void RenderLayer::paintLayer(GraphicsContext& context, const LayerPaintingInfo& > return; > } > >+ paintLayerWithEffects(context, paintingInfo, paintFlags); >+} >+ >+void RenderLayer::paintLayerWithEffects(GraphicsContext& context, const LayerPaintingInfo& paintingInfo, OptionSet<PaintLayerFlag> paintFlags) >+{ > // Non self-painting leaf layers don't need to be painted as their renderer() should properly paint itself. > if (!isSelfPaintingLayer() && !hasSelfPaintingLayerDescendant()) > return; > > if (shouldSuppressPaintingLayer(this)) > return; >- >+ > // If this layer is totally invisible then there is nothing to paint. > if (!renderer().opacity()) > return; >diff --git a/Source/WebCore/rendering/RenderLayer.h b/Source/WebCore/rendering/RenderLayer.h >index da4beb9ac9850608552fafafe7bda20af019ad1b..22be9bcbbfe02dedc4bc25caaada73466ad62756 100644 >--- a/Source/WebCore/rendering/RenderLayer.h >+++ b/Source/WebCore/rendering/RenderLayer.h >@@ -1003,6 +1003,8 @@ private: > void applyFilters(GraphicsContext& originalContext, const LayerPaintingInfo&, const LayerFragments&); > > void paintLayer(GraphicsContext&, const LayerPaintingInfo&, OptionSet<PaintLayerFlag>); >+ void paintLayerWithEffects(GraphicsContext&, const LayerPaintingInfo&, OptionSet<PaintLayerFlag>); >+ > void paintLayerContentsAndReflection(GraphicsContext&, const LayerPaintingInfo&, OptionSet<PaintLayerFlag>); > void paintLayerByApplyingTransform(GraphicsContext&, const LayerPaintingInfo&, OptionSet<PaintLayerFlag>, const LayoutSize& translationOffset = LayoutSize()); > void paintLayerContents(GraphicsContext&, const LayerPaintingInfo&, OptionSet<PaintLayerFlag>); >diff --git a/Source/WebCore/rendering/RenderLayerBacking.cpp b/Source/WebCore/rendering/RenderLayerBacking.cpp >index 0ed800cf919112e1da9806f86b4dcb74ef101718..4bbf446b2c4d5b6c077b81547b4d0060a0cb4759 100644 >--- a/Source/WebCore/rendering/RenderLayerBacking.cpp >+++ b/Source/WebCore/rendering/RenderLayerBacking.cpp >@@ -2665,10 +2665,13 @@ void RenderLayerBacking::paintIntoLayer(const GraphicsLayer* graphicsLayer, Grap > > RenderLayer::LayerPaintingInfo paintingInfo(&m_owningLayer, paintDirtyRect, paintBehavior, -m_subpixelOffsetFromRenderer); > >- layer.paintLayerContents(context, paintingInfo, paintFlags); >+ if (&layer == &m_owningLayer) { >+ layer.paintLayerContents(context, paintingInfo, paintFlags); > >- if (layer.containsDirtyOverlayScrollbars()) >- layer.paintLayerContents(context, paintingInfo, paintFlags | RenderLayer::PaintLayerPaintingOverlayScrollbars); >+ if (layer.containsDirtyOverlayScrollbars()) >+ layer.paintLayerContents(context, paintingInfo, paintFlags | RenderLayer::PaintLayerPaintingOverlayScrollbars); >+ } else >+ layer.paintLayerWithEffects(context, paintingInfo, paintFlags); > > if (layer.isRenderViewLayer()) > renderer().view().frameView().didPaintContents(context, paintDirtyRect, paintingState); >diff --git a/Source/WebCore/rendering/RenderLayerCompositor.cpp b/Source/WebCore/rendering/RenderLayerCompositor.cpp >index e3a4c9f3f87abeb4ebe4024fec1e69ac51648d36..a2348ff1a7e327c23d28362939a7c351c0ca07be 100644 >--- a/Source/WebCore/rendering/RenderLayerCompositor.cpp >+++ b/Source/WebCore/rendering/RenderLayerCompositor.cpp >@@ -860,6 +860,9 @@ bool RenderLayerCompositor::updateCompositingLayers(CompositingUpdateType update > > static bool backingProviderLayerCanIncludeLayer(const RenderLayer& sharedLayer, const RenderLayer& layer) > { >+ // Disable sharing when painting shared layers doesn't work correctly. >+ if (layer.hasReflection()) >+ return false; > return layer.ancestorLayerIsInContainingBlockChain(sharedLayer); > } > >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 72cecf98bb49ee8e208906cf95b381f17c2d678d..4806f21612dd20a66749e051f8a81f549c330b65 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,20 @@ >+2019-05-09 Simon Fraser <simon.fraser@apple.com> >+ >+ Backing-sharing layers with transforms render incorrectly >+ https://bugs.webkit.org/show_bug.cgi?id=197692 >+ <rdar://problem/50652127> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * compositing/shared-backing/shared-layer-has-filter-expected.html: Added. >+ * compositing/shared-backing/shared-layer-has-filter.html: Added. >+ * compositing/shared-backing/shared-layer-has-opacity-expected.html: Added. >+ * compositing/shared-backing/shared-layer-has-opacity.html: Added. >+ * compositing/shared-backing/shared-layer-has-reflection-expected.html: Added. >+ * compositing/shared-backing/shared-layer-has-reflection.html: Added. >+ * compositing/shared-backing/shared-layer-has-transform-expected.html: Added. >+ * compositing/shared-backing/shared-layer-has-transform.html: Added. >+ > 2019-05-09 Simon Fraser <simon.fraser@apple.com> > > Implement backing-sharing in compositing layers, allowing overlap layers to paint into the backing store of another layer >diff --git a/LayoutTests/compositing/shared-backing/shared-layer-has-filter-expected.html b/LayoutTests/compositing/shared-backing/shared-layer-has-filter-expected.html >new file mode 100644 >index 0000000000000000000000000000000000000000..55828317fca87f46603428e80d7ad0fe13d69ae4 >--- /dev/null >+++ b/LayoutTests/compositing/shared-backing/shared-layer-has-filter-expected.html >@@ -0,0 +1,35 @@ >+<!DOCTYPE html> <!-- webkit-test-runner [ internal:AsyncOverflowScrollingEnabled=true ] --> >+<html> >+<head> >+ <title>Tests painting of a filtered layer into shared backing</title> >+ <style> >+ .scrollable { >+ position: relative; >+ z-index: 0; >+ overflow-y: scroll; >+ height: 300px; >+ width: 300px; >+ margin: 10px; >+ border: 1px solid black; >+ } >+ >+ .sharing { >+ width: 200px; >+ height: 200px; >+ background-color: magenta; >+ filter: hue-rotate(0.5turn); >+ } >+ >+ .spacer { >+ height: 500px; >+ } >+ </style> >+</head> >+<body> >+ <div class="scrollable"> >+ <div class="sharing"> >+ </div> >+ <div class="spacer"></div> >+ </div> >+</body> >+</html> >diff --git a/LayoutTests/compositing/shared-backing/shared-layer-has-filter.html b/LayoutTests/compositing/shared-backing/shared-layer-has-filter.html >new file mode 100644 >index 0000000000000000000000000000000000000000..40713897176abb1b24b09aea227c71aa012533ed >--- /dev/null >+++ b/LayoutTests/compositing/shared-backing/shared-layer-has-filter.html >@@ -0,0 +1,33 @@ >+<!DOCTYPE html> <!-- webkit-test-runner [ internal:AsyncOverflowScrollingEnabled=true ] --> >+<html> >+<head> >+ <title>Tests painting of a filtered layer into shared backing</title> >+ <style> >+ .scrollable { >+ overflow-y: scroll; >+ height: 300px; >+ width: 300px; >+ margin: 10px; >+ border: 1px solid black; >+ } >+ >+ .sharing { >+ width: 200px; >+ height: 200px; >+ background-color: magenta; >+ filter: hue-rotate(0.5turn); >+ } >+ >+ .spacer { >+ height: 500px; >+ } >+ </style> >+</head> >+<body> >+ <div class="scrollable"> >+ <div class="sharing"> >+ </div> >+ <div class="spacer"></div> >+ </div> >+</body> >+</html> >diff --git a/LayoutTests/compositing/shared-backing/shared-layer-has-opacity-expected.html b/LayoutTests/compositing/shared-backing/shared-layer-has-opacity-expected.html >new file mode 100644 >index 0000000000000000000000000000000000000000..74c6a3303ce9ebef9d52382a9e19a34b3acf470b >--- /dev/null >+++ b/LayoutTests/compositing/shared-backing/shared-layer-has-opacity-expected.html >@@ -0,0 +1,35 @@ >+<!DOCTYPE html> <!-- webkit-test-runner [ internal:AsyncOverflowScrollingEnabled=true ] --> >+<html> >+<head> >+ <title>Tests painting of a layer with opacity into shared backing</title> >+ <style> >+ .scrollable { >+ position: relative; >+ z-index: 0; >+ overflow-y: scroll; >+ height: 300px; >+ width: 300px; >+ margin: 10px; >+ border: 1px solid black; >+ } >+ >+ .sharing { >+ width: 200px; >+ height: 200px; >+ background-color: green; >+ opacity: 0.5; >+ } >+ >+ .spacer { >+ height: 500px; >+ } >+ </style> >+</head> >+<body> >+ <div class="scrollable"> >+ <div class="sharing"> >+ </div> >+ <div class="spacer"></div> >+ </div> >+</body> >+</html> >diff --git a/LayoutTests/compositing/shared-backing/shared-layer-has-opacity.html b/LayoutTests/compositing/shared-backing/shared-layer-has-opacity.html >new file mode 100644 >index 0000000000000000000000000000000000000000..1abf4e48c3bd300387a2bdef48a4c2bd439a1448 >--- /dev/null >+++ b/LayoutTests/compositing/shared-backing/shared-layer-has-opacity.html >@@ -0,0 +1,33 @@ >+<!DOCTYPE html> <!-- webkit-test-runner [ internal:AsyncOverflowScrollingEnabled=true ] --> >+<html> >+<head> >+ <title>Tests painting of a layer with opacity into shared backing</title> >+ <style> >+ .scrollable { >+ overflow-y: scroll; >+ height: 300px; >+ width: 300px; >+ margin: 10px; >+ border: 1px solid black; >+ } >+ >+ .sharing { >+ width: 200px; >+ height: 200px; >+ background-color: green; >+ opacity: 0.5; >+ } >+ >+ .spacer { >+ height: 500px; >+ } >+ </style> >+</head> >+<body> >+ <div class="scrollable"> >+ <div class="sharing"> >+ </div> >+ <div class="spacer"></div> >+ </div> >+</body> >+</html> >diff --git a/LayoutTests/compositing/shared-backing/shared-layer-has-reflection-expected.html b/LayoutTests/compositing/shared-backing/shared-layer-has-reflection-expected.html >new file mode 100644 >index 0000000000000000000000000000000000000000..4eefd643fb9d4b9572f36742007ecd9822a08669 >--- /dev/null >+++ b/LayoutTests/compositing/shared-backing/shared-layer-has-reflection-expected.html >@@ -0,0 +1,37 @@ >+<!DOCTYPE html> <!-- webkit-test-runner [ internal:AsyncOverflowScrollingEnabled=true ] --> >+<html> >+<head> >+ <title>Tests painting of a reflected layer into shared backing</title> >+ <style> >+ .scrollable { >+ position: relative; >+ z-index: 0; >+ overflow-y: scroll; >+ height: 400px; >+ width: 300px; >+ margin: 10px; >+ border: 1px solid black; >+ } >+ >+ .sharing { >+ margin: 20px; >+ width: 150px; >+ height: 130px; >+ background-color: green; >+ border-bottom: 20px solid orange; >+ -webkit-box-reflect: below 10px; >+ } >+ >+ .spacer { >+ height: 500px; >+ } >+ </style> >+</head> >+<body> >+ <div class="scrollable"> >+ <div class="sharing"> >+ </div> >+ <div class="spacer"></div> >+ </div> >+</body> >+</html> >diff --git a/LayoutTests/compositing/shared-backing/shared-layer-has-reflection.html b/LayoutTests/compositing/shared-backing/shared-layer-has-reflection.html >new file mode 100644 >index 0000000000000000000000000000000000000000..f584d9ef1a5f3619d88f9e6588b50d1eb3e06d44 >--- /dev/null >+++ b/LayoutTests/compositing/shared-backing/shared-layer-has-reflection.html >@@ -0,0 +1,35 @@ >+<!DOCTYPE html> <!-- webkit-test-runner [ internal:AsyncOverflowScrollingEnabled=true ] --> >+<html> >+<head> >+ <title>Tests painting of a reflected layer into shared backing</title> >+ <style> >+ .scrollable { >+ overflow-y: scroll; >+ height: 400px; >+ width: 300px; >+ margin: 10px; >+ border: 1px solid black; >+ } >+ >+ .sharing { >+ margin: 20px; >+ width: 150px; >+ height: 130px; >+ background-color: green; >+ border-bottom: 20px solid orange; >+ -webkit-box-reflect: below 10px; >+ } >+ >+ .spacer { >+ height: 500px; >+ } >+ </style> >+</head> >+<body> >+ <div class="scrollable"> >+ <div class="sharing"> >+ </div> >+ <div class="spacer"></div> >+ </div> >+</body> >+</html> >diff --git a/LayoutTests/compositing/shared-backing/shared-layer-has-transform-expected.html b/LayoutTests/compositing/shared-backing/shared-layer-has-transform-expected.html >new file mode 100644 >index 0000000000000000000000000000000000000000..daccda1b77fc43489e372c97b892ec0b63920b41 >--- /dev/null >+++ b/LayoutTests/compositing/shared-backing/shared-layer-has-transform-expected.html >@@ -0,0 +1,36 @@ >+<!DOCTYPE html> <!-- webkit-test-runner [ internal:AsyncOverflowScrollingEnabled=true ] --> >+<html> >+<head> >+ <title>Tests painting of a transformed layer into shared backing</title> >+ <style> >+ .scrollable { >+ position: relative; >+ z-index: 0; >+ overflow-y: scroll; >+ height: 300px; >+ width: 300px; >+ margin: 10px; >+ border: 1px solid black; >+ } >+ >+ .sharing { >+ width: 100px; >+ height: 100px; >+ background-color: green; >+ transform: scale(2); >+ transform-origin: top left; >+ } >+ >+ .spacer { >+ height: 500px; >+ } >+ </style> >+</head> >+<body> >+ <div class="scrollable"> >+ <div class="sharing"> >+ </div> >+ <div class="spacer"></div> >+ </div> >+</body> >+</html> >diff --git a/LayoutTests/compositing/shared-backing/shared-layer-has-transform.html b/LayoutTests/compositing/shared-backing/shared-layer-has-transform.html >new file mode 100644 >index 0000000000000000000000000000000000000000..7a45c9151b5eb1e0308da5e2d3f9172d054f41dc >--- /dev/null >+++ b/LayoutTests/compositing/shared-backing/shared-layer-has-transform.html >@@ -0,0 +1,34 @@ >+<!DOCTYPE html> <!-- webkit-test-runner [ internal:AsyncOverflowScrollingEnabled=true ] --> >+<html> >+<head> >+ <title>Tests painting of a transformed layer into shared backing</title> >+ <style> >+ .scrollable { >+ overflow-y: scroll; >+ height: 300px; >+ width: 300px; >+ margin: 10px; >+ border: 1px solid black; >+ } >+ >+ .sharing { >+ width: 100px; >+ height: 100px; >+ background-color: green; >+ transform: scale(2); >+ transform-origin: top left; >+ } >+ >+ .spacer { >+ height: 500px; >+ } >+ </style> >+</head> >+<body> >+ <div class="scrollable"> >+ <div class="sharing"> >+ </div> >+ <div class="spacer"></div> >+ </div> >+</body> >+</html>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 197692
:
369544
|
369561
|
369637
|
369638
|
369639
|
369641
|
369642
|
369643
|
369644
|
369645
|
369646
|
369647
|
369652