Diff
Modified: trunk/Source/WebCore/ChangeLog (167261 => 167262)
--- trunk/Source/WebCore/ChangeLog 2014-04-14 19:45:24 UTC (rev 167261)
+++ trunk/Source/WebCore/ChangeLog 2014-04-14 19:49:37 UTC (rev 167262)
@@ -1,3 +1,21 @@
+2014-04-14 Simon Fraser <simon.fra...@apple.com>
+
+ [WK2 iOS] Scrolling to anchor links is broken
+ https://bugs.webkit.org/show_bug.cgi?id=131618
+ <rdar://problem/16599144>
+
+ Reviewed by Tim Horton.
+
+ Have ScrollingTreeScrollingNode pass RequestedScrollPosition updates
+ to the scrolling tree, so that the scrolling tree can have custom behavior
+ for them if necessary.
+
+ * page/scrolling/ScrollingTree.h:
+ (WebCore::ScrollingTree::scrollingTreeNodeRequestsScroll):
+ * page/scrolling/ScrollingTreeScrollingNode.cpp:
+ (WebCore::ScrollingTreeScrollingNode::updateAfterChildren):
+ * page/scrolling/ScrollingTreeScrollingNode.h:
+
2014-04-14 Brian J. Burg <b...@cs.washington.edu>
Web Replay: memoize fallback time values for document.lastModified
Modified: trunk/Source/WebCore/page/scrolling/ScrollingTree.h (167261 => 167262)
--- trunk/Source/WebCore/page/scrolling/ScrollingTree.h 2014-04-14 19:45:24 UTC (rev 167261)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTree.h 2014-04-14 19:49:37 UTC (rev 167262)
@@ -75,6 +75,9 @@
// Updates FrameView/RenderLayer scrolling state and GraphicsLayers.
virtual void scrollingTreeNodeDidScroll(ScrollingNodeID, const FloatPoint& scrollPosition, SetOrSyncScrollingLayerPosition = SyncScrollingLayerPosition) = 0;
+ // Called for requested scroll position updates.
+ virtual void scrollingTreeNodeRequestsScroll(ScrollingNodeID, const FloatPoint& /*scrollPosition*/, bool /*representsProgrammaticScroll*/) { }
+
// Delegated scrolling/zooming has caused the viewport to change, so update viewport-constrained layers
// (but don't cause scroll events to be fired).
virtual void viewportChangedViaDelegatedScrolling(ScrollingNodeID, const WebCore::FloatRect& viewportRect, double scale);
Modified: trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp (167261 => 167262)
--- trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp 2014-04-14 19:45:24 UTC (rev 167261)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp 2014-04-14 19:49:37 UTC (rev 167262)
@@ -87,6 +87,13 @@
m_behaviorForFixed = state.scrollBehaviorForFixedElements();
}
+void ScrollingTreeScrollingNode::updateAfterChildren(const ScrollingStateNode& stateNode)
+{
+ const ScrollingStateScrollingNode& scrollingStateNode = toScrollingStateScrollingNode(stateNode);
+ if (scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::RequestedScrollPosition))
+ scrollingTree().scrollingTreeNodeRequestsScroll(scrollingNodeID(), scrollingStateNode.requestedScrollPosition(), scrollingStateNode.requestedScrollPositionRepresentsProgrammaticScroll());
+}
+
} // namespace WebCore
#endif // ENABLE(ASYNC_SCROLLING)
Modified: trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h (167261 => 167262)
--- trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h 2014-04-14 19:45:24 UTC (rev 167261)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h 2014-04-14 19:49:37 UTC (rev 167262)
@@ -45,6 +45,7 @@
virtual ~ScrollingTreeScrollingNode();
virtual void updateBeforeChildren(const ScrollingStateNode&) override;
+ virtual void updateAfterChildren(const ScrollingStateNode&) override;
// FIXME: We should implement this when we support ScrollingTreeScrollingNodes as children.
virtual void parentScrollPositionDidChange(const FloatRect& /*viewportRect*/, const FloatSize& /*cumulativeDelta*/) override { }
Modified: trunk/Source/WebKit2/ChangeLog (167261 => 167262)
--- trunk/Source/WebKit2/ChangeLog 2014-04-14 19:45:24 UTC (rev 167261)
+++ trunk/Source/WebKit2/ChangeLog 2014-04-14 19:49:37 UTC (rev 167262)
@@ -1,3 +1,42 @@
+2014-04-14 Simon Fraser <simon.fra...@apple.com>
+
+ [WK2 iOS] Scrolling to anchor links is broken
+ https://bugs.webkit.org/show_bug.cgi?id=131618
+ <rdar://problem/16599144>
+
+ Reviewed by Tim Horton.
+
+ The RemoteScrollingTree implements scrollingTreeNodeRequestsScroll
+ to get informed about requested scroll position updates, and passes
+ them along via the RemoteScrollingCoordinatorProxy, WebPageProxy and PageClient
+ to the WKWebView, which performs a scroll.
+
+ * UIProcess/API/Cocoa/WKWebView.mm:
+ (-[WKWebView _scrollToContentOffset:WebCore::]): Scroll to content offset,
+ taking page scale and insets into account.
+ * UIProcess/API/Cocoa/WKWebViewInternal.h:
+ * UIProcess/CoordinatedGraphics/WebView.cpp:
+ (WebKit::WebView::requestScroll):
+ * UIProcess/CoordinatedGraphics/WebView.h:
+ * UIProcess/PageClient.h:
+ * UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.cpp:
+ (WebKit::RemoteScrollingCoordinatorProxy::scrollingTreeNodeRequestsScroll):
+ Pass scrolls along to the WebPageProxy for the root node. We will also need
+ to handle programmatic scrolls for overflow soon.
+ * UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.h:
+ * UIProcess/Scrolling/RemoteScrollingTree.cpp:
+ (WebKit::RemoteScrollingTree::scrollingTreeNodeRequestsScroll):
+ * UIProcess/Scrolling/RemoteScrollingTree.h:
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::requestScroll):
+ * UIProcess/WebPageProxy.h:
+ * UIProcess/ios/PageClientImplIOS.h:
+ * UIProcess/ios/PageClientImplIOS.mm:
+ (WebKit::PageClientImpl::canScrollView):
+ (WebKit::PageClientImpl::requestScroll):
+ * UIProcess/mac/PageClientImpl.mm:
+ (WebKit::PageClientImpl::requestScroll):
+
2014-04-12 Antti Koivisto <an...@apple.com>
Keep secondary tile grid for zoomed-out scale
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (167261 => 167262)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm 2014-04-14 19:45:24 UTC (rev 167261)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm 2014-04-14 19:49:37 UTC (rev 167262)
@@ -544,6 +544,18 @@
return contentOffset;
}
+- (void)_scrollToContentOffset:(WebCore::FloatPoint)contentOffset
+{
+ WebCore::FloatPoint scaledOffset = contentOffset;
+ CGFloat zoomScale = contentZoomScale(self);
+ scaledOffset.scale(zoomScale, zoomScale);
+
+ UIEdgeInsets inset = [_scrollView contentInset];
+ scaledOffset += WebCore::FloatSize(-inset.left, -inset.top);
+
+ [_scrollView setContentOffset:scaledOffset];
+}
+
- (BOOL)_scrollToRect:(WebCore::FloatRect)targetRect origin:(WebCore::FloatPoint)origin minimumScrollDistance:(float)minimumScrollDistance
{
WebCore::FloatRect unobscuredContentRect([self _contentRectForUserInteraction]);
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewInternal.h (167261 => 167262)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewInternal.h 2014-04-14 19:45:24 UTC (rev 167261)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewInternal.h 2014-04-14 19:49:37 UTC (rev 167262)
@@ -64,6 +64,7 @@
- (RetainPtr<CGImageRef>)_takeViewSnapshot;
+- (void)_scrollToContentOffset:(WebCore::FloatPoint)contentOffset;
- (BOOL)_scrollToRect:(WebCore::FloatRect)targetRect origin:(WebCore::FloatPoint)origin minimumScrollDistance:(float)minimumScrollDistance;
- (BOOL)_zoomToRect:(WebCore::FloatRect)targetRect withOrigin:(WebCore::FloatPoint)origin fitEntireRect:(BOOL)fitEntireRect minimumScale:(double)minimumScale maximumScale:(double)maximumScale minimumScrollDistance:(float)minimumScrollDistance;
- (void)_zoomOutWithOrigin:(WebCore::FloatPoint)origin;
Modified: trunk/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.cpp (167261 => 167262)
--- trunk/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.cpp 2014-04-14 19:45:24 UTC (rev 167261)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.cpp 2014-04-14 19:49:37 UTC (rev 167262)
@@ -83,6 +83,11 @@
setViewNeedsDisplay(scrollRect);
}
+void PageClientImpl::requestScroll(const WebCore::FloatPoint&, bool)
+{
+ notImplemented();
+}
+
WebCore::IntSize PageClientImpl::viewSize()
{
if (!gtk_widget_get_realized(m_viewWidget))
Modified: trunk/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.h (167261 => 167262)
--- trunk/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.h 2014-04-14 19:45:24 UTC (rev 167261)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.h 2014-04-14 19:49:37 UTC (rev 167262)
@@ -65,6 +65,7 @@
virtual void displayView() override;
virtual bool canScrollView() override { return false; }
virtual void scrollView(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset) override;
+ virtual void requestScroll(const WebCore::FloatPoint& scrollPosition, bool isProgrammaticScroll) override;
virtual WebCore::IntSize viewSize() override;
virtual bool isViewWindowActive() override;
virtual bool isViewFocused() override;
Modified: trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/WebView.cpp (167261 => 167262)
--- trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/WebView.cpp 2014-04-14 19:45:24 UTC (rev 167261)
+++ trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/WebView.cpp 2014-04-14 19:49:37 UTC (rev 167262)
@@ -304,6 +304,11 @@
setViewNeedsDisplay(scrollRect);
}
+void WebView::requestScroll(const WebCore::FloatPoint&, bool)
+{
+ notImplemented();
+}
+
WebCore::IntSize WebView::viewSize()
{
return roundedIntSize(dipSize());
Modified: trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/WebView.h (167261 => 167262)
--- trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/WebView.h 2014-04-14 19:45:24 UTC (rev 167261)
+++ trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/WebView.h 2014-04-14 19:49:37 UTC (rev 167262)
@@ -131,6 +131,7 @@
virtual bool canScrollView() override { return false; }
virtual void scrollView(const WebCore::IntRect&, const WebCore::IntSize&) override;
+ virtual void requestScroll(const WebCore::FloatPoint&, bool) override;
virtual WebCore::IntSize viewSize() override;
Modified: trunk/Source/WebKit2/UIProcess/PageClient.h (167261 => 167262)
--- trunk/Source/WebKit2/UIProcess/PageClient.h 2014-04-14 19:45:24 UTC (rev 167261)
+++ trunk/Source/WebKit2/UIProcess/PageClient.h 2014-04-14 19:49:37 UTC (rev 167262)
@@ -93,6 +93,8 @@
virtual bool canScrollView() = 0;
// Tell the view to scroll scrollRect by scrollOffset.
virtual void scrollView(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset) = 0;
+ // Tell the view to scroll to the given position, and whether this was a programmatic scroll.
+ virtual void requestScroll(const WebCore::FloatPoint& scrollPosition, bool isProgrammaticScroll) = 0;
// Return the size of the view the page is associated with.
virtual WebCore::IntSize viewSize() = 0;
Modified: trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.cpp (167261 => 167262)
--- trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.cpp 2014-04-14 19:45:24 UTC (rev 167261)
+++ trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.cpp 2014-04-14 19:49:37 UTC (rev 167262)
@@ -160,6 +160,12 @@
m_webPageProxy.send(Messages::RemoteScrollingCoordinator::ScrollPositionChangedForNode(scrolledNodeID, newScrollPosition));
}
+void RemoteScrollingCoordinatorProxy::scrollingTreeNodeRequestsScroll(ScrollingNodeID scrolledNodeID, const FloatPoint& scrollPosition, bool representsProgrammaticScroll)
+{
+ if (scrolledNodeID == rootScrollingNodeID())
+ m_webPageProxy.requestScroll(scrollPosition, representsProgrammaticScroll);
+}
+
} // namespace WebKit
#endif // ENABLE(ASYNC_SCROLLING)
Modified: trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.h (167261 => 167262)
--- trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.h 2014-04-14 19:45:24 UTC (rev 167261)
+++ trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.h 2014-04-14 19:49:37 UTC (rev 167262)
@@ -53,6 +53,7 @@
// Inform the web process that the scroll position changed (called from the scrolling tree)
void scrollingTreeNodeDidScroll(WebCore::ScrollingNodeID, const WebCore::FloatPoint& newScrollPosition);
+ void scrollingTreeNodeRequestsScroll(WebCore::ScrollingNodeID, const WebCore::FloatPoint& scrollPosition, bool representsProgrammaticScroll);
bool isPointInNonFastScrollableRegion(const WebCore::IntPoint&) const;
Modified: trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingTree.cpp (167261 => 167262)
--- trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingTree.cpp 2014-04-14 19:45:24 UTC (rev 167261)
+++ trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingTree.cpp 2014-04-14 19:49:37 UTC (rev 167262)
@@ -82,6 +82,11 @@
m_scrollingCoordinatorProxy.scrollingTreeNodeDidScroll(nodeID, scrollPosition);
}
+void RemoteScrollingTree::scrollingTreeNodeRequestsScroll(ScrollingNodeID nodeID, const FloatPoint& scrollPosition, bool representsProgrammaticScroll)
+{
+ m_scrollingCoordinatorProxy.scrollingTreeNodeRequestsScroll(nodeID, scrollPosition, representsProgrammaticScroll);
+}
+
PassOwnPtr<ScrollingTreeNode> RemoteScrollingTree::createNode(ScrollingNodeType nodeType, ScrollingNodeID nodeID)
{
switch (nodeType) {
Modified: trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingTree.h (167261 => 167262)
--- trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingTree.h 2014-04-14 19:45:24 UTC (rev 167261)
+++ trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingTree.h 2014-04-14 19:49:37 UTC (rev 167262)
@@ -47,6 +47,7 @@
const RemoteScrollingCoordinatorProxy& scrollingCoordinatorProxy() const { return m_scrollingCoordinatorProxy; }
virtual void scrollingTreeNodeDidScroll(WebCore::ScrollingNodeID, const WebCore::FloatPoint& scrollPosition, WebCore::SetOrSyncScrollingLayerPosition = WebCore::SyncScrollingLayerPosition) override;
+ virtual void scrollingTreeNodeRequestsScroll(WebCore::ScrollingNodeID, const WebCore::FloatPoint& scrollPosition, bool representsProgrammaticScroll) override;
private:
explicit RemoteScrollingTree(RemoteScrollingCoordinatorProxy&);
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (167261 => 167262)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2014-04-14 19:45:24 UTC (rev 167261)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2014-04-14 19:49:37 UTC (rev 167262)
@@ -1008,6 +1008,11 @@
m_pageClient.scrollView(scrollRect, scrollOffset);
}
+void WebPageProxy::requestScroll(const FloatPoint& scrollPosition, bool isProgrammaticScroll)
+{
+ m_pageClient.requestScroll(scrollPosition, isProgrammaticScroll);
+}
+
void WebPageProxy::updateViewState(ViewState::Flags flagsToUpdate)
{
m_viewState &= ~flagsToUpdate;
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (167261 => 167262)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h 2014-04-14 19:45:24 UTC (rev 167261)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h 2014-04-14 19:49:37 UTC (rev 167262)
@@ -545,7 +545,8 @@
void setViewNeedsDisplay(const WebCore::IntRect&);
void displayView();
bool canScrollView();
- void scrollView(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset);
+ void scrollView(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset); // FIXME: CoordinatedGraphics should use requestScroll().
+ void requestScroll(const WebCore::FloatPoint& scrollPosition, bool isProgrammaticScroll);
void setDelegatesScrolling(bool delegatesScrolling) { m_delegatesScrolling = delegatesScrolling; }
bool delegatesScrolling() const { return m_delegatesScrolling; }
Modified: trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h (167261 => 167262)
--- trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h 2014-04-14 19:45:24 UTC (rev 167261)
+++ trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h 2014-04-14 19:49:37 UTC (rev 167262)
@@ -53,6 +53,7 @@
virtual void displayView() override;
virtual bool canScrollView() override;
virtual void scrollView(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset) override;
+ virtual void requestScroll(const WebCore::FloatPoint& scrollPosition, bool isProgrammaticScroll) override;
virtual WebCore::IntSize viewSize() override;
virtual bool isViewWindowActive() override;
virtual bool isViewFocused() override;
Modified: trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm (167261 => 167262)
--- trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm 2014-04-14 19:45:24 UTC (rev 167261)
+++ trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm 2014-04-14 19:49:37 UTC (rev 167262)
@@ -82,15 +82,21 @@
ASSERT_NOT_REACHED();
}
+bool PageClientImpl::canScrollView()
+{
+ notImplemented();
+ return false;
+}
+
void PageClientImpl::scrollView(const IntRect&, const IntSize&)
{
ASSERT_NOT_REACHED();
}
-bool PageClientImpl::canScrollView()
+void PageClientImpl::requestScroll(const FloatPoint& scrollPosition, bool isProgrammaticScroll)
{
- notImplemented();
- return false;
+ UNUSED_PARAM(isProgrammaticScroll);
+ [m_webView _scrollToContentOffset:scrollPosition];
}
IntSize PageClientImpl::viewSize()
Modified: trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm (167261 => 167262)
--- trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm 2014-04-14 19:45:24 UTC (rev 167261)
+++ trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm 2014-04-14 19:49:37 UTC (rev 167262)
@@ -170,6 +170,11 @@
ASSERT_NOT_REACHED();
}
+void PageClientImpl::requestScroll(const FloatPoint& scrollPosition, bool isProgrammaticScroll)
+{
+ ASSERT_NOT_REACHED();
+}
+
IntSize PageClientImpl::viewSize()
{
return IntSize([m_wkView bounds].size);