Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[chromium] Support high DIP pixel tests with DumpRenderTree
https://bugs.webkit.org/show_bug.cgi?id=94935

Patch by Alex Sakhartchouk <alexst@chromium.org> on 2012-08-29
Reviewed by James Robinson.

Tools:

Adding device scale factor into the drt image dumping code

* DumpRenderTree/chromium/DRTTestRunner.cpp:
(DRTTestRunner::reset):
(DRTTestRunner::setBackingScaleFactor):
* DumpRenderTree/chromium/WebViewHost.cpp:
(WebViewHost::setDeviceScaleFactor):
(WebViewHost::paintInvalidatedRegion):
(WebViewHost::canvas):
* DumpRenderTree/chromium/WebViewHost.h:
(WebViewHost):

LayoutTests:

Introducing new expected test results in full resolution and temporarily
marking the files on other platforms as expected to fail until I can update them later

* platform/chromium-linux/fast/hidpi/broken-image-icon-hidpi-expected.png:
* platform/chromium-linux/fast/hidpi/broken-image-with-size-hidpi-expected.png:
* platform/chromium-linux/fast/hidpi/clip-text-in-hidpi-expected.png:
* platform/chromium-linux/fast/hidpi/device-scale-factor-paint-expected.png:
* platform/chromium-linux/fast/hidpi/focus-rings-expected.png:
* platform/chromium-linux/fast/hidpi/image-set-as-background-expected.png:
* platform/chromium-linux/fast/hidpi/image-set-background-dynamic-expected.png:
* platform/chromium-linux/fast/hidpi/image-set-background-repeat-expected.png:
* platform/chromium-linux/fast/hidpi/image-set-background-repeat-without-size-expected.png:
* platform/chromium-linux/fast/hidpi/image-set-border-image-comparison-expected.png:
* platform/chromium-linux/fast/hidpi/image-set-border-image-dynamic-expected.png:
* platform/chromium-linux/fast/hidpi/image-set-border-image-simple-expected.png:
* platform/chromium-linux/fast/hidpi/image-set-in-content-dynamic-expected.png:
* platform/chromium-linux/fast/hidpi/image-set-out-of-order-expected.png:
* platform/chromium-linux/fast/hidpi/image-set-simple-expected.png:
* platform/chromium-linux/fast/hidpi/image-set-without-specified-width-expected.png:
* platform/chromium-linux/fast/hidpi/resize-corner-hidpi-expected.png:
* platform/chromium-linux/fast/hidpi/video-controls-in-hidpi-expected.png:
* platform/chromium/TestExpectations:

Canonical link: https://commits.webkit.org/113234@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@127061 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Alex Sakhartchouk authored and webkit-commit-queue committed Aug 29, 2012
1 parent 6b75748 commit 751e5ab
Show file tree
Hide file tree
Showing 24 changed files with 89 additions and 4 deletions.
30 changes: 30 additions & 0 deletions LayoutTests/ChangeLog
@@ -1,3 +1,33 @@
2012-08-29 Alex Sakhartchouk <alexst@chromium.org>

[chromium] Support high DIP pixel tests with DumpRenderTree
https://bugs.webkit.org/show_bug.cgi?id=94935

Reviewed by James Robinson.

Introducing new expected test results in full resolution and temporarily
marking the files on other platforms as expected to fail until I can update them later

* platform/chromium-linux/fast/hidpi/broken-image-icon-hidpi-expected.png:
* platform/chromium-linux/fast/hidpi/broken-image-with-size-hidpi-expected.png:
* platform/chromium-linux/fast/hidpi/clip-text-in-hidpi-expected.png:
* platform/chromium-linux/fast/hidpi/device-scale-factor-paint-expected.png:
* platform/chromium-linux/fast/hidpi/focus-rings-expected.png:
* platform/chromium-linux/fast/hidpi/image-set-as-background-expected.png:
* platform/chromium-linux/fast/hidpi/image-set-background-dynamic-expected.png:
* platform/chromium-linux/fast/hidpi/image-set-background-repeat-expected.png:
* platform/chromium-linux/fast/hidpi/image-set-background-repeat-without-size-expected.png:
* platform/chromium-linux/fast/hidpi/image-set-border-image-comparison-expected.png:
* platform/chromium-linux/fast/hidpi/image-set-border-image-dynamic-expected.png:
* platform/chromium-linux/fast/hidpi/image-set-border-image-simple-expected.png:
* platform/chromium-linux/fast/hidpi/image-set-in-content-dynamic-expected.png:
* platform/chromium-linux/fast/hidpi/image-set-out-of-order-expected.png:
* platform/chromium-linux/fast/hidpi/image-set-simple-expected.png:
* platform/chromium-linux/fast/hidpi/image-set-without-specified-width-expected.png:
* platform/chromium-linux/fast/hidpi/resize-corner-hidpi-expected.png:
* platform/chromium-linux/fast/hidpi/video-controls-in-hidpi-expected.png:
* platform/chromium/TestExpectations:

2012-08-29 Roger Fong <roger_fong@apple.com>

Unreviewed Gardening: editing/delete/br-004(5)(6) failing on Windows (old run webkit tests)
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions LayoutTests/platform/chromium/TestExpectations
Expand Up @@ -2650,6 +2650,26 @@ BUGWK70066 SKIP : svg/as-image/image-respects-deviceScaleFactor.html = TIMEOUT
// SVG painting in high DPI mode is broken in DRT.
BUGWK92511 SKIP : svg/as-image/animated-svg-repaints-completely-in-hidpi.html = IMAGE+TEXT

// Swidth DRT to high DPI output mode, which temporarily breaks IMAGE
BUGWK94935 WIN ANDROID MAC : fast/hidpi/broken-image-icon-hidpi.html = IMAGE
BUGWK94935 WIN ANDROID MAC : fast/hidpi/device-scale-factor-paint.html = IMAGE
BUGWK94935 WIN ANDROID MAC : fast/hidpi/image-set-as-background.html = IMAGE
BUGWK94935 WIN ANDROID MAC : fast/hidpi/image-set-background-repeat-without-size.html = IMAGE
BUGWK94935 WIN ANDROID MAC : fast/hidpi/image-set-border-image-simple.html = IMAGE
BUGWK94935 WIN ANDROID MAC : fast/hidpi/image-set-simple.html = IMAGE
BUGWK94935 WIN ANDROID MAC : fast/hidpi/video-controls-in-hidpi.html = IMAGE
BUGWK94935 WIN ANDROID MAC : fast/hidpi/broken-image-with-size-hidpi.html = IMAGE
BUGWK94935 WIN ANDROID MAC : fast/hidpi/focus-rings.html = IMAGE
BUGWK94935 WIN ANDROID MAC : fast/hidpi/image-set-background-dynamic.html = IMAGE
BUGWK94935 WIN ANDROID MAC : fast/hidpi/image-set-border-image-comparison.html = IMAGE
BUGWK94935 WIN ANDROID MAC : fast/hidpi/image-set-in-content-dynamic.html = IMAGE
BUGWK94935 WIN ANDROID MAC : fast/hidpi/image-set-without-specified-width.html = IMAGE
BUGWK94935 WIN ANDROID MAC : fast/hidpi/clip-text-in-hidpi.html = IMAGE
BUGWK94935 WIN ANDROID MAC : fast/hidpi/image-set-background-repeat.html = IMAGE
BUGWK94935 WIN ANDROID MAC : fast/hidpi/image-set-border-image-dynamic.html = IMAGE
BUGWK94935 WIN ANDROID MAC : fast/hidpi/image-set-out-of-order.html = IMAGE
BUGWK94935 WIN ANDROID MAC : fast/hidpi/resize-corner-hidpi.html = IMAGE

// Flaky tests from ~r97647
BUGWK70298 MAC : fast/table/border-collapsing/cached-69296.html = IMAGE

Expand Down
19 changes: 19 additions & 0 deletions Tools/ChangeLog
@@ -1,3 +1,22 @@
2012-08-29 Alex Sakhartchouk <alexst@chromium.org>

[chromium] Support high DIP pixel tests with DumpRenderTree
https://bugs.webkit.org/show_bug.cgi?id=94935

Reviewed by James Robinson.

Adding device scale factor into the drt image dumping code

* DumpRenderTree/chromium/DRTTestRunner.cpp:
(DRTTestRunner::reset):
(DRTTestRunner::setBackingScaleFactor):
* DumpRenderTree/chromium/WebViewHost.cpp:
(WebViewHost::setDeviceScaleFactor):
(WebViewHost::paintInvalidatedRegion):
(WebViewHost::canvas):
* DumpRenderTree/chromium/WebViewHost.h:
(WebViewHost):

2012-08-29 Kevin Funk <kevin.funk@kdab.com>

Fix check-webkit-style (and probably others) when WebKit is in a git submodule
Expand Down
4 changes: 2 additions & 2 deletions Tools/DumpRenderTree/chromium/DRTTestRunner.cpp
Expand Up @@ -654,7 +654,7 @@ void DRTTestRunner::reset()
m_shell->webView()->removeAllUserContent();
WebKit::WebSize empty;
m_shell->webView()->disableAutoResizeMode();
m_shell->webView()->setDeviceScaleFactor(1);
m_shell->webViewHost()->setDeviceScaleFactor(1);
}
m_dumpAsText = false;
m_dumpAsAudio = false;
Expand Down Expand Up @@ -2238,7 +2238,7 @@ void DRTTestRunner::setBackingScaleFactor(const CppArgumentList& arguments, CppV
return;

float value = arguments[0].value.doubleValue;
m_shell->webView()->setDeviceScaleFactor(value);
m_shell->webViewHost()->setDeviceScaleFactor(value);

OwnArrayPtr<CppVariant> callbackArguments = adoptArrayPtr(new CppVariant[1]);
callbackArguments[0].set(arguments[1]);
Expand Down
19 changes: 17 additions & 2 deletions Tools/DumpRenderTree/chromium/WebViewHost.cpp
Expand Up @@ -1771,6 +1771,12 @@ void WebViewHost::setPendingExtraData(PassOwnPtr<TestShellExtraData> extraData)
m_pendingExtraData = extraData;
}

void WebViewHost::setDeviceScaleFactor(float deviceScaleFactor)
{
webView()->setDeviceScaleFactor(deviceScaleFactor);
discardBackingStore();
}

void WebViewHost::setGamepadData(const WebGamepads& pads)
{
webkit_support::SetGamepadData(pads);
Expand Down Expand Up @@ -1836,7 +1842,13 @@ void WebViewHost::paintRect(const WebRect& rect)
ASSERT(!m_isPainting);
ASSERT(canvas());
m_isPainting = true;
webWidget()->paint(canvas(), rect);
float deviceScaleFactor = webView()->deviceScaleFactor();
int scaledX = static_cast<int>(static_cast<float>(rect.x) * deviceScaleFactor);
int scaledY = static_cast<int>(static_cast<float>(rect.y) * deviceScaleFactor);
int scaledWidth = static_cast<int>(ceil(static_cast<float>(rect.width) * deviceScaleFactor));
int scaledHeight = static_cast<int>(ceil(static_cast<float>(rect.height) * deviceScaleFactor));
WebRect deviceRect(scaledX, scaledY, scaledWidth, scaledHeight);
webWidget()->paint(canvas(), deviceRect);
m_isPainting = false;
}

Expand Down Expand Up @@ -1906,8 +1918,11 @@ SkCanvas* WebViewHost::canvas()
if (m_canvas)
return m_canvas.get();
WebSize widgetSize = webWidget()->size();
float deviceScaleFactor = webView()->deviceScaleFactor();
int scaledWidth = static_cast<int>(ceil(static_cast<float>(widgetSize.width) * deviceScaleFactor));
int scaledHeight = static_cast<int>(ceil(static_cast<float>(widgetSize.height) * deviceScaleFactor));
resetScrollRect();
m_canvas = adoptPtr(skia::CreateBitmapCanvas(widgetSize.width, widgetSize.height, true));
m_canvas = adoptPtr(skia::CreateBitmapCanvas(scaledWidth, scaledHeight, true));
return m_canvas.get();
}

Expand Down
1 change: 1 addition & 0 deletions Tools/DumpRenderTree/chromium/WebViewHost.h
Expand Up @@ -98,6 +98,7 @@ class WebViewHost : public WebKit::WebViewClient, public WebKit::WebFrameClient,
virtual void setEditCommand(const std::string& name, const std::string& value) OVERRIDE;
virtual void clearEditCommand() OVERRIDE;
void setPendingExtraData(PassOwnPtr<TestShellExtraData>);
void setDeviceScaleFactor(float);

virtual void setGamepadData(const WebKit::WebGamepads&);

Expand Down

0 comments on commit 751e5ab

Please sign in to comment.