Changeset 249230 in webkit


Ignore:
Timestamp:
Aug 28, 2019 7:07:35 PM (5 years ago)
Author:
timothy_horton@apple.com
Message:

Reloading a web view with a fixed-width viewport and variable content width restores the previous page scale, shouldn't
https://bugs.webkit.org/show_bug.cgi?id=201256
<rdar://problem/54809509>

Reviewed by Simon Fraser.

Source/WebKit:

  • WebProcess/WebPage/ios/WebPageIOS.mm:

(WebKit::WebPage::restorePageState):
When restoring page state from a history item, if the saved scale was equal to the
initial scale at the time it was saved, ignore the saved scale and use the current
initial scale instead.

Normally this doesn't matter because a given page's initial scale doesn't usually change
between loads, but it totally can! See the test for one example of a way an API client
might cause this; you could also imagine something similar happening if the actual
page content changed.

Tools:

  • TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
  • TestWebKitAPI/Tests/WebKit/long-email-viewport.html: Added.
  • TestWebKitAPI/Tests/WebKitCocoa/ReloadWithDifferingInitialScale.mm: Added.

(TestWebKitAPI::TEST):
Add a test. I left many comments because I had a great deal of trouble
writing this test and wanted to document my findings.

Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r249224 r249230  
     12019-08-28  Tim Horton  <timothy_horton@apple.com>
     2
     3        Reloading a web view with a fixed-width viewport and variable content width restores the previous page scale, shouldn't
     4        https://bugs.webkit.org/show_bug.cgi?id=201256
     5        <rdar://problem/54809509>
     6
     7        Reviewed by Simon Fraser.
     8
     9        * WebProcess/WebPage/ios/WebPageIOS.mm:
     10        (WebKit::WebPage::restorePageState):
     11        When restoring page state from a history item, if the saved scale was equal to the
     12        initial scale at the time it was saved, ignore the saved scale and use the current
     13        initial scale instead.
     14
     15        Normally this doesn't matter because a given page's initial scale doesn't usually change
     16        between loads, but it totally can! See the test for one example of a way an API client
     17        might cause this; you could also imagine something similar happening if the actual
     18        page content changed.
     19
    1202019-08-28  Megan Gardner  <megan_gardner@apple.com>
    221
  • trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm

    r249217 r249230  
    380380    FloatSize currentMinimumLayoutSizeInScrollViewCoordinates = m_viewportConfiguration.minimumLayoutSize();
    381381    if (historyItem.minimumLayoutSizeInScrollViewCoordinates() == currentMinimumLayoutSizeInScrollViewCoordinates) {
    382         float boundedScale = std::min<float>(m_viewportConfiguration.maximumScale(), std::max<float>(m_viewportConfiguration.minimumScale(), historyItem.pageScaleFactor()));
     382        float boundedScale = historyItem.scaleIsInitial() ? m_viewportConfiguration.initialScale() : historyItem.pageScaleFactor();
     383        boundedScale = std::min<float>(m_viewportConfiguration.maximumScale(), std::max<float>(m_viewportConfiguration.minimumScale(), boundedScale));
    383384        scalePage(boundedScale, IntPoint());
    384385
  • trunk/Tools/ChangeLog

    r249227 r249230  
     12019-08-28  Tim Horton  <timothy_horton@apple.com>
     2
     3        Reloading a web view with a fixed-width viewport and variable content width restores the previous page scale, shouldn't
     4        https://bugs.webkit.org/show_bug.cgi?id=201256
     5        <rdar://problem/54809509>
     6
     7        Reviewed by Simon Fraser.
     8
     9        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
     10        * TestWebKitAPI/Tests/WebKit/long-email-viewport.html: Added.
     11        * TestWebKitAPI/Tests/WebKitCocoa/ReloadWithDifferingInitialScale.mm: Added.
     12        (TestWebKitAPI::TEST):
     13        Add a test. I left many comments because I had a great deal of trouble
     14        writing this test and wanted to document my findings.
     15
    1162019-08-28  Jonathan Bedard  <jbedard@apple.com>
    217
  • trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj

    r249115 r249230  
    127127                2D2BEB2D22324E5F005544CA /* RequestTextInputContext.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D2BEB2C22324E5F005544CA /* RequestTextInputContext.mm */; };
    128128                2D2D13B3229F408B005068AF /* DeviceManagementRestrictions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D2D13B2229F408B005068AF /* DeviceManagementRestrictions.mm */; };
     129                2D2FE8D82315F06E00B2E9C9 /* ReloadWithDifferingInitialScale.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D2FE8D72315F06D00B2E9C9 /* ReloadWithDifferingInitialScale.mm */; };
     130                2D2FE8DA231745C900B2E9C9 /* long-email-viewport.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 2D2FE8D9231745AB00B2E9C9 /* long-email-viewport.html */; };
    129131                2D3CA3A8221DF4B40088E803 /* PageOverlayPlugin.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D3CA3A4221DF2390088E803 /* PageOverlayPlugin.mm */; };
    130132                2D4CF8BD1D8360CC0001CE8D /* WKThumbnailView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D4CF8BC1D8360CC0001CE8D /* WKThumbnailView.mm */; };
     
    13221324                                46C519E81D3563FD00DAA51A /* LocalStorageNullEntries.localstorage-shm in Copy Resources */,
    13231325                                7A6A2C721DCCFB5200C0D085 /* LocalStorageQuirkEnabled.html in Copy Resources */,
     1326                                2D2FE8DA231745C900B2E9C9 /* long-email-viewport.html in Copy Resources */,
    13241327                                C9E8EE7521DED94300797765 /* long-test.mp4 in Copy Resources */,
    13251328                                9361002914DC95A70061379D /* lots-of-iframes.html in Copy Resources */,
     
    15691572                2D2BEB2C22324E5F005544CA /* RequestTextInputContext.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RequestTextInputContext.mm; sourceTree = "<group>"; };
    15701573                2D2D13B2229F408B005068AF /* DeviceManagementRestrictions.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DeviceManagementRestrictions.mm; sourceTree = "<group>"; };
     1574                2D2FE8D72315F06D00B2E9C9 /* ReloadWithDifferingInitialScale.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ReloadWithDifferingInitialScale.mm; sourceTree = "<group>"; };
     1575                2D2FE8D9231745AB00B2E9C9 /* long-email-viewport.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "long-email-viewport.html"; sourceTree = "<group>"; };
    15711576                2D3CA3A4221DF2390088E803 /* PageOverlayPlugin.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PageOverlayPlugin.mm; sourceTree = "<group>"; };
    15721577                2D4CF8BC1D8360CC0001CE8D /* WKThumbnailView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WKThumbnailView.mm; path = WebKit/WKThumbnailView.mm; sourceTree = "<group>"; };
     
    28312836                                5CFACF64226FD1FB0056C7D0 /* Proxy.mm */,
    28322837                                A1C4FB6C1BACCE50003742D0 /* QuickLook.mm */,
     2838                                2D2FE8D72315F06D00B2E9C9 /* ReloadWithDifferingInitialScale.mm */,
    28332839                                1A4F81D01BDFFDCF004E672E /* RemoteObjectRegistry.h */,
    28342840                                1A4F81C81BDFFD18004E672E /* RemoteObjectRegistry.mm */,
     
    36963702                                8349D3C31DB9724F004A9F65 /* link-with-download-attribute.html */,
    36973703                                378E647816326FDF00B6C676 /* link-with-title.html */,
     3704                                2D2FE8D9231745AB00B2E9C9 /* long-email-viewport.html */,
    36983705                                C9E8EE7421DED91E00797765 /* long-test.mp4 */,
    36993706                                9361002814DC957B0061379D /* lots-of-iframes.html */,
     
    46454652                                6B4E861C2220A5520022F389 /* RegistrableDomain.cpp in Sources */,
    46464653                                7CCE7F0D1A411AE600447C4C /* ReloadPageAfterCrash.cpp in Sources */,
     4654                                2D2FE8D82315F06E00B2E9C9 /* ReloadWithDifferingInitialScale.mm in Sources */,
    46474655                                7C83E0C31D0A653A00FEBCF3 /* RemoteObjectRegistry.mm in Sources */,
    46484656                                7CCE7EC91A411A7E00447C4C /* RenderedImageFromDOMNode.mm in Sources */,
Note: See TracChangeset for help on using the changeset viewer.