Changeset 170461 in webkit


Ignore:
Timestamp:
Jun 25, 2014 9:15:40 PM (10 years ago)
Author:
Simon Fraser
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):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r170459 r170461  
     12014-06-25  Simon Fraser  <simon.fraser@apple.com>
     2
     3        [iOS WK2] Tweak the logic used to choose the scale at which position:fixed gets pushed out of view
     4        https://bugs.webkit.org/show_bug.cgi?id=134323
     5
     6        Reviewed by Benjamin Poulain.
     7
     8        Previously we used a fixed scale (1.2x) at which we'd start pushing position:fixed elements
     9        out of the viewport. This worked well on iPad, but terribly on iPhone. Instead, choose a scale
     10        relative to how much of the page is visible width-wise, the threshold being 2/3 of the page width.
     11        The width is clamped to get reasonable behavior on wide pages.
     12
     13        * page/FrameView.cpp:
     14        (WebCore::FrameView::rectForViewportConstrainedObjects):
     15
    1162014-06-25  Brady Eidson  <beidson@apple.com>
    217
  • trunk/Source/WebCore/page/FrameView.cpp

    r170297 r170461  
    16361636        return visibleContentRect;
    16371637   
     1638    if (totalContentsSize.isEmpty())
     1639        return visibleContentRect;
     1640
    16381641    // We impose an lower limit on the size (so an upper limit on the scale) of
    16391642    // the rect used to position fixed objects so that they don't crowd into the
    16401643    // center of the screen at larger scales.
    1641     const float constraintThresholdScale = 1.2;
    1642 
     1644    const LayoutUnit maxContentWidthForZoomThreshold = LayoutUnit::fromPixel(1024);
     1645    float zoomedOutScale = frameScaleFactor * visibleContentRect.width() / std::min(maxContentWidthForZoomThreshold, totalContentsSize.width());
     1646    float constraintThresholdScale = 1.5 * zoomedOutScale;
    16431647    float maxPostionedObjectsRectScale = std::min(frameScaleFactor, constraintThresholdScale);
    16441648
Note: See TracChangeset for help on using the changeset viewer.