Title: [242919] trunk
Revision
242919
Author
[email protected]
Date
2019-03-13 16:36:02 -0700 (Wed, 13 Mar 2019)

Log Message

Use RenderBox::previousSiblingBox/nextSiblingBox in RenderMultiColumnFlow
https://bugs.webkit.org/show_bug.cgi?id=195701
<rdar://problem/48448658>

Reviewed by Simon Fraser.

Source/WebCore:

It's safer to use existing RenderBox functions to get sibling boxes.

Test: fast/ruby/crash-when-paginated-ruby.html

* rendering/RenderMultiColumnFlow.cpp:
(WebCore::RenderMultiColumnFlow::nextColumnSetOrSpannerSiblingOf):
(WebCore::RenderMultiColumnFlow::previousColumnSetOrSpannerSiblingOf):

LayoutTests:

* fast/ruby/crash-when-paginated-ruby-expected.txt: Added.
* fast/ruby/crash-when-paginated-ruby.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (242918 => 242919)


--- trunk/LayoutTests/ChangeLog	2019-03-13 23:24:19 UTC (rev 242918)
+++ trunk/LayoutTests/ChangeLog	2019-03-13 23:36:02 UTC (rev 242919)
@@ -1,3 +1,14 @@
+2019-03-13  Zalan Bujtas  <[email protected]>
+
+        Use RenderBox::previousSiblingBox/nextSiblingBox in RenderMultiColumnFlow
+        https://bugs.webkit.org/show_bug.cgi?id=195701
+        <rdar://problem/48448658>
+
+        Reviewed by Simon Fraser.
+
+        * fast/ruby/crash-when-paginated-ruby-expected.txt: Added.
+        * fast/ruby/crash-when-paginated-ruby.html: Added.
+
 2019-03-13  Wenson Hsieh  <[email protected]>
 
         Fix an edge case where HTMLFormElement::removeFormElement is invoked twice with the same element

Added: trunk/LayoutTests/fast/ruby/crash-when-paginated-ruby-expected.txt (0 => 242919)


--- trunk/LayoutTests/fast/ruby/crash-when-paginated-ruby-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/ruby/crash-when-paginated-ruby-expected.txt	2019-03-13 23:36:02 UTC (rev 242919)
@@ -0,0 +1 @@
+click me Pass if no crash.

Added: trunk/LayoutTests/fast/ruby/crash-when-paginated-ruby.html (0 => 242919)


--- trunk/LayoutTests/fast/ruby/crash-when-paginated-ruby.html	                        (rev 0)
+++ trunk/LayoutTests/fast/ruby/crash-when-paginated-ruby.html	2019-03-13 23:36:02 UTC (rev 242919)
@@ -0,0 +1,16 @@
+<style>
+ruby {
+    float:left;
+    column-count: 2;
+}
+</style>		
+<ruby id=ruby>content</ruby>
+Pass if no crash.
+<script>
+if (window.testRunner)
+    testRunner.dumpAsText();
+document.body.offsetHeight;
+ruby.innerHTML="<button>click me</button>";	
+styleSheet = document.styleSheets[0];
+styleSheet.addRule('#ruby::before','content: counter(coun2)');
+</script>

Modified: trunk/LayoutTests/platform/mac/TestExpectations (242918 => 242919)


--- trunk/LayoutTests/platform/mac/TestExpectations	2019-03-13 23:24:19 UTC (rev 242918)
+++ trunk/LayoutTests/platform/mac/TestExpectations	2019-03-13 23:36:02 UTC (rev 242919)
@@ -152,6 +152,7 @@
 
 # Asserts in debug.
 [ Debug ] fast/images/large-size-image-crash.html [ Skip ]
+[ Debug ] fast/ruby/crash-when-paginated-ruby.html [ Skip ]
 
 webkit.org/b/188061 [ Debug ] webgl/2.0.0/conformance2/glsl3/compound-assignment-type-combination.html [ Slow ]
 

Modified: trunk/Source/WebCore/ChangeLog (242918 => 242919)


--- trunk/Source/WebCore/ChangeLog	2019-03-13 23:24:19 UTC (rev 242918)
+++ trunk/Source/WebCore/ChangeLog	2019-03-13 23:36:02 UTC (rev 242919)
@@ -1,3 +1,19 @@
+2019-03-13  Zalan Bujtas  <[email protected]>
+
+        Use RenderBox::previousSiblingBox/nextSiblingBox in RenderMultiColumnFlow
+        https://bugs.webkit.org/show_bug.cgi?id=195701
+        <rdar://problem/48448658>
+
+        Reviewed by Simon Fraser.
+
+        It's safer to use existing RenderBox functions to get sibling boxes.
+
+        Test: fast/ruby/crash-when-paginated-ruby.html
+
+        * rendering/RenderMultiColumnFlow.cpp:
+        (WebCore::RenderMultiColumnFlow::nextColumnSetOrSpannerSiblingOf):
+        (WebCore::RenderMultiColumnFlow::previousColumnSetOrSpannerSiblingOf):
+
 2019-03-13  Keith Rollin  <[email protected]>
 
         Add support for new StagedFrameworks layout

Modified: trunk/Source/WebCore/rendering/RenderMultiColumnFlow.cpp (242918 => 242919)


--- trunk/Source/WebCore/rendering/RenderMultiColumnFlow.cpp	2019-03-13 23:24:19 UTC (rev 242918)
+++ trunk/Source/WebCore/rendering/RenderMultiColumnFlow.cpp	2019-03-13 23:36:02 UTC (rev 242919)
@@ -93,11 +93,7 @@
 
 RenderBox* RenderMultiColumnFlow::nextColumnSetOrSpannerSiblingOf(const RenderBox* child)
 {
-    if (!child)
-        return nullptr;
-    if (RenderObject* sibling = child->nextSibling())
-        return downcast<RenderBox>(sibling);
-    return nullptr;
+    return child ? child->nextSiblingBox() : nullptr;
 }
 
 RenderBox* RenderMultiColumnFlow::previousColumnSetOrSpannerSiblingOf(const RenderBox* child)
@@ -104,10 +100,9 @@
 {
     if (!child)
         return nullptr;
-    if (RenderObject* sibling = child->previousSibling()) {
-        if (is<RenderFragmentedFlow>(*sibling))
-            return nullptr;
-        return downcast<RenderBox>(sibling);
+    if (auto* sibling = child->previousSiblingBox()) {
+        if (!is<RenderFragmentedFlow>(*sibling))
+            return sibling;
     }
     return nullptr;
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to