Title: [189793] releases/WebKitGTK/webkit-2.10
Revision
189793
Author
carlo...@webkit.org
Date
2015-09-15 01:07:01 -0700 (Tue, 15 Sep 2015)

Log Message

Merge r189594 - [New Block-Inside-Inline Model] Self-collapsing block check needs to account for anonymous inline blocks
https://bugs.webkit.org/show_bug.cgi?id=149042

Reviewed by Dean Jackson.

Source/WebCore:

Added new tests in fast/block/inside-inlines/

* rendering/InlineFlowBox.cpp:
* rendering/InlineFlowBox.h:
(WebCore::InlineFlowBox::anonymousInlineBlock):
Add a new accessor to get the anonymousInlineBlock() for lines that wrap them.

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::childrenPreventSelfCollapsing):
(WebCore::RenderBlock::isSelfCollapsingBlock):
isSelfCollapsingBlock() now calls a virtual method that checks lines/children called childrenPreventSelfCollapsing.
This lets us farm out the lines check to the derived RenderBlockFlow class.

* rendering/RenderBlock.h:
(WebCore::RenderBlock::childrenPreventSelfCollapsing):
Added new virtual method for checking children.

* rendering/RenderBlockFlow.cpp:
* rendering/RenderBlockFlow.h:
(WebCore::RenderBlockFlow::childrenPreventSelfCollapsing):
Overridden to ensure that blocks can still be self-collapsing if they only contain anonymous inline-block lines that
are also self-collapsing.

LayoutTests:

* fast/block/inside-inlines/new-model/self-collapsing-test-expected.html: Added.
* fast/block/inside-inlines/new-model/self-collapsing-test.html: Added.
* fast/block/inside-inlines/self-collapsing-test-expected.html: Added.
* fast/block/inside-inlines/self-collapsing-test.html: Added.

Modified Paths

Added Paths

Diff

Modified: releases/WebKitGTK/webkit-2.10/LayoutTests/ChangeLog (189792 => 189793)


--- releases/WebKitGTK/webkit-2.10/LayoutTests/ChangeLog	2015-09-15 07:59:43 UTC (rev 189792)
+++ releases/WebKitGTK/webkit-2.10/LayoutTests/ChangeLog	2015-09-15 08:07:01 UTC (rev 189793)
@@ -1,3 +1,15 @@
+2015-09-10  David Hyatt  <hy...@apple.com>
+
+        [New Block-Inside-Inline Model] Self-collapsing block check needs to account for anonymous inline blocks
+        https://bugs.webkit.org/show_bug.cgi?id=149042
+
+        Reviewed by Dean Jackson.
+
+        * fast/block/inside-inlines/new-model/self-collapsing-test-expected.html: Added.
+        * fast/block/inside-inlines/new-model/self-collapsing-test.html: Added.
+        * fast/block/inside-inlines/self-collapsing-test-expected.html: Added.
+        * fast/block/inside-inlines/self-collapsing-test.html: Added.
+
 2015-09-10  ChangSeok Oh  <changseok...@collabora.com>
 
         [GTK] Volume bar is broken

Added: releases/WebKitGTK/webkit-2.10/LayoutTests/fast/block/inside-inlines/new-model/self-collapsing-test-expected.html (0 => 189793)


--- releases/WebKitGTK/webkit-2.10/LayoutTests/fast/block/inside-inlines/new-model/self-collapsing-test-expected.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.10/LayoutTests/fast/block/inside-inlines/new-model/self-collapsing-test-expected.html	2015-09-15 08:07:01 UTC (rev 189793)
@@ -0,0 +1,13 @@
+<!doctype html>
+<head>
+<style>
+.margin { margin:20px 0 }
+p { margin:0 }
+span { clear:left; float:left; width:20px; height:20px; background-color:green }
+</style>
+<body>
+The two green floats should be stacked right on top of one another.
+<div>
+<span></span>
+<span></span>
+</div>
\ No newline at end of file

Added: releases/WebKitGTK/webkit-2.10/LayoutTests/fast/block/inside-inlines/new-model/self-collapsing-test.html (0 => 189793)


--- releases/WebKitGTK/webkit-2.10/LayoutTests/fast/block/inside-inlines/new-model/self-collapsing-test.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.10/LayoutTests/fast/block/inside-inlines/new-model/self-collapsing-test.html	2015-09-15 08:07:01 UTC (rev 189793)
@@ -0,0 +1,20 @@
+<!doctype html>
+<head>
+<style>
+.margin { margin:20px 0 }
+p { margin:0 }
+span { float:left; width:20px; height:20px; background-color:green }
+</style>
+<script>
+if (window.internals)
+    window.internals.settings.setNewBlockInsideInlineModelEnabled(true)
+</script>
+<body>
+The two green floats should be stacked right on top of one another.
+<p><span></span></p>
+<div class="margin">
+<i>
+<div></div>
+</i>
+</div>
+<p><span></span></p>
\ No newline at end of file

Added: releases/WebKitGTK/webkit-2.10/LayoutTests/fast/block/inside-inlines/self-collapsing-test-expected.html (0 => 189793)


--- releases/WebKitGTK/webkit-2.10/LayoutTests/fast/block/inside-inlines/self-collapsing-test-expected.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.10/LayoutTests/fast/block/inside-inlines/self-collapsing-test-expected.html	2015-09-15 08:07:01 UTC (rev 189793)
@@ -0,0 +1,13 @@
+<!doctype html>
+<head>
+<style>
+.margin { margin:20px 0 }
+p { margin:0 }
+span { clear:left; float:left; width:20px; height:20px; background-color:green }
+</style>
+<body>
+The two green floats should be stacked right on top of one another.
+<div>
+<span></span>
+<span></span>
+</div>
\ No newline at end of file

Added: releases/WebKitGTK/webkit-2.10/LayoutTests/fast/block/inside-inlines/self-collapsing-test.html (0 => 189793)


--- releases/WebKitGTK/webkit-2.10/LayoutTests/fast/block/inside-inlines/self-collapsing-test.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.10/LayoutTests/fast/block/inside-inlines/self-collapsing-test.html	2015-09-15 08:07:01 UTC (rev 189793)
@@ -0,0 +1,16 @@
+<!doctype html>
+<head>
+<style>
+.margin { margin:20px 0 }
+p { margin:0 }
+span { float:left; width:20px; height:20px; background-color:green }
+</style>
+<body>
+The two green floats should be stacked right on top of one another.
+<p><span></span></p>
+<div class="margin">
+<i>
+<div></div>
+</i>
+</div>
+<p><span></span></p>
\ No newline at end of file

Modified: releases/WebKitGTK/webkit-2.10/Source/WebCore/ChangeLog (189792 => 189793)


--- releases/WebKitGTK/webkit-2.10/Source/WebCore/ChangeLog	2015-09-15 07:59:43 UTC (rev 189792)
+++ releases/WebKitGTK/webkit-2.10/Source/WebCore/ChangeLog	2015-09-15 08:07:01 UTC (rev 189793)
@@ -1,3 +1,33 @@
+2015-09-10  David Hyatt  <hy...@apple.com>
+
+        [New Block-Inside-Inline Model] Self-collapsing block check needs to account for anonymous inline blocks
+        https://bugs.webkit.org/show_bug.cgi?id=149042
+
+        Reviewed by Dean Jackson.
+
+        Added new tests in fast/block/inside-inlines/
+
+        * rendering/InlineFlowBox.cpp:
+        * rendering/InlineFlowBox.h:
+        (WebCore::InlineFlowBox::anonymousInlineBlock):
+        Add a new accessor to get the anonymousInlineBlock() for lines that wrap them.
+
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::childrenPreventSelfCollapsing):
+        (WebCore::RenderBlock::isSelfCollapsingBlock):
+        isSelfCollapsingBlock() now calls a virtual method that checks lines/children called childrenPreventSelfCollapsing.
+        This lets us farm out the lines check to the derived RenderBlockFlow class.
+
+        * rendering/RenderBlock.h:
+        (WebCore::RenderBlock::childrenPreventSelfCollapsing):
+        Added new virtual method for checking children.
+
+        * rendering/RenderBlockFlow.cpp:
+        * rendering/RenderBlockFlow.h:
+        (WebCore::RenderBlockFlow::childrenPreventSelfCollapsing):
+        Overridden to ensure that blocks can still be self-collapsing if they only contain anonymous inline-block lines that
+        are also self-collapsing.
+
 2015-09-10  Jinyoung Hur  <hur....@navercorp.com>
 
         [WebGL][GLES] bad shaders should not be linked not only for GL but also for GL ES

Modified: releases/WebKitGTK/webkit-2.10/Source/WebCore/rendering/InlineFlowBox.cpp (189792 => 189793)


--- releases/WebKitGTK/webkit-2.10/Source/WebCore/rendering/InlineFlowBox.cpp	2015-09-15 07:59:43 UTC (rev 189792)
+++ releases/WebKitGTK/webkit-2.10/Source/WebCore/rendering/InlineFlowBox.cpp	2015-09-15 08:07:01 UTC (rev 189793)
@@ -69,6 +69,11 @@
 
 #endif
 
+RenderBlockFlow* InlineFlowBox::anonymousInlineBlock() const
+{
+    return m_hasAnonymousInlineBlock ? &downcast<RenderBlockFlow>(firstChild()->renderer()) : nullptr;
+}
+
 LayoutUnit InlineFlowBox::getFlowSpacingLogicalWidth()
 {
     LayoutUnit totalWidth = marginBorderPaddingLogicalLeft() + marginBorderPaddingLogicalRight();

Modified: releases/WebKitGTK/webkit-2.10/Source/WebCore/rendering/InlineFlowBox.h (189792 => 189793)


--- releases/WebKitGTK/webkit-2.10/Source/WebCore/rendering/InlineFlowBox.h	2015-09-15 07:59:43 UTC (rev 189792)
+++ releases/WebKitGTK/webkit-2.10/Source/WebCore/rendering/InlineFlowBox.h	2015-09-15 08:07:01 UTC (rev 189793)
@@ -214,7 +214,8 @@
     
     bool hasAnonymousInlineBlock() const { return m_hasAnonymousInlineBlock; }
     void setHasAnonymousInlineBlock(bool b) { m_hasAnonymousInlineBlock = b; }
-
+    RenderBlockFlow* anonymousInlineBlock() const;
+    
     void checkConsistency() const;
     void setHasBadChildList();
 

Modified: releases/WebKitGTK/webkit-2.10/Source/WebCore/rendering/RenderBlock.cpp (189792 => 189793)


--- releases/WebKitGTK/webkit-2.10/Source/WebCore/rendering/RenderBlock.cpp	2015-09-15 07:59:43 UTC (rev 189792)
+++ releases/WebKitGTK/webkit-2.10/Source/WebCore/rendering/RenderBlock.cpp	2015-09-15 08:07:01 UTC (rev 189793)
@@ -795,6 +795,19 @@
     }
 }
 
+bool RenderBlock::childrenPreventSelfCollapsing() const
+{
+    // Whether or not we collapse is dependent on whether all our normal flow children
+    // are also self-collapsing.
+    for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBox()) {
+        if (child->isFloatingOrOutOfFlowPositioned())
+            continue;
+        if (!child->isSelfCollapsingBlock())
+            return true;
+    }
+    return false;
+}
+
 bool RenderBlock::isSelfCollapsingBlock() const
 {
     // We are not self-collapsing if we
@@ -821,22 +834,9 @@
 
     // If the height is 0 or auto, then whether or not we are a self-collapsing block depends
     // on whether we have content that is all self-collapsing or not.
-    if (hasAutoHeight || ((logicalHeightLength.isFixed() || logicalHeightLength.isPercentOrCalculated()) && logicalHeightLength.isZero())) {
-        // If the block has inline children, see if we generated any line boxes.  If we have any
-        // line boxes, then we can't be self-collapsing, since we have content.
-        if (childrenInline())
-            return !hasLines();
-        
-        // Whether or not we collapse is dependent on whether all our normal flow children
-        // are also self-collapsing.
-        for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBox()) {
-            if (child->isFloatingOrOutOfFlowPositioned())
-                continue;
-            if (!child->isSelfCollapsingBlock())
-                return false;
-        }
-        return true;
-    }
+    if (hasAutoHeight || ((logicalHeightLength.isFixed() || logicalHeightLength.isPercentOrCalculated()) && logicalHeightLength.isZero()))
+        return !childrenPreventSelfCollapsing();
+
     return false;
 }
 

Modified: releases/WebKitGTK/webkit-2.10/Source/WebCore/rendering/RenderBlock.h (189792 => 189793)


--- releases/WebKitGTK/webkit-2.10/Source/WebCore/rendering/RenderBlock.h	2015-09-15 07:59:43 UTC (rev 189792)
+++ releases/WebKitGTK/webkit-2.10/Source/WebCore/rendering/RenderBlock.h	2015-09-15 08:07:01 UTC (rev 189793)
@@ -413,7 +413,9 @@
     void addChildToContinuation(RenderObject* newChild, RenderObject* beforeChild);
     virtual void addChildIgnoringContinuation(RenderObject* newChild, RenderObject* beforeChild) override;
 
-    virtual bool isSelfCollapsingBlock() const override final;
+    virtual bool isSelfCollapsingBlock() const override;
+    virtual bool childrenPreventSelfCollapsing() const;
+    
     // FIXME-BLOCKFLOW: Remove virtualizaion when all callers have moved to RenderBlockFlow
     virtual bool hasLines() const { return false; }
 

Modified: releases/WebKitGTK/webkit-2.10/Source/WebCore/rendering/RenderBlockFlow.cpp (189792 => 189793)


--- releases/WebKitGTK/webkit-2.10/Source/WebCore/rendering/RenderBlockFlow.cpp	2015-09-15 07:59:43 UTC (rev 189792)
+++ releases/WebKitGTK/webkit-2.10/Source/WebCore/rendering/RenderBlockFlow.cpp	2015-09-15 08:07:01 UTC (rev 189793)
@@ -944,6 +944,27 @@
     return MarginValues(childBeforePositive, childBeforeNegative, childAfterPositive, childAfterNegative);
 }
 
+bool RenderBlockFlow::childrenPreventSelfCollapsing() const
+{
+    if (!childrenInline())
+        return RenderBlock::childrenPreventSelfCollapsing();
+
+    // If the block has inline children, see if we generated any line boxes. If we have any
+    // line boxes, then we can only be self-collapsing if we have nothing but anonymous inline blocks
+    // that are also self-collapsing inside us.
+    if (!hasLines())
+        return false;
+    
+    if (simpleLineLayout())
+        return true; // We have simple line layout lines, so we can't be self-collapsing.
+    
+    for (auto* child = firstRootBox(); child; child = child->nextRootBox()) {
+        if (!child->hasAnonymousInlineBlock() || !child->anonymousInlineBlock()->isSelfCollapsingBlock())
+            return true;
+    }
+    return false; // We have no line boxes, so we must be self-collapsing.
+}
+
 LayoutUnit RenderBlockFlow::collapseMargins(RenderBox& child, MarginInfo& marginInfo)
 {
     bool childDiscardMarginBefore = mustDiscardMarginBeforeForChild(child);

Modified: releases/WebKitGTK/webkit-2.10/Source/WebCore/rendering/RenderBlockFlow.h (189792 => 189793)


--- releases/WebKitGTK/webkit-2.10/Source/WebCore/rendering/RenderBlockFlow.h	2015-09-15 07:59:43 UTC (rev 189792)
+++ releases/WebKitGTK/webkit-2.10/Source/WebCore/rendering/RenderBlockFlow.h	2015-09-15 08:07:01 UTC (rev 189793)
@@ -255,6 +255,8 @@
     void handleAfterSideOfBlock(LayoutUnit top, LayoutUnit bottom, MarginInfo&);
     void setCollapsedBottomMargin(const MarginInfo&);
 
+    virtual bool childrenPreventSelfCollapsing() const override final;
+
     bool shouldBreakAtLineToAvoidWidow() const { return hasRareBlockFlowData() && rareBlockFlowData()->m_lineBreakToAvoidWidow >= 0; }
     void clearShouldBreakAtLineToAvoidWidow() const;
     int lineBreakToAvoidWidow() const { return hasRareBlockFlowData() ? rareBlockFlowData()->m_lineBreakToAvoidWidow : -1; }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to