Changeset 168837 in webkit


Ignore:
Timestamp:
May 14, 2014 8:38:34 AM (10 years ago)
Author:
stavila@adobe.com
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 Andrei Bucur.

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.

No new tests required.

  • rendering/RenderObject.cpp:

(WebCore::RenderObject::locateFlowThreadContainingBlockNoCache):
(WebCore::RenderObject::locateFlowThreadContainingBlock):

  • rendering/RenderObject.h:
Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r168836 r168837  
     12014-05-14  Radu Stavila  <stavila@adobe.com>
     2
     3        [CSS Regions] Add ASSERT to make sure using the flowThread cache does not return incorrect results
     4        https://bugs.webkit.org/show_bug.cgi?id=132906
     5
     6        Reviewed by Andrei Bucur.
     7
     8        If flowThreadContainingBlock() is called on an object which is in a different
     9        flow thread than the one currently being laid out, this method will return an incorrect
     10        result. I added an assertion for that to make sure we catch and treat any such scenarios.
     11
     12        No new tests required.
     13
     14        * rendering/RenderObject.cpp:
     15        (WebCore::RenderObject::locateFlowThreadContainingBlockNoCache):
     16        (WebCore::RenderObject::locateFlowThreadContainingBlock):
     17        * rendering/RenderObject.h:
     18
    1192014-05-14  Andrei Bucur  <abucur@adobe.com>
    220
  • trunk/Source/WebCore/rendering/RenderObject.cpp

    r168437 r168837  
    523523}
    524524
    525 RenderFlowThread* RenderObject::locateFlowThreadContainingBlock() const
     525RenderFlowThread* RenderObject::locateFlowThreadContainingBlockNoCache() const
    526526{
    527527    ASSERT(flowThreadState() != NotInsideFlowThread);
    528528
    529     // See if we have the thread cached because we're in the middle of layout.
    530     RenderFlowThread* flowThread = view().flowThreadController().currentRenderFlowThread();
    531     if (flowThread && (flowThreadState() == flowThread->flowThreadState()))
    532         return flowThread;
    533    
    534     // Not in the middle of layout so have to find the thread the slow way.
    535529    RenderObject* curr = const_cast<RenderObject*>(this);
    536530    while (curr) {
     
    540534    }
    541535    return 0;
     536}
     537
     538RenderFlowThread* RenderObject::locateFlowThreadContainingBlock() const
     539{
     540    ASSERT(flowThreadState() != NotInsideFlowThread);
     541
     542    // See if we have the thread cached because we're in the middle of layout.
     543    RenderFlowThread* flowThread = view().flowThreadController().currentRenderFlowThread();
     544    if (flowThread && (flowThreadState() == flowThread->flowThreadState())) {
     545        // Make sure the slow path would return the same result as our cache.
     546        ASSERT(flowThread == locateFlowThreadContainingBlockNoCache());
     547        return flowThread;
     548    }
     549   
     550    // Not in the middle of layout so have to find the thread the slow way.
     551    return locateFlowThreadContainingBlockNoCache();
    542552}
    543553
  • trunk/Source/WebCore/rendering/RenderObject.h

    r168404 r168837  
    890890private:
    891891    RenderFlowThread* locateFlowThreadContainingBlock() const;
     892   
     893    // This will walk the tree to find the flow thread.
     894    RenderFlowThread* locateFlowThreadContainingBlockNoCache() const;
     895   
    892896    void removeFromRenderFlowThread();
    893897    void removeFromRenderFlowThreadRecursive(RenderFlowThread*);
Note: See TracChangeset for help on using the changeset viewer.