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

Unified Diff: sky/viewer/platform/weblayertreeview_impl.cc

Issue 737793006: Add compile flag for enabling the compostior (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: cleanup Created 6 years, 1 month 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
« no previous file with comments | « sky/viewer/platform/weblayertreeview_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/viewer/platform/weblayertreeview_impl.cc
diff --git a/sky/viewer/platform/weblayertreeview_impl.cc b/sky/viewer/platform/weblayertreeview_impl.cc
index f718fc34c2778232dc02fa3d12925ddd1c351b24..7dd15534d362638f58a4fc05e59c9e5b0d2bd394 100644
--- a/sky/viewer/platform/weblayertreeview_impl.cc
+++ b/sky/viewer/platform/weblayertreeview_impl.cc
@@ -13,8 +13,11 @@
#include "mojo/cc/output_surface_mojo.h"
#include "mojo/converters/surfaces/surfaces_type_converters.h"
#include "mojo/services/public/cpp/view_manager/view.h"
+#include "sky/engine/public/web/WebSettings.h"
+#include "sky/engine/public/web/WebView.h"
#include "sky/engine/public/web/WebWidget.h"
#include "sky/viewer/cc/web_layer_impl.h"
+#include "third_party/skia/include/core/SkCanvas.h"
namespace sky {
@@ -57,6 +60,19 @@ WebLayerTreeViewImpl::~WebLayerTreeViewImpl() {
layer_tree_host_.reset();
}
+void WebLayerTreeViewImpl::PaintContents(SkCanvas* canvas,
+ const gfx::Rect& clip,
+ GraphicsContextStatus gc_status) {
+ blink::WebRect rect(clip.x(), clip.y(), clip.width(), clip.height());
+ widget_->paint(canvas, rect);
+ canvas->flush();
+}
+
+bool WebLayerTreeViewImpl::FillsBoundsCompletely() const {
+ // TODO(abarth): We should be able to return true when we're opaque.
+ return false;
+}
+
void WebLayerTreeViewImpl::WillBeginMainFrame(int frame_id) {
}
@@ -73,8 +89,26 @@ void WebLayerTreeViewImpl::BeginMainFrame(const cc::BeginFrameArgs& args) {
widget_->beginFrame(web_begin_frame_args);
}
+void WebLayerTreeViewImpl::set_widget(blink::WebWidget* widget) {
+ widget_ = widget;
+
+ // TODO(sky): The only reason this is here is because we need the widget to
+ // check whether the compositor is enabled.
+ if (!static_cast<blink::WebView*>(widget_)->settings()->compositorIsEnabled()) {
+ root_layer_ = cc::ContentLayer::Create(this);
+ layer_tree_host_->SetRootLayer(root_layer_);
+ }
+}
+
void WebLayerTreeViewImpl::Layout() {
widget_->layout();
+ blink::WebSize size = widget_->size();
+
+ if (!static_cast<blink::WebView*>(widget_)->settings()->compositorIsEnabled()) {
+ root_layer_->SetBounds(gfx::Size(size.width, size.height));
+ root_layer_->SetIsDrawable(true);
+ root_layer_->SetNeedsDisplay();
+ }
}
void WebLayerTreeViewImpl::ApplyViewportDeltas(
« no previous file with comments | « sky/viewer/platform/weblayertreeview_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698