Title: [186757] branches/safari-601.1-branch/Source
Revision
186757
Author
bshaf...@apple.com
Date
2015-07-12 23:56:28 -0700 (Sun, 12 Jul 2015)

Log Message

Merged r186712.  rdar://problem/20483550

Modified Paths

Diff

Modified: branches/safari-601.1-branch/Source/WebCore/ChangeLog (186756 => 186757)


--- branches/safari-601.1-branch/Source/WebCore/ChangeLog	2015-07-13 06:54:36 UTC (rev 186756)
+++ branches/safari-601.1-branch/Source/WebCore/ChangeLog	2015-07-13 06:56:28 UTC (rev 186757)
@@ -1,5 +1,41 @@
 2015-07-12  Babak Shafiei  <bshaf...@apple.com>
 
+        Merge r186712.
+
+    2015-07-10  Simon Fraser  <simon.fra...@apple.com>
+
+            [iOS WK2] Scrolling issues on horizontally scrollable RTL pages
+            https://bugs.webkit.org/show_bug.cgi?id=146872
+            rdar://problem/7569416
+
+            Reviewed by Sam Weinig.
+
+            Horizontally scrollable RTL pages in WebKit2 had a variety of issues: they had
+            a gap down the right edge, and unreachable content on the left side, focussing
+            form fields scrolled to the wrong location, and programmatic scrolls scrolled
+            to the wrong place.
+
+            Fix by plumbing the WebCore notion of scrollOrigin through to the UI process,
+            and using it in various places. There are three main aspects to the patch:
+
+            1. scroll origin is included in RemoteLayerTreeTransaction, and plumbed through
+               to -[WKWebView _scrollToContentOffset:] for correct programmatic scrolling,
+               including zooming to focussed form elements.
+            2. WebPageProxy::computeCustomFixedPositionRect() uses the actual documentRect()
+               rather than just conjuring up a rect with a zero origin, which makes position:fixed
+               work correctly.
+            3. _interactionViewsContainerView (which hosts tap highlights) is positioned to 
+               coincide with the origin of the documentRect (i.e. at the scroll origin, which
+               may not be top-left). This allows tap highlights to show in the correct location.
+            4. ScrollView::unobscuredContentRect() is fixed to take scroll origin into account;
+               if the returned rect is wrong, RenderLayer::hitTest() incorrectly clips the hit
+               testing area.
+
+            * platform/ios/ScrollViewIOS.mm:
+            (WebCore::ScrollView::unobscuredContentRect):
+
+2015-07-12  Babak Shafiei  <bshaf...@apple.com>
+
         Merge r186707.
 
     2015-07-10  Chris Dumez  <cdu...@apple.com>

Modified: branches/safari-601.1-branch/Source/WebCore/platform/ios/ScrollViewIOS.mm (186756 => 186757)


--- branches/safari-601.1-branch/Source/WebCore/platform/ios/ScrollViewIOS.mm	2015-07-13 06:54:36 UTC (rev 186756)
+++ branches/safari-601.1-branch/Source/WebCore/platform/ios/ScrollViewIOS.mm	2015-07-13 06:56:28 UTC (rev 186757)
@@ -108,7 +108,7 @@
     }
 
     if (!m_unobscuredContentSize.isEmpty())
-        return IntRect(IntPoint(m_scrollOffset), roundedIntSize(m_unobscuredContentSize));
+        return IntRect(scrollOrigin() + m_scrollOffset, roundedIntSize(m_unobscuredContentSize));
 
     return unobscuredContentRectInternal();
 }

Modified: branches/safari-601.1-branch/Source/WebKit2/ChangeLog (186756 => 186757)


--- branches/safari-601.1-branch/Source/WebKit2/ChangeLog	2015-07-13 06:54:36 UTC (rev 186756)
+++ branches/safari-601.1-branch/Source/WebKit2/ChangeLog	2015-07-13 06:56:28 UTC (rev 186757)
@@ -1,5 +1,77 @@
 2015-07-12  Babak Shafiei  <bshaf...@apple.com>
 
+        Merge r186712.
+
+    2015-07-10  Simon Fraser  <simon.fra...@apple.com>
+
+            [iOS WK2] Scrolling issues on horizontally scrollable RTL pages
+            https://bugs.webkit.org/show_bug.cgi?id=146872
+            rdar://problem/7569416
+
+            Reviewed by Sam Weinig.
+
+            Horizontally scrollable RTL pages in WebKit2 had a variety of issues: they had
+            a gap down the right edge, and unreachable content on the left side, focussing
+            form fields scrolled to the wrong location, and programmatic scrolls scrolled
+            to the wrong place.
+
+            Fix by plumbing the WebCore notion of scrollOrigin through to the UI process,
+            and using it in various places. There are three main aspects to the patch:
+
+            1. scroll origin is included in RemoteLayerTreeTransaction, and plumbed through
+               to -[WKWebView _scrollToContentOffset:] for correct programmatic scrolling,
+               including zooming to focused form elements. The WKContentView's boundsOrigin
+               is set to the scroll origin so that the view coordinates match document coordinates.
+            2. WebPageProxy::computeCustomFixedPositionRect() uses the actual documentRect()
+               rather than just conjuring up a rect with a zero origin, which makes position:fixed
+               work correctly.
+            3. _interactionViewsContainerView (which hosts tap highlights) is positioned to 
+               coincide with the origin of the documentRect (i.e. at the scroll origin, which
+               may not be top-left). This allows tap highlights to show in the correct location.
+            4. ScrollView::unobscuredContentRect() is fixed to take scroll origin into account;
+               if the returned rect is wrong, RenderLayer::hitTest() incorrectly clips the hit
+               testing area.
+
+            * Shared/mac/RemoteLayerTreeTransaction.h:
+            (WebKit::RemoteLayerTreeTransaction::scrollOrigin):
+            (WebKit::RemoteLayerTreeTransaction::setScrollOrigin):
+            * Shared/mac/RemoteLayerTreeTransaction.mm:
+            (WebKit::RemoteLayerTreeTransaction::encode):
+            (WebKit::RemoteLayerTreeTransaction::decode):
+            (WebKit::RemoteLayerTreeTransaction::description): Dump some more info.
+            * UIProcess/API/Cocoa/WKWebView.mm:
+            (-[WKWebView _scrollToContentOffset:scrollOrigin:]):
+            (-[WKWebView _scrollToContentOffset:]): Deleted.
+            * UIProcess/API/Cocoa/WKWebViewInternal.h:
+            * UIProcess/API/gtk/PageClientImpl.cpp:
+            (WebKit::PageClientImpl::requestScroll):
+            * UIProcess/API/gtk/PageClientImpl.h:
+            * UIProcess/CoordinatedGraphics/WebView.cpp:
+            (WebKit::WebView::requestScroll):
+            * UIProcess/CoordinatedGraphics/WebView.h:
+            * UIProcess/PageClient.h:
+            * UIProcess/WebPageProxy.cpp:
+            (WebKit::WebPageProxy::requestScroll):
+            * UIProcess/WebPageProxy.h:
+            * UIProcess/ios/PageClientImplIOS.h:
+            * UIProcess/ios/PageClientImplIOS.mm:
+            (WebKit::PageClientImpl::requestScroll):
+            (WebKit::PageClientImpl::documentRect):
+            (WebKit::PageClientImpl::contentsSize): Deleted.
+            * UIProcess/ios/WKContentView.mm:
+            (-[WKContentView _didCommitLayerTree:]):
+            * UIProcess/ios/WebPageProxyIOS.mm:
+            (WebKit::WebPageProxy::computeCustomFixedPositionRect):
+            * UIProcess/mac/PageClientImpl.h:
+            * UIProcess/mac/PageClientImpl.mm:
+            (WebKit::PageClientImpl::requestScroll):
+            * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm:
+            (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
+            * WebProcess/WebPage/WebPage.cpp:
+            (WebKit::WebPage::willCommitLayerTree):
+
+2015-07-12  Babak Shafiei  <bshaf...@apple.com>
+
         Merge r186707.
 
     2015-07-10  Chris Dumez  <cdu...@apple.com>

Modified: branches/safari-601.1-branch/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h (186756 => 186757)


--- branches/safari-601.1-branch/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h	2015-07-13 06:54:36 UTC (rev 186756)
+++ branches/safari-601.1-branch/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h	2015-07-13 06:56:28 UTC (rev 186757)
@@ -195,6 +195,9 @@
 
     WebCore::IntSize contentsSize() const { return m_contentsSize; }
     void setContentsSize(const WebCore::IntSize& size) { m_contentsSize = size; };
+
+    WebCore::IntPoint scrollOrigin() const { return m_scrollOrigin; }
+    void setScrollOrigin(const WebCore::IntPoint& origin) { m_scrollOrigin = origin; };
     
     WebCore::Color pageExtendedBackgroundColor() const { return m_pageExtendedBackgroundColor; }
     void setPageExtendedBackgroundColor(WebCore::Color color) { m_pageExtendedBackgroundColor = color; }
@@ -242,6 +245,7 @@
     Vector<TransactionCallbackID> m_callbackIDs;
 
     WebCore::IntSize m_contentsSize;
+    WebCore::IntPoint m_scrollOrigin;
 #if PLATFORM(MAC)
     WebCore::IntPoint m_scrollPosition;
 #endif

Modified: branches/safari-601.1-branch/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm (186756 => 186757)


--- branches/safari-601.1-branch/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm	2015-07-13 06:54:36 UTC (rev 186756)
+++ branches/safari-601.1-branch/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm	2015-07-13 06:56:28 UTC (rev 186757)
@@ -516,6 +516,7 @@
     encoder << m_layerIDsWithNewlyUnreachableBackingStore;
 
     encoder << m_contentsSize;
+    encoder << m_scrollOrigin;
 #if PLATFORM(MAC)
     encoder << m_scrollPosition;
 #endif
@@ -581,6 +582,9 @@
     if (!decoder.decode(result.m_contentsSize))
         return false;
 
+    if (!decoder.decode(result.m_scrollOrigin))
+        return false;
+
 #if PLATFORM(MAC)
     if (!decoder.decode(result.m_scrollPosition))
         return false;
@@ -1242,6 +1246,15 @@
 {
     RemoteLayerTreeTextStream ts;
 
+    ts << "(";
+    dumpProperty(ts, "transactionID", m_transactionID);
+    dumpProperty(ts, "contentsSize", m_contentsSize);
+    if (m_scrollOrigin != IntPoint::zero())
+        dumpProperty(ts, "scrollOrigin", m_scrollOrigin);
+
+    if (m_pageScaleFactor != 1)
+        dumpProperty(ts, "pageScaleFactor", m_pageScaleFactor);
+
     ts << "(\n";
     ts.increaseIndent();
     ts.writeIndent();

Modified: branches/safari-601.1-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (186756 => 186757)


--- branches/safari-601.1-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm	2015-07-13 06:54:36 UTC (rev 186756)
+++ branches/safari-601.1-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm	2015-07-13 06:56:28 UTC (rev 186757)
@@ -1145,12 +1145,14 @@
     return contentOffset;
 }
 
-- (void)_scrollToContentOffset:(WebCore::FloatPoint)contentOffsetInPageCoordinates
+- (void)_scrollToContentOffset:(WebCore::FloatPoint)contentOffsetInPageCoordinates scrollOrigin:(WebCore::IntPoint)scrollOrigin
 {
     if (_dynamicViewportUpdateMode != DynamicViewportUpdateMode::NotResizing)
         return;
 
-    WebCore::FloatPoint scaledOffset = contentOffsetInPageCoordinates;
+    WebCore::FloatPoint contentOffsetRespectingOrigin = scrollOrigin + toFloatSize(contentOffsetInPageCoordinates);
+
+    WebCore::FloatPoint scaledOffset = contentOffsetRespectingOrigin;
     CGFloat zoomScale = contentZoomScale(self);
     scaledOffset.scale(zoomScale, zoomScale);
 

Modified: branches/safari-601.1-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewInternal.h (186756 => 186757)


--- branches/safari-601.1-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewInternal.h	2015-07-13 06:54:36 UTC (rev 186756)
+++ branches/safari-601.1-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewInternal.h	2015-07-13 06:56:28 UTC (rev 186757)
@@ -81,7 +81,7 @@
 
 - (PassRefPtr<WebKit::ViewSnapshot>)_takeViewSnapshot;
 
-- (void)_scrollToContentOffset:(WebCore::FloatPoint)contentOffset;
+- (void)_scrollToContentOffset:(WebCore::FloatPoint)contentOffset scrollOrigin:(WebCore::IntPoint)scrollOrigin;
 - (BOOL)_scrollToRect:(WebCore::FloatRect)targetRect origin:(WebCore::FloatPoint)origin minimumScrollDistance:(float)minimumScrollDistance;
 - (void)_scrollByOffset:(WebCore::FloatPoint)offset;
 - (void)_zoomToFocusRect:(WebCore::FloatRect)focusedElementRect selectionRect:(WebCore::FloatRect)selectionRectInDocumentCoordinates fontSize:(float)fontSize minimumScale:(double)minimumScale maximumScale:(double)maximumScale allowScaling:(BOOL)allowScaling forceScroll:(BOOL)forceScroll;

Modified: branches/safari-601.1-branch/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.cpp (186756 => 186757)


--- branches/safari-601.1-branch/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.cpp	2015-07-13 06:54:36 UTC (rev 186756)
+++ branches/safari-601.1-branch/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.cpp	2015-07-13 06:56:28 UTC (rev 186757)
@@ -77,7 +77,7 @@
     setViewNeedsDisplay(scrollRect);
 }
 
-void PageClientImpl::requestScroll(const WebCore::FloatPoint&, bool)
+void PageClientImpl::requestScroll(const WebCore::FloatPoint&, const WebCore::IntPoint&, bool)
 {
     notImplemented();
 }

Modified: branches/safari-601.1-branch/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.h (186756 => 186757)


--- branches/safari-601.1-branch/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.h	2015-07-13 06:54:36 UTC (rev 186756)
+++ branches/safari-601.1-branch/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.h	2015-07-13 06:56:28 UTC (rev 186757)
@@ -58,7 +58,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 void requestScroll(const WebCore::FloatPoint& scrollPosition, const WebCore::IntPoint& scrollOrigin, bool isProgrammaticScroll) override;
     virtual WebCore::IntSize viewSize() override;
     virtual bool isViewWindowActive() override;
     virtual bool isViewFocused() override;

Modified: branches/safari-601.1-branch/Source/WebKit2/UIProcess/CoordinatedGraphics/WebView.cpp (186756 => 186757)


--- branches/safari-601.1-branch/Source/WebKit2/UIProcess/CoordinatedGraphics/WebView.cpp	2015-07-13 06:54:36 UTC (rev 186756)
+++ branches/safari-601.1-branch/Source/WebKit2/UIProcess/CoordinatedGraphics/WebView.cpp	2015-07-13 06:56:28 UTC (rev 186757)
@@ -304,7 +304,7 @@
     setViewNeedsDisplay(scrollRect);
 }
 
-void WebView::requestScroll(const WebCore::FloatPoint&, bool)
+void WebView::requestScroll(const WebCore::FloatPoint&, const WebCore::IntPoint&, bool)
 {
     notImplemented();
 }

Modified: branches/safari-601.1-branch/Source/WebKit2/UIProcess/CoordinatedGraphics/WebView.h (186756 => 186757)


--- branches/safari-601.1-branch/Source/WebKit2/UIProcess/CoordinatedGraphics/WebView.h	2015-07-13 06:54:36 UTC (rev 186756)
+++ branches/safari-601.1-branch/Source/WebKit2/UIProcess/CoordinatedGraphics/WebView.h	2015-07-13 06:56:28 UTC (rev 186757)
@@ -128,7 +128,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 void requestScroll(const WebCore::FloatPoint&, const WebCore::IntPoint&, bool) override;
 
     virtual WebCore::IntSize viewSize() override;
 

Modified: branches/safari-601.1-branch/Source/WebKit2/UIProcess/PageClient.h (186756 => 186757)


--- branches/safari-601.1-branch/Source/WebKit2/UIProcess/PageClient.h	2015-07-13 06:54:36 UTC (rev 186756)
+++ branches/safari-601.1-branch/Source/WebKit2/UIProcess/PageClient.h	2015-07-13 06:56:28 UTC (rev 186757)
@@ -97,7 +97,7 @@
     // 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;
+    virtual void requestScroll(const WebCore::FloatPoint& scrollPosition, const WebCore::IntPoint& scrollOrigin, bool isProgrammaticScroll) = 0;
 
     // Return the size of the view the page is associated with.
     virtual WebCore::IntSize viewSize() = 0;
@@ -279,7 +279,7 @@
     virtual void zoomToRect(WebCore::FloatRect, double minimumScale, double maximumScale) = 0;
     virtual void didChangeViewportMetaTagWidth(float) = 0;
     virtual double minimumZoomScale() const = 0;
-    virtual WebCore::FloatSize contentsSize() const = 0;
+    virtual WebCore::FloatRect documentRect() const = 0;
     virtual void overflowScrollViewWillStartPanGesture() = 0;
     virtual void overflowScrollViewDidScroll() = 0;
     virtual void overflowScrollWillStartScroll() = 0;

Modified: branches/safari-601.1-branch/Source/WebKit2/UIProcess/WebPageProxy.cpp (186756 => 186757)


--- branches/safari-601.1-branch/Source/WebKit2/UIProcess/WebPageProxy.cpp	2015-07-13 06:54:36 UTC (rev 186756)
+++ branches/safari-601.1-branch/Source/WebKit2/UIProcess/WebPageProxy.cpp	2015-07-13 06:56:28 UTC (rev 186757)
@@ -1275,9 +1275,9 @@
     m_pageClient.scrollView(scrollRect, scrollOffset);
 }
 
-void WebPageProxy::requestScroll(const FloatPoint& scrollPosition, bool isProgrammaticScroll)
+void WebPageProxy::requestScroll(const FloatPoint& scrollPosition, const IntPoint& scrollOrigin, bool isProgrammaticScroll)
 {
-    m_pageClient.requestScroll(scrollPosition, isProgrammaticScroll);
+    m_pageClient.requestScroll(scrollPosition, scrollOrigin, isProgrammaticScroll);
 }
 
 void WebPageProxy::setSuppressVisibilityUpdates(bool flag)

Modified: branches/safari-601.1-branch/Source/WebKit2/UIProcess/WebPageProxy.h (186756 => 186757)


--- branches/safari-601.1-branch/Source/WebKit2/UIProcess/WebPageProxy.h	2015-07-13 06:54:36 UTC (rev 186756)
+++ branches/safari-601.1-branch/Source/WebKit2/UIProcess/WebPageProxy.h	2015-07-13 06:56:28 UTC (rev 186757)
@@ -418,7 +418,7 @@
     void displayView();
     bool canScrollView();
     void scrollView(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset); // FIXME: CoordinatedGraphics should use requestScroll().
-    void requestScroll(const WebCore::FloatPoint& scrollPosition, bool isProgrammaticScroll);
+    void requestScroll(const WebCore::FloatPoint& scrollPosition, const WebCore::IntPoint& scrollOrigin, bool isProgrammaticScroll);
     
     void setDelegatesScrolling(bool delegatesScrolling) { m_delegatesScrolling = delegatesScrolling; }
     bool delegatesScrolling() const { return m_delegatesScrolling; }

Modified: branches/safari-601.1-branch/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h (186756 => 186757)


--- branches/safari-601.1-branch/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h	2015-07-13 06:54:36 UTC (rev 186756)
+++ branches/safari-601.1-branch/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h	2015-07-13 06:56:28 UTC (rev 186757)
@@ -56,7 +56,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 void requestScroll(const WebCore::FloatPoint& scrollPosition, const WebCore::IntPoint& scrollOrigin, bool isProgrammaticScroll) override;
     virtual WebCore::IntSize viewSize() override;
     virtual bool isViewWindowActive() override;
     virtual bool isViewFocused() override;
@@ -135,7 +135,7 @@
     virtual bool handleRunOpenPanel(WebPageProxy*, WebFrameProxy*, WebOpenPanelParameters*, WebOpenPanelResultListenerProxy*) override;
     virtual void didChangeViewportMetaTagWidth(float) override;
     virtual double minimumZoomScale() const override;
-    virtual WebCore::FloatSize contentsSize() const override;
+    virtual WebCore::FloatRect documentRect() const override;
 
     virtual void showInspectorHighlight(const WebCore::Highlight&) override;
     virtual void hideInspectorHighlight() override;

Modified: branches/safari-601.1-branch/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm (186756 => 186757)


--- branches/safari-601.1-branch/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm	2015-07-13 06:54:36 UTC (rev 186756)
+++ branches/safari-601.1-branch/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm	2015-07-13 06:56:28 UTC (rev 186757)
@@ -154,10 +154,10 @@
     ASSERT_NOT_REACHED();
 }
 
-void PageClientImpl::requestScroll(const FloatPoint& scrollPosition, bool isProgrammaticScroll)
+void PageClientImpl::requestScroll(const FloatPoint& scrollPosition, const IntPoint& scrollOrigin, bool isProgrammaticScroll)
 {
     UNUSED_PARAM(isProgrammaticScroll);
-    [m_webView _scrollToContentOffset:scrollPosition];
+    [m_webView _scrollToContentOffset:scrollPosition scrollOrigin:scrollOrigin];
 }
 
 IntSize PageClientImpl::viewSize()
@@ -278,9 +278,9 @@
     return 1;
 }
 
-WebCore::FloatSize PageClientImpl::contentsSize() const
+WebCore::FloatRect PageClientImpl::documentRect() const
 {
-    return FloatSize([m_contentView bounds].size);
+    return [m_contentView bounds];
 }
 
 void PageClientImpl::setCursor(const Cursor&)

Modified: branches/safari-601.1-branch/Source/WebKit2/UIProcess/ios/WKContentView.mm (186756 => 186757)


--- branches/safari-601.1-branch/Source/WebKit2/UIProcess/ios/WKContentView.mm	2015-07-13 06:54:36 UTC (rev 186756)
+++ branches/safari-601.1-branch/Source/WebKit2/UIProcess/ios/WKContentView.mm	2015-07-13 06:56:28 UTC (rev 186757)
@@ -494,14 +494,21 @@
 - (void)_didCommitLayerTree:(const WebKit::RemoteLayerTreeTransaction&)layerTreeTransaction
 {
     CGSize contentsSize = layerTreeTransaction.contentsSize();
-    CGRect contentBounds = { CGPointZero, contentsSize };
-    CGRect oldBounds = [self bounds];
+    CGPoint scrollOrigin = -layerTreeTransaction.scrollOrigin();
+    CGRect contentBounds = { scrollOrigin, contentsSize };
 
-    BOOL boundsChanged = !CGRectEqualToRect(oldBounds, contentBounds);
+    BOOL boundsChanged = !CGRectEqualToRect([self bounds], contentBounds);
     if (boundsChanged)
         [self setBounds:contentBounds];
 
     [_webView _didCommitLayerTree:layerTreeTransaction];
+
+    if (_interactionViewsContainerView) {
+        FloatPoint scaledOrigin = layerTreeTransaction.scrollOrigin();
+        float scale = [[_webView scrollView] zoomScale];
+        scaledOrigin.scale(scale, scale);
+        [_interactionViewsContainerView setFrame:CGRectMake(scaledOrigin.x(), scaledOrigin.y(), 0, 0)];
+    }
     
     if (boundsChanged) {
         FloatRect fixedPositionRect = _page->computeCustomFixedPositionRect(_page->unobscuredContentRect(), [[_webView scrollView] zoomScale]);

Modified: branches/safari-601.1-branch/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm (186756 => 186757)


--- branches/safari-601.1-branch/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm	2015-07-13 06:54:36 UTC (rev 186756)
+++ branches/safari-601.1-branch/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm	2015-07-13 06:56:28 UTC (rev 186757)
@@ -217,8 +217,7 @@
 WebCore::FloatRect WebPageProxy::computeCustomFixedPositionRect(const FloatRect& unobscuredContentRect, double displayedContentScale, UnobscuredRectConstraint constraint) const
 {
     FloatRect constrainedUnobscuredRect = unobscuredContentRect;
-    FloatSize contentsSize = m_pageClient.contentsSize();
-    FloatRect documentRect = FloatRect(FloatPoint(), contentsSize);
+    FloatRect documentRect = m_pageClient.documentRect();
 
     if (m_pageClient.isAssistingNode())
         return documentRect;
@@ -238,7 +237,7 @@
         constrainedUnobscuredRect.setHeight(adjustedUnexposedMaxEdge(documentRect.maxY(), constrainedUnobscuredRect.maxY(), factor) - constrainedUnobscuredRect.y());
     }
     
-    return FrameView::rectForViewportConstrainedObjects(enclosingLayoutRect(constrainedUnobscuredRect), LayoutSize(contentsSize), displayedContentScale, false, StickToViewportBounds);
+    return FrameView::rectForViewportConstrainedObjects(enclosingLayoutRect(constrainedUnobscuredRect), LayoutSize(documentRect.size()), displayedContentScale, false, StickToViewportBounds);
 }
 
 void WebPageProxy::overflowScrollViewWillStartPanGesture()

Modified: branches/safari-601.1-branch/Source/WebKit2/UIProcess/mac/PageClientImpl.h (186756 => 186757)


--- branches/safari-601.1-branch/Source/WebKit2/UIProcess/mac/PageClientImpl.h	2015-07-13 06:54:36 UTC (rev 186756)
+++ branches/safari-601.1-branch/Source/WebKit2/UIProcess/mac/PageClientImpl.h	2015-07-13 06:56:28 UTC (rev 186757)
@@ -61,7 +61,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 void requestScroll(const WebCore::FloatPoint& scrollPosition, const WebCore::IntPoint& scrollOrigin, bool isProgrammaticScroll) override;
 
     virtual WebCore::IntSize viewSize() override;
     virtual bool isViewWindowActive() override;

Modified: branches/safari-601.1-branch/Source/WebKit2/UIProcess/mac/PageClientImpl.mm (186756 => 186757)


--- branches/safari-601.1-branch/Source/WebKit2/UIProcess/mac/PageClientImpl.mm	2015-07-13 06:54:36 UTC (rev 186756)
+++ branches/safari-601.1-branch/Source/WebKit2/UIProcess/mac/PageClientImpl.mm	2015-07-13 06:56:28 UTC (rev 186757)
@@ -181,7 +181,7 @@
     ASSERT_NOT_REACHED();
 }
 
-void PageClientImpl::requestScroll(const FloatPoint& scrollPosition, bool isProgrammaticScroll)
+void PageClientImpl::requestScroll(const FloatPoint& scrollPosition, const IntPoint& scrollOrigin, bool isProgrammaticScroll)
 {
     ASSERT_NOT_REACHED();
 }

Modified: branches/safari-601.1-branch/Source/WebKit2/UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm (186756 => 186757)


--- branches/safari-601.1-branch/Source/WebKit2/UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm	2015-07-13 06:54:36 UTC (rev 186756)
+++ branches/safari-601.1-branch/Source/WebKit2/UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm	2015-07-13 06:56:28 UTC (rev 186757)
@@ -219,7 +219,7 @@
     // Handle requested scroll position updates from the scrolling tree transaction after didCommitLayerTree()
     // has updated the view size based on the content size.
     if (requestedScrollInfo.requestsScrollPositionUpdate)
-        m_webPageProxy.requestScroll(requestedScrollInfo.requestedScrollPosition, requestedScrollInfo.requestIsProgrammaticScroll);
+        m_webPageProxy.requestScroll(requestedScrollInfo.requestedScrollPosition, layerTreeTransaction.scrollOrigin(), requestedScrollInfo.requestIsProgrammaticScroll);
 #endif // ENABLE(ASYNC_SCROLLING)
 
     if (m_debugIndicatorLayerTreeHost) {

Modified: branches/safari-601.1-branch/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (186756 => 186757)


--- branches/safari-601.1-branch/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2015-07-13 06:54:36 UTC (rev 186756)
+++ branches/safari-601.1-branch/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2015-07-13 06:56:28 UTC (rev 186757)
@@ -2948,6 +2948,7 @@
 void WebPage::willCommitLayerTree(RemoteLayerTreeTransaction& layerTransaction)
 {
     layerTransaction.setContentsSize(corePage()->mainFrame().view()->contentsSize());
+    layerTransaction.setScrollOrigin(corePage()->mainFrame().view()->scrollOrigin());
     layerTransaction.setPageScaleFactor(corePage()->pageScaleFactor());
     layerTransaction.setRenderTreeSize(corePage()->renderTreeSize());
     layerTransaction.setPageExtendedBackgroundColor(corePage()->pageExtendedBackgroundColor());
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to