Changeset 186712 in webkit
- Timestamp:
- Jul 11, 2015, 11:19:46 AM (10 years ago)
- Location:
- trunk/Source
- Files:
-
- 22 edited
-
WebCore/ChangeLog (modified) (1 diff)
-
WebCore/platform/ios/ScrollViewIOS.mm (modified) (1 diff)
-
WebKit2/ChangeLog (modified) (1 diff)
-
WebKit2/Shared/mac/RemoteLayerTreeTransaction.h (modified) (2 diffs)
-
WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm (modified) (3 diffs)
-
WebKit2/UIProcess/API/Cocoa/WKWebView.mm (modified) (1 diff)
-
WebKit2/UIProcess/API/Cocoa/WKWebViewInternal.h (modified) (1 diff)
-
WebKit2/UIProcess/API/gtk/PageClientImpl.cpp (modified) (1 diff)
-
WebKit2/UIProcess/API/gtk/PageClientImpl.h (modified) (1 diff)
-
WebKit2/UIProcess/CoordinatedGraphics/WebView.cpp (modified) (1 diff)
-
WebKit2/UIProcess/CoordinatedGraphics/WebView.h (modified) (1 diff)
-
WebKit2/UIProcess/PageClient.h (modified) (2 diffs)
-
WebKit2/UIProcess/WebPageProxy.cpp (modified) (1 diff)
-
WebKit2/UIProcess/WebPageProxy.h (modified) (1 diff)
-
WebKit2/UIProcess/ios/PageClientImplIOS.h (modified) (2 diffs)
-
WebKit2/UIProcess/ios/PageClientImplIOS.mm (modified) (2 diffs)
-
WebKit2/UIProcess/ios/WKContentView.mm (modified) (1 diff)
-
WebKit2/UIProcess/ios/WebPageProxyIOS.mm (modified) (2 diffs)
-
WebKit2/UIProcess/mac/PageClientImpl.h (modified) (1 diff)
-
WebKit2/UIProcess/mac/PageClientImpl.mm (modified) (1 diff)
-
WebKit2/UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm (modified) (1 diff)
-
WebKit2/WebProcess/WebPage/WebPage.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r186707 r186712 1 2015-07-10 Simon Fraser <simon.fraser@apple.com> 2 3 [iOS WK2] Scrolling issues on horizontally scrollable RTL pages 4 https://bugs.webkit.org/show_bug.cgi?id=146872 5 rdar://problem/7569416 6 7 Reviewed by Sam Weinig. 8 9 Horizontally scrollable RTL pages in WebKit2 had a variety of issues: they had 10 a gap down the right edge, and unreachable content on the left side, focussing 11 form fields scrolled to the wrong location, and programmatic scrolls scrolled 12 to the wrong place. 13 14 Fix by plumbing the WebCore notion of scrollOrigin through to the UI process, 15 and using it in various places. There are three main aspects to the patch: 16 17 1. scroll origin is included in RemoteLayerTreeTransaction, and plumbed through 18 to -[WKWebView _scrollToContentOffset:] for correct programmatic scrolling, 19 including zooming to focussed form elements. 20 2. WebPageProxy::computeCustomFixedPositionRect() uses the actual documentRect() 21 rather than just conjuring up a rect with a zero origin, which makes position:fixed 22 work correctly. 23 3. _interactionViewsContainerView (which hosts tap highlights) is positioned to 24 coincide with the origin of the documentRect (i.e. at the scroll origin, which 25 may not be top-left). This allows tap highlights to show in the correct location. 26 4. ScrollView::unobscuredContentRect() is fixed to take scroll origin into account; 27 if the returned rect is wrong, RenderLayer::hitTest() incorrectly clips the hit 28 testing area. 29 30 * platform/ios/ScrollViewIOS.mm: 31 (WebCore::ScrollView::unobscuredContentRect): 32 1 33 2015-07-10 Chris Dumez <cdumez@apple.com> 2 34 -
trunk/Source/WebCore/platform/ios/ScrollViewIOS.mm
r185021 r186712 109 109 110 110 if (!m_unobscuredContentSize.isEmpty()) 111 return IntRect( IntPoint(m_scrollOffset), roundedIntSize(m_unobscuredContentSize));111 return IntRect(scrollOrigin() + m_scrollOffset, roundedIntSize(m_unobscuredContentSize)); 112 112 113 113 return unobscuredContentRectInternal(); -
trunk/Source/WebKit2/ChangeLog
r186707 r186712 1 2015-07-10 Simon Fraser <simon.fraser@apple.com> 2 3 [iOS WK2] Scrolling issues on horizontally scrollable RTL pages 4 https://bugs.webkit.org/show_bug.cgi?id=146872 5 rdar://problem/7569416 6 7 Reviewed by Sam Weinig. 8 9 Horizontally scrollable RTL pages in WebKit2 had a variety of issues: they had 10 a gap down the right edge, and unreachable content on the left side, focussing 11 form fields scrolled to the wrong location, and programmatic scrolls scrolled 12 to the wrong place. 13 14 Fix by plumbing the WebCore notion of scrollOrigin through to the UI process, 15 and using it in various places. There are three main aspects to the patch: 16 17 1. scroll origin is included in RemoteLayerTreeTransaction, and plumbed through 18 to -[WKWebView _scrollToContentOffset:] for correct programmatic scrolling, 19 including zooming to focused form elements. The WKContentView's boundsOrigin 20 is set to the scroll origin so that the view coordinates match document coordinates. 21 2. WebPageProxy::computeCustomFixedPositionRect() uses the actual documentRect() 22 rather than just conjuring up a rect with a zero origin, which makes position:fixed 23 work correctly. 24 3. _interactionViewsContainerView (which hosts tap highlights) is positioned to 25 coincide with the origin of the documentRect (i.e. at the scroll origin, which 26 may not be top-left). This allows tap highlights to show in the correct location. 27 4. ScrollView::unobscuredContentRect() is fixed to take scroll origin into account; 28 if the returned rect is wrong, RenderLayer::hitTest() incorrectly clips the hit 29 testing area. 30 31 * Shared/mac/RemoteLayerTreeTransaction.h: 32 (WebKit::RemoteLayerTreeTransaction::scrollOrigin): 33 (WebKit::RemoteLayerTreeTransaction::setScrollOrigin): 34 * Shared/mac/RemoteLayerTreeTransaction.mm: 35 (WebKit::RemoteLayerTreeTransaction::encode): 36 (WebKit::RemoteLayerTreeTransaction::decode): 37 (WebKit::RemoteLayerTreeTransaction::description): Dump some more info. 38 * UIProcess/API/Cocoa/WKWebView.mm: 39 (-[WKWebView _scrollToContentOffset:scrollOrigin:]): 40 (-[WKWebView _scrollToContentOffset:]): Deleted. 41 * UIProcess/API/Cocoa/WKWebViewInternal.h: 42 * UIProcess/API/gtk/PageClientImpl.cpp: 43 (WebKit::PageClientImpl::requestScroll): 44 * UIProcess/API/gtk/PageClientImpl.h: 45 * UIProcess/CoordinatedGraphics/WebView.cpp: 46 (WebKit::WebView::requestScroll): 47 * UIProcess/CoordinatedGraphics/WebView.h: 48 * UIProcess/PageClient.h: 49 * UIProcess/WebPageProxy.cpp: 50 (WebKit::WebPageProxy::requestScroll): 51 * UIProcess/WebPageProxy.h: 52 * UIProcess/ios/PageClientImplIOS.h: 53 * UIProcess/ios/PageClientImplIOS.mm: 54 (WebKit::PageClientImpl::requestScroll): 55 (WebKit::PageClientImpl::documentRect): 56 (WebKit::PageClientImpl::contentsSize): Deleted. 57 * UIProcess/ios/WKContentView.mm: 58 (-[WKContentView _didCommitLayerTree:]): 59 * UIProcess/ios/WebPageProxyIOS.mm: 60 (WebKit::WebPageProxy::computeCustomFixedPositionRect): 61 * UIProcess/mac/PageClientImpl.h: 62 * UIProcess/mac/PageClientImpl.mm: 63 (WebKit::PageClientImpl::requestScroll): 64 * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm: 65 (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree): 66 * WebProcess/WebPage/WebPage.cpp: 67 (WebKit::WebPage::willCommitLayerTree): 68 1 69 2015-07-10 Chris Dumez <cdumez@apple.com> 2 70 -
trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h
r183242 r186712 196 196 WebCore::IntSize contentsSize() const { return m_contentsSize; } 197 197 void setContentsSize(const WebCore::IntSize& size) { m_contentsSize = size; }; 198 199 WebCore::IntPoint scrollOrigin() const { return m_scrollOrigin; } 200 void setScrollOrigin(const WebCore::IntPoint& origin) { m_scrollOrigin = origin; }; 198 201 199 202 WebCore::Color pageExtendedBackgroundColor() const { return m_pageExtendedBackgroundColor; } … … 243 246 244 247 WebCore::IntSize m_contentsSize; 248 WebCore::IntPoint m_scrollOrigin; 245 249 #if PLATFORM(MAC) 246 250 WebCore::IntPoint m_scrollPosition; -
trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm
r183942 r186712 517 517 518 518 encoder << m_contentsSize; 519 encoder << m_scrollOrigin; 519 520 #if PLATFORM(MAC) 520 521 encoder << m_scrollPosition; … … 580 581 581 582 if (!decoder.decode(result.m_contentsSize)) 583 return false; 584 585 if (!decoder.decode(result.m_scrollOrigin)) 582 586 return false; 583 587 … … 1243 1247 RemoteLayerTreeTextStream ts; 1244 1248 1249 ts << "("; 1250 dumpProperty(ts, "transactionID", m_transactionID); 1251 dumpProperty(ts, "contentsSize", m_contentsSize); 1252 if (m_scrollOrigin != IntPoint::zero()) 1253 dumpProperty(ts, "scrollOrigin", m_scrollOrigin); 1254 1255 if (m_pageScaleFactor != 1) 1256 dumpProperty(ts, "pageScaleFactor", m_pageScaleFactor); 1257 1245 1258 ts << "(\n"; 1246 1259 ts.increaseIndent(); -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm
r186586 r186712 1146 1146 } 1147 1147 1148 - (void)_scrollToContentOffset:(WebCore::FloatPoint)contentOffsetInPageCoordinates 1148 - (void)_scrollToContentOffset:(WebCore::FloatPoint)contentOffsetInPageCoordinates scrollOrigin:(WebCore::IntPoint)scrollOrigin 1149 1149 { 1150 1150 if (_dynamicViewportUpdateMode != DynamicViewportUpdateMode::NotResizing) 1151 1151 return; 1152 1152 1153 WebCore::FloatPoint scaledOffset = contentOffsetInPageCoordinates; 1153 WebCore::FloatPoint contentOffsetRespectingOrigin = scrollOrigin + toFloatSize(contentOffsetInPageCoordinates); 1154 1155 WebCore::FloatPoint scaledOffset = contentOffsetRespectingOrigin; 1154 1156 CGFloat zoomScale = contentZoomScale(self); 1155 1157 scaledOffset.scale(zoomScale, zoomScale); -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewInternal.h
r186092 r186712 82 82 - (PassRefPtr<WebKit::ViewSnapshot>)_takeViewSnapshot; 83 83 84 - (void)_scrollToContentOffset:(WebCore::FloatPoint)contentOffset ;84 - (void)_scrollToContentOffset:(WebCore::FloatPoint)contentOffset scrollOrigin:(WebCore::IntPoint)scrollOrigin; 85 85 - (BOOL)_scrollToRect:(WebCore::FloatRect)targetRect origin:(WebCore::FloatPoint)origin minimumScrollDistance:(float)minimumScrollDistance; 86 86 - (void)_scrollByOffset:(WebCore::FloatPoint)offset; -
trunk/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.cpp
r186221 r186712 78 78 } 79 79 80 void PageClientImpl::requestScroll(const WebCore::FloatPoint&, bool)80 void PageClientImpl::requestScroll(const WebCore::FloatPoint&, const WebCore::IntPoint&, bool) 81 81 { 82 82 notImplemented(); -
trunk/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.h
r186108 r186712 59 59 virtual bool canScrollView() override { return false; } 60 60 virtual void scrollView(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset) override; 61 virtual void requestScroll(const WebCore::FloatPoint& scrollPosition, bool isProgrammaticScroll) override;61 virtual void requestScroll(const WebCore::FloatPoint& scrollPosition, const WebCore::IntPoint& scrollOrigin, bool isProgrammaticScroll) override; 62 62 virtual WebCore::IntSize viewSize() override; 63 63 virtual bool isViewWindowActive() override; -
trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/WebView.cpp
r183517 r186712 305 305 } 306 306 307 void WebView::requestScroll(const WebCore::FloatPoint&, bool)307 void WebView::requestScroll(const WebCore::FloatPoint&, const WebCore::IntPoint&, bool) 308 308 { 309 309 notImplemented(); -
trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/WebView.h
r186103 r186712 129 129 virtual bool canScrollView() override { return false; } 130 130 virtual void scrollView(const WebCore::IntRect&, const WebCore::IntSize&) override; 131 virtual void requestScroll(const WebCore::FloatPoint&, bool) override;131 virtual void requestScroll(const WebCore::FloatPoint&, const WebCore::IntPoint&, bool) override; 132 132 133 133 virtual WebCore::IntSize viewSize() override; -
trunk/Source/WebKit2/UIProcess/PageClient.h
r186088 r186712 98 98 virtual void scrollView(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset) = 0; 99 99 // Tell the view to scroll to the given position, and whether this was a programmatic scroll. 100 virtual void requestScroll(const WebCore::FloatPoint& scrollPosition, bool isProgrammaticScroll) = 0;100 virtual void requestScroll(const WebCore::FloatPoint& scrollPosition, const WebCore::IntPoint& scrollOrigin, bool isProgrammaticScroll) = 0; 101 101 102 102 // Return the size of the view the page is associated with. … … 280 280 virtual void didChangeViewportMetaTagWidth(float) = 0; 281 281 virtual double minimumZoomScale() const = 0; 282 virtual WebCore::Float Size contentsSize() const = 0;282 virtual WebCore::FloatRect documentRect() const = 0; 283 283 virtual void overflowScrollViewWillStartPanGesture() = 0; 284 284 virtual void overflowScrollViewDidScroll() = 0; -
trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp
r186707 r186712 1276 1276 } 1277 1277 1278 void WebPageProxy::requestScroll(const FloatPoint& scrollPosition, bool isProgrammaticScroll)1279 { 1280 m_pageClient.requestScroll(scrollPosition, isProgrammaticScroll);1278 void WebPageProxy::requestScroll(const FloatPoint& scrollPosition, const IntPoint& scrollOrigin, bool isProgrammaticScroll) 1279 { 1280 m_pageClient.requestScroll(scrollPosition, scrollOrigin, isProgrammaticScroll); 1281 1281 } 1282 1282 -
trunk/Source/WebKit2/UIProcess/WebPageProxy.h
r186707 r186712 419 419 bool canScrollView(); 420 420 void scrollView(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset); // FIXME: CoordinatedGraphics should use requestScroll(). 421 void requestScroll(const WebCore::FloatPoint& scrollPosition, bool isProgrammaticScroll);421 void requestScroll(const WebCore::FloatPoint& scrollPosition, const WebCore::IntPoint& scrollOrigin, bool isProgrammaticScroll); 422 422 423 423 void setDelegatesScrolling(bool delegatesScrolling) { m_delegatesScrolling = delegatesScrolling; } -
trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h
r186092 r186712 57 57 virtual bool canScrollView() override; 58 58 virtual void scrollView(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset) override; 59 virtual void requestScroll(const WebCore::FloatPoint& scrollPosition, bool isProgrammaticScroll) override;59 virtual void requestScroll(const WebCore::FloatPoint& scrollPosition, const WebCore::IntPoint& scrollOrigin, bool isProgrammaticScroll) override; 60 60 virtual WebCore::IntSize viewSize() override; 61 61 virtual bool isViewWindowActive() override; … … 136 136 virtual void didChangeViewportMetaTagWidth(float) override; 137 137 virtual double minimumZoomScale() const override; 138 virtual WebCore::Float Size contentsSize() const override;138 virtual WebCore::FloatRect documentRect() const override; 139 139 140 140 virtual void showInspectorHighlight(const WebCore::Highlight&) override; -
trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm
r186092 r186712 155 155 } 156 156 157 void PageClientImpl::requestScroll(const FloatPoint& scrollPosition, bool isProgrammaticScroll)157 void PageClientImpl::requestScroll(const FloatPoint& scrollPosition, const IntPoint& scrollOrigin, bool isProgrammaticScroll) 158 158 { 159 159 UNUSED_PARAM(isProgrammaticScroll); 160 [m_webView _scrollToContentOffset:scrollPosition ];160 [m_webView _scrollToContentOffset:scrollPosition scrollOrigin:scrollOrigin]; 161 161 } 162 162 … … 279 279 } 280 280 281 WebCore::Float Size PageClientImpl::contentsSize() const282 { 283 return FloatSize([m_contentView bounds].size);281 WebCore::FloatRect PageClientImpl::documentRect() const 282 { 283 return [m_contentView bounds]; 284 284 } 285 285 -
trunk/Source/WebKit2/UIProcess/ios/WKContentView.mm
r186648 r186712 495 495 { 496 496 CGSize contentsSize = layerTreeTransaction.contentsSize(); 497 CG Rect contentBounds = { CGPointZero, contentsSize };498 CGRect oldBounds = [self bounds];499 500 BOOL boundsChanged = !CGRectEqualToRect( oldBounds, contentBounds);497 CGPoint scrollOrigin = -layerTreeTransaction.scrollOrigin(); 498 CGRect contentBounds = { scrollOrigin, contentsSize }; 499 500 BOOL boundsChanged = !CGRectEqualToRect([self bounds], contentBounds); 501 501 if (boundsChanged) 502 502 [self setBounds:contentBounds]; 503 503 504 504 [_webView _didCommitLayerTree:layerTreeTransaction]; 505 506 if (_interactionViewsContainerView) { 507 FloatPoint scaledOrigin = layerTreeTransaction.scrollOrigin(); 508 float scale = [[_webView scrollView] zoomScale]; 509 scaledOrigin.scale(scale, scale); 510 [_interactionViewsContainerView setFrame:CGRectMake(scaledOrigin.x(), scaledOrigin.y(), 0, 0)]; 511 } 505 512 506 513 if (boundsChanged) { -
trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm
r186082 r186712 218 218 { 219 219 FloatRect constrainedUnobscuredRect = unobscuredContentRect; 220 FloatSize contentsSize = m_pageClient.contentsSize(); 221 FloatRect documentRect = FloatRect(FloatPoint(), contentsSize); 220 FloatRect documentRect = m_pageClient.documentRect(); 222 221 223 222 if (m_pageClient.isAssistingNode()) … … 239 238 } 240 239 241 return FrameView::rectForViewportConstrainedObjects(enclosingLayoutRect(constrainedUnobscuredRect), LayoutSize( contentsSize), displayedContentScale, false, StickToViewportBounds);240 return FrameView::rectForViewportConstrainedObjects(enclosingLayoutRect(constrainedUnobscuredRect), LayoutSize(documentRect.size()), displayedContentScale, false, StickToViewportBounds); 242 241 } 243 242 -
trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h
r186088 r186712 62 62 virtual bool canScrollView() override; 63 63 virtual void scrollView(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset) override; 64 virtual void requestScroll(const WebCore::FloatPoint& scrollPosition, bool isProgrammaticScroll) override;64 virtual void requestScroll(const WebCore::FloatPoint& scrollPosition, const WebCore::IntPoint& scrollOrigin, bool isProgrammaticScroll) override; 65 65 66 66 virtual WebCore::IntSize viewSize() override; -
trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm
r186088 r186712 182 182 } 183 183 184 void PageClientImpl::requestScroll(const FloatPoint& scrollPosition, bool isProgrammaticScroll)184 void PageClientImpl::requestScroll(const FloatPoint& scrollPosition, const IntPoint& scrollOrigin, bool isProgrammaticScroll) 185 185 { 186 186 ASSERT_NOT_REACHED(); -
trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm
r186662 r186712 220 220 // has updated the view size based on the content size. 221 221 if (requestedScrollInfo.requestsScrollPositionUpdate) 222 m_webPageProxy.requestScroll(requestedScrollInfo.requestedScrollPosition, requestedScrollInfo.requestIsProgrammaticScroll);222 m_webPageProxy.requestScroll(requestedScrollInfo.requestedScrollPosition, layerTreeTransaction.scrollOrigin(), requestedScrollInfo.requestIsProgrammaticScroll); 223 223 #endif // ENABLE(ASYNC_SCROLLING) 224 224 -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
r186662 r186712 2949 2949 { 2950 2950 layerTransaction.setContentsSize(corePage()->mainFrame().view()->contentsSize()); 2951 layerTransaction.setScrollOrigin(corePage()->mainFrame().view()->scrollOrigin()); 2951 2952 layerTransaction.setPageScaleFactor(corePage()->pageScaleFactor()); 2952 2953 layerTransaction.setRenderTreeSize(corePage()->renderTreeSize());
Note:
See TracChangeset
for help on using the changeset viewer.