Title: [198595] trunk/Source/WebCore
- Revision
- 198595
- Author
- [email protected]
- Date
- 2016-03-23 14:20:38 -0700 (Wed, 23 Mar 2016)
Log Message
Screen queries should query the exact screen, not a default
https://bugs.webkit.org/show_bug.cgi?id=155806
<rdar://problem/25322916>
Reviewed by Simon Fraser.
Some of our media queries were using helper functions that
would query the capabilities of the deepest screen, rather
than the currently used screen. I changed them to use
the existing helper function (that works with WebKit 2)
and comment in some other helpers why a generic check is
ok.
Covered by the existing tests.
* platform/mac/PlatformScreenMac.mm:
(WebCore::screenDepth): Use the helper function.
(WebCore::screenDepthPerComponent):
(WebCore::screenIsMonochrome): Move these and make a comment.
(WebCore::screenHasInvertedColors):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (198594 => 198595)
--- trunk/Source/WebCore/ChangeLog 2016-03-23 21:07:35 UTC (rev 198594)
+++ trunk/Source/WebCore/ChangeLog 2016-03-23 21:20:38 UTC (rev 198595)
@@ -1,3 +1,26 @@
+2016-03-23 Dean Jackson <[email protected]>
+
+ Screen queries should query the exact screen, not a default
+ https://bugs.webkit.org/show_bug.cgi?id=155806
+ <rdar://problem/25322916>
+
+ Reviewed by Simon Fraser.
+
+ Some of our media queries were using helper functions that
+ would query the capabilities of the deepest screen, rather
+ than the currently used screen. I changed them to use
+ the existing helper function (that works with WebKit 2)
+ and comment in some other helpers why a generic check is
+ ok.
+
+ Covered by the existing tests.
+
+ * platform/mac/PlatformScreenMac.mm:
+ (WebCore::screenDepth): Use the helper function.
+ (WebCore::screenDepthPerComponent):
+ (WebCore::screenIsMonochrome): Move these and make a comment.
+ (WebCore::screenHasInvertedColors):
+
2016-03-23 Daniel Bates <[email protected]>
CSP: Make violation console messages concise and consistent
Modified: trunk/Source/WebCore/platform/mac/PlatformScreenMac.mm (198594 => 198595)
--- trunk/Source/WebCore/platform/mac/PlatformScreenMac.mm 2016-03-23 21:07:35 UTC (rev 198594)
+++ trunk/Source/WebCore/platform/mac/PlatformScreenMac.mm 2016-03-23 21:20:38 UTC (rev 198595)
@@ -51,26 +51,6 @@
return nil;
}
-int screenDepth(Widget*)
-{
- return NSBitsPerPixelFromDepth([[NSScreen deepestScreen] depth]);
-}
-
-int screenDepthPerComponent(Widget*)
-{
- return NSBitsPerSampleFromDepth([[NSScreen deepestScreen] depth]);
-}
-
-bool screenIsMonochrome(Widget*)
-{
- return CGDisplayUsesForceToGray();
-}
-
-bool screenHasInvertedColors()
-{
- return CGDisplayUsesInvertedPolarity();
-}
-
// These functions scale between screen and page coordinates because _javascript_/DOM operations
// assume that the screen and the page share the same coordinate system.
@@ -100,6 +80,34 @@
return screenForWindow(nil);
}
+int screenDepth(Widget* widget)
+{
+ NSWindow *window = widget ? [widget->platformWidget() window] : nil;
+ NSScreen *screen = screenForWidget(widget, window);
+ return NSBitsPerPixelFromDepth(screen.depth);
+}
+
+int screenDepthPerComponent(Widget* widget)
+{
+ NSWindow *window = widget ? [widget->platformWidget() window] : nil;
+ NSScreen *screen = screenForWidget(widget, window);
+ return NSBitsPerSampleFromDepth(screen.depth);
+}
+
+bool screenIsMonochrome(Widget*)
+{
+ // At the moment this is a system-wide accessibility setting,
+ // so we don't need to check the screen we're using.
+ return CGDisplayUsesForceToGray();
+}
+
+bool screenHasInvertedColors()
+{
+ // At the moment this is a system-wide accessibility setting,
+ // so we don't need to check the screen we're using.
+ return CGDisplayUsesInvertedPolarity();
+}
+
FloatRect screenRect(Widget* widget)
{
NSWindow *window = widget ? [widget->platformWidget() window] : nil;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes