Title: [200161] trunk/Source
Revision
200161
Author
simon.fra...@apple.com
Date
2016-04-27 16:51:40 -0700 (Wed, 27 Apr 2016)

Log Message

[iOS WK2] When determining tile size, check whether ancestor UIScrollViews are actually scrollable
https://bugs.webkit.org/show_bug.cgi?id=157107
rdar://problem/25943577

Reviewed by Tim Horton.
Source/WebCore:

Rename "enclosedInScrollView" to "enclosedInScrollableAncestorView" everywhere.

* page/FrameView.cpp:
(WebCore::FrameView::adjustTiledBackingScrollability):
* page/Page.h:
(WebCore::Page::enclosedInScrollableAncestorView):
(WebCore::Page::setEnclosedInScrollableAncestorView):
(WebCore::Page::enclosedInScrollView): Deleted.
(WebCore::Page::setEnclosedInScrollView): Deleted.

Source/WebKit2:

We should only fall back to 512x512 tiles if the WKWebView has a UIScrollView ancestor,
and that UIScrollView actually scrolls. This avoids falling back to small tiles in
MobileSafari.

Rename "enclosedInScrollView" to "enclosedInScrollableAncestorView" everywhere.

* Shared/VisibleContentRectUpdateInfo.cpp:
(WebKit::VisibleContentRectUpdateInfo::encode):
(WebKit::VisibleContentRectUpdateInfo::decode):
* Shared/VisibleContentRectUpdateInfo.h:
(WebKit::VisibleContentRectUpdateInfo::VisibleContentRectUpdateInfo):
(WebKit::VisibleContentRectUpdateInfo::enclosedInScrollableAncestorView):
(WebKit::operator==):
(WebKit::VisibleContentRectUpdateInfo::enclosedInScrollView): Deleted.
* UIProcess/API/Cocoa/WKWebView.mm:
(scrollViewCanScroll):
(-[WKWebView _updateContentRectsWithState:]):
* UIProcess/ios/WKContentView.h:
* UIProcess/ios/WKContentView.mm:
(-[WKContentView didUpdateVisibleRect:unobscuredRect:unobscuredRectInScrollViewCoordinates:obscuredInset:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:]):
(-[WKContentView didUpdateVisibleRect:unobscuredRect:unobscuredRectInScrollViewCoordinates:obscuredInset:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollView:]): Deleted.
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::updateVisibleContentRects):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (200160 => 200161)


--- trunk/Source/WebCore/ChangeLog	2016-04-27 23:51:35 UTC (rev 200160)
+++ trunk/Source/WebCore/ChangeLog	2016-04-27 23:51:40 UTC (rev 200161)
@@ -1,3 +1,21 @@
+2016-04-27  Simon Fraser  <simon.fra...@apple.com>
+
+        [iOS WK2] When determining tile size, check whether ancestor UIScrollViews are actually scrollable
+        https://bugs.webkit.org/show_bug.cgi?id=157107
+        rdar://problem/25943577
+
+        Reviewed by Tim Horton.
+
+        Rename "enclosedInScrollView" to "enclosedInScrollableAncestorView" everywhere.
+
+        * page/FrameView.cpp:
+        (WebCore::FrameView::adjustTiledBackingScrollability):
+        * page/Page.h:
+        (WebCore::Page::enclosedInScrollableAncestorView):
+        (WebCore::Page::setEnclosedInScrollableAncestorView):
+        (WebCore::Page::enclosedInScrollView): Deleted.
+        (WebCore::Page::setEnclosedInScrollView): Deleted.
+
 2016-04-27  Michael Catanzaro  <mcatanz...@igalia.com>
 
         [SOUP] Implement PlatformCookieJar::addCookie

Modified: trunk/Source/WebCore/page/FrameView.cpp (200160 => 200161)


--- trunk/Source/WebCore/page/FrameView.cpp	2016-04-27 23:51:35 UTC (rev 200160)
+++ trunk/Source/WebCore/page/FrameView.cpp	2016-04-27 23:51:40 UTC (rev 200161)
@@ -2487,7 +2487,7 @@
 
 #if PLATFORM(IOS)
     if (Page* page = frame().page())
-        clippedByAncestorView |= page->enclosedInScrollView();
+        clippedByAncestorView |= page->enclosedInScrollableAncestorView();
 #endif
 
     if (delegatesScrolling()) {

Modified: trunk/Source/WebCore/page/Page.h (200160 => 200161)


--- trunk/Source/WebCore/page/Page.h	2016-04-27 23:51:35 UTC (rev 200160)
+++ trunk/Source/WebCore/page/Page.h	2016-04-27 23:51:40 UTC (rev 200161)
@@ -299,8 +299,8 @@
     FloatSize obscuredInset() const { return m_obscuredInset; }
     void setObscuredInset(FloatSize inset) { m_obscuredInset = inset; }
     
-    bool enclosedInScrollView() const { return m_enclosedInScrollView; }
-    void setEnclosedInScrollView(bool f) { m_enclosedInScrollView = f; }
+    bool enclosedInScrollableAncestorView() const { return m_enclosedInScrollableAncestorView; }
+    void setEnclosedInScrollableAncestorView(bool f) { m_enclosedInScrollableAncestorView = f; }
 #endif
 
 #if ENABLE(IOS_TEXT_AUTOSIZING)
@@ -612,7 +612,7 @@
 #if PLATFORM(IOS)
     // This is only used for history scroll position restoration.
     FloatSize m_obscuredInset;
-    bool m_enclosedInScrollView { false };
+    bool m_enclosedInScrollableAncestorView { false };
 #endif
 
 #if ENABLE(IOS_TEXT_AUTOSIZING)

Modified: trunk/Source/WebKit2/ChangeLog (200160 => 200161)


--- trunk/Source/WebKit2/ChangeLog	2016-04-27 23:51:35 UTC (rev 200160)
+++ trunk/Source/WebKit2/ChangeLog	2016-04-27 23:51:40 UTC (rev 200161)
@@ -1,3 +1,35 @@
+2016-04-27  Simon Fraser  <simon.fra...@apple.com>
+
+        [iOS WK2] When determining tile size, check whether ancestor UIScrollViews are actually scrollable
+        https://bugs.webkit.org/show_bug.cgi?id=157107
+        rdar://problem/25943577
+
+        Reviewed by Tim Horton.
+        
+        We should only fall back to 512x512 tiles if the WKWebView has a UIScrollView ancestor,
+        and that UIScrollView actually scrolls. This avoids falling back to small tiles in
+        MobileSafari.
+
+        Rename "enclosedInScrollView" to "enclosedInScrollableAncestorView" everywhere.
+
+        * Shared/VisibleContentRectUpdateInfo.cpp:
+        (WebKit::VisibleContentRectUpdateInfo::encode):
+        (WebKit::VisibleContentRectUpdateInfo::decode):
+        * Shared/VisibleContentRectUpdateInfo.h:
+        (WebKit::VisibleContentRectUpdateInfo::VisibleContentRectUpdateInfo):
+        (WebKit::VisibleContentRectUpdateInfo::enclosedInScrollableAncestorView):
+        (WebKit::operator==):
+        (WebKit::VisibleContentRectUpdateInfo::enclosedInScrollView): Deleted.
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (scrollViewCanScroll):
+        (-[WKWebView _updateContentRectsWithState:]):
+        * UIProcess/ios/WKContentView.h:
+        * UIProcess/ios/WKContentView.mm:
+        (-[WKContentView didUpdateVisibleRect:unobscuredRect:unobscuredRectInScrollViewCoordinates:obscuredInset:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:]):
+        (-[WKContentView didUpdateVisibleRect:unobscuredRect:unobscuredRectInScrollViewCoordinates:obscuredInset:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollView:]): Deleted.
+        * WebProcess/WebPage/ios/WebPageIOS.mm:
+        (WebKit::WebPage::updateVisibleContentRects):
+
 2016-04-26  Ada Chan  <adac...@apple.com>
 
         Set WebVideoFullscreenInterfaceMac up as a client of WebPlaybackSessionInterfaceMac to listen for playback state changes

Modified: trunk/Source/WebKit2/Shared/VisibleContentRectUpdateInfo.cpp (200160 => 200161)


--- trunk/Source/WebKit2/Shared/VisibleContentRectUpdateInfo.cpp	2016-04-27 23:51:35 UTC (rev 200160)
+++ trunk/Source/WebKit2/Shared/VisibleContentRectUpdateInfo.cpp	2016-04-27 23:51:40 UTC (rev 200161)
@@ -46,7 +46,7 @@
     encoder << m_inStableState;
     encoder << m_isChangingObscuredInsetsInteractively;
     encoder << m_allowShrinkToFit;
-    encoder << m_enclosedInScrollView;
+    encoder << m_enclosedInScrollableAncestorView;
 }
 
 bool VisibleContentRectUpdateInfo::decode(IPC::ArgumentDecoder& decoder, VisibleContentRectUpdateInfo& result)
@@ -79,7 +79,7 @@
         return false;
     if (!decoder.decode(result.m_allowShrinkToFit))
         return false;
-    if (!decoder.decode(result.m_enclosedInScrollView))
+    if (!decoder.decode(result.m_enclosedInScrollableAncestorView))
         return false;
 
     return true;

Modified: trunk/Source/WebKit2/Shared/VisibleContentRectUpdateInfo.h (200160 => 200161)


--- trunk/Source/WebKit2/Shared/VisibleContentRectUpdateInfo.h	2016-04-27 23:51:35 UTC (rev 200160)
+++ trunk/Source/WebKit2/Shared/VisibleContentRectUpdateInfo.h	2016-04-27 23:51:40 UTC (rev 200161)
@@ -41,7 +41,7 @@
 
     VisibleContentRectUpdateInfo(const WebCore::FloatRect& exposedContentRect, const WebCore::FloatRect& unobscuredContentRect,
         const WebCore::FloatRect& unobscuredRectInScrollViewCoordinates, const WebCore::FloatRect& customFixedPositionRect,
-        const WebCore::FloatSize& obscuredInset, double scale, bool inStableState, bool isChangingObscuredInsetsInteractively, bool allowShrinkToFit, bool enclosedInScrollView,
+        const WebCore::FloatSize& obscuredInset, double scale, bool inStableState, bool isChangingObscuredInsetsInteractively, bool allowShrinkToFit, bool enclosedInScrollableAncestorView,
         double timestamp, double horizontalVelocity, double verticalVelocity, double scaleChangeRate, uint64_t lastLayerTreeTransactionId)
         : m_exposedContentRect(exposedContentRect)
         , m_unobscuredContentRect(unobscuredContentRect)
@@ -57,7 +57,7 @@
         , m_inStableState(inStableState)
         , m_isChangingObscuredInsetsInteractively(isChangingObscuredInsetsInteractively)
         , m_allowShrinkToFit(allowShrinkToFit)
-        , m_enclosedInScrollView(enclosedInScrollView)
+        , m_enclosedInScrollableAncestorView(enclosedInScrollableAncestorView)
     {
     }
 
@@ -71,7 +71,7 @@
     bool inStableState() const { return m_inStableState; }
     bool isChangingObscuredInsetsInteractively() const { return m_isChangingObscuredInsetsInteractively; }
     bool allowShrinkToFit() const { return m_allowShrinkToFit; }
-    bool enclosedInScrollView() const { return m_enclosedInScrollView; }
+    bool enclosedInScrollableAncestorView() const { return m_enclosedInScrollableAncestorView; }
 
     double timestamp() const { return m_timestamp; }
     double horizontalVelocity() const { return m_horizontalVelocity; }
@@ -98,7 +98,7 @@
     bool m_inStableState { false };
     bool m_isChangingObscuredInsetsInteractively { false };
     bool m_allowShrinkToFit { false };
-    bool m_enclosedInScrollView { false };
+    bool m_enclosedInScrollableAncestorView { false };
 };
 
 inline bool operator==(const VisibleContentRectUpdateInfo& a, const VisibleContentRectUpdateInfo& b)
@@ -114,7 +114,7 @@
         && a.scaleChangeRate() == b.scaleChangeRate()
         && a.inStableState() == b.inStableState()
         && a.allowShrinkToFit() == b.allowShrinkToFit()
-        && a.enclosedInScrollView() == b.enclosedInScrollView();
+        && a.enclosedInScrollableAncestorView() == b.enclosedInScrollableAncestorView();
 }
 
 } // namespace WebKit

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


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm	2016-04-27 23:51:35 UTC (rev 200160)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm	2016-04-27 23:51:40 UTC (rev 200161)
@@ -1986,6 +1986,19 @@
     [self _updateContentRectsWithState:isStableState];
 }
 
+static bool scrollViewCanScroll(UIScrollView *scrollView)
+{
+    if (!scrollView)
+        return NO;
+
+    UIEdgeInsets contentInset = scrollView.contentInset;
+    CGSize contentSize = scrollView.contentSize;
+    CGSize boundsSize = scrollView.bounds.size;
+
+    return (contentSize.width + contentInset.left + contentInset.right) > boundsSize.width
+        || (contentSize.height + contentInset.top + contentInset.bottom) > boundsSize.height;
+}
+
 - (void)_updateContentRectsWithState:(BOOL)inStableState
 {
     if (![self usesStandardContentView]) {
@@ -2042,7 +2055,7 @@
         scale:scaleFactor minimumScale:[_scrollView minimumZoomScale]
         inStableState:inStableState
         isChangingObscuredInsetsInteractively:_isChangingObscuredInsetsInteractively
-        enclosedInScrollView:[self _scroller] != nil];
+        enclosedInScrollableAncestorView:scrollViewCanScroll([self _scroller])];
 }
 
 - (void)_didFinishLoadForMainFrame

Modified: trunk/Source/WebKit2/UIProcess/ios/WKContentView.h (200160 => 200161)


--- trunk/Source/WebKit2/UIProcess/ios/WKContentView.h	2016-04-27 23:51:35 UTC (rev 200160)
+++ trunk/Source/WebKit2/UIProcess/ios/WKContentView.h	2016-04-27 23:51:40 UTC (rev 200161)
@@ -72,7 +72,7 @@
     scale:(CGFloat)scale minimumScale:(CGFloat)minimumScale
     inStableState:(BOOL)isStableState
     isChangingObscuredInsetsInteractively:(BOOL)isChangingObscuredInsetsInteractively
-    enclosedInScrollView:(BOOL)enclosedInScrollView;
+    enclosedInScrollableAncestorView:(BOOL)enclosedInScrollableAncestorView;
 
 - (void)didFinishScrolling;
 - (void)didInterruptScrolling;

Modified: trunk/Source/WebKit2/UIProcess/ios/WKContentView.mm (200160 => 200161)


--- trunk/Source/WebKit2/UIProcess/ios/WKContentView.mm	2016-04-27 23:51:35 UTC (rev 200160)
+++ trunk/Source/WebKit2/UIProcess/ios/WKContentView.mm	2016-04-27 23:51:40 UTC (rev 200161)
@@ -356,7 +356,7 @@
 }
 
 - (void)didUpdateVisibleRect:(CGRect)visibleRect unobscuredRect:(CGRect)unobscuredRect unobscuredRectInScrollViewCoordinates:(CGRect)unobscuredRectInScrollViewCoordinates
-    obscuredInset:(CGSize)obscuredInset scale:(CGFloat)zoomScale minimumScale:(CGFloat)minimumScale inStableState:(BOOL)isStableState isChangingObscuredInsetsInteractively:(BOOL)isChangingObscuredInsetsInteractively enclosedInScrollView:(BOOL)enclosedInScrollView
+    obscuredInset:(CGSize)obscuredInset scale:(CGFloat)zoomScale minimumScale:(CGFloat)minimumScale inStableState:(BOOL)isStableState isChangingObscuredInsetsInteractively:(BOOL)isChangingObscuredInsetsInteractively enclosedInScrollableAncestorView:(BOOL)enclosedInScrollableAncestorView
 {
     auto drawingArea = _page->drawingArea();
     if (!drawingArea)
@@ -381,7 +381,7 @@
         isStableState,
         isChangingObscuredInsetsInteractively,
         _webView._allowsViewportShrinkToFit,
-        enclosedInScrollView,
+        enclosedInScrollableAncestorView,
         timestamp,
         velocityData.horizontalVelocity,
         velocityData.verticalVelocity,

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


--- trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm	2016-04-27 23:51:35 UTC (rev 200160)
+++ trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm	2016-04-27 23:51:40 UTC (rev 200161)
@@ -2967,7 +2967,7 @@
 
     frameView.setUnobscuredContentSize(visibleContentRectUpdateInfo.unobscuredContentRect().size());
     m_page->setObscuredInset(visibleContentRectUpdateInfo.obscuredInset());
-    m_page->setEnclosedInScrollView(visibleContentRectUpdateInfo.enclosedInScrollView());
+    m_page->setEnclosedInScrollableAncestorView(visibleContentRectUpdateInfo.enclosedInScrollableAncestorView());
 
     double horizontalVelocity = visibleContentRectUpdateInfo.horizontalVelocity();
     double verticalVelocity = visibleContentRectUpdateInfo.verticalVelocity();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to