• Ali Juma's avatar
    Make CRWWebController::webViewScrollViewDidResetContentSize workaround more targetted · de7a28aa
    Ali Juma authored
    webViewScrollViewDidResetContentSize interprets the scroll view's content size's
    width being narrower than the frame's width as a sign that WebKit hasn't
    properly resized the content, so resets zoom scale to force WebKit to
    re-render. However, the zoom scale that makes the content fit exactly within
    the width of the frame may not be exactly representable as a float. In this
    case, the content size's width can be up to a pixel narrower than the frame
    width. There's no benefit to forcing a re-render in this case, and furthermore,
    resetting the zoom scale causes the page to scroll, which may trigger the page's
    content to spuriously change. In the worst case, this can lead to a never-ending
    cycle of resetting the zoom scale, the page scrolling, the page changing,
    resetting the zoom scale again, and so on.
    
    This CL makes webViewScrollViewDidResetContentSize ignore cases where the
    contentSize's width is up to a pixel narrower than the frame.
    
    Bug: 822697
    Change-Id: I93e3e7efb33a6ea3b931c0d7f2b404bf93e80e12
    Reviewed-on: https://chromium-review.googlesource.com/c/1348955Reviewed-by: default avatarEugene But <eugenebut@chromium.org>
    Reviewed-by: default avatarKurt Horimoto <kkhorimoto@chromium.org>
    Commit-Queue: Ali Juma <ajuma@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#611104}
    de7a28aa
crw_web_controller.mm 240 KB