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

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

Issue 2923343005: Move printing-related methods from WebFrame to WebLocalFrame. (Closed)
Patch Set: Rebasing... Created 3 years, 6 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/test_runner/pixel_dump.cc
diff --git a/content/shell/test_runner/pixel_dump.cc b/content/shell/test_runner/pixel_dump.cc
index 12eb7414ddcc87aa8d310a6a84fbf041880cfabc..7711760e3999172b3e475a6c500e010ca3ef6dc8 100644
--- a/content/shell/test_runner/pixel_dump.cc
+++ b/content/shell/test_runner/pixel_dump.cc
@@ -5,6 +5,7 @@
#include "content/shell/test_runner/pixel_dump.h"
#include <memory>
+#include <utility>
#include "base/bind.h"
#include "base/bind_helpers.h"
@@ -48,7 +49,8 @@ struct PixelsDumpRequest {
class CaptureCallback : public blink::WebCompositeAndReadbackAsyncCallback {
public:
- CaptureCallback(const base::Callback<void(const SkBitmap&)>& callback);
+ explicit CaptureCallback(
+ const base::Callback<void(const SkBitmap&)>& callback);
virtual ~CaptureCallback();
void set_wait_for_popup(bool wait) { wait_for_popup_ = wait; }
@@ -74,7 +76,12 @@ void DrawSelectionRect(const PixelsDumpRequest& dump_request,
if (!dump_request.layout_test_runtime_flags.dump_selection_rect())
return;
// If there is a selection rect - draw a red 1px border enclosing rect
- blink::WebRect wr = dump_request.web_view->MainFrame()->SelectionBoundsRect();
+ CHECK(dump_request.web_view->MainFrame()->IsWebLocalFrame())
+ << "This function cannot be called if the main frame is not a "
+ "local frame.";
+ blink::WebRect wr = dump_request.web_view->MainFrame()
+ ->ToWebLocalFrame()
+ ->GetSelectionBoundsRectForTesting();
if (wr.IsEmpty())
return;
// Render a red rectangle bounding selection rect
@@ -92,7 +99,12 @@ void CapturePixelsForPrinting(std::unique_ptr<PixelsDumpRequest> dump_request) {
dump_request->web_view->UpdateAllLifecyclePhases();
blink::WebSize page_size_in_pixels = dump_request->web_view->Size();
- blink::WebFrame* web_frame = dump_request->web_view->MainFrame();
+
+ CHECK(dump_request->web_view->MainFrame()->IsWebLocalFrame())
+ << "This function cannot be called if the main frame is not a "
+ "local frame.";
+ blink::WebLocalFrame* web_frame =
+ dump_request->web_view->MainFrame()->ToWebLocalFrame();
int page_count = web_frame->PrintBegin(page_size_in_pixels);
int totalHeight = page_count * (page_size_in_pixels.height + 1) - 1;
@@ -109,7 +121,7 @@ void CapturePixelsForPrinting(std::unique_ptr<PixelsDumpRequest> dump_request) {
}
cc::SkiaPaintCanvas canvas(bitmap);
- web_frame->PrintPagesWithBoundaries(&canvas, page_size_in_pixels);
+ web_frame->PrintPagesForTesting(&canvas, page_size_in_pixels);
web_frame->PrintEnd();
DrawSelectionRect(*dump_request, &canvas);
« no previous file with comments | « content/renderer/gpu/gpu_benchmarking_extension.cc ('k') | third_party/WebKit/Source/core/exported/WebRemoteFrameImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698