Title: [214995] releases/WebKitGTK/webkit-2.14
Revision
214995
Author
[email protected]
Date
2017-04-05 23:59:03 -0700 (Wed, 05 Apr 2017)

Log Message

Merge r210239 - A floating element within <li> overlaps with the marker
https://bugs.webkit.org/show_bug.cgi?id=166528

Reviewed by Zalan Bujtas.

Source/WebCore:

Merged from Blink (patch by [email protected]):
https://crrev.com/c896e79e5ba348d7ed87438cd3a19d0176f3036d
https://crbug.com/548616

Establish a list marker's offset before floats have been added to its line.

Computing the offset for a list marker after the rest of the objects on the line
it is on have been laid out, means it will avoid floats it ought not to.

Instead, compute the offset when laying out the marker and cache it for use later.

Tests: fast/lists/list-marker-before-float-nested-rtl.html
       fast/lists/list-marker-before-float-nested.html
       fast/lists/list-marker-before-float-rtl.html
       fast/lists/list-marker-before-float.html

* rendering/RenderListItem.cpp:
(WebCore::RenderListItem::positionListMarker):
* rendering/RenderListMarker.cpp:
(WebCore::RenderListMarker::RenderListMarker):
(WebCore::RenderListMarker::layout):
* rendering/RenderListMarker.h:

LayoutTests:

* fast/lists/list-marker-before-float-expected.html: Added.
* fast/lists/list-marker-before-float-nested-expected.html: Added.
* fast/lists/list-marker-before-float-nested-rtl-expected.html: Added.
* fast/lists/list-marker-before-float-nested-rtl.html: Added.
* fast/lists/list-marker-before-float-nested.html: Added.
* fast/lists/list-marker-before-float-rtl-expected.html: Added.
* fast/lists/list-marker-before-float-rtl.html: Added.
* fast/lists/list-marker-before-float.html: Added.

Modified Paths

Added Paths

Diff

Modified: releases/WebKitGTK/webkit-2.14/LayoutTests/ChangeLog (214994 => 214995)


--- releases/WebKitGTK/webkit-2.14/LayoutTests/ChangeLog	2017-04-06 06:37:16 UTC (rev 214994)
+++ releases/WebKitGTK/webkit-2.14/LayoutTests/ChangeLog	2017-04-06 06:59:03 UTC (rev 214995)
@@ -1,3 +1,19 @@
+2017-01-03  Carlos Alberto Lopez Perez  <[email protected]>
+
+        A floating element within <li> overlaps with the marker
+        https://bugs.webkit.org/show_bug.cgi?id=166528
+
+        Reviewed by Zalan Bujtas.
+
+        * fast/lists/list-marker-before-float-expected.html: Added.
+        * fast/lists/list-marker-before-float-nested-expected.html: Added.
+        * fast/lists/list-marker-before-float-nested-rtl-expected.html: Added.
+        * fast/lists/list-marker-before-float-nested-rtl.html: Added.
+        * fast/lists/list-marker-before-float-nested.html: Added.
+        * fast/lists/list-marker-before-float-rtl-expected.html: Added.
+        * fast/lists/list-marker-before-float-rtl.html: Added.
+        * fast/lists/list-marker-before-float.html: Added.
+
 2016-12-09  Daniel Bates  <[email protected]>
 
         [CSP] Policy of window opener not applied to about:blank window

Added: releases/WebKitGTK/webkit-2.14/LayoutTests/fast/lists/list-marker-before-float-expected.html (0 => 214995)


--- releases/WebKitGTK/webkit-2.14/LayoutTests/fast/lists/list-marker-before-float-expected.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.14/LayoutTests/fast/lists/list-marker-before-float-expected.html	2017-04-06 06:59:03 UTC (rev 214995)
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<p>webkit.org/b/166528: List markers shouldn't shift to avoid floats that come after them on a line.</p>
+<ol>
+  <li>
+    <img width=20 height=20 style="background-color:black;"><img width=20 height=20 style="background-color:black;">
+  </li>
+</ol>
+

Added: releases/WebKitGTK/webkit-2.14/LayoutTests/fast/lists/list-marker-before-float-nested-expected.html (0 => 214995)


--- releases/WebKitGTK/webkit-2.14/LayoutTests/fast/lists/list-marker-before-float-nested-expected.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.14/LayoutTests/fast/lists/list-marker-before-float-nested-expected.html	2017-04-06 06:59:03 UTC (rev 214995)
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<p>webkit.org/b/166528: List markers shouldn't shift to avoid floats that come after them on a line.</p>
+<ol>
+  <li>
+    <img width=20 height=20 style="background-color:black;"><img width=20 height=20 style="background-color:black;">
+    <li>
+      <img width=20 height=20 style="background-color:black;"><img width=20 height=20 style="background-color:black;">
+    </li>
+  </li>
+  <li>
+    <img width=20 height=20 style="background-color:black;"><img width=20 height=20 style="background-color:black;">
+  </li>
+</ol>
+

Added: releases/WebKitGTK/webkit-2.14/LayoutTests/fast/lists/list-marker-before-float-nested-rtl-expected.html (0 => 214995)


--- releases/WebKitGTK/webkit-2.14/LayoutTests/fast/lists/list-marker-before-float-nested-rtl-expected.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.14/LayoutTests/fast/lists/list-marker-before-float-nested-rtl-expected.html	2017-04-06 06:59:03 UTC (rev 214995)
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<p>webkit.org/b/166528: List markers shouldn't shift to avoid floats that come after them on a line.</p>
+<ol dir=rtl>
+  <li>
+    <img width=20 height=20 style="background-color:black;"><img width=20 height=20 style="background-color:black;">
+    <li>
+      <img width=20 height=20 style="background-color:black;"><img width=20 height=20 style="background-color:black;">
+    </li>
+  </li>
+  <li>
+    <img width=20 height=20 style="background-color:black;"><img width=20 height=20 style="background-color:black;">
+  </li>
+</ol>
+

Added: releases/WebKitGTK/webkit-2.14/LayoutTests/fast/lists/list-marker-before-float-nested-rtl.html (0 => 214995)


--- releases/WebKitGTK/webkit-2.14/LayoutTests/fast/lists/list-marker-before-float-nested-rtl.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.14/LayoutTests/fast/lists/list-marker-before-float-nested-rtl.html	2017-04-06 06:59:03 UTC (rev 214995)
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<p>webkit.org/b/166528: List markers shouldn't shift to avoid floats that come after them on a line.</p>
+<ol dir=rtl>
+  <li>
+    <img width=20 height=20 style="float: right; background-color:black;"><img width=20 height=20 style="background-color:black;">
+    <li>
+      <img width=20 height=20 style="float: right; background-color:black;"><img width=20 height=20 style="background-color:black;">
+    </li>
+  </li>
+  <li>
+    <img width=20 height=20 style="float: right; background-color:black;"><img width=20 height=20 style="background-color:black;">
+  </li>
+</ol>
+

Added: releases/WebKitGTK/webkit-2.14/LayoutTests/fast/lists/list-marker-before-float-nested.html (0 => 214995)


--- releases/WebKitGTK/webkit-2.14/LayoutTests/fast/lists/list-marker-before-float-nested.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.14/LayoutTests/fast/lists/list-marker-before-float-nested.html	2017-04-06 06:59:03 UTC (rev 214995)
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<p>webkit.org/b/166528: List markers shouldn't shift to avoid floats that come after them on a line.</p>
+<ol>
+  <li>
+    <img width=20 height=20 style="float: left; background-color:black;"><img width=20 height=20 style="background-color:black;">
+    <li>
+      <img width=20 height=20 style="float: left; background-color:black;"><img width=20 height=20 style="background-color:black;">
+    </li>
+  </li>
+  <li>
+    <img width=20 height=20 style="float: left; background-color:black;"><img width=20 height=20 style="background-color:black;">
+  </li>
+</ol>
+

Added: releases/WebKitGTK/webkit-2.14/LayoutTests/fast/lists/list-marker-before-float-rtl-expected.html (0 => 214995)


--- releases/WebKitGTK/webkit-2.14/LayoutTests/fast/lists/list-marker-before-float-rtl-expected.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.14/LayoutTests/fast/lists/list-marker-before-float-rtl-expected.html	2017-04-06 06:59:03 UTC (rev 214995)
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<p>webkit.org/b/166528: List markers shouldn't shift to avoid floats that come after them on a line.</p>
+<ol dir=rtl>
+  <li>
+    <img width=20 height=20 style="background-color:black;"><img width=20 height=20 style="background-color:black;">
+  </li>
+</ol>
+

Added: releases/WebKitGTK/webkit-2.14/LayoutTests/fast/lists/list-marker-before-float-rtl.html (0 => 214995)


--- releases/WebKitGTK/webkit-2.14/LayoutTests/fast/lists/list-marker-before-float-rtl.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.14/LayoutTests/fast/lists/list-marker-before-float-rtl.html	2017-04-06 06:59:03 UTC (rev 214995)
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<p>webkit.org/b/166528: List markers shouldn't shift to avoid floats that come after them on a line.</p>
+<ol dir=rtl>
+  <li>
+    <img width=20 height=20 style="float: right; background-color:black;"><img width=20 height=20 style="background-color:black;">
+  </li>
+</ol>
+

Added: releases/WebKitGTK/webkit-2.14/LayoutTests/fast/lists/list-marker-before-float.html (0 => 214995)


--- releases/WebKitGTK/webkit-2.14/LayoutTests/fast/lists/list-marker-before-float.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.14/LayoutTests/fast/lists/list-marker-before-float.html	2017-04-06 06:59:03 UTC (rev 214995)
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<p>webkit.org/b/166528: List markers shouldn't shift to avoid floats that come after them on a line.</p>
+<ol>
+  <li>
+    <img width=20 height=20 style="float: left; background-color:black;"><img width=20 height=20 style="background-color:black;">
+  </li>
+</ol>
+

Modified: releases/WebKitGTK/webkit-2.14/Source/WebCore/ChangeLog (214994 => 214995)


--- releases/WebKitGTK/webkit-2.14/Source/WebCore/ChangeLog	2017-04-06 06:37:16 UTC (rev 214994)
+++ releases/WebKitGTK/webkit-2.14/Source/WebCore/ChangeLog	2017-04-06 06:59:03 UTC (rev 214995)
@@ -1,3 +1,33 @@
+2017-01-03  Carlos Alberto Lopez Perez  <[email protected]>
+
+        A floating element within <li> overlaps with the marker
+        https://bugs.webkit.org/show_bug.cgi?id=166528
+
+        Reviewed by Zalan Bujtas.
+
+        Merged from Blink (patch by [email protected]):
+        https://crrev.com/c896e79e5ba348d7ed87438cd3a19d0176f3036d
+        https://crbug.com/548616
+
+        Establish a list marker's offset before floats have been added to its line.
+
+        Computing the offset for a list marker after the rest of the objects on the line
+        it is on have been laid out, means it will avoid floats it ought not to.
+
+        Instead, compute the offset when laying out the marker and cache it for use later.
+
+        Tests: fast/lists/list-marker-before-float-nested-rtl.html
+               fast/lists/list-marker-before-float-nested.html
+               fast/lists/list-marker-before-float-rtl.html
+               fast/lists/list-marker-before-float.html
+
+        * rendering/RenderListItem.cpp:
+        (WebCore::RenderListItem::positionListMarker):
+        * rendering/RenderListMarker.cpp:
+        (WebCore::RenderListMarker::RenderListMarker):
+        (WebCore::RenderListMarker::layout):
+        * rendering/RenderListMarker.h:
+
 2016-12-09  Daniel Bates  <[email protected]>
 
         [CSP] Policy of window opener not applied to about:blank window

Modified: releases/WebKitGTK/webkit-2.14/Source/WebCore/rendering/RenderListItem.cpp (214994 => 214995)


--- releases/WebKitGTK/webkit-2.14/Source/WebCore/rendering/RenderListItem.cpp	2017-04-06 06:37:16 UTC (rev 214994)
+++ releases/WebKitGTK/webkit-2.14/Source/WebCore/rendering/RenderListItem.cpp	2017-04-06 06:59:03 UTC (rev 214995)
@@ -356,8 +356,7 @@
 
         // FIXME: Need to account for relative positioning in the layout overflow.
         if (style().isLeftToRightDirection()) {
-            LayoutUnit leftLineOffset = logicalLeftOffsetForLine(blockOffset, logicalLeftOffsetForLine(blockOffset, DoNotIndentText), false);
-            markerLogicalLeft = leftLineOffset - lineOffset - paddingStart() - borderStart() + m_marker->marginStart();
+            markerLogicalLeft = m_marker->lineOffsetForListItem() - lineOffset - paddingStart() - borderStart() + m_marker->marginStart();
             m_marker->inlineBoxWrapper()->adjustLineDirectionPosition(markerLogicalLeft - markerOldLogicalLeft);
             for (InlineFlowBox* box = m_marker->inlineBoxWrapper()->parent(); box; box = box->parent()) {
                 LayoutRect newLogicalVisualOverflowRect = box->logicalVisualOverflowRect(lineTop, lineBottom);
@@ -379,8 +378,7 @@
                     hitSelfPaintingLayer = true;
             }
         } else {
-            LayoutUnit rightLineOffset = logicalRightOffsetForLine(blockOffset, logicalRightOffsetForLine(blockOffset, DoNotIndentText), false);
-            markerLogicalLeft = rightLineOffset - lineOffset + paddingStart() + borderStart() + m_marker->marginEnd();
+            markerLogicalLeft = m_marker->lineOffsetForListItem() - lineOffset + paddingStart() + borderStart() + m_marker->marginEnd();
             m_marker->inlineBoxWrapper()->adjustLineDirectionPosition(markerLogicalLeft - markerOldLogicalLeft);
             for (InlineFlowBox* box = m_marker->inlineBoxWrapper()->parent(); box; box = box->parent()) {
                 LayoutRect newLogicalVisualOverflowRect = box->logicalVisualOverflowRect(lineTop, lineBottom);

Modified: releases/WebKitGTK/webkit-2.14/Source/WebCore/rendering/RenderListMarker.cpp (214994 => 214995)


--- releases/WebKitGTK/webkit-2.14/Source/WebCore/rendering/RenderListMarker.cpp	2017-04-06 06:37:16 UTC (rev 214994)
+++ releases/WebKitGTK/webkit-2.14/Source/WebCore/rendering/RenderListMarker.cpp	2017-04-06 06:59:03 UTC (rev 214995)
@@ -1370,6 +1370,14 @@
 {
     StackStats::LayoutCheckPoint layoutCheckPoint;
     ASSERT(needsLayout());
+
+    LayoutUnit blockOffset;
+    for (auto* box = parentBox(); box && box != &m_listItem; box = box->parentBox())
+        blockOffset += box->logicalTop();
+    if (style().isLeftToRightDirection())
+        m_lineOffsetForListItem = m_listItem.logicalLeftOffsetForLine(blockOffset, DoNotIndentText, LayoutUnit());
+    else
+        m_lineOffsetForListItem = m_listItem.logicalRightOffsetForLine(blockOffset, DoNotIndentText, LayoutUnit());
  
     if (isImage()) {
         updateMarginsAndContent();

Modified: releases/WebKitGTK/webkit-2.14/Source/WebCore/rendering/RenderListMarker.h (214994 => 214995)


--- releases/WebKitGTK/webkit-2.14/Source/WebCore/rendering/RenderListMarker.h	2017-04-06 06:37:16 UTC (rev 214994)
+++ releases/WebKitGTK/webkit-2.14/Source/WebCore/rendering/RenderListMarker.h	2017-04-06 06:59:03 UTC (rev 214995)
@@ -43,6 +43,8 @@
 
     bool isInside() const;
 
+    LayoutUnit lineOffsetForListItem() const { return m_lineOffsetForListItem; }
+
     void updateMarginsAndContent();
 
 private:
@@ -83,6 +85,7 @@
     String m_text;
     RefPtr<StyleImage> m_image;
     RenderListItem& m_listItem;
+    LayoutUnit m_lineOffsetForListItem;
 };
 
 } // namespace WebCore
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to