Bug 132307

Summary: [iOS][WK2] Restore the scroll position and scale from the HistoryItem (mostly)
Product: WebKit Reporter: Benjamin Poulain <benjamin>
Component: New BugsAssignee: Benjamin Poulain <benjamin>
Status: RESOLVED FIXED    
Severity: Normal CC: simon.fraser
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch none

Description Benjamin Poulain 2014-04-28 15:30:49 PDT
[iOS][WK2] Restore the scroll position and scale from the HistoryItem (mostly)
Comment 1 Benjamin Poulain 2014-04-28 15:37:56 PDT
Created attachment 230328 [details]
Patch
Comment 2 Simon Fraser (smfr) 2014-04-28 16:20:16 PDT
Comment on attachment 230328 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=230328&action=review

> Source/WebKit2/WebProcess/WebCoreSupport/ios/WebFrameLoaderClientIOS.mm:90
> +            if (page && m_frame->isMainFrame() && currentItem->pageScaleFactor())
> +                m_frame->page()->restorePageState(currentItem->pageScaleFactor(), currentItem->scrollPoint());

Is the currentItem->pageScaleFactor() test useful, or just trying to catch odd uninitialized cases?

> Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm:144
> +    FrameView& frameView = *m_page->mainFrame().view();
> +    frameView.setScrollPosition(scrollPosition);

Odd to put FrameView in a local when you only use it once.

> Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm:145
> +    m_userHasChangedPageScaleFactor = true;

Why? Add a comment?
Comment 3 Benjamin Poulain 2014-04-28 17:49:26 PDT
(In reply to comment #2)
> (From update of attachment 230328 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=230328&action=review
> 
> > Source/WebKit2/WebProcess/WebCoreSupport/ios/WebFrameLoaderClientIOS.mm:90
> > +            if (page && m_frame->isMainFrame() && currentItem->pageScaleFactor())
> > +                m_frame->page()->restorePageState(currentItem->pageScaleFactor(), currentItem->scrollPoint());
> 
> Is the currentItem->pageScaleFactor() test useful, or just trying to catch odd uninitialized cases?

Zero is the default value of HistoryItem.

It is a weird API, I would prefer if HistoryItem would keep a separate state to know if values have been set. Relying on the default pageScaleFactor is odd.
Comment 4 Benjamin Poulain 2014-04-28 18:20:27 PDT
Created attachment 230345 [details]
Patch
Comment 5 Benjamin Poulain 2014-04-28 18:31:12 PDT
Committed r167916: <http://trac.webkit.org/changeset/167916>
Comment 6 Benjamin Poulain 2014-04-28 18:31:57 PDT
Comment on attachment 230345 [details]
Patch

Uploaded this again by accident.
Comment 7 Simon Fraser (smfr) 2014-07-24 11:50:05 PDT
<rdar://problem/16031704>