Commit 068507af authored by Robbie Gibson's avatar Robbie Gibson Committed by Chromium LUCI CQ

[iOS] Fix incorrect default CRWWebViewScrollViewProxy properties

CRWWebViewScrollViewProxy initializes itself with a base UIScrollView
so any properties set on it before a real web view scroll view is set
are used (see the comment in CRWWebViewScrollViewProxy -init). Then,
when another scroll view is added to the proxy, all properties are
copied over from the stored scroll view to the newly added one.

However, there are a few properties for which a WKWebView.scrollView
(WKScrollView, a private class) and UIScrollView have different
defaults. This means that the property copying phase overwrites the
WKWebView.scrollView defaults with the UIScrollView defaults.

A better solution might be to track which properties are set, and only
copy over those properties in the copying phase, but that would be a
much more involved solution.

Bug: 1156224
Change-Id: Ie0ad8bad0439caf3fdb4ec37d03369c43d0a7100
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2580533Reviewed-by: default avatarGauthier Ambard <gambard@chromium.org>
Commit-Queue: Gauthier Ambard <gambard@chromium.org>
Cr-Commit-Position: refs/heads/master@{#836073}
parent bb7ac605
...@@ -169,6 +169,15 @@ static int gAnyContext = 0; ...@@ -169,6 +169,15 @@ static int gAnyContext = 0;
// -asUIScrollView method. // -asUIScrollView method.
_underlyingScrollView = [[UIScrollView alloc] init]; _underlyingScrollView = [[UIScrollView alloc] init];
// There are a few properties where the default WKWebView.scrollView has
// different values from a base UIScrollView. As _underlyingScrollView
// starts out as a base UIScrollView, the property preservation code will
// copy over these incorrect values and overwrite the default
// WKWebView.scrollView values for those properties. Instead, set those
// values to their WebKit defaults.
_underlyingScrollView.alwaysBounceVertical = YES;
_underlyingScrollView.directionalLockEnabled = YES;
[self.class startObservingScrollView:_underlyingScrollView proxy:self]; [self.class startObservingScrollView:_underlyingScrollView proxy:self];
} }
return self; return self;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment