diff options
author | jbroman <jbroman@chromium.org> | 2015-02-17 13:47:04 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-02-17 21:47:45 +0000 |
commit | d8171ac22520b1d01577087435c4af9e8b3433dd (patch) | |
tree | 1d489cd983196880cb6036fd1288f487da268a46 /content/shell | |
parent | 34ca873ecd8905a90f9acfc6e840fb84671895af (diff) | |
download | chromium_src-d8171ac22520b1d01577087435c4af9e8b3433dd.zip chromium_src-d8171ac22520b1d01577087435c4af9e8b3433dd.tar.gz chromium_src-d8171ac22520b1d01577087435c4af9e8b3433dd.tar.bz2 |
Move WebPageOverlay subclasses to use WebGraphicsContext.
To support Slimming Paint, page overlays are now expected to declare the size
of the content they draw to a canvas. This moves the two subclasses, both
solid-color overlays, to use the new interface.
Following this CL, the deprecated method will be removed on the Blink side.
BUG=450761
Review URL: https://codereview.chromium.org/920843002
Cr-Commit-Position: refs/heads/master@{#316662}
Diffstat (limited to 'content/shell')
-rw-r--r-- | content/shell/renderer/test_runner/test_runner.cc | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/content/shell/renderer/test_runner/test_runner.cc b/content/shell/renderer/test_runner/test_runner.cc index 69644f4..6356292 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" @@ -1497,22 +1502,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) @@ -2871,7 +2873,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); } } |