Changeset 163515 in webkit
- Timestamp:
- Feb 5, 2014 10:45:41 PM (10 years ago)
- Location:
- trunk/Source
- Files:
-
- 2 added
- 27 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r163512 r163515 1 2014-02-05 Benjamin Poulain <benjamin@webkit.org> 2 3 [iOS] Synchronize the WKContentView and UIScrollView updates with the tiles being commited 4 https://bugs.webkit.org/show_bug.cgi?id=127886 5 6 Reviewed by Simon Fraser. 7 8 The updates of the views on the UIProcess side was completely disconnected 9 from the tiles updates from the DrawingArea. There is a non-negligible time 10 between the size/scale update and the new tiles coming, which causes 11 visual glitches. 12 13 There are three main cases where the tiles and content would be out of sync 14 with the UIViews: 15 -When loading a new page with different content width of a different viewport. 16 -When a page changes its viewport. 17 -When the viewport-constrainted viewport size changes. 18 19 To fix the issue, WKView is modified to maintain the old state of WKContentView 20 and UIScrollView until the new tiles are available. 21 22 Geometry/scale update are split in two phases: 23 1) A source (the page or the user) changes parameters of the geometry. The WebProcess updates 24 its layout accordingly. 25 At this point, the UIViews are unchanged and are left with the old parameters. 26 2) Eventually, new tiles come and commitLayerTree() is called on the drawing area proxy. 27 At that point, WKContentView and its UIScrollView are updated to match the committed 28 size and scale for the page. 29 30 * WebCore.exp.in: 31 * WebCore.xcodeproj/project.pbxproj: 32 * page/ViewportConfiguration.cpp: Added. 33 (WebCore::constraintsAreAllRelative): 34 (WebCore::ViewportConfiguration::ViewportConfiguration): 35 (WebCore::ViewportConfiguration::setDefaultConfiguration): 36 (WebCore::ViewportConfiguration::setContentsSize): 37 (WebCore::ViewportConfiguration::setMinimumLayoutSize): 38 (WebCore::ViewportConfiguration::setViewportArguments): 39 (WebCore::ViewportConfiguration::layoutSize): 40 (WebCore::ViewportConfiguration::initialScale): 41 (WebCore::ViewportConfiguration::minimumScale): 42 (WebCore::ViewportConfiguration::maximumScale): 43 (WebCore::ViewportConfiguration::allowsUserScaling): 44 (WebCore::viewportArgumentValueIsValid): 45 (WebCore::applyViewportArgument): 46 (WebCore::ViewportConfiguration::updateConfiguration): 47 (WebCore::ViewportConfiguration::layoutWidth): 48 (WebCore::ViewportConfiguration::layoutHeight): 49 * page/ViewportConfiguration.h: Added. 50 (WebCore::ViewportConfigurationConfiguration::ViewportConfigurationConfiguration): 51 (WebCore::ViewportConfiguration::defaultConfiguration): 52 (WebCore::ViewportConfiguration::contentsSize): 53 (WebCore::ViewportConfiguration::minimumLayoutSize): 54 (WebCore::ViewportConfiguration::viewportArguments): 55 1 56 2014-02-05 Benjamin Poulain <benjamin@webkit.org> 2 57 -
trunk/Source/WebCore/WebCore.exp.in
r163482 r163515 569 569 __ZN7WebCore15GraphicsLayerCA40platformCALayerSetNeedsToRevalidateTilesEv 570 570 __ZNK7WebCore15GraphicsLayerCA49platformCALayerContentsScaleMultiplierForNewTilesEPNS_15PlatformCALayerE 571 __ZNK7WebCore21ViewportConfiguration10layoutSizeEv 572 __ZNK7WebCore21ViewportConfiguration12initialScaleEv 571 573 __ZN7WebCore15GraphicsLayerCA7setNameERKN3WTF6StringE 572 574 __ZN7WebCore15GraphicsLayerCA7setSizeERKNS_9FloatSizeE … … 576 578 __ZN7WebCore15GraphicsLayerCA19setCustomAppearanceENS_13GraphicsLayer16CustomAppearanceE 577 579 __ZNK7WebCore15GraphicsLayerCA14primaryLayerIDEv 580 __ZNK7WebCore21ViewportConfiguration12minimumScaleEv 578 581 __ZN7WebCore15HitTestLocation12rectForPointERKNS_11LayoutPointEjjjj 579 582 __ZN7WebCore15HitTestLocationC1ERKNS_10FloatPointE … … 846 849 __ZN7WebCore21URLByRemovingUserInfoEP5NSURL 847 850 __ZN7WebCore21UserContentURLPattern5parseERKN3WTF6StringE 851 __ZN7WebCore21ViewportConfiguration15setContentsSizeERKNS_7IntSizeE 852 __ZN7WebCore21ViewportConfiguration20setMinimumLayoutSizeERKNS_7IntSizeE 853 __ZN7WebCore21ViewportConfiguration20setViewportArgumentsERKNS_17ViewportArgumentsE 854 __ZN7WebCore21ViewportConfiguration23setDefaultConfigurationERKNS0_10ParametersE 848 855 __ZN7WebCore21WindowsLatin1EncodingEv 849 856 __ZN7WebCore21createCFURLFromBufferEPKcmPK7__CFURL … … 910 917 __ZN7WebCore24ImmutableStylePropertiesD1Ev 911 918 __ZN7WebCore24ReferenceFilterOperationC1ERKN3WTF6StringES4_NS_15FilterOperation13OperationTypeE 919 __ZN7WebCore21ViewportConfigurationC1Ev 912 920 __ZN7WebCore24createFragmentFromMarkupERNS_8DocumentERKN3WTF6StringES5_NS_19ParserContentPolicyE 913 921 __ZN7WebCore24decodeURLEscapeSequencesERKN3WTF6StringE -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r163359 r163515 984 984 26E98A10130A9FCA008EB7B2 /* TextCodecASCIIFastPath.h in Headers */ = {isa = PBXBuildFile; fileRef = 26E98A0F130A9FCA008EB7B2 /* TextCodecASCIIFastPath.h */; }; 985 985 26F40D4A14904A6300CA67C4 /* EventLoopIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 26F40D4914904A6300CA67C4 /* EventLoopIOS.mm */; }; 986 26F9A83818A046AC00AEB88A /* ViewportConfiguration.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26F9A83618A046AC00AEB88A /* ViewportConfiguration.cpp */; }; 987 26F9A83918A046AC00AEB88A /* ViewportConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 26F9A83718A046AC00AEB88A /* ViewportConfiguration.h */; settings = {ATTRIBUTES = (Private, ); }; }; 986 988 26FAE4CC1852E3A5004C8C46 /* ResourceHandleCFURLConnectionDelegate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26FAE4C81852E3A5004C8C46 /* ResourceHandleCFURLConnectionDelegate.cpp */; }; 987 989 26FAE4CD1852E3A5004C8C46 /* ResourceHandleCFURLConnectionDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 26FAE4C91852E3A5004C8C46 /* ResourceHandleCFURLConnectionDelegate.h */; }; … … 7770 7772 26E98A0F130A9FCA008EB7B2 /* TextCodecASCIIFastPath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextCodecASCIIFastPath.h; sourceTree = "<group>"; }; 7771 7773 26F40D4914904A6300CA67C4 /* EventLoopIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = EventLoopIOS.mm; path = ios/EventLoopIOS.mm; sourceTree = "<group>"; }; 7774 26F9A83618A046AC00AEB88A /* ViewportConfiguration.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ViewportConfiguration.cpp; sourceTree = "<group>"; }; 7775 26F9A83718A046AC00AEB88A /* ViewportConfiguration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ViewportConfiguration.h; sourceTree = "<group>"; }; 7772 7776 26FAE4C81852E3A5004C8C46 /* ResourceHandleCFURLConnectionDelegate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ResourceHandleCFURLConnectionDelegate.cpp; sourceTree = "<group>"; }; 7773 7777 26FAE4C91852E3A5004C8C46 /* ResourceHandleCFURLConnectionDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResourceHandleCFURLConnectionDelegate.h; sourceTree = "<group>"; }; … … 16200 16204 F513A3E915FF4841001526DB /* ValidationMessageClient.h */, 16201 16205 8678D0BA1878E810003ABDE6 /* ViewState.h */, 16206 26F9A83618A046AC00AEB88A /* ViewportConfiguration.cpp */, 16207 26F9A83718A046AC00AEB88A /* ViewportConfiguration.h */, 16202 16208 1ABA80051897355500DCE9D6 /* VisitedLinkProvider.cpp */, 16203 16209 1ABA7FFF1897341200DCE9D6 /* VisitedLinkProvider.h */, … … 24375 24381 B2FA3D7B0AB75A6F000E5AC4 /* JSSVGFEFuncAElement.h in Headers */, 24376 24382 B2FA3D7D0AB75A6F000E5AC4 /* JSSVGFEFuncBElement.h in Headers */, 24383 26F9A83918A046AC00AEB88A /* ViewportConfiguration.h in Headers */, 24377 24384 B2FA3D7F0AB75A6F000E5AC4 /* JSSVGFEFuncGElement.h in Headers */, 24378 24385 B2FA3D810AB75A6F000E5AC4 /* JSSVGFEFuncRElement.h in Headers */, … … 26929 26936 A024575116CEAA27000E5671 /* EXTDrawBuffers.cpp in Sources */, 26930 26937 6E67D2A61280E8A4008758F7 /* Extensions3DOpenGL.cpp in Sources */, 26938 26F9A83818A046AC00AEB88A /* ViewportConfiguration.cpp in Sources */, 26931 26939 44DAB5B115A623580097C1E4 /* Extensions3DOpenGLCommon.cpp in Sources */, 26932 26940 7728694E14F8882500F484DC /* EXTTextureFilterAnisotropic.cpp in Sources */, -
trunk/Source/WebKit2/ChangeLog
r163514 r163515 1 2014-02-05 Benjamin Poulain <benjamin@webkit.org> 2 3 [iOS] Synchronize the WKContentView and UIScrollView updates with the tiles being commited 4 https://bugs.webkit.org/show_bug.cgi?id=127886 5 6 Reviewed by Simon Fraser. 7 8 * Shared/mac/RemoteLayerTreeTransaction.h: 9 (WebKit::RemoteLayerTreeTransaction::mainFrameContentsSize): 10 (WebKit::RemoteLayerTreeTransaction::setMainFrameContentsSize): 11 (WebKit::RemoteLayerTreeTransaction::pageScaleFactor): 12 (WebKit::RemoteLayerTreeTransaction::setPageScaleFactor): 13 (WebKit::RemoteLayerTreeTransaction::minimumScaleFactor): 14 (WebKit::RemoteLayerTreeTransaction::setMinimumScaleFactor): 15 (WebKit::RemoteLayerTreeTransaction::maximumScaleFactor): 16 (WebKit::RemoteLayerTreeTransaction::setMaximumScaleFactor): 17 (WebKit::RemoteLayerTreeTransaction::allowsUserScaling): 18 (WebKit::RemoteLayerTreeTransaction::setAllowsUserScaling): 19 * Shared/mac/RemoteLayerTreeTransaction.mm: 20 (WebKit::RemoteLayerTreeTransaction::encode): 21 (WebKit::RemoteLayerTreeTransaction::decode): 22 * UIProcess/API/ios/PageClientImplIOS.h: 23 * UIProcess/API/ios/PageClientImplIOS.mm: 24 (WebKit::PageClientImpl::didCommitLayerTree): 25 * UIProcess/API/ios/WKContentView.h: 26 * UIProcess/API/ios/WKContentView.mm: 27 (-[WKContentView setMinimumLayoutSize:]): 28 (-[WKContentView willStartUserTriggeredZoom]): 29 (-[WKContentView _didCommitLayerTree:WebKit::]): 30 * UIProcess/API/ios/WKContentViewInternal.h: 31 * UIProcess/API/ios/WKViewIOS.mm: 32 (-[WKView contentViewDidCommitLoadForMainFrame:]): 33 (-[WKView contentView:didCommitLayerTree:WebKit::]): 34 (-[WKView scrollViewWillBeginZooming:withView:]): 35 (-[WKView _commonInitializationWithContextRef:pageGroupRef:relatedToPage:]): 36 (-[WKView _frameOrBoundsChanged]): 37 (-[WKView minimumLayoutSizeOverride]): 38 (-[WKView setMinimumLayoutSizeOverride:]): 39 * UIProcess/PageClient.h: 40 * UIProcess/WebPageProxy.cpp: 41 * UIProcess/WebPageProxy.h: 42 * UIProcess/WebPageProxy.messages.in: 43 * UIProcess/ios/WebPageProxyIOS.mm: 44 (WebKit::WebPageProxy::setVirtualViewportMinimumLayoutSize): 45 (WebKit::WebPageProxy::didCommitLayerTree): 46 (WebKit::WebPageProxy::willStartUserTriggeredZooming): 47 * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm: 48 (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree): 49 * WebProcess/WebCoreSupport/WebChromeClient.cpp: 50 (WebKit::WebChromeClient::contentsSizeChanged): 51 (WebKit::WebChromeClient::dispatchViewportPropertiesDidChange): 52 * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm: 53 (WebKit::WebChromeClient::didReceiveMobileDocType): 54 * WebProcess/WebPage/WebPage.cpp: 55 (WebKit::WebPage::WebPage): 56 (WebKit::WebPage::mainFrameDidLayout): 57 (WebKit::WebPage::didCommitLoad): 58 * WebProcess/WebPage/WebPage.h: 59 * WebProcess/WebPage/WebPage.messages.in: 60 * WebProcess/WebPage/ios/WebPageIOS.mm: 61 (WebKit::WebPage::viewportPropertiesDidChange): 62 (WebKit::WebPage::minimumPageScaleFactor): 63 (WebKit::WebPage::maximumPageScaleFactor): 64 (WebKit::WebPage::allowsUserScaling): 65 (WebKit::WebPage::setVirtualViewportMinimumLayoutSize): 66 (WebKit::WebPage::virtualViewportChanged): 67 (WebKit::WebPage::willStartUserTriggeredZooming): 68 * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm: 69 (WebKit::RemoteLayerTreeDrawingArea::flushLayers): 70 1 71 2014-02-05 Benjamin Poulain <bpoulain@apple.com> 2 72 -
trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h
r161192 r163515 156 156 Vector<WebCore::GraphicsLayer::PlatformLayerID> destroyedLayers() const { return m_destroyedLayerIDs; } 157 157 158 WebCore::IntSize contentsSize() const { return m_contentsSize; } 159 void setContentsSize(const WebCore::IntSize& size) { m_contentsSize = size; }; 160 161 double pageScaleFactor() const { return m_pageScaleFactor; } 162 void setPageScaleFactor(double pageScaleFactor) { m_pageScaleFactor = pageScaleFactor; } 163 164 double minimumScaleFactor() const { return m_minimumScaleFactor; } 165 void setMinimumScaleFactor(double scale) { m_minimumScaleFactor = scale; } 166 167 double maximumScaleFactor() const { return m_maximumScaleFactor; } 168 void setMaximumScaleFactor(double scale) { m_maximumScaleFactor = scale; } 169 170 bool allowsUserScaling() const { return m_allowsUserScaling; } 171 void setAllowsUserScaling(bool allowsUserScaling) { m_allowsUserScaling = allowsUserScaling; } 172 158 173 private: 159 174 WebCore::GraphicsLayer::PlatformLayerID m_rootLayerID; … … 161 176 Vector<LayerCreationProperties> m_createdLayers; 162 177 Vector<WebCore::GraphicsLayer::PlatformLayerID> m_destroyedLayerIDs; 178 WebCore::IntSize m_contentsSize; 179 double m_pageScaleFactor; 180 double m_minimumScaleFactor; 181 double m_maximumScaleFactor; 182 bool m_allowsUserScaling; 163 183 }; 164 184 -
trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm
r163103 r163515 349 349 encoder << m_changedLayerProperties; 350 350 encoder << m_destroyedLayerIDs; 351 encoder << m_contentsSize; 352 encoder << m_pageScaleFactor; 353 encoder << m_minimumScaleFactor; 354 encoder << m_maximumScaleFactor; 355 encoder << m_allowsUserScaling; 351 356 } 352 357 … … 371 376 return false; 372 377 } 378 379 if (!decoder.decode(result.m_contentsSize)) 380 return false; 381 382 if (!decoder.decode(result.m_pageScaleFactor)) 383 return false; 384 385 if (!decoder.decode(result.m_minimumScaleFactor)) 386 return false; 387 388 if (!decoder.decode(result.m_maximumScaleFactor)) 389 return false; 390 391 if (!decoder.decode(result.m_allowsUserScaling)) 392 return false; 373 393 374 394 return true; -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm
r163514 r163515 36 36 #import "WebBackForwardList.h" 37 37 #import "WebPageProxy.h" 38 #import <WebKit2/RemoteLayerTreeTransaction.h> 38 39 #import <wtf/RetainPtr.h> 39 40 40 41 #if PLATFORM(IOS) 41 42 #import "WKScrollView.h" 42 43 static const float minWebViewScale = 0.25;44 static const float maxWebViewScale = 5;45 static _UIWebViewportConfiguration standardViewportConfiguration = { { UIWebViewportStandardViewportWidth, UIWebViewportGrowsAndShrinksToFitHeight }, UIWebViewportScaleForScalesToFit, minWebViewScale, maxWebViewScale, true46 };47 48 43 #endif 49 44 … … 59 54 RetainPtr<WKScrollView> _scrollView; 60 55 RetainPtr<WKContentView> _contentView; 61 RetainPtr<_UIWebViewportHandler> _viewportHandler; 62 63 BOOL _userHasChangedPageScale; 56 57 BOOL _isWaitingForNewLayerTreeAfterDidCommitLoad; 64 58 BOOL _hasStaticMinimumLayoutSize; 59 CGSize _minimumLayoutSizeOverride; 65 60 #endif 66 61 #if PLATFORM(MAC) && !PLATFORM(IOS) … … 100 95 [_scrollView addSubview:_contentView.get()]; 101 96 102 _viewportHandler = adoptNS([[_UIWebViewportHandler alloc] init]);103 [_viewportHandler setDelegate:self];104 105 97 [self _frameOrBoundsChanged]; 106 98 #endif … … 214 206 #pragma mark WKContentViewDelegate 215 207 216 - (void)contentView:(WKContentView *)contentView contentsSizeDidChange:(CGSize)newSize217 {218 CGFloat zoomScale = [_scrollView zoomScale];219 CGSize contentsSizeInScrollViewCoordinates = CGSizeMake(newSize.width * zoomScale, newSize.height * zoomScale);220 [_scrollView setContentSize:contentsSizeInScrollViewCoordinates];221 222 [_viewportHandler update:^{223 [_viewportHandler setDocumentBounds:{CGPointZero, newSize}];224 }];225 }226 227 208 - (void)contentViewDidCommitLoadForMainFrame:(WKContentView *)contentView 228 209 { 229 _userHasChangedPageScale = NO; 230 231 WKContentType contentType = [_contentView contentType]; 232 [_viewportHandler update:^{ 233 [_viewportHandler clearWebKitViewportConfigurationFlags]; 234 _UIWebViewportConfiguration configuration = standardViewportConfiguration; 235 236 if (contentType == PlainText) { 237 CGFloat screenWidth = [[UIScreen mainScreen] bounds].size.width; 238 configuration.size.width = screenWidth; 239 } else if (contentType == WKContentType::Image) 240 configuration.minimumScale = 0.01; 241 242 [_viewportHandler resetViewportConfiguration:&configuration]; 243 }]; 244 } 245 246 - (void)contentViewDidReceiveMobileDocType:(WKContentView *)contentView 247 { 248 [_viewportHandler update:^{ 249 _UIWebViewportConfiguration configuration = standardViewportConfiguration; 250 configuration.minimumScale = 1; 251 configuration.size = CGSizeMake(320, UIWebViewportGrowsAndShrinksToFitHeight); 252 [_viewportHandler resetViewportConfiguration:&configuration]; 253 }]; 254 } 255 256 - (void)contentView:(WKContentView *)contentView didChangeViewportArgumentsSize:(CGSize)newSize initialScale:(float)initialScale minimumScale:(float)minimumScale maximumScale:(float)maximumScale allowsUserScaling:(float)allowsUserScaling 257 { 258 [_viewportHandler update:^{ 259 [_viewportHandler applyWebKitViewportArgumentsSize:newSize initialScale:initialScale minimumScale:minimumScale maximumScale:maximumScale allowsUserScaling:allowsUserScaling]; 260 }]; 261 } 262 263 #pragma mark - _UIWebViewportHandlerDelegate 264 265 - (void)viewportHandlerDidChangeScales:(_UIWebViewportHandler *)viewportHandler 266 { 267 ASSERT(viewportHandler == _viewportHandler); 268 [_scrollView setMinimumZoomScale:viewportHandler.minimumScale]; 269 [_scrollView setMaximumZoomScale:viewportHandler.maximumScale]; 270 [_scrollView setZoomEnabled:viewportHandler.allowsUserScaling]; 271 272 if (!_userHasChangedPageScale) 273 [self _setDocumentScale:viewportHandler.initialScale]; 274 else { 275 CGFloat currentScale = [_scrollView zoomScale]; 276 CGFloat validScale = std::max(std::min(currentScale, static_cast<CGFloat>(viewportHandler.maximumScale)), static_cast<CGFloat>(viewportHandler.minimumScale)); 277 [self _setDocumentScale:validScale]; 210 _isWaitingForNewLayerTreeAfterDidCommitLoad = YES; 211 } 212 213 - (void)contentView:(WKContentView *)contentView didCommitLayerTree:(const WebKit::RemoteLayerTreeTransaction&)layerTreeTransaction 214 { 215 [_scrollView setMinimumZoomScale:layerTreeTransaction.minimumScaleFactor()]; 216 [_scrollView setMaximumZoomScale:layerTreeTransaction.maximumScaleFactor()]; 217 [_scrollView setZoomEnabled:layerTreeTransaction.allowsUserScaling()]; 218 if (![_scrollView isZooming] && ![_scrollView isZoomBouncing]) 219 [_scrollView setZoomScale:layerTreeTransaction.pageScaleFactor()]; 220 221 if (_isWaitingForNewLayerTreeAfterDidCommitLoad) { 222 UIEdgeInsets inset = [_scrollView contentInset]; 223 [_scrollView setContentOffset:CGPointMake(-inset.left, -inset.top)]; 224 _isWaitingForNewLayerTreeAfterDidCommitLoad = NO; 278 225 } 279 } 280 281 - (void)viewportHandler:(_UIWebViewportHandler *)viewportHandler didChangeViewportSize:(CGSize)newSize 282 { 283 ASSERT(viewportHandler == _viewportHandler); 284 [_contentView setViewportSize:newSize]; 226 285 227 } 286 228 … … 296 238 { 297 239 if (scrollView.pinchGestureRecognizer.state == UIGestureRecognizerStateBegan) 298 _userHasChangedPageScale = YES;240 [_contentView willStartUserTriggeredZoom]; 299 241 [_contentView willStartZoomOrScroll]; 300 242 } … … 344 286 CGRect bounds = self.bounds; 345 287 346 if (!_hasStaticMinimumLayoutSize) { 347 [_viewportHandler update:^{ 348 [_viewportHandler setAvailableViewSize:bounds.size]; 349 }]; 350 } 288 if (!_hasStaticMinimumLayoutSize) 289 [_contentView setMinimumLayoutSize:bounds.size]; 351 290 [_scrollView setFrame:bounds]; 352 291 [_contentView setMinimumSize:bounds.size]; … … 369 308 { 370 309 ASSERT(_hasStaticMinimumLayoutSize); 371 return [_viewportHandler availableViewSize];310 return _minimumLayoutSizeOverride; 372 311 } 373 312 … … 375 314 { 376 315 _hasStaticMinimumLayoutSize = YES; 377 [_viewportHandler update:^{ 378 [_viewportHandler setAvailableViewSize:minimumLayoutSizeOverride]; 379 }]; 316 _minimumLayoutSizeOverride = minimumLayoutSizeOverride; 317 [_contentView setMinimumLayoutSize:minimumLayoutSizeOverride]; 380 318 } 381 319 -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewInternal.h
r163332 r163515 33 33 #import "WKContentViewInternal.h" 34 34 #import <UIKit/UIScrollView_Private.h> 35 #import <UIKit/_UIWebViewportHandler.h>36 35 #endif 37 36 38 37 #if PLATFORM(IOS) 39 #define WK_WEB_VIEW_PROTOCOLS <UIScrollViewDelegate, WKContentViewDelegate , _UIWebViewportHandlerDelegate>38 #define WK_WEB_VIEW_PROTOCOLS <UIScrollViewDelegate, WKContentViewDelegate> 40 39 #endif 41 40 -
trunk/Source/WebKit2/UIProcess/API/ios/PageClientImplIOS.h
r163255 r163515 63 63 virtual bool decidePolicyForGeolocationPermissionRequest(WebFrameProxy&, WebSecurityOrigin&, GeolocationPermissionRequestProxy&) override; 64 64 virtual void didCommitLoadForMainFrame() override; 65 virtual void didChangeContentSize(const WebCore::IntSize&) override;66 65 virtual void setCursor(const WebCore::Cursor&) override; 67 66 virtual void setCursorHiddenUntilMouseMoves(bool) override; … … 102 101 virtual void clearCustomSwipeViews() override; 103 102 104 virtual void mainDocumentDidReceiveMobileDocType() override;105 106 103 virtual void didGetTapHighlightGeometries(uint64_t requestID, const WebCore::Color& color, const Vector<WebCore::FloatQuad>& highlightedQuads, const WebCore::IntSize& topLeftRadius, const WebCore::IntSize& topRightRadius, const WebCore::IntSize& bottomLeftRadius, const WebCore::IntSize& bottomRightRadius) override; 107 104 108 v oid didChangeViewportArguments(const WebCore::ViewportArguments& viewportArguments) override;105 virtual void didCommitLayerTree(const RemoteLayerTreeTransaction&) override; 109 106 110 107 virtual void startAssistingNode(const WebCore::IntRect&, bool hasNextFocusable, bool hasPreviousFocusable) override; -
trunk/Source/WebKit2/UIProcess/API/ios/PageClientImplIOS.mm
r163255 r163515 148 148 } 149 149 150 void PageClientImpl::didChangeContentSize(const IntSize& contentsSize)151 {152 [m_view _didChangeContentSize:contentsSize];153 }154 155 150 void PageClientImpl::setCursor(const Cursor&) 156 151 { … … 345 340 } 346 341 347 void PageClientImpl::mainDocumentDidReceiveMobileDocType()348 {349 [m_view _didReceiveMobileDocTypeForMainFrame];350 }351 352 342 void PageClientImpl::didGetTapHighlightGeometries(uint64_t requestID, const WebCore::Color& color, const Vector<WebCore::FloatQuad>& highlightedQuads, const WebCore::IntSize& topLeftRadius, const WebCore::IntSize& topRightRadius, const WebCore::IntSize& bottomLeftRadius, const WebCore::IntSize& bottomRightRadius) 353 343 { … … 355 345 } 356 346 357 void PageClientImpl::didC hangeViewportArguments(const WebCore::ViewportArguments& viewportArguments)358 { 359 [m_view _didC hangeViewportArguments:viewportArguments];347 void PageClientImpl::didCommitLayerTree(const RemoteLayerTreeTransaction& layerTreeTransaction) 348 { 349 [m_view _didCommitLayerTree:layerTreeTransaction]; 360 350 } 361 351 -
trunk/Source/WebKit2/UIProcess/API/ios/WKContentView.h
r163388 r163515 40 40 }; 41 41 42 namespace WebKit { 43 class RemoteLayerTreeTransaction; 44 } 45 42 46 @protocol WKContentViewDelegate <NSObject> 43 47 @optional 44 - (void)contentView:(WKContentView *)contentView contentsSizeDidChange:(CGSize)newSize;45 48 - (void)contentViewDidCommitLoadForMainFrame:(WKContentView *)contentView; 46 - (void)contentViewDidReceiveMobileDocType:(WKContentView *)contentView; 47 - (void)contentView:(WKContentView *)contentView didChangeViewportArgumentsSize:(CGSize)newSize initialScale:(float)initialScale minimumScale:(float)minimumScale maximumScale:(float)maximumScale allowsUserScaling:(float)allowsUserScaling; 48 49 - (void)contentView:(WKContentView *)contentView didCommitLayerTree:(const WebKit::RemoteLayerTreeTransaction&)layerTreeTransaction; 49 50 @end 50 51 … … 67 68 - (void)setMinimumSize:(CGSize)size; 68 69 - (void)setViewportSize:(CGSize)size; 70 - (void)setMinimumLayoutSize:(CGSize)size; 69 71 70 72 - (void)didFinishScrollTo:(CGPoint)contentOffset; … … 72 74 - (void)didZoomToScale:(CGFloat)scale; 73 75 - (void)willStartZoomOrScroll; 76 - (void)willStartUserTriggeredZoom; 74 77 75 78 @end -
trunk/Source/WebKit2/UIProcess/API/ios/WKContentView.mm
r163388 r163515 210 210 } 211 211 212 - (void)setMinimumLayoutSize:(CGSize)size 213 { 214 _page->setViewportConfigurationMinimumLayoutSize(IntSize(CGCeiling(size.width), CGCeiling(size.height))); 215 } 216 212 217 - (void)didFinishScrollTo:(CGPoint)contentOffset 213 218 { … … 232 237 } 233 238 239 - (void)willStartUserTriggeredZoom 240 { 241 _page->willStartUserTriggeredZooming(); 242 } 243 234 244 - (void)didZoomToScale:(CGFloat)scale 235 245 { … … 305 315 } 306 316 307 - (void)_didChangeContentSize:(CGSize)contentsSize 308 { 317 - (void)_didCommitLayerTree:(const WebKit::RemoteLayerTreeTransaction&)layerTreeTransaction 318 { 319 CGSize contentsSize = layerTreeTransaction.contentsSize(); 320 309 321 [self setBounds:{CGPointZero, contentsSize}]; 310 322 [_interactionView setFrame:CGRectMake(0, 0, contentsSize.width, contentsSize.height)]; 311 323 [_rootContentView setFrame:CGRectMake(0, 0, contentsSize.width, contentsSize.height)]; 312 324 313 if ([_delegate respondsToSelector:@selector(contentView:contentsSizeDidChange:)]) 314 [_delegate contentView:self contentsSizeDidChange:contentsSize]; 315 } 316 317 - (void)_didReceiveMobileDocTypeForMainFrame 318 { 319 if ([_delegate respondsToSelector:@selector(contentViewDidReceiveMobileDocType:)]) 320 [_delegate contentViewDidReceiveMobileDocType:self]; 321 } 322 323 - (void)_didChangeViewportArguments:(const WebCore::ViewportArguments&)arguments 324 { 325 if ([_delegate respondsToSelector:@selector(contentView:didChangeViewportArgumentsSize:initialScale:minimumScale:maximumScale:allowsUserScaling:)]) 326 [_delegate contentView:self didChangeViewportArgumentsSize:CGSizeMake(arguments.width, arguments.height) initialScale:arguments.zoom minimumScale:arguments.minZoom maximumScale:arguments.maxZoom allowsUserScaling:arguments.userZoom]; 325 if ([_delegate respondsToSelector:@selector(contentView:didCommitLayerTree:)]) 326 [_delegate contentView:self didCommitLayerTree:layerTreeTransaction]; 327 327 } 328 328 -
trunk/Source/WebKit2/UIProcess/API/ios/WKContentViewInternal.h
r163116 r163515 39 39 class GeolocationPermissionRequestProxy; 40 40 class LayerTreeContext; 41 class RemoteLayerTreeTransaction; 41 42 class WebFrameProxy; 42 43 class WebPageProxy; … … 58 59 59 60 - (void)_didCommitLoadForMainFrame; 60 - (void)_didChangeContentSize:(CGSize)contentsSize; 61 - (void)_didReceiveMobileDocTypeForMainFrame; 62 - (void)_didChangeViewportArguments:(const WebCore::ViewportArguments&)viewportArguments; 61 - (void)_didCommitLayerTree:(const WebKit::RemoteLayerTreeTransaction&)layerTreeTransaction; 63 62 64 63 - (void)_didGetTapHighlightForRequest:(uint64_t)requestID color:(const WebCore::Color&)color quads:(const Vector<WebCore::FloatQuad>&)highlightedQuads topLeftRadius:(const WebCore::IntSize&)topLeftRadius topRightRadius:(const WebCore::IntSize&)topRightRadius bottomLeftRadius:(const WebCore::IntSize&)bottomLeftRadius bottomRightRadius:(const WebCore::IntSize&)bottomRightRadius; -
trunk/Source/WebKit2/UIProcess/API/ios/WKViewIOS.mm
r163388 r163515 33 33 #import <UIKit/UIScreen.h> 34 34 #import <UIKit/UIScrollView_Private.h> 35 #import < UIKit/_UIWebViewportHandler.h>35 #import <WebKit2/RemoteLayerTreeTransaction.h> 36 36 #import <wtf/RetainPtr.h> 37 37 38 static const float minWebViewScale = 0.25; 39 static const float maxWebViewScale = 5; 40 static struct _UIWebViewportConfiguration standardViewportConfiguration = { { UIWebViewportStandardViewportWidth, UIWebViewportGrowsAndShrinksToFitHeight }, UIWebViewportScaleForScalesToFit, minWebViewScale, maxWebViewScale, true }; 41 42 @interface WKView () <UIScrollViewDelegate, WKContentViewDelegate, _UIWebViewportHandlerDelegate> 38 @interface WKView () <UIScrollViewDelegate, WKContentViewDelegate> 43 39 - (void)_setDocumentScale:(CGFloat)newScale; 44 40 @end … … 48 44 RetainPtr<WKContentView> _contentView; 49 45 50 BOOL _userHasChangedPageScale; 51 RetainPtr<_UIWebViewportHandler> _viewportHandler; 46 BOOL _isWaitingForNewLayerTreeAfterDidCommitLoad; 52 47 BOOL _hasStaticMinimumLayoutSize; 48 CGSize _minimumLayoutSizeOverride; 53 49 } 54 50 … … 104 100 #pragma mark WKContentViewDelegate 105 101 106 - (void)contentView:(WKContentView *)contentView contentsSizeDidChange:(CGSize)newSize107 {108 CGFloat zoomScale = [_scrollView zoomScale];109 CGSize contentsSizeInScrollViewCoordinates = CGSizeMake(newSize.width * zoomScale, newSize.height * zoomScale);110 [_scrollView setContentSize:contentsSizeInScrollViewCoordinates];111 112 [_viewportHandler update:^{113 [_viewportHandler setDocumentBounds:{CGPointZero, newSize}];114 }];115 }116 117 102 - (void)contentViewDidCommitLoadForMainFrame:(WKContentView *)contentView 118 103 { 119 _userHasChangedPageScale = NO; 120 121 WKContentType contentType = [_contentView contentType]; 122 [_viewportHandler update:^{ 123 [_viewportHandler clearWebKitViewportConfigurationFlags]; 124 struct _UIWebViewportConfiguration configuration = standardViewportConfiguration; 125 126 if (contentType == PlainText) { 127 CGFloat screenWidth = [[UIScreen mainScreen] bounds].size.width; 128 configuration.size.width = screenWidth; 129 } else if (contentType == WKContentType::Image) 130 configuration.minimumScale = 0.01; 131 132 [_viewportHandler resetViewportConfiguration:&configuration]; 133 }]; 134 } 135 136 - (void)contentViewDidReceiveMobileDocType:(WKContentView *)contentView 137 { 138 [_viewportHandler update:^{ 139 struct _UIWebViewportConfiguration configuration = standardViewportConfiguration; 140 configuration.minimumScale = 1; 141 configuration.size = CGSizeMake(320.0, UIWebViewportGrowsAndShrinksToFitHeight); 142 [_viewportHandler resetViewportConfiguration:&configuration]; 143 }]; 144 } 145 146 - (void)contentView:(WKContentView *)contentView didChangeViewportArgumentsSize:(CGSize)newSize initialScale:(float)initialScale minimumScale:(float)minimumScale maximumScale:(float)maximumScale allowsUserScaling:(float)allowsUserScaling 147 { 148 [_viewportHandler update:^{ 149 [_viewportHandler applyWebKitViewportArgumentsSize:newSize 150 initialScale:initialScale 151 minimumScale:minimumScale 152 maximumScale:maximumScale 153 allowsUserScaling:allowsUserScaling]; 154 }]; 155 } 156 157 #pragma mark - _UIWebViewportHandlerDelegate 158 159 - (void)viewportHandlerDidChangeScales:(_UIWebViewportHandler *)viewportHandler 160 { 161 ASSERT(viewportHandler == _viewportHandler); 162 [_scrollView setMinimumZoomScale:viewportHandler.minimumScale]; 163 [_scrollView setMaximumZoomScale:viewportHandler.maximumScale]; 164 [_scrollView setZoomEnabled:viewportHandler.allowsUserScaling]; 165 166 if (!_userHasChangedPageScale) 167 [self _setDocumentScale:viewportHandler.initialScale]; 168 else { 169 CGFloat currentScale = [_scrollView zoomScale]; 170 CGFloat validScale = std::max(std::min(currentScale, static_cast<CGFloat>(viewportHandler.maximumScale)), static_cast<CGFloat>(viewportHandler.minimumScale)); 171 [self _setDocumentScale:validScale]; 104 _isWaitingForNewLayerTreeAfterDidCommitLoad = YES; 105 } 106 107 - (void)contentView:(WKContentView *)contentView didCommitLayerTree:(const WebKit::RemoteLayerTreeTransaction&)layerTreeTransaction 108 { 109 [_scrollView setMinimumZoomScale:layerTreeTransaction.minimumScaleFactor()]; 110 [_scrollView setMaximumZoomScale:layerTreeTransaction.maximumScaleFactor()]; 111 [_scrollView setZoomEnabled:layerTreeTransaction.allowsUserScaling()]; 112 if (![_scrollView isZooming] && ![_scrollView isZoomBouncing]) 113 [_scrollView setZoomScale:layerTreeTransaction.pageScaleFactor()]; 114 115 if (_isWaitingForNewLayerTreeAfterDidCommitLoad) { 116 UIEdgeInsets inset = [_scrollView contentInset]; 117 [_scrollView setContentOffset:CGPointMake(-inset.left, -inset.top)]; 118 _isWaitingForNewLayerTreeAfterDidCommitLoad = NO; 172 119 } 173 } 174 175 - (void)viewportHandler:(_UIWebViewportHandler *)viewportHandler didChangeViewportSize:(CGSize)newSize 176 { 177 ASSERT(viewportHandler == _viewportHandler); 178 [_contentView setViewportSize:newSize]; 179 } 180 120 121 } 181 122 182 123 #pragma mark - UIScrollViewDelegate … … 191 132 { 192 133 if (scrollView.pinchGestureRecognizer.state == UIGestureRecognizerStateBegan) 193 _userHasChangedPageScale = YES;134 [_contentView willStartUserTriggeredZoom]; 194 135 [_contentView willStartZoomOrScroll]; 195 136 } … … 256 197 [_scrollView addSubview:_contentView.get()]; 257 198 258 _viewportHandler = adoptNS([[_UIWebViewportHandler alloc] init]);259 [_viewportHandler setDelegate:self];260 261 199 [self _frameOrBoundsChanged]; 262 200 } … … 265 203 { 266 204 CGRect bounds = [self bounds]; 267 if (!_hasStaticMinimumLayoutSize) { 268 [_viewportHandler update:^{ 269 [_viewportHandler setAvailableViewSize:bounds.size]; 270 }]; 271 } 205 if (!_hasStaticMinimumLayoutSize) 206 [_contentView setMinimumLayoutSize:bounds.size]; 272 207 [_scrollView setFrame:bounds]; 273 208 [_contentView setMinimumSize:bounds.size]; … … 311 246 { 312 247 ASSERT(_hasStaticMinimumLayoutSize); 313 return [_viewportHandler availableViewSize];248 return _minimumLayoutSizeOverride; 314 249 } 315 250 … … 317 252 { 318 253 _hasStaticMinimumLayoutSize = YES; 319 [_viewportHandler update:^{ 320 [_viewportHandler setAvailableViewSize:minimumLayoutSizeOverride]; 321 }]; 254 _minimumLayoutSizeOverride = minimumLayoutSizeOverride; 255 [_contentView setMinimumLayoutSize:minimumLayoutSizeOverride]; 322 256 } 323 257 -
trunk/Source/WebKit2/UIProcess/PageClient.h
r163255 r163515 56 56 class FindIndicator; 57 57 class NativeWebKeyboardEvent; 58 class RemoteLayerTreeTransaction; 58 59 class WebContextMenuProxy; 59 60 class WebEditCommandProxy; … … 150 151 #endif // PLATFORM(EFL) || PLATFORM(GTK) 151 152 152 #if PLATFORM(EFL) || PLATFORM(IOS)153 #if PLATFORM(EFL) 153 154 virtual void didChangeContentSize(const WebCore::IntSize&) = 0; 154 155 #endif … … 239 240 240 241 #if PLATFORM(IOS) 241 virtual void mainDocumentDidReceiveMobileDocType() = 0;242 243 242 virtual void didGetTapHighlightGeometries(uint64_t requestID, const WebCore::Color&, const Vector<WebCore::FloatQuad>& highlightedQuads, const WebCore::IntSize& topLeftRadius, const WebCore::IntSize& topRightRadius, const WebCore::IntSize& bottomLeftRadius, const WebCore::IntSize& bottomRightRadius) = 0; 244 243 245 virtual void didC hangeViewportArguments(const WebCore::ViewportArguments&) = 0;244 virtual void didCommitLayerTree(const RemoteLayerTreeTransaction&) = 0; 246 245 247 246 virtual void startAssistingNode(const WebCore::IntRect&, bool hasNextFocusable, bool hasPreviousFocusable) = 0; -
trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp
r163480 r163515 2875 2875 #endif // PLATFORM(EFL) || PLATFORM(GTK) 2876 2876 2877 #if PLATFORM(EFL) || PLATFORM(IOS)2877 #if PLATFORM(EFL) 2878 2878 void WebPageProxy::didChangeContentSize(const IntSize& size) 2879 2879 { -
trunk/Source/WebKit2/UIProcess/WebPageProxy.h
r163480 r163515 140 140 class NativeWebWheelEvent; 141 141 class PageClient; 142 class RemoteLayerTreeTransaction; 142 143 class RemoteScrollingCoordinatorProxy; 143 144 class StringPairVector; … … 439 440 void validateCommand(const String& commandName, PassRefPtr<ValidateCommandCallback>); 440 441 #if PLATFORM(IOS) 442 void setViewportConfigurationMinimumLayoutSize(const WebCore::IntSize&); 443 void didCommitLayerTree(const WebKit::RemoteLayerTreeTransaction&); 441 444 void selectWithGesture(const WebCore::IntPoint, WebCore::TextGranularity, uint32_t gestureType, uint32_t gestureState, PassRefPtr<GestureCallback>); 442 445 void updateSelectionWithTouches(const WebCore::IntPoint, uint32_t touches, bool baseIsStart, PassRefPtr<TouchesCallback>); … … 822 825 823 826 #if PLATFORM(IOS) 827 void willStartUserTriggeredZooming(); 824 828 void didFinishScrolling(const WebCore::FloatPoint& contentOffset); 825 829 void didFinishZooming(float newScale); … … 994 998 void didFindZoomableArea(const WebCore::IntPoint&, const WebCore::IntRect&); 995 999 #endif 996 #if PLATFORM(EFL) || PLATFORM(IOS)1000 #if PLATFORM(EFL) 997 1001 void didChangeContentSize(const WebCore::IntSize&); 998 1002 #endif … … 1136 1140 1137 1141 #if PLATFORM(IOS) 1138 void mainDocumentDidReceiveMobileDocType();1139 1140 1142 void didGetTapHighlightGeometries(uint64_t requestID, const WebCore::Color& color, const Vector<WebCore::FloatQuad>& geometries, const WebCore::IntSize& topLeftRadius, const WebCore::IntSize& topRightRadius, const WebCore::IntSize& bottomLeftRadius, const WebCore::IntSize& bottomRightRadius); 1141 1142 void didChangeViewportArguments(const WebCore::ViewportArguments& viewportArguments);1143 1143 1144 1144 void startAssistingNode(const WebCore::IntRect&, bool hasNextFocusable, bool hasPreviousFocusable); -
trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in
r163255 r163515 91 91 #endif 92 92 93 #if PLATFORM(EFL) || PLATFORM(IOS)93 #if PLATFORM(EFL) 94 94 DidChangeContentSize(WebCore::IntSize newSize) 95 95 #endif … … 307 307 308 308 #if PLATFORM(IOS) 309 MainDocumentDidReceiveMobileDocType();310 311 309 DidGetTapHighlightGeometries(uint64_t requestID, WebCore::Color color, Vector<WebCore::FloatQuad> geometries, WebCore::IntSize topLeftRadius, WebCore::IntSize topRightRadius, WebCore::IntSize bottomLeftRadius, WebCore::IntSize bottomRightRadius) 312 DidChangeViewportArguments(WebCore::ViewportArguments viewportArguments)313 310 314 311 StartAssistingNode(WebCore::IntRect scrollRect, bool hasNextFocusable, bool hasPreviousFocusable) -
trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm
r163255 r163515 230 230 } 231 231 232 void WebPageProxy::setViewportConfigurationMinimumLayoutSize(const WebCore::IntSize& size) 233 { 234 m_process->send(Messages::WebPage::SetViewportConfigurationMinimumLayoutSize(size), m_pageID); 235 } 236 237 void WebPageProxy::didCommitLayerTree(const WebKit::RemoteLayerTreeTransaction& layerTreeTransaction) 238 { 239 m_pageClient.didCommitLayerTree(layerTreeTransaction); 240 } 241 232 242 void WebPageProxy::selectWithGesture(const WebCore::IntPoint point, WebCore::TextGranularity granularity, uint32_t gestureType, uint32_t gestureState, PassRefPtr<GestureCallback> callback) 233 243 { … … 418 428 } 419 429 430 void WebPageProxy::willStartUserTriggeredZooming() 431 { 432 process().send(Messages::WebPage::WillStartUserTriggeredZooming(), m_pageID); 433 } 434 420 435 void WebPageProxy::didFinishScrolling(const WebCore::FloatPoint& contentOffset) 421 436 { … … 442 457 } 443 458 444 void WebPageProxy::mainDocumentDidReceiveMobileDocType()445 {446 m_pageClient.mainDocumentDidReceiveMobileDocType();447 }448 449 459 void WebPageProxy::didGetTapHighlightGeometries(uint64_t requestID, const WebCore::Color& color, const Vector<WebCore::FloatQuad>& highlightedQuads, const WebCore::IntSize& topLeftRadius, const WebCore::IntSize& topRightRadius, const WebCore::IntSize& bottomLeftRadius, const WebCore::IntSize& bottomRightRadius) 450 460 { … … 452 462 } 453 463 454 void WebPageProxy::didChangeViewportArguments(const WebCore::ViewportArguments& viewportArguments)455 {456 m_pageClient.didChangeViewportArguments(viewportArguments);457 }458 459 464 void WebPageProxy::startAssistingNode(const WebCore::IntRect& scrollRect, bool hasNextFocusable, bool hasPreviousFocusable) 460 465 { -
trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm
r161533 r163515 90 90 m_webPageProxy->scrollingCoordinatorProxy()->updateScrollingTree(scrollingTreeTransaction); 91 91 #endif 92 #if PLATFORM(IOS) 93 m_webPageProxy->didCommitLayerTree(layerTreeTransaction); 94 #endif 92 95 } 93 96 -
trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp
r163079 r163515 502 502 m_page->send(Messages::WebPageProxy::DidChangeContentSize(size)); 503 503 #endif 504 #if PLATFORM(IOS) 505 m_page->send(Messages::WebPageProxy::DidChangeContentSize(size)); 506 #endif 504 507 505 508 506 m_page->drawingArea()->mainFrameContentSizeChanged(size); … … 850 848 void WebChromeClient::dispatchViewportPropertiesDidChange(const ViewportArguments& viewportArguments) const 851 849 { 850 UNUSED_PARAM(viewportArguments); 852 851 #if PLATFORM(IOS) 853 m_page->send(Messages::WebPageProxy::DidChangeViewportArguments(viewportArguments)); 854 #else 855 UNUSED_PARAM(viewportArguments); 852 m_page->viewportPropertiesDidChange(viewportArguments); 856 853 #endif 857 854 #if USE(TILED_BACKING_STORE) -
trunk/Source/WebKit2/WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm
r161106 r163515 54 54 void WebChromeClient::didReceiveMobileDocType() 55 55 { 56 m_page->send(Messages::WebPageProxy::MainDocumentDidReceiveMobileDocType());56 // FIXME: update the ViewportConfiguration accordingly. 57 57 } 58 58 -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
r163476 r163515 282 282 #if PLATFORM(IOS) 283 283 , m_shouldReturnWordAtSelection(false) 284 , m_userHasChangedPageScaleFactor(false) 284 285 #endif 285 286 , m_inspectorClient(0) … … 3076 3077 m_viewGestureGeometryCollector.mainFrameDidLayout(); 3077 3078 #endif 3079 #if PLATFORM(IOS) 3080 if (FrameView* frameView = mainFrameView()) { 3081 m_viewportConfiguration.setContentsSize(frameView->contentsSize()); 3082 viewportConfigurationChanged(); 3083 } 3084 #endif 3078 3085 } 3079 3086 … … 3978 3985 scalePage(1, IntPoint()); 3979 3986 } 3987 #if PLATFORM(IOS) 3988 m_userHasChangedPageScaleFactor = false; 3989 3990 // FIXME: Setup a real configuration. 3991 ViewportConfiguration::Parameters defaultConfiguration; 3992 defaultConfiguration.width = 980; 3993 defaultConfiguration.widthIsSet = true; 3994 defaultConfiguration.allowsUserScaling = true; 3995 defaultConfiguration.minimumScale = 0.25; 3996 defaultConfiguration.maximumScale = 5; 3997 3998 m_viewportConfiguration.setDefaultConfiguration(defaultConfiguration); 3999 m_viewportConfiguration.setViewportArguments(ViewportArguments()); 4000 m_viewportConfiguration.setContentsSize(m_viewportConfiguration.minimumLayoutSize()); 4001 viewportConfigurationChanged(); 4002 #endif 3980 4003 3981 4004 #if ENABLE(PRIMARY_SNAPSHOTTED_PLUGIN_HEURISTIC) -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h
r163476 r163515 59 59 #include <WebCore/UserActivity.h> 60 60 #include <WebCore/ViewState.h> 61 #include <WebCore/ViewportConfiguration.h> 61 62 #include <WebCore/WebCoreKeyboardUIMode.h> 62 63 #include <wtf/HashMap.h> … … 412 413 413 414 #if PLATFORM(IOS) 415 void viewportPropertiesDidChange(const WebCore::ViewportArguments&); 416 417 double minimumPageScaleFactor() const; 418 double maximumPageScaleFactor() const; 419 bool allowsUserScaling() const; 420 414 421 void handleTap(const WebCore::IntPoint&); 415 422 void tapHighlightAtPosition(uint64_t requestID, const WebCore::FloatPoint&); … … 630 637 631 638 #if PLATFORM(IOS) 639 void setViewportConfigurationMinimumLayoutSize(const WebCore::IntSize&); 640 void viewportConfigurationChanged(); 641 void willStartUserTriggeredZooming(); 632 642 void didFinishScrolling(const WebCore::FloatPoint& contentOffset); 633 643 void didFinishZooming(float); … … 1050 1060 RefPtr<WebCore::Node> m_interactionNode; 1051 1061 bool m_shouldReturnWordAtSelection; 1062 1063 WebCore::ViewportConfiguration m_viewportConfiguration; 1064 bool m_userHasChangedPageScaleFactor; 1052 1065 #endif 1053 1066 -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in
r163255 r163515 42 42 WheelEventSyncForTesting(WebKit::WebWheelEvent event) -> (bool handled) 43 43 #if PLATFORM(IOS) 44 SetViewportConfigurationMinimumLayoutSize(WebCore::IntSize size) 45 44 46 HandleTap(WebCore::IntPoint point) 45 47 TapHighlightAtPosition(uint64_t requestID, WebCore::FloatPoint point) … … 314 316 315 317 #if PLATFORM(IOS) 318 WillStartUserTriggeredZooming(); 316 319 DidFinishScrolling(WebCore::FloatPoint contentOffset); 317 320 DidFinishZooming(float scale); -
trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm
r163499 r163515 80 80 } 81 81 82 void WebPage::viewportPropertiesDidChange(const ViewportArguments& viewportArguments) 83 { 84 m_viewportConfiguration.setViewportArguments(viewportArguments); 85 viewportConfigurationChanged(); 86 } 87 88 double WebPage::minimumPageScaleFactor() const 89 { 90 return m_viewportConfiguration.minimumScale(); 91 } 92 93 double WebPage::maximumPageScaleFactor() const 94 { 95 return m_viewportConfiguration.maximumScale(); 96 } 97 98 bool WebPage::allowsUserScaling() const 99 { 100 return m_viewportConfiguration.allowsUserScaling(); 101 } 102 82 103 bool WebPage::handleEditingKeyboardEvent(KeyboardEvent* event, bool) 83 104 { … … 961 982 } 962 983 984 void WebPage::setViewportConfigurationMinimumLayoutSize(const IntSize& size) 985 { 986 m_viewportConfiguration.setMinimumLayoutSize(size); 987 viewportConfigurationChanged(); 988 } 989 990 void WebPage::viewportConfigurationChanged() 991 { 992 setFixedLayoutSize(m_viewportConfiguration.layoutSize()); 993 994 double scale; 995 if (m_userHasChangedPageScaleFactor) 996 scale = std::max(std::min(pageScaleFactor(), m_viewportConfiguration.maximumScale()), m_viewportConfiguration.minimumScale()); 997 else 998 scale = m_viewportConfiguration.initialScale(); 999 1000 m_page->setPageScaleFactor(scale, m_page->mainFrame().view()->scrollPosition()); 1001 } 1002 1003 void WebPage::willStartUserTriggeredZooming() 1004 { 1005 m_userHasChangedPageScaleFactor = true; 1006 } 1007 963 1008 void WebPage::didFinishScrolling(const WebCore::FloatPoint& contentOffset) 964 1009 { -
trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm
r162730 r163515 322 322 RemoteLayerTreeTransaction layerTransaction; 323 323 m_remoteLayerTreeContext->buildTransaction(layerTransaction, *m_rootLayer); 324 layerTransaction.setContentsSize(m_webPage->corePage()->mainFrame().view()->contentsSize()); 325 layerTransaction.setPageScaleFactor(m_webPage->corePage()->pageScaleFactor()); 326 #if PLATFORM(IOS) 327 layerTransaction.setMinimumScaleFactor(m_webPage->minimumPageScaleFactor()); 328 layerTransaction.setMaximumScaleFactor(m_webPage->maximumPageScaleFactor()); 329 layerTransaction.setAllowsUserScaling(m_webPage->allowsUserScaling()); 330 #endif 324 331 325 332 RemoteScrollingCoordinatorTransaction scrollingTransaction;
Note: See TracChangeset
for help on using the changeset viewer.