Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1498)

Unified Diff: content/shell/renderer/test_runner/test_runner.cc

Issue 920843002: Move WebPageOverlay subclasses to use WebGraphicsContext. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/shell/renderer/test_runner/test_runner.cc
diff --git a/content/shell/renderer/test_runner/test_runner.cc b/content/shell/renderer/test_runner/test_runner.cc
index 2b79535bcefc506a7094f634a0ebe439c13a6f1f..bc49dc1ef261788c30a9f404f2a5e671de8c8be7 100644
--- a/content/shell/renderer/test_runner/test_runner.cc
+++ b/content/shell/renderer/test_runner/test_runner.cc
@@ -37,6 +37,7 @@
#include "third_party/WebKit/public/web/WebDocument.h"
#include "third_party/WebKit/public/web/WebFindOptions.h"
#include "third_party/WebKit/public/web/WebFrame.h"
+#include "third_party/WebKit/public/web/WebGraphicsContext.h"
#include "third_party/WebKit/public/web/WebInputElement.h"
#include "third_party/WebKit/public/web/WebKit.h"
#include "third_party/WebKit/public/web/WebMIDIClientMock.h"
@@ -49,6 +50,10 @@
#include "third_party/WebKit/public/web/WebView.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "third_party/skia/include/core/SkCanvas.h"
+#include "ui/gfx/geometry/rect.h"
+#include "ui/gfx/geometry/rect_f.h"
+#include "ui/gfx/geometry/size.h"
+#include "ui/gfx/skia_util.h"
#if defined(__linux__) || defined(ANDROID)
#include "third_party/WebKit/public/web/linux/WebFontRendering.h"
@@ -1489,22 +1494,19 @@ void TestRunnerBindings::NotImplemented(const gin::Arguments& args) {
class TestPageOverlay : public WebPageOverlay {
public:
- explicit TestPageOverlay(WebView* web_view)
- : web_view_(web_view) {
- }
+ TestPageOverlay() {}
virtual ~TestPageOverlay() {}
- virtual void paintPageOverlay(WebCanvas* canvas) override {
- SkRect rect = SkRect::MakeWH(web_view_->size().width,
- web_view_->size().height);
+ virtual void paintPageOverlay(WebGraphicsContext* context,
+ const WebSize& webViewSize) {
+ gfx::Rect rect(webViewSize);
+ SkCanvas* canvas = context->beginDrawing(gfx::RectF(rect));
SkPaint paint;
paint.setColor(SK_ColorCYAN);
paint.setStyle(SkPaint::kFill_Style);
- canvas->drawRect(rect, paint);
+ canvas->drawRect(gfx::RectToSkRect(rect), paint);
+ context->endDrawing();
}
-
- private:
- WebView* web_view_;
};
TestRunner::WorkQueue::WorkQueue(TestRunner* controller)
@@ -2858,7 +2860,7 @@ void TestRunner::AddMockCredentialManagerResponse(const std::string& id,
void TestRunner::AddWebPageOverlay() {
if (web_view_ && !page_overlay_) {
- page_overlay_ = new TestPageOverlay(web_view_);
+ page_overlay_ = new TestPageOverlay;
web_view_->addPageOverlay(page_overlay_, 0);
}
}
« chrome/renderer/webview_color_overlay.h ('K') | « chrome/renderer/webview_color_overlay.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698