screen.availWidth always returns width of primary display
https://bugs.webkit.org/show_bug.cgi?id=117863
Source/WebCore:
Reviewed by Geoffrey Garen.
In WebKit2, Widgets have no platformWidget, so trying to get to the
NSScreen via the platform widget's window never succeeded, and we always
fell back on getting info for the main display.
However, we were already pushing the WKView's displayID down to the
WebProcess for the requestAnimationFrame infrastructure, so use that.
Add a virtual function on Widget windowDisplayID(), that is overridden
in FrameView to return the PlatformDisplayID which Page has.
Fix PlatformScreenMac to fall back to Widget::windowDisplayID() when it fails
to get an NSWindow from the Widget.
Add a utility category on NSScreen to get an NSScreen's displayID, and to
find an NSScreen given a displayID.
* WebCore.exp.in:
* WebCore.xcodeproj/project.pbxproj:
* page/FrameView.cpp:
(WebCore::FrameView::windowDisplayID):
* page/FrameView.h:
* platform/Widget.cpp:
(WebCore::Widget::windowDisplayID):
* platform/Widget.h:
* platform/mac/PlatformScreenMac.h: Added.
* platform/mac/PlatformScreenMac.mm:
(+[NSScreen screenForDislayID:]):
(-[NSScreen displayID]):
(WebCore::screenRect):
(WebCore::screenAvailableRect):
* platform/mac/WidgetMac.mm:
(WebCore::Widget::windowDisplayID):
Source/WebKit2:
Reviewed by Geoffrey Garen.
In WebKit2, Widgets have no platformWidget, so trying to get to the
NSScreen via the platform widget's window never succeeded, and we always
fell back on getting info for the main display.
However, we were already pushing the WKView's displayID down to the
WebProcess for the requestAnimationFrame infrastructure, so use that.
The WebProcess would not receive a displayID for a WKView until the window
was activated; fix by calling -doWindowDidChangeScreen when the view
moves to a window, rather than doing it from -_windowDidBecomeKey:.
* UIProcess/API/mac/WKView.mm:
(-[WKView viewDidMoveToWindow]):
(-[WKView _windowDidBecomeKey:]):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@151877 268f45cc-cd09-0410-ab3c-d52691b4dbfc
12 files changed