⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 175345 in webkit


Ignore:
Timestamp:
Oct 29, 2014, 2:13:12 PM (12 years ago)
Author:
Alan Bujtas
Message:

Remove invalid float from RootInlineBox.
https://bugs.webkit.org/show_bug.cgi?id=137707

Reviewed by Antti Koivisto.

In certain cases, floating boxes get attached to the last (root) inline box.
When this particular floating box gets destroyed, it also needs to be detached
from the last inline box.
Source/WebCore:

  1. Introduce RootInlineBox::removeFloat() (vs. RootInlineBox::appendFloat())
  2. Ensure that it is called when the floating box is being destroyed.

Test: fast/inline/crash-when-inline-box-has-invalid-float.html

  • rendering/RenderBlockFlow.cpp:

(WebCore::RenderBlockFlow::removeFloatingObject):
(WebCore::RenderBlockFlow::markAllDescendantsWithFloatsForLayout): During style recalc, while
tearing down the render tree, we can get to a state where a block element has both inline and block children.
It happens when the style change on an element makes sibling anonymous block wrappers detached.
In that case the markAllDescendantsWithFloatsForLayout() call does not get propagated down on the
block child elements as we return early at the childrenInline() check.

  • rendering/RootInlineBox.h:

(WebCore::RootInlineBox::removeFloat):

LayoutTests:

  • fast/inline/crash-when-inline-box-has-invalid-float-expected.txt: Added.
  • fast/inline/crash-when-inline-box-has-invalid-float.html: Added.
Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r175329 r175345  
     12014-10-29  Zalan Bujtas  <zalan@apple.com>
     2
     3        Remove invalid float from RootInlineBox.
     4        https://bugs.webkit.org/show_bug.cgi?id=137707
     5
     6        Reviewed by Antti Koivisto.
     7
     8        In certain cases, floating boxes get attached to the last (root) inline box.
     9        When this particular floating box gets destroyed, it also needs to be detached
     10        from the last inline box.
     11
     12        * fast/inline/crash-when-inline-box-has-invalid-float-expected.txt: Added.
     13        * fast/inline/crash-when-inline-box-has-invalid-float.html: Added.
     14
    1152014-10-29  Alexey Proskuryakov  <ap@apple.com>
    216
  • trunk/Source/WebCore/ChangeLog

    r175343 r175345  
     12014-10-29  Zalan Bujtas  <zalan@apple.com>
     2
     3        Remove invalid float from RootInlineBox.
     4        https://bugs.webkit.org/show_bug.cgi?id=137707
     5
     6        Reviewed by Antti Koivisto.
     7
     8        In certain cases, floating boxes get attached to the last (root) inline box.
     9        When this particular floating box gets destroyed, it also needs to be detached
     10        from the last inline box.
     11        1. Introduce RootInlineBox::removeFloat() (vs. RootInlineBox::appendFloat())
     12        2. Ensure that it is called when the floating box is being destroyed.
     13
     14        Test: fast/inline/crash-when-inline-box-has-invalid-float.html
     15
     16        * rendering/RenderBlockFlow.cpp:
     17        (WebCore::RenderBlockFlow::removeFloatingObject):
     18        (WebCore::RenderBlockFlow::markAllDescendantsWithFloatsForLayout): During style recalc, while
     19        tearing down the render tree, we can get to a state where a block element has both inline and block children.
     20        It happens when the style change on an element makes sibling anonymous block wrappers detached.
     21        In that case the markAllDescendantsWithFloatsForLayout() call does not get propagated down on the
     22        block child elements as we return early at the childrenInline() check.
     23        * rendering/RootInlineBox.h:
     24        (WebCore::RootInlineBox::removeFloat):
     25
    1262014-10-29  Antti Koivisto  <antti@apple.com>
    227
  • trunk/Source/WebCore/rendering/RenderBlockFlow.cpp

    r175242 r175345  
    22262226                }
    22272227                if (floatingObject->originatingLine()) {
     2228                    floatingObject->originatingLine()->removeFloat(floatBox);
    22282229                    if (!selfNeedsLayout()) {
    22292230                        ASSERT(&floatingObject->originatingLine()->renderer() == this);
     
    26832684        removeFloatingObject(*floatToRemove);
    26842685
    2685     if (childrenInline())
    2686         return;
    2687 
    2688     // Iterate over our children and mark them as needed.
     2686    // Iterate over our block children and mark them as needed.
    26892687    for (auto& block : childrenOfType<RenderBlock>(*this)) {
    26902688        if (!floatToRemove && block.isFloatingOrOutOfFlowPositioned())
  • trunk/Source/WebCore/rendering/RootInlineBox.h

    r174746 r175345  
    146146    }
    147147
     148    void removeFloat(RenderBox& floatingBox)
     149    {
     150        ASSERT(m_floats);
     151        ASSERT(m_floats->contains(&floatingBox));
     152        m_floats->remove(m_floats->find(&floatingBox));
     153    }
     154
    148155    Vector<RenderBox*>* floatsPtr() { ASSERT(!isDirty()); return m_floats.get(); }
    149156
Note: See TracChangeset for help on using the changeset viewer.