summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authorenne@chromium.org <enne@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-16 08:04:58 +0000
committerenne@chromium.org <enne@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-16 08:04:58 +0000
commit54fd1633f8bc5a5207d29dbe5bf21e70283310f3 (patch)
tree991349a75395e009e00fd204facfb8d122790f79 /content
parentd77605925a3eda85175de6e06dd1eb363c919ed5 (diff)
downloadchromium_src-54fd1633f8bc5a5207d29dbe5bf21e70283310f3.zip
chromium_src-54fd1633f8bc5a5207d29dbe5bf21e70283310f3.tar.gz
chromium_src-54fd1633f8bc5a5207d29dbe5bf21e70283310f3.tar.bz2
Remove software paint path from WebTestProxy
BUG=none Review URL: https://codereview.chromium.org/284073002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@270959 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/shell/renderer/test_runner/web_test_proxy.cc83
-rw-r--r--content/shell/renderer/test_runner/web_test_proxy.h4
-rw-r--r--content/shell/renderer/webkit_test_runner.cc38
3 files changed, 4 insertions, 121 deletions
diff --git a/content/shell/renderer/test_runner/web_test_proxy.cc b/content/shell/renderer/test_runner/web_test_proxy.cc
index 44701a9..3b729c4 100644
--- a/content/shell/renderer/test_runner/web_test_proxy.cc
+++ b/content/shell/renderer/test_runner/web_test_proxy.cc
@@ -397,19 +397,6 @@ string WebTestProxyBase::CaptureTree(bool debugRenderTree) {
return dataUtf8;
}
-SkCanvas* WebTestProxyBase::CapturePixels() {
- TRACE_EVENT0("shell", "WebTestProxyBase::CapturePixels");
- web_widget_->layout();
- if (test_interfaces_->testRunner()->isPrinting())
- PaintPagesWithBoundaries();
- else
- PaintInvalidatedRegion();
-
- DrawSelectionRect(GetCanvas());
-
- return GetCanvas();
-}
-
void WebTestProxyBase::DrawSelectionRect(SkCanvas* canvas) {
// See if we need to draw the selection bounds rect. Selection bounds
// rect is the rect enclosing the (possibly transformed) selection.
@@ -472,55 +459,6 @@ void WebTestProxyBase::SetLogConsoleOutput(bool enabled) {
log_console_output_ = enabled;
}
-void WebTestProxyBase::PaintRect(const WebRect& rect) {
- DCHECK(!is_painting_);
- DCHECK(GetCanvas());
- is_painting_ = true;
- float deviceScaleFactor = GetWebView()->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);
- web_widget_->paint(GetCanvas(), deviceRect);
- is_painting_ = false;
-}
-
-void WebTestProxyBase::PaintInvalidatedRegion() {
- web_widget_->animate(0.0);
- web_widget_->layout();
- WebSize widgetSize = web_widget_->size();
- WebRect clientRect(0, 0, widgetSize.width, widgetSize.height);
-
- // Paint the canvas if necessary. Allow painting to generate extra rects
- // for the first two calls. This is necessary because some WebCore rendering
- // objects update their layout only when painted.
- // Store the total area painted in total_paint. Then tell the gdk window
- // to update that area after we're done painting it.
- for (int i = 0; i < 3; ++i) {
- // rect = intersect(paint_rect_ , clientRect)
- WebRect damageRect = paint_rect_;
- int left = max(damageRect.x, clientRect.x);
- int top = max(damageRect.y, clientRect.y);
- int right =
- min(damageRect.x + damageRect.width, clientRect.x + clientRect.width);
- int bottom =
- min(damageRect.y + damageRect.height, clientRect.y + clientRect.height);
- WebRect rect;
- if (left < right && top < bottom)
- rect = WebRect(left, top, right - left, bottom - top);
-
- paint_rect_ = WebRect();
- if (rect.isEmpty()) continue;
- PaintRect(rect);
- }
- DCHECK(paint_rect_.isEmpty());
-}
-
void WebTestProxyBase::PaintPagesWithBoundaries() {
DCHECK(!is_painting_);
DCHECK(GetCanvas());
@@ -563,15 +501,6 @@ SkCanvas* WebTestProxyBase::GetCanvas() {
return canvas_.get();
}
-void WebTestProxyBase::DisplayForSoftwareMode(const base::Closure& callback) {
- const blink::WebSize& size = web_widget_->size();
- WebRect rect(0, 0, size.width, size.height);
- paint_rect_ = rect;
- PaintInvalidatedRegion();
-
- if (!callback.is_null()) callback.Run();
-}
-
void WebTestProxyBase::DidDisplayAsync(const base::Closure& callback,
const SkBitmap& bitmap) {
// Verify we actually composited.
@@ -583,17 +512,7 @@ void WebTestProxyBase::DidDisplayAsync(const base::Closure& callback,
void WebTestProxyBase::DisplayAsyncThen(const base::Closure& callback) {
TRACE_EVENT0("shell", "WebTestProxyBase::DisplayAsyncThen");
- // TODO(danakj): Remove when we have kForceCompositingMode everywhere.
- if (!web_widget_->isAcceleratedCompositingActive()) {
- TRACE_EVENT0("shell",
- "WebTestProxyBase::DisplayAsyncThen "
- "isAcceleratedCompositingActive false");
- base::MessageLoopProxy::current()->PostTask(
- FROM_HERE, base::Bind(&WebTestProxyBase::DisplayForSoftwareMode,
- base::Unretained(this), callback));
- return;
- }
-
+ CHECK(web_widget_->isAcceleratedCompositingActive());
CapturePixelsAsync(base::Bind(&WebTestProxyBase::DidDisplayAsync,
base::Unretained(this), callback));
}
diff --git a/content/shell/renderer/test_runner/web_test_proxy.h b/content/shell/renderer/test_runner/web_test_proxy.h
index 8b8b210..7d1a6b7 100644
--- a/content/shell/renderer/test_runner/web_test_proxy.h
+++ b/content/shell/renderer/test_runner/web_test_proxy.h
@@ -104,7 +104,6 @@ class WebTestProxyBase : public blink::WebCompositeAndReadbackAsyncCallback {
void MoveValidationMessage(const blink::WebRect& anchorInRootView);
std::string CaptureTree(bool debugRenderTree);
- SkCanvas* CapturePixels();
void CapturePixelsForPrinting(
const base::Callback<void(const SkBitmap&)>& callback);
void CapturePixelsAsync(
@@ -225,14 +224,11 @@ class WebTestProxyBase : public blink::WebCompositeAndReadbackAsyncCallback {
template <class, typename, typename>
friend class WebFrameTestProxy;
void LocationChangeDone(blink::WebFrame*);
- void PaintRect(const blink::WebRect&);
- void PaintInvalidatedRegion();
void PaintPagesWithBoundaries();
SkCanvas* GetCanvas();
void InvalidateAll();
void AnimateNow();
void DrawSelectionRect(SkCanvas* canvas);
- void DisplayForSoftwareMode(const base::Closure& callback);
void DidDisplayAsync(const base::Closure& callback, const SkBitmap& bitmap);
blink::WebWidget* web_widget() const { return web_widget_; }
diff --git a/content/shell/renderer/webkit_test_runner.cc b/content/shell/renderer/webkit_test_runner.cc
index 8d2dea6..c4cc35a 100644
--- a/content/shell/renderer/webkit_test_runner.cc
+++ b/content/shell/renderer/webkit_test_runner.cc
@@ -98,32 +98,6 @@ void InvokeTaskHelper(void* context) {
delete task;
}
-#if !defined(OS_MACOSX)
-void MakeBitmapOpaque(SkBitmap* bitmap) {
- SkAutoLockPixels lock(*bitmap);
- DCHECK_EQ(bitmap->config(), SkBitmap::kARGB_8888_Config);
- for (int y = 0; y < bitmap->height(); ++y) {
- uint32_t* row = bitmap->getAddr32(0, y);
- for (int x = 0; x < bitmap->width(); ++x)
- row[x] |= 0xFF000000; // Set alpha bits to 1.
- }
-}
-#endif
-
-void CopyCanvasToBitmap(SkCanvas* canvas, SkBitmap* snapshot) {
- SkBaseDevice* device = skia::GetTopDevice(*canvas);
- const SkBitmap& bitmap = device->accessBitmap(false);
- const bool success = bitmap.copyTo(snapshot, kPMColor_SkColorType);
- DCHECK(success);
-
-#if !defined(OS_MACOSX)
- // Only the expected PNGs for Mac have a valid alpha channel.
- if (!CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableOverlayFullscreenVideo))
- MakeBitmapOpaque(snapshot);
-#endif
-}
-
class SyncNavigationStateVisitor : public RenderViewVisitor {
public:
SyncNavigationStateVisitor() {}
@@ -653,15 +627,9 @@ void WebKitTestRunner::CaptureDump() {
if (test_config_.enable_pixel_dumping &&
interfaces->testRunner()->shouldGeneratePixelResults()) {
- // TODO(danakj): Remove when kForceCompositingMode is everywhere.
- if (!render_view()->GetWebView()->isAcceleratedCompositingActive()) {
- SkBitmap snapshot;
- CopyCanvasToBitmap(proxy()->CapturePixels(), &snapshot);
- CaptureDumpPixels(snapshot);
- } else {
- proxy()->CapturePixelsAsync(base::Bind(
- &WebKitTestRunner::CaptureDumpPixels, base::Unretained(this)));
- }
+ CHECK(render_view()->GetWebView()->isAcceleratedCompositingActive());
+ proxy()->CapturePixelsAsync(base::Bind(
+ &WebKitTestRunner::CaptureDumpPixels, base::Unretained(this)));
return;
}
}