Bug 134150 - [iOS][WK2] Make the state restore from HistoryItem more precise and reliable
Summary: [iOS][WK2] Make the state restore from HistoryItem more precise and reliable
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Benjamin Poulain
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2014-06-20 20:51 PDT by Benjamin Poulain
Modified: 2014-06-23 15:06 PDT (History)
8 users (show)

See Also:


Attachments
Patch (61.10 KB, patch)
2014-06-20 21:29 PDT, Benjamin Poulain
no flags Details | Formatted Diff | Diff
Patch (61.11 KB, patch)
2014-06-23 12:30 PDT, Benjamin Poulain
thorton: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Benjamin Poulain 2014-06-20 20:51:01 PDT
[iOS][WK2] Make the state restore from HistoryItem more precise and reliable
Comment 1 Benjamin Poulain 2014-06-20 21:29:36 PDT
Created attachment 233506 [details]
Patch
Comment 2 Benjamin Poulain 2014-06-20 21:43:27 PDT
<rdar://problem/16031704>
Comment 3 Tim Horton 2014-06-20 22:49:13 PDT
Comment on attachment 233506 [details]
Patch

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

Too many things to take in right now, but some minor comments:

> Source/WebKit2/Shared/VisibleContentRectUpdateInfo.h:77
> +    uint64_t lastLayerTreeTransactionId() const { return m_lastLayerTreeTransactionId; }

it's ID, not Id, everywhere else

> Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm:2361
> +    // Skip any VisibleContentRectUpdate that have been queued before DidCommitLoad suppress the updates on the UIProcess.

there's at least one word missing in this sentence

> Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm:2362
> +    if (visibleContentRectUpdateInfo.lastLayerTreeTransactionId() <= m_lastLayerTreeTransactionBeforeDidCommitLoad)

shouldn't m_lastLayerTreeTransactionBeforeDidCommitLoad have "ID" in it somewhere?

> Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h:56
> +    uint64_t currentTransactionID() { return m_currentTransactionID; }

const
Comment 4 Anders Carlsson 2014-06-21 11:32:19 PDT
Comment on attachment 233506 [details]
Patch

Let's not add more things to HistoryItem; I'm working on a better way to do state restoration, and I'm planning to have something landed early next week. Maybe we can revisit this patch then?
Comment 5 Benjamin Poulain 2014-06-21 12:50:01 PDT
(In reply to comment #4)
> (From update of attachment 233506 [details])
> Let's not add more things to HistoryItem; I'm working on a better way to do state restoration, and I'm planning to have something landed early next week. Maybe we can revisit this patch then?

Are you kidding? I have been debugging this crap for a week. Why didn't you mention it last monday?
Comment 6 Benjamin Poulain 2014-06-23 12:30:21 PDT
Created attachment 233626 [details]
Patch
Comment 7 Tim Horton 2014-06-23 14:05:21 PDT
Comment on attachment 233626 [details]
Patch

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

> Source/WebCore/history/CachedPage.cpp:93
> +        bool hadProhibitsScrolling = false;

maybe explain this in the changelog?

> Source/WebCore/loader/HistoryController.cpp:82
> +    FrameView& frameView = *m_frame.view();

might as well move this up a little further and use it in more places

> Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm:176
> +    uint64_t _firstTransactionIdAfterPageRestore;

ID, not Id.

> Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm:785
> +    if (_needsToRestoreExposedRect && layerTreeTransaction.transactionID() >= _firstTransactionIdAfterPageRestore) {

can we factor out the layerTreeTransaction.transactionID() >= _firstTransactionIdAfterPageRestore from these two blocks

> Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm:832
> +- (void)_restorePageSateToExposedRect:(WebCore::FloatRect)exposedRect scale:(double)scale

typo "Sate"

> Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm:847
> +- (void)_restorePageSateToUnobscuredCenter:(WebCore::FloatPoint)center scale:(double)scale

typo "Sate"

> Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm:857
> +    _firstTransactionIdAfterPageRestore = toRemoteLayerTreeDrawingAreaProxy(_page->drawingArea())->nextLayerTreeTransactionID();

ID

> Source/WebKit2/UIProcess/WebPageProxy.h:1201
> +    void restorePageSate(const WebCore::FloatRect&, double scale);

so many Sates

> Source/WebKit2/WebProcess/WebCoreSupport/ios/WebFrameLoaderClientIOS.mm:94
> +        if (m_frame->isMainFrame())
> +            m_frame->page()->restorePageState(*currentItem);

might as well use frame instead of m_frame

> Source/WebKit2/WebProcess/WebPage/WebPage.h:1220
> +    uint64_t m_lastLayerTreeTransactionIdBeforeDidCommitLoad;

ID

> Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm:171
> +        // When the content size change, we keep the same relative horizontal content width in view, otherwise we would

change*s*

> Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm:172
> +        // end up zoom to far in landscape->portrait, and too close in portrait->landscape.

zoom*ed*, to*o*
Comment 8 Benjamin Poulain 2014-06-23 15:06:17 PDT
Committed r170325: <http://trac.webkit.org/changeset/170325>