Changeset 137726 in webkit
- Timestamp:
- Dec 14, 2012 12:32:28 AM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/CMakeLists.txt
r137715 r137726 1721 1721 mathml/MathMLTextElement.cpp 1722 1722 1723 page/AutoscrollController.cpp 1723 1724 page/BarInfo.cpp 1724 1725 page/Chrome.cpp -
trunk/Source/WebCore/ChangeLog
r137724 r137726 1 2012-12-14 Yoshifumi Inoue <yosin@chromium.org> 2 3 Handling autoscroll in EventHandler should be re-factor 4 https://bugs.webkit.org/show_bug.cgi?id=104764 5 6 Reviewed by Hajime Morita. 7 8 This patch introduces new class AutoscrollController for moving autoscroll 9 and panscroll from EventHandler class for ease of maintenance of 10 EventHandler and ease of adding autoscroll related features, e.g. autoscroll 11 during drag-and-drop, autoscoll by gesture. 12 13 No new tests. This patch doesn't change behavior. 14 15 * CMakeLists.txt: Changed to add page/AutoscrollController.cpp 16 * GNUmakefile.list.am: Changed to add page/AutoscrollController.{cpp,h} 17 * Target.pri: Changed to add page/AutoscrollController.cpp 18 * WebCore.gypi: Changed to add page/AutoscrollController.{cpp,h} 19 * WebCore.vcproj/WebCore.vcproj: Changed to add page/AutoscrollController.{cpp,h} 20 * WebCore.xcodeproj/project.pbxproj: Changed to add page/AutoscrollController.{cpp,h} 21 * page/AutoscrollController.cpp: Added. 22 (WebCore::getMainFrame): Helper function. 23 (WebCore::AutoscrollController::AutoscrollController): Moved from EventHandler. 24 (WebCore::AutoscrollController::autoscrollRenderer): Moved from EventHandler. 25 (WebCore::AutoscrollController::autoscrollInProgress): Moved from EventHandler. 26 (WebCore::AutoscrollController::startAutoscrollForSelection): Replacement of EventHandler::handleAutoscroll(). 27 (WebCore::AutoscrollController::stopAutoscrollTimer): Moveed from EventHandler. 28 (WebCore::AutoscrollController::updateAutoscrollRenderer): ditto 29 (WebCore::AutoscrollController::didPanScrollStart): Added for updating pan scrolling status of main frame. 30 (WebCore::AutoscrollController::didPanScrollStop): ditto 31 (WebCore::AutoscrollController::handleMouseReleaseEvent): Extracted from EventHandler. 32 (WebCore::AutoscrollController::panScrollInProgress): Replacement of EventHandler::m_panScrollInProgress. 33 (WebCore::AutoscrollController::startPanScrolling): Moved from EventHandler::startPanScrolling() 34 (WebCore::AutoscrollController::autoscrollTimerFired): Moved from EventHandler::autoscrollTimerFired(). 35 (WebCore::AutoscrollController::startAutoscrollTimer): Moved from EventHandler::startAutoscrollTimer(). 36 (WebCore::AutoscrollController::updatePanScrollState): Moved from EventHandler::updatePanScrollState(). 37 * page/AutoscrollController.h: Added. 38 (AutoscrollController): 39 * page/EventHandler.cpp: 40 (WebCore::EventHandler::EventHandler): Changed autoscroll and panscroll related member variable initializations to m_autoscrollController initialization. 41 (WebCore::EventHandler::handleMouseDraggedEvent): Changed to call AutoscrollController::startAutoscrollForSelection(). 42 (WebCore::EventHandler::handleMouseReleaseEvent): Changed to remove m_autoscrollInProgress reference. 43 (WebCore::EventHandler::didPanScrollStart): Added for updating pan scrolling status of main frame. 44 (WebCore::EventHandler::didPanScrollStop): ditto 45 (WebCore::EventHandler::startPanScrolling): Changed to call AutoscrollController::startPanScrolling(). 46 (WebCore::EventHandler::autoscrollRenderer): Changed to use AutoscrollController. 47 (WebCore::EventHandler::updateAutoscrollRenderer): ditto 48 (WebCore::EventHandler::autoscrollInProgress): ditto 49 (WebCore::EventHandler::panScrollInProgress): Added to replace m_panScrollInProgress. 50 (WebCore::EventHandler::stopAutoscrollTimer): Changed to use AutoscrollController. 51 (WebCore::EventHandler::selectCursor): Changed to use panScrollInProgress(). 52 (WebCore::EventHandler::handleMousePressEvent): Chagned to call AutoscrollController::handleMousePressEvent(). 53 (WebCore::EventHandler::keyEvent): Changed to use panScrollInProgress(). 54 * page/EventHandler.h: 55 (WebCore::EventHandler::autoscrollController): Added for using main frame's panScrollInProgress(). 56 (WebCore::EventHandler::mouseDownWasInSubframe): Added for AutoscrollController. 57 * rendering/RenderBox.cpp: 58 (WebCore::RenderBox::canAutoscroll): Moved from EventHandler.cpp. 59 (WebCore::RenderBox::findAutoscrollable): Moved from EventHandler.cpp. 60 * rendering/RenderBox.h: 61 (RenderBox): Added new functions canAutoscroll() and findAutoscrollable(). 62 1 63 2012-12-14 David Dorwin <ddorwin@chromium.org> 2 64 -
trunk/Source/WebCore/GNUmakefile.list.am
r137715 r137726 4005 4005 Source/WebCore/page/AdjustViewSizeOrNot.h \ 4006 4006 Source/WebCore/page/AlternativeTextClient.h \ 4007 Source/WebCore/page/AutoscrollController.cpp \ 4008 Source/WebCore/page/AutoscrollController.h \ 4007 4009 Source/WebCore/page/BarInfo.cpp \ 4008 4010 Source/WebCore/page/BarInfo.h \ -
trunk/Source/WebCore/Target.pri
r137715 r137726 870 870 page/animation/ImplicitAnimation.cpp \ 871 871 page/animation/KeyframeAnimation.cpp \ 872 page/AutoscrollController.cpp \ 872 873 page/BarInfo.cpp \ 873 874 page/Chrome.cpp \ … … 2017 2018 page/animation/KeyframeAnimation.h \ 2018 2019 page/AdjustViewSizeOrNot.h \ 2020 page/AutoscrollController.h \ 2019 2021 page/BarInfo.h \ 2020 2022 page/Chrome.h \ -
trunk/Source/WebCore/WebCore.gypi
r137715 r137726 2029 2029 'mathml/MathMLTextElement.cpp', 2030 2030 'mathml/MathMLTextElement.h', 2031 'page/AutoscrollController.cpp', 2032 'page/AutoscrollController.h', 2031 2033 'page/BarInfo.cpp', 2032 2034 'page/BarInfo.h', -
trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj
r137703 r137726 26799 26799 </File> 26800 26800 <File 26801 RelativePath="..\page\AutoscrollController.cpp" 26802 > 26803 </File> 26804 <File 26805 RelativePath="..\page\AutoscrollController.h" 26806 > 26807 </File> 26808 <File 26801 26809 RelativePath="..\page\BarInfo.cpp" 26802 26810 > -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r137715 r137726 1233 1233 453EB636159C570400001BB7 /* DateTimeFormat.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 453EB634159C570400001BB7 /* DateTimeFormat.cpp */; }; 1234 1234 453EB637159C570400001BB7 /* DateTimeFormat.h in Headers */ = {isa = PBXBuildFile; fileRef = 453EB635159C570400001BB7 /* DateTimeFormat.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1235 45830D4D1679B4F800ACF8C3 /* AutoscrollController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 45830D4B1679B4F800ACF8C3 /* AutoscrollController.cpp */; }; 1236 45830D4E1679B4F800ACF8C3 /* AutoscrollController.h in Headers */ = {isa = PBXBuildFile; fileRef = 45830D4C1679B4F800ACF8C3 /* AutoscrollController.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1235 1237 45861C72161949DC00010F3A /* BaseMultipleFieldsDateAndTimeInputType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 45861C70161949DC00010F3A /* BaseMultipleFieldsDateAndTimeInputType.cpp */; }; 1236 1238 45861C73161949DC00010F3A /* BaseMultipleFieldsDateAndTimeInputType.h in Headers */ = {isa = PBXBuildFile; fileRef = 45861C71161949DC00010F3A /* BaseMultipleFieldsDateAndTimeInputType.h */; }; … … 8477 8479 453EB634159C570400001BB7 /* DateTimeFormat.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DateTimeFormat.cpp; sourceTree = "<group>"; }; 8478 8480 453EB635159C570400001BB7 /* DateTimeFormat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DateTimeFormat.h; sourceTree = "<group>"; }; 8481 45830D4B1679B4F800ACF8C3 /* AutoscrollController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AutoscrollController.cpp; sourceTree = "<group>"; }; 8482 45830D4C1679B4F800ACF8C3 /* AutoscrollController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AutoscrollController.h; sourceTree = "<group>"; }; 8479 8483 45861C70161949DC00010F3A /* BaseMultipleFieldsDateAndTimeInputType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BaseMultipleFieldsDateAndTimeInputType.cpp; sourceTree = "<group>"; }; 8480 8484 45861C71161949DC00010F3A /* BaseMultipleFieldsDateAndTimeInputType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BaseMultipleFieldsDateAndTimeInputType.h; sourceTree = "<group>"; }; … … 15956 15960 BCF48CE61370D114004E87D6 /* AdjustViewSizeOrNot.h */, 15957 15961 CEDA12D6152CA1CB00D9E08D /* AlternativeTextClient.h */, 15962 45830D4B1679B4F800ACF8C3 /* AutoscrollController.cpp */, 15963 45830D4C1679B4F800ACF8C3 /* AutoscrollController.h */, 15958 15964 BC124EE40C2641CD009E2349 /* BarInfo.cpp */, 15959 15965 BC124EE50C2641CD009E2349 /* BarInfo.h */, … … 22685 22691 514C764C0CE9234E007EF3CD /* AuthenticationMac.h in Headers */, 22686 22692 51E1ECB30C91C55600DC255B /* AutodrainedPool.h in Headers */, 22693 45830D4E1679B4F800ACF8C3 /* AutoscrollController.h in Headers */, 22687 22694 A8CFF04E0A154F09000A4234 /* AutoTableLayout.h in Headers */, 22688 22695 29A812380FBB9C1D00510293 /* AXObjectCache.h in Headers */, … … 26323 26330 514C764D0CE9234E007EF3CD /* AuthenticationMac.mm in Sources */, 26324 26331 51E1ECAF0C91C54600DC255B /* AutodrainedPool.mm in Sources */, 26332 45830D4D1679B4F800ACF8C3 /* AutoscrollController.cpp in Sources */, 26325 26333 A8CFF0500A154F09000A4234 /* AutoTableLayout.cpp in Sources */, 26326 26334 29A8124B0FBB9CA900510293 /* AXObjectCacheMac.mm in Sources */, -
trunk/Source/WebCore/page/EventHandler.cpp
r137703 r137726 30 30 31 31 #include "AXObjectCache.h" 32 #include "AutoscrollController.h" 32 33 #include "CachedImage.h" 33 34 #include "Chrome.h" … … 138 139 #endif 139 140 140 // When the autoscroll or the panScroll is triggered when do the scroll every 0.05s to make it smooth141 const double autoscrollInterval = 0.05;142 143 141 // The amount of time to wait before sending a fake mouse event, triggered 144 142 // during a scroll. The short interval is used if the content responds to the mouse events quickly enough, … … 332 330 , m_mouseDownWasSingleClickInSelection(false) 333 331 , m_selectionInitiationState(HaveNotStartedSelection) 334 , m_panScrollInProgress(false)335 , m_panScrollButtonPressed(false)336 , m_springLoadedPanScrollInProgress(false)337 332 , m_hoverTimer(this, &EventHandler::hoverTimerFired) 338 , m_autoscrollTimer(this, &EventHandler::autoscrollTimerFired) 339 , m_autoscrollRenderer(0) 340 , m_autoscrollInProgress(false) 333 , m_autoscrollController(adoptPtr(new AutoscrollController)) 341 334 , m_mouseDownMayStartAutoscroll(false) 342 335 , m_mouseDownWasInSubframe(false) … … 705 698 } 706 699 707 // There are two kinds of renderer that can autoscroll.708 static bool canAutoscroll(RenderObject* renderer)709 {710 if (!renderer->isBox())711 return false;712 713 // Check for a box that can be scrolled in its own right.714 if (toRenderBox(renderer)->canBeScrolledAndHasScrollableArea())715 return true;716 717 // Check for a box that represents the top level of a web page.718 // This can be scrolled by calling Chrome::scrollRectIntoView.719 // This only has an effect on the Mac platform in applications720 // that put web views into scrolling containers, such as Mac OS X Mail.721 // The code for this is in RenderLayer::scrollRectToVisible.722 if (renderer->node() != renderer->document())723 return false;724 Frame* frame = renderer->frame();725 if (!frame)726 return false;727 Page* page = frame->page();728 return page && page->mainFrame() == frame;729 }730 731 700 #if ENABLE(DRAG_SUPPORT) 732 701 bool EventHandler::handleMouseDraggedEvent(const MouseEventWithHitTestResults& event) … … 755 724 m_mouseDownMayStartDrag = false; 756 725 757 if (m_mouseDownMayStartAutoscroll && !m_panScrollInProgress) { 758 // Find a renderer that can autoscroll. 759 while (renderer && !canAutoscroll(renderer)) { 760 if (!renderer->parent() && renderer->node() == renderer->document() && renderer->document()->ownerElement()) 761 renderer = renderer->document()->ownerElement()->renderer(); 762 else 763 renderer = renderer->parent(); 764 } 765 766 if (renderer) { 767 m_autoscrollInProgress = true; 768 handleAutoscroll(renderer); 769 } 770 726 if (m_mouseDownMayStartAutoscroll && !panScrollInProgress()) { 727 m_autoscrollController->startAutoscrollForSelection(renderer); 771 728 m_mouseDownMayStartAutoscroll = false; 772 729 } … … 936 893 bool EventHandler::handleMouseReleaseEvent(const MouseEventWithHitTestResults& event) 937 894 { 938 if ( m_autoscrollInProgress)895 if (autoscrollInProgress()) 939 896 stopAutoscrollTimer(); 940 897 … … 991 948 } 992 949 993 void EventHandler::handleAutoscroll(RenderObject* renderer)994 {995 // We don't want to trigger the autoscroll or the panScroll if it's already active996 if (m_autoscrollTimer.isActive())997 return;998 999 setAutoscrollRenderer(renderer);1000 1001 950 #if ENABLE(PAN_SCROLLING) 1002 if (m_panScrollInProgress) { 1003 m_panScrollStartPos = lastKnownMousePosition(); 1004 if (FrameView* view = m_frame->view()) 1005 view->addPanScrollIcon(m_panScrollStartPos); 1006 // If we're not in the top frame we notify it that we doing a panScroll. 1007 if (Page* page = m_frame->page()) { 1008 Frame* mainFrame = page->mainFrame(); 1009 if (m_frame != mainFrame) 1010 mainFrame->eventHandler()->m_panScrollInProgress = true; 1011 } 1012 } 1013 #endif 1014 1015 startAutoscrollTimer(); 1016 } 1017 1018 void EventHandler::autoscrollTimerFired(Timer<EventHandler>*) 1019 { 1020 RenderObject* r = autoscrollRenderer(); 1021 if (!r || !r->isBox()) { 1022 stopAutoscrollTimer(); 951 952 void EventHandler::didPanScrollStart() 953 { 954 m_autoscrollController->didPanScrollStart(); 955 } 956 957 void EventHandler::didPanScrollStop() 958 { 959 m_autoscrollController->didPanScrollStop(); 960 } 961 962 void EventHandler::startPanScrolling(RenderObject* renderer) 963 { 964 if (!renderer->isBox()) 1023 965 return; 1024 } 1025 1026 if (m_autoscrollInProgress) { 1027 if (!m_mousePressed) { 1028 stopAutoscrollTimer(); 1029 return; 1030 } 1031 toRenderBox(r)->autoscroll(); 1032 } else { 1033 // we verify that the main frame hasn't received the order to stop the panScroll 1034 if (Page* page = m_frame->page()) { 1035 if (!page->mainFrame()->eventHandler()->m_panScrollInProgress) { 1036 stopAutoscrollTimer(); 1037 return; 1038 } 1039 } 1040 #if ENABLE(PAN_SCROLLING) 1041 updatePanScrollState(); 1042 toRenderBox(r)->panScroll(m_panScrollStartPos); 1043 #endif 1044 } 1045 } 1046 1047 #if ENABLE(PAN_SCROLLING) 1048 1049 void EventHandler::startPanScrolling(RenderObject* renderer) 1050 { 1051 m_panScrollInProgress = true; 1052 m_panScrollButtonPressed = true; 1053 handleAutoscroll(renderer); 966 m_autoscrollController->startPanScrolling(toRenderBox(renderer), lastKnownMousePosition()); 1054 967 invalidateClick(); 1055 968 } 1056 969 1057 void EventHandler::updatePanScrollState()1058 {1059 FrameView* view = m_frame->view();1060 if (!view)1061 return;1062 1063 // At the original click location we draw a 4 arrowed icon. Over this icon there won't be any scroll1064 // So we don't want to change the cursor over this area1065 bool east = m_panScrollStartPos.x() < (m_lastKnownMousePosition.x() - ScrollView::noPanScrollRadius);1066 bool west = m_panScrollStartPos.x() > (m_lastKnownMousePosition.x() + ScrollView::noPanScrollRadius);1067 bool north = m_panScrollStartPos.y() > (m_lastKnownMousePosition.y() + ScrollView::noPanScrollRadius);1068 bool south = m_panScrollStartPos.y() < (m_lastKnownMousePosition.y() - ScrollView::noPanScrollRadius);1069 1070 if ((east || west || north || south) && m_panScrollButtonPressed)1071 m_springLoadedPanScrollInProgress = true;1072 1073 if (north) {1074 if (east)1075 view->setCursor(northEastPanningCursor());1076 else if (west)1077 view->setCursor(northWestPanningCursor());1078 else1079 view->setCursor(northPanningCursor());1080 } else if (south) {1081 if (east)1082 view->setCursor(southEastPanningCursor());1083 else if (west)1084 view->setCursor(southWestPanningCursor());1085 else1086 view->setCursor(southPanningCursor());1087 } else if (east)1088 view->setCursor(eastPanningCursor());1089 else if (west)1090 view->setCursor(westPanningCursor());1091 else1092 view->setCursor(middlePanningCursor());1093 }1094 1095 970 #endif // ENABLE(PAN_SCROLLING) 1096 971 1097 972 RenderObject* EventHandler::autoscrollRenderer() const 1098 973 { 1099 return m_autoscroll Renderer;974 return m_autoscrollController->autoscrollRenderer(); 1100 975 } 1101 976 1102 977 void EventHandler::updateAutoscrollRenderer() 1103 978 { 1104 if (!m_autoscrollRenderer) 1105 return; 1106 1107 HitTestResult hitTest = hitTestResultAtPoint(m_panScrollStartPos, true); 1108 1109 if (Node* nodeAtPoint = hitTest.innerNode()) 1110 m_autoscrollRenderer = nodeAtPoint->renderer(); 1111 1112 while (m_autoscrollRenderer && !canAutoscroll(m_autoscrollRenderer)) 1113 m_autoscrollRenderer = m_autoscrollRenderer->parent(); 1114 } 1115 1116 void EventHandler::setAutoscrollRenderer(RenderObject* renderer) 1117 { 1118 m_autoscrollRenderer = renderer; 979 m_autoscrollController->updateAutoscrollRenderer(); 980 } 981 982 bool EventHandler::autoscrollInProgress() const 983 { 984 return m_autoscrollController->autoscrollInProgress(); 985 } 986 987 bool EventHandler::panScrollInProgress() const 988 { 989 return m_autoscrollController->panScrollInProgress(); 1119 990 } 1120 991 … … 1196 1067 } 1197 1068 1198 1199 void EventHandler::startAutoscrollTimer()1200 {1201 m_autoscrollTimer.startRepeating(autoscrollInterval);1202 }1203 1204 1069 void EventHandler::stopAutoscrollTimer(bool rendererIsBeingDestroyed) 1205 1070 { 1206 if (m_autoscrollInProgress) { 1207 if (m_mouseDownWasInSubframe) { 1208 if (Frame* subframe = subframeForTargetNode(m_mousePressNode.get())) 1209 subframe->eventHandler()->stopAutoscrollTimer(rendererIsBeingDestroyed); 1210 return; 1211 } 1212 } 1213 1214 if (autoscrollRenderer()) { 1215 if (!rendererIsBeingDestroyed && (m_autoscrollInProgress || m_panScrollInProgress)) 1216 toRenderBox(autoscrollRenderer())->stopAutoscroll(); 1217 #if ENABLE(PAN_SCROLLING) 1218 if (m_panScrollInProgress) { 1219 if (FrameView* view = m_frame->view()) { 1220 view->removePanScrollIcon(); 1221 view->setCursor(pointerCursor()); 1222 } 1223 } 1224 #endif 1225 1226 setAutoscrollRenderer(0); 1227 } 1228 1229 m_autoscrollTimer.stop(); 1230 1231 m_panScrollInProgress = false; 1232 m_springLoadedPanScrollInProgress = false; 1233 1234 // If we're not in the top frame we notify it that we are not doing a panScroll any more. 1235 if (Page* page = m_frame->page()) { 1236 Frame* mainFrame = page->mainFrame(); 1237 if (m_frame != mainFrame) 1238 mainFrame->eventHandler()->m_panScrollInProgress = false; 1239 } 1240 1241 m_autoscrollInProgress = false; 1071 m_autoscrollController->stopAutoscrollTimer(rendererIsBeingDestroyed); 1242 1072 } 1243 1073 … … 1422 1252 if (!page) 1423 1253 return NoCursorChange; 1424 if (page->mainFrame()->eventHandler()->m_panScrollInProgress) 1254 #if ENABLE(PAN_SCROLLING) 1255 if (page->mainFrame()->eventHandler()->panScrollInProgress()) 1425 1256 return NoCursorChange; 1257 #endif 1426 1258 1427 1259 Node* node = event.targetNode(); … … 1653 1485 #if ENABLE(PAN_SCROLLING) 1654 1486 // We store whether pan scrolling is in progress before calling stopAutoscrollTimer() 1655 // because it will set m_panScrollInProgress to false on return. 1656 bool isPanScrollInProgress = m_frame->page() && m_frame->page()->mainFrame()->eventHandler()->m_panScrollInProgress; 1657 if (isPanScrollInProgress || m_autoscrollInProgress) 1658 stopAutoscrollTimer(); 1487 // because it will set m_autoscrollType to NoAutoscroll on return. 1488 bool isPanScrollInProgress = m_frame->page() && m_frame->page()->mainFrame()->eventHandler()->panScrollInProgress(); 1489 stopAutoscrollTimer(); 1659 1490 if (isPanScrollInProgress) { 1660 1491 // We invalidate the click when exiting pan scrolling so that we don't inadvertently navigate … … 1951 1782 1952 1783 #if ENABLE(PAN_SCROLLING) 1953 if (mouseEvent.button() == MiddleButton) 1954 m_panScrollButtonPressed = false; 1955 if (m_springLoadedPanScrollInProgress) 1956 stopAutoscrollTimer(); 1784 m_autoscrollController->handleMouseReleaseEvent(mouseEvent); 1957 1785 #endif 1958 1786 … … 3144 2972 #if ENABLE(PAN_SCROLLING) 3145 2973 if (Page* page = m_frame->page()) { 3146 if (page->mainFrame()->eventHandler()-> m_panScrollInProgress) {2974 if (page->mainFrame()->eventHandler()->panScrollInProgress()) { 3147 2975 // If a key is pressed while the panScroll is in progress then we want to stop 3148 2976 if (initialKeyEvent.type() == PlatformEvent::KeyDown || initialKeyEvent.type() == PlatformEvent::RawKeyDown) -
trunk/Source/WebCore/page/EventHandler.h
r137703 r137726 52 52 namespace WebCore { 53 53 54 class AutoscrollController; 54 55 class Clipboard; 55 56 class Event; … … 110 111 void setMousePressNode(PassRefPtr<Node>); 111 112 113 #if ENABLE(PAN_SCROLLING) 114 void didPanScrollStart(); 115 void didPanScrollStop(); 112 116 void startPanScrolling(RenderObject*); 117 #endif 113 118 114 119 void stopAutoscrollTimer(bool rendererIsBeingDestroyed = false); 115 120 RenderObject* autoscrollRenderer() const; 116 121 void updateAutoscrollRenderer(); 117 bool autoscrollInProgress() const { return m_autoscrollInProgress; } 122 bool autoscrollInProgress() const; 123 bool mouseDownWasInSubframe() const { return m_mouseDownWasInSubframe; } 124 bool panScrollInProgress() const; 118 125 119 126 void dispatchFakeMouseMoveEventSoon(); … … 270 277 271 278 OptionalCursor selectCursor(const MouseEventWithHitTestResults&, Scrollbar*); 272 #if ENABLE(PAN_SCROLLING)273 void updatePanScrollState();274 #endif275 276 279 void hoverTimerFired(Timer<EventHandler>*); 277 280 278 void handleAutoscroll(RenderObject*);279 void startAutoscrollTimer();280 void setAutoscrollRenderer(RenderObject*);281 void autoscrollTimerFired(Timer<EventHandler>*);282 281 bool logicalScrollOverflow(ScrollLogicalDirection, ScrollGranularity, Node* startingNode = 0); 283 282 … … 402 401 #endif 403 402 404 IntPoint m_panScrollStartPos;405 bool m_panScrollInProgress;406 407 403 bool m_panScrollButtonPressed; 408 bool m_springLoadedPanScrollInProgress;409 404 410 405 Timer<EventHandler> m_hoverTimer; 411 412 Timer<EventHandler> m_autoscrollTimer; 413 RenderObject* m_autoscrollRenderer; 414 bool m_autoscrollInProgress; 406 407 OwnPtr<AutoscrollController> m_autoscrollController; 415 408 bool m_mouseDownMayStartAutoscroll; 416 409 bool m_mouseDownWasInSubframe; -
trunk/Source/WebCore/rendering/RenderBox.cpp
r137703 r137726 35 35 #include "htmlediting.h" 36 36 #include "HTMLElement.h" 37 #include "HTMLFrameOwnerElement.h" 37 38 #include "HTMLNames.h" 38 39 #include "ImageBuffer.h" … … 641 642 if (layer()) 642 643 layer()->autoscroll(); 644 } 645 646 // There are two kinds of renderer that can autoscroll. 647 bool RenderBox::canAutoscroll() const 648 { 649 // Check for a box that can be scrolled in its own right. 650 if (canBeScrolledAndHasScrollableArea()) 651 return true; 652 653 // Check for a box that represents the top level of a web page. 654 // This can be scrolled by calling Chrome::scrollRectIntoView. 655 // This only has an effect on the Mac platform in applications 656 // that put web views into scrolling containers, such as Mac OS X Mail. 657 // The code for this is in RenderLayer::scrollRectToVisible. 658 if (node() != document()) 659 return false; 660 Frame* frame = this->frame(); 661 if (!frame) 662 return false; 663 Page* page = frame->page(); 664 return page && page->mainFrame() == frame; 665 } 666 667 RenderBox* RenderBox::findAutoscrollable(RenderObject* renderer) 668 { 669 while (renderer && !(renderer->isBox() && toRenderBox(renderer)->canAutoscroll())) { 670 if (!renderer->parent() && renderer->node() == renderer->document() && renderer->document()->ownerElement()) 671 renderer = renderer->document()->ownerElement()->renderer(); 672 else 673 renderer = renderer->parent(); 674 } 675 676 return renderer && renderer->isBox() ? toRenderBox(renderer) : 0; 643 677 } 644 678 -
trunk/Source/WebCore/rendering/RenderBox.h
r137703 r137726 440 440 virtual bool canBeProgramaticallyScrolled() const; 441 441 virtual void autoscroll(); 442 bool canAutoscroll() const; 443 static RenderBox* findAutoscrollable(RenderObject*); 442 444 virtual void stopAutoscroll() { } 443 445 virtual void panScroll(const IntPoint&);
Note: See TracChangeset
for help on using the changeset viewer.