Diff
Modified: trunk/Source/WebCore/ChangeLog (261947 => 261948)
--- trunk/Source/WebCore/ChangeLog 2020-05-20 20:21:31 UTC (rev 261947)
+++ trunk/Source/WebCore/ChangeLog 2020-05-20 20:23:38 UTC (rev 261948)
@@ -1,3 +1,36 @@
+2020-05-20 Simon Fraser <[email protected]>
+
+ Plumb the display's nominal refresh rate down to ScrollingTree for use in scroll synchronization
+ https://bugs.webkit.org/show_bug.cgi?id=212159
+
+ Reviewed by Tim Horton.
+
+ Plumb an Optional<unsigned> down windowScreenDidChange, which contains the nominal
+ display refresh rate (as frames per second) if available. On macOS, we get this
+ from CVDisplayLinkGetNominalOutputVideoRefreshPeriod().
+
+ To read it, WebProcessPool::nominalFramesPerSecondForDisplay() makes a DisplayLink
+ that doesn't get any observers, but that DisplayLink will very likely get used
+ as soon as we schedule a rendering update.
+
+ * page/Chrome.cpp:
+ (WebCore::Chrome::windowScreenDidChange):
+ * page/Chrome.h:
+ * page/Page.cpp:
+ (WebCore::Page::scrollingCoordinator):
+ (WebCore::Page::windowScreenDidChange):
+ * page/Page.h:
+ (WebCore::Page::displayNominalFramesPerSecond const):
+ * page/scrolling/AsyncScrollingCoordinator.cpp:
+ (WebCore::AsyncScrollingCoordinator::windowScreenDidChange):
+ * page/scrolling/AsyncScrollingCoordinator.h:
+ * page/scrolling/ScrollingCoordinator.h:
+ (WebCore::ScrollingCoordinator::windowScreenDidChange):
+ * page/scrolling/ScrollingTree.cpp:
+ (WebCore::ScrollingTree::windowScreenDidChange):
+ * page/scrolling/ScrollingTree.h:
+ * platform/HostWindow.h:
+
2020-05-20 Chris Dumez <[email protected]>
Disable support for BeforeLoadEvent
Modified: trunk/Source/WebCore/page/Chrome.cpp (261947 => 261948)
--- trunk/Source/WebCore/page/Chrome.cpp 2020-05-20 20:21:31 UTC (rev 261947)
+++ trunk/Source/WebCore/page/Chrome.cpp 2020-05-20 20:23:38 UTC (rev 261948)
@@ -512,12 +512,12 @@
return m_page.displayID();
}
-void Chrome::windowScreenDidChange(PlatformDisplayID displayID)
+void Chrome::windowScreenDidChange(PlatformDisplayID displayID, Optional<unsigned> nominalFrameInterval)
{
- if (displayID == m_page.displayID())
+ if (displayID == m_page.displayID() && nominalFrameInterval == m_page.displayNominalFramesPerSecond())
return;
- m_page.windowScreenDidChange(displayID);
+ m_page.windowScreenDidChange(displayID, nominalFrameInterval);
#if PLATFORM(MAC) && ENABLE(GRAPHICS_CONTEXT_GL)
GraphicsContextGLOpenGLManager::sharedManager().screenDidChange(displayID, this);
Modified: trunk/Source/WebCore/page/Chrome.h (261947 => 261948)
--- trunk/Source/WebCore/page/Chrome.h 2020-05-20 20:21:31 UTC (rev 261947)
+++ trunk/Source/WebCore/page/Chrome.h 2020-05-20 20:23:38 UTC (rev 261948)
@@ -88,7 +88,7 @@
void scheduleAnimation() override { }
PlatformDisplayID displayID() const override;
- void windowScreenDidChange(PlatformDisplayID) override;
+ void windowScreenDidChange(PlatformDisplayID, Optional<unsigned>) override;
FloatSize screenSize() const override;
FloatSize availableScreenSize() const override;
Modified: trunk/Source/WebCore/page/Page.cpp (261947 => 261948)
--- trunk/Source/WebCore/page/Page.cpp 2020-05-20 20:21:31 UTC (rev 261947)
+++ trunk/Source/WebCore/page/Page.cpp 2020-05-20 20:23:38 UTC (rev 261948)
@@ -435,7 +435,7 @@
if (!m_scrollingCoordinator)
m_scrollingCoordinator = ScrollingCoordinator::create(this);
- m_scrollingCoordinator->windowScreenDidChange(m_displayID);
+ m_scrollingCoordinator->windowScreenDidChange(m_displayID, m_displayNominalFramesPerSecond);
}
return m_scrollingCoordinator.get();
@@ -1110,12 +1110,13 @@
pageOverlayController().didChangeDeviceScaleFactor();
}
-void Page::windowScreenDidChange(PlatformDisplayID displayID)
+void Page::windowScreenDidChange(PlatformDisplayID displayID, Optional<unsigned> nominalFramesPerSecond)
{
- if (displayID == m_displayID)
+ if (displayID == m_displayID && nominalFramesPerSecond == m_displayNominalFramesPerSecond)
return;
m_displayID = displayID;
+ m_displayNominalFramesPerSecond = nominalFramesPerSecond;
for (Frame* frame = &mainFrame(); frame; frame = frame->tree().traverseNext()) {
if (frame->document())
@@ -1123,7 +1124,7 @@
}
if (m_scrollingCoordinator)
- m_scrollingCoordinator->windowScreenDidChange(displayID);
+ m_scrollingCoordinator->windowScreenDidChange(displayID, nominalFramesPerSecond);
renderingUpdateScheduler().windowScreenDidChange(displayID);
Modified: trunk/Source/WebCore/page/Page.h (261947 => 261948)
--- trunk/Source/WebCore/page/Page.h 2020-05-20 20:21:31 UTC (rev 261947)
+++ trunk/Source/WebCore/page/Page.h 2020-05-20 20:23:38 UTC (rev 261948)
@@ -362,8 +362,9 @@
float initialScaleIgnoringContentSize() const { return m_initialScaleIgnoringContentSize; }
WEBCORE_EXPORT void setInitialScaleIgnoringContentSize(float);
- void windowScreenDidChange(PlatformDisplayID);
+ void windowScreenDidChange(PlatformDisplayID, Optional<unsigned> nominalFramesPerSecond);
PlatformDisplayID displayID() const { return m_displayID; }
+ Optional<unsigned> displayNominalFramesPerSecond() const { return m_displayNominalFramesPerSecond; }
float topContentInset() const { return m_topContentInset; }
WEBCORE_EXPORT void setTopContentInset(float);
@@ -845,6 +846,7 @@
RTCController m_rtcController;
PlatformDisplayID m_displayID { 0 };
+ Optional<unsigned> m_displayNominalFramesPerSecond;
int m_nestedRunLoopCount { 0 };
WTF::Function<void()> m_unnestCallback;
Modified: trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp (261947 => 261948)
--- trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp 2020-05-20 20:21:31 UTC (rev 261947)
+++ trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp 2020-05-20 20:23:38 UTC (rev 261948)
@@ -816,10 +816,10 @@
#endif
}
-void AsyncScrollingCoordinator::windowScreenDidChange(PlatformDisplayID displayID)
+void AsyncScrollingCoordinator::windowScreenDidChange(PlatformDisplayID displayID, Optional<unsigned> nominalFramesPerSecond)
{
if (m_scrollingTree)
- m_scrollingTree->windowScreenDidChange(displayID);
+ m_scrollingTree->windowScreenDidChange(displayID, nominalFramesPerSecond);
}
bool AsyncScrollingCoordinator::isRubberBandInProgress() const
Modified: trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h (261947 => 261948)
--- trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h 2020-05-20 20:21:31 UTC (rev 261947)
+++ trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h 2020-05-20 20:23:38 UTC (rev 261948)
@@ -138,7 +138,7 @@
WEBCORE_EXPORT void setSynchronousScrollingReasons(ScrollingNodeID, OptionSet<SynchronousScrollingReason>) final;
WEBCORE_EXPORT bool hasSynchronousScrollingReasons(ScrollingNodeID) const final;
- WEBCORE_EXPORT void windowScreenDidChange(PlatformDisplayID) final;
+ WEBCORE_EXPORT void windowScreenDidChange(PlatformDisplayID, Optional<unsigned> nominalFramesPerSecond) final;
virtual void scheduleTreeStateCommit() = 0;
Modified: trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h (261947 => 261948)
--- trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h 2020-05-20 20:21:31 UTC (rev 261947)
+++ trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h 2020-05-20 20:23:38 UTC (rev 261948)
@@ -181,7 +181,7 @@
virtual void willDestroyScrollableArea(ScrollableArea&) { }
virtual void scrollableAreaScrollbarLayerDidChange(ScrollableArea&, ScrollbarOrientation) { }
- virtual void windowScreenDidChange(PlatformDisplayID) { }
+ virtual void windowScreenDidChange(PlatformDisplayID, Optional<unsigned> /* nominalFramesPerSecond */) { }
static String synchronousScrollingReasonsAsText(OptionSet<SynchronousScrollingReason>);
String synchronousScrollingReasonsAsText() const;
Modified: trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp (261947 => 261948)
--- trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp 2020-05-20 20:21:31 UTC (rev 261947)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp 2020-05-20 20:23:38 UTC (rev 261948)
@@ -527,10 +527,11 @@
return false;
}
-void ScrollingTree::windowScreenDidChange(PlatformDisplayID displayID)
+void ScrollingTree::windowScreenDidChange(PlatformDisplayID displayID, Optional<unsigned> nominalFramesPerSecond)
{
LockHolder locker(m_treeStateMutex);
m_treeState.displayID = displayID;
+ m_treeState.nominalFramesPerSecond = nominalFramesPerSecond;
}
PlatformDisplayID ScrollingTree::displayID()
Modified: trunk/Source/WebCore/page/scrolling/ScrollingTree.h (261947 => 261948)
--- trunk/Source/WebCore/page/scrolling/ScrollingTree.h 2020-05-20 20:21:31 UTC (rev 261947)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTree.h 2020-05-20 20:23:38 UTC (rev 261948)
@@ -179,7 +179,7 @@
virtual void lockLayersForHitTesting() { }
virtual void unlockLayersForHitTesting() { }
- void windowScreenDidChange(PlatformDisplayID);
+ void windowScreenDidChange(PlatformDisplayID, Optional<unsigned> nominalFramesPerSecond);
PlatformDisplayID displayID();
protected:
@@ -221,6 +221,7 @@
EventTrackingRegions eventTrackingRegions;
FloatPoint mainFrameScrollPosition;
PlatformDisplayID displayID { 0 };
+ Optional<unsigned> nominalFramesPerSecond;
bool mainFrameIsRubberBanding { false };
bool mainFrameIsScrollSnapping { false };
};
Modified: trunk/Source/WebCore/platform/HostWindow.h (261947 => 261948)
--- trunk/Source/WebCore/platform/HostWindow.h 2020-05-20 20:21:31 UTC (rev 261947)
+++ trunk/Source/WebCore/platform/HostWindow.h 2020-05-20 20:23:38 UTC (rev 261948)
@@ -76,7 +76,7 @@
virtual void scheduleAnimation() = 0;
virtual PlatformDisplayID displayID() const = 0;
- virtual void windowScreenDidChange(PlatformDisplayID) = 0;
+ virtual void windowScreenDidChange(PlatformDisplayID, Optional<unsigned> nominalFramesPerSecond) = 0;
virtual FloatSize screenSize() const = 0;
virtual FloatSize availableScreenSize() const = 0;
Modified: trunk/Source/WebCore/platform/mac/PlatformScreenMac.mm (261947 => 261948)
--- trunk/Source/WebCore/platform/mac/PlatformScreenMac.mm 2020-05-20 20:21:31 UTC (rev 261947)
+++ trunk/Source/WebCore/platform/mac/PlatformScreenMac.mm 2020-05-20 20:23:38 UTC (rev 261948)
@@ -48,7 +48,7 @@
PlatformDisplayID displayID(NSScreen *screen)
{
ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
- return [[[screen deviceDescription] objectForKey:@"NSScreenNumber"] intValue];
+ return [[screen.deviceDescription objectForKey:@"NSScreenNumber"] intValue];
}
static PlatformDisplayID displayID(Widget* widget)
Modified: trunk/Source/WebKit/ChangeLog (261947 => 261948)
--- trunk/Source/WebKit/ChangeLog 2020-05-20 20:21:31 UTC (rev 261947)
+++ trunk/Source/WebKit/ChangeLog 2020-05-20 20:23:38 UTC (rev 261948)
@@ -1,3 +1,37 @@
+2020-05-20 Simon Fraser <[email protected]>
+
+ Plumb the display's nominal refresh rate down to ScrollingTree for use in scroll synchronization
+ https://bugs.webkit.org/show_bug.cgi?id=212159
+
+ Reviewed by Tim Horton.
+
+ Plumb an Optional<unsigned> down windowScreenDidChange, which contains the nominal
+ display refresh rate (as frames per second) if available. On macOS, we get this
+ from CVDisplayLinkGetNominalOutputVideoRefreshPeriod().
+
+ To read it, WebProcessPool::nominalFramesPerSecondForDisplay() makes a DisplayLink
+ that doesn't get any observers, but that DisplayLink will very likely get used
+ as soon as we schedule a rendering update.
+
+ * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
+ (WebKit::WebProcessPool::nominalFramesPerSecondForDisplay):
+ * UIProcess/Cocoa/WebViewImpl.mm:
+ (WebKit::WebViewImpl::windowDidChangeScreen):
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::windowScreenDidChange):
+ * UIProcess/WebPageProxy.h:
+ * UIProcess/WebProcessPool.h:
+ * UIProcess/mac/DisplayLink.cpp:
+ (WebKit::DisplayLink::DisplayLink):
+ (WebKit::DisplayLink::nominalFramesPerSecond const):
+ * UIProcess/mac/DisplayLink.h:
+ * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
+ (WebKit::RemoteLayerTreeDrawingArea::RemoteLayerTreeDrawingArea):
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::windowScreenDidChange):
+ * WebProcess/WebPage/WebPage.h:
+ * WebProcess/WebPage/WebPage.messages.in:
+
2020-05-20 Myles C. Maxfield <[email protected]>
[iPadOS] -webkit-text-size-adjust:percentage doesn't work in native apps
Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm (261947 => 261948)
--- trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm 2020-05-20 20:21:31 UTC (rev 261947)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm 2020-05-20 20:23:38 UTC (rev 261948)
@@ -791,6 +791,20 @@
}
#if PLATFORM(MAC) && ENABLE(WEBPROCESS_WINDOWSERVER_BLOCKING)
+Optional<unsigned> WebProcessPool::nominalFramesPerSecondForDisplay(WebCore::PlatformDisplayID displayID)
+{
+ for (auto& displayLink : m_displayLinks) {
+ if (displayLink->displayID() == displayID)
+ return displayLink->nominalFramesPerSecond();
+ }
+
+ // Note that this creates a DisplayLink with no observers, but it's highly likely that we'll soon call startDisplayLink() for it.
+ auto displayLink = makeUnique<DisplayLink>(displayID);
+ auto frameRate = displayLink->nominalFramesPerSecond();
+ m_displayLinks.append(WTFMove(displayLink));
+ return frameRate;
+}
+
void WebProcessPool::startDisplayLink(IPC::Connection& connection, DisplayLinkObserverID observerID, PlatformDisplayID displayID)
{
for (auto& displayLink : m_displayLinks) {
Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm (261947 => 261948)
--- trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm 2020-05-20 20:21:31 UTC (rev 261947)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm 2020-05-20 20:23:38 UTC (rev 261948)
@@ -96,6 +96,7 @@
#import <WebCore/LocalizedStrings.h>
#import <WebCore/Pasteboard.h>
#import <WebCore/PlatformEventFactoryMac.h>
+#import <WebCore/PlatformScreen.h>
#import <WebCore/PromisedAttachmentInfo.h>
#import <WebCore/TextAlternativeWithRange.h>
#import <WebCore/TextUndoInsertionMarkupMac.h>
@@ -2122,7 +2123,9 @@
void WebViewImpl::windowDidChangeScreen()
{
NSWindow *window = m_targetWindowForMovePreparation ? m_targetWindowForMovePreparation.get() : [m_view window];
- m_page->windowScreenDidChange([[[[window screen] deviceDescription] objectForKey:@"NSScreenNumber"] intValue]);
+ PlatformDisplayID displayID = WebCore::displayID(window.screen);
+ auto framesPerSecond = m_page->process().processPool().nominalFramesPerSecondForDisplay(displayID);
+ m_page->windowScreenDidChange(displayID, framesPerSecond);
}
void WebViewImpl::windowDidChangeLayerHosting()
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (261947 => 261948)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2020-05-20 20:21:31 UTC (rev 261947)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2020-05-20 20:23:38 UTC (rev 261948)
@@ -3705,12 +3705,12 @@
m_drawingArea->deviceScaleFactorDidChange();
}
-void WebPageProxy::windowScreenDidChange(PlatformDisplayID displayID)
+void WebPageProxy::windowScreenDidChange(PlatformDisplayID displayID, Optional<unsigned> nominalFramesPerSecond)
{
if (!hasRunningProcess())
return;
- send(Messages::WebPage::WindowScreenDidChange(displayID));
+ send(Messages::WebPage::WindowScreenDidChange(displayID, nominalFramesPerSecond));
}
float WebPageProxy::deviceScaleFactor() const
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (261947 => 261948)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.h 2020-05-20 20:21:31 UTC (rev 261947)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h 2020-05-20 20:23:38 UTC (rev 261948)
@@ -992,7 +992,7 @@
float deviceScaleFactor() const;
void setIntrinsicDeviceScaleFactor(float);
void setCustomDeviceScaleFactor(float);
- void windowScreenDidChange(WebCore::PlatformDisplayID);
+ void windowScreenDidChange(WebCore::PlatformDisplayID, Optional<unsigned> nominalFramesPerSecond);
void accessibilitySettingsDidChange();
void setUseFixedLayout(bool);
Modified: trunk/Source/WebKit/UIProcess/WebProcessPool.h (261947 => 261948)
--- trunk/Source/WebKit/UIProcess/WebProcessPool.h 2020-05-20 20:21:31 UTC (rev 261947)
+++ trunk/Source/WebKit/UIProcess/WebProcessPool.h 2020-05-20 20:23:38 UTC (rev 261948)
@@ -249,6 +249,7 @@
#endif
#if PLATFORM(MAC) && ENABLE(WEBPROCESS_WINDOWSERVER_BLOCKING)
+ Optional<unsigned> nominalFramesPerSecondForDisplay(WebCore::PlatformDisplayID);
void startDisplayLink(IPC::Connection&, DisplayLinkObserverID, WebCore::PlatformDisplayID);
void stopDisplayLink(IPC::Connection&, DisplayLinkObserverID, WebCore::PlatformDisplayID);
void stopDisplayLinks(IPC::Connection&);
Modified: trunk/Source/WebKit/UIProcess/mac/DisplayLink.cpp (261947 => 261948)
--- trunk/Source/WebKit/UIProcess/mac/DisplayLink.cpp 2020-05-20 20:21:31 UTC (rev 261947)
+++ trunk/Source/WebKit/UIProcess/mac/DisplayLink.cpp 2020-05-20 20:23:38 UTC (rev 261948)
@@ -36,16 +36,18 @@
DisplayLink::DisplayLink(WebCore::PlatformDisplayID displayID)
: m_displayID(displayID)
{
+ // FIXME: We can get here with displayID == 0 (webkit.org/b/212120), in which case CVDisplayLinkCreateWithCGDisplay()
+ // probably defaults to the main screen.
ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
CVReturn error = CVDisplayLinkCreateWithCGDisplay(displayID, &m_displayLink);
if (error) {
- WTFLogAlways("Could not create a display link: %d", error);
+ WTFLogAlways("Could not create a display link for display %u: error %d", displayID, error);
return;
}
error = CVDisplayLinkSetOutputCallback(m_displayLink, displayLinkCallback, this);
if (error) {
- WTFLogAlways("Could not set the display link output callback: %d", error);
+ WTFLogAlways("Could not set the display link output callback for display %u: error %d", displayID, error);
return;
}
}
@@ -61,6 +63,12 @@
CVDisplayLinkRelease(m_displayLink);
}
+Optional<unsigned> DisplayLink::nominalFramesPerSecond() const
+{
+ CVTime refreshPeriod = CVDisplayLinkGetNominalOutputVideoRefreshPeriod(m_displayLink);
+ return round((double)refreshPeriod.timeScale / (double)refreshPeriod.timeValue);
+}
+
void DisplayLink::addObserver(IPC::Connection& connection, DisplayLinkObserverID observerID)
{
ASSERT(RunLoop::isMain());
Modified: trunk/Source/WebKit/UIProcess/mac/DisplayLink.h (261947 => 261948)
--- trunk/Source/WebKit/UIProcess/mac/DisplayLink.h 2020-05-20 20:21:31 UTC (rev 261947)
+++ trunk/Source/WebKit/UIProcess/mac/DisplayLink.h 2020-05-20 20:23:38 UTC (rev 261948)
@@ -51,6 +51,8 @@
bool hasObservers() const;
WebCore::PlatformDisplayID displayID() const { return m_displayID; }
+
+ Optional<unsigned> nominalFramesPerSecond() const;
private:
static CVReturn displayLinkCallback(CVDisplayLinkRef, const CVTimeStamp*, const CVTimeStamp*, CVOptionFlags, CVOptionFlags*, void* data);
Modified: trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp (261947 => 261948)
--- trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp 2020-05-20 20:21:31 UTC (rev 261947)
+++ trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp 2020-05-20 20:23:38 UTC (rev 261948)
@@ -576,7 +576,7 @@
auto changeWindowScreen = [&] {
// In order to ensure that we get a unique DisplayRefreshMonitor per-DrawingArea (necessary because ThreadedDisplayRefreshMonitor
// is driven by the ThreadedCompositor of the drawing area), give each page a unique DisplayID derived from WebPage's unique ID.
- m_webPage.windowScreenDidChange(m_layerTreeHost->displayID());
+ m_webPage.windowScreenDidChange(m_layerTreeHost->displayID(), WTF::nullopt);
};
ASSERT(!m_layerTreeHost);
@@ -632,7 +632,7 @@
m_discardPreviousLayerTreeHostTimer.startOneShot(5_s);
// Always use the primary display ID (0) when not in accelerated compositing mode.
- m_webPage.windowScreenDidChange(0);
+ m_webPage.windowScreenDidChange(0, WTF::nullopt);
m_dirtyRegion = m_webPage.bounds();
Modified: trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm (261947 => 261948)
--- trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm 2020-05-20 20:21:31 UTC (rev 261947)
+++ trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm 2020-05-20 20:23:38 UTC (rev 261948)
@@ -72,7 +72,7 @@
// FIXME: While using the high end of the range of DisplayIDs makes a collision with real, non-RemoteLayerTreeDrawingArea
// DisplayIDs less likely, it is not entirely safe to have a RemoteLayerTreeDrawingArea and TiledCoreAnimationDrawingArea
// coeexist in the same process.
- webPage.windowScreenDidChange(std::numeric_limits<uint32_t>::max() - webPage.identifier().toUInt64());
+ webPage.windowScreenDidChange(std::numeric_limits<uint32_t>::max() - webPage.identifier().toUInt64(), WTF::nullopt);
if (auto viewExposedRect = parameters.viewExposedRect)
setViewExposedRect(viewExposedRect);
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (261947 => 261948)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2020-05-20 20:21:31 UTC (rev 261947)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2020-05-20 20:23:38 UTC (rev 261948)
@@ -1971,9 +1971,9 @@
return frame->setPageAndTextZoomFactors(static_cast<float>(pageZoomFactor), static_cast<float>(textZoomFactor));
}
-void WebPage::windowScreenDidChange(uint32_t displayID)
+void WebPage::windowScreenDidChange(PlatformDisplayID displayID, Optional<unsigned> nominalFramesPerSecond)
{
- m_page->chrome().windowScreenDidChange(static_cast<PlatformDisplayID>(displayID));
+ m_page->chrome().windowScreenDidChange(displayID, nominalFramesPerSecond);
#if PLATFORM(MAC)
WebProcess::singleton().updatePageScreenProperties();
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.h (261947 => 261948)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.h 2020-05-20 20:21:31 UTC (rev 261947)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.h 2020-05-20 20:23:38 UTC (rev 261948)
@@ -204,6 +204,8 @@
enum class TextGranularity : uint8_t;
enum class WritingDirection : uint8_t;
+using PlatformDisplayID = uint32_t;
+
struct AttributedString;
struct BackForwardItemIdentifier;
struct CompositionHighlight;
@@ -517,7 +519,7 @@
double pageZoomFactor() const;
void setPageZoomFactor(double);
void setPageAndTextZoomFactors(double pageZoomFactor, double textZoomFactor);
- void windowScreenDidChange(uint32_t);
+ void windowScreenDidChange(WebCore::PlatformDisplayID, Optional<unsigned> nominalFramesPerSecond);
String dumpHistoryForTesting(const String& directory);
void clearHistory();
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in (261947 => 261948)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in 2020-05-20 20:21:31 UTC (rev 261947)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in 2020-05-20 20:23:38 UTC (rev 261948)
@@ -267,7 +267,7 @@
SetPageAndTextZoomFactors(double pageZoomFactor, double textZoomFactor)
SetPageZoomFactor(double zoomFactor)
SetTextZoomFactor(double zoomFactor)
- WindowScreenDidChange(uint32_t displayID)
+ WindowScreenDidChange(uint32_t displayID, Optional<unsigned> nominalFramesPerSecond)
AccessibilitySettingsDidChange()
Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (261947 => 261948)
--- trunk/Source/WebKitLegacy/mac/ChangeLog 2020-05-20 20:21:31 UTC (rev 261947)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog 2020-05-20 20:23:38 UTC (rev 261948)
@@ -1,3 +1,21 @@
+2020-05-20 Simon Fraser <[email protected]>
+
+ Plumb the display's nominal refresh rate down to ScrollingTree for use in scroll synchronization
+ https://bugs.webkit.org/show_bug.cgi?id=212159
+
+ Reviewed by Tim Horton.
+
+ Plumb an Optional<unsigned> down windowScreenDidChange, which contains the nominal
+ display refresh rate (as frames per second) if available. On macOS, we get this
+ from CVDisplayLinkGetNominalOutputVideoRefreshPeriod().
+
+ To read it, WebProcessPool::nominalFramesPerSecondForDisplay() makes a DisplayLink
+ that doesn't get any observers, but that DisplayLink will very likely get used
+ as soon as we schedule a rendering update.
+
+ * WebView/WebView.mm:
+ (-[WebView doWindowDidChangeScreen]):
+
2020-05-18 David Kilzer <[email protected]>
Replace TextIndicatorOptions with OptionSet<TextIndicatorOption>
Modified: trunk/Source/WebKitLegacy/mac/WebView/WebView.mm (261947 => 261948)
--- trunk/Source/WebKitLegacy/mac/WebView/WebView.mm 2020-05-20 20:21:31 UTC (rev 261947)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebView.mm 2020-05-20 20:23:38 UTC (rev 261948)
@@ -192,6 +192,7 @@
#import <WebCore/PageGroup.h>
#import <WebCore/PathUtilities.h>
#import <WebCore/PlatformEventFactoryMac.h>
+#import <WebCore/PlatformScreen.h>
#import <WebCore/ProgressTracker.h>
#import <WebCore/RenderTheme.h>
#import <WebCore/RenderView.h>
@@ -6046,7 +6047,7 @@
- (void)doWindowDidChangeScreen
{
if (_private && _private->page)
- _private->page->chrome().windowScreenDidChange((WebCore::PlatformDisplayID)[[[[[self window] screen] deviceDescription] objectForKey:@"NSScreenNumber"] intValue]);
+ _private->page->chrome().windowScreenDidChange(WebCore::displayID(self.window.screen), WTF::nullopt);
}
- (void)_windowChangedKeyState