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

Unified Diff: third_party/WebKit/Source/core/paint/RemoteFramePainter.cpp

Issue 2653963002: [Experimental] Supporting OOPIF printing
Patch Set: Rename service, fix for webview, and connect to DiscardableMemoryManager Created 3 years, 9 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: third_party/WebKit/Source/core/paint/RemoteFramePainter.cpp
diff --git a/third_party/WebKit/Source/core/paint/RemoteFramePainter.cpp b/third_party/WebKit/Source/core/paint/RemoteFramePainter.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..2650037e70b910f0619fa2197c26c2e003ca6898
--- /dev/null
+++ b/third_party/WebKit/Source/core/paint/RemoteFramePainter.cpp
@@ -0,0 +1,41 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "core/paint/RemoteFramePainter.h"
+
+#include "third_party/WebKit/Source/core/frame/RemoteFrameView.h"
+#include "third_party/WebKit/Source/platform/graphics/GraphicsContext.h"
+#include "third_party/WebKit/Source/platform/graphics/paint/CullRect.h"
+#include "third_party/WebKit/Source/platform/graphics/paint/DrawingRecorder.h"
+#include "third_party/WebKit/Source/platform/graphics/paint/PaintRecordBuilder.h"
+#include "third_party/WebKit/public/web/WebRemoteFrame.h"
+#include "third_party/skia/include/core/SkCanvas.h"
+#include "third_party/skia/include/core/SkPictureRecorder.h"
+#include "third_party/skia/include/core/SkRect.h"
+
+namespace blink {
+
+void RemoteFramePainter::paint(GraphicsContext& context,
+ const CullRect& rect) const {
+ DCHECK(context.printing());
+
+ IntRect bound(m_frameView.frameRect());
+ SkRect skRect;
+ skRect.iset(bound.x(), bound.y(), bound.x() + bound.width(),
+ bound.y() + bound.height());
+
+ // Inform the actual frame printing.
+ int id = m_frameView.print(bound, context.printPageNumber());
+
+ if (!drawable_)
+ drawable_.reset(new SkFutureDrawable(skRect, id));
+
+ DrawingRecorder drawRecorder(context, m_frameView,
+ DisplayItem::kDocumentBackground,
+ FloatRect(skRect));
+ DCHECK(context.canvas());
+ context.canvas()->drawDrawable(drawable_.get());
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698