WebKit Bugzilla
Attachment 339412 Details for
Bug 185251
: Ads in NYTimes app are shifted downwards by the scroll view's top content inset
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-185251-20180503091230.patch (text/plain), 3.59 KB, created by
Wenson Hsieh
on 2018-05-03 09:12:30 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Wenson Hsieh
Created:
2018-05-03 09:12:30 PDT
Size:
3.59 KB
patch
obsolete
>Subversion Revision: 231220 >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 5854d6db9669d574ed21d9d1612cd72dc51e2587..e1693692d9ba83be5a5c66733c108cd167fe580b 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,29 @@ >+2018-05-03 Wenson Hsieh <wenson_hsieh@apple.com> >+ >+ Ads in NYTimes app are shifted downwards by the scroll view's top content inset >+ https://bugs.webkit.org/show_bug.cgi?id=185251 >+ <rdar://problem/39062357> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ The NYTimes app embeds advertisements in each article's WKWebView by adding views in the WKScrollView's view >+ hierarchy. These views are positioned using the bounding client rects of elements in the DOM (via Element >+ ::getBoundingClientRect). Prior to r229641, WebKit would report bounding client rects inset by the content >+ insets of WKScrollView, which means that if a top content inset X is specified on the scroll view, an element >+ that is flush against the top of the viewport will have a bounding client rect top of -X (when it should really >+ be 0). >+ >+ To account for this, NYTimes adds the scroll view content insets back to the bounding client rect when >+ determining the position of each advertisement which, after r229641, causes these views to be shifted downwards >+ by an amount equal to the scroll view content inset top. >+ >+ This new behavior does not affect Safari, since Safari uses SPI to explicitly set obscured insets. As such, we >+ address this by gating the scroll view content inset fix with a linked-on-or-after check. >+ >+ * UIProcess/API/Cocoa/WKWebView.mm: >+ (-[WKWebView _computedObscuredInset]): >+ * UIProcess/Cocoa/VersionChecks.h: >+ > 2018-05-01 Jer Noble <jer.noble@apple.com> > > Production build error in Migrate Header phase when WK_ALTERNATE_FRAMEWORKS_DIR is set to non-empty value >diff --git a/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm b/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm >index b443524c2dc2b238a9c66f0dbc97ed99b9fed937..f44a41d8b6a2c6de0bdcd21586a8f5ceb411e7c7 100644 >--- a/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm >+++ b/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm >@@ -1616,6 +1616,12 @@ - (UIRectEdge)_effectiveObscuredInsetEdgesAffectedBySafeArea > > - (UIEdgeInsets)_computedObscuredInset > { >+ if (!linkedOnOrAfter(WebKit::SDKVersion::FirstWhereScrollViewContentInsetsAreNotObscuringInsets)) { >+ // For binary compability with third party apps, treat scroll view content insets as obscuring insets when the app is compiled >+ // against a WebKit version without the fix in r229641. >+ return [self _computedContentInset]; >+ } >+ > if (_haveSetObscuredInsets) > return _obscuredInsets; > >diff --git a/Source/WebKit/UIProcess/Cocoa/VersionChecks.h b/Source/WebKit/UIProcess/Cocoa/VersionChecks.h >index efa415549a47487f2edcce1f3f1ff29ffbcddc82..f248c5fda4427566fbc7a589d43753813c094573 100644 >--- a/Source/WebKit/UIProcess/Cocoa/VersionChecks.h >+++ b/Source/WebKit/UIProcess/Cocoa/VersionChecks.h >@@ -38,6 +38,7 @@ enum class SDKVersion : uint32_t { > FirstWithExpiredOnlyReloadBehavior = DYLD_IOS_VERSION_11_0, > FirstThatDisallowsSettingAnyXHRHeaderFromFileURLs = DYLD_IOS_VERSION_11_3, > FirstThatDefaultsToPassiveTouchListenersOnDocument = DYLD_IOS_VERSION_11_3, >+ FirstWhereScrollViewContentInsetsAreNotObscuringInsets = DYLD_IOS_VERSION_12_0 > #elif PLATFORM(MAC) > FirstWithNetworkCache = DYLD_MACOSX_VERSION_10_11, > FirstWithExceptionsForDuplicateCompletionHandlerCalls = DYLD_MACOSX_VERSION_10_13,
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 185251
:
339412
|
339435
|
339443