-
timothy_horton@apple.com authored
https://bugs.webkit.org/show_bug.cgi?id=118429 <rdar://problem/14120323> Reviewed by Anders Carlsson. Test (API): WebKit2.ScrollPinningBehaviors * WebCore.exp.in: Expose FrameView::setScrollPinningBehavior. * page/FrameView.cpp: (WebCore::FrameView::FrameView): Our pinning behavior should be DoNotPin by default. * page/FrameView.cpp: (WebCore::FrameView::minimumScrollPosition): (WebCore::FrameView::maximumScrollPosition): * page/scrolling/mac/ScrollingTreeScrollingNodeMac.mm: (WebCore::ScrollingTreeScrollingNodeMac::minimumScrollPosition): (WebCore::ScrollingTreeScrollingNodeMac::maximumScrollPosition): Fix the minimum scroll position's vertical location to the maximum if we're pinned to the bottom, and vice-versa if we're pinned to the top. (WebCore::FrameView::setScrollPinningBehavior): Added. If scroll pinning behavior has changed, inform ScrollingCoordinator and update scrollbars (which will also re-pin the scroll position). * page/FrameView.h: Override minimumScrollPosition, add setScrollPinningBehavior, and storage for m_scrollPinningBehavior. * page/scrolling/ScrollingCoordinator.h: (WebCore::ScrollingCoordinator::setScrollPinningBehavior): Added. * page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::ScrollingTree): Our pinning behavior should be DoNotPin by default. (WebCore::ScrollingTree::setScrollPinningBehavior): (WebCore::ScrollingTree::scrollPinningBehavior): Getter/setter for m_scrollPinningBehavior, scrolling-thread-safe. * page/scrolling/ScrollingTree.h: * page/scrolling/mac/ScrollingCoordinatorMac.h: * page/scrolling/mac/ScrollingCoordinatorMac.mm: (WebCore::ScrollingCoordinatorMac::setScrollPinningBehavior): Inform ScrollingTree of the scroll pinning behavior change. * platform/ScrollTypes.h: Add ScrollPinningBehavior enum. * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: * TestWebKitAPI/Tests/WebKit2/ScrollPinningBehaviors.cpp: Added. (TestWebKitAPI::didFinishDocumentLoadForFrame): (TestWebKitAPI::TEST): Add a test that ensures that the three pinning modes (DoNotPin, PinToTop, PinToBottom) all work correctly in the face of resizing the view and scrolling from JS. * Shared/WebPageCreationParameters.cpp: (WebKit::WebPageCreationParameters::encode): (WebKit::WebPageCreationParameters::decode): * Shared/WebPageCreationParameters.h: Pass the current ScrollPinningBehavior across to the WebPage upon creation. * UIProcess/API/C/WKPage.cpp: (WKPageGetScrollPinningBehavior): (WKPageSetScrollPinningBehavior): * UIProcess/API/C/WKPagePrivate.h: SPI to get/set the WebPageProxy's current ScrollPinningBehavior. Convert between WK API type and WebCore enum. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::WebPageProxy): (WebKit::WebPageProxy::creationParameters): Send ScrollPinningBehavior when creating a WebPage. (WebKit::WebPageProxy::setScrollPinningBehavior): Pass ScrollPinningBehavior changes across to the WebProcess (and save it in WebPageProxy so it can be sent back across if the WebProcess crashes). * UIProcess/WebPageProxy.h: (WebKit::WebPageProxy::scrollPinningBehavior): Getter/setter and storage for m_scrollPinningBehavior. * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage): Inform new FrameViews of the current ScrollPinningBehavior. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::WebPage): Set our ScrollPinningBehavior based on our creation parameters. (WebKit::WebPage::setScrollPinningBehavior): Inform the FrameView of ScrollPinningBehavior changes. * WebProcess/WebPage/WebPage.h: (WebKit::WebPage::scrollPinningBehavior): Added. (WebKit::WebPage::setScrollPinningBehavior): Added. Add storage for m_scrollPinningBehavior. * WebProcess/WebPage/WebPage.messages.in: Add SetScrollPinningBehavior message. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@152425 268f45cc-cd09-0410-ab3c-d52691b4dbfc
8685d4e7