Title: [283634] trunk/Source/WebCore
- Revision
- 283634
- Author
- [email protected]
- Date
- 2021-10-06 10:54:58 -0700 (Wed, 06 Oct 2021)
Log Message
Ensure that the top layer is always anchored to the RenderView
https://bugs.webkit.org/show_bug.cgi?id=231292
Reviewed by Simon Fraser.
A fixed positioned block level box is not necessarily anchored to the RenderView (see canContainFixedPositionObjects).
This patch ensures that we skip those ancestors and return the RenderView as the containing block for the top layer content.
https://fullscreen.spec.whatwg.org/#new-stacking-layer
"If the top layer position property computes to fixed, its containing block is the viewport, and the initial containing block otherwise."
* rendering/RenderObject.cpp:
(WebCore::RenderObject::containingBlock const):
(WebCore::containerForElement):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (283633 => 283634)
--- trunk/Source/WebCore/ChangeLog 2021-10-06 17:50:05 UTC (rev 283633)
+++ trunk/Source/WebCore/ChangeLog 2021-10-06 17:54:58 UTC (rev 283634)
@@ -1,3 +1,20 @@
+2021-10-06 Alan Bujtas <[email protected]>
+
+ Ensure that the top layer is always anchored to the RenderView
+ https://bugs.webkit.org/show_bug.cgi?id=231292
+
+ Reviewed by Simon Fraser.
+
+ A fixed positioned block level box is not necessarily anchored to the RenderView (see canContainFixedPositionObjects).
+ This patch ensures that we skip those ancestors and return the RenderView as the containing block for the top layer content.
+
+ https://fullscreen.spec.whatwg.org/#new-stacking-layer
+ "If the top layer position property computes to fixed, its containing block is the viewport, and the initial containing block otherwise."
+
+ * rendering/RenderObject.cpp:
+ (WebCore::RenderObject::containingBlock const):
+ (WebCore::containerForElement):
+
2021-10-06 Tim Nguyen <[email protected]>
Reset m_isModal flag when removing <dialog> from document
Modified: trunk/Source/WebCore/rendering/RenderObject.cpp (283633 => 283634)
--- trunk/Source/WebCore/rendering/RenderObject.cpp 2021-10-06 17:50:05 UTC (rev 283633)
+++ trunk/Source/WebCore/rendering/RenderObject.cpp 2021-10-06 17:54:58 UTC (rev 283634)
@@ -657,8 +657,9 @@
RenderBlock* RenderObject::containingBlock() const
{
- auto containingBlockForRenderer = [](const RenderElement& renderer)
- {
+ auto containingBlockForRenderer = [](const auto& renderer) -> RenderBlock* {
+ if (isInTopLayerOrBackdrop(renderer.style(), renderer.element()))
+ return &renderer.view();
if (renderer.isAbsolutelyPositioned())
return renderer.containingBlockForAbsolutePosition();
if (renderer.isFixedPositioned())
@@ -1468,6 +1469,8 @@
// This does mean that computePositionedLogicalWidth and computePositionedLogicalHeight have to use container().
if (!is<RenderElement>(renderer))
return renderer.parent();
+ if (isInTopLayerOrBackdrop(renderer.style(), downcast<RenderElement>(renderer).element()))
+ return &renderer.view();
auto position = renderer.style().position();
if (position == PositionType::Static || position == PositionType::Relative || position == PositionType::Sticky)
return renderer.parent();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes