Skip to content

Commit 2e989dc

Browse files
committed
[iOS WK2] CADisplayLink in the web process is used unintentionally
https://bugs.webkit.org/show_bug.cgi?id=224395 Reviewed by Tim Horton. When RemoteLayerTreeDrawingArea called windowScreenDidChange() from its constructor, m_page.drawingArea() was null which resulted in DisplayRefreshMonitor::create() receiving a null DisplayRefreshMonitorFactory*, so it fell back to the legacy DisplayRefreshMonitorIOS, instead of using RemoteLayerTreeDisplayRefreshMonitor. Fix by sending windowScreenDidChange() from the UI process, with the synthetic DisplayID generated from the webPageID(). This has the advantage that WebPageProxy will also store the correct DisplayID, and is more similar to macOS. * UIProcess/ios/WKContentView.mm: (-[WKContentView _commonInitializationWithProcessPool:configuration:]): * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm: (WebKit::RemoteLayerTreeDrawingArea::RemoteLayerTreeDrawingArea): Canonical link: https://commits.webkit.org/236363@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@275792 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent b5bed29 commit 2e989dc

3 files changed

Lines changed: 28 additions & 7 deletions

File tree

Source/WebKit/ChangeLog

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,24 @@
1+
2021-04-09 Simon Fraser <simon.fraser@apple.com>
2+
3+
[iOS WK2] CADisplayLink in the web process is used unintentionally
4+
https://bugs.webkit.org/show_bug.cgi?id=224395
5+
6+
Reviewed by Tim Horton.
7+
8+
When RemoteLayerTreeDrawingArea called windowScreenDidChange() from its constructor,
9+
m_page.drawingArea() was null which resulted in DisplayRefreshMonitor::create()
10+
receiving a null DisplayRefreshMonitorFactory*, so it fell back to the legacy
11+
DisplayRefreshMonitorIOS, instead of using RemoteLayerTreeDisplayRefreshMonitor.
12+
13+
Fix by sending windowScreenDidChange() from the UI process, with the synthetic
14+
DisplayID generated from the webPageID(). This has the advantage that
15+
WebPageProxy will also store the correct DisplayID, and is more similar to macOS.
16+
17+
* UIProcess/ios/WKContentView.mm:
18+
(-[WKContentView _commonInitializationWithProcessPool:configuration:]):
19+
* WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
20+
(WebKit::RemoteLayerTreeDrawingArea::RemoteLayerTreeDrawingArea):
21+
122
2021-04-09 Wenson Hsieh <wenson_hsieh@apple.com>
223

324
REGRESSION (r271660): Tap highlight no longer shows when tapping clickable elements without touch event listeners

Source/WebKit/UIProcess/ios/WKContentView.mm

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,13 @@ - (instancetype)_commonInitializationWithProcessPool:(WebKit::WebProcessPool&)pr
174174
_page->setDelegatesScrolling(true);
175175
_page->setScreenIsBeingCaptured([[[self window] screen] isCaptured]);
176176

177+
// In order to ensure that we get a unique DisplayRefreshMonitor per-DrawingArea (necessary because DisplayRefreshMonitor
178+
// is driven by this class), give each page a unique DisplayID derived from WebPage's unique ID.
179+
// FIXME: While using the high end of the range of DisplayIDs makes a collision with real, non-RemoteLayerTreeDrawingArea
180+
// DisplayIDs less likely, it is not entirely safe to have a RemoteLayerTreeDrawingArea and TiledCoreAnimationDrawingArea
181+
// coeexist in the same process.
182+
_page->windowScreenDidChange(std::numeric_limits<uint32_t>::max() - _page->webPageID().toUInt64(), WTF::nullopt);
183+
177184
#if ENABLE(FULLSCREEN_API)
178185
_page->setFullscreenClient(makeUnique<WebKit::FullscreenClient>(self.webView));
179186
#endif

Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,6 @@
6767

6868
m_commitQueue = adoptOSObject(dispatch_queue_create("com.apple.WebKit.WebContent.RemoteLayerTreeDrawingArea.CommitQueue", nullptr));
6969

70-
// In order to ensure that we get a unique DisplayRefreshMonitor per-DrawingArea (necessary because DisplayRefreshMonitor
71-
// is driven by this class), give each page a unique DisplayID derived from WebPage's unique ID.
72-
// FIXME: While using the high end of the range of DisplayIDs makes a collision with real, non-RemoteLayerTreeDrawingArea
73-
// DisplayIDs less likely, it is not entirely safe to have a RemoteLayerTreeDrawingArea and TiledCoreAnimationDrawingArea
74-
// coeexist in the same process.
75-
webPage.windowScreenDidChange(std::numeric_limits<uint32_t>::max() - webPage.identifier().toUInt64(), WTF::nullopt);
76-
7770
if (auto viewExposedRect = parameters.viewExposedRect)
7871
setViewExposedRect(viewExposedRect);
7972
}

0 commit comments

Comments
 (0)