Changeset 86160 in webkit


Ignore:
Timestamp:
May 10, 2011 9:40:35 AM (13 years ago)
Author:
inferno@chromium.org
Message:

2011-05-10 Abhishek Arya <inferno@chromium.org>

Reviewed by Simon Fraser.

Add containsFloats call to hasOverhangingFloats.
https://bugs.webkit.org/show_bug.cgi?id=60537

Test: fast/block/float/no-overhanging-float-crash.html

  • rendering/RenderBlock.cpp: (WebCore::RenderBlock::repaintOverhangingFloats):
  • rendering/RenderBlock.h: (WebCore::RenderBlock::hasOverhangingFloats):

2011-05-10 Abhishek Arya <inferno@chromium.org>

Reviewed by Simon Fraser.

Tests that we do not crash due to wrong result from
hasOverhangingFloats.
https://bugs.webkit.org/show_bug.cgi?id=60537

  • fast/block/float/no-overhanging-float-crash-expected.txt: Added.
  • fast/block/float/no-overhanging-float-crash.html: Added.
Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r86157 r86160  
     12011-05-10  Abhishek Arya  <inferno@chromium.org>
     2
     3        Reviewed by Simon Fraser.
     4
     5        Tests that we do not crash due to wrong result from
     6        hasOverhangingFloats.
     7        https://bugs.webkit.org/show_bug.cgi?id=60537
     8
     9        * fast/block/float/no-overhanging-float-crash-expected.txt: Added.
     10        * fast/block/float/no-overhanging-float-crash.html: Added.
     11
    1122011-05-10  Adam Roben  <aroben@apple.com>
    213
  • trunk/Source/WebCore/ChangeLog

    r86153 r86160  
     12011-05-10  Abhishek Arya  <inferno@chromium.org>
     2
     3        Reviewed by Simon Fraser.
     4
     5        Add containsFloats call to hasOverhangingFloats.
     6        https://bugs.webkit.org/show_bug.cgi?id=60537
     7
     8        Test: fast/block/float/no-overhanging-float-crash.html
     9
     10        * rendering/RenderBlock.cpp:
     11        (WebCore::RenderBlock::repaintOverhangingFloats):
     12        * rendering/RenderBlock.h:
     13        (WebCore::RenderBlock::hasOverhangingFloats):
     14
    1152011-05-10  Alexis Menard  <alexis.menard@openbossa.org>
    216
  • trunk/Source/WebCore/rendering/RenderBlock.cpp

    r86039 r86160  
    22182218{
    22192219    // Repaint any overhanging floats (if we know we're the one to paint them).
    2220     if (hasOverhangingFloats()) {
    2221         // We think that we must be in a bad state if m_floatingObjects is nil at this point, so
    2222         // we assert on Debug builds and nil-check Release builds.
    2223         ASSERT(m_floatingObjects);
    2224         if (!m_floatingObjects)
    2225             return;
    2226 
    2227         // FIXME: Avoid disabling LayoutState. At the very least, don't disable it for floats originating
    2228         // in this block. Better yet would be to push extra state for the containers of other floats.
    2229         view()->disableLayoutState();
    2230         FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
    2231         FloatingObjectSetIterator end = floatingObjectSet.end();
    2232         for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++it) {
    2233             FloatingObject* r = *it;
    2234             // Only repaint the object if it is overhanging, is not in its own layer, and
    2235             // is our responsibility to paint (m_shouldPaint is set). When paintAllDescendants is true, the latter
    2236             // condition is replaced with being a descendant of us.
    2237             if (logicalBottomForFloat(r) > logicalHeight() && ((paintAllDescendants && r->m_renderer->isDescendantOf(this)) || r->m_shouldPaint) && !r->m_renderer->hasSelfPaintingLayer()) {
    2238                 r->m_renderer->repaint();
    2239                 r->m_renderer->repaintOverhangingFloats();
    2240             }
    2241         }
    2242         view()->enableLayoutState();
    2243     }
     2220    // Otherwise, bail out.
     2221    if (!hasOverhangingFloats())
     2222        return;
     2223
     2224    // FIXME: Avoid disabling LayoutState. At the very least, don't disable it for floats originating
     2225    // in this block. Better yet would be to push extra state for the containers of other floats.
     2226    view()->disableLayoutState();
     2227    FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
     2228    FloatingObjectSetIterator end = floatingObjectSet.end();
     2229    for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++it) {
     2230        FloatingObject* r = *it;
     2231        // Only repaint the object if it is overhanging, is not in its own layer, and
     2232        // is our responsibility to paint (m_shouldPaint is set). When paintAllDescendants is true, the latter
     2233        // condition is replaced with being a descendant of us.
     2234        if (logicalBottomForFloat(r) > logicalHeight() && ((paintAllDescendants && r->m_renderer->isDescendantOf(this)) || r->m_shouldPaint) && !r->m_renderer->hasSelfPaintingLayer()) {
     2235            r->m_renderer->repaint();
     2236            r->m_renderer->repaintOverhangingFloats();
     2237        }
     2238    }
     2239    view()->enableLayoutState();
    22442240}
    22452241 
  • trunk/Source/WebCore/rendering/RenderBlock.h

    r85876 r86160  
    569569    virtual bool avoidsFloats() const;
    570570
    571     bool hasOverhangingFloats() { return parent() && !hasColumns() && lowestFloatLogicalBottom() > logicalHeight(); }
     571    bool hasOverhangingFloats() { return parent() && !hasColumns() && containsFloats() && lowestFloatLogicalBottom() > logicalHeight(); }
    572572    void addIntrudingFloats(RenderBlock* prev, int xoffset, int yoffset);
    573573    int addOverhangingFloats(RenderBlock* child, int xoffset, int yoffset, bool makeChildPaintOtherFloats);
Note: See TracChangeset for help on using the changeset viewer.