Title: [240213] trunk
Revision
240213
Author
za...@apple.com
Date
2019-01-20 11:17:42 -0800 (Sun, 20 Jan 2019)

Log Message

[LFC][BFC] <body>'s overflow property value is propagated to viewport
https://bugs.webkit.org/show_bug.cgi?id=193617

Reviewed by Antti Koivisto.

Source/WebCore:

When the root element is an HTML "HTML" element or an XHTML "html" element, and that element has an HTML "BODY" element
or an XHTML "body" element as a child, user agents must instead apply the 'overflow' property from the first such child element to the viewport,
if the value on the root element is 'visible'. The 'visible' value when used for the viewport must be interpreted as 'auto'.
The element from which the value is propagated must have a used value for 'overflow' of 'visible'.

This also has impact on layout since <body style="overflow: hidden"> would establish a block formatting context.

* layout/layouttree/LayoutBox.cpp:
(WebCore::Layout::Box::isOverflowVisible const):

Tools:

* LayoutReloaded/misc/LFC-passing-tests.txt:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (240212 => 240213)


--- trunk/Source/WebCore/ChangeLog	2019-01-20 18:37:18 UTC (rev 240212)
+++ trunk/Source/WebCore/ChangeLog	2019-01-20 19:17:42 UTC (rev 240213)
@@ -1,3 +1,20 @@
+2019-01-19  Zalan Bujtas  <za...@apple.com>
+
+        [LFC][BFC] <body>'s overflow property value is propagated to viewport
+        https://bugs.webkit.org/show_bug.cgi?id=193617
+
+        Reviewed by Antti Koivisto.
+
+        When the root element is an HTML "HTML" element or an XHTML "html" element, and that element has an HTML "BODY" element
+        or an XHTML "body" element as a child, user agents must instead apply the 'overflow' property from the first such child element to the viewport,
+        if the value on the root element is 'visible'. The 'visible' value when used for the viewport must be interpreted as 'auto'.
+        The element from which the value is propagated must have a used value for 'overflow' of 'visible'.
+
+        This also has impact on layout since <body style="overflow: hidden"> would establish a block formatting context.
+
+        * layout/layouttree/LayoutBox.cpp:
+        (WebCore::Layout::Box::isOverflowVisible const):
+
 2019-01-20  Michael Catanzaro  <mcatanz...@igalia.com>
 
         Unreviewed, rolling out r240209.

Modified: trunk/Source/WebCore/layout/layouttree/LayoutBox.cpp (240212 => 240213)


--- trunk/Source/WebCore/layout/layouttree/LayoutBox.cpp	2019-01-20 18:37:18 UTC (rev 240212)
+++ trunk/Source/WebCore/layout/layouttree/LayoutBox.cpp	2019-01-20 19:17:42 UTC (rev 240213)
@@ -262,7 +262,32 @@
 
 bool Box::isOverflowVisible() const
 {
-    return m_style.overflowX() == Overflow::Visible || m_style.overflowY() == Overflow::Visible;
+    auto isOverflowVisible = m_style.overflowX() == Overflow::Visible || m_style.overflowY() == Overflow::Visible;
+    // UAs must apply the 'overflow' property set on the root element to the viewport. When the root element is an HTML "HTML" element
+    // or an XHTML "html" element, and that element has an HTML "BODY" element or an XHTML "body" element as a child,
+    // user agents must instead apply the 'overflow' property from the first such child element to the viewport,
+    // if the value on the root element is 'visible'. The 'visible' value when used for the viewport must be interpreted as 'auto'.
+    // The element from which the value is propagated must have a used value for 'overflow' of 'visible'.
+    if (isBodyBox()) {
+        auto* documentBox = parent();
+        ASSERT(documentBox);
+        if (!documentBox->isDocumentBox())
+            return isOverflowVisible;
+        if (!documentBox->isOverflowVisible())
+            return isOverflowVisible;
+        return true;
+    }
+    if (isInitialContainingBlock()) {
+        auto* documentBox = downcast<Container>(*this).firstChild();
+        if (!documentBox || !documentBox->isDocumentBox() || !is<Container>(documentBox))
+            return isOverflowVisible;
+        auto* bodyBox = downcast<Container>(documentBox)->firstChild();
+        if (!bodyBox || !bodyBox->isBodyBox())
+            return isOverflowVisible;
+        auto& bodyBoxStyle = bodyBox->style();
+        return bodyBoxStyle.overflowX() == Overflow::Visible || bodyBoxStyle.overflowY() == Overflow::Visible;
+    }
+    return isOverflowVisible;
 }
 
 bool Box::isPaddingApplicable() const

Modified: trunk/Tools/ChangeLog (240212 => 240213)


--- trunk/Tools/ChangeLog	2019-01-20 18:37:18 UTC (rev 240212)
+++ trunk/Tools/ChangeLog	2019-01-20 19:17:42 UTC (rev 240213)
@@ -1,3 +1,12 @@
+2019-01-19  Zalan Bujtas  <za...@apple.com>
+
+        [LFC][BFC] <body>'s overflow property value is propagated to viewport
+        https://bugs.webkit.org/show_bug.cgi?id=193617
+
+        Reviewed by Antti Koivisto.
+
+        * LayoutReloaded/misc/LFC-passing-tests.txt:
+
 2019-01-20  Michael Catanzaro  <mcatanz...@igalia.com>
 
         Unreviewed, rolling out r240209.

Modified: trunk/Tools/LayoutReloaded/misc/LFC-passing-tests.txt (240212 => 240213)


--- trunk/Tools/LayoutReloaded/misc/LFC-passing-tests.txt	2019-01-20 18:37:18 UTC (rev 240212)
+++ trunk/Tools/LayoutReloaded/misc/LFC-passing-tests.txt	2019-01-20 19:17:42 UTC (rev 240213)
@@ -122,6 +122,7 @@
 fast/block/float/crash-when-intruding-float-has-anonymous-parent-and-detach.html
 fast/block/float/float-in-descendant-formatting-context.html
 fast/block/float/floats-with-negative-horizontal-margin.html
+fast/block/float/float-forced-below-other-floats.html
 fast/block/margin-collapse/002.html
 fast/block/margin-collapse/003.html
 fast/block/margin-collapse/026.html
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to