Bug 104767

Summary: WebViewImpl::resetScrollAndScaleState() causes the page to render incorrectly
Product: WebKit Reporter: dfalcantara
Component: WebKit Misc.Assignee: dfalcantara
Status: RESOLVED FIXED    
Severity: Normal CC: abarth, aelias, dglazkov, fishd, jamesr, japhet, tkent+wkapi, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Android   
OS: Android   
URL: http://crbug.com/165436
Attachments:
Description Flags
Patch
none
Patch none

dfalcantara
Reported 2012-12-11 22:22:44 PST
Follow up of https://bugs.webkit.org/show_bug.cgi?id=90222 The patch set applied in the above bug is meant to avoid issues where the page would be zoomed in and scrolled incorrectly after a page has been reloaded with an override URL. It does so by resetting the page's scale factor to 0.0f (which is a special value for HistoryController::restoreScrollPositionAndViewState()) and then saving it to the HistoryItem. While this was working on Android, it was not working on ChromeOS when it landed (http://crbug.com/153907). Recently, this stopped working on Android, as well, resulting in black page loads if called (http://crbug.com/165436). There are two workarounds that get this working again: * The original version of the patch in the original WebKit bug avoids this issue by directly setting the HistoryItem values instead of indirectly setting them through setPageScaleFactor(0.0). Later versions of the patch flipped this around, apparently breaking things. * Moving the resetScrollAndScaleState() call to RenderViewImpl::didFirstVisuallyNonEmptyLayout() from RenderViewImpl::didCommitProvisionalLoad() in chromium also appears to work, but this might cause a secondary reload.
Attachments
Patch (4.26 KB, patch)
2012-12-11 22:30 PST, dfalcantara
no flags
Patch (5.59 KB, patch)
2012-12-12 12:07 PST, dfalcantara
no flags
dfalcantara
Comment 1 2012-12-11 22:30:38 PST
dfalcantara
Comment 2 2012-12-11 22:32:44 PST
The attached patch goes with option 1 and changes the way the WebKit function works.
WebKit Review Bot
Comment 3 2012-12-11 22:34:19 PST
Please wait for approval from abarth@webkit.org, dglazkov@chromium.org, fishd@chromium.org, jamesr@chromium.org or tkent@chromium.org before submitting, as this patch contains changes to the Chromium public API. See also https://trac.webkit.org/wiki/ChromiumWebKitAPI.
Alexandre Elias
Comment 4 2012-12-12 00:09:05 PST
Comment on attachment 178969 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=178969&action=review Note that I recommended this change because it's unsafe to set pageScaleFactor to 0: code elsewhere doesn't know what to do with that and will just shrink the document to a point. The 0 value is only valid within a historyItem. > Source/WebKit/chromium/src/WebViewImpl.cpp:-3093 > - page()->setPageScaleFactor(0, IntPoint()); Let's keep this line but change it to "page()->setPageScaleFactor(1, IntPoint());" so that non-history-item-related callers still get the reset behavior. > Source/WebKit/chromium/src/WebViewImpl.cpp:3093 > + // Clear out the values for the current history item. Add extra comment: "This will prevent the history item from clobbering the value determined during page scale initialization, which may be less than 1." > Source/WebKit/chromium/src/WebViewImpl.cpp:3095 > + RefPtr<HistoryItem> currentItem = m_page->mainFrame()->loader()->history()->currentItem(); I'm thinking we should just move these lines to a new method "HistoryController::clearDocumentAndScrollState()". That would be a reasonable method for HistoryController to have.
dfalcantara
Comment 5 2012-12-12 12:07:16 PST
Alexandre Elias
Comment 6 2012-12-12 12:15:57 PST
LGTM, thanks.
dfalcantara
Comment 7 2012-12-12 12:23:05 PST
(In reply to comment #0) > * Moving the resetScrollAndScaleState() call to RenderViewImpl::didFirstVisuallyNonEmptyLayout() from RenderViewImpl::didCommitProvisionalLoad() in chromium also appears to work, but this might cause a secondary reload. Meant re-layout instead of reload.
WebKit Review Bot
Comment 8 2012-12-14 17:22:28 PST
Comment on attachment 179098 [details] Patch Clearing flags on attachment: 179098 Committed r137792: <http://trac.webkit.org/changeset/137792>
WebKit Review Bot
Comment 9 2012-12-14 17:22:33 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.