Changeset 136045 in webkit


Ignore:
Timestamp:
Nov 28, 2012 12:39:52 PM (11 years ago)
Author:
Alexandru Chiculita
Message:

[CSS Regions] Crash when using hover and first-letter inside a flow-thread
https://bugs.webkit.org/show_bug.cgi?id=102957

Reviewed by David Hyatt.

Source/WebCore:

Some RenderObjects use a different path when they are destroyed. That's because they are dynamically
added just before layout happens and their parent is usually not their actual owner. In those cases the parent
will remove the object from the tree, but it's actually the owner that will destroy the object and all its
children.

RenderFlowThread maintains a RenderBoxRegionInfo object for each RenderObject that is rendered inside the
flow-thread. When the RenderObject is removed from the RenderFlowThread, the associated RenderBoxRegionInfo object
also needs to be removed.

In these special cases (list-marker, first-letter), the object itself was removed from the RenderFlowThread,
but its children were still left in the flow-thread. When the these special objects were later destroyed,
they will remove their own children. Removing their children means it will try to remove them from the
associated RenderFlowThread. However, in this cases there would be no link back to the parent flow-thread,
as the tree is now detached from the enclosing RenderFlowThread.

Added code that recursively removes the whole children tree from the RenderFlowThread when the root is removed.

Tests: fast/regions/firstletter-inside-flowthread.html

fast/regions/listmarker-inside-flowthread.html

  • rendering/RenderObject.cpp:

(WebCore::RenderObject::willBeRemovedFromTree):
(WebCore::RenderObject::removeFromRenderFlowThread):
(WebCore):
(WebCore::RenderObject::removeFromRenderFlowThreadRecursive):

  • rendering/RenderObject.h:

(RenderObject):

LayoutTests:

Added CSS Regions tests for the firstLetter and listMarker render objects that use
different destroy paths in the code.

  • fast/regions/firstletter-inside-flowthread-expected.html: Added.
  • fast/regions/firstletter-inside-flowthread.html: Added.
  • fast/regions/listmarker-inside-flowthread-expected.html: Added.
  • fast/regions/listmarker-inside-flowthread.html: Added.
Location:
trunk
Files:
4 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r136042 r136045  
     12012-11-28  Alexandru Chiculita  <achicu@adobe.com>
     2
     3        [CSS Regions] Crash when using hover and first-letter inside a flow-thread
     4        https://bugs.webkit.org/show_bug.cgi?id=102957
     5
     6        Reviewed by David Hyatt.
     7
     8        Added CSS Regions tests for the firstLetter and listMarker render objects that use
     9        different destroy paths in the code.
     10
     11        * fast/regions/firstletter-inside-flowthread-expected.html: Added.
     12        * fast/regions/firstletter-inside-flowthread.html: Added.
     13        * fast/regions/listmarker-inside-flowthread-expected.html: Added.
     14        * fast/regions/listmarker-inside-flowthread.html: Added.
     15
    1162012-11-28  Tony Chang  <tony@chromium.org>
    217
  • trunk/Source/WebCore/ChangeLog

    r136039 r136045  
     12012-11-28  Alexandru Chiculita  <achicu@adobe.com>
     2
     3        [CSS Regions] Crash when using hover and first-letter inside a flow-thread
     4        https://bugs.webkit.org/show_bug.cgi?id=102957
     5
     6        Reviewed by David Hyatt.
     7
     8        Some RenderObjects use a different path when they are destroyed. That's because they are dynamically
     9        added just before layout happens and their parent is usually not their actual owner. In those cases the parent
     10        will remove the object from the tree, but it's actually the owner that will destroy the object and all its
     11        children.
     12
     13        RenderFlowThread maintains a RenderBoxRegionInfo object for each RenderObject that is rendered inside the
     14        flow-thread. When the RenderObject is removed from the RenderFlowThread, the associated RenderBoxRegionInfo object
     15        also needs to be removed.
     16
     17        In these special cases (list-marker, first-letter), the object itself was removed from the RenderFlowThread,
     18        but its children were still left in the flow-thread. When the these special objects were later destroyed,
     19        they will remove their own children. Removing their children means it will try to remove them from the
     20        associated RenderFlowThread. However, in this cases there would be no link back to the parent flow-thread,
     21        as the tree is now detached from the enclosing RenderFlowThread.
     22
     23        Added code that recursively removes the whole children tree from the RenderFlowThread when the root is removed.
     24
     25        Tests: fast/regions/firstletter-inside-flowthread.html
     26               fast/regions/listmarker-inside-flowthread.html
     27
     28        * rendering/RenderObject.cpp:
     29        (WebCore::RenderObject::willBeRemovedFromTree):
     30        (WebCore::RenderObject::removeFromRenderFlowThread):
     31        (WebCore):
     32        (WebCore::RenderObject::removeFromRenderFlowThreadRecursive):
     33        * rendering/RenderObject.h:
     34        (RenderObject):
     35
    1362012-11-28  Alexandru Chiculita  <achicu@adobe.com>
    237
  • trunk/Source/WebCore/rendering/RenderObject.cpp

    r136001 r136045  
    24482448        parent()->dirtyLinesFromChangedChild(this);
    24492449
    2450     if (inRenderFlowThread()) {
    2451         ASSERT(enclosingRenderFlowThread());
    2452         enclosingRenderFlowThread()->removeFlowChildInfo(this);
    2453     }
     2450    if (inRenderFlowThread())
     2451        removeFromRenderFlowThread();
    24542452
    24552453    if (RenderNamedFlowThread* containerFlowThread = parent()->enclosingRenderNamedFlowThread())
     
    24602458    parent()->setNeedsBoundariesUpdate();
    24612459#endif
     2460}
     2461
     2462void RenderObject::removeFromRenderFlowThread()
     2463{
     2464    RenderFlowThread* renderFlowThread = enclosingRenderFlowThread();
     2465    ASSERT(renderFlowThread);
     2466    // Sometimes we remove the element from the flow, but it's not destroyed at that time.
     2467    // It's only until later when we actually destroy it and remove all the children from it.
     2468    // Currently, that happens for firstLetter elements and list markers.
     2469    // Pass in the flow thread so that we don't have to look it up for all the children.
     2470    removeFromRenderFlowThreadRecursive(renderFlowThread);
     2471}
     2472
     2473void RenderObject::removeFromRenderFlowThreadRecursive(RenderFlowThread* renderFlowThread)
     2474{
     2475    if (const RenderObjectChildList* children = virtualChildren()) {
     2476        for (RenderObject* child = children->firstChild(); child; child = child->nextSibling())
     2477            child->removeFromRenderFlowThreadRecursive(renderFlowThread);
     2478    }
     2479    renderFlowThread->removeFlowChildInfo(this);
     2480    setInRenderFlowThread(false);
    24622481}
    24632482
  • trunk/Source/WebCore/rendering/RenderObject.h

    r135779 r136045  
    986986
    987987private:
     988    void removeFromRenderFlowThread();
     989    void removeFromRenderFlowThreadRecursive(RenderFlowThread*);
     990
    988991    RenderStyle* cachedFirstLineStyle() const;
    989992    StyleDifference adjustStyleDifference(StyleDifference, unsigned contextSensitiveProperties) const;
Note: See TracChangeset for help on using the changeset viewer.