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

Unified Diff: components/html_viewer/html_frame.cc

Issue 1373003002: html_viewer/Mandoline: Avoid subclassing WebLayerImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated Created 5 years, 3 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
« no previous file with comments | « components/html_viewer/html_frame.h ('k') | components/html_viewer/web_layer_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/html_viewer/html_frame.cc
diff --git a/components/html_viewer/html_frame.cc b/components/html_viewer/html_frame.cc
index edaed4f2c63cd875ffa769a50c1c4d5da377ba7f..fc1f6c0544e1325fbcef4c90d9cd2a091e05c289 100644
--- a/components/html_viewer/html_frame.cc
+++ b/components/html_viewer/html_frame.cc
@@ -12,6 +12,8 @@
#include "base/stl_util.h"
#include "base/strings/string_util.h"
#include "base/thread_task_runner_handle.h"
+#include "cc/blink/web_layer_impl.h"
+#include "cc/surfaces/surface_id.h"
#include "components/html_viewer/ax_provider_impl.h"
#include "components/html_viewer/blink_basic_type_converters.h"
#include "components/html_viewer/blink_input_events_type_converters.h"
@@ -28,7 +30,6 @@
#include "components/html_viewer/media_factory.h"
#include "components/html_viewer/stats_collection_controller.h"
#include "components/html_viewer/touch_handler.h"
-#include "components/html_viewer/web_layer_impl.h"
#include "components/html_viewer/web_layer_tree_view_impl.h"
#include "components/html_viewer/web_storage_namespace_impl.h"
#include "components/html_viewer/web_url_loader_impl.h"
@@ -102,6 +103,17 @@ HTMLFrame* GetPreviousSibling(HTMLFrame* frame) {
return (iter == frame->parent()->children().begin()) ? nullptr : *(--iter);
}
+// See surface_layer.h for a description of this callback.
+void SatisfyCallback(cc::SurfaceSequence sequence) {
+ // TODO(fsamuel): Implement this.
+}
+
+// See surface_layer.h for a description of this callback.
+void RequireCallback(cc::SurfaceId surface_id,
+ cc::SurfaceSequence sequence) {
+ // TODO(fsamuel): Implement this.
+}
+
} // namespace
HTMLFrame::HTMLFrame(CreateParams* params)
@@ -567,11 +579,17 @@ void HTMLFrame::SwapToRemote() {
// swap() ends up calling us back and we then close the frame, which deletes
// it.
web_frame_->swap(remote_frame);
- // TODO(sky): this isn't quite right, but WebLayerImpl is temporary.
if (owned_view_) {
- web_layer_.reset(
- new WebLayerImpl(owned_view_->view(),
- global_state()->device_pixel_ratio()));
+ surface_layer_ =
+ cc::SurfaceLayer::Create(cc_blink::WebLayerImpl::LayerSettings(),
+ base::Bind(&SatisfyCallback),
+ base::Bind(&RequireCallback));
+ surface_layer_->SetSurfaceId(
+ cc::SurfaceId(owned_view_->view()->id()),
+ global_state()->device_pixel_ratio(),
+ owned_view_->view()->bounds().To<gfx::Rect>().size());
+
+ web_layer_.reset(new cc_blink::WebLayerImpl(surface_layer_));
}
remote_frame->setRemoteWebLayer(web_layer_.get());
remote_frame->setReplicatedName(state_.name);
@@ -864,8 +882,25 @@ void HTMLFrame::reload(bool ignore_cache, bool is_client_redirect) {
NOTIMPLEMENTED();
}
-void HTMLFrame::forwardInputEvent(const blink::WebInputEvent* event) {
- NOTIMPLEMENTED();
+void HTMLFrame::frameRectsChanged(const blink::WebRect& frame_rect) {
+ // Only the owner of view can update its size.
+ if (!owned_view_)
+ return;
+
+ const gfx::Rect rect_in_dip(frame_rect.x, frame_rect.y, frame_rect.width,
+ frame_rect.height);
+ const gfx::Rect rect_in_pixels(gfx::ConvertRectToPixel(
+ global_state()->device_pixel_ratio(), rect_in_dip));
+ const mojo::RectPtr mojo_rect_in_pixels(mojo::Rect::From(rect_in_pixels));
+ owned_view_->view()->SetBounds(*mojo_rect_in_pixels);
+
+ if (!surface_layer_)
+ return;
+
+ surface_layer_->SetSurfaceId(
+ cc::SurfaceId(owned_view_->view()->id()),
+ global_state()->device_pixel_ratio(),
+ owned_view_->view()->bounds().To<gfx::Rect>().size());
}
} // namespace mojo
« no previous file with comments | « components/html_viewer/html_frame.h ('k') | components/html_viewer/web_layer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698