Changeset 19005 in webkit


Ignore:
Timestamp:
Jan 20, 2007 4:35:32 PM (17 years ago)
Author:
weinig
Message:

LayoutTests:

Reviewed by Darin.

  • fast/layers/removed-by-scroll-handler-expected.checksum: Added.
  • fast/layers/removed-by-scroll-handler-expected.png: Added.
  • fast/layers/removed-by-scroll-handler-expected.txt: Added.
  • fast/layers/removed-by-scroll-handler.html: Added.

WebCore:

Reviewed by Darin.

Test: fast/layers/removed-by-scroll-handler.html

  • rendering/RenderLayer.cpp: (WebCore::RenderLayer::RenderLayer): (WebCore::RenderLayer::dispatchScrollEvent): Added. Called when the timer fires and dispatches the scroll event to the layer's element. (WebCore::RenderLayer::scrollToOffset): Instead of dispatching the scroll event from this function, which is called during layout, schedule a 0-duration timer to dispatch the event after layout. (WebCore::RenderLayer::scrollRectToVisible): (WebCore::RenderLayer::updateScrollInfoAfterLayout): (WebCore::Marquee::start):
  • rendering/RenderLayer.h:
Location:
trunk
Files:
4 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r19004 r19005  
     12007-01-20  Mitz Pettel  <mitz@webkit.org>
     2
     3        Reviewed by Darin.
     4
     5        - test for http://bugs.webkit.org/show_bug.cgi?id=8360
     6          Repro crash when onscroll handler deletes the scrolled object
     7
     8        * fast/layers/removed-by-scroll-handler-expected.checksum: Added.
     9        * fast/layers/removed-by-scroll-handler-expected.png: Added.
     10        * fast/layers/removed-by-scroll-handler-expected.txt: Added.
     11        * fast/layers/removed-by-scroll-handler.html: Added.
     12
    1132007-01-20  Nikolas Zimmermann  <zimmermann@kde.org>
    214
  • trunk/WebCore/ChangeLog

    r19003 r19005  
     12007-01-20  Mitz Pettel  <mitz@webkit.org>
     2
     3        Reviewed by Darin.
     4
     5        - fix http://bugs.webkit.org/show_bug.cgi?id=8360
     6          Repro crash when onscroll handler deletes the scrolled object
     7
     8        Test: fast/layers/removed-by-scroll-handler.html
     9
     10        * rendering/RenderLayer.cpp:
     11        (WebCore::RenderLayer::RenderLayer):
     12        (WebCore::RenderLayer::dispatchScrollEvent): Added. Called when the timer
     13        fires and dispatches the scroll event to the layer's element.
     14        (WebCore::RenderLayer::scrollToOffset): Instead of dispatching the scroll
     15        event from this function, which is called during layout, schedule a 0-duration
     16        timer to dispatch the event after layout.
     17        (WebCore::RenderLayer::scrollRectToVisible):
     18        (WebCore::RenderLayer::updateScrollInfoAfterLayout):
     19        (WebCore::Marquee::start):
     20        * rendering/RenderLayer.h:
     21
    1222007-01-20  Nikolas Zimmermann  <zimmermann@kde.org>
    223
  • trunk/WebCore/rendering/RenderLayer.cpp

    r18951 r19005  
    113113
    114114RenderLayer::RenderLayer(RenderObject* object)
    115 : m_object(object),
    116 m_parent(0),
    117 m_previous(0),
    118 m_next(0),
    119 m_first(0),
    120 m_last(0),
    121 m_repaintX(0),
    122 m_repaintY(0),
    123 m_relX(0),
    124 m_relY(0),
    125 m_x(0),
    126 m_y(0),
    127 m_width(0),
    128 m_height(0),
    129 m_scrollX(0),
    130 m_scrollY(0),
    131 m_scrollOriginX(0),
    132 m_scrollLeftOverflow(0),
    133 m_scrollWidth(0),
    134 m_scrollHeight(0),
    135 m_inResizeMode(false),
    136 m_posZOrderList(0),
    137 m_negZOrderList(0),
    138 m_overflowList(0),
    139 m_clipRects(0) ,
    140 m_scrollDimensionsDirty(true),
    141 m_zOrderListsDirty(true),
    142 m_overflowListDirty(true),
    143 m_isOverflowOnly(shouldBeOverflowOnly()),
    144 m_usedTransparency(false),
    145 m_inOverflowRelayout(false),
    146 m_repaintOverflowOnResize(false),
    147 m_overflowStatusDirty(true),
    148 m_visibleContentStatusDirty( true ),
    149 m_hasVisibleContent( false ),
    150 m_visibleDescendantStatusDirty( false ),
    151 m_hasVisibleDescendant( false ),
    152 m_marquee(0)
     115    : m_object(object)
     116    , m_parent(0)
     117    , m_previous(0)
     118    , m_next(0)
     119    , m_first(0)
     120    , m_last(0)
     121    , m_repaintX(0)
     122    , m_repaintY(0)
     123    , m_relX(0)
     124    , m_relY(0)
     125    , m_x(0)
     126    , m_y(0)
     127    , m_width(0)
     128    , m_height(0)
     129    , m_scrollX(0)
     130    , m_scrollY(0)
     131    , m_scrollOriginX(0)
     132    , m_scrollLeftOverflow(0)
     133    , m_scrollWidth(0)
     134    , m_scrollHeight(0)
     135    , m_inResizeMode(false)
     136    , m_posZOrderList(0)
     137    , m_negZOrderList(0)
     138    , m_overflowList(0)
     139    , m_clipRects(0)
     140    , m_scrollDimensionsDirty(true)
     141    , m_zOrderListsDirty(true)
     142    , m_overflowListDirty(true)
     143    , m_isOverflowOnly(shouldBeOverflowOnly())
     144    , m_usedTransparency(false)
     145    , m_inOverflowRelayout(false)
     146    , m_repaintOverflowOnResize(false)
     147    , m_overflowStatusDirty(true)
     148    , m_visibleContentStatusDirty(true)
     149    , m_hasVisibleContent(false)
     150    , m_visibleDescendantStatusDirty(false)
     151    , m_hasVisibleDescendant(false)
     152    , m_marquee(0)
     153    , m_scrollEventTimer(this, &RenderLayer::dispatchScrollEvent)
    153154{
    154155    if (!object->firstChild() && object->style()) {
     
    673674}
    674675
     676void RenderLayer::dispatchScrollEvent(Timer<RenderLayer>* timer)
     677{
     678    EventTargetNodeCast(m_object->element())->dispatchHTMLEvent(scrollEvent, true, false);
     679}
     680
    675681void RenderLayer::scrollToOffset(int x, int y, bool updateScrollbars, bool repaint)
    676682{
     
    722728    }
    723729
    724     // Fire the scroll DOM event.
    725     EventTargetNodeCast(m_object->element())->dispatchHTMLEvent(scrollEvent, true, false);
     730    // Schedule the scroll DOM event. Since the event handler might destroy the object and its renderer,
     731    // we do not dispatch the event here during layout.
     732    m_scrollEventTimer.startOneShot(0);
    726733}
    727734
     
    750757            int diffY = scrollYOffset();
    751758            scrollToOffset(xOffset, yOffset);
    752             // FIXME: At this point a scroll event fired, which could have deleted this layer.
    753             // Need to handle this case.
    754759            diffX = scrollXOffset() - diffX;
    755760            diffY = scrollYOffset() - diffY;
     
    11851190        if (newX != scrollXOffset() || newY != m_scrollY)
    11861191            scrollToOffset(newX, newY);
    1187         // FIXME: At this point a scroll event fired, which could have deleted this layer.
    1188         // Need to handle this case.
    11891192    }
    11901193
     
    21532156        else
    21542157            m_layer->scrollToOffset(0, m_start, false, false);
    2155         // FIXME: At this point a scroll event fired, which could have deleted this layer,
    2156         // including the marquee. Need to handle this case.
    21572158    }
    21582159    else {
  • trunk/WebCore/rendering/RenderLayer.h

    r18838 r19005  
    378378    void updateVisibilityStatus();
    379379
     380    void dispatchScrollEvent(Timer<RenderLayer>*);
     381
    380382protected:   
    381383    RenderObject* m_object;
     
    453455
    454456    Marquee* m_marquee; // Used by layers with overflow:marquee
     457   
     458    Timer<RenderLayer> m_scrollEventTimer;
    455459};
    456460
Note: See TracChangeset for help on using the changeset viewer.