CTTE: Autoscroll renderer is always a RenderBox.
authorakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 13 Jan 2014 14:33:53 +0000 (14:33 +0000)
committerakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 13 Jan 2014 14:33:53 +0000 (14:33 +0000)
<https://webkit.org/b/126884>

Reviewed by Antti Koivisto.

* page/EventHandler.h:
* page/EventHandler.cpp:
(WebCore::EventHandler::autoscrollRenderer):

    Make autoscrollRenderer() return a RenderBox*.

* rendering/RenderObject.cpp:
(WebCore::RenderObject::willBeDestroyed):
* rendering/RenderBox.cpp:
(WebCore::RenderBox::willBeDestroyed):

    Only check if the autoscroll renderer is being torn down
    in RenderBox::willBeDestroyed() since it's not relevant for
    other renderer types.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@161877 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/page/EventHandler.cpp
Source/WebCore/page/EventHandler.h
Source/WebCore/rendering/RenderBox.cpp
Source/WebCore/rendering/RenderObject.cpp

index d80dab3582210e932de2f9ce8ebe145d38d34bbd..5d2133c9545f1a6d710ee55e58d82ac40fed3fd4 100644 (file)
@@ -1,3 +1,25 @@
+2014-01-13  Andreas Kling  <akling@apple.com>
+
+        CTTE: Autoscroll renderer is always a RenderBox.
+        <https://webkit.org/b/126884>
+
+        Reviewed by Antti Koivisto.
+
+        * page/EventHandler.h:
+        * page/EventHandler.cpp:
+        (WebCore::EventHandler::autoscrollRenderer):
+
+            Make autoscrollRenderer() return a RenderBox*.
+
+        * rendering/RenderObject.cpp:
+        (WebCore::RenderObject::willBeDestroyed):
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::willBeDestroyed):
+
+            Only check if the autoscroll renderer is being torn down
+            in RenderBox::willBeDestroyed() since it's not relevant for
+            other renderer types.
+
 2014-01-13  László Langó  <llango.u-szeged@partner.samsung.com>
 
         Text should be constructable.
index 2517d0238f1d1bbe561ec591e5e7b37ac5de2a85..6d22a49ee38f3aa5feabdf5c6512a37d311ee880 100644 (file)
@@ -1023,7 +1023,7 @@ void EventHandler::startPanScrolling(RenderElement* renderer)
 
 #endif // ENABLE(PAN_SCROLLING)
 
-RenderElement* EventHandler::autoscrollRenderer() const
+RenderBox* EventHandler::autoscrollRenderer() const
 {
     return m_autoscrollController->autoscrollRenderer();
 }
index 0cf893d8daaf1891e7e337ce19c126f4cc864761..1e91446e6089fd330d5e7d9300ebbf6a69e92705 100644 (file)
@@ -86,9 +86,9 @@ class OptionalCursor;
 class PlatformKeyboardEvent;
 class PlatformTouchEvent;
 class PlatformWheelEvent;
+class RenderBox;
 class RenderElement;
 class RenderLayer;
-class RenderObject;
 class RenderWidget;
 class SVGElementInstance;
 class Scrollbar;
@@ -138,7 +138,7 @@ public:
 #endif
 
     void stopAutoscrollTimer(bool rendererIsBeingDestroyed = false);
-    RenderElement* autoscrollRenderer() const;
+    RenderBox* autoscrollRenderer() const;
     void updateAutoscrollRenderer();
     bool autoscrollInProgress() const;
     bool mouseDownWasInSubframe() const { return m_mouseDownWasInSubframe; }
index 1be2f1026b6f60e954031f3c3c148e33a86fc13e..29f32359238804591a5ac1fb2a5bd275a3f59034 100644 (file)
@@ -28,6 +28,7 @@
 #include "Chrome.h"
 #include "ChromeClient.h"
 #include "Document.h"
+#include "EventHandler.h"
 #include "FloatQuad.h"
 #include "Frame.h"
 #include "FrameView.h"
@@ -218,6 +219,9 @@ void RenderBox::clearRenderBoxRegionInfo()
 
 void RenderBox::willBeDestroyed()
 {
+    if (frame().eventHandler().autoscrollRenderer() == this)
+        frame().eventHandler().stopAutoscrollTimer(true);
+
     clearOverrideSize();
     clearContainingBlockOverrideSize();
 
index 7dd3dadfe9cbf963f7d3a53d1257b671d9420192..968eecf1d3f6157403ff0b29da726f7936de273b 100644 (file)
@@ -1830,14 +1830,6 @@ inline void RenderObject::clearLayoutRootIfNeeded() const
 
 void RenderObject::willBeDestroyed()
 {
-    // If this renderer is being autoscrolled, stop the autoscroll timer
-    
-    // FIXME: RenderObject::destroy should not get called with a renderer whose document
-    // has a null frame, so we assert this. However, we don't want release builds to crash which is why we
-    // check that the frame is not null.
-    if (frame().eventHandler().autoscrollRenderer() == this)
-        frame().eventHandler().stopAutoscrollTimer(true);
-
     // For accessibility management, notify the parent of the imminent change to its child set.
     // We do it now, before remove(), while the parent pointer is still available.
     if (AXObjectCache* cache = document().existingAXObjectCache())