WebKit Bugzilla
Attachment 345893 Details for
Bug 188087
: [Fullscreen] Do not create composited layers for renderers unless they are part of the fullscreen subtree.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-188087-20180726185732.patch (text/plain), 8.40 KB, created by
zalan
on 2018-07-26 18:57:33 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
zalan
Created:
2018-07-26 18:57:33 PDT
Size:
8.40 KB
patch
obsolete
>Subversion Revision: 234269 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 7072433ede099c4698b51b48103957df198d27fc..4b92a189627d62c5937127f3cf54046885b8cfa8 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,23 @@ >+2018-07-26 Zalan Bujtas <zalan@apple.com> >+ >+ [Fullscreen] Do not create composited layers for renderers unless they are part of the fullscreen subtree. >+ https://bugs.webkit.org/show_bug.cgi?id=188087 >+ <rdar://problem/42632124> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Sibling composited layers prevent battery lifetime optimizations when in fullscreen. >+ >+ Test: compositing/no-compositing-when-fulll-screen-is-present.html >+ >+ * rendering/RenderLayer.cpp: >+ (WebCore::RenderLayer::isDescendantOf const): >+ * rendering/RenderLayer.h: >+ * rendering/RenderLayerCompositor.cpp: >+ (WebCore::isDescendantOfFullScreenLayer): >+ (WebCore::RenderLayerCompositor::requiresCompositingForWillChange const): >+ (WebCore::RenderLayerCompositor::requiresCompositingForPosition const): >+ > 2018-07-26 Eric Carlson <eric.carlson@apple.com> > > Switching tabs should not close PiP window >diff --git a/Source/WebCore/rendering/RenderLayer.cpp b/Source/WebCore/rendering/RenderLayer.cpp >index 8291ef99c0405779e3314e4df156beed865efda4..6cf1f9cd483e514f5fd1f81d64689517add7c099 100644 >--- a/Source/WebCore/rendering/RenderLayer.cpp >+++ b/Source/WebCore/rendering/RenderLayer.cpp >@@ -1843,6 +1843,15 @@ void RenderLayer::willBeDestroyed() > } > #endif > >+bool RenderLayer::isDescendantOf(const RenderLayer& layer) const >+{ >+ for (auto* ancestor = this; ancestor; ancestor = ancestor->parent()) { >+ if (&layer == ancestor) >+ return true; >+ } >+ return false; >+} >+ > void RenderLayer::addChild(RenderLayer* child, RenderLayer* beforeChild) > { > RenderLayer* prevSibling = beforeChild ? beforeChild->previousSibling() : lastChild(); >diff --git a/Source/WebCore/rendering/RenderLayer.h b/Source/WebCore/rendering/RenderLayer.h >index d7fd0a8c6a6295f012f807e5416f15a76fc1d69d..47fff652cf9aa70f51546485b79668a36b669e6f 100644 >--- a/Source/WebCore/rendering/RenderLayer.h >+++ b/Source/WebCore/rendering/RenderLayer.h >@@ -143,6 +143,7 @@ public: > RenderLayer* nextSibling() const { return m_next; } > RenderLayer* firstChild() const { return m_first; } > RenderLayer* lastChild() const { return m_last; } >+ bool isDescendantOf(const RenderLayer&) const; > > void addChild(RenderLayer* newChild, RenderLayer* beforeChild = nullptr); > RenderLayer* removeChild(RenderLayer*); >diff --git a/Source/WebCore/rendering/RenderLayerCompositor.cpp b/Source/WebCore/rendering/RenderLayerCompositor.cpp >index 41a63846d7d85a8a131814bbdf0c64787636d4e2..7e013d33473c8b1cd525e07e4551e238f937af46 100644 >--- a/Source/WebCore/rendering/RenderLayerCompositor.cpp >+++ b/Source/WebCore/rendering/RenderLayerCompositor.cpp >@@ -2068,6 +2068,23 @@ bool RenderLayerCompositor::canBeComposited(const RenderLayer& layer) const > return false; > } > >+enum class FullScreenDescendant { Yes, No, NotApplicable }; >+static FullScreenDescendant isDescendantOfFullScreenLayer(const RenderLayer& layer) >+{ >+ auto& document = layer.renderer().document(); >+ >+ if (!document.webkitIsFullScreen() || !document.fullScreenRenderer()) >+ return FullScreenDescendant::NotApplicable; >+ >+ auto* fullScreenLayer = document.fullScreenRenderer()->layer(); >+ if (!fullScreenLayer) { >+ ASSERT_NOT_REACHED(); >+ return FullScreenDescendant::NotApplicable; >+ } >+ >+ return layer.isDescendantOf(*fullScreenLayer) ? FullScreenDescendant::Yes : FullScreenDescendant::No; >+} >+ > bool RenderLayerCompositor::requiresOwnBackingStore(const RenderLayer& layer, const RenderLayer* compositingAncestorLayer, const LayoutRect& layerCompositedBoundsInAncestor, const LayoutRect& ancestorCompositedBounds) const > { > auto& renderer = layer.renderer(); >@@ -2565,6 +2582,9 @@ bool RenderLayerCompositor::requiresCompositingForWillChange(RenderLayerModelObj > if (!renderer.style().willChange() || !renderer.style().willChange()->canTriggerCompositing()) > return false; > >+ if (renderer.layer() && isDescendantOfFullScreenLayer(*renderer.layer()) == FullScreenDescendant::No) >+ return false; >+ > if (is<RenderBox>(renderer)) > return true; > >@@ -2635,6 +2655,9 @@ bool RenderLayerCompositor::requiresCompositingForPosition(RenderLayerModelObjec > if (!renderer.isPositioned()) > return false; > >+ if (isDescendantOfFullScreenLayer(layer) == FullScreenDescendant::No) >+ return false; >+ > auto position = renderer.style().position(); > bool isFixed = renderer.isOutOfFlowPositioned() && position == PositionType::Fixed; > if (isFixed && !layer.isStackingContainer()) >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 4bb35518ac17a53a5bca181788ad733a170ddd28..82a62945d6de2a52b61ace68c20e3a44aa4ad5db 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,14 @@ >+2018-07-26 Zalan Bujtas <zalan@apple.com> >+ >+ [Fullscreen] Do not create composited layers for renderers unless they are part of the fullscreen subtree. >+ https://bugs.webkit.org/show_bug.cgi?id=188087 >+ <rdar://problem/42632124> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * compositing/no-compositing-when-fulll-screen-is-present-expected.txt: Added. >+ * compositing/no-compositing-when-fulll-screen-is-present.html: Added. >+ > 2018-07-26 David Fenton <david_fenton@apple.com> > > Layout Test webgl/2.0.0/conformance2/glsl3/compound-assignment-type-combination.html is timing out on mac Debug >diff --git a/LayoutTests/compositing/no-compositing-when-fulll-screen-is-present-expected.txt b/LayoutTests/compositing/no-compositing-when-fulll-screen-is-present-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..1cf1c27f60ae6f3f8141532f2e2c1e8f7c4103b7 >--- /dev/null >+++ b/LayoutTests/compositing/no-compositing-when-fulll-screen-is-present-expected.txt >@@ -0,0 +1,42 @@ >+Test that only elements in fullscreen subtree get layer backed. >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+ >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+full screen content >+foobar >+foobar >+(GraphicsLayer >+(anchor 0.00 0.00) >+(bounds 800.00 600.00) >+(backingStoreAttached 1) >+(children 1 >+(GraphicsLayer >+(bounds 800.00 600.00) >+(contentsOpaque 1) >+(backingStoreAttached 1) >+(children 1 >+(GraphicsLayer >+(bounds 800.00 600.00) >+(backingStoreAttached 1) >+(children 2 >+(GraphicsLayer >+(anchor 0.00 0.00) >+(bounds 800.00 600.00) >+(backingStoreAttached 1) >+) >+(GraphicsLayer >+(bounds 800.00 600.00) >+(drawsContent 1) >+(backingStoreAttached 1) >+) >+) >+) >+) >+) >+) >+) >+Enter fullscreen >diff --git a/LayoutTests/compositing/no-compositing-when-fulll-screen-is-present.html b/LayoutTests/compositing/no-compositing-when-fulll-screen-is-present.html >new file mode 100644 >index 0000000000000000000000000000000000000000..6ba9bd6c878f549c7fe94c3b54ff4b2756617ab4 >--- /dev/null >+++ b/LayoutTests/compositing/no-compositing-when-fulll-screen-is-present.html >@@ -0,0 +1,54 @@ >+<!DOCTYPE html> >+<html> >+<body> >+<div id="host">full screen content</div> >+<div style="position: fixed; top: 100px; left: 100px;">foobar</div> >+<div style="will-change: transform;">foobar</div> >+<div id=layers></div> >+<button>Enter fullscreen</button> >+<script src="../resources/js-test.js"></script> >+<script> >+ >+description("Test that only elements in fullscreen subtree get layer backed."); >+ >+function goFullscreen() { >+ host.webkitRequestFullscreen(); >+ setTimeout(function () { >+ if (done) >+ return; >+ >+ testFailed('webkitfullscreenchange was not fired'); >+ finishJSTest(); >+ }, 2000); >+} >+ >+let done = false; >+function finalizeTest() { >+ if (done) >+ return; >+ done = true; >+ >+ if (testRunner) >+ testRunner.dumpAsText(); >+ >+ if (window.internals) >+ layers.innerText = internals.layerTreeAsText(document, internals.LAYER_TREE_INCLUDES_BACKING_STORE_ATTACHED); >+ >+ finishJSTest(); >+} >+ >+host.addEventListener('webkitfullscreenchange', finalizeTest); >+ >+let button = document.querySelector('button'); >+button.onclick = goFullscreen; >+ >+if (window.eventSender) { >+ jsTestIsAsync = true; >+ eventSender.mouseMoveTo(button.offsetLeft + 5, button.offsetTop + 5); >+ eventSender.mouseDown(); >+ eventSender.mouseUp(); >+} >+ >+</script> >+</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 188087
:
345893
|
345894
|
345895