Title: [207631] trunk
Revision
207631
Author
[email protected]
Date
2016-10-20 12:15:59 -0700 (Thu, 20 Oct 2016)

Log Message

Stop searching for first-letter containers at multi-column boundary.
https://bugs.webkit.org/show_bug.cgi?id=163739
<rdar://problem/28810750>

Source/WebCore:

We should not cross the multi-column boundary while searching for the first-letter container.
While moving first-letter renderers to a multi-column parent, it could result in finding the wrong
container and end up adding a new wrapper under the original container (from where we are moving the renderers).

Reviewed by David Hyatt.

Test: fast/css-generated-content/first-letter-move-to-multicolumn-crash.html

* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::moveChildrenTo):
* rendering/RenderTextFragment.cpp:
(WebCore::RenderTextFragment::blockForAccompanyingFirstLetter):

LayoutTests:

Reviewed by David Hyatt.

* fast/css-generated-content/first-letter-move-to-multicolumn-crash-expected.txt: Added.
* fast/css-generated-content/first-letter-move-to-multicolumn-crash.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (207630 => 207631)


--- trunk/LayoutTests/ChangeLog	2016-10-20 19:09:30 UTC (rev 207630)
+++ trunk/LayoutTests/ChangeLog	2016-10-20 19:15:59 UTC (rev 207631)
@@ -1,3 +1,14 @@
+2016-10-20  Zalan Bujtas  <[email protected]>
+
+        Stop searching for first-letter containers at multi-column boundary.
+        https://bugs.webkit.org/show_bug.cgi?id=163739
+        <rdar://problem/28810750>
+
+        Reviewed by David Hyatt.
+
+        * fast/css-generated-content/first-letter-move-to-multicolumn-crash-expected.txt: Added.
+        * fast/css-generated-content/first-letter-move-to-multicolumn-crash.html: Added.
+
 2016-10-19  Dean Jackson  <[email protected]>
 
         Support CSS Shapes Level 1 without a prefix

Added: trunk/LayoutTests/fast/css-generated-content/first-letter-move-to-multicolumn-crash-expected.txt (0 => 207631)


--- trunk/LayoutTests/fast/css-generated-content/first-letter-move-to-multicolumn-crash-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/css-generated-content/first-letter-move-to-multicolumn-crash-expected.txt	2016-10-20 19:15:59 UTC (rev 207631)
@@ -0,0 +1,2 @@
+PASS if no crash or ASSERT.
+f

Added: trunk/LayoutTests/fast/css-generated-content/first-letter-move-to-multicolumn-crash.html (0 => 207631)


--- trunk/LayoutTests/fast/css-generated-content/first-letter-move-to-multicolumn-crash.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css-generated-content/first-letter-move-to-multicolumn-crash.html	2016-10-20 19:15:59 UTC (rev 207631)
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests that we can move first-letter elements to column content and back.</title>
+<style>
+.original::first-letter{ 
+    -webkit-columns: 2;
+}
+.newClass::first-letter{
+    float: left;
+}
+</style>
+<script>
+if (window.testRunner)
+    testRunner.dumpAsText();
+
+function runTest() {
+    li.style.webkitColumns = "2";
+    li.offsetParent;
+
+    li.className = "newClass";
+    li.style.cssText = "letter-spacing: 10px;"
+    li.offsetParent;
+
+    li.style.webkitColumns = "2";
+    li.offsetParent;
+}
+</script>
+</head>
+<body _onload_="runTest()">
+PASS if no crash or ASSERT.
+<li class=original id="li">f<script></script>
+</li>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (207630 => 207631)


--- trunk/Source/WebCore/ChangeLog	2016-10-20 19:09:30 UTC (rev 207630)
+++ trunk/Source/WebCore/ChangeLog	2016-10-20 19:15:59 UTC (rev 207631)
@@ -1,3 +1,22 @@
+2016-10-20  Zalan Bujtas  <[email protected]>
+
+        Stop searching for first-letter containers at multi-column boundary.
+        https://bugs.webkit.org/show_bug.cgi?id=163739
+        <rdar://problem/28810750>
+
+        We should not cross the multi-column boundary while searching for the first-letter container.
+        While moving first-letter renderers to a multi-column parent, it could result in finding the wrong
+        container and end up adding a new wrapper under the original container (from where we are moving the renderers).    
+
+        Reviewed by David Hyatt.
+
+        Test: fast/css-generated-content/first-letter-move-to-multicolumn-crash.html
+
+        * rendering/RenderBoxModelObject.cpp:
+        (WebCore::RenderBoxModelObject::moveChildrenTo):
+        * rendering/RenderTextFragment.cpp:
+        (WebCore::RenderTextFragment::blockForAccompanyingFirstLetter):
+
 2016-10-19  Dean Jackson  <[email protected]>
 
         Support CSS Shapes Level 1 without a prefix

Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp (207630 => 207631)


--- trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp	2016-10-20 19:09:30 UTC (rev 207630)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp	2016-10-20 19:15:59 UTC (rev 207631)
@@ -2529,9 +2529,11 @@
         // Save our next sibling as moveChildTo will clear it.
         RenderObject* nextSibling = child->nextSibling();
         
+        // FIXME: This logic here fails to detect the first letter in certain cases
+        // and skips a valid sibling renderer (see webkit.org/b/163737).
         // Check to make sure we're not saving the firstLetter as the nextSibling.
         // When the |child| object will be moved, its firstLetter will be recreated,
-        // so saving it now in nextSibling would let us with a destroyed object.
+        // so saving it now in nextSibling would leave us with a stale object.
         if (is<RenderTextFragment>(*child) && is<RenderText>(nextSibling)) {
             RenderObject* firstLetterObj = nullptr;
             if (RenderBlock* block = downcast<RenderTextFragment>(*child).blockForAccompanyingFirstLetter()) {

Modified: trunk/Source/WebCore/rendering/RenderTextFragment.cpp (207630 => 207631)


--- trunk/Source/WebCore/rendering/RenderTextFragment.cpp	2016-10-20 19:09:30 UTC (rev 207630)
+++ trunk/Source/WebCore/rendering/RenderTextFragment.cpp	2016-10-20 19:15:59 UTC (rev 207631)
@@ -25,6 +25,7 @@
 
 #include "RenderBlock.h"
 #include "RenderIterator.h"
+#include "RenderMultiColumnFlowThread.h"
 #include "Text.h"
 
 namespace WebCore {
@@ -112,6 +113,8 @@
     if (!m_firstLetter)
         return nullptr;
     for (auto& block : ancestorsOfType<RenderBlock>(*m_firstLetter)) {
+        if (is<RenderMultiColumnFlowThread>(block))
+            break;
         if (block.style().hasPseudoStyle(FIRST_LETTER) && block.canHaveChildren())
             return &block;
     }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to