Title: [168971] trunk/Source/WebCore
Revision
168971
Author
stav...@adobe.com
Date
2014-05-16 11:26:24 -0700 (Fri, 16 May 2014)

Log Message

[CSS Regions] Add ASSERT to make sure using the flowThread cache does not return incorrect results
https://bugs.webkit.org/show_bug.cgi?id=132906

Reviewed by Simon Fraser.

If flowThreadContainingBlock() is called on an object which is in a different
flow thread than the one currently being laid out, this method will return an incorrect
result. I added an assertion for that to make sure we catch and treat any such scenarios.
For the moment, this assertion is only validated for regions, as multicol still has some issues.

No new tests required.

* rendering/RenderObject.cpp:
(WebCore::RenderObject::locateFlowThreadContainingBlockNoCache):
(WebCore::RenderObject::locateFlowThreadContainingBlock):
* rendering/RenderObject.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (168970 => 168971)


--- trunk/Source/WebCore/ChangeLog	2014-05-16 17:07:09 UTC (rev 168970)
+++ trunk/Source/WebCore/ChangeLog	2014-05-16 18:26:24 UTC (rev 168971)
@@ -1,3 +1,22 @@
+2014-05-16  Radu Stavila  <stav...@adobe.com>
+
+        [CSS Regions] Add ASSERT to make sure using the flowThread cache does not return incorrect results
+        https://bugs.webkit.org/show_bug.cgi?id=132906
+
+        Reviewed by Simon Fraser.
+
+        If flowThreadContainingBlock() is called on an object which is in a different
+        flow thread than the one currently being laid out, this method will return an incorrect
+        result. I added an assertion for that to make sure we catch and treat any such scenarios.
+        For the moment, this assertion is only validated for regions, as multicol still has some issues.
+
+        No new tests required.
+
+        * rendering/RenderObject.cpp:
+        (WebCore::RenderObject::locateFlowThreadContainingBlockNoCache):
+        (WebCore::RenderObject::locateFlowThreadContainingBlock):
+        * rendering/RenderObject.h:
+
 2014-05-16  Martin Hock  <mh...@apple.com>
 
         MemoryCache::addImageToCache should return the result of add().

Modified: trunk/Source/WebCore/rendering/RenderObject.cpp (168970 => 168971)


--- trunk/Source/WebCore/rendering/RenderObject.cpp	2014-05-16 17:07:09 UTC (rev 168970)
+++ trunk/Source/WebCore/rendering/RenderObject.cpp	2014-05-16 18:26:24 UTC (rev 168971)
@@ -523,16 +523,10 @@
     return false;
 }
 
-RenderFlowThread* RenderObject::locateFlowThreadContainingBlock() const
+RenderFlowThread* RenderObject::locateFlowThreadContainingBlockNoCache() const
 {
     ASSERT(flowThreadState() != NotInsideFlowThread);
 
-    // See if we have the thread cached because we're in the middle of layout.
-    RenderFlowThread* flowThread = view().flowThreadController().currentRenderFlowThread();
-    if (flowThread && (flowThreadState() == flowThread->flowThreadState()))
-        return flowThread;
-    
-    // Not in the middle of layout so have to find the thread the slow way.
     RenderObject* curr = const_cast<RenderObject*>(this);
     while (curr) {
         if (curr->isRenderFlowThread())
@@ -542,6 +536,25 @@
     return 0;
 }
 
+RenderFlowThread* RenderObject::locateFlowThreadContainingBlock() const
+{
+    ASSERT(flowThreadState() != NotInsideFlowThread);
+
+    // See if we have the thread cached because we're in the middle of layout.
+    RenderFlowThread* flowThread = view().flowThreadController().currentRenderFlowThread();
+    if (flowThread && (flowThreadState() == flowThread->flowThreadState())) {
+        // Make sure the slow path would return the same result as our cache.
+        // FIXME: For the moment, only apply this assertion to regions, as multicol
+        // still has some issues and triggers this assert.
+        // Created https://bugs.webkit.org/show_bug.cgi?id=132946 for this issue.
+        ASSERT(!flowThread->isRenderNamedFlowThread() || flowThread == locateFlowThreadContainingBlockNoCache());
+        return flowThread;
+    }
+    
+    // Not in the middle of layout so have to find the thread the slow way.
+    return locateFlowThreadContainingBlockNoCache();
+}
+
 RenderBlock* RenderObject::firstLineBlock() const
 {
     return 0;

Modified: trunk/Source/WebCore/rendering/RenderObject.h (168970 => 168971)


--- trunk/Source/WebCore/rendering/RenderObject.h	2014-05-16 17:07:09 UTC (rev 168970)
+++ trunk/Source/WebCore/rendering/RenderObject.h	2014-05-16 18:26:24 UTC (rev 168971)
@@ -891,6 +891,8 @@
 
 private:
     RenderFlowThread* locateFlowThreadContainingBlock() const;
+    RenderFlowThread* locateFlowThreadContainingBlockNoCache() const;
+    
     void removeFromRenderFlowThread();
     void removeFromRenderFlowThreadRecursive(RenderFlowThread*);
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to