Changeset 168971 in webkit


Ignore:
Timestamp:
May 16, 2014 11:26:24 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 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:
Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r168970 r168971  
     12014-05-16  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 Simon Fraser.
     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        For the moment, this assertion is only validated for regions, as multicol still has some issues.
     12
     13        No new tests required.
     14
     15        * rendering/RenderObject.cpp:
     16        (WebCore::RenderObject::locateFlowThreadContainingBlockNoCache):
     17        (WebCore::RenderObject::locateFlowThreadContainingBlock):
     18        * rendering/RenderObject.h:
     19
    1202014-05-16  Martin Hock  <mhock@apple.com>
    221
  • trunk/Source/WebCore/rendering/RenderObject.cpp

    r168967 r168971  
    524524}
    525525
    526 RenderFlowThread* RenderObject::locateFlowThreadContainingBlock() const
     526RenderFlowThread* RenderObject::locateFlowThreadContainingBlockNoCache() const
    527527{
    528528    ASSERT(flowThreadState() != NotInsideFlowThread);
    529529
    530     // See if we have the thread cached because we're in the middle of layout.
    531     RenderFlowThread* flowThread = view().flowThreadController().currentRenderFlowThread();
    532     if (flowThread && (flowThreadState() == flowThread->flowThreadState()))
    533         return flowThread;
    534    
    535     // Not in the middle of layout so have to find the thread the slow way.
    536530    RenderObject* curr = const_cast<RenderObject*>(this);
    537531    while (curr) {
     
    541535    }
    542536    return 0;
     537}
     538
     539RenderFlowThread* RenderObject::locateFlowThreadContainingBlock() const
     540{
     541    ASSERT(flowThreadState() != NotInsideFlowThread);
     542
     543    // See if we have the thread cached because we're in the middle of layout.
     544    RenderFlowThread* flowThread = view().flowThreadController().currentRenderFlowThread();
     545    if (flowThread && (flowThreadState() == flowThread->flowThreadState())) {
     546        // Make sure the slow path would return the same result as our cache.
     547        // FIXME: For the moment, only apply this assertion to regions, as multicol
     548        // still has some issues and triggers this assert.
     549        // Created https://bugs.webkit.org/show_bug.cgi?id=132946 for this issue.
     550        ASSERT(!flowThread->isRenderNamedFlowThread() || flowThread == locateFlowThreadContainingBlockNoCache());
     551        return flowThread;
     552    }
     553   
     554    // Not in the middle of layout so have to find the thread the slow way.
     555    return locateFlowThreadContainingBlockNoCache();
    543556}
    544557
  • trunk/Source/WebCore/rendering/RenderObject.h

    r168967 r168971  
    892892private:
    893893    RenderFlowThread* locateFlowThreadContainingBlock() const;
     894    RenderFlowThread* locateFlowThreadContainingBlockNoCache() const;
     895   
    894896    void removeFromRenderFlowThread();
    895897    void removeFromRenderFlowThreadRecursive(RenderFlowThread*);
Note: See TracChangeset for help on using the changeset viewer.