Title: [247912] trunk
- Revision
- 247912
- Author
- [email protected]
- Date
- 2019-07-29 11:37:50 -0700 (Mon, 29 Jul 2019)
Log Message
REGRESSION (r246899): Subtitles show twice when controls show/hide on hulu.com
https://bugs.webkit.org/show_bug.cgi?id=200187
rdar://problem/53511121
Reviewed by Zalan Bujtas.
Source/WebCore:
When a layer that painted into shared backing moved, we'd fail to repaint its old position
because the RenderLayer's repaint rects are cleared via BackingSharingState::updateBeforeDescendantTraversal().
Recomputing repaint rects is expensive, so we only want to do it when necessary, which is for
layers that start and stop sharing (going into and out of compositing already recomputes them).
So add logic to RenderLayerBacking::setBackingSharingLayers() that recomputes repaint rects
on layers that will no longer use shared backing, and those that are newly using shared
backing.
Test: compositing/shared-backing/backing-sharing-repaint.html
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::setBackingProviderLayer):
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::setBackingSharingLayers):
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::BackingSharingState::appendSharingLayer):
(WebCore::RenderLayerCompositor::updateBacking):
LayoutTests:
* compositing/shared-backing/backing-sharing-repaint-expected.html: Added.
* compositing/shared-backing/backing-sharing-repaint.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (247911 => 247912)
--- trunk/LayoutTests/ChangeLog 2019-07-29 18:35:33 UTC (rev 247911)
+++ trunk/LayoutTests/ChangeLog 2019-07-29 18:37:50 UTC (rev 247912)
@@ -1,5 +1,16 @@
2019-07-29 Simon Fraser <[email protected]>
+ REGRESSION (r246899): Subtitles show twice when controls show/hide on hulu.com
+ https://bugs.webkit.org/show_bug.cgi?id=200187
+ rdar://problem/53511121
+
+ Reviewed by Zalan Bujtas.
+
+ * compositing/shared-backing/backing-sharing-repaint-expected.html: Added.
+ * compositing/shared-backing/backing-sharing-repaint.html: Added.
+
+2019-07-29 Simon Fraser <[email protected]>
+
The touch-action property was ignored on replaced elements (canvas, img etc)
https://bugs.webkit.org/show_bug.cgi?id=200205
rdar://problem/53331224
Added: trunk/LayoutTests/compositing/shared-backing/backing-sharing-repaint-expected.html (0 => 247912)
--- trunk/LayoutTests/compositing/shared-backing/backing-sharing-repaint-expected.html (rev 0)
+++ trunk/LayoutTests/compositing/shared-backing/backing-sharing-repaint-expected.html 2019-07-29 18:37:50 UTC (rev 247912)
@@ -0,0 +1,60 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <style>
+ .container {
+ position: absolute;
+ margin: 40px;
+ padding: 50px;
+ width: 400px;
+ height: 300px;
+ border: 1px solid black;
+ }
+
+ .caption-container {
+ position: absolute;
+ top: 0;
+ left: 0;
+ width: 100%;
+ height: 100%;
+ box-shadow: 0 0 10px black;
+ }
+
+ .caption {
+ position: absolute;
+ width: 300px;
+ bottom: 20px;
+ text-align: center;
+ height: 100px;
+ background-color: blue;
+ }
+
+ .child {
+ position: absolute;
+ top: 10px;
+ left: 320px;
+ width: 100px;
+ height: 100px;
+ background-color: blue;
+ }
+ .composited {
+ transform: translateZ(0);
+ background-color: silver;
+ }
+ </style>
+</head>
+<body>
+ <div class="container">
+ <div class="composited">composited</div>
+
+ <div class="caption-container">
+ <div class="caption">
+ This should move, not duplicate
+ <div class="child">
+ child
+ </div>
+ </div>
+ </div>
+ </div>
+</body>
+</html>
Added: trunk/LayoutTests/compositing/shared-backing/backing-sharing-repaint.html (0 => 247912)
--- trunk/LayoutTests/compositing/shared-backing/backing-sharing-repaint.html (rev 0)
+++ trunk/LayoutTests/compositing/shared-backing/backing-sharing-repaint.html 2019-07-29 18:37:50 UTC (rev 247912)
@@ -0,0 +1,79 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <style>
+ .container {
+ position: absolute;
+ margin: 40px;
+ padding: 50px;
+ width: 400px;
+ height: 300px;
+ border: 1px solid black;
+ }
+
+ .caption-container {
+ position: absolute;
+ top: 0;
+ left: 0;
+ width: 100%;
+ height: 100%;
+ box-shadow: 0 0 10px black;
+ }
+
+ .caption {
+ position: absolute;
+ width: 300px;
+ bottom: 200px;
+ text-align: center;
+ height: 100px;
+ background-color: blue;
+ }
+
+ .child {
+ position: absolute;
+ top: 10px;
+ left: 320px;
+ width: 100px;
+ height: 100px;
+ background-color: blue;
+ }
+
+ body.changed .caption {
+ bottom: 20px;
+ }
+
+ .composited {
+ transform: translateZ(0);
+ background-color: silver;
+ }
+ </style>
+ <script>
+ if (window.testRunner)
+ testRunner.waitUntilDone();
+
+ window.addEventListener('load', () => {
+ requestAnimationFrame(() => {
+ document.getElementById('trigger').classList.add('composited');
+ requestAnimationFrame(() => {
+ document.body.classList.add('changed');
+ if (window.testRunner)
+ testRunner.notifyDone();
+ });
+ });
+ }, false);
+ </script>
+</head>
+<body>
+ <div class="container">
+ <div id="trigger">composited</div>
+ <div class="caption-container">
+ <div class="caption">
+ This should move, not duplicate
+ <div class="child">
+ child
+ </div>
+ </div>
+ </div>
+ </div>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (247911 => 247912)
--- trunk/Source/WebCore/ChangeLog 2019-07-29 18:35:33 UTC (rev 247911)
+++ trunk/Source/WebCore/ChangeLog 2019-07-29 18:37:50 UTC (rev 247912)
@@ -1,5 +1,32 @@
2019-07-29 Simon Fraser <[email protected]>
+ REGRESSION (r246899): Subtitles show twice when controls show/hide on hulu.com
+ https://bugs.webkit.org/show_bug.cgi?id=200187
+ rdar://problem/53511121
+
+ Reviewed by Zalan Bujtas.
+
+ When a layer that painted into shared backing moved, we'd fail to repaint its old position
+ because the RenderLayer's repaint rects are cleared via BackingSharingState::updateBeforeDescendantTraversal().
+
+ Recomputing repaint rects is expensive, so we only want to do it when necessary, which is for
+ layers that start and stop sharing (going into and out of compositing already recomputes them).
+ So add logic to RenderLayerBacking::setBackingSharingLayers() that recomputes repaint rects
+ on layers that will no longer use shared backing, and those that are newly using shared
+ backing.
+
+ Test: compositing/shared-backing/backing-sharing-repaint.html
+
+ * rendering/RenderLayer.cpp:
+ (WebCore::RenderLayer::setBackingProviderLayer):
+ * rendering/RenderLayerBacking.cpp:
+ (WebCore::RenderLayerBacking::setBackingSharingLayers):
+ * rendering/RenderLayerCompositor.cpp:
+ (WebCore::RenderLayerCompositor::BackingSharingState::appendSharingLayer):
+ (WebCore::RenderLayerCompositor::updateBacking):
+
+2019-07-29 Simon Fraser <[email protected]>
+
The touch-action property was ignored on replaced elements (canvas, img etc)
https://bugs.webkit.org/show_bug.cgi?id=200205
rdar://problem/53331224
Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (247911 => 247912)
--- trunk/Source/WebCore/rendering/RenderLayer.cpp 2019-07-29 18:35:33 UTC (rev 247911)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp 2019-07-29 18:37:50 UTC (rev 247912)
@@ -1796,10 +1796,8 @@
if (backingProvider == m_backingProviderLayer)
return;
- if (!renderer().renderTreeBeingDestroyed()) {
- clearRepaintRects();
+ if (!renderer().renderTreeBeingDestroyed())
clearClipRectsIncludingDescendants();
- }
m_backingProviderLayer = makeWeakPtr(backingProvider);
}
Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (247911 => 247912)
--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2019-07-29 18:35:33 UTC (rev 247911)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2019-07-29 18:37:50 UTC (rev 247912)
@@ -281,15 +281,35 @@
void RenderLayerBacking::setBackingSharingLayers(Vector<WeakPtr<RenderLayer>>&& sharingLayers)
{
+ bool sharingLayersChanged = m_backingSharingLayers != sharingLayers;
+ if (sharingLayersChanged) {
+ // For layers that used to share and no longer do, and are not composited, recompute repaint rects.
+ for (auto& oldSharingLayer : m_backingSharingLayers) {
+ // Layers that go from shared to composited have their repaint rects recomputed in RenderLayerCompositor::updateBacking().
+ // FIXME: Two O(n^2) traversals in this funtion. Probably OK because sharing lists are usually small, but still.
+ if (!sharingLayers.contains(oldSharingLayer) && !oldSharingLayer->isComposited())
+ oldSharingLayer->computeRepaintRectsIncludingDescendants();
+ }
+ }
+
clearBackingSharingLayerProviders(m_backingSharingLayers);
if (sharingLayers != m_backingSharingLayers)
- setContentsNeedDisplay(); // This could be optimize to only repaint rects for changed layers.
+ setContentsNeedDisplay(); // This could be optimized to only repaint rects for changed layers.
+ auto oldSharingLayers = WTFMove(m_backingSharingLayers);
m_backingSharingLayers = WTFMove(sharingLayers);
for (auto& layerWeakPtr : m_backingSharingLayers)
layerWeakPtr->setBackingProviderLayer(&m_owningLayer);
+
+ if (sharingLayersChanged) {
+ // For layers that are newly sharing, recompute repaint rects.
+ for (auto& currentSharingLayer : m_backingSharingLayers) {
+ if (!oldSharingLayers.contains(currentSharingLayer))
+ currentSharingLayer->computeRepaintRectsIncludingDescendants();
+ }
+ }
}
void RenderLayerBacking::removeBackingSharingLayer(RenderLayer& layer)
Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (247911 => 247912)
--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2019-07-29 18:35:33 UTC (rev 247911)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2019-07-29 18:37:50 UTC (rev 247912)
@@ -207,6 +207,7 @@
void appendSharingLayer(RenderLayer& layer)
{
+ ASSERT(m_backingProviderCandidate);
m_backingSharingLayers.append(makeWeakPtr(layer));
}
@@ -1621,7 +1622,7 @@
// the repaint container, so change when compositing changes; we need to update them here.
if (layer.parent())
layer.computeRepaintRectsIncludingDescendants();
-
+
layer.setNeedsCompositingGeometryUpdate();
layer.setNeedsCompositingConfigurationUpdate();
layer.setNeedsCompositingPaintOrderChildrenUpdate();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes