Changeset 163515 in webkit


Ignore:
Timestamp:
Feb 5, 2014 10:45:41 PM (10 years ago)
Author:
benjamin@webkit.org
Message:

[iOS] Synchronize the WKContentView and UIScrollView updates with the tiles being commited
https://bugs.webkit.org/show_bug.cgi?id=127886

Reviewed by Simon Fraser.

Source/WebCore:

The updates of the views on the UIProcess side was completely disconnected
from the tiles updates from the DrawingArea. There is a non-negligible time
between the size/scale update and the new tiles coming, which causes
visual glitches.

There are three main cases where the tiles and content would be out of sync
with the UIViews:
-When loading a new page with different content width of a different viewport.
-When a page changes its viewport.
-When the viewport-constrainted viewport size changes.

To fix the issue, WKView is modified to maintain the old state of WKContentView
and UIScrollView until the new tiles are available.

Geometry/scale update are split in two phases:
1) A source (the page or the user) changes parameters of the geometry. The WebProcess updates

its layout accordingly.
At this point, the UIViews are unchanged and are left with the old parameters.

2) Eventually, new tiles come and commitLayerTree() is called on the drawing area proxy.

At that point, WKContentView and its UIScrollView are updated to match the committed
size and scale for the page.

  • WebCore.exp.in:
  • WebCore.xcodeproj/project.pbxproj:
  • page/ViewportConfiguration.cpp: Added.

(WebCore::constraintsAreAllRelative):
(WebCore::ViewportConfiguration::ViewportConfiguration):
(WebCore::ViewportConfiguration::setDefaultConfiguration):
(WebCore::ViewportConfiguration::setContentsSize):
(WebCore::ViewportConfiguration::setMinimumLayoutSize):
(WebCore::ViewportConfiguration::setViewportArguments):
(WebCore::ViewportConfiguration::layoutSize):
(WebCore::ViewportConfiguration::initialScale):
(WebCore::ViewportConfiguration::minimumScale):
(WebCore::ViewportConfiguration::maximumScale):
(WebCore::ViewportConfiguration::allowsUserScaling):
(WebCore::viewportArgumentValueIsValid):
(WebCore::applyViewportArgument):
(WebCore::ViewportConfiguration::updateConfiguration):
(WebCore::ViewportConfiguration::layoutWidth):
(WebCore::ViewportConfiguration::layoutHeight):

  • page/ViewportConfiguration.h: Added.

(WebCore::ViewportConfigurationConfiguration::ViewportConfigurationConfiguration):
(WebCore::ViewportConfiguration::defaultConfiguration):
(WebCore::ViewportConfiguration::contentsSize):
(WebCore::ViewportConfiguration::minimumLayoutSize):
(WebCore::ViewportConfiguration::viewportArguments):

Source/WebKit2:

  • Shared/mac/RemoteLayerTreeTransaction.h:

(WebKit::RemoteLayerTreeTransaction::mainFrameContentsSize):
(WebKit::RemoteLayerTreeTransaction::setMainFrameContentsSize):
(WebKit::RemoteLayerTreeTransaction::pageScaleFactor):
(WebKit::RemoteLayerTreeTransaction::setPageScaleFactor):
(WebKit::RemoteLayerTreeTransaction::minimumScaleFactor):
(WebKit::RemoteLayerTreeTransaction::setMinimumScaleFactor):
(WebKit::RemoteLayerTreeTransaction::maximumScaleFactor):
(WebKit::RemoteLayerTreeTransaction::setMaximumScaleFactor):
(WebKit::RemoteLayerTreeTransaction::allowsUserScaling):
(WebKit::RemoteLayerTreeTransaction::setAllowsUserScaling):

  • Shared/mac/RemoteLayerTreeTransaction.mm:

(WebKit::RemoteLayerTreeTransaction::encode):
(WebKit::RemoteLayerTreeTransaction::decode):

  • UIProcess/API/ios/PageClientImplIOS.h:
  • UIProcess/API/ios/PageClientImplIOS.mm:

(WebKit::PageClientImpl::didCommitLayerTree):

  • UIProcess/API/ios/WKContentView.h:
  • UIProcess/API/ios/WKContentView.mm:

(-[WKContentView setMinimumLayoutSize:]):
(-[WKContentView willStartUserTriggeredZoom]):
(-[WKContentView _didCommitLayerTree:WebKit::]):

  • UIProcess/API/ios/WKContentViewInternal.h:
  • UIProcess/API/ios/WKViewIOS.mm:

(-[WKView contentViewDidCommitLoadForMainFrame:]):
(-[WKView contentView:didCommitLayerTree:WebKit::]):
(-[WKView scrollViewWillBeginZooming:withView:]):
(-[WKView _commonInitializationWithContextRef:pageGroupRef:relatedToPage:]):
(-[WKView _frameOrBoundsChanged]):
(-[WKView minimumLayoutSizeOverride]):
(-[WKView setMinimumLayoutSizeOverride:]):

  • UIProcess/PageClient.h:
  • UIProcess/WebPageProxy.cpp:
  • UIProcess/WebPageProxy.h:
  • UIProcess/WebPageProxy.messages.in:
  • UIProcess/ios/WebPageProxyIOS.mm:

(WebKit::WebPageProxy::setVirtualViewportMinimumLayoutSize):
(WebKit::WebPageProxy::didCommitLayerTree):
(WebKit::WebPageProxy::willStartUserTriggeredZooming):

  • UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm:

(WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):

  • WebProcess/WebCoreSupport/WebChromeClient.cpp:

(WebKit::WebChromeClient::contentsSizeChanged):
(WebKit::WebChromeClient::dispatchViewportPropertiesDidChange):

  • WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm:

(WebKit::WebChromeClient::didReceiveMobileDocType):

  • WebProcess/WebPage/WebPage.cpp:

(WebKit::WebPage::WebPage):
(WebKit::WebPage::mainFrameDidLayout):
(WebKit::WebPage::didCommitLoad):

  • WebProcess/WebPage/WebPage.h:
  • WebProcess/WebPage/WebPage.messages.in:
  • WebProcess/WebPage/ios/WebPageIOS.mm:

(WebKit::WebPage::viewportPropertiesDidChange):
(WebKit::WebPage::minimumPageScaleFactor):
(WebKit::WebPage::maximumPageScaleFactor):
(WebKit::WebPage::allowsUserScaling):
(WebKit::WebPage::setVirtualViewportMinimumLayoutSize):
(WebKit::WebPage::virtualViewportChanged):
(WebKit::WebPage::willStartUserTriggeredZooming):

  • WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm:

(WebKit::RemoteLayerTreeDrawingArea::flushLayers):

Location:
trunk/Source
Files:
2 added
27 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r163512 r163515  
     12014-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
    1562014-02-05  Benjamin Poulain  <benjamin@webkit.org>
    257
  • trunk/Source/WebCore/WebCore.exp.in

    r163482 r163515  
    569569__ZN7WebCore15GraphicsLayerCA40platformCALayerSetNeedsToRevalidateTilesEv
    570570__ZNK7WebCore15GraphicsLayerCA49platformCALayerContentsScaleMultiplierForNewTilesEPNS_15PlatformCALayerE
     571__ZNK7WebCore21ViewportConfiguration10layoutSizeEv
     572__ZNK7WebCore21ViewportConfiguration12initialScaleEv
    571573__ZN7WebCore15GraphicsLayerCA7setNameERKN3WTF6StringE
    572574__ZN7WebCore15GraphicsLayerCA7setSizeERKNS_9FloatSizeE
     
    576578__ZN7WebCore15GraphicsLayerCA19setCustomAppearanceENS_13GraphicsLayer16CustomAppearanceE
    577579__ZNK7WebCore15GraphicsLayerCA14primaryLayerIDEv
     580__ZNK7WebCore21ViewportConfiguration12minimumScaleEv
    578581__ZN7WebCore15HitTestLocation12rectForPointERKNS_11LayoutPointEjjjj
    579582__ZN7WebCore15HitTestLocationC1ERKNS_10FloatPointE
     
    846849__ZN7WebCore21URLByRemovingUserInfoEP5NSURL
    847850__ZN7WebCore21UserContentURLPattern5parseERKN3WTF6StringE
     851__ZN7WebCore21ViewportConfiguration15setContentsSizeERKNS_7IntSizeE
     852__ZN7WebCore21ViewportConfiguration20setMinimumLayoutSizeERKNS_7IntSizeE
     853__ZN7WebCore21ViewportConfiguration20setViewportArgumentsERKNS_17ViewportArgumentsE
     854__ZN7WebCore21ViewportConfiguration23setDefaultConfigurationERKNS0_10ParametersE
    848855__ZN7WebCore21WindowsLatin1EncodingEv
    849856__ZN7WebCore21createCFURLFromBufferEPKcmPK7__CFURL
     
    910917__ZN7WebCore24ImmutableStylePropertiesD1Ev
    911918__ZN7WebCore24ReferenceFilterOperationC1ERKN3WTF6StringES4_NS_15FilterOperation13OperationTypeE
     919__ZN7WebCore21ViewportConfigurationC1Ev
    912920__ZN7WebCore24createFragmentFromMarkupERNS_8DocumentERKN3WTF6StringES5_NS_19ParserContentPolicyE
    913921__ZN7WebCore24decodeURLEscapeSequencesERKN3WTF6StringE
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r163359 r163515  
    984984                26E98A10130A9FCA008EB7B2 /* TextCodecASCIIFastPath.h in Headers */ = {isa = PBXBuildFile; fileRef = 26E98A0F130A9FCA008EB7B2 /* TextCodecASCIIFastPath.h */; };
    985985                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, ); }; };
    986988                26FAE4CC1852E3A5004C8C46 /* ResourceHandleCFURLConnectionDelegate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26FAE4C81852E3A5004C8C46 /* ResourceHandleCFURLConnectionDelegate.cpp */; };
    987989                26FAE4CD1852E3A5004C8C46 /* ResourceHandleCFURLConnectionDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 26FAE4C91852E3A5004C8C46 /* ResourceHandleCFURLConnectionDelegate.h */; };
     
    77707772                26E98A0F130A9FCA008EB7B2 /* TextCodecASCIIFastPath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextCodecASCIIFastPath.h; sourceTree = "<group>"; };
    77717773                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>"; };
    77727776                26FAE4C81852E3A5004C8C46 /* ResourceHandleCFURLConnectionDelegate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ResourceHandleCFURLConnectionDelegate.cpp; sourceTree = "<group>"; };
    77737777                26FAE4C91852E3A5004C8C46 /* ResourceHandleCFURLConnectionDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResourceHandleCFURLConnectionDelegate.h; sourceTree = "<group>"; };
     
    1620016204                                F513A3E915FF4841001526DB /* ValidationMessageClient.h */,
    1620116205                                8678D0BA1878E810003ABDE6 /* ViewState.h */,
     16206                                26F9A83618A046AC00AEB88A /* ViewportConfiguration.cpp */,
     16207                                26F9A83718A046AC00AEB88A /* ViewportConfiguration.h */,
    1620216208                                1ABA80051897355500DCE9D6 /* VisitedLinkProvider.cpp */,
    1620316209                                1ABA7FFF1897341200DCE9D6 /* VisitedLinkProvider.h */,
     
    2437524381                                B2FA3D7B0AB75A6F000E5AC4 /* JSSVGFEFuncAElement.h in Headers */,
    2437624382                                B2FA3D7D0AB75A6F000E5AC4 /* JSSVGFEFuncBElement.h in Headers */,
     24383                                26F9A83918A046AC00AEB88A /* ViewportConfiguration.h in Headers */,
    2437724384                                B2FA3D7F0AB75A6F000E5AC4 /* JSSVGFEFuncGElement.h in Headers */,
    2437824385                                B2FA3D810AB75A6F000E5AC4 /* JSSVGFEFuncRElement.h in Headers */,
     
    2692926936                                A024575116CEAA27000E5671 /* EXTDrawBuffers.cpp in Sources */,
    2693026937                                6E67D2A61280E8A4008758F7 /* Extensions3DOpenGL.cpp in Sources */,
     26938                                26F9A83818A046AC00AEB88A /* ViewportConfiguration.cpp in Sources */,
    2693126939                                44DAB5B115A623580097C1E4 /* Extensions3DOpenGLCommon.cpp in Sources */,
    2693226940                                7728694E14F8882500F484DC /* EXTTextureFilterAnisotropic.cpp in Sources */,
  • trunk/Source/WebKit2/ChangeLog

    r163514 r163515  
     12014-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
    1712014-02-05  Benjamin Poulain  <bpoulain@apple.com>
    272
  • trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h

    r161192 r163515  
    156156    Vector<WebCore::GraphicsLayer::PlatformLayerID> destroyedLayers() const { return m_destroyedLayerIDs; }
    157157
     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
    158173private:
    159174    WebCore::GraphicsLayer::PlatformLayerID m_rootLayerID;
     
    161176    Vector<LayerCreationProperties> m_createdLayers;
    162177    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;
    163183};
    164184
  • trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm

    r163103 r163515  
    349349    encoder << m_changedLayerProperties;
    350350    encoder << m_destroyedLayerIDs;
     351    encoder << m_contentsSize;
     352    encoder << m_pageScaleFactor;
     353    encoder << m_minimumScaleFactor;
     354    encoder << m_maximumScaleFactor;
     355    encoder << m_allowsUserScaling;
    351356}
    352357
     
    371376            return false;
    372377    }
     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;
    373393
    374394    return true;
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm

    r163514 r163515  
    3636#import "WebBackForwardList.h"
    3737#import "WebPageProxy.h"
     38#import <WebKit2/RemoteLayerTreeTransaction.h>
    3839#import <wtf/RetainPtr.h>
    3940
    4041#if PLATFORM(IOS)
    4142#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, true
    46 };
    47 
    4843#endif
    4944
     
    5954    RetainPtr<WKScrollView> _scrollView;
    6055    RetainPtr<WKContentView> _contentView;
    61     RetainPtr<_UIWebViewportHandler> _viewportHandler;
    62 
    63     BOOL _userHasChangedPageScale;
     56
     57    BOOL _isWaitingForNewLayerTreeAfterDidCommitLoad;
    6458    BOOL _hasStaticMinimumLayoutSize;
     59    CGSize _minimumLayoutSizeOverride;
    6560#endif
    6661#if PLATFORM(MAC) && !PLATFORM(IOS)
     
    10095    [_scrollView addSubview:_contentView.get()];
    10196
    102     _viewportHandler = adoptNS([[_UIWebViewportHandler alloc] init]);
    103     [_viewportHandler setDelegate:self];
    104 
    10597    [self _frameOrBoundsChanged];
    10698#endif
     
    214206#pragma mark WKContentViewDelegate
    215207
    216 - (void)contentView:(WKContentView *)contentView contentsSizeDidChange:(CGSize)newSize
    217 {
    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 
    227208- (void)contentViewDidCommitLoadForMainFrame:(WKContentView *)contentView
    228209{
    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;
    278225    }
    279 }
    280 
    281 - (void)viewportHandler:(_UIWebViewportHandler *)viewportHandler didChangeViewportSize:(CGSize)newSize
    282 {
    283     ASSERT(viewportHandler == _viewportHandler);
    284     [_contentView setViewportSize:newSize];
     226   
    285227}
    286228
     
    296238{
    297239    if (scrollView.pinchGestureRecognizer.state == UIGestureRecognizerStateBegan)
    298         _userHasChangedPageScale = YES;
     240        [_contentView willStartUserTriggeredZoom];
    299241    [_contentView willStartZoomOrScroll];
    300242}
     
    344286    CGRect bounds = self.bounds;
    345287
    346     if (!_hasStaticMinimumLayoutSize) {
    347         [_viewportHandler update:^{
    348             [_viewportHandler setAvailableViewSize:bounds.size];
    349         }];
    350     }
     288    if (!_hasStaticMinimumLayoutSize)
     289        [_contentView setMinimumLayoutSize:bounds.size];
    351290    [_scrollView setFrame:bounds];
    352291    [_contentView setMinimumSize:bounds.size];
     
    369308{
    370309    ASSERT(_hasStaticMinimumLayoutSize);
    371     return [_viewportHandler availableViewSize];
     310    return _minimumLayoutSizeOverride;
    372311}
    373312
     
    375314{
    376315    _hasStaticMinimumLayoutSize = YES;
    377     [_viewportHandler update:^{
    378         [_viewportHandler setAvailableViewSize:minimumLayoutSizeOverride];
    379     }];
     316    _minimumLayoutSizeOverride = minimumLayoutSizeOverride;
     317    [_contentView setMinimumLayoutSize:minimumLayoutSizeOverride];
    380318}
    381319
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewInternal.h

    r163332 r163515  
    3333#import "WKContentViewInternal.h"
    3434#import <UIKit/UIScrollView_Private.h>
    35 #import <UIKit/_UIWebViewportHandler.h>
    3635#endif
    3736
    3837#if PLATFORM(IOS)
    39 #define WK_WEB_VIEW_PROTOCOLS <UIScrollViewDelegate, WKContentViewDelegate, _UIWebViewportHandlerDelegate>
     38#define WK_WEB_VIEW_PROTOCOLS <UIScrollViewDelegate, WKContentViewDelegate>
    4039#endif
    4140
  • trunk/Source/WebKit2/UIProcess/API/ios/PageClientImplIOS.h

    r163255 r163515  
    6363    virtual bool decidePolicyForGeolocationPermissionRequest(WebFrameProxy&, WebSecurityOrigin&, GeolocationPermissionRequestProxy&) override;
    6464    virtual void didCommitLoadForMainFrame() override;
    65     virtual void didChangeContentSize(const WebCore::IntSize&) override;
    6665    virtual void setCursor(const WebCore::Cursor&) override;
    6766    virtual void setCursorHiddenUntilMouseMoves(bool) override;
     
    102101    virtual void clearCustomSwipeViews() override;
    103102
    104     virtual void mainDocumentDidReceiveMobileDocType() override;
    105 
    106103    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;
    107104
    108     void didChangeViewportArguments(const WebCore::ViewportArguments& viewportArguments) override;
     105    virtual void didCommitLayerTree(const RemoteLayerTreeTransaction&) override;
    109106
    110107    virtual void startAssistingNode(const WebCore::IntRect&, bool hasNextFocusable, bool hasPreviousFocusable) override;
  • trunk/Source/WebKit2/UIProcess/API/ios/PageClientImplIOS.mm

    r163255 r163515  
    148148}
    149149
    150 void PageClientImpl::didChangeContentSize(const IntSize& contentsSize)
    151 {
    152     [m_view _didChangeContentSize:contentsSize];
    153 }
    154 
    155150void PageClientImpl::setCursor(const Cursor&)
    156151{
     
    345340}
    346341
    347 void PageClientImpl::mainDocumentDidReceiveMobileDocType()
    348 {
    349     [m_view _didReceiveMobileDocTypeForMainFrame];
    350 }
    351 
    352342void 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)
    353343{
     
    355345}
    356346
    357 void PageClientImpl::didChangeViewportArguments(const WebCore::ViewportArguments& viewportArguments)
    358 {
    359     [m_view _didChangeViewportArguments:viewportArguments];
     347void PageClientImpl::didCommitLayerTree(const RemoteLayerTreeTransaction& layerTreeTransaction)
     348{
     349    [m_view _didCommitLayerTree:layerTreeTransaction];
    360350}
    361351
  • trunk/Source/WebKit2/UIProcess/API/ios/WKContentView.h

    r163388 r163515  
    4040};
    4141
     42namespace WebKit {
     43class RemoteLayerTreeTransaction;
     44}
     45
    4246@protocol WKContentViewDelegate <NSObject>
    4347@optional
    44 - (void)contentView:(WKContentView *)contentView contentsSizeDidChange:(CGSize)newSize;
    4548- (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;
    4950@end
    5051
     
    6768- (void)setMinimumSize:(CGSize)size;
    6869- (void)setViewportSize:(CGSize)size;
     70- (void)setMinimumLayoutSize:(CGSize)size;
    6971
    7072- (void)didFinishScrollTo:(CGPoint)contentOffset;
     
    7274- (void)didZoomToScale:(CGFloat)scale;
    7375- (void)willStartZoomOrScroll;
     76- (void)willStartUserTriggeredZoom;
    7477
    7578@end
  • trunk/Source/WebKit2/UIProcess/API/ios/WKContentView.mm

    r163388 r163515  
    210210}
    211211
     212- (void)setMinimumLayoutSize:(CGSize)size
     213{
     214    _page->setViewportConfigurationMinimumLayoutSize(IntSize(CGCeiling(size.width), CGCeiling(size.height)));
     215}
     216
    212217- (void)didFinishScrollTo:(CGPoint)contentOffset
    213218{
     
    232237}
    233238
     239- (void)willStartUserTriggeredZoom
     240{
     241    _page->willStartUserTriggeredZooming();
     242}
     243
    234244- (void)didZoomToScale:(CGFloat)scale
    235245{
     
    305315}
    306316
    307 - (void)_didChangeContentSize:(CGSize)contentsSize
    308 {
     317- (void)_didCommitLayerTree:(const WebKit::RemoteLayerTreeTransaction&)layerTreeTransaction
     318{
     319    CGSize contentsSize = layerTreeTransaction.contentsSize();
     320
    309321    [self setBounds:{CGPointZero, contentsSize}];
    310322    [_interactionView setFrame:CGRectMake(0, 0, contentsSize.width, contentsSize.height)];
    311323    [_rootContentView setFrame:CGRectMake(0, 0, contentsSize.width, contentsSize.height)];
    312324
    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];
    327327}
    328328
  • trunk/Source/WebKit2/UIProcess/API/ios/WKContentViewInternal.h

    r163116 r163515  
    3939class GeolocationPermissionRequestProxy;
    4040class LayerTreeContext;
     41class RemoteLayerTreeTransaction;
    4142class WebFrameProxy;
    4243class WebPageProxy;
     
    5859
    5960- (void)_didCommitLoadForMainFrame;
    60 - (void)_didChangeContentSize:(CGSize)contentsSize;
    61 - (void)_didReceiveMobileDocTypeForMainFrame;
    62 - (void)_didChangeViewportArguments:(const WebCore::ViewportArguments&)viewportArguments;
     61- (void)_didCommitLayerTree:(const WebKit::RemoteLayerTreeTransaction&)layerTreeTransaction;
    6362
    6463- (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  
    3333#import <UIKit/UIScreen.h>
    3434#import <UIKit/UIScrollView_Private.h>
    35 #import <UIKit/_UIWebViewportHandler.h>
     35#import <WebKit2/RemoteLayerTreeTransaction.h>
    3636#import <wtf/RetainPtr.h>
    3737
    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>
    4339- (void)_setDocumentScale:(CGFloat)newScale;
    4440@end
     
    4844    RetainPtr<WKContentView> _contentView;
    4945
    50     BOOL _userHasChangedPageScale;
    51     RetainPtr<_UIWebViewportHandler> _viewportHandler;
     46    BOOL _isWaitingForNewLayerTreeAfterDidCommitLoad;
    5247    BOOL _hasStaticMinimumLayoutSize;
     48    CGSize _minimumLayoutSizeOverride;
    5349}
    5450
     
    104100#pragma mark WKContentViewDelegate
    105101
    106 - (void)contentView:(WKContentView *)contentView contentsSizeDidChange:(CGSize)newSize
    107 {
    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 
    117102- (void)contentViewDidCommitLoadForMainFrame:(WKContentView *)contentView
    118103{
    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;
    172119    }
    173 }
    174 
    175 - (void)viewportHandler:(_UIWebViewportHandler *)viewportHandler didChangeViewportSize:(CGSize)newSize
    176 {
    177     ASSERT(viewportHandler == _viewportHandler);
    178     [_contentView setViewportSize:newSize];
    179 }
    180 
     120
     121}
    181122
    182123#pragma mark - UIScrollViewDelegate
     
    191132{
    192133    if (scrollView.pinchGestureRecognizer.state == UIGestureRecognizerStateBegan)
    193         _userHasChangedPageScale = YES;
     134        [_contentView willStartUserTriggeredZoom];
    194135    [_contentView willStartZoomOrScroll];
    195136}
     
    256197    [_scrollView addSubview:_contentView.get()];
    257198
    258     _viewportHandler = adoptNS([[_UIWebViewportHandler alloc] init]);
    259     [_viewportHandler setDelegate:self];
    260 
    261199    [self _frameOrBoundsChanged];
    262200}
     
    265203{
    266204    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];
    272207    [_scrollView setFrame:bounds];
    273208    [_contentView setMinimumSize:bounds.size];
     
    311246{
    312247    ASSERT(_hasStaticMinimumLayoutSize);
    313     return [_viewportHandler availableViewSize];
     248    return _minimumLayoutSizeOverride;
    314249}
    315250
     
    317252{
    318253    _hasStaticMinimumLayoutSize = YES;
    319     [_viewportHandler update:^{
    320         [_viewportHandler setAvailableViewSize:minimumLayoutSizeOverride];
    321     }];
     254    _minimumLayoutSizeOverride = minimumLayoutSizeOverride;
     255    [_contentView setMinimumLayoutSize:minimumLayoutSizeOverride];
    322256}
    323257
  • trunk/Source/WebKit2/UIProcess/PageClient.h

    r163255 r163515  
    5656class FindIndicator;
    5757class NativeWebKeyboardEvent;
     58class RemoteLayerTreeTransaction;
    5859class WebContextMenuProxy;
    5960class WebEditCommandProxy;
     
    150151#endif // PLATFORM(EFL) || PLATFORM(GTK)
    151152
    152 #if PLATFORM(EFL) || PLATFORM(IOS)
     153#if PLATFORM(EFL)
    153154    virtual void didChangeContentSize(const WebCore::IntSize&) = 0;
    154155#endif
     
    239240
    240241#if PLATFORM(IOS)
    241     virtual void mainDocumentDidReceiveMobileDocType() = 0;
    242 
    243242    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;
    244243
    245     virtual void didChangeViewportArguments(const WebCore::ViewportArguments&) = 0;
     244    virtual void didCommitLayerTree(const RemoteLayerTreeTransaction&) = 0;
    246245
    247246    virtual void startAssistingNode(const WebCore::IntRect&, bool hasNextFocusable, bool hasPreviousFocusable) = 0;
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp

    r163480 r163515  
    28752875#endif // PLATFORM(EFL) || PLATFORM(GTK)
    28762876
    2877 #if PLATFORM(EFL) || PLATFORM(IOS)
     2877#if PLATFORM(EFL)
    28782878void WebPageProxy::didChangeContentSize(const IntSize& size)
    28792879{
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.h

    r163480 r163515  
    140140class NativeWebWheelEvent;
    141141class PageClient;
     142class RemoteLayerTreeTransaction;
    142143class RemoteScrollingCoordinatorProxy;
    143144class StringPairVector;
     
    439440    void validateCommand(const String& commandName, PassRefPtr<ValidateCommandCallback>);
    440441#if PLATFORM(IOS)
     442    void setViewportConfigurationMinimumLayoutSize(const WebCore::IntSize&);
     443    void didCommitLayerTree(const WebKit::RemoteLayerTreeTransaction&);
    441444    void selectWithGesture(const WebCore::IntPoint, WebCore::TextGranularity, uint32_t gestureType, uint32_t gestureState, PassRefPtr<GestureCallback>);
    442445    void updateSelectionWithTouches(const WebCore::IntPoint, uint32_t touches, bool baseIsStart, PassRefPtr<TouchesCallback>);
     
    822825
    823826#if PLATFORM(IOS)
     827    void willStartUserTriggeredZooming();
    824828    void didFinishScrolling(const WebCore::FloatPoint& contentOffset);
    825829    void didFinishZooming(float newScale);
     
    994998    void didFindZoomableArea(const WebCore::IntPoint&, const WebCore::IntRect&);
    995999#endif
    996 #if PLATFORM(EFL) || PLATFORM(IOS)
     1000#if PLATFORM(EFL)
    9971001    void didChangeContentSize(const WebCore::IntSize&);
    9981002#endif
     
    11361140
    11371141#if PLATFORM(IOS)
    1138     void mainDocumentDidReceiveMobileDocType();
    1139 
    11401142    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);
    11431143
    11441144    void startAssistingNode(const WebCore::IntRect&, bool hasNextFocusable, bool hasPreviousFocusable);
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in

    r163255 r163515  
    9191#endif
    9292
    93 #if PLATFORM(EFL) || PLATFORM(IOS)
     93#if PLATFORM(EFL)
    9494    DidChangeContentSize(WebCore::IntSize newSize)
    9595#endif
     
    307307
    308308#if PLATFORM(IOS)
    309     MainDocumentDidReceiveMobileDocType();
    310 
    311309    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)
    313310
    314311    StartAssistingNode(WebCore::IntRect scrollRect, bool hasNextFocusable, bool hasPreviousFocusable)
  • trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm

    r163255 r163515  
    230230}
    231231
     232void WebPageProxy::setViewportConfigurationMinimumLayoutSize(const WebCore::IntSize& size)
     233{
     234    m_process->send(Messages::WebPage::SetViewportConfigurationMinimumLayoutSize(size), m_pageID);
     235}
     236
     237void WebPageProxy::didCommitLayerTree(const WebKit::RemoteLayerTreeTransaction& layerTreeTransaction)
     238{
     239    m_pageClient.didCommitLayerTree(layerTreeTransaction);
     240}
     241
    232242void WebPageProxy::selectWithGesture(const WebCore::IntPoint point, WebCore::TextGranularity granularity, uint32_t gestureType, uint32_t gestureState, PassRefPtr<GestureCallback> callback)
    233243{
     
    418428}
    419429
     430void WebPageProxy::willStartUserTriggeredZooming()
     431{
     432    process().send(Messages::WebPage::WillStartUserTriggeredZooming(), m_pageID);
     433}
     434
    420435void WebPageProxy::didFinishScrolling(const WebCore::FloatPoint& contentOffset)
    421436{
     
    442457}
    443458
    444 void WebPageProxy::mainDocumentDidReceiveMobileDocType()
    445 {
    446     m_pageClient.mainDocumentDidReceiveMobileDocType();
    447 }
    448 
    449459void 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)
    450460{
     
    452462}
    453463
    454 void WebPageProxy::didChangeViewportArguments(const WebCore::ViewportArguments& viewportArguments)
    455 {
    456     m_pageClient.didChangeViewportArguments(viewportArguments);
    457 }
    458 
    459464void WebPageProxy::startAssistingNode(const WebCore::IntRect& scrollRect, bool hasNextFocusable, bool hasPreviousFocusable)
    460465{
  • trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm

    r161533 r163515  
    9090    m_webPageProxy->scrollingCoordinatorProxy()->updateScrollingTree(scrollingTreeTransaction);
    9191#endif
     92#if PLATFORM(IOS)
     93    m_webPageProxy->didCommitLayerTree(layerTreeTransaction);
     94#endif
    9295}
    9396
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp

    r163079 r163515  
    502502    m_page->send(Messages::WebPageProxy::DidChangeContentSize(size));
    503503#endif
    504 #if PLATFORM(IOS)
    505     m_page->send(Messages::WebPageProxy::DidChangeContentSize(size));
    506 #endif
     504
    507505
    508506    m_page->drawingArea()->mainFrameContentSizeChanged(size);
     
    850848void WebChromeClient::dispatchViewportPropertiesDidChange(const ViewportArguments& viewportArguments) const
    851849{
     850    UNUSED_PARAM(viewportArguments);
    852851#if PLATFORM(IOS)
    853     m_page->send(Messages::WebPageProxy::DidChangeViewportArguments(viewportArguments));
    854 #else
    855     UNUSED_PARAM(viewportArguments);
     852    m_page->viewportPropertiesDidChange(viewportArguments);
    856853#endif
    857854#if USE(TILED_BACKING_STORE)
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm

    r161106 r163515  
    5454void WebChromeClient::didReceiveMobileDocType()
    5555{
    56     m_page->send(Messages::WebPageProxy::MainDocumentDidReceiveMobileDocType());
     56    // FIXME: update the ViewportConfiguration accordingly.
    5757}
    5858
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp

    r163476 r163515  
    282282#if PLATFORM(IOS)
    283283    , m_shouldReturnWordAtSelection(false)
     284    , m_userHasChangedPageScaleFactor(false)
    284285#endif
    285286    , m_inspectorClient(0)
     
    30763077    m_viewGestureGeometryCollector.mainFrameDidLayout();
    30773078#endif
     3079#if PLATFORM(IOS)
     3080    if (FrameView* frameView = mainFrameView()) {
     3081        m_viewportConfiguration.setContentsSize(frameView->contentsSize());
     3082        viewportConfigurationChanged();
     3083    }
     3084#endif
    30783085}
    30793086
     
    39783985            scalePage(1, IntPoint());
    39793986    }
     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
    39804003
    39814004#if ENABLE(PRIMARY_SNAPSHOTTED_PLUGIN_HEURISTIC)
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h

    r163476 r163515  
    5959#include <WebCore/UserActivity.h>
    6060#include <WebCore/ViewState.h>
     61#include <WebCore/ViewportConfiguration.h>
    6162#include <WebCore/WebCoreKeyboardUIMode.h>
    6263#include <wtf/HashMap.h>
     
    412413
    413414#if PLATFORM(IOS)
     415    void viewportPropertiesDidChange(const WebCore::ViewportArguments&);
     416
     417    double minimumPageScaleFactor() const;
     418    double maximumPageScaleFactor() const;
     419    bool allowsUserScaling() const;
     420
    414421    void handleTap(const WebCore::IntPoint&);
    415422    void tapHighlightAtPosition(uint64_t requestID, const WebCore::FloatPoint&);
     
    630637
    631638#if PLATFORM(IOS)
     639    void setViewportConfigurationMinimumLayoutSize(const WebCore::IntSize&);
     640    void viewportConfigurationChanged();
     641    void willStartUserTriggeredZooming();
    632642    void didFinishScrolling(const WebCore::FloatPoint& contentOffset);
    633643    void didFinishZooming(float);
     
    10501060    RefPtr<WebCore::Node> m_interactionNode;
    10511061    bool m_shouldReturnWordAtSelection;
     1062
     1063    WebCore::ViewportConfiguration m_viewportConfiguration;
     1064    bool m_userHasChangedPageScaleFactor;
    10521065#endif
    10531066
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in

    r163255 r163515  
    4242    WheelEventSyncForTesting(WebKit::WebWheelEvent event) -> (bool handled)
    4343#if PLATFORM(IOS)
     44    SetViewportConfigurationMinimumLayoutSize(WebCore::IntSize size)
     45
    4446    HandleTap(WebCore::IntPoint point)
    4547    TapHighlightAtPosition(uint64_t requestID, WebCore::FloatPoint point)
     
    314316
    315317#if PLATFORM(IOS)
     318    WillStartUserTriggeredZooming();
    316319    DidFinishScrolling(WebCore::FloatPoint contentOffset);
    317320    DidFinishZooming(float scale);
  • trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm

    r163499 r163515  
    8080}
    8181
     82void WebPage::viewportPropertiesDidChange(const ViewportArguments& viewportArguments)
     83{
     84    m_viewportConfiguration.setViewportArguments(viewportArguments);
     85    viewportConfigurationChanged();
     86}
     87
     88double WebPage::minimumPageScaleFactor() const
     89{
     90    return m_viewportConfiguration.minimumScale();
     91}
     92
     93double WebPage::maximumPageScaleFactor() const
     94{
     95    return m_viewportConfiguration.maximumScale();
     96}
     97
     98bool WebPage::allowsUserScaling() const
     99{
     100    return m_viewportConfiguration.allowsUserScaling();
     101}
     102
    82103bool WebPage::handleEditingKeyboardEvent(KeyboardEvent* event, bool)
    83104{
     
    961982}
    962983
     984void WebPage::setViewportConfigurationMinimumLayoutSize(const IntSize& size)
     985{
     986    m_viewportConfiguration.setMinimumLayoutSize(size);
     987    viewportConfigurationChanged();
     988}
     989
     990void 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
     1003void WebPage::willStartUserTriggeredZooming()
     1004{
     1005    m_userHasChangedPageScaleFactor = true;
     1006}
     1007
    9631008void WebPage::didFinishScrolling(const WebCore::FloatPoint& contentOffset)
    9641009{
  • trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm

    r162730 r163515  
    322322    RemoteLayerTreeTransaction layerTransaction;
    323323    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
    324331
    325332    RemoteScrollingCoordinatorTransaction scrollingTransaction;
Note: See TracChangeset for help on using the changeset viewer.