Diff
Modified: branches/safari-534.54-branch/Source/WebCore/ChangeLog (106488 => 106489)
--- branches/safari-534.54-branch/Source/WebCore/ChangeLog 2012-02-01 21:34:08 UTC (rev 106488)
+++ branches/safari-534.54-branch/Source/WebCore/ChangeLog 2012-02-01 21:46:51 UTC (rev 106489)
@@ -1,3 +1,58 @@
+2011-02-01 Lucas Forschler <[email protected]>
+
+ Merge 106271
+
+ 2012-01-30 Beth Dakin <[email protected]>
+
+ https://bugs.webkit.org/show_bug.cgi?id=77263
+ PlatformScreenMac should not rely on NSWindow for important bits of data
+
+ Reviewed by Geoff Garen.
+
+ The main problem is that we cannot rely on the NSWindow for information about
+ the deviceScaleFactor because we cannot access an NSWindow from within
+ WebCore for WebKit2 windows. Instead, we can fetch it from
+ WebCore::deviceScaleFactor(), but we need a Frame to call that. So
+ screenAvailableRect and screenRect both now take a FrameView* instead of a
+ Widget*. All existing call sites actually sent a FrameView in anyway, so this
+ is not a big change, but it does require touching a lot of platforms.
+ * WebCore.exp.in:
+ * platform/PlatformScreen.h:
+ (WebCore):
+ * platform/blackberry/PlatformScreenBlackBerry.cpp:
+ (WebCore::screenAvailableRect):
+ (WebCore::screenRect):
+ * platform/chromium/PlatformScreenChromium.cpp:
+ (WebCore::screenRect):
+ (WebCore::screenAvailableRect):
+ * platform/chromium/PlatformSupport.h:
+ (WebCore):
+ (PlatformSupport):
+ ():
+ * platform/efl/PlatformScreenEfl.cpp:
+ (WebCore::screenRect):
+ (WebCore::screenAvailableRect):
+ * platform/gtk/PlatformScreenGtk.cpp:
+ (WebCore::screenRect):
+ (WebCore::screenAvailableRect):
+ * platform/qt/PlatformScreenQt.cpp:
+ (WebCore::screenRect):
+ (WebCore::screenAvailableRect):
+ * platform/win/PlatformScreenWin.cpp:
+ (WebCore::screenRect):
+ (WebCore::screenAvailableRect):
+ * platform/wx/ScreenWx.cpp:
+ (WebCore::screenRect):
+ (WebCore::screenAvailableRect):
+
+ The Mac-only functions toUserSpace() and toDeviceSpace() were also updated to
+ take a parameter for the deviceScaleFactor.
+ * platform/mac/PlatformScreenMac.mm:
+ (WebCore::screenRect):
+ (WebCore::screenAvailableRect):
+ (WebCore::toUserSpace):
+ (WebCore::toDeviceSpace):
+
2011-01-27 Lucas Forschler <[email protected]>
Merge 106130
Modified: branches/safari-534.54-branch/Source/WebCore/WebCore.exp.in (106488 => 106489)
--- branches/safari-534.54-branch/Source/WebCore/WebCore.exp.in 2012-02-01 21:34:08 UTC (rev 106488)
+++ branches/safari-534.54-branch/Source/WebCore/WebCore.exp.in 2012-02-01 21:46:51 UTC (rev 106489)
@@ -220,7 +220,7 @@
__ZN7WebCore11globalPointERK8_NSPointP8NSWindow
__ZN7WebCore11memoryCacheEv
__ZN7WebCore11startOfWordERKNS_15VisiblePositionENS_9EWordSideE
-__ZN7WebCore11toUserSpaceERK7_NSRectP8NSWindow
+__ZN7WebCore11toUserSpaceERK6CGRectP8NSWindowf
__ZN7WebCore11writeToFileEiPKci
__ZN7WebCore12ChromeClient20paintCustomScrollbarEPNS_15GraphicsContextERKNS_9FloatRectENS_20ScrollbarControlSizeEjNS_13ScrollbarPartEbffj
__ZN7WebCore12ChromeClient23paintCustomOverhangAreaEPNS_15GraphicsContextERKNS_7IntRectES5_S5_
@@ -327,7 +327,7 @@
__ZN7WebCore13TypingCommand39insertParagraphSeparatorInQuotedContentEPNS_8DocumentE
__ZN7WebCore13createWrapperEPN3JSC9ExecStateEPNS_17JSDOMGlobalObjectEPNS_4NodeE
__ZN7WebCore13directoryNameERKN3WTF6StringE
-__ZN7WebCore13toDeviceSpaceERKNS_9FloatRectEP8NSWindow
+__ZN7WebCore13toDeviceSpaceERKNS_9FloatRectEP8NSWindowf
__ZN7WebCore13toHTMLElementEPNS_21FormAssociatedElementE
__ZN7WebCore13toJSDOMWindowEN3JSC7JSValueE
__ZN7WebCore14CachedResource12removeClientEPNS_20CachedResourceClientE
Modified: branches/safari-534.54-branch/Source/WebCore/platform/PlatformScreen.h (106488 => 106489)
--- branches/safari-534.54-branch/Source/WebCore/platform/PlatformScreen.h 2012-02-01 21:34:08 UTC (rev 106488)
+++ branches/safari-534.54-branch/Source/WebCore/platform/PlatformScreen.h 2012-02-01 21:46:51 UTC (rev 106489)
@@ -43,20 +43,21 @@
namespace WebCore {
class FloatRect;
+ class FrameView;
class Widget;
int screenDepth(Widget*);
int screenDepthPerComponent(Widget*);
bool screenIsMonochrome(Widget*);
- FloatRect screenRect(Widget*);
- FloatRect screenAvailableRect(Widget*);
+ FloatRect screenRect(FrameView*);
+ FloatRect screenAvailableRect(FrameView*);
#if PLATFORM(MAC)
NSScreen *screenForWindow(NSWindow *);
- FloatRect toUserSpace(const NSRect&, NSWindow *destination);
- NSRect toDeviceSpace(const FloatRect&, NSWindow *source);
+ FloatRect toUserSpace(const NSRect&, NSWindow *destination, float deviceScaleFactor);
+ NSRect toDeviceSpace(const FloatRect&, NSWindow *source, float deviceScaleFactor);
NSPoint flipScreenPoint(const NSPoint&, NSScreen *);
#endif
Modified: branches/safari-534.54-branch/Source/WebCore/platform/mac/PlatformScreenMac.mm (106488 => 106489)
--- branches/safari-534.54-branch/Source/WebCore/platform/mac/PlatformScreenMac.mm 2012-02-01 21:34:08 UTC (rev 106488)
+++ branches/safari-534.54-branch/Source/WebCore/platform/mac/PlatformScreenMac.mm 2012-02-01 21:46:51 UTC (rev 106489)
@@ -51,16 +51,16 @@
// These functions scale between screen and page coordinates because _javascript_/DOM operations
// assume that the screen and the page share the same coordinate system.
-FloatRect screenRect(Widget* widget)
+FloatRect screenRect(FrameView* frameView)
{
- NSWindow *window = widget ? [widget->platformWidget() window] : nil;
- return toUserSpace([screenForWindow(window) frame], window);
+ NSWindow *window = frameView ? [frameView->platformWidget() window] : nil;
+ return toUserSpace([screenForWindow(window) frame], window, WebCore::deviceScaleFactor(frameView->frame()));
}
-FloatRect screenAvailableRect(Widget* widget)
+FloatRect screenAvailableRect(FrameView* frameView)
{
- NSWindow *window = widget ? [widget->platformWidget() window] : nil;
- return toUserSpace([screenForWindow(window) visibleFrame], window);
+ NSWindow *window = frameView ? [frameView->platformWidget() window] : nil;
+ return toUserSpace([screenForWindow(window) visibleFrame], window, WebCore::deviceScaleFactor(frameView->frame()));
}
NSScreen *screenForWindow(NSWindow *window)
@@ -76,29 +76,18 @@
return nil;
}
-static CGFloat windowScaleFactor(NSWindow *window)
+FloatRect toUserSpace(const NSRect& rect, NSWindow *destination, float deviceScaleFactor)
{
-#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
- return [window backingScaleFactor];
-#else
- return [window userSpaceScaleFactor];
-#endif
-}
-
-FloatRect toUserSpace(const NSRect& rect, NSWindow *destination)
-{
FloatRect userRect = rect;
userRect.setY(NSMaxY([screenForWindow(destination) frame]) - (userRect.y() + userRect.height())); // flip
- if (destination)
- userRect.scale(1 / windowScaleFactor(destination)); // scale down
+ userRect.scale(1 / deviceScaleFactor); // scale down
return userRect;
}
-NSRect toDeviceSpace(const FloatRect& rect, NSWindow *source)
+NSRect toDeviceSpace(const FloatRect& rect, NSWindow *source, float deviceScaleFactor)
{
FloatRect deviceRect = rect;
- if (source)
- deviceRect.scale(windowScaleFactor(source)); // scale up
+ deviceRect.scale(deviceScaleFactor); // scale up
deviceRect.setY(NSMaxY([screenForWindow(source) frame]) - (deviceRect.y() + deviceRect.height())); // flip
return deviceRect;
}
Modified: branches/safari-534.54-branch/Source/WebCore/platform/win/PlatformScreenWin.cpp (106488 => 106489)
--- branches/safari-534.54-branch/Source/WebCore/platform/win/PlatformScreenWin.cpp 2012-02-01 21:34:08 UTC (rev 106488)
+++ branches/safari-534.54-branch/Source/WebCore/platform/win/PlatformScreenWin.cpp 2012-02-01 21:46:51 UTC (rev 106489)
@@ -93,15 +93,15 @@
#endif
}
-FloatRect screenRect(Widget* widget)
+FloatRect screenRect(FrameView* frameView)
{
- MONITORINFOEX monitorInfo = monitorInfoForWidget(widget);
+ MONITORINFOEX monitorInfo = monitorInfoForWidget(frameView);
return monitorInfo.rcMonitor;
}
-FloatRect screenAvailableRect(Widget* widget)
+FloatRect screenAvailableRect(FrameView* frameView)
{
- MONITORINFOEX monitorInfo = monitorInfoForWidget(widget);
+ MONITORINFOEX monitorInfo = monitorInfoForWidget(frameView);
return monitorInfo.rcWork;
}
Modified: branches/safari-534.54-branch/Source/WebKit/chromium/ChangeLog (106488 => 106489)
--- branches/safari-534.54-branch/Source/WebKit/chromium/ChangeLog 2012-02-01 21:34:08 UTC (rev 106488)
+++ branches/safari-534.54-branch/Source/WebKit/chromium/ChangeLog 2012-02-01 21:46:51 UTC (rev 106489)
@@ -1,3 +1,19 @@
+2011-02-01 Lucas Forschler <[email protected]>
+
+ Merge 106271
+
+ 2012-01-30 Beth Dakin <[email protected]>
+
+ https://bugs.webkit.org/show_bug.cgi?id=77263
+ PlatformScreenMac should not rely on NSWindow for important bits of data
+
+ Reviewed by Geoff Garen.
+
+ These two functions now take a FrameView instead of a Widget.
+ * src/PlatformSupport.cpp:
+ (WebCore::PlatformSupport::screenRect):
+ (WebCore::PlatformSupport::screenAvailableRect):
+
2011-1-5 Lucas Forschler <[email protected]>
Merge 99439
Modified: branches/safari-534.54-branch/Source/WebKit/mac/ChangeLog (106488 => 106489)
--- branches/safari-534.54-branch/Source/WebKit/mac/ChangeLog 2012-02-01 21:34:08 UTC (rev 106488)
+++ branches/safari-534.54-branch/Source/WebKit/mac/ChangeLog 2012-02-01 21:46:51 UTC (rev 106489)
@@ -1,3 +1,21 @@
+2011-02-01 Lucas Forschler <[email protected]>
+
+ Merge 106271
+
+ 2012-01-30 Beth Dakin <[email protected]>
+
+ https://bugs.webkit.org/show_bug.cgi?id=77263
+ PlatformScreenMac should not rely on NSWindow for important bits of data
+
+ Reviewed by Geoff Garen.
+
+ toUserSpace() and toDeviceSpace() now take a parameter for the
+ deviceScaleFactor.
+ * WebCoreSupport/WebChromeClient.mm:
+ (windowScaleFactor):
+ (WebChromeClient::setWindowRect):
+ (WebChromeClient::windowRect):
+
2012-01-25 Mark Rowe <[email protected]>
Merge r105942.
Modified: branches/safari-534.54-branch/Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm (106488 => 106489)
--- branches/safari-534.54-branch/Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm 2012-02-01 21:34:08 UTC (rev 106488)
+++ branches/safari-534.54-branch/Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm 2012-02-01 21:46:51 UTC (rev 106489)
@@ -154,19 +154,16 @@
delete this;
}
-// These functions scale between window and WebView coordinates because _javascript_/DOM operations
-// assume that the WebView and the window share the same coordinate system.
-
void WebChromeClient::setWindowRect(const FloatRect& rect)
{
- NSRect windowRect = toDeviceSpace(rect, [m_webView window]);
+ NSRect windowRect = toDeviceSpace(rect, [m_webView window], [m_webView _backingScaleFactor]);
[[m_webView _UIDelegateForwarder] webView:m_webView setFrame:windowRect];
}
FloatRect WebChromeClient::windowRect()
{
NSRect windowRect = [[m_webView _UIDelegateForwarder] webViewFrame:m_webView];
- return toUserSpace(windowRect, [m_webView window]);
+ return toUserSpace(windowRect, [m_webView window], [m_webView _backingScaleFactor]);
}
// FIXME: We need to add API for setting and getting this.
Modified: branches/safari-534.54-branch/Source/WebKit2/ChangeLog (106488 => 106489)
--- branches/safari-534.54-branch/Source/WebKit2/ChangeLog 2012-02-01 21:34:08 UTC (rev 106488)
+++ branches/safari-534.54-branch/Source/WebKit2/ChangeLog 2012-02-01 21:46:51 UTC (rev 106489)
@@ -1,3 +1,20 @@
+2011-02-01 Lucas Forschler <[email protected]>
+
+ Merge 106271
+
+ 2012-01-30 Beth Dakin <[email protected]>
+
+ https://bugs.webkit.org/show_bug.cgi?id=77263
+ PlatformScreenMac should not rely on NSWindow for important bits of data
+
+ Reviewed by Geoff Garen.
+
+ toUserSpace() and toDeviceSpace() now take a parameter for the
+ deviceScaleFactor.
+ * UIProcess/API/mac/WKView.mm:
+ (-[WKView _convertToDeviceSpace:]):
+ (-[WKView _convertToUserSpace:]):
+
2012-01-26 Mark Rowe <[email protected]>
Merge r102507.
Modified: branches/safari-534.54-branch/Source/WebKit2/UIProcess/API/mac/WKView.mm (106488 => 106489)
--- branches/safari-534.54-branch/Source/WebKit2/UIProcess/API/mac/WKView.mm 2012-02-01 21:34:08 UTC (rev 106488)
+++ branches/safari-534.54-branch/Source/WebKit2/UIProcess/API/mac/WKView.mm 2012-02-01 21:46:51 UTC (rev 106489)
@@ -2134,12 +2134,12 @@
- (NSRect)_convertToDeviceSpace:(NSRect)rect
{
- return toDeviceSpace(rect, [self window]);
+ return toDeviceSpace(rect, [self window], _data->_page->deviceScaleFactor());
}
- (NSRect)_convertToUserSpace:(NSRect)rect
{
- return toUserSpace(rect, [self window]);
+ return toUserSpace(rect, [self window], _data->_page->deviceScaleFactor());
}
// Any non-zero value will do, but using something recognizable might help us debug some day.