Diff
Modified: trunk/Source/WebCore/ChangeLog (106270 => 106271)
--- trunk/Source/WebCore/ChangeLog 2012-01-30 19:37:41 UTC (rev 106270)
+++ trunk/Source/WebCore/ChangeLog 2012-01-30 19:47:34 UTC (rev 106271)
@@ -1,3 +1,54 @@
+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):
+
2012-01-30 Antti Koivisto <[email protected]>
Kill CSSMutableStyleDeclarationConstIterator
Modified: trunk/Source/WebCore/WebCore.exp.in (106270 => 106271)
--- trunk/Source/WebCore/WebCore.exp.in 2012-01-30 19:37:41 UTC (rev 106270)
+++ trunk/Source/WebCore/WebCore.exp.in 2012-01-30 19:47:34 UTC (rev 106271)
@@ -220,7 +220,7 @@
__ZN7WebCore11globalPointERK8_NSPointP8NSWindow
__ZN7WebCore11memoryCacheEv
__ZN7WebCore11startOfWordERKNS_15VisiblePositionENS_9EWordSideE
-__ZN7WebCore11toUserSpaceERK7_NSRectP8NSWindow
+__ZN7WebCore11toUserSpaceERK6CGRectP8NSWindowf
__ZN7WebCore11writeToFileEiPKci
__ZN7WebCore12ChromeClient23paintCustomOverhangAreaEPNS_15GraphicsContextERKNS_7IntRectES5_S5_
__ZN7WebCore12EditingStyleD1Ev
@@ -326,7 +326,7 @@
__ZN7WebCore13TypingCommand39insertParagraphSeparatorInQuotedContentEPNS_8DocumentE
__ZN7WebCore13createWrapperEPN3JSC9ExecStateEPNS_17JSDOMGlobalObjectEPNS_4NodeE
__ZN7WebCore13directoryNameERKN3WTF6StringE
-__ZN7WebCore13toDeviceSpaceERKNS_9FloatRectEP8NSWindow
+__ZN7WebCore13toDeviceSpaceERKNS_9FloatRectEP8NSWindowf
__ZN7WebCore13toHTMLElementEPNS_21FormAssociatedElementE
__ZN7WebCore13toJSDOMWindowEN3JSC7JSValueE
__ZN7WebCore14CachedResource12removeClientEPNS_20CachedResourceClientE
Modified: trunk/Source/WebCore/platform/PlatformScreen.h (106270 => 106271)
--- trunk/Source/WebCore/platform/PlatformScreen.h 2012-01-30 19:37:41 UTC (rev 106270)
+++ trunk/Source/WebCore/platform/PlatformScreen.h 2012-01-30 19:47:34 UTC (rev 106271)
@@ -40,6 +40,7 @@
namespace WebCore {
class FloatRect;
+ class FrameView;
class Widget;
int screenHorizontalDPI(Widget*);
@@ -48,14 +49,14 @@
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: trunk/Source/WebCore/platform/blackberry/PlatformScreenBlackBerry.cpp (106270 => 106271)
--- trunk/Source/WebCore/platform/blackberry/PlatformScreenBlackBerry.cpp 2012-01-30 19:37:41 UTC (rev 106270)
+++ trunk/Source/WebCore/platform/blackberry/PlatformScreenBlackBerry.cpp 2012-01-30 19:47:34 UTC (rev 106271)
@@ -20,6 +20,7 @@
#include "PlatformScreen.h"
#include "FloatRect.h"
+#include "FrameView.h"
#include "Widget.h"
#include <BlackBerryPlatformScreen.h>
@@ -41,12 +42,12 @@
return 24;
}
-FloatRect screenAvailableRect(Widget* widget)
+FloatRect screenAvailableRect(FrameView* frameView)
{
return FloatRect(FloatPoint(), FloatSize(IntSize(BlackBerry::Platform::Graphics::Screen::size())));
}
-FloatRect screenRect(Widget* widget)
+FloatRect screenRect(FrameView* frameView)
{
return FloatRect(FloatPoint(), FloatSize(IntSize(BlackBerry::Platform::Graphics::Screen::size())));
}
Modified: trunk/Source/WebCore/platform/chromium/PlatformScreenChromium.cpp (106270 => 106271)
--- trunk/Source/WebCore/platform/chromium/PlatformScreenChromium.cpp 2012-01-30 19:37:41 UTC (rev 106270)
+++ trunk/Source/WebCore/platform/chromium/PlatformScreenChromium.cpp 2012-01-30 19:47:34 UTC (rev 106271)
@@ -31,6 +31,7 @@
#include "config.h"
#include "PlatformScreen.h"
+#include "FrameView.h"
#include "IntRect.h"
#include "PlatformSupport.h"
@@ -61,14 +62,14 @@
return PlatformSupport::screenIsMonochrome(widget);
}
-FloatRect screenRect(Widget* widget)
+FloatRect screenRect(FrameView* frameView)
{
- return PlatformSupport::screenRect(widget);
+ return PlatformSupport::screenRect(frameView);
}
-FloatRect screenAvailableRect(Widget* widget)
+FloatRect screenAvailableRect(FrameView* frameView)
{
- return PlatformSupport::screenAvailableRect(widget);
+ return PlatformSupport::screenAvailableRect(frameView);
}
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/chromium/PlatformSupport.h (106270 => 106271)
--- trunk/Source/WebCore/platform/chromium/PlatformSupport.h 2012-01-30 19:37:41 UTC (rev 106270)
+++ trunk/Source/WebCore/platform/chromium/PlatformSupport.h 2012-01-30 19:47:34 UTC (rev 106271)
@@ -71,6 +71,7 @@
class Cursor;
class Document;
class Frame;
+class FrameView;
class GamepadList;
class GeolocationServiceBridge;
class GeolocationServiceChromium;
@@ -245,8 +246,8 @@
static int screenDepth(Widget*);
static int screenDepthPerComponent(Widget*);
static bool screenIsMonochrome(Widget*);
- static IntRect screenRect(Widget*);
- static IntRect screenAvailableRect(Widget*);
+ static IntRect screenRect(FrameView*);
+ static IntRect screenAvailableRect(FrameView*);
// SharedTimers -------------------------------------------------------
static void setSharedTimerFiredFunction(void (*func)());
Modified: trunk/Source/WebCore/platform/efl/PlatformScreenEfl.cpp (106270 => 106271)
--- trunk/Source/WebCore/platform/efl/PlatformScreenEfl.cpp 2012-01-30 19:37:41 UTC (rev 106270)
+++ trunk/Source/WebCore/platform/efl/PlatformScreenEfl.cpp 2012-01-30 19:47:34 UTC (rev 106271)
@@ -34,6 +34,7 @@
#include "config.h"
#include "PlatformScreen.h"
+#include "FrameView.h"
#include "NotImplemented.h"
#include "PlatformString.h"
#include "Widget.h"
@@ -73,23 +74,23 @@
return false;
}
-FloatRect screenRect(Widget* widget)
+FloatRect screenRect(FrameView* frameView)
{
- if (!widget)
+ if (!frameView)
return FloatRect();
int x, y, w, h;
- Evas* e = widget->evas();
+ Evas* e = frameView->evas();
ecore_evas_screen_geometry_get(ecore_evas_ecore_evas_get(e), &x, &y, &w, &h);
return FloatRect(x, y, w, h);
}
-FloatRect screenAvailableRect(Widget* widget)
+FloatRect screenAvailableRect(FrameView* frameView)
{
notImplemented();
- return screenRect(widget);
+ return screenRect(frameView);
}
}
Modified: trunk/Source/WebCore/platform/gtk/PlatformScreenGtk.cpp (106270 => 106271)
--- trunk/Source/WebCore/platform/gtk/PlatformScreenGtk.cpp 2012-01-30 19:37:41 UTC (rev 106270)
+++ trunk/Source/WebCore/platform/gtk/PlatformScreenGtk.cpp 2012-01-30 19:47:34 UTC (rev 106271)
@@ -31,6 +31,7 @@
#include "config.h"
#include "PlatformScreen.h"
+#include "FrameView.h"
#include "GtkVersioning.h"
#include "HostWindow.h"
#include "NotImplemented.h"
@@ -100,9 +101,9 @@
return gtk_widget_has_screen(widget) ? gtk_widget_get_screen(widget) : gdk_screen_get_default();
}
-FloatRect screenRect(Widget* widget)
+FloatRect screenRect(FrameView* frameView)
{
- GtkWidget* container = widget ? GTK_WIDGET(widget->root()->hostWindow()->platformPageClient()) : 0;
+ GtkWidget* container = frameView ? GTK_WIDGET(frameView->root()->hostWindow()->platformPageClient()) : 0;
if (container)
container = getToplevel(container);
@@ -118,11 +119,11 @@
return FloatRect(geometry.x, geometry.y, geometry.width, geometry.height);
}
-FloatRect screenAvailableRect(Widget* widget)
+FloatRect screenAvailableRect(FrameView* frameView)
{
- GtkWidget* container = widget ? GTK_WIDGET(widget->root()->hostWindow()->platformPageClient()) : 0;
+ GtkWidget* container = frameView ? GTK_WIDGET(frameView->root()->hostWindow()->platformPageClient()) : 0;
if (container && !gtk_widget_get_realized(container))
- return screenRect(widget);
+ return screenRect(frameView);
GdkScreen* screen = container ? getScreen(container) : gdk_screen_get_default();
if (!screen)
Modified: trunk/Source/WebCore/platform/mac/PlatformScreenMac.mm (106270 => 106271)
--- trunk/Source/WebCore/platform/mac/PlatformScreenMac.mm 2012-01-30 19:37:41 UTC (rev 106270)
+++ trunk/Source/WebCore/platform/mac/PlatformScreenMac.mm 2012-01-30 19:47:34 UTC (rev 106271)
@@ -64,16 +64,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)
@@ -89,29 +89,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: trunk/Source/WebCore/platform/qt/PlatformScreenQt.cpp (106270 => 106271)
--- trunk/Source/WebCore/platform/qt/PlatformScreenQt.cpp 2012-01-30 19:37:41 UTC (rev 106270)
+++ trunk/Source/WebCore/platform/qt/PlatformScreenQt.cpp 2012-01-30 19:47:34 UTC (rev 106271)
@@ -102,15 +102,15 @@
return QApplication::desktop()->screen(screenNumber(w))->colorCount() == 2;
}
-FloatRect screenRect(Widget* w)
+FloatRect screenRect(FrameView* frameView)
{
- QRect r = QApplication::desktop()->screenGeometry(screenNumber(w));
+ QRect r = QApplication::desktop()->screenGeometry(screenNumber(frameView));
return FloatRect(r.x(), r.y(), r.width(), r.height());
}
-FloatRect screenAvailableRect(Widget* w)
+FloatRect screenAvailableRect(FrameView* frameView)
{
- QRect r = QApplication::desktop()->availableGeometry(screenNumber(w));
+ QRect r = QApplication::desktop()->availableGeometry(screenNumber(frameView));
return FloatRect(r.x(), r.y(), r.width(), r.height());
}
Modified: trunk/Source/WebCore/platform/win/PlatformScreenWin.cpp (106270 => 106271)
--- trunk/Source/WebCore/platform/win/PlatformScreenWin.cpp 2012-01-30 19:37:41 UTC (rev 106270)
+++ trunk/Source/WebCore/platform/win/PlatformScreenWin.cpp 2012-01-30 19:47:34 UTC (rev 106271)
@@ -106,15 +106,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: trunk/Source/WebCore/platform/wx/ScreenWx.cpp (106270 => 106271)
--- trunk/Source/WebCore/platform/wx/ScreenWx.cpp 2012-01-30 19:37:41 UTC (rev 106270)
+++ trunk/Source/WebCore/platform/wx/ScreenWx.cpp 2012-01-30 19:47:34 UTC (rev 106271)
@@ -28,6 +28,7 @@
#include "Screen.h"
#include "IntRect.h"
#include "FloatRect.h"
+#include "FrameView.h"
#include "NotImplemented.h"
#include "Widget.h"
@@ -48,7 +49,7 @@
return 0;
}
-FloatRect screenRect(Widget* widget)
+FloatRect screenRect(FrameView* frameView)
{
/*
int displayNum;
@@ -77,7 +78,7 @@
return wxColourDisplay();
}
-FloatRect screenAvailableRect(Widget* widget)
+FloatRect screenAvailableRect(FrameView* frameView)
{
/*
Widget* widget = widget->widget();
Modified: trunk/Source/WebKit/chromium/ChangeLog (106270 => 106271)
--- trunk/Source/WebKit/chromium/ChangeLog 2012-01-30 19:37:41 UTC (rev 106270)
+++ trunk/Source/WebKit/chromium/ChangeLog 2012-01-30 19:47:34 UTC (rev 106271)
@@ -1,3 +1,15 @@
+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):
+
2012-01-30 Ami Fischman <[email protected]>
[chromium] enable -Wexit-time-destructors for webkit unit tests
Modified: trunk/Source/WebKit/chromium/src/PlatformSupport.cpp (106270 => 106271)
--- trunk/Source/WebKit/chromium/src/PlatformSupport.cpp 2012-01-30 19:37:41 UTC (rev 106270)
+++ trunk/Source/WebKit/chromium/src/PlatformSupport.cpp 2012-01-30 19:47:34 UTC (rev 106271)
@@ -1092,17 +1092,17 @@
return client->screenInfo().isMonochrome;
}
-IntRect PlatformSupport::screenRect(Widget* widget)
+IntRect PlatformSupport::screenRect(FrameView* frameView)
{
- WebWidgetClient* client = toWebWidgetClient(widget);
+ WebWidgetClient* client = toWebWidgetClient(frameView);
if (!client)
return IntRect();
return client->screenInfo().rect;
}
-IntRect PlatformSupport::screenAvailableRect(Widget* widget)
+IntRect PlatformSupport::screenAvailableRect(FrameView* frameView)
{
- WebWidgetClient* client = toWebWidgetClient(widget);
+ WebWidgetClient* client = toWebWidgetClient(frameView);
if (!client)
return IntRect();
return client->screenInfo().availableRect;
Modified: trunk/Source/WebKit/mac/ChangeLog (106270 => 106271)
--- trunk/Source/WebKit/mac/ChangeLog 2012-01-30 19:37:41 UTC (rev 106270)
+++ trunk/Source/WebKit/mac/ChangeLog 2012-01-30 19:47:34 UTC (rev 106271)
@@ -1,3 +1,17 @@
+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]>
Build in to an alternate location when USE_STAGING_INSTALL_PATH is set.
Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm (106270 => 106271)
--- trunk/Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm 2012-01-30 19:37:41 UTC (rev 106270)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm 2012-01-30 19:47:34 UTC (rev 106271)
@@ -150,19 +150,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: trunk/Source/WebKit2/ChangeLog (106270 => 106271)
--- trunk/Source/WebKit2/ChangeLog 2012-01-30 19:37:41 UTC (rev 106270)
+++ trunk/Source/WebKit2/ChangeLog 2012-01-30 19:47:34 UTC (rev 106271)
@@ -1,3 +1,16 @@
+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 No'am Rosenthal <[email protected]> and Jocelyn Turcotte <[email protected]>
[Qt] WKTR: Use a software rendering pipiline when running tests.
Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm (106270 => 106271)
--- trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm 2012-01-30 19:37:41 UTC (rev 106270)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm 2012-01-30 19:47:34 UTC (rev 106271)
@@ -2272,12 +2272,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.