Diff
Modified: trunk/LayoutTests/ChangeLog (165469 => 165470)
--- trunk/LayoutTests/ChangeLog 2014-03-12 14:42:42 UTC (rev 165469)
+++ trunk/LayoutTests/ChangeLog 2014-03-12 15:34:47 UTC (rev 165470)
@@ -1,3 +1,19 @@
+2014-03-12 Zalan Bujtas <[email protected]>
+
+ Add hiDPI support for compositing content in DumpRenderTree/WebKitTestRunner
+ https://bugs.webkit.org/show_bug.cgi?id=129961
+
+ Reviewed by Simon Fraser.
+
+ Now scaled content can go through the window capturing mechanism too for compositing content.
+ AppleMagnifiedMode is redundant.
+
+ * compositing/hidpi-compositing-vs-non-compositing-check-on-testing-framework-expected.html: Added.
+ * compositing/hidpi-compositing-vs-non-compositing-check-on-testing-framework.html: Added.
+ * svg/custom/hidpi-masking-clipping-expected.svg: Added.
+ * svg/custom/hidpi-masking-clipping.svg: Renamed from LayoutTests/svg/custom/masking-clipping-hidpi.svg.
+ * svg/custom/masking-clipping-hidpi-expected.svg: Removed.
+
2014-03-12 Antti Koivisto <[email protected]>
Update result after https://trac.webkit.org/r165465
Added: trunk/LayoutTests/compositing/hidpi-compositing-vs-non-compositing-check-on-testing-framework-expected.html (0 => 165470)
--- trunk/LayoutTests/compositing/hidpi-compositing-vs-non-compositing-check-on-testing-framework-expected.html (rev 0)
+++ trunk/LayoutTests/compositing/hidpi-compositing-vs-non-compositing-check-on-testing-framework-expected.html 2014-03-12 15:34:47 UTC (rev 165470)
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests that hidpi content with compositing layers matches non-compositing drawing in DumpRenderTree/WebKitTestRunner context</title>
+<style>
+ div {
+ border: green solid 0.5px;
+ width: 10px;
+ height: 10px;
+ position: absolute;
+ }
+</style>
+</head>
+<body>
+<p id="container"></p>
+<script>
+ var container = document.getElementById("container");
+ adjustment = 0;
+ for (i = 0; i < 15; ++i) {
+ adjustment+=0.5;
+ for (j = 0; j < 15; ++j) {
+ var e = document.createElement("div");
+ e.style.top = (22 * i + j * adjustment) + "px";
+ e.style.left = (22 * j + i * adjustment) + "px";
+ container.appendChild(e);
+ }
+ }
+</script>
+</body>
+</html>
\ No newline at end of file
Added: trunk/LayoutTests/compositing/hidpi-compositing-vs-non-compositing-check-on-testing-framework.html (0 => 165470)
--- trunk/LayoutTests/compositing/hidpi-compositing-vs-non-compositing-check-on-testing-framework.html (rev 0)
+++ trunk/LayoutTests/compositing/hidpi-compositing-vs-non-compositing-check-on-testing-framework.html 2014-03-12 15:34:47 UTC (rev 165470)
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests that hidpi content with compositing layers matches non-compositing drawing in DumpRenderTree/WebKitTestRunner context</title>
+<style>
+ div {
+ border: green solid 0.5px;
+ width: 10px;
+ height: 10px;
+ position: absolute;
+ -webkit-transform: rotate3D(0, 0, 1, 90deg);
+ }
+</style>
+</head>
+<body>
+<p id="container"></p>
+<script>
+ var container = document.getElementById("container");
+ adjustment = 0;
+ for (i = 0; i < 15; ++i) {
+ adjustment+=0.5;
+ for (j = 0; j < 15; ++j) {
+ var e = document.createElement("div");
+ e.style.top = (22 * i + j * adjustment) + "px";
+ e.style.left = (22 * j + i * adjustment) + "px";
+ container.appendChild(e);
+ }
+ }
+</script>
+</body>
+</html>
\ No newline at end of file
Added: trunk/LayoutTests/svg/custom/hidpi-masking-clipping-expected.svg (0 => 165470)
--- trunk/LayoutTests/svg/custom/hidpi-masking-clipping-expected.svg (rev 0)
+++ trunk/LayoutTests/svg/custom/hidpi-masking-clipping-expected.svg 2014-03-12 15:34:47 UTC (rev 165470)
@@ -0,0 +1,14 @@
+<svg xmlns="http://www.w3.org/2000/svg">
+ <style>
+ text {
+ -webkit-font-smoothing: antialiased;
+ }
+ </style>
+
+ <text x='0' y='12'>This text should be sharp.</text>
+ <text x='0' y='36'>This text and the circles should also be sharp.</text>
+
+ <circle cx="25" cy="85" r="20"/>
+ <circle cx="25" cy="135" r="20"/>
+ <circle cx="25" cy="187" r="20"/>
+</svg>
Copied: trunk/LayoutTests/svg/custom/hidpi-masking-clipping.svg (from rev 165469, trunk/LayoutTests/svg/custom/masking-clipping-hidpi.svg) (0 => 165470)
--- trunk/LayoutTests/svg/custom/hidpi-masking-clipping.svg (rev 0)
+++ trunk/LayoutTests/svg/custom/hidpi-masking-clipping.svg 2014-03-12 15:34:47 UTC (rev 165470)
@@ -0,0 +1,39 @@
+<svg xmlns="http://www.w3.org/2000/svg">
+ <style>
+ text {
+ -webkit-font-smoothing: antialiased;
+ }
+ </style>
+
+ <defs>
+ <mask id="textMask">
+ <rect width='100%' height='100%' fill='white'/>
+ <text width='100%' height='100%' x='0' y='12'>This text should be sharp.</text>
+ </mask>
+ </defs>
+ <rect width='200' height='100' fill='black'/>
+ <rect width='200' height='100' fill='white' mask="url(#textMask)"/>
+
+ <defs>
+ <linearGradient id="blackGradient" x1="0%" y1="0%" x2="100%" y2="0%">
+ <stop offset="0%" style="stop-color:rgb(0,0,0);"/>
+ <stop offset="100%" style="stop-color:rgb(0,0,0);"/>
+ </linearGradient>
+ </defs>
+ <text x='0' y='36' fill="url(#blackGradient)">This text and the circles should also be sharp.</text>
+
+ <defs>
+ <clipPath id="circleClipPath" clipPathUnits="objectBoundingBox">
+ <circle cx="0.25" cy="0.25" r="0.20"/>
+ <circle cx="0.25" cy="0.75" r="0.20"/>
+ </clipPath>
+ </defs>
+ <rect x="0" y="60" width="100" height="100" clip-path="url(#circleClipPath)"/>
+
+ <defs>
+ <pattern id="Pattern" width="1" height="1">
+ <circle cx="25" cy="25" r="20" fill="url(#blackGradient)"/>
+ </pattern>
+ </defs>
+ <rect fill="url(#Pattern)" x="0" y="162" width="200" height="200"/>
+</svg>
Deleted: trunk/LayoutTests/svg/custom/masking-clipping-hidpi-expected.svg (165469 => 165470)
--- trunk/LayoutTests/svg/custom/masking-clipping-hidpi-expected.svg 2014-03-12 14:42:42 UTC (rev 165469)
+++ trunk/LayoutTests/svg/custom/masking-clipping-hidpi-expected.svg 2014-03-12 15:34:47 UTC (rev 165470)
@@ -1,27 +0,0 @@
-<svg xmlns="http://www.w3.org/2000/svg" _onload_="startTest()">
- <script>
- function startTest() {
- if (!window.testRunner)
- return;
-
- testRunner.waitUntilDone();
- testRunner.setBackingScaleFactor(2, finishTest);
- }
-
- function finishTest() {
- setTimeout(function () { testRunner.notifyDone(); }, 0);
- }
- </script>
- <style>
- text {
- -webkit-font-smoothing: antialiased;
- }
- </style>
-
- <text x='0' y='12'>This text should be sharp.</text>
- <text x='0' y='36'>This text and the circles should also be sharp.</text>
-
- <circle cx="25" cy="85" r="20"/>
- <circle cx="25" cy="135" r="20"/>
- <circle cx="25" cy="187" r="20"/>
-</svg>
Deleted: trunk/LayoutTests/svg/custom/masking-clipping-hidpi.svg (165469 => 165470)
--- trunk/LayoutTests/svg/custom/masking-clipping-hidpi.svg 2014-03-12 14:42:42 UTC (rev 165469)
+++ trunk/LayoutTests/svg/custom/masking-clipping-hidpi.svg 2014-03-12 15:34:47 UTC (rev 165470)
@@ -1,52 +0,0 @@
-<svg xmlns="http://www.w3.org/2000/svg" _onload_="startTest()">
- <script>
- function startTest() {
- if (!window.testRunner)
- return;
-
- testRunner.waitUntilDone();
- testRunner.setBackingScaleFactor(2, finishTest);
- }
-
- function finishTest() {
- setTimeout(function () { testRunner.notifyDone(); }, 0);
- }
- </script>
- <style>
- text {
- -webkit-font-smoothing: antialiased;
- }
- </style>
-
- <defs>
- <mask id="textMask">
- <rect width='100%' height='100%' fill='white'/>
- <text width='100%' height='100%' x='0' y='12'>This text should be sharp.</text>
- </mask>
- </defs>
- <rect width='200' height='100' fill='black'/>
- <rect width='200' height='100' fill='white' mask="url(#textMask)"/>
-
- <defs>
- <linearGradient id="blackGradient" x1="0%" y1="0%" x2="100%" y2="0%">
- <stop offset="0%" style="stop-color:rgb(0,0,0);"/>
- <stop offset="100%" style="stop-color:rgb(0,0,0);"/>
- </linearGradient>
- </defs>
- <text x='0' y='36' fill="url(#blackGradient)">This text and the circles should also be sharp.</text>
-
- <defs>
- <clipPath id="circleClipPath" clipPathUnits="objectBoundingBox">
- <circle cx="0.25" cy="0.25" r="0.20"/>
- <circle cx="0.25" cy="0.75" r="0.20"/>
- </clipPath>
- </defs>
- <rect x="0" y="60" width="100" height="100" clip-path="url(#circleClipPath)"/>
-
- <defs>
- <pattern id="Pattern" width="1" height="1">
- <circle cx="25" cy="25" r="20" fill="url(#blackGradient)"/>
- </pattern>
- </defs>
- <rect fill="url(#Pattern)" x="0" y="162" width="200" height="200"/>
-</svg>
Modified: trunk/Tools/ChangeLog (165469 => 165470)
--- trunk/Tools/ChangeLog 2014-03-12 14:42:42 UTC (rev 165469)
+++ trunk/Tools/ChangeLog 2014-03-12 15:34:47 UTC (rev 165470)
@@ -1,3 +1,28 @@
+2014-03-12 Zalan Bujtas <[email protected]>
+
+ Add hiDPI support for compositing content in DumpRenderTree/WebKitTestRunner
+ https://bugs.webkit.org/show_bug.cgi?id=129961
+
+ Reviewed by Simon Fraser.
+
+ Now scaled content can go through the window capturing mechanism too for compositing content.
+ AppleMagnifiedMode is redundant.
+
+ * DumpRenderTree/mac/DumpRenderTree.mm:
+ (setDefaultsToConsistentValuesForTesting):
+ (runTest):
+ * DumpRenderTree/mac/PixelDumpSupportMac.mm:
+ (createBitmapContextFromWebView):
+ * WebKitTestRunner/PlatformWebView.h:
+ * WebKitTestRunner/cg/TestInvocationCG.cpp:
+ (WTR::TestInvocation::dumpPixelsAndCompareWithExpected):
+ * WebKitTestRunner/mac/PlatformWebViewMac.mm:
+ (WTR::PlatformWebView::didInitializeClients):
+ (WTR::PlatformWebView::changeWindowScaleIfNeeded):
+ (WTR::PlatformWebView::forceWindowFramesChanged):
+ * WebKitTestRunner/mac/main.mm:
+ (setDefaultsToConsistentValuesForTesting):
+
2014-03-12 Anton Obzhirov <[email protected]>
Unreviewed. Add myself as a committer.
Modified: trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm (165469 => 165470)
--- trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm 2014-03-12 14:42:42 UTC (rev 165469)
+++ trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm 2014-03-12 15:34:47 UTC (rev 165470)
@@ -928,7 +928,6 @@
NSDictionary *dict = @{
@"AppleKeyboardUIMode": @1,
- @"AppleMagnifiedMode": @YES,
@"AppleAntiAliasingThreshold": @4,
@"AppleFontSmoothing": @(NoFontSmoothing),
@"AppleAquaColorVariant": @(BlueTintedAppearance),
@@ -1759,10 +1758,10 @@
const char* testURL([[url absoluteString] UTF8String]);
+ resetWebViewToConsistentStateBeforeTesting();
#if !PLATFORM(IOS)
changeWindowScaleIfNeeded(testURL);
#endif
- resetWebViewToConsistentStateBeforeTesting();
gTestRunner = TestRunner::create(testURL, command.expectedPixelHash);
topLoadingFrame = nil;
Modified: trunk/Tools/DumpRenderTree/mac/PixelDumpSupportMac.mm (165469 => 165470)
--- trunk/Tools/DumpRenderTree/mac/PixelDumpSupportMac.mm 2014-03-12 14:42:42 UTC (rev 165469)
+++ trunk/Tools/DumpRenderTree/mac/PixelDumpSupportMac.mm 2014-03-12 15:34:47 UTC (rev 165470)
@@ -111,7 +111,10 @@
if (!bitmapContext)
return 0;
CGContextRef context = bitmapContext->cgContext();
- CGContextScaleCTM(context, deviceScaleFactor, deviceScaleFactor);
+ // The final scaling gets doubled on the screen capture surface when we use the hidpi backingScaleFactor value for CTM.
+ // This is a workaround to push the scaling back.
+ float scaleForCTM = onscreen ? 1 : [view _backingScaleFactor];
+ CGContextScaleCTM(context, scaleForCTM, scaleForCTM);
NSGraphicsContext *nsContext = [NSGraphicsContext graphicsContextWithGraphicsPort:context flipped:NO];
ASSERT(nsContext);
@@ -125,13 +128,7 @@
[view displayRectIgnoringOpacity:line inContext:nsContext];
}
} else {
- if (deviceScaleFactor != 1) {
- // Call displayRectIgnoringOpacity for HiDPI tests since it ensures we paint directly into the context
- // that we have appropriately sized and scaled.
- [view displayRectIgnoringOpacity:[view bounds] inContext:nsContext];
- if ([view isTrackingRepaints])
- paintRepaintRectOverlay(view, context);
- } else if (onscreen) {
+ if (onscreen) {
// displayIfNeeded does not update the CA layers if the layer-hosting view was not marked as needing display, so
// we're at the mercy of CA's display-link callback to update layers in time. So we need to force a display of the view
// to get AppKit to update the CA layers synchronously.
@@ -147,6 +144,12 @@
if ([view isTrackingRepaints])
paintRepaintRectOverlay(view, context);
+ } else if (deviceScaleFactor != 1) {
+ // Call displayRectIgnoringOpacity for HiDPI tests since it ensures we paint directly into the context
+ // that we have appropriately sized and scaled.
+ [view displayRectIgnoringOpacity:[view bounds] inContext:nsContext];
+ if ([view isTrackingRepaints])
+ paintRepaintRectOverlay(view, context);
} else {
// Make sure the view has been painted.
[view displayIfNeeded];
Modified: trunk/Tools/WebKitTestRunner/PlatformWebView.h (165469 => 165470)
--- trunk/Tools/WebKitTestRunner/PlatformWebView.h 2014-03-12 14:42:42 UTC (rev 165469)
+++ trunk/Tools/WebKitTestRunner/PlatformWebView.h 2014-03-12 15:34:47 UTC (rev 165470)
@@ -92,6 +92,8 @@
void changeWindowScaleIfNeeded(float newScale);
private:
+ void forceWindowFramesChanged();
+
PlatformWKView m_view;
PlatformWindow m_window;
bool m_windowIsKey;
Modified: trunk/Tools/WebKitTestRunner/cg/TestInvocationCG.cpp (165469 => 165470)
--- trunk/Tools/WebKitTestRunner/cg/TestInvocationCG.cpp 2014-03-12 14:42:42 UTC (rev 165469)
+++ trunk/Tools/WebKitTestRunner/cg/TestInvocationCG.cpp 2014-03-12 15:34:47 UTC (rev 165470)
@@ -159,11 +159,6 @@
PlatformWebView* webView = TestController::shared().mainWebView();
WKRetainPtr<WKImageRef> windowSnapshot = webView->windowSnapshotImage();
- // There is no way at this time to fake a window's scale factor, so we need to avoid the window
- // snapshots for HiDPI tests.
- if (WKPageGetBackingScaleFactor(webView->page()) != 1)
- windowSnapshot = 0;
-
RetainPtr<CGContextRef> context;
if (windowSnapshot)
context = adoptCF(createCGContextFromImage(windowSnapshot.get(), DontFlipGraphicsContext));
Modified: trunk/Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm (165469 => 165470)
--- trunk/Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm 2014-03-12 14:42:42 UTC (rev 165469)
+++ trunk/Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm 2014-03-12 15:34:47 UTC (rev 165470)
@@ -199,9 +199,7 @@
void PlatformWebView::didInitializeClients()
{
// Set a temporary 1x1 window frame to force a WindowAndViewFramesChanged notification. <rdar://problem/13380145>
- WKRect wkFrame = windowFrame();
- [m_window setFrame:NSMakeRect(0, 0, 1, 1) display:YES];
- setWindowFrame(wkFrame);
+ forceWindowFramesChanged();
}
void PlatformWebView::addChromeInputField()
@@ -253,10 +251,19 @@
if (currentScale == newScale)
return;
[m_window _setWindowResolution:newScale displayIfChanged:YES];
+ // Instead of re-constructing the current window, let's fake resize it to ensure that the scale change gets picked up.
+ forceWindowFramesChanged();
// Changing the scaling factor on the window does not trigger NSWindowDidChangeBackingPropertiesNotification. We need to send the notification manually.
RetainPtr<NSMutableDictionary> notificationUserInfo = [[NSMutableDictionary alloc] initWithCapacity:1];
[notificationUserInfo setObject:[NSNumber numberWithDouble:currentScale] forKey:NSBackingPropertyOldScaleFactorKey];
[[NSNotificationCenter defaultCenter] postNotificationName:NSWindowDidChangeBackingPropertiesNotification object:m_window userInfo:notificationUserInfo.get()];
}
+void PlatformWebView::forceWindowFramesChanged()
+{
+ WKRect wkFrame = windowFrame();
+ [m_window setFrame:NSMakeRect(0, 0, 1, 1) display:YES];
+ setWindowFrame(wkFrame);
+}
+
} // namespace WTR
Modified: trunk/Tools/WebKitTestRunner/mac/main.mm (165469 => 165470)
--- trunk/Tools/WebKitTestRunner/mac/main.mm 2014-03-12 14:42:42 UTC (rev 165469)
+++ trunk/Tools/WebKitTestRunner/mac/main.mm 2014-03-12 15:34:47 UTC (rev 165470)
@@ -31,7 +31,6 @@
{
NSDictionary *dict = @{
@"AppleKeyboardUIMode": @1,
- @"AppleMagnifiedMode": @YES,
@"WebKitKerningAndLigaturesEnabledByDefault": @NO,
// FIXME: This is likely insufficient, as tests change (and don't reset) these settings via Internals.
@"WebAutomaticQuoteSubstitutionEnabled": @NO,