Changeset 84096 in webkit


Ignore:
Timestamp:
Apr 16, 2011 2:59:36 PM (13 years ago)
Author:
mitz@apple.com
Message:

<rdar://problem/9190108> Crash when hiding a float

Reviewed by Simon Fraser.

Source/WebCore:

Test: fast/block/float/overhanging-tall-block.html

  • rendering/RenderBlock.cpp:

(WebCore::RenderBlock::addOverhangingFloats): Moved the call to childLogicalTop() out of the loop.
Capped the logical bottom so that we get the correct maximum.

  • rendering/RenderBlock.h: Decleared appendFloatingObjectToLastLine().
  • rendering/RenderBlockLineLayout.cpp:

(WebCore::RenderBlock::appendFloatingObjectToLastLine): Added. Ensures correct bookkeeping by
extending the float if needed so that it touches the line.
(WebCore::RenderBlock::layoutInlineChildren): Changed to call appendFloatingObjectToLastLine().
(WebCore::RenderBlock::checkFloatsInCleanLine): Capped the float height so the we mark the right
range of lines as dirty.

  • rendering/RootInlineBox.h:

(WebCore::RootInlineBox::appendFloat): Replaced the floats() accessor with this function, which
allows the creation of the vector to be combined with appending the first float.

LayoutTests:

  • fast/block/float/overhanging-tall-block.html: Added.
  • platform/mac/fast/block/float/overhanging-tall-block-expected.checksum: Added.
  • platform/mac/fast/block/float/overhanging-tall-block-expected.png: Added.
  • platform/mac/fast/block/float/overhanging-tall-block-expected.txt: Added.
Location:
trunk
Files:
4 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r84093 r84096  
     12011-04-16  Dan Bernstein  <mitz@apple.com>
     2
     3        Reviewed by Simon Fraser.
     4
     5        <rdar://problem/9190108> Crash when hiding a float
     6
     7        * fast/block/float/overhanging-tall-block.html: Added.
     8        * platform/mac/fast/block/float/overhanging-tall-block-expected.checksum: Added.
     9        * platform/mac/fast/block/float/overhanging-tall-block-expected.png: Added.
     10        * platform/mac/fast/block/float/overhanging-tall-block-expected.txt: Added.
     11
    1122011-04-16  Simon Fraser  <simon.fraser@apple.com>
    213
  • trunk/Source/WebCore/ChangeLog

    r84091 r84096  
     12011-04-16  Dan Bernstein  <mitz@apple.com>
     2
     3        Reviewed by Simon Fraser.
     4
     5        <rdar://problem/9190108> Crash when hiding a float
     6
     7        Test: fast/block/float/overhanging-tall-block.html
     8
     9        * rendering/RenderBlock.cpp:
     10        (WebCore::RenderBlock::addOverhangingFloats): Moved the call to childLogicalTop() out of the loop.
     11        Capped the logical bottom so that we get the correct maximum.
     12        * rendering/RenderBlock.h: Decleared appendFloatingObjectToLastLine().
     13        * rendering/RenderBlockLineLayout.cpp:
     14        (WebCore::RenderBlock::appendFloatingObjectToLastLine): Added. Ensures correct bookkeeping by
     15        extending the float if needed so that it touches the line.
     16        (WebCore::RenderBlock::layoutInlineChildren): Changed to call appendFloatingObjectToLastLine().
     17        (WebCore::RenderBlock::checkFloatsInCleanLine): Capped the float height so the we mark the right
     18        range of lines as dirty.
     19        * rendering/RootInlineBox.h:
     20        (WebCore::RootInlineBox::appendFloat): Replaced the floats() accessor with this function, which
     21        allows the creation of the vector to be combined with appending the first float.
     22
    1232011-04-16  Sam Weinig  <sam@webkit.org>
    224
  • trunk/Source/WebCore/rendering/RenderBlock.cpp

    r84066 r84096  
    36513651        return 0;
    36523652
     3653    int childLogicalTop = child->logicalTop();
    36533654    int lowestFloatLogicalBottom = 0;
    36543655
     
    36583659    for (FloatingObjectSetIterator childIt = child->m_floatingObjects->set().begin(); childIt != childEnd; ++childIt) {
    36593660        FloatingObject* r = *childIt;
    3660         int logicalBottom = child->logicalTop() + logicalBottomForFloat(r);
     3661        int logicalBottomForFloat = min(this->logicalBottomForFloat(r), numeric_limits<int>::max() - childLogicalTop);
     3662        int logicalBottom = childLogicalTop + logicalBottomForFloat;
    36613663        lowestFloatLogicalBottom = max(lowestFloatLogicalBottom, logicalBottom);
    36623664
  • trunk/Source/WebCore/rendering/RenderBlock.h

    r83813 r84096  
    512512    // have to move to the next page/column.
    513513    bool positionNewFloatOnLine(FloatingObject* newFloat, FloatingObject* lastFloatFromPreviousLine, LineWidth&);
     514    void appendFloatingObjectToLastLine(FloatingObject*);
    514515
    515516    // End of functions defined in RenderBlockLineLayout.cpp.
  • trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp

    r83813 r84096  
    713713    }
    714714    return trailingSpaceRun;
     715}
     716
     717void RenderBlock::appendFloatingObjectToLastLine(FloatingObject* floatingObject)
     718{
     719    // Ensure that the float touches the line.
     720    if (logicalBottomForFloat(floatingObject) < lastRootBox()->blockLogicalHeight())
     721        setLogicalHeightForFloat(floatingObject, lastRootBox()->blockLogicalHeight() - logicalTopForFloat(floatingObject));
     722
     723    lastRootBox()->appendFloat(floatingObject->renderer());
    715724}
    716725
     
    9991008                for (; it != end; ++it) {
    10001009                    FloatingObject* f = *it;
    1001                     lastRootBox()->floats().append(f->m_renderer);
     1010                    appendFloatingObjectToLastLine(f);
    10021011                    ASSERT(f->m_renderer == floats[floatIndex].object);
    10031012                    // If a float's geometry has changed, give up on syncing with clean lines.
     
    10811090            }
    10821091            for (; it != end; ++it)
    1083                 lastRootBox()->floats().append((*it)->m_renderer);
     1092                appendFloatingObjectToLastLine(*it);
    10841093            lastFloat = !floatingObjectSet.isEmpty() ? floatingObjectSet.last() : 0;
    10851094        }
     
    11391148            int floatHeight = isHorizontalWritingMode() ? max(floats[floatIndex].rect.height(), newSize.height())
    11401149                                                                 : max(floats[floatIndex].rect.width(), newSize.width());
     1150            floatHeight = min(floatHeight, numeric_limits<int>::max() - floatTop);
    11411151            line->markDirty();
    11421152            markLinesDirtyInBlockRange(line->blockLogicalHeight(), floatTop + floatHeight, line);
  • trunk/Source/WebCore/rendering/RootInlineBox.h

    r82611 r84096  
    112112    InlineBox* closestLeafChildForLogicalLeftPosition(int, bool onlyEditableLeaves = false);
    113113
    114     Vector<RenderBox*>& floats()
     114    void appendFloat(RenderBox* floatingBox)
    115115    {
    116116        ASSERT(!isDirty());
    117         if (!m_floats)
    118             m_floats= adoptPtr(new Vector<RenderBox*>);
    119         return *m_floats;
     117        if (m_floats)
     118            m_floats->append(floatingBox);
     119        else
     120            m_floats= adoptPtr(new Vector<RenderBox*>(1, floatingBox));
    120121    }
    121122
Note: See TracChangeset for help on using the changeset viewer.