Diff
Modified: trunk/Source/WebCore/CMakeLists.txt (137702 => 137703)
--- trunk/Source/WebCore/CMakeLists.txt 2012-12-14 03:42:14 UTC (rev 137702)
+++ trunk/Source/WebCore/CMakeLists.txt 2012-12-14 03:47:00 UTC (rev 137703)
@@ -1719,7 +1719,6 @@
mathml/MathMLMathElement.cpp
mathml/MathMLTextElement.cpp
- page/AutoscrollController.cpp
page/BarInfo.cpp
page/Chrome.cpp
page/Console.cpp
Modified: trunk/Source/WebCore/ChangeLog (137702 => 137703)
--- trunk/Source/WebCore/ChangeLog 2012-12-14 03:42:14 UTC (rev 137702)
+++ trunk/Source/WebCore/ChangeLog 2012-12-14 03:47:00 UTC (rev 137703)
@@ -1,3 +1,44 @@
+2012-12-13 Yoshifumi Inoue <[email protected]>
+
+ Unreviewed, rolling out r137691.
+ http://trac.webkit.org/changeset/137691
+ https://bugs.webkit.org/show_bug.cgi?id=104764
+
+ panscroll test on AppleWin failed
+
+ * CMakeLists.txt:
+ * GNUmakefile.list.am:
+ * Target.pri:
+ * WebCore.gypi:
+ * WebCore.vcproj/WebCore.vcproj:
+ * WebCore.xcodeproj/project.pbxproj:
+ * page/AutoscrollController.cpp: Removed.
+ * page/AutoscrollController.h: Removed.
+ * page/EventHandler.cpp:
+ (WebCore):
+ (WebCore::EventHandler::EventHandler):
+ (WebCore::canAutoscroll):
+ (WebCore::EventHandler::handleMouseDraggedEvent):
+ (WebCore::EventHandler::handleMouseReleaseEvent):
+ (WebCore::EventHandler::handleAutoscroll):
+ (WebCore::EventHandler::autoscrollTimerFired):
+ (WebCore::EventHandler::startPanScrolling):
+ (WebCore::EventHandler::updatePanScrollState):
+ (WebCore::EventHandler::autoscrollRenderer):
+ (WebCore::EventHandler::updateAutoscrollRenderer):
+ (WebCore::EventHandler::setAutoscrollRenderer):
+ (WebCore::EventHandler::startAutoscrollTimer):
+ (WebCore::EventHandler::stopAutoscrollTimer):
+ (WebCore::EventHandler::selectCursor):
+ (WebCore::EventHandler::handleMousePressEvent):
+ (WebCore::EventHandler::keyEvent):
+ * page/EventHandler.h:
+ (EventHandler):
+ (WebCore::EventHandler::autoscrollInProgress):
+ * rendering/RenderBox.cpp:
+ * rendering/RenderBox.h:
+ (RenderBox):
+
2012-12-13 Kentaro Hara <[email protected]>
ChildNodesLazySnapshot::nextNode() can crash
Modified: trunk/Source/WebCore/GNUmakefile.list.am (137702 => 137703)
--- trunk/Source/WebCore/GNUmakefile.list.am 2012-12-14 03:42:14 UTC (rev 137702)
+++ trunk/Source/WebCore/GNUmakefile.list.am 2012-12-14 03:47:00 UTC (rev 137703)
@@ -4002,8 +4002,6 @@
Source/WebCore/page/animation/KeyframeAnimation.h \
Source/WebCore/page/AdjustViewSizeOrNot.h \
Source/WebCore/page/AlternativeTextClient.h \
- Source/WebCore/page/AutoscrollController.cpp \
- Source/WebCore/page/AutoscrollController.h \
Source/WebCore/page/BarInfo.cpp \
Source/WebCore/page/BarInfo.h \
Source/WebCore/page/Chrome.cpp \
Modified: trunk/Source/WebCore/Target.pri (137702 => 137703)
--- trunk/Source/WebCore/Target.pri 2012-12-14 03:42:14 UTC (rev 137702)
+++ trunk/Source/WebCore/Target.pri 2012-12-14 03:47:00 UTC (rev 137703)
@@ -868,7 +868,6 @@
page/animation/CSSPropertyAnimation.cpp \
page/animation/ImplicitAnimation.cpp \
page/animation/KeyframeAnimation.cpp \
- page/AutoscrollController.cpp \
page/BarInfo.cpp \
page/Chrome.cpp \
page/Console.cpp \
@@ -2015,7 +2014,6 @@
page/animation/ImplicitAnimation.h \
page/animation/KeyframeAnimation.h \
page/AdjustViewSizeOrNot.h \
- page/AutoscrollController.h \
page/BarInfo.h \
page/Chrome.h \
page/Console.h \
Modified: trunk/Source/WebCore/WebCore.gypi (137702 => 137703)
--- trunk/Source/WebCore/WebCore.gypi 2012-12-14 03:42:14 UTC (rev 137702)
+++ trunk/Source/WebCore/WebCore.gypi 2012-12-14 03:47:00 UTC (rev 137703)
@@ -2028,8 +2028,6 @@
'mathml/MathMLMathElement.h',
'mathml/MathMLTextElement.cpp',
'mathml/MathMLTextElement.h',
- 'page/AutoscrollController.cpp',
- 'page/AutoscrollController.h',
'page/BarInfo.cpp',
'page/BarInfo.h',
'page/Chrome.cpp',
Modified: trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj (137702 => 137703)
--- trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj 2012-12-14 03:42:14 UTC (rev 137702)
+++ trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj 2012-12-14 03:47:00 UTC (rev 137703)
@@ -26798,14 +26798,6 @@
>
</File>
<File
- RelativePath="..\page\AutoscrollController.cpp"
- >
- </File>
- <File
- RelativePath="..\page\AutoscrollController.h"
- >
- </File>
- <File
RelativePath="..\page\BarInfo.cpp"
>
</File>
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (137702 => 137703)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2012-12-14 03:42:14 UTC (rev 137702)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2012-12-14 03:47:00 UTC (rev 137703)
@@ -1232,8 +1232,6 @@
4512502315DCE37D002F84E2 /* SpinButtonElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 4512502115DCE37D002F84E2 /* SpinButtonElement.h */; };
453EB636159C570400001BB7 /* DateTimeFormat.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 453EB634159C570400001BB7 /* DateTimeFormat.cpp */; };
453EB637159C570400001BB7 /* DateTimeFormat.h in Headers */ = {isa = PBXBuildFile; fileRef = 453EB635159C570400001BB7 /* DateTimeFormat.h */; settings = {ATTRIBUTES = (Private, ); }; };
- 45830D4D1679B4F800ACF8C3 /* AutoscrollController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 45830D4B1679B4F800ACF8C3 /* AutoscrollController.cpp */; };
- 45830D4E1679B4F800ACF8C3 /* AutoscrollController.h in Headers */ = {isa = PBXBuildFile; fileRef = 45830D4C1679B4F800ACF8C3 /* AutoscrollController.h */; settings = {ATTRIBUTES = (Private, ); }; };
45861C72161949DC00010F3A /* BaseMultipleFieldsDateAndTimeInputType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 45861C70161949DC00010F3A /* BaseMultipleFieldsDateAndTimeInputType.cpp */; };
45861C73161949DC00010F3A /* BaseMultipleFieldsDateAndTimeInputType.h in Headers */ = {isa = PBXBuildFile; fileRef = 45861C71161949DC00010F3A /* BaseMultipleFieldsDateAndTimeInputType.h */; };
45861C7F16194A7400010F3A /* DateTimeEditElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 45861C7516194A7400010F3A /* DateTimeEditElement.cpp */; };
@@ -8476,8 +8474,6 @@
4512502115DCE37D002F84E2 /* SpinButtonElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SpinButtonElement.h; sourceTree = "<group>"; };
453EB634159C570400001BB7 /* DateTimeFormat.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DateTimeFormat.cpp; sourceTree = "<group>"; };
453EB635159C570400001BB7 /* DateTimeFormat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DateTimeFormat.h; sourceTree = "<group>"; };
- 45830D4B1679B4F800ACF8C3 /* AutoscrollController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AutoscrollController.cpp; sourceTree = "<group>"; };
- 45830D4C1679B4F800ACF8C3 /* AutoscrollController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AutoscrollController.h; sourceTree = "<group>"; };
45861C70161949DC00010F3A /* BaseMultipleFieldsDateAndTimeInputType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BaseMultipleFieldsDateAndTimeInputType.cpp; sourceTree = "<group>"; };
45861C71161949DC00010F3A /* BaseMultipleFieldsDateAndTimeInputType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BaseMultipleFieldsDateAndTimeInputType.h; sourceTree = "<group>"; };
45861C7516194A7400010F3A /* DateTimeEditElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DateTimeEditElement.cpp; sourceTree = "<group>"; };
@@ -15955,8 +15951,6 @@
8538F0000AD71770006A81D1 /* AbstractView.idl */,
BCF48CE61370D114004E87D6 /* AdjustViewSizeOrNot.h */,
CEDA12D6152CA1CB00D9E08D /* AlternativeTextClient.h */,
- 45830D4B1679B4F800ACF8C3 /* AutoscrollController.cpp */,
- 45830D4C1679B4F800ACF8C3 /* AutoscrollController.h */,
BC124EE40C2641CD009E2349 /* BarInfo.cpp */,
BC124EE50C2641CD009E2349 /* BarInfo.h */,
BC124EE60C2641CD009E2349 /* BarInfo.idl */,
@@ -22684,7 +22678,6 @@
E124748410AA161D00B79493 /* AuthenticationClient.h in Headers */,
514C764C0CE9234E007EF3CD /* AuthenticationMac.h in Headers */,
51E1ECB30C91C55600DC255B /* AutodrainedPool.h in Headers */,
- 45830D4E1679B4F800ACF8C3 /* AutoscrollController.h in Headers */,
A8CFF04E0A154F09000A4234 /* AutoTableLayout.h in Headers */,
29A812380FBB9C1D00510293 /* AXObjectCache.h in Headers */,
BCA8C81E11E3D36900812FB7 /* BackForwardController.h in Headers */,
@@ -26322,7 +26315,6 @@
934F71380D5A6EFF00018D69 /* AuthenticationChallengeBase.cpp in Sources */,
514C764D0CE9234E007EF3CD /* AuthenticationMac.mm in Sources */,
51E1ECAF0C91C54600DC255B /* AutodrainedPool.mm in Sources */,
- 45830D4D1679B4F800ACF8C3 /* AutoscrollController.cpp in Sources */,
A8CFF0500A154F09000A4234 /* AutoTableLayout.cpp in Sources */,
29A8124B0FBB9CA900510293 /* AXObjectCacheMac.mm in Sources */,
BCA8C81F11E3D36900812FB7 /* BackForwardController.cpp in Sources */,
Deleted: trunk/Source/WebCore/page/AutoscrollController.cpp (137702 => 137703)
--- trunk/Source/WebCore/page/AutoscrollController.cpp 2012-12-14 03:42:14 UTC (rev 137702)
+++ trunk/Source/WebCore/page/AutoscrollController.cpp 2012-12-14 03:47:00 UTC (rev 137703)
@@ -1,270 +0,0 @@
-/*
- * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
- * Copyright (C) 2006 Alexey Proskuryakov ([email protected])
- * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies)
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "AutoscrollController.h"
-
-#include "EventHandler.h"
-#include "Frame.h"
-#include "FrameView.h"
-#include "HitTestResult.h"
-#include "Page.h"
-#include "RenderBox.h"
-#include "ScrollView.h"
-
-namespace WebCore {
-
-// When the autoscroll or the panScroll is triggered when do the scroll every 0.05s to make it smooth
-static const double autoscrollInterval = 0.05;
-
-#if ENABLE(PAN_SCROLLING)
-static Frame* getMainFrame(Frame* frame)
-{
- Page* page = frame->page();
- return page ? page->mainFrame() : 0;
-}
-#endif
-
-AutoscrollController::AutoscrollController()
- : m_autoscrollTimer(this, &AutoscrollController::autoscrollTimerFired)
- , m_autoscrollRenderer(0)
- , m_autoscrollType(NoAutoscroll)
-#if ENABLE(PAN_SCROLLING)
- , m_panScrollButtonPressed(false)
- , m_springLoadedPanScrollInProgress(false)
-#endif
-{
-}
-
-RenderBox* AutoscrollController::autoscrollRenderer() const
-{
- return m_autoscrollRenderer;
-}
-
-bool AutoscrollController::autoscrollInProgress() const
-{
- return m_autoscrollType == AutoscrollForSelection;
-}
-
-void AutoscrollController::startAutoscrollForSelection(RenderObject* renderer)
-{
- // We don't want to trigger the autoscroll or the panScroll if it's already active
- if (m_autoscrollTimer.isActive())
- return;
- RenderBox* scrollable = RenderBox::findAutoscrollable(renderer);
- if (!scrollable)
- return;
- m_autoscrollType = AutoscrollForSelection;
- m_autoscrollRenderer = scrollable;
- startAutoscrollTimer();
-}
-
-void AutoscrollController::stopAutoscrollTimer(bool rendererIsBeingDestroyed)
-{
- RenderBox* scrollable = m_autoscrollRenderer;
- m_autoscrollTimer.stop();
- m_autoscrollType = NoAutoscroll;
- m_autoscrollRenderer = 0;
-#if ENABLE(PAN_SCROLLING)
- m_panScrollButtonPressed = false;
- m_springLoadedPanScrollInProgress = false;
-#endif
-
- if (!scrollable)
- return;
-
- Frame* frame = scrollable->frame();
- EventHandler* eventHandler = frame->eventHandler();
- if (autoscrollInProgress() && eventHandler->mouseDownWasInSubframe()) {
- if (Frame* subframe = eventHandler->subframeForTargetNode(eventHandler->mousePressNode()))
- subframe->eventHandler()->stopAutoscrollTimer(rendererIsBeingDestroyed);
- return;
- }
-
- if (!rendererIsBeingDestroyed)
- scrollable->stopAutoscroll();
-#if ENABLE(PAN_SCROLLING)
- if (panScrollInProgress()) {
- if (FrameView* view = frame->view()) {
- view->removePanScrollIcon();
- view->setCursor(pointerCursor());
- }
- }
-#endif
-
-#if ENABLE(PAN_SCROLLING)
- // If we're not in the top frame we notify it that we are not doing a panScroll any more.
- if (Frame* mainFrame = getMainFrame(frame)) {
- if (frame != mainFrame)
- mainFrame->eventHandler()->didPanScrollStop();
- }
-#endif
-}
-
-void AutoscrollController::updateAutoscrollRenderer()
-{
- if (!m_autoscrollRenderer)
- return;
-
- RenderObject* renderer = m_autoscrollRenderer;
-
-#if ENABLE(PAN_SCROLLING)
- HitTestResult hitTest = m_autoscrollRenderer->frame()->eventHandler()->hitTestResultAtPoint(m_panScrollStartPos, true);
-
- if (Node* nodeAtPoint = hitTest.innerNode())
- renderer = nodeAtPoint->renderer();
-#endif
-
- while (renderer && !(renderer->isBox() && toRenderBox(renderer)->canAutoscroll()))
- renderer = renderer->parent();
- m_autoscrollRenderer = renderer && renderer->isBox() ? toRenderBox(renderer) : 0;
-}
-
-#if ENABLE(PAN_SCROLLING)
-void AutoscrollController::didPanScrollStart()
-{
- m_autoscrollType = AutoscrollForPan;
-}
-
-void AutoscrollController::didPanScrollStop()
-{
- m_autoscrollType = NoAutoscroll;
-}
-
-void AutoscrollController::handleMouseReleaseEvent(const PlatformMouseEvent& mouseEvent)
-{
- if (mouseEvent.button() == MiddleButton)
- m_panScrollButtonPressed = false;
- if (m_springLoadedPanScrollInProgress)
- stopAutoscrollTimer();
-}
-
-bool AutoscrollController::panScrollInProgress() const
-{
- return m_autoscrollType == AutoscrollForPan;
-}
-
-void AutoscrollController::startPanScrolling(RenderBox* scrollable, const IntPoint& lastKnownMousePosition)
-{
- // We don't want to trigger the autoscroll or the panScroll if it's already active
- if (m_autoscrollTimer.isActive())
- return;
-
- m_autoscrollType = AutoscrollForPan;
- m_autoscrollRenderer = scrollable;
- m_panScrollStartPos = lastKnownMousePosition;
- m_springLoadedPanScrollInProgress = false;
-
- if (FrameView* view = scrollable->frame()->view())
- view->addPanScrollIcon(lastKnownMousePosition);
- scrollable->frame()->eventHandler()->didPanScrollStart();
- startAutoscrollTimer();
-}
-#else
-bool AutoscrollController::panScrollInProgress() const
-{
- return false;
-}
-#endif
-
-void AutoscrollController::autoscrollTimerFired(Timer<AutoscrollController>*)
-{
- if (!m_autoscrollRenderer) {
- stopAutoscrollTimer();
- return;
- }
-
- Frame* frame = m_autoscrollRenderer->frame();
- switch (m_autoscrollType) {
- case AutoscrollForSelection:
- if (!frame->eventHandler()->mousePressed()) {
- stopAutoscrollTimer();
- return;
- }
- m_autoscrollRenderer->autoscroll();
- break;
- case NoAutoscroll:
- break;
-#if ENABLE(PAN_SCROLLING)
- case AutoscrollForPan:
- // we verify that the main frame hasn't received the order to stop the panScroll
- if (Frame* mainFrame = getMainFrame(frame)) {
- if (!mainFrame->eventHandler()->panScrollInProgress()) {
- stopAutoscrollTimer();
- return;
- }
- }
- if (FrameView* view = frame->view())
- updatePanScrollState(view, frame->eventHandler()->lastKnownMousePosition());
- m_autoscrollRenderer->panScroll(m_panScrollStartPos);
- break;
-#endif
- }
-}
-
-void AutoscrollController::startAutoscrollTimer()
-{
- m_autoscrollTimer.startRepeating(autoscrollInterval);
-}
-
-#if ENABLE(PAN_SCROLLING)
-void AutoscrollController::updatePanScrollState(FrameView* view, const IntPoint& lastKnownMousePosition)
-{
- // At the original click location we draw a 4 arrowed icon. Over this icon there won't be any scroll
- // So we don't want to change the cursor over this area
- bool east = m_panScrollStartPos.x() < (lastKnownMousePosition.x() - ScrollView::noPanScrollRadius);
- bool west = m_panScrollStartPos.x() > (lastKnownMousePosition.x() + ScrollView::noPanScrollRadius);
- bool north = m_panScrollStartPos.y() > (lastKnownMousePosition.y() + ScrollView::noPanScrollRadius);
- bool south = m_panScrollStartPos.y() < (lastKnownMousePosition.y() - ScrollView::noPanScrollRadius);
-
- if ((east || west || north || south) && m_panScrollButtonPressed)
- m_springLoadedPanScrollInProgress = true;
-
- if (north) {
- if (east)
- view->setCursor(northEastPanningCursor());
- else if (west)
- view->setCursor(northWestPanningCursor());
- else
- view->setCursor(northPanningCursor());
- } else if (south) {
- if (east)
- view->setCursor(southEastPanningCursor());
- else if (west)
- view->setCursor(southWestPanningCursor());
- else
- view->setCursor(southPanningCursor());
- } else if (east)
- view->setCursor(eastPanningCursor());
- else if (west)
- view->setCursor(westPanningCursor());
- else
- view->setCursor(middlePanningCursor());
-}
-#endif
-
-} // namespace WebCore
Deleted: trunk/Source/WebCore/page/AutoscrollController.h (137702 => 137703)
--- trunk/Source/WebCore/page/AutoscrollController.h 2012-12-14 03:42:14 UTC (rev 137702)
+++ trunk/Source/WebCore/page/AutoscrollController.h 2012-12-14 03:47:00 UTC (rev 137703)
@@ -1,86 +0,0 @@
-/*
- * Copyright (C) 2006, 2007, 2009, 2010, 2011 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef AutoscrollController_h
-#define AutoscrollController_h
-
-#include "IntPoint.h"
-#include "Timer.h"
-
-namespace WebCore {
-
-class EventHandler;
-class Frame;
-class FrameView;
-class PlatformMouseEvent;
-class RenderBox;
-class RenderObject;
-
-enum AutoscrollType {
- NoAutoscroll,
- AutoscrollForSelection,
-#if ENABLE(PAN_SCROLLING)
- AutoscrollForPan,
-#endif
-};
-
-// AutscrollController handels autoscroll and pan scroll for EventHandler.
-class AutoscrollController {
-public:
- AutoscrollController();
- RenderBox* autoscrollRenderer() const;
- bool autoscrollInProgress() const;
- bool panScrollInProgress() const;
- void startAutoscrollForSelection(RenderObject*);
- void stopAutoscrollTimer(bool rendererIsBeingDestroyed = false);
- void updateAutoscrollRenderer();
-#if ENABLE(PAN_SCROLLING)
- void didPanScrollStart();
- void didPanScrollStop();
- void handleMouseReleaseEvent(const PlatformMouseEvent&);
- void setPanScrollInProgress(bool);
- void startPanScrolling(RenderBox*, const IntPoint&);
-#endif
-
-private:
- void autoscrollTimerFired(Timer<AutoscrollController>*);
- void startAutoscrollTimer();
-#if ENABLE(PAN_SCROLLING)
- void updatePanScrollState(FrameView*, const IntPoint&);
-#endif
-
- Timer<AutoscrollController> m_autoscrollTimer;
- RenderBox* m_autoscrollRenderer;
- AutoscrollType m_autoscrollType;
-#if ENABLE(PAN_SCROLLING)
- IntPoint m_panScrollStartPos;
- bool m_panScrollButtonPressed;
- bool m_springLoadedPanScrollInProgress;
-#endif
-};
-
-} // namespace WebCore
-
-#endif // AutoscrollController_h
Modified: trunk/Source/WebCore/page/EventHandler.cpp (137702 => 137703)
--- trunk/Source/WebCore/page/EventHandler.cpp 2012-12-14 03:42:14 UTC (rev 137702)
+++ trunk/Source/WebCore/page/EventHandler.cpp 2012-12-14 03:47:00 UTC (rev 137703)
@@ -29,7 +29,6 @@
#include "EventHandler.h"
#include "AXObjectCache.h"
-#include "AutoscrollController.h"
#include "CachedImage.h"
#include "Chrome.h"
#include "ChromeClient.h"
@@ -138,6 +137,9 @@
using namespace SVGNames;
#endif
+// When the autoscroll or the panScroll is triggered when do the scroll every 0.05s to make it smooth
+const double autoscrollInterval = 0.05;
+
// The amount of time to wait before sending a fake mouse event, triggered
// during a scroll. The short interval is used if the content responds to the mouse events quickly enough,
// otherwise the long interval is used.
@@ -329,8 +331,13 @@
#endif
, m_mouseDownWasSingleClickInSelection(false)
, m_selectionInitiationState(HaveNotStartedSelection)
+ , m_panScrollInProgress(false)
+ , m_panScrollButtonPressed(false)
+ , m_springLoadedPanScrollInProgress(false)
, m_hoverTimer(this, &EventHandler::hoverTimerFired)
- , m_autoscrollController(adoptPtr(new AutoscrollController))
+ , m_autoscrollTimer(this, &EventHandler::autoscrollTimerFired)
+ , m_autoscrollRenderer(0)
+ , m_autoscrollInProgress(false)
, m_mouseDownMayStartAutoscroll(false)
, m_mouseDownWasInSubframe(false)
, m_fakeMouseMoveEventTimer(this, &EventHandler::fakeMouseMoveEventTimerFired)
@@ -697,6 +704,30 @@
return swallowEvent;
}
+// There are two kinds of renderer that can autoscroll.
+static bool canAutoscroll(RenderObject* renderer)
+{
+ if (!renderer->isBox())
+ return false;
+
+ // Check for a box that can be scrolled in its own right.
+ if (toRenderBox(renderer)->canBeScrolledAndHasScrollableArea())
+ return true;
+
+ // Check for a box that represents the top level of a web page.
+ // This can be scrolled by calling Chrome::scrollRectIntoView.
+ // This only has an effect on the Mac platform in applications
+ // that put web views into scrolling containers, such as Mac OS X Mail.
+ // The code for this is in RenderLayer::scrollRectToVisible.
+ if (renderer->node() != renderer->document())
+ return false;
+ Frame* frame = renderer->frame();
+ if (!frame)
+ return false;
+ Page* page = frame->page();
+ return page && page->mainFrame() == frame;
+}
+
#if ENABLE(DRAG_SUPPORT)
bool EventHandler::handleMouseDraggedEvent(const MouseEventWithHitTestResults& event)
{
@@ -723,8 +754,20 @@
m_mouseDownMayStartDrag = false;
- if (m_mouseDownMayStartAutoscroll && !panScrollInProgress()) {
- m_autoscrollController->startAutoscrollForSelection(renderer);
+ if (m_mouseDownMayStartAutoscroll && !m_panScrollInProgress) {
+ // Find a renderer that can autoscroll.
+ while (renderer && !canAutoscroll(renderer)) {
+ if (!renderer->parent() && renderer->node() == renderer->document() && renderer->document()->ownerElement())
+ renderer = renderer->document()->ownerElement()->renderer();
+ else
+ renderer = renderer->parent();
+ }
+
+ if (renderer) {
+ m_autoscrollInProgress = true;
+ handleAutoscroll(renderer);
+ }
+
m_mouseDownMayStartAutoscroll = false;
}
@@ -892,7 +935,8 @@
bool EventHandler::handleMouseReleaseEvent(const MouseEventWithHitTestResults& event)
{
- stopAutoscrollTimer();
+ if (m_autoscrollInProgress)
+ stopAutoscrollTimer();
if (handleMouseUp(event))
return true;
@@ -946,46 +990,132 @@
return handled;
}
+void EventHandler::handleAutoscroll(RenderObject* renderer)
+{
+ // We don't want to trigger the autoscroll or the panScroll if it's already active
+ if (m_autoscrollTimer.isActive())
+ return;
+
+ setAutoscrollRenderer(renderer);
+
#if ENABLE(PAN_SCROLLING)
+ if (m_panScrollInProgress) {
+ m_panScrollStartPos = lastKnownMousePosition();
+ if (FrameView* view = m_frame->view())
+ view->addPanScrollIcon(m_panScrollStartPos);
+ // If we're not in the top frame we notify it that we doing a panScroll.
+ if (Page* page = m_frame->page()) {
+ Frame* mainFrame = page->mainFrame();
+ if (m_frame != mainFrame)
+ mainFrame->eventHandler()->m_panScrollInProgress = true;
+ }
+ }
+#endif
-void EventHandler::didPanScrollStart()
-{
- m_autoscrollController->didPanScrollStart();
+ startAutoscrollTimer();
}
-void EventHandler::didPanScrollStop()
+void EventHandler::autoscrollTimerFired(Timer<EventHandler>*)
{
- m_autoscrollController->didPanScrollStop();
+ RenderObject* r = autoscrollRenderer();
+ if (!r || !r->isBox()) {
+ stopAutoscrollTimer();
+ return;
+ }
+
+ if (m_autoscrollInProgress) {
+ if (!m_mousePressed) {
+ stopAutoscrollTimer();
+ return;
+ }
+ toRenderBox(r)->autoscroll();
+ } else {
+ // we verify that the main frame hasn't received the order to stop the panScroll
+ if (Page* page = m_frame->page()) {
+ if (!page->mainFrame()->eventHandler()->m_panScrollInProgress) {
+ stopAutoscrollTimer();
+ return;
+ }
+ }
+#if ENABLE(PAN_SCROLLING)
+ updatePanScrollState();
+ toRenderBox(r)->panScroll(m_panScrollStartPos);
+#endif
+ }
}
+#if ENABLE(PAN_SCROLLING)
+
void EventHandler::startPanScrolling(RenderObject* renderer)
{
- if (!renderer->isBox())
- return;
- m_autoscrollController->startPanScrolling(toRenderBox(renderer), lastKnownMousePosition());
+ m_panScrollInProgress = true;
+ m_panScrollButtonPressed = true;
+ handleAutoscroll(renderer);
invalidateClick();
}
+void EventHandler::updatePanScrollState()
+{
+ FrameView* view = m_frame->view();
+ if (!view)
+ return;
+
+ // At the original click location we draw a 4 arrowed icon. Over this icon there won't be any scroll
+ // So we don't want to change the cursor over this area
+ bool east = m_panScrollStartPos.x() < (m_lastKnownMousePosition.x() - ScrollView::noPanScrollRadius);
+ bool west = m_panScrollStartPos.x() > (m_lastKnownMousePosition.x() + ScrollView::noPanScrollRadius);
+ bool north = m_panScrollStartPos.y() > (m_lastKnownMousePosition.y() + ScrollView::noPanScrollRadius);
+ bool south = m_panScrollStartPos.y() < (m_lastKnownMousePosition.y() - ScrollView::noPanScrollRadius);
+
+ if ((east || west || north || south) && m_panScrollButtonPressed)
+ m_springLoadedPanScrollInProgress = true;
+
+ if (north) {
+ if (east)
+ view->setCursor(northEastPanningCursor());
+ else if (west)
+ view->setCursor(northWestPanningCursor());
+ else
+ view->setCursor(northPanningCursor());
+ } else if (south) {
+ if (east)
+ view->setCursor(southEastPanningCursor());
+ else if (west)
+ view->setCursor(southWestPanningCursor());
+ else
+ view->setCursor(southPanningCursor());
+ } else if (east)
+ view->setCursor(eastPanningCursor());
+ else if (west)
+ view->setCursor(westPanningCursor());
+ else
+ view->setCursor(middlePanningCursor());
+}
+
#endif // ENABLE(PAN_SCROLLING)
RenderObject* EventHandler::autoscrollRenderer() const
{
- return m_autoscrollController->autoscrollRenderer();
+ return m_autoscrollRenderer;
}
void EventHandler::updateAutoscrollRenderer()
{
- m_autoscrollController->updateAutoscrollRenderer();
-}
+ if (!m_autoscrollRenderer)
+ return;
-bool EventHandler::autoscrollInProgress() const
-{
- return m_autoscrollController->autoscrollInProgress();
+ HitTestResult hitTest = hitTestResultAtPoint(m_panScrollStartPos, true);
+
+ if (Node* nodeAtPoint = hitTest.innerNode())
+ m_autoscrollRenderer = nodeAtPoint->renderer();
+
+ while (m_autoscrollRenderer && !canAutoscroll(m_autoscrollRenderer))
+ m_autoscrollRenderer = m_autoscrollRenderer->parent();
}
-bool EventHandler::panScrollInProgress() const
+void EventHandler::setAutoscrollRenderer(RenderObject* renderer)
{
- return m_autoscrollController->panScrollInProgress();
+ m_autoscrollRenderer = renderer;
}
#if ENABLE(DRAG_SUPPORT)
@@ -1065,9 +1195,50 @@
return result;
}
+
+void EventHandler::startAutoscrollTimer()
+{
+ m_autoscrollTimer.startRepeating(autoscrollInterval);
+}
+
void EventHandler::stopAutoscrollTimer(bool rendererIsBeingDestroyed)
{
- m_autoscrollController->stopAutoscrollTimer(rendererIsBeingDestroyed);
+ if (m_autoscrollInProgress) {
+ if (m_mouseDownWasInSubframe) {
+ if (Frame* subframe = subframeForTargetNode(m_mousePressNode.get()))
+ subframe->eventHandler()->stopAutoscrollTimer(rendererIsBeingDestroyed);
+ return;
+ }
+ }
+
+ if (autoscrollRenderer()) {
+ if (!rendererIsBeingDestroyed && (m_autoscrollInProgress || m_panScrollInProgress))
+ toRenderBox(autoscrollRenderer())->stopAutoscroll();
+#if ENABLE(PAN_SCROLLING)
+ if (m_panScrollInProgress) {
+ if (FrameView* view = m_frame->view()) {
+ view->removePanScrollIcon();
+ view->setCursor(pointerCursor());
+ }
+ }
+#endif
+
+ setAutoscrollRenderer(0);
+ }
+
+ m_autoscrollTimer.stop();
+
+ m_panScrollInProgress = false;
+ m_springLoadedPanScrollInProgress = false;
+
+ // If we're not in the top frame we notify it that we are not doing a panScroll any more.
+ if (Page* page = m_frame->page()) {
+ Frame* mainFrame = page->mainFrame();
+ if (m_frame != mainFrame)
+ mainFrame->eventHandler()->m_panScrollInProgress = false;
+ }
+
+ m_autoscrollInProgress = false;
}
Node* EventHandler::mousePressNode() const
@@ -1250,10 +1421,8 @@
Page* page = m_frame->page();
if (!page)
return NoCursorChange;
-#if ENABLE(PAN_SCROLLING)
- if (page->mainFrame()->eventHandler()->panScrollInProgress())
+ if (page->mainFrame()->eventHandler()->m_panScrollInProgress)
return NoCursorChange;
-#endif
Node* node = event.targetNode();
RenderObject* renderer = node ? node->renderer() : 0;
@@ -1483,9 +1652,10 @@
#if ENABLE(PAN_SCROLLING)
// We store whether pan scrolling is in progress before calling stopAutoscrollTimer()
- // because it will set m_autoscrollType to NoAutoscroll on return.
- bool isPanScrollInProgress = m_frame->page() && m_frame->page()->mainFrame()->eventHandler()->panScrollInProgress();
- stopAutoscrollTimer();
+ // because it will set m_panScrollInProgress to false on return.
+ bool isPanScrollInProgress = m_frame->page() && m_frame->page()->mainFrame()->eventHandler()->m_panScrollInProgress;
+ if (isPanScrollInProgress || m_autoscrollInProgress)
+ stopAutoscrollTimer();
if (isPanScrollInProgress) {
// We invalidate the click when exiting pan scrolling so that we don't inadvertently navigate
// away from the current page (e.g. the click was on a hyperlink). See <rdar://problem/6095023>.
@@ -1780,7 +1950,10 @@
UserGestureIndicator gestureIndicator(DefinitelyProcessingUserGesture);
#if ENABLE(PAN_SCROLLING)
- m_autoscrollController->handleMouseReleaseEvent(mouseEvent);
+ if (mouseEvent.button() == MiddleButton)
+ m_panScrollButtonPressed = false;
+ if (m_springLoadedPanScrollInProgress)
+ stopAutoscrollTimer();
#endif
m_mousePressed = false;
@@ -2970,7 +3143,7 @@
#if ENABLE(PAN_SCROLLING)
if (Page* page = m_frame->page()) {
- if (page->mainFrame()->eventHandler()->panScrollInProgress()) {
+ if (page->mainFrame()->eventHandler()->m_panScrollInProgress) {
// If a key is pressed while the panScroll is in progress then we want to stop
if (initialKeyEvent.type() == PlatformEvent::KeyDown || initialKeyEvent.type() == PlatformEvent::RawKeyDown)
stopAutoscrollTimer();
Modified: trunk/Source/WebCore/page/EventHandler.h (137702 => 137703)
--- trunk/Source/WebCore/page/EventHandler.h 2012-12-14 03:42:14 UTC (rev 137702)
+++ trunk/Source/WebCore/page/EventHandler.h 2012-12-14 03:47:00 UTC (rev 137703)
@@ -51,7 +51,6 @@
namespace WebCore {
-class AutoscrollController;
class Clipboard;
class Event;
class EventTarget;
@@ -110,18 +109,12 @@
Node* mousePressNode() const;
void setMousePressNode(PassRefPtr<Node>);
-#if ENABLE(PAN_SCROLLING)
- void didPanScrollStart();
- void didPanScrollStop();
void startPanScrolling(RenderObject*);
-#endif
void stopAutoscrollTimer(bool rendererIsBeingDestroyed = false);
RenderObject* autoscrollRenderer() const;
void updateAutoscrollRenderer();
- bool autoscrollInProgress() const;
- bool mouseDownWasInSubframe() const { return m_mouseDownWasInSubframe; }
- bool panScrollInProgress() const;
+ bool autoscrollInProgress() const { return m_autoscrollInProgress; }
void dispatchFakeMouseMoveEventSoon();
void dispatchFakeMouseMoveEventSoonInQuad(const FloatQuad&);
@@ -276,8 +269,16 @@
bool handleMouseReleaseEvent(const MouseEventWithHitTestResults&);
OptionalCursor selectCursor(const MouseEventWithHitTestResults&, Scrollbar*);
+#if ENABLE(PAN_SCROLLING)
+ void updatePanScrollState();
+#endif
+
void hoverTimerFired(Timer<EventHandler>*);
+ void handleAutoscroll(RenderObject*);
+ void startAutoscrollTimer();
+ void setAutoscrollRenderer(RenderObject*);
+ void autoscrollTimerFired(Timer<EventHandler>*);
bool logicalScrollOverflow(ScrollLogicalDirection, ScrollGranularity, Node* startingNode = 0);
bool shouldTurnVerticalTicksIntoHorizontal(const HitTestResult&, const PlatformWheelEvent&) const;
@@ -400,11 +401,17 @@
LayoutPoint m_dragStartPos;
#endif
+ IntPoint m_panScrollStartPos;
+ bool m_panScrollInProgress;
+
bool m_panScrollButtonPressed;
+ bool m_springLoadedPanScrollInProgress;
Timer<EventHandler> m_hoverTimer;
-
- OwnPtr<AutoscrollController> m_autoscrollController;
+
+ Timer<EventHandler> m_autoscrollTimer;
+ RenderObject* m_autoscrollRenderer;
+ bool m_autoscrollInProgress;
bool m_mouseDownMayStartAutoscroll;
bool m_mouseDownWasInSubframe;
Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (137702 => 137703)
--- trunk/Source/WebCore/rendering/RenderBox.cpp 2012-12-14 03:42:14 UTC (rev 137702)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp 2012-12-14 03:47:00 UTC (rev 137703)
@@ -34,7 +34,6 @@
#include "HitTestResult.h"
#include "htmlediting.h"
#include "HTMLElement.h"
-#include "HTMLFrameOwnerElement.h"
#include "HTMLNames.h"
#include "ImageBuffer.h"
#include "FloatQuad.h"
@@ -643,39 +642,6 @@
layer()->autoscroll();
}
-// There are two kinds of renderer that can autoscroll.
-bool RenderBox::canAutoscroll() const
-{
- // Check for a box that can be scrolled in its own right.
- if (canBeScrolledAndHasScrollableArea())
- return true;
-
- // Check for a box that represents the top level of a web page.
- // This can be scrolled by calling Chrome::scrollRectIntoView.
- // This only has an effect on the Mac platform in applications
- // that put web views into scrolling containers, such as Mac OS X Mail.
- // The code for this is in RenderLayer::scrollRectToVisible.
- if (node() != document())
- return false;
- Frame* frame = this->frame();
- if (!frame)
- return false;
- Page* page = frame->page();
- return page && page->mainFrame() == frame;
-}
-
-RenderBox* RenderBox::findAutoscrollable(RenderObject* renderer)
-{
- while (renderer && !(renderer->isBox() && toRenderBox(renderer)->canAutoscroll())) {
- if (!renderer->parent() && renderer->node() == renderer->document() && renderer->document()->ownerElement())
- renderer = renderer->document()->ownerElement()->renderer();
- else
- renderer = renderer->parent();
- }
-
- return renderer && renderer->isBox() ? toRenderBox(renderer) : 0;
-}
-
void RenderBox::panScroll(const IntPoint& source)
{
if (layer())
Modified: trunk/Source/WebCore/rendering/RenderBox.h (137702 => 137703)
--- trunk/Source/WebCore/rendering/RenderBox.h 2012-12-14 03:42:14 UTC (rev 137702)
+++ trunk/Source/WebCore/rendering/RenderBox.h 2012-12-14 03:47:00 UTC (rev 137703)
@@ -439,8 +439,6 @@
bool canBeScrolledAndHasScrollableArea() const;
virtual bool canBeProgramaticallyScrolled() const;
virtual void autoscroll();
- bool canAutoscroll() const;
- static RenderBox* findAutoscrollable(RenderObject*);
virtual void stopAutoscroll() { }
virtual void panScroll(const IntPoint&);