Title: [170461] trunk/Source/WebCore
Revision
170461
Author
simon.fra...@apple.com
Date
2014-06-25 21:15:40 -0700 (Wed, 25 Jun 2014)

Log Message

[iOS WK2] Tweak the logic used to choose the scale at which position:fixed gets pushed out of view
https://bugs.webkit.org/show_bug.cgi?id=134323

Reviewed by Benjamin Poulain.

Previously we used a fixed scale (1.2x) at which we'd start pushing position:fixed elements
out of the viewport. This worked well on iPad, but terribly on iPhone. Instead, choose a scale
relative to how much of the page is visible width-wise, the threshold being 2/3 of the page width.
The width is clamped to get reasonable behavior on wide pages.

* page/FrameView.cpp:
(WebCore::FrameView::rectForViewportConstrainedObjects):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (170460 => 170461)


--- trunk/Source/WebCore/ChangeLog	2014-06-26 04:15:32 UTC (rev 170460)
+++ trunk/Source/WebCore/ChangeLog	2014-06-26 04:15:40 UTC (rev 170461)
@@ -1,3 +1,18 @@
+2014-06-25  Simon Fraser  <simon.fra...@apple.com>
+
+        [iOS WK2] Tweak the logic used to choose the scale at which position:fixed gets pushed out of view
+        https://bugs.webkit.org/show_bug.cgi?id=134323
+
+        Reviewed by Benjamin Poulain.
+
+        Previously we used a fixed scale (1.2x) at which we'd start pushing position:fixed elements
+        out of the viewport. This worked well on iPad, but terribly on iPhone. Instead, choose a scale
+        relative to how much of the page is visible width-wise, the threshold being 2/3 of the page width.
+        The width is clamped to get reasonable behavior on wide pages.
+
+        * page/FrameView.cpp:
+        (WebCore::FrameView::rectForViewportConstrainedObjects):
+
 2014-06-25  Brady Eidson  <beid...@apple.com>
 
         Add new platform gamepad abstractions

Modified: trunk/Source/WebCore/page/FrameView.cpp (170460 => 170461)


--- trunk/Source/WebCore/page/FrameView.cpp	2014-06-26 04:15:32 UTC (rev 170460)
+++ trunk/Source/WebCore/page/FrameView.cpp	2014-06-26 04:15:40 UTC (rev 170461)
@@ -1635,11 +1635,15 @@
     if (fixedElementsLayoutRelativeToFrame)
         return visibleContentRect;
     
+    if (totalContentsSize.isEmpty())
+        return visibleContentRect;
+
     // We impose an lower limit on the size (so an upper limit on the scale) of
     // the rect used to position fixed objects so that they don't crowd into the
     // center of the screen at larger scales.
-    const float constraintThresholdScale = 1.2;
-
+    const LayoutUnit maxContentWidthForZoomThreshold = LayoutUnit::fromPixel(1024);
+    float zoomedOutScale = frameScaleFactor * visibleContentRect.width() / std::min(maxContentWidthForZoomThreshold, totalContentsSize.width());
+    float constraintThresholdScale = 1.5 * zoomedOutScale;
     float maxPostionedObjectsRectScale = std::min(frameScaleFactor, constraintThresholdScale);
 
     LayoutRect viewportConstrainedObjectsRect = visibleContentRect;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to