Bug 49550

Summary: Refactoring: use PlatformBridge to set scroll position in Android scroll view.
Product: WebKit Reporter: sw <swang>
Component: HistoryAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: andreip, benm, commit-queue, steveblock, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: OS X 10.5   
Attachments:
Description Flags
Fix android specific history bug.
none
Fix android specific history bug.
none
Use platform bridge to set scroll position. this fixes layering violation.
none
Use platform bridge to set scroll position. this fixes layering violation.
none
Use platform bridge to set scroll position. this fixes layering violation.
none
Use platform bridge to set scroll position. this fixes layering violation.
none
Use platform bridge to set scroll position. this fixes layering violation. none

Description sw 2010-11-15 10:47:37 PST
Fix android specific history bug

This issue is related to how android implements view position restoration.  The fix is to only send main view's restoration to android specific code.
Comment 1 sw 2010-11-15 11:30:28 PST
Created attachment 73917 [details]
Fix android specific history bug.

Make sure only main frame view's position is restored.
Comment 2 sw 2010-11-15 15:43:59 PST
who should review my change?
Comment 3 Andrei Popescu 2010-11-16 03:51:33 PST
> No new tests. (OOPS!)

Please remove this and explain why you don't add a test.

> // Sometimes the parent scrollView is not set for some iFrame when it's first loaded
>// in case of history going back.

Just curious: can you please provide more info about the circumstances when the parent is not set?

> android::WebViewCore *webViewCore = android::WebViewCore::getWebViewCore(this);

There should not be Android namespace code in WebCore, this is a layering violation. You should use the PlatformBridge instead. I know you haven't introduced this yourself in this patch but it'd be good to think how to address the layering violations in this file.
Comment 4 sw 2010-11-16 10:51:52 PST
Created attachment 74011 [details]
Fix android specific history bug.

Thanks Andrei for review.  I update the patch; and will think about how to remove the android namespace.
Comment 5 sw 2010-11-17 09:24:22 PST
hi, Andrei/Ben/Steve,

Could you review this again?

Thanks

Simon
Comment 6 Steve Block 2010-11-22 04:58:33 PST
Comment on attachment 74011 [details]
Fix android specific history bug.

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

> WebCore/platform/android/ScrollViewAndroid.cpp:75
> +    // engadget.com site, you go to some article then hit back.

I think the right place for these kind of details are in the bug, not in comments, and it would be good to understand the underlying problem, rather than just listing a test case.

> WebCore/platform/android/ScrollViewAndroid.cpp:77
> +    android::WebViewCore *webViewCore = android::WebViewCore::getWebViewCore(this);

Layering violation, as Andrei says.
Comment 7 sw 2010-11-22 14:33:48 PST
Created attachment 74598 [details]
Use platform bridge to set scroll position.  this fixes layering violation.

Use platform bridge to set scroll position.  this fixes layering violation.  since PlatformBridge.cpp is in webkit and is not upstreamed, so this patch doesn't include that file.  Also it seems the platformBridge.h and scrollviewAndroid.cpp are very outdated.
Comment 8 Steve Block 2010-11-23 02:14:46 PST
Comment on attachment 74598 [details]
Use platform bridge to set scroll position.  this fixes layering violation.

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

> WebCore/ChangeLog:5
> +        Use platform bridge to set scroll position.

You should update the bug title to match this updated description.

> WebCore/ChangeLog:9
> +        test introduced.

The patch no longer has anything to do with browsing history. In any case, LayoutTests are to test platform-independent functionality. This is a change to the Android implementation, so 'Refactoring only, tested by existing tests' suffices.

> WebCore/platform/android/PlatformBridge.h:109
> +    static void setScrollPosition(ScrollView*, int, int);

you should name the two int params, as it's not clear from their types what they are.
Comment 9 sw 2010-11-23 10:51:42 PST
Created attachment 74680 [details]
Use platform bridge to set scroll position.  this fixes layering violation.

Refactoring to prevent layering violation.
Comment 10 Steve Block 2010-11-23 10:56:37 PST
Comment on attachment 74680 [details]
Use platform bridge to set scroll position.  this fixes layering violation.

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

> WebCore/ChangeLog:11
> +        (WebCore::ScrollView::platformSetScrollPosition):

PlatformBridge.h seems to be missing? You should probably re-run prepare-ChangeLog.

> WebCore/platform/android/PlatformBridge.h:109
> +    static void setScrollPosition(ScrollView* scrollView, int x, int y);

Don't need to name 'scrollView' as it's obvious from its type.
Comment 11 sw 2010-11-23 11:03:49 PST
Created attachment 74683 [details]
Use platform bridge to set scroll position.  this fixes layering violation.

Refactoring only.
Comment 12 Steve Block 2010-11-23 11:06:17 PST
Comment on attachment 74683 [details]
Use platform bridge to set scroll position.  this fixes layering violation.

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

Do you want cq too? You can set cq? to request this.

> WebCore/ChangeLog:5
> +        Use platform bridge to set scroll position.

Need a link to the bug URL
Comment 13 sw 2010-11-23 11:34:24 PST
Created attachment 74684 [details]
Use platform bridge to set scroll position.  this fixes layering violation.

Refactoring only.  Thanks Steve for reviewing.
Comment 14 WebKit Review Bot 2010-11-23 11:37:29 PST
Attachment 74684 [details] did not pass style-queue:

Failed to run "['WebKitTools/Scripts/check-webkit-style', '--diff-files', u'WebCore/ChangeLog', u'WebCore/platform/android/PlatformBridge.h', u'WebCore/platform/android/ScrollViewAndroid.cpp']" exit_code: 1
WebCore/ChangeLog:6:  Line contains tab character.  [whitespace/tab] [5]
Total errors found: 1 in 3 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 15 sw 2010-11-23 11:38:44 PST
Created attachment 74685 [details]
Use platform bridge to set scroll position.  this fixes layering violation.

Refactoring only.
Comment 16 Steve Block 2010-11-23 13:20:38 PST
Comment on attachment 74685 [details]
Use platform bridge to set scroll position.  this fixes layering violation.

r=me
Comment 17 sw 2010-11-23 13:28:34 PST
thanks a lot Steve for all the review and help.
Comment 18 WebKit Commit Bot 2010-11-23 14:55:03 PST
Comment on attachment 74685 [details]
Use platform bridge to set scroll position.  this fixes layering violation.

Clearing flags on attachment: 74685

Committed r72631: <http://trac.webkit.org/changeset/72631>
Comment 19 WebKit Commit Bot 2010-11-23 14:55:10 PST
All reviewed patches have been landed.  Closing bug.