Title: [168556] trunk/Source
Revision
168556
Author
benja...@webkit.org
Date
2014-05-09 16:08:31 -0700 (Fri, 09 May 2014)

Log Message

[iOS][WK2] Set up the resize events
https://bugs.webkit.org/show_bug.cgi?id=132726

Patch by Benjamin Poulain <bpoul...@apple.com> on 2014-05-09
Reviewed by Darin Adler and Simon Fraser.


Source/WebCore: 
Let the WebKit2 layer override the size used for resize events.

* WebCore.exp.in:
* page/FrameView.cpp:
(WebCore::FrameView::layout):
(WebCore::FrameView::sizeForResizeEvent):
(WebCore::FrameView::sendResizeEventIfNeeded):
(WebCore::FrameView::setCustomSizeForResizeEvent):
* page/FrameView.h:

Source/WebKit2: 
Wire the UI Process updates to FrameView to send the resize events appropriately.

* Shared/VisibleContentRectUpdateInfo.cpp:
(WebKit::VisibleContentRectUpdateInfo::encode):
(WebKit::VisibleContentRectUpdateInfo::decode):
* Shared/VisibleContentRectUpdateInfo.h:
(WebKit::VisibleContentRectUpdateInfo::VisibleContentRectUpdateInfo):
(WebKit::VisibleContentRectUpdateInfo::isChangingObscuredInsetsInteractively):
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _updateVisibleContentRects]):
* UIProcess/ios/WKContentView.h:
* UIProcess/ios/WKContentView.mm:
(-[WKContentView didUpdateVisibleRect:unobscuredRect:scale:inStableState:isChangingObscuredInsetsInteractively:]):
(-[WKContentView didUpdateVisibleRect:unobscuredRect:scale:inStableState:]): Deleted.
Pass down the status of the content insets with the view update to main frame's FrameView
when needed.

* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::dynamicViewportSizeUpdate):
On live resize, send the resize event, then the scroll events (if needed).

Since _javascript_ now gets two chances to change the content (resize event + scroll event),
we query the actual scroll offset and scale for the DynamicViewportUpdateChangedTarget.

(WebKit::WebPage::viewportConfigurationChanged):
Define the custom size on load before the app gets a chance to send different rects.
If for some reason the app changes its mind about the insets, the content will be notified with a resize event.

(WebKit::WebPage::updateVisibleContentRects):
Send the resize event when the insets are stable.
Also move the scroll event after the resize event for consistency with live resize.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (168555 => 168556)


--- trunk/Source/WebCore/ChangeLog	2014-05-09 21:25:39 UTC (rev 168555)
+++ trunk/Source/WebCore/ChangeLog	2014-05-09 23:08:31 UTC (rev 168556)
@@ -1,3 +1,20 @@
+2014-05-09  Benjamin Poulain  <bpoul...@apple.com>
+
+        [iOS][WK2] Set up the resize events
+        https://bugs.webkit.org/show_bug.cgi?id=132726
+
+        Reviewed by Darin Adler and Simon Fraser.
+
+        Let the WebKit2 layer override the size used for resize events.
+
+        * WebCore.exp.in:
+        * page/FrameView.cpp:
+        (WebCore::FrameView::layout):
+        (WebCore::FrameView::sizeForResizeEvent):
+        (WebCore::FrameView::sendResizeEventIfNeeded):
+        (WebCore::FrameView::setCustomSizeForResizeEvent):
+        * page/FrameView.h:
+
 2014-05-09  Alexey Proskuryakov  <a...@apple.com>
 
         REGRESSION (r168518): Multiple tests for workers in blobs assert

Modified: trunk/Source/WebCore/WebCore.exp.in (168555 => 168556)


--- trunk/Source/WebCore/WebCore.exp.in	2014-05-09 21:25:39 UTC (rev 168555)
+++ trunk/Source/WebCore/WebCore.exp.in	2014-05-09 23:08:31 UTC (rev 168556)
@@ -2450,6 +2450,7 @@
 _WebUIApplicationDidBecomeActiveNotification
 _WebUIApplicationWillEnterForegroundNotification
 _WebUIApplicationWillResignActiveNotification
+__ZN7WebCore9FrameView27setCustomSizeForResizeEventENS_7IntSizeE
 __ZN7WebCore10ScrollView15setScrollOffsetERKNS_8IntPointE
 __ZN7WebCore10ScrollView21setExposedContentRectERKNS_7IntRectE
 __ZN7WebCore10ScrollView24setUnobscuredContentRectERKNS_7IntRectE

Modified: trunk/Source/WebCore/page/FrameView.cpp (168555 => 168556)


--- trunk/Source/WebCore/page/FrameView.cpp	2014-05-09 21:25:39 UTC (rev 168555)
+++ trunk/Source/WebCore/page/FrameView.cpp	2014-05-09 23:08:31 UTC (rev 168556)
@@ -177,6 +177,7 @@
     , m_speculativeTilingEnableTimer(this, &FrameView::speculativeTilingEnableTimerFired)
 #if PLATFORM(IOS)
     , m_useCustomFixedPositionLayoutRect(false)
+    , m_useCustomSizeForResizeEvent(false)
 #endif
     , m_hasOverrideViewportSize(false)
     , m_shouldAutoSize(false)
@@ -1214,11 +1215,7 @@
 
                     m_firstLayout = false;
                     m_firstLayoutCallbackPending = true;
-                    if (useFixedLayout() && !fixedLayoutSize().isEmpty() && delegatesScrolling())
-                        m_lastViewportSize = fixedLayoutSize();
-                    else
-                        m_lastViewportSize = visibleContentRectIncludingScrollbars().size();
-
+                    m_lastViewportSize = sizeForResizeEvent();
                     m_lastZoomFactor = root->style().zoom();
 
                     // Set the initial vMode to AlwaysOn if we're auto.
@@ -2797,6 +2794,17 @@
     sendResizeEventIfNeeded();
 }
 
+IntSize FrameView::sizeForResizeEvent() const
+{
+#if PLATFORM(IOS)
+    if (m_useCustomSizeForResizeEvent)
+        return m_customSizeForResizeEvent;
+#endif
+    if (useFixedLayout() && !fixedLayoutSize().isEmpty() && delegatesScrolling())
+        return fixedLayoutSize();
+    return visibleContentRectIncludingScrollbars().size();
+}
+
 void FrameView::sendResizeEventIfNeeded()
 {
     RenderView* renderView = this->renderView();
@@ -2805,12 +2813,7 @@
     if (frame().page() && frame().page()->chrome().client().isSVGImageChromeClient())
         return;
 
-    IntSize currentSize;
-    if (useFixedLayout() && !fixedLayoutSize().isEmpty() && delegatesScrolling())
-        currentSize = fixedLayoutSize();
-    else
-        currentSize = visibleContentRectIncludingScrollbars().size();
-
+    IntSize currentSize = sizeForResizeEvent();
     float currentZoomFactor = renderView->style().zoom();
     bool shouldSendResizeEvent = !m_firstLayout && (currentSize != m_lastViewportSize || currentZoomFactor != m_lastZoomFactor);
 
@@ -4159,6 +4162,13 @@
     return false;
 }
 
+void FrameView::setCustomSizeForResizeEvent(IntSize customSize)
+{
+    m_useCustomSizeForResizeEvent = true;
+    m_customSizeForResizeEvent = customSize;
+    sendResizeEventIfNeeded();
+}
+
 void FrameView::setScrollVelocity(double horizontalVelocity, double verticalVelocity, double scaleChangeRate, double timestamp)
 {
     m_horizontalVelocity = horizontalVelocity;

Modified: trunk/Source/WebCore/page/FrameView.h (168555 => 168556)


--- trunk/Source/WebCore/page/FrameView.h	2014-05-09 21:25:39 UTC (rev 168555)
+++ trunk/Source/WebCore/page/FrameView.h	2014-05-09 23:08:31 UTC (rev 168556)
@@ -130,6 +130,8 @@
     void setCustomFixedPositionLayoutRect(const IntRect&);
     bool updateFixedPositionLayoutRect();
 
+    void setCustomSizeForResizeEvent(IntSize);
+
     void setScrollVelocity(double horizontalVelocity, double verticalVelocity, double scaleChangeRate, double timestamp);
     FloatRect computeCoverageRect(double horizontalMargin, double verticalMargin) const;
 #else
@@ -577,6 +579,7 @@
     virtual void didAddScrollbar(Scrollbar*, ScrollbarOrientation) override;
     virtual void willRemoveScrollbar(Scrollbar*, ScrollbarOrientation) override;
 
+    IntSize sizeForResizeEvent() const;
     void sendResizeEventIfNeeded();
 
     void updateScrollableAreaSet();
@@ -695,6 +698,9 @@
     bool m_useCustomFixedPositionLayoutRect;
     IntRect m_customFixedPositionLayoutRect;
 
+    bool m_useCustomSizeForResizeEvent;
+    IntSize m_customSizeForResizeEvent;
+
     double m_horizontalVelocity;
     double m_verticalVelocity;
     double m_scaleChangeRate;

Modified: trunk/Source/WebKit2/ChangeLog (168555 => 168556)


--- trunk/Source/WebKit2/ChangeLog	2014-05-09 21:25:39 UTC (rev 168555)
+++ trunk/Source/WebKit2/ChangeLog	2014-05-09 23:08:31 UTC (rev 168556)
@@ -1,3 +1,42 @@
+2014-05-09  Benjamin Poulain  <bpoul...@apple.com>
+
+        [iOS][WK2] Set up the resize events
+        https://bugs.webkit.org/show_bug.cgi?id=132726
+
+        Reviewed by Darin Adler and Simon Fraser.
+
+        Wire the UI Process updates to FrameView to send the resize events appropriately.
+
+        * Shared/VisibleContentRectUpdateInfo.cpp:
+        (WebKit::VisibleContentRectUpdateInfo::encode):
+        (WebKit::VisibleContentRectUpdateInfo::decode):
+        * Shared/VisibleContentRectUpdateInfo.h:
+        (WebKit::VisibleContentRectUpdateInfo::VisibleContentRectUpdateInfo):
+        (WebKit::VisibleContentRectUpdateInfo::isChangingObscuredInsetsInteractively):
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView _updateVisibleContentRects]):
+        * UIProcess/ios/WKContentView.h:
+        * UIProcess/ios/WKContentView.mm:
+        (-[WKContentView didUpdateVisibleRect:unobscuredRect:scale:inStableState:isChangingObscuredInsetsInteractively:]):
+        (-[WKContentView didUpdateVisibleRect:unobscuredRect:scale:inStableState:]): Deleted.
+        Pass down the status of the content insets with the view update to main frame's FrameView
+        when needed.
+
+        * WebProcess/WebPage/ios/WebPageIOS.mm:
+        (WebKit::WebPage::dynamicViewportSizeUpdate):
+        On live resize, send the resize event, then the scroll events (if needed).
+
+        Since _javascript_ now gets two chances to change the content (resize event + scroll event),
+        we query the actual scroll offset and scale for the DynamicViewportUpdateChangedTarget.
+
+        (WebKit::WebPage::viewportConfigurationChanged):
+        Define the custom size on load before the app gets a chance to send different rects.
+        If for some reason the app changes its mind about the insets, the content will be notified with a resize event.
+
+        (WebKit::WebPage::updateVisibleContentRects):
+        Send the resize event when the insets are stable.
+        Also move the scroll event after the resize event for consistency with live resize.
+
 2014-05-09  Benjamin Poulain  <benja...@webkit.org>
 
         [iOS] Switch geolocation to an explicit authorization query model

Modified: trunk/Source/WebKit2/Shared/VisibleContentRectUpdateInfo.cpp (168555 => 168556)


--- trunk/Source/WebKit2/Shared/VisibleContentRectUpdateInfo.cpp	2014-05-09 21:25:39 UTC (rev 168555)
+++ trunk/Source/WebKit2/Shared/VisibleContentRectUpdateInfo.cpp	2014-05-09 23:08:31 UTC (rev 168556)
@@ -34,10 +34,12 @@
 {
     encoder << m_exposedRect;
     encoder << m_unobscuredRect;
+    encoder << m_unobscuredRectInScrollViewCoordinates;
     encoder << m_customFixedPositionRect;
     encoder << m_scale;
     encoder << m_updateID;
     encoder << m_inStableState;
+    encoder << m_isChangingObscuredInsetsInteractively;
     encoder << m_timestamp;
     encoder << m_horizontalVelocity;
     encoder << m_verticalVelocity;
@@ -50,6 +52,8 @@
         return false;
     if (!decoder.decode(result.m_unobscuredRect))
         return false;
+    if (!decoder.decode(result.m_unobscuredRectInScrollViewCoordinates))
+        return false;
     if (!decoder.decode(result.m_customFixedPositionRect))
         return false;
     if (!decoder.decode(result.m_scale))
@@ -58,6 +62,8 @@
         return false;
     if (!decoder.decode(result.m_inStableState))
         return false;
+    if (!decoder.decode(result.m_isChangingObscuredInsetsInteractively))
+        return false;
     if (!decoder.decode(result.m_timestamp))
         return false;
     if (!decoder.decode(result.m_horizontalVelocity))

Modified: trunk/Source/WebKit2/Shared/VisibleContentRectUpdateInfo.h (168555 => 168556)


--- trunk/Source/WebKit2/Shared/VisibleContentRectUpdateInfo.h	2014-05-09 21:25:39 UTC (rev 168555)
+++ trunk/Source/WebKit2/Shared/VisibleContentRectUpdateInfo.h	2014-05-09 23:08:31 UTC (rev 168556)
@@ -41,16 +41,19 @@
         : m_scale(-1)
         , m_updateID(0)
         , m_inStableState(false)
+        , m_isChangingObscuredInsetsInteractively(false)
     {
     }
 
-    VisibleContentRectUpdateInfo(uint64_t updateID, const WebCore::FloatRect& exposedRect, const WebCore::FloatRect& unobscuredRect, const WebCore::FloatRect& customFixedPositionRect, double scale, bool inStableState, double timestamp, double horizontalVelocity, double verticalVelocity, double scaleChangeRate)
+    VisibleContentRectUpdateInfo(uint64_t updateID, const WebCore::FloatRect& exposedRect, const WebCore::FloatRect& unobscuredRect, const WebCore::FloatRect& unobscuredRectInScrollViewCoordinates, const WebCore::FloatRect& customFixedPositionRect, double scale, bool inStableState, bool isChangingObscuredInsetsInteractively, double timestamp, double horizontalVelocity, double verticalVelocity, double scaleChangeRate)
         : m_exposedRect(exposedRect)
         , m_unobscuredRect(unobscuredRect)
+        , m_unobscuredRectInScrollViewCoordinates(unobscuredRectInScrollViewCoordinates)
         , m_customFixedPositionRect(customFixedPositionRect)
         , m_scale(scale)
         , m_updateID(updateID)
         , m_inStableState(inStableState)
+        , m_isChangingObscuredInsetsInteractively(isChangingObscuredInsetsInteractively)
         , m_timestamp(timestamp)
         , m_horizontalVelocity(horizontalVelocity)
         , m_verticalVelocity(verticalVelocity)
@@ -60,10 +63,12 @@
 
     const WebCore::FloatRect& exposedRect() const { return m_exposedRect; }
     const WebCore::FloatRect& unobscuredRect() const { return m_unobscuredRect; }
+    const WebCore::FloatRect& unobscuredRectInScrollViewCoordinates() const { return m_unobscuredRectInScrollViewCoordinates; }
     const WebCore::FloatRect& customFixedPositionRect() const { return m_customFixedPositionRect; }
     double scale() const { return m_scale; }
     uint64_t updateID() const { return m_updateID; }
     bool inStableState() const { return m_inStableState; }
+    bool isChangingObscuredInsetsInteractively() const { return m_isChangingObscuredInsetsInteractively; }
 
     double timestamp() const { return m_timestamp; }
     double horizontalVelocity() const { return m_horizontalVelocity; }
@@ -76,10 +81,12 @@
 private:
     WebCore::FloatRect m_exposedRect;
     WebCore::FloatRect m_unobscuredRect;
+    WebCore::FloatRect m_unobscuredRectInScrollViewCoordinates;
     WebCore::FloatRect m_customFixedPositionRect;
     double m_scale;
     uint64_t m_updateID;
     bool m_inStableState;
+    bool m_isChangingObscuredInsetsInteractively;
     double m_timestamp;
     double m_horizontalVelocity;
     double m_verticalVelocity;

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (168555 => 168556)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm	2014-05-09 21:25:39 UTC (rev 168555)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm	2014-05-09 23:08:31 UTC (rev 168556)
@@ -779,7 +779,7 @@
     CGFloat scaleFactor = contentZoomScale(self);
 
     BOOL isStableState = !(_isChangingObscuredInsetsInteractively || [_scrollView isDragging] || [_scrollView isDecelerating] || [_scrollView isZooming] || [_scrollView isZoomBouncing] || [_scrollView _isAnimatingZoom]);
-    [_contentView didUpdateVisibleRect:visibleRectInContentCoordinates unobscuredRect:unobscuredRectInContentCoordinates scale:scaleFactor inStableState:isStableState];
+    [_contentView didUpdateVisibleRect:visibleRectInContentCoordinates unobscuredRect:unobscuredRectInContentCoordinates unobscuredRectInScrollViewCoordinates:unobscuredRect scale:scaleFactor inStableState:isStableState isChangingObscuredInsetsInteractively:_isChangingObscuredInsetsInteractively];
 }
 
 - (void)_keyboardChangedWithInfo:(NSDictionary *)keyboardInfo adjustScrollView:(BOOL)adjustScrollView
@@ -1487,7 +1487,7 @@
     CGRect visibleRectInContentCoordinates = [self convertRect:newBounds toView:_contentView.get()];
     CGRect unobscuredRectInContentCoordinates = [self convertRect:futureUnobscuredRectInSelfCoordinates toView:_contentView.get()];
 
-    _page->dynamicViewportSizeUpdate(WebCore::FloatSize(newMinimumLayoutSize.width, newMinimumLayoutSize.height), visibleRectInContentCoordinates, unobscuredRectInContentCoordinates, targetScale);
+    _page->dynamicViewportSizeUpdate(WebCore::FloatSize(newMinimumLayoutSize.width, newMinimumLayoutSize.height), visibleRectInContentCoordinates, unobscuredRectInContentCoordinates, futureUnobscuredRectInSelfCoordinates, targetScale);
 }
 
 - (void)_endAnimatedResize

Modified: trunk/Source/WebKit2/UIProcess/API/ios/WKViewIOS.mm (168555 => 168556)


--- trunk/Source/WebKit2/UIProcess/API/ios/WKViewIOS.mm	2014-05-09 21:25:39 UTC (rev 168555)
+++ trunk/Source/WebKit2/UIProcess/API/ios/WKViewIOS.mm	2014-05-09 23:08:31 UTC (rev 168556)
@@ -263,7 +263,7 @@
 
     CGFloat scaleFactor = [_scrollView zoomScale];
 
-    [_contentView didUpdateVisibleRect:visibleRectInContentCoordinates unobscuredRect:unobscuredRectInContentCoordinates scale:scaleFactor inStableState:YES];
+    [_contentView didUpdateVisibleRect:visibleRectInContentCoordinates unobscuredRect:unobscuredRectInContentCoordinates unobscuredRectInScrollViewCoordinates:unobscuredRect scale:scaleFactor inStableState:YES isChangingObscuredInsetsInteractively:NO];
 }
 
 - (void)_keyboardChangedWithInfo:(NSDictionary *)keyboardInfo adjustScrollView:(BOOL)adjustScrollView

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (168555 => 168556)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2014-05-09 21:25:39 UTC (rev 168555)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2014-05-09 23:08:31 UTC (rev 168556)
@@ -589,7 +589,7 @@
     uint64_t nextVisibleContentRectUpdateID() const { return m_lastVisibleContentRectUpdate.updateID() + 1; }
     uint64_t lastVisibleContentRectUpdateID() const { return m_lastVisibleContentRectUpdate.updateID(); }
 
-    void dynamicViewportSizeUpdate(const WebCore::FloatSize& minimumLayoutSize, const WebCore::FloatRect& targetExposedContentRect, const WebCore::FloatRect& targetUnobscuredRect, double targetScale);
+    void dynamicViewportSizeUpdate(const WebCore::FloatSize& minimumLayoutSize, const WebCore::FloatRect& targetExposedContentRect, const WebCore::FloatRect& targetUnobscuredRect, const WebCore::FloatRect& targetUnobscuredRectInScrollViewCoordinates, double targetScale);
     
     void setViewportConfigurationMinimumLayoutSize(const WebCore::FloatSize&);
     void setMinimumLayoutSizeForMinimalUI(const WebCore::FloatSize&);

Modified: trunk/Source/WebKit2/UIProcess/ios/WKContentView.h (168555 => 168556)


--- trunk/Source/WebKit2/UIProcess/ios/WKContentView.h	2014-05-09 21:25:39 UTC (rev 168555)
+++ trunk/Source/WebKit2/UIProcess/ios/WKContentView.h	2014-05-09 23:08:31 UTC (rev 168556)
@@ -60,7 +60,7 @@
 - (instancetype)initWithFrame:(CGRect)frame context:(WebKit::WebContext&)context configuration:(WebKit::WebPageConfiguration)webPageConfiguration webView:(WKWebView *)webView;
 
 - (void)setMinimumSize:(CGSize)size;
-- (void)didUpdateVisibleRect:(CGRect)visibleRect unobscuredRect:(CGRect)unobscuredRect scale:(CGFloat)scale inStableState:(BOOL)isStableState;
+- (void)didUpdateVisibleRect:(CGRect)visibleRect unobscuredRect:(CGRect)unobscuredRect unobscuredRectInScrollViewCoordinates:(CGRect)unobscuredRectInScrollViewCoordinates scale:(CGFloat)scale inStableState:(BOOL)isStableState isChangingObscuredInsetsInteractively:(BOOL)isChangingObscuredInsetsInteractively;
 
 - (void)didFinishScrolling;
 - (void)didZoomToScale:(CGFloat)scale;

Modified: trunk/Source/WebKit2/UIProcess/ios/WKContentView.mm (168555 => 168556)


--- trunk/Source/WebKit2/UIProcess/ios/WKContentView.mm	2014-05-09 21:25:39 UTC (rev 168555)
+++ trunk/Source/WebKit2/UIProcess/ios/WKContentView.mm	2014-05-09 23:08:31 UTC (rev 168556)
@@ -297,7 +297,7 @@
     return FrameView::rectForViewportConstrainedObjects(enclosingLayoutRect(unobscuredRect), roundedLayoutSize(FloatSize(documentSize)), scale, false, StickToViewportBounds);
 }
 
-- (void)didUpdateVisibleRect:(CGRect)visibleRect unobscuredRect:(CGRect)unobscuredRect scale:(CGFloat)zoomScale inStableState:(BOOL)isStableState
+- (void)didUpdateVisibleRect:(CGRect)visibleRect unobscuredRect:(CGRect)unobscuredRect unobscuredRectInScrollViewCoordinates:(CGRect)unobscuredRectInScrollViewCoordinates scale:(CGFloat)zoomScale inStableState:(BOOL)isStableState isChangingObscuredInsetsInteractively:(BOOL)isChangingObscuredInsetsInteractively
 {
     double timestamp = monotonicallyIncreasingTime();
     HistoricalVelocityData::VelocityData velocityData;
@@ -315,7 +315,7 @@
     }
 
     FloatRect customFixedPositionRect = fixedPositionRectFromExposedRect(unobscuredRect, [self bounds].size, zoomScale);
-    _page->updateVisibleContentRects(VisibleContentRectUpdateInfo(_page->nextVisibleContentRectUpdateID(), visibleRect, unobscuredRect, customFixedPositionRect, filteredScale, isStableState, timestamp, velocityData.horizontalVelocity, velocityData.verticalVelocity, velocityData.scaleChangeRate));
+    _page->updateVisibleContentRects(VisibleContentRectUpdateInfo(_page->nextVisibleContentRectUpdateID(), visibleRect, unobscuredRect, unobscuredRectInScrollViewCoordinates, customFixedPositionRect, filteredScale, isStableState, isChangingObscuredInsetsInteractively, timestamp, velocityData.horizontalVelocity, velocityData.verticalVelocity, velocityData.scaleChangeRate));
     
     RemoteScrollingCoordinatorProxy* scrollingCoordinator = _page->scrollingCoordinatorProxy();
     scrollingCoordinator->viewportChangedViaDelegatedScrolling(scrollingCoordinator->rootScrollingNodeID(), unobscuredRect, zoomScale);

Modified: trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm (168555 => 168556)


--- trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm	2014-05-09 21:25:39 UTC (rev 168555)
+++ trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm	2014-05-09 23:08:31 UTC (rev 168556)
@@ -194,9 +194,9 @@
     return true;
 }
 
-void WebPageProxy::dynamicViewportSizeUpdate(const FloatSize& minimumLayoutSize, const FloatRect& targetExposedContentRect, const FloatRect& targetUnobscuredRect, double targetScale)
+void WebPageProxy::dynamicViewportSizeUpdate(const FloatSize& minimumLayoutSize, const FloatRect& targetExposedContentRect, const FloatRect& targetUnobscuredRect, const FloatRect& targetUnobscuredRectInScrollViewCoordinates,  double targetScale)
 {
-    m_process->send(Messages::WebPage::DynamicViewportSizeUpdate(minimumLayoutSize, targetExposedContentRect, targetUnobscuredRect, targetScale), m_pageID);
+    m_process->send(Messages::WebPage::DynamicViewportSizeUpdate(minimumLayoutSize, targetExposedContentRect, targetUnobscuredRect, targetUnobscuredRectInScrollViewCoordinates, targetScale), m_pageID);
 }
 
 void WebPageProxy::setViewportConfigurationMinimumLayoutSize(const WebCore::FloatSize& size)

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (168555 => 168556)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h	2014-05-09 21:25:39 UTC (rev 168555)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h	2014-05-09 23:08:31 UTC (rev 168556)
@@ -706,7 +706,7 @@
 #if PLATFORM(IOS)
     void setViewportConfigurationMinimumLayoutSize(const WebCore::FloatSize&);
     void setMinimumLayoutSizeForMinimalUI(const WebCore::FloatSize&);
-    void dynamicViewportSizeUpdate(const WebCore::FloatSize& minimumLayoutSize, const WebCore::FloatRect& targetExposedContentRect, const WebCore::FloatRect& targetUnobscuredRect, double scale);
+    void dynamicViewportSizeUpdate(const WebCore::FloatSize& minimumLayoutSize, const WebCore::FloatRect& targetExposedContentRect, const WebCore::FloatRect& targetUnobscuredRect, const WebCore::FloatRect& targetUnobscuredRectInScrollViewCoordinates, double scale);
     void updateVisibleContentRects(const VisibleContentRectUpdateInfo&);
     bool scaleWasSetByUIProcess() const { return m_scaleWasSetByUIProcess; }
     void willStartUserTriggeredZooming();

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in (168555 => 168556)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in	2014-05-09 21:25:39 UTC (rev 168555)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in	2014-05-09 23:08:31 UTC (rev 168556)
@@ -45,7 +45,7 @@
 #if PLATFORM(IOS)
     SetViewportConfigurationMinimumLayoutSize(WebCore::FloatSize size)
     SetMinimumLayoutSizeForMinimalUI(WebCore::FloatSize size)
-    DynamicViewportSizeUpdate(WebCore::FloatSize minimumLayoutSize, WebCore::FloatRect targetExposedContentRect, WebCore::FloatRect targetUnobscuredRect, double scale)
+    DynamicViewportSizeUpdate(WebCore::FloatSize minimumLayoutSize, WebCore::FloatRect targetExposedContentRect, WebCore::FloatRect targetUnobscuredRect, WebCore::FloatRect targetUnobscuredRectInScrollViewCoordinates, double scale)
 
     HandleTap(WebCore::IntPoint point)
     PotentialTapAtPosition(uint64_t requestID, WebCore::FloatPoint point)

Modified: trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm (168555 => 168556)


--- trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm	2014-05-09 21:25:39 UTC (rev 168555)
+++ trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm	2014-05-09 23:08:31 UTC (rev 168556)
@@ -1891,7 +1891,7 @@
     viewportConfigurationChanged();
 }
 
-void WebPage::dynamicViewportSizeUpdate(const FloatSize& minimumLayoutSize, const FloatRect& targetExposedContentRect, const FloatRect& targetUnobscuredRect, double targetScale)
+void WebPage::dynamicViewportSizeUpdate(const FloatSize& minimumLayoutSize, const FloatRect& targetExposedContentRect, const FloatRect& targetUnobscuredRect, const WebCore::FloatRect& targetUnobscuredRectInScrollViewCoordinates, double targetScale)
 {
     TemporaryChange<bool> dynamicSizeUpdateGuard(m_inDynamicSizeUpdate, true);
     // FIXME: this does not handle the cases where the content would change the content size or scroll position from _javascript_.
@@ -2028,15 +2028,19 @@
     frameView.setScrollVelocity(0, 0, 0, monotonicallyIncreasingTime());
 
     IntRect roundedUnobscuredContentRect = roundedIntRect(newUnobscuredContentRect);
-    frameView.setScrollOffset(roundedUnobscuredContentRect.location());
     frameView.setUnobscuredContentRect(roundedUnobscuredContentRect);
     m_drawingArea->setExposedContentRect(newExposedContentRect);
 
     if (scale == targetScale)
         scalePage(scale, roundedUnobscuredContentRect.location());
 
-    if (scale != targetScale || roundedIntPoint(targetUnobscuredRect.location()) != roundedUnobscuredContentRect.location())
-        send(Messages::WebPageProxy::DynamicViewportUpdateChangedTarget(scale, roundedUnobscuredContentRect.location()));
+    FloatSize unobscuredContentRectSizeInContentCoordinates = newUnobscuredContentRect.size();
+    unobscuredContentRectSizeInContentCoordinates.scale(scale);
+    frameView.setCustomSizeForResizeEvent(expandedIntSize(unobscuredContentRectSizeInContentCoordinates));
+    frameView.setScrollOffset(roundedUnobscuredContentRect.location());
+
+    if (pageScaleFactor() != targetScale || roundedIntPoint(targetUnobscuredRect.location()) != frameView.scrollPosition())
+        send(Messages::WebPageProxy::DynamicViewportUpdateChangedTarget(pageScaleFactor(), frameView.scrollPosition()));
 }
 
 void WebPage::resetViewportDefaultConfiguration(WebFrame* frame)
@@ -2091,6 +2095,8 @@
     if (!m_hasReceivedVisibleContentRectsAfterDidCommitLoad) {
         // This takes scale into account, so do after the scale change.
         frameView.setCustomFixedPositionLayoutRect(enclosingIntRect(frameView.viewportConstrainedObjectsRect()));
+
+        frameView.setCustomSizeForResizeEvent(expandedIntSize(m_viewportConfiguration.minimumLayoutSize()));
     }
 }
 
@@ -2164,7 +2170,6 @@
     if (scrollPosition != IntPoint(frameView.scrollOffset()))
         m_dynamicSizeUpdateHistory.clear();
 
-    frameView.setScrollOffset(scrollPosition);
     frameView.setUnobscuredContentRect(roundedUnobscuredRect);
 
     double horizontalVelocity = visibleContentRectUpdateInfo.horizontalVelocity();
@@ -2176,6 +2181,11 @@
 
     if (visibleContentRectUpdateInfo.inStableState())
         m_page->mainFrame().view()->setCustomFixedPositionLayoutRect(enclosingIntRect(visibleContentRectUpdateInfo.customFixedPositionRect()));
+
+    if (!visibleContentRectUpdateInfo.isChangingObscuredInsetsInteractively())
+        frameView.setCustomSizeForResizeEvent(expandedIntSize(visibleContentRectUpdateInfo.unobscuredRectInScrollViewCoordinates().size()));
+
+    frameView.setScrollOffset(scrollPosition);
 }
 
 void WebPage::willStartUserTriggeredZooming()
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to