Title: [238611] trunk
Revision
238611
Author
[email protected]
Date
2018-11-28 07:30:05 -0800 (Wed, 28 Nov 2018)

Log Message

[LFC] Add support for quirk container's collapsing top margin in quirks mode.
https://bugs.webkit.org/show_bug.cgi?id=192070

Reviewed by Antti Koivisto.

Source/WebCore:

In quirk mode when the top margin collapsing is computed for a quirk container (body, table cell) and the canditate margin value is
also a quirk value, we just ignore it.

* layout/blockformatting/BlockMarginCollapse.cpp:
(WebCore::Layout::isQuirkContainer):
(WebCore::Layout::hasMarginTopQuirkValue):
(WebCore::Layout::shouldIgnoreMarginTopInQuirkContext):
(WebCore::Layout::isMarginTopCollapsedWithParent):
(WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginTop):
* layout/layouttree/LayoutBox.h:
(WebCore::Layout::Box::isTableCell const):

Tools:

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

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (238610 => 238611)


--- trunk/Source/WebCore/ChangeLog	2018-11-28 15:06:19 UTC (rev 238610)
+++ trunk/Source/WebCore/ChangeLog	2018-11-28 15:30:05 UTC (rev 238611)
@@ -1,3 +1,22 @@
+2018-11-28  Zalan Bujtas  <[email protected]>
+
+        [LFC] Add support for quirk container's collapsing top margin in quirks mode.
+        https://bugs.webkit.org/show_bug.cgi?id=192070
+
+        Reviewed by Antti Koivisto.
+
+        In quirk mode when the top margin collapsing is computed for a quirk container (body, table cell) and the canditate margin value is
+        also a quirk value, we just ignore it.
+
+        * layout/blockformatting/BlockMarginCollapse.cpp:
+        (WebCore::Layout::isQuirkContainer):
+        (WebCore::Layout::hasMarginTopQuirkValue):
+        (WebCore::Layout::shouldIgnoreMarginTopInQuirkContext):
+        (WebCore::Layout::isMarginTopCollapsedWithParent):
+        (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginTop):
+        * layout/layouttree/LayoutBox.h:
+        (WebCore::Layout::Box::isTableCell const):
+
 2018-11-28  Ali Juma  <[email protected]>
 
         Intersection Observer: rootMargin: '' gives weird results

Modified: trunk/Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp (238610 => 238611)


--- trunk/Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp	2018-11-28 15:06:19 UTC (rev 238610)
+++ trunk/Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp	2018-11-28 15:30:05 UTC (rev 238611)
@@ -36,6 +36,23 @@
 namespace WebCore {
 namespace Layout {
 
+static bool isQuirkContainer(const Box& layoutBox)
+{
+    return layoutBox.isBodyBox() || layoutBox.isDocumentBox() || layoutBox.isTableCell();
+}
+
+static bool hasMarginTopQuirkValue(const Box& layoutBox)
+{
+    return layoutBox.style().hasMarginBeforeQuirk();
+}
+
+static bool shouldIgnoreMarginTopInQuirkContext(const LayoutState& layoutState, const Box& layoutBox)
+{
+    if (!layoutBox.parent())
+        return false;
+    return layoutState.inQuirksMode() && isQuirkContainer(*layoutBox.parent()) && hasMarginTopQuirkValue(layoutBox);
+}
+
 static LayoutUnit marginValue(LayoutUnit currentMarginValue, LayoutUnit candidateMarginValue)
 {
     if (!candidateMarginValue)
@@ -115,6 +132,9 @@
     if (parentDisplayBox.paddingTop().value_or(0))
         return false;
 
+    if (shouldIgnoreMarginTopInQuirkContext(layoutState, layoutBox))
+        return false;
+
     return true;
 }
 
@@ -211,6 +231,10 @@
     if (isMarginTopCollapsedWithParent(layoutState, layoutBox))
         return 0;
 
+    // FIXME: Find out the logic behind this.
+    if (shouldIgnoreMarginTopInQuirkContext(layoutState, layoutBox))
+        return 0;
+
     if (!isMarginTopCollapsedWithSibling(layoutBox)) {
         if (!isMarginBottomCollapsedThrough(layoutState, layoutBox))
             return nonCollapsedMarginTop(layoutState, layoutBox);

Modified: trunk/Source/WebCore/layout/layouttree/LayoutBox.h (238610 => 238611)


--- trunk/Source/WebCore/layout/layouttree/LayoutBox.h	2018-11-28 15:06:19 UTC (rev 238610)
+++ trunk/Source/WebCore/layout/layouttree/LayoutBox.h	2018-11-28 15:30:05 UTC (rev 238611)
@@ -45,6 +45,7 @@
     enum class ElementType {
         Document,
         Body,
+        TableCell,
         TableColumn,
         TableRow,
         TableColumnGroup,
@@ -107,6 +108,7 @@
 
     bool isDocumentBox() const { return m_elementAttributes && m_elementAttributes.value().elementType == ElementType::Document; }
     bool isBodyBox() const { return m_elementAttributes && m_elementAttributes.value().elementType == ElementType::Body; }
+    bool isTableCell() const { return m_elementAttributes && m_elementAttributes.value().elementType == ElementType::TableCell; }
 
     const Container* parent() const { return m_parent; }
     const Box* nextSibling() const { return m_nextSibling; }

Modified: trunk/Tools/ChangeLog (238610 => 238611)


--- trunk/Tools/ChangeLog	2018-11-28 15:06:19 UTC (rev 238610)
+++ trunk/Tools/ChangeLog	2018-11-28 15:30:05 UTC (rev 238611)
@@ -1,3 +1,12 @@
+2018-11-28  Zalan Bujtas  <[email protected]>
+
+        [LFC] Add support for quirk container's collapsing top margin in quirks mode.
+        https://bugs.webkit.org/show_bug.cgi?id=192070
+
+        Reviewed by Antti Koivisto.
+
+        * LayoutReloaded/misc/LFC-passing-tests.txt:
+
 2018-11-28  Thibault Saunier  <[email protected]>
 
         [WebRTC][GStreamer] Make sure to have the default microphone on the top of the list

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


--- trunk/Tools/LayoutReloaded/misc/LFC-passing-tests.txt	2018-11-28 15:06:19 UTC (rev 238610)
+++ trunk/Tools/LayoutReloaded/misc/LFC-passing-tests.txt	2018-11-28 15:30:05 UTC (rev 238611)
@@ -81,3 +81,18 @@
 fast/block/basic/height-percentage-simple.html
 fast/block/basic/child-block-level-box-with-height-percent.html
 fast/block/basic/quirk-mode-percent-height.html
+fast/block/float/001.html
+fast/block/float/007.html
+fast/block/float/008.html
+fast/block/float/009.html
+fast/block/float/013.html
+fast/block/float/019.html
+fast/block/basic/002.html
+fast/block/basic/003.html
+fast/block/basic/006.html
+fast/block/basic/007.html
+fast/block/basic/008.html
+fast/block/basic/009.html
+fast/block/basic/012.html
+fast/block/margin-collapse/002.html
+fast/block/margin-collapse/003.html
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to