Changeset 61598 in webkit
- Timestamp:
- Jun 21, 2010 7:28:51 PM (14 years ago)
- Location:
- trunk/WebKit/chromium
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKit/chromium/ChangeLog
r61547 r61598 1 2010-06-21 MORITA Hajime <morrita@google.com> 2 3 Reviewed by Darin Fisher. 4 5 [Chromium] Dragging outside the frame immediately causes page to scroll 6 http://webkit.org/b/40461 7 8 This is regression that was introduced at http://webkit.org/b/39725. 9 10 There are 2 problems: 11 1. It starts auto-scrolling immediately. We should have some delay. 12 2. The scroll continues even after a mouse cursor goes outside a frame. 13 The scroll should be stopped when the curosr has left. 14 15 This change introduced DragScrollTimer to handle 1. 16 At the same time, it fixed DragScrollTimer::scrollDistanceFor() to 17 handle 2, We now stop scrolling when the cursor gone. 18 19 * WebKit.gyp: 20 * src/DragScrollTimer.cpp: Added. 21 (WebKit::distanceToRect): 22 (WebKit::DragScrollTimer::DragScrollTimer): 23 (WebKit::DragScrollTimer::~DragScrollTimer): 24 (WebKit::DragScrollTimer::stop): 25 (WebKit::DragScrollTimer::scroll): 26 (WebKit::DragScrollTimer::update): 27 (WebKit::DragScrollTimer::triggerScroll): 28 (WebKit::DragScrollTimer::scrollDistanceFor): 29 * src/DragScrollTimer.h: Added. 30 (WebKit::DragScrollTimer::fired): 31 (WebKit::DragScrollTimer::shouldScroll): 32 * src/WebViewImpl.cpp: 33 (WebKit::WebViewImpl::WebViewImpl): 34 (WebKit::WebViewImpl::dragSourceEndedAt): 35 (WebKit::WebViewImpl::dragSourceMovedTo): 36 (WebKit::WebViewImpl::dragTargetDrop): 37 (WebKit::WebViewImpl::dragTargetDragEnterOrOver): 38 * src/WebViewImpl.h: 39 1 40 2010-06-21 Kent Tamura <tkent@chromium.org> 2 41 -
trunk/WebKit/chromium/WebKit.gyp
r61539 r61598 262 262 'src/DragClientImpl.cpp', 263 263 'src/DragClientImpl.h', 264 'src/DragScrollTimer.cpp', 265 'src/DragScrollTimer.h', 264 266 'src/EditorClientImpl.cpp', 265 267 'src/EditorClientImpl.h', -
trunk/WebKit/chromium/src/WebViewImpl.cpp
r61484 r61598 47 47 #include "DOMUtilitiesPrivate.h" 48 48 #include "DragController.h" 49 #include "DragScrollTimer.h" 49 50 #include "DragData.h" 50 51 #include "Editor.h" … … 83 84 #include "SelectionController.h" 84 85 #include "Settings.h" 86 #include "Timer.h" 85 87 #include "TypingCommand.h" 86 88 #include "WebAccessibilityObject.h" … … 240 242 , m_isTransparent(false) 241 243 , m_tabsToLinks(false) 244 , m_dragScrollTimer(new DragScrollTimer()) 242 245 #if USE(ACCELERATED_COMPOSITING) 243 246 , m_layerRenderer(0) … … 829 832 } 830 833 831 // Computes the distance from a point outside a rect to the nearest edge of the rect.832 static IntSize distanceToRect(const IntPoint& point, const IntRect& rect)833 {834 int dx = 0, dy = 0;835 if (point.x() < rect.x())836 dx = point.x() - rect.x();837 else if (rect.right() < point.x())838 dx = point.x() - rect.right();839 if (point.y() < rect.y())840 dy = point.y() - rect.y();841 else if (rect.bottom() < point.y())842 dy = point.y() - rect.bottom();843 return IntSize(dx, dy);844 }845 846 void WebViewImpl::scrollForDragging(const WebPoint& clientPoint)847 {848 // This margin approximates Safari behavior, derived from an observation.849 static const int scrollMargin = 30;850 851 FrameView* view = mainFrameImpl()->frameView();852 if (!view)853 return;854 855 IntRect bounds(0, 0, view->visibleWidth(), view->visibleHeight());856 bounds.setY(bounds.y() + scrollMargin);857 bounds.setHeight(bounds.height() - scrollMargin * 2);858 bounds.setX(bounds.x() + scrollMargin);859 bounds.setWidth(bounds.width() - scrollMargin * 2);860 861 IntPoint point = clientPoint;862 if (bounds.contains(point))863 return;864 865 IntSize toScroll = distanceToRect(point, bounds);866 if (!toScroll.isZero())867 view->scrollBy(toScroll);868 }869 870 834 void WebViewImpl::hideSelectPopup() 871 835 { … … 1666 1630 m_page->mainFrame()->eventHandler()->dragSourceEndedAt(pme, 1667 1631 static_cast<DragOperation>(operation)); 1632 m_dragScrollTimer->stop(); 1668 1633 } 1669 1634 … … 1673 1638 WebDragOperation operation) 1674 1639 { 1675 scrollForDragging(clientPoint);1640 m_dragScrollTimer->triggerScroll(mainFrameImpl()->frameView(), clientPoint); 1676 1641 } 1677 1642 … … 1762 1727 m_dragOperation = WebDragOperationNone; 1763 1728 m_dragIdentity = 0; 1729 m_dragScrollTimer->stop(); 1764 1730 } 1765 1731 … … 1797 1763 1798 1764 if (dragAction == DragOver) 1799 scrollForDragging(clientPoint); 1765 m_dragScrollTimer->triggerScroll(mainFrameImpl()->frameView(), clientPoint); 1766 else 1767 m_dragScrollTimer->stop(); 1768 1800 1769 1801 1770 return m_dragOperation; -
trunk/WebKit/chromium/src/WebViewImpl.h
r61484 r61598 69 69 class AutoFillPopupMenuClient; 70 70 class ContextMenuClientImpl; 71 class DragScrollTimer; 71 72 class SuggestionsPopupMenuClient; 72 73 class WebAccessibilityObject; … … 363 364 bool scrollViewWithKeyboard(int keyCode, int modifiers); 364 365 365 void scrollForDragging(const WebPoint&);366 367 366 void hideSelectPopup(); 368 367 … … 508 507 typedef HashMap<WebCore::String, WebCore::String> SettingsMap; 509 508 OwnPtr<SettingsMap> m_inspectorSettingsMap; 509 OwnPtr<DragScrollTimer> m_dragScrollTimer; 510 510 511 511 #if ENABLE(NOTIFICATIONS)
Note: See TracChangeset
for help on using the changeset viewer.