Title: [185531] trunk/Source/WebCore
Revision
185531
Author
[email protected]
Date
2015-06-12 20:25:00 -0700 (Fri, 12 Jun 2015)

Log Message

Be more defensive at renderer type checking when initializing flow segments.
https://bugs.webkit.org/show_bug.cgi?id=145942

Reviewed by Simon Fraser.

FlowContents::initializeSegments should ignore unsupported renderers so that when we miss
a simple line layout path invalidation, we don't downcast the unsupported renderer to RenderText.

I have not reproduced this issue (but related to rdar://problem/21312452)

* rendering/SimpleLineLayoutFlowContents.cpp:
(WebCore::SimpleLineLayout::initializeSegments):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (185530 => 185531)


--- trunk/Source/WebCore/ChangeLog	2015-06-13 02:27:56 UTC (rev 185530)
+++ trunk/Source/WebCore/ChangeLog	2015-06-13 03:25:00 UTC (rev 185531)
@@ -1,3 +1,18 @@
+2015-06-12  Zalan Bujtas  <[email protected]>
+
+        Be more defensive at renderer type checking when initializing flow segments.
+        https://bugs.webkit.org/show_bug.cgi?id=145942
+
+        Reviewed by Simon Fraser.
+
+        FlowContents::initializeSegments should ignore unsupported renderers so that when we miss
+        a simple line layout path invalidation, we don't downcast the unsupported renderer to RenderText.
+
+        I have not reproduced this issue (but related to rdar://problem/21312452)
+
+        * rendering/SimpleLineLayoutFlowContents.cpp:
+        (WebCore::SimpleLineLayout::initializeSegments):
+
 2015-06-12  Anders Carlsson  <[email protected]>
 
         deleteEmptyDirectory should delete .DS_Store files on OS X

Modified: trunk/Source/WebCore/rendering/SimpleLineLayoutFlowContents.cpp (185530 => 185531)


--- trunk/Source/WebCore/rendering/SimpleLineLayoutFlowContents.cpp	2015-06-13 02:27:56 UTC (rev 185530)
+++ trunk/Source/WebCore/rendering/SimpleLineLayoutFlowContents.cpp	2015-06-13 03:25:00 UTC (rev 185531)
@@ -36,7 +36,6 @@
 
 static Vector<FlowContents::Segment> initializeSegments(const RenderBlockFlow& flow)
 {
-
     unsigned numberOfChildren = 0;
     auto children = childrenOfType<RenderObject>(flow);
     for (auto it = children.begin(), end = children.end(); it != end; ++it)
@@ -45,15 +44,18 @@
     segments.reserveCapacity(numberOfChildren);
     unsigned startPosition = 0;
     for (const auto& child : childrenOfType<RenderObject>(flow)) {
+        if (is<RenderText>(child)) {
+            const auto& textChild = downcast<RenderText>(child);
+            unsigned textLength = textChild.text()->length();
+            segments.append(FlowContents::Segment { startPosition, startPosition + textLength, textChild.text(), textChild });
+            startPosition += textLength;
+            continue;
+        }
         if (is<RenderLineBreak>(child)) {
             segments.append(FlowContents::Segment { startPosition, startPosition, String(), child });
             continue;
         }
-        ASSERT(is<RenderText>(child));
-        const auto& textChild = downcast<RenderText>(child);
-        unsigned textLength = textChild.text()->length();
-        segments.append(FlowContents::Segment { startPosition, startPosition + textLength, textChild.text(), textChild });
-        startPosition += textLength;
+        ASSERT_NOT_REACHED();
     }
     return segments;
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to