Title: [186928] branches/safari-601.1-branch/Source

Diff

Modified: branches/safari-601.1-branch/Source/WebCore/ChangeLog (186927 => 186928)


--- branches/safari-601.1-branch/Source/WebCore/ChangeLog	2015-07-17 03:59:31 UTC (rev 186927)
+++ branches/safari-601.1-branch/Source/WebCore/ChangeLog	2015-07-17 05:32:19 UTC (rev 186928)
@@ -1,3 +1,27 @@
+2015-07-16  Matthew Hanson  <matthew_han...@apple.com>
+
+        Merge r186786. rdar://problem/9222837
+
+    2015-07-13  Simon Fraser  <simon.fra...@apple.com>
+
+            [iOS WK2] When choosing an initial viewport scale, take overflow on the <body> into account
+            https://bugs.webkit.org/show_bug.cgi?id=146918
+            rdar://problem/9222837
+
+            Reviewed by Tim Horton.
+
+            Use as input to the viewport scaling algorithm a contents size from the FrameView
+            that takes overflow on the viewport renderer into account. This prevents unexpected
+            viewports scaling on pages that have content that overflows their expressed contents size,
+            but apply overflow to the <body>.
+
+            * page/FrameView.cpp:
+            (WebCore::FrameView::contentsSizeRespectingOverflow): Look for overflow:hidden on each axis of
+            the m_viewportRenderer, which is computed post-layout by calculateScrollbarModesForLayout()
+            and is used for scrollbar logic on OS X. Clip unscaledDocumentRect on each axis, and then
+            apply page scale.
+            * page/FrameView.h:
+
 2015-07-16  Lucas Forschler  <lforsch...@apple.com>
 
         Merge r186764. rdar://problem/20923632

Modified: branches/safari-601.1-branch/Source/WebCore/page/FrameView.cpp (186927 => 186928)


--- branches/safari-601.1-branch/Source/WebCore/page/FrameView.cpp	2015-07-17 03:59:31 UTC (rev 186927)
+++ branches/safari-601.1-branch/Source/WebCore/page/FrameView.cpp	2015-07-17 05:32:19 UTC (rev 186928)
@@ -617,6 +617,29 @@
     setContentsSize(size);
 }
 
+IntSize FrameView::contentsSizeRespectingOverflow() const
+{
+    RenderView* renderView = this->renderView();
+    if (!renderView || !m_viewportRenderer || !is<RenderBox>(m_viewportRenderer) || !frame().isMainFrame())
+        return contentsSize();
+
+    ASSERT(frame().view() == this);
+
+    FloatRect contentRect = renderView->unscaledDocumentRect();
+    RenderBox& viewportRendererBox = downcast<RenderBox>(*m_viewportRenderer);
+
+    if (m_viewportRenderer->style().overflowX() == OHIDDEN)
+        contentRect.setWidth(std::min<float>(contentRect.width(), viewportRendererBox.frameRect().width()));
+
+    if (m_viewportRenderer->style().overflowY() == OHIDDEN)
+        contentRect.setHeight(std::min<float>(contentRect.height(), viewportRendererBox.frameRect().height()));
+
+    if (renderView->hasTransform())
+        contentRect = renderView->layer()->currentTransform().mapRect(contentRect);
+
+    return IntSize(contentRect.size());
+}
+
 void FrameView::applyOverflowToViewport(RenderElement* renderer, ScrollbarMode& hMode, ScrollbarMode& vMode)
 {
     // Handle the overflow:hidden/scroll case for the body/html elements.  WinIE treats

Modified: branches/safari-601.1-branch/Source/WebCore/page/FrameView.h (186927 => 186928)


--- branches/safari-601.1-branch/Source/WebCore/page/FrameView.h	2015-07-17 03:59:31 UTC (rev 186927)
+++ branches/safari-601.1-branch/Source/WebCore/page/FrameView.h	2015-07-17 05:32:19 UTC (rev 186928)
@@ -105,6 +105,8 @@
     virtual void setContentsSize(const IntSize&) override;
     virtual void updateContentsSize() override;
 
+    WEBCORE_EXPORT IntSize contentsSizeRespectingOverflow() const;
+
     void layout(bool allowSubtree = true);
     WEBCORE_EXPORT bool didFirstLayout() const;
     void layoutTimerFired();

Modified: branches/safari-601.1-branch/Source/WebKit2/ChangeLog (186927 => 186928)


--- branches/safari-601.1-branch/Source/WebKit2/ChangeLog	2015-07-17 03:59:31 UTC (rev 186927)
+++ branches/safari-601.1-branch/Source/WebKit2/ChangeLog	2015-07-17 05:32:19 UTC (rev 186928)
@@ -1,3 +1,24 @@
+2015-07-16  Matthew Hanson  <matthew_han...@apple.com>
+
+        Merge r186786. rdar://problem/9222837
+
+    2015-07-13  Simon Fraser  <simon.fra...@apple.com>
+
+            [iOS WK2] When choosing an initial viewport scale, take overflow on the <body> into account
+            https://bugs.webkit.org/show_bug.cgi?id=146918
+            rdar://problem/9222837
+
+            Reviewed by Tim Horton.
+
+            Use as input to the viewport scaling algorithm a contents size from the FrameView
+            that takes overflow on the viewport renderer into account. This prevents unexpected
+            viewports scaling on pages that have content that overflows their expressed contents size,
+            but apply overflow to the <body>.
+
+            * WebProcess/WebPage/WebPage.cpp:
+            (WebKit::WebPage::mainFrameDidLayout): Use contentsSizeRespectingOverflow(),
+            rather than raw contentsSize(), to determine scaling.
+
 2015-07-13  Babak Shafiei  <bshaf...@apple.com>
 
         Merge r186777.

Modified: branches/safari-601.1-branch/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (186927 => 186928)


--- branches/safari-601.1-branch/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2015-07-17 03:59:31 UTC (rev 186927)
+++ branches/safari-601.1-branch/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2015-07-17 05:32:19 UTC (rev 186928)
@@ -3508,7 +3508,7 @@
 #endif
 #if PLATFORM(IOS)
     if (FrameView* frameView = mainFrameView()) {
-        IntSize newContentSize = frameView->contentsSize();
+        IntSize newContentSize = frameView->contentsSizeRespectingOverflow();
         if (m_viewportConfiguration.contentsSize() != newContentSize) {
             m_viewportConfiguration.setContentsSize(newContentSize);
             viewportConfigurationChanged();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to