Changeset 143418 in webkit
- Timestamp:
- Feb 19, 2013 5:42:47 PM (11 years ago)
- Location:
- trunk/Source
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r143417 r143418 1 2013-02-19 Conrad Shultz <conrad_shultz@apple.com> 2 3 Allow UI clients to handle vertical wheel events. 4 https://bugs.webkit.org/show_bug.cgi?id=110006 5 6 Reviewed by Tim Horton. 7 8 Add API to allow matching changes in WebKit2 to control rubber-banding behavior at vertical page extrema. 9 If rubber-banding is disabled during a scroll event that would otherwise trigger rubber-banding, dispatch 10 didNotHandleWheelEvent() to the page UI client. 11 12 * WebCore.exp.in: 13 Export new rubber-banding API. 14 15 * page/Page.cpp: 16 (WebCore): 17 (WebCore::Page::rubberBandsAtBottom): 18 Proxy for the corresponding function in ScrollingCoordinator. 19 (WebCore::Page::setRubberBandsAtBottom): 20 Ditto. 21 (WebCore::Page::rubberBandsAtTop): 22 Ditto. 23 (WebCore::Page::setRubberBandsAtTop): 24 Ditto. 25 26 * page/Page.h: 27 (Page): 28 Declare new rubber-banding API (above). 29 30 * page/scrolling/ScrollingCoordinator.h: 31 (WebCore::ScrollingCoordinator::rubberBandsAtBottom): 32 Stub API implementation. 33 (WebCore::ScrollingCoordinator::setRubberBandsAtBottom): 34 Ditto. 35 (WebCore::ScrollingCoordinator::rubberBandsAtTop): 36 Ditto. 37 (WebCore::ScrollingCoordinator::setRubberBandsAtTop): 38 Ditto. 39 40 * page/scrolling/ScrollingTree.cpp: 41 (WebCore::ScrollingTree::ScrollingTree): 42 Initialize new member variables. 43 (WebCore::ScrollingTree::setMainFramePinState): 44 Set top/bottom pinned states. 45 (WebCore::ScrollingTree::rubberBandsAtBottom): 46 New accessor function. 47 (WebCore::ScrollingTree::setRubberBandsAtBottom): 48 New mutator function. 49 (WebCore::ScrollingTree::rubberBandsAtTop): 50 New accessor function. 51 (WebCore::ScrollingTree::setRubberBandsAtTop): 52 New mutator function. 53 (WebCore::ScrollingTree::willWheelEventStartSwipeGesture): 54 Start a vertical swipe event if the frame is pinned at the top or bottom and associated rubber-banding is disabled. 55 56 * page/scrolling/ScrollingTree.h: 57 (ScrollingTree): 58 Declare new rubber-banding API and associated member variables. 59 60 * page/scrolling/mac/ScrollingCoordinatorMac.h: 61 (ScrollingCoordinatorMac): 62 Declare API overrides. 63 64 * page/scrolling/mac/ScrollingCoordinatorMac.mm: 65 (WebCore::ScrollingCoordinatorMac::rubberBandsAtBottom): 66 Method override; proxy to corresponding function in ScrollingTree. 67 (WebCore::ScrollingCoordinatorMac::setRubberBandsAtBottom): 68 Ditto. 69 (WebCore::ScrollingCoordinatorMac::rubberBandsAtTop): 70 Ditto. 71 (WebCore::ScrollingCoordinatorMac::setRubberBandsAtTop): 72 Ditto. 73 74 * page/scrolling/mac/ScrollingTreeScrollingNodeMac.mm: 75 (WebCore::ScrollingTreeScrollingNodeMac::pinnedInDirection): 76 Remove trailing whitespace. 77 (WebCore::ScrollingTreeScrollingNodeMac::updateMainFramePinState): 78 Calculate and pass vertical pinning state to ScrollingTree::setMainFramePinState(). 79 1 80 2013-02-19 Simon Fraser <simon.fraser@apple.com> 2 81 -
trunk/Source/WebCore/WebCore.exp.in
r143398 r143418 783 783 __ZN7WebCore4Page19addLayoutMilestonesEj 784 784 __ZN7WebCore4Page19visitedStateChangedEPNS_9PageGroupEy 785 __ZN7WebCore4Page19setRubberBandsAtTopEb 785 786 __ZN7WebCore4Page20setDeviceScaleFactorEf 786 787 __ZN7WebCore4Page20unmarkAllTextMatchesEv … … 788 789 __ZN7WebCore4Page22allVisitedStateChangedEPNS_9PageGroupE 789 790 __ZN7WebCore4Page22nonFastScrollableRectsEPKNS_5FrameE 791 __ZN7WebCore4Page22setRubberBandsAtBottomEb 790 792 __ZN7WebCore4Page23clearUndoRedoOperationsEv 791 793 __ZN7WebCore4Page24findStringMatchingRangesERKN3WTF6StringEjiPNS1_6VectorINS1_6RefPtrINS_5RangeEEELm0EEERi … … 2702 2704 __ZN7WebCore15ScrollingThread8dispatchERKN3WTF8FunctionIFvvEEE 2703 2705 __ZN7WebCore20ScrollingCoordinator44setForceMainThreadScrollLayerPositionUpdatesEb 2706 __ZNK7WebCore23ScrollingCoordinatorMac19rubberBandsAtBottomEv 2707 __ZNK7WebCore23ScrollingCoordinatorMac16rubberBandsAtTopEv 2708 __ZN7WebCore23ScrollingCoordinatorMac22setRubberBandsAtBottomEb 2709 __ZN7WebCore23ScrollingCoordinatorMac19setRubberBandsAtTopEb 2704 2710 __ZN7WebCore4Page20scrollingCoordinatorEv 2705 2711 #endif -
trunk/Source/WebCore/page/Page.cpp
r142271 r143418 816 816 } 817 817 818 bool Page::rubberBandsAtBottom() 819 { 820 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator()) 821 return scrollingCoordinator->rubberBandsAtBottom(); 822 823 return false; 824 } 825 826 void Page::setRubberBandsAtBottom(bool rubberBandsAtBottom) 827 { 828 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator()) 829 scrollingCoordinator->setRubberBandsAtBottom(rubberBandsAtBottom); 830 } 831 832 bool Page::rubberBandsAtTop() 833 { 834 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator()) 835 return scrollingCoordinator->rubberBandsAtTop(); 836 837 return false; 838 } 839 840 void Page::setRubberBandsAtTop(bool rubberBandsAtTop) 841 { 842 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator()) 843 scrollingCoordinator->setRubberBandsAtTop(rubberBandsAtTop); 844 } 845 818 846 void Page::setPagination(const Pagination& pagination) 819 847 { -
trunk/Source/WebCore/page/Page.h
r142069 r143418 272 272 void setShouldSuppressScrollbarAnimations(bool suppressAnimations); 273 273 274 bool rubberBandsAtBottom(); 275 void setRubberBandsAtBottom(bool); 276 bool rubberBandsAtTop(); 277 void setRubberBandsAtTop(bool); 278 274 279 // Page and FrameView both store a Pagination value. Page::pagination() is set only by API, 275 280 // and FrameView::pagination() is set only by CSS. Page::pagination() will affect all -
trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h
r143404 r143418 125 125 virtual String scrollingStateTreeAsText() const; 126 126 virtual bool isRubberBandInProgress() const { return false; } 127 virtual bool rubberBandsAtBottom() const { return false; } 128 virtual void setRubberBandsAtBottom(bool) { } 129 virtual bool rubberBandsAtTop() const { return false; } 130 virtual void setRubberBandsAtTop(bool) { } 127 131 128 132 // Generated a unique id for scroll layers. -
trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp
r142691 r143418 1 1 /* 2 * Copyright (C) 2012 Apple Inc. All rights reserved.2 * Copyright (C) 2012, 2013 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 54 54 , m_mainFramePinnedToTheLeft(false) 55 55 , m_mainFramePinnedToTheRight(false) 56 , m_rubberBandsAtBottom(true) 57 , m_rubberBandsAtTop(true) 58 , m_mainFramePinnedToTheTop(false) 59 , m_mainFramePinnedToTheBottom(false) 56 60 , m_mainFrameIsRubberBanding(false) 57 61 , m_scrollingPerformanceLoggingEnabled(false) … … 226 230 } 227 231 228 void ScrollingTree::setMainFramePinState(bool pinnedToTheLeft, bool pinnedToTheRight )232 void ScrollingTree::setMainFramePinState(bool pinnedToTheLeft, bool pinnedToTheRight, bool pinnedToTheTop, bool pinnedToTheBottom) 229 233 { 230 234 MutexLocker locker(m_swipeStateMutex); … … 232 236 m_mainFramePinnedToTheLeft = pinnedToTheLeft; 233 237 m_mainFramePinnedToTheRight = pinnedToTheRight; 238 m_mainFramePinnedToTheTop = pinnedToTheTop; 239 m_mainFramePinnedToTheBottom = pinnedToTheBottom; 234 240 } 235 241 … … 291 297 } 292 298 299 bool ScrollingTree::rubberBandsAtBottom() 300 { 301 MutexLocker lock(m_swipeStateMutex); 302 303 return m_rubberBandsAtBottom; 304 } 305 306 void ScrollingTree::setRubberBandsAtBottom(bool rubberBandsAtBottom) 307 { 308 MutexLocker locker(m_swipeStateMutex); 309 310 m_rubberBandsAtBottom = rubberBandsAtBottom; 311 } 312 313 bool ScrollingTree::rubberBandsAtTop() 314 { 315 MutexLocker lock(m_swipeStateMutex); 316 317 return m_rubberBandsAtTop; 318 } 319 320 void ScrollingTree::setRubberBandsAtTop(bool rubberBandsAtTop) 321 { 322 MutexLocker locker(m_swipeStateMutex); 323 324 m_rubberBandsAtTop = rubberBandsAtTop; 325 } 326 293 327 bool ScrollingTree::willWheelEventStartSwipeGesture(const PlatformWheelEvent& wheelEvent) 294 328 { 295 329 if (wheelEvent.phase() != PlatformWheelEventPhaseBegan) 296 return false;297 if (!wheelEvent.deltaX())298 330 return false; 299 331 … … 304 336 if (wheelEvent.deltaX() < 0 && m_mainFramePinnedToTheRight && m_canGoForward) 305 337 return true; 338 if (wheelEvent.deltaY() > 0 && m_mainFramePinnedToTheTop && !m_rubberBandsAtTop) 339 return true; 340 if (wheelEvent.deltaY() < 0 && m_mainFramePinnedToTheBottom && !m_rubberBandsAtBottom) 341 return true; 306 342 307 343 return false; -
trunk/Source/WebCore/page/scrolling/ScrollingTree.h
r142691 r143418 1 1 /* 2 * Copyright (C) 2012 Apple Inc. All rights reserved.2 * Copyright (C) 2012, 2013 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 86 86 void commitNewTreeState(PassOwnPtr<ScrollingStateTree>); 87 87 88 void setMainFramePinState(bool pinnedToTheLeft, bool pinnedToTheRight );88 void setMainFramePinState(bool pinnedToTheLeft, bool pinnedToTheRight, bool pinnedToTheTop, bool pinnedToTheBottom); 89 89 90 90 void updateMainFrameScrollPosition(const IntPoint& scrollPosition, SetOrSyncScrollingLayerPosition = SyncScrollingLayerPosition); … … 97 97 bool canGoBack(); 98 98 bool canGoForward(); 99 100 bool rubberBandsAtBottom(); 101 void setRubberBandsAtBottom(bool); 102 bool rubberBandsAtTop(); 103 void setRubberBandsAtTop(bool); 99 104 100 105 bool willWheelEventStartSwipeGesture(const PlatformWheelEvent&); … … 127 132 bool m_mainFramePinnedToTheLeft; 128 133 bool m_mainFramePinnedToTheRight; 134 bool m_rubberBandsAtBottom; 135 bool m_rubberBandsAtTop; 136 bool m_mainFramePinnedToTheTop; 137 bool m_mainFramePinnedToTheBottom; 129 138 bool m_mainFrameIsRubberBanding; 130 139 -
trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.h
r142504 r143418 77 77 78 78 virtual bool isRubberBandInProgress() const OVERRIDE; 79 virtual bool rubberBandsAtBottom() const OVERRIDE; 80 virtual void setRubberBandsAtBottom(bool) OVERRIDE; 81 virtual bool rubberBandsAtTop() const OVERRIDE; 82 virtual void setRubberBandsAtTop(bool) OVERRIDE; 79 83 80 84 private: -
trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.mm
r143074 r143418 94 94 } 95 95 96 bool ScrollingCoordinatorMac::rubberBandsAtBottom() const 97 { 98 return scrollingTree()->rubberBandsAtBottom(); 99 } 100 101 void ScrollingCoordinatorMac::setRubberBandsAtBottom(bool rubberBandsAtBottom) 102 { 103 scrollingTree()->setRubberBandsAtBottom(rubberBandsAtBottom); 104 } 105 106 bool ScrollingCoordinatorMac::rubberBandsAtTop() const 107 { 108 return scrollingTree()->rubberBandsAtTop(); 109 } 110 111 void ScrollingCoordinatorMac::setRubberBandsAtTop(bool rubberBandsAtTop) 112 { 113 scrollingTree()->setRubberBandsAtTop(rubberBandsAtTop); 114 } 115 96 116 void ScrollingCoordinatorMac::commitTreeStateIfNeeded() 97 117 { -
trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeMac.mm
r143404 r143418 201 201 } 202 202 203 if ((delta.width() || delta.height()) && (limitDelta.width() < 1 && limitDelta.height() < 1)) 203 if ((delta.width() || delta.height()) && (limitDelta.width() < 1 && limitDelta.height() < 1)) 204 204 return true; 205 205 … … 350 350 bool pinnedToTheLeft = scrollPosition.x() <= minimumScrollPosition().x(); 351 351 bool pinnedToTheRight = scrollPosition.x() >= maximumScrollPosition().x(); 352 353 scrollingTree()->setMainFramePinState(pinnedToTheLeft, pinnedToTheRight); 352 bool pinnedToTheTop = scrollPosition.y() <= minimumScrollPosition().y(); 353 bool pinnedToTheBottom = scrollPosition.y() >= maximumScrollPosition().y(); 354 355 scrollingTree()->setMainFramePinState(pinnedToTheLeft, pinnedToTheRight, pinnedToTheTop, pinnedToTheBottom); 354 356 } 355 357 -
trunk/Source/WebKit2/ChangeLog
r143396 r143418 1 2013-02-19 Conrad Shultz <conrad_shultz@apple.com> 2 3 Allow UI clients to handle vertical wheel events. 4 https://bugs.webkit.org/show_bug.cgi?id=110006 5 6 Reviewed by Tim Horton. 7 8 Add API to allow clients to selectively control rubber-banding at vertical page extrema. 9 10 * UIProcess/API/C/WKPage.cpp: 11 (WKPageRubberBandsAtBottom): 12 Proxy for the corresponding function in WebCore::Page. 13 (WKPageSetRubberBandsAtBottom): 14 Ditto. 15 (WKPageRubberBandsAtTop): 16 Ditto. 17 (WKPageSetRubberBandsAtTop): 18 Ditto. 19 20 * UIProcess/API/C/WKPage.h: 21 Declare new API. 22 23 * UIProcess/WebPageProxy.cpp: 24 (WebKit::WebPageProxy::WebPageProxy): 25 Initialize new member variables. 26 (WebKit::WebPageProxy::setRubberBandsAtBottom): 27 New function; dispatches a matching message to the WebKit::WebPage. 28 (WebKit::WebPageProxy::setRubberBandsAtTop): 29 Ditto. 30 31 * UIProcess/WebPageProxy.h: 32 (WebPageProxy): 33 Declare new API. 34 (WebKit::WebPageProxy::rubberBandsAtBottom): 35 New accessor function. 36 (WebKit::WebPageProxy::rubberBandsAtTop): 37 Ditto. 38 39 * WebProcess/WebPage/WebPage.cpp: 40 (WebKit::WebPage::setRubberBandsAtBottom): 41 New function; call the matching function on the associated WebCore::Page. 42 (WebKit::WebPage::setRubberBandsAtTop): 43 Ditto. 44 45 * WebProcess/WebPage/WebPage.h: 46 (WebPage): 47 Declare new rubber-banding API. 48 49 * WebProcess/WebPage/WebPage.messages.in: 50 Declare new rubber-banding API. 51 1 52 2013-02-19 Anders Carlsson <andersca@apple.com> 2 53 -
trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp
r141448 r143418 395 395 } 396 396 397 398 bool WKPageRubberBandsAtBottom(WKPageRef pageRef) 399 { 400 return toImpl(pageRef)->rubberBandsAtBottom(); 401 } 402 403 void WKPageSetRubberBandsAtBottom(WKPageRef pageRef, bool rubberBandsAtBottom) 404 { 405 toImpl(pageRef)->setRubberBandsAtBottom(rubberBandsAtBottom); 406 } 407 408 bool WKPageRubberBandsAtTop(WKPageRef pageRef) 409 { 410 return toImpl(pageRef)->rubberBandsAtTop(); 411 } 412 413 void WKPageSetRubberBandsAtTop(WKPageRef pageRef, bool rubberBandsAtTop) 414 { 415 toImpl(pageRef)->setRubberBandsAtTop(rubberBandsAtTop); 416 } 417 397 418 void WKPageSetPaginationMode(WKPageRef pageRef, WKPaginationMode paginationMode) 398 419 { -
trunk/Source/WebKit2/UIProcess/API/C/WKPage.h
r142762 r143418 445 445 WK_EXPORT bool WKPageIsPinnedToBottomSide(WKPageRef page); 446 446 447 WK_EXPORT bool WKPageRubberBandsAtBottom(WKPageRef); 448 WK_EXPORT void WKPageSetRubberBandsAtBottom(WKPageRef, bool rubberBandsAtBottom); 449 WK_EXPORT bool WKPageRubberBandsAtTop(WKPageRef); 450 WK_EXPORT void WKPageSetRubberBandsAtTop(WKPageRef, bool rubberBandsAtTop); 451 447 452 WK_EXPORT bool WKPageCanDelete(WKPageRef page); 448 453 WK_EXPORT bool WKPageHasSelectedRange(WKPageRef page); -
trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp
r143275 r143418 227 227 , m_mainFrameIsPinnedToTopSide(false) 228 228 , m_mainFrameIsPinnedToBottomSide(false) 229 , m_rubberBandsAtBottom(false) 230 , m_rubberBandsAtTop(false) 229 231 , m_mainFrameInViewSourceMode(false) 230 232 , m_pageCount(0) … … 259 261 #if ENABLE(VIBRATION) 260 262 m_vibration = WebVibrationProxy::create(this); 263 #endif 264 #if ENABLE(THREADED_SCROLLING) 265 m_rubberBandsAtBottom = true; 266 m_rubberBandsAtTop = true; 261 267 #endif 262 268 … … 1672 1678 m_suppressScrollbarAnimations = suppressAnimations; 1673 1679 m_process->send(Messages::WebPage::SetSuppressScrollbarAnimations(suppressAnimations), m_pageID); 1680 } 1681 1682 void WebPageProxy::setRubberBandsAtBottom(bool rubberBandsAtBottom) 1683 { 1684 if (rubberBandsAtBottom == m_rubberBandsAtBottom) 1685 return; 1686 1687 m_rubberBandsAtBottom = rubberBandsAtBottom; 1688 1689 if (!isValid()) 1690 return; 1691 1692 m_process->send(Messages::WebPage::SetRubberBandsAtBottom(rubberBandsAtBottom), m_pageID); 1693 } 1694 1695 void WebPageProxy::setRubberBandsAtTop(bool rubberBandsAtTop) 1696 { 1697 if (rubberBandsAtTop == m_rubberBandsAtTop) 1698 return; 1699 1700 m_rubberBandsAtTop = rubberBandsAtTop; 1701 1702 if (!isValid()) 1703 return; 1704 1705 m_process->send(Messages::WebPage::SetRubberBandsAtTop(rubberBandsAtTop), m_pageID); 1674 1706 } 1675 1707 -
trunk/Source/WebKit2/UIProcess/WebPageProxy.h
r143275 r143418 503 503 bool isPinnedToBottomSide() const { return m_mainFrameIsPinnedToBottomSide; } 504 504 505 bool rubberBandsAtBottom() const { return m_rubberBandsAtBottom; } 506 void setRubberBandsAtBottom(bool); 507 bool rubberBandsAtTop() const { return m_rubberBandsAtTop; } 508 void setRubberBandsAtTop(bool); 509 505 510 void setPaginationMode(WebCore::Pagination::Mode); 506 511 WebCore::Pagination::Mode paginationMode() const { return m_paginationMode; } … … 1210 1215 bool m_mainFrameIsPinnedToBottomSide; 1211 1216 1217 bool m_rubberBandsAtBottom; 1218 bool m_rubberBandsAtTop; 1219 1212 1220 bool m_mainFrameInViewSourceMode; 1213 1221 -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
r143353 r143418 1313 1313 } 1314 1314 1315 void WebPage::setRubberBandsAtBottom(bool rubberBandsAtBottom) 1316 { 1317 m_page->setRubberBandsAtBottom(rubberBandsAtBottom); 1318 } 1319 1320 void WebPage::setRubberBandsAtTop(bool rubberBandsAtTop) 1321 { 1322 m_page->setRubberBandsAtTop(rubberBandsAtTop); 1323 } 1324 1315 1325 void WebPage::setPaginationMode(uint32_t mode) 1316 1326 { -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h
r141486 r143418 316 316 void setSuppressScrollbarAnimations(bool); 317 317 318 void setRubberBandsAtBottom(bool); 319 void setRubberBandsAtTop(bool); 320 318 321 void setPaginationMode(uint32_t /* WebCore::Pagination::Mode */); 319 322 void setPaginationBehavesLikeColumns(bool); -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in
r141448 r143418 143 143 SetSuppressScrollbarAnimations(bool suppressAnimations) 144 144 145 SetRubberBandsAtBottom(bool rubberBandsAtBottom) 146 SetRubberBandsAtTop(bool rubberBandsAtTop) 147 145 148 SetPaginationMode(uint32_t mode) 146 149 SetPaginationBehavesLikeColumns(bool behavesLikeColumns)
Note: See TracChangeset
for help on using the changeset viewer.