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

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: 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..20511bfad2654b023c344ba3d0a5c62effdae2b8 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,16 @@ 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(),
+ frame_size_in_pixels_);
sky 2015/09/28 15:29:09 Why do we need frame_size_in_pixels_ as a member?
Fady Samuel 2015/09/28 15:57:00 Done.
+
+ web_layer_.reset(new cc_blink::WebLayerImpl(surface_layer_));
}
remote_frame->setRemoteWebLayer(web_layer_.get());
remote_frame->setReplicatedName(state_.name);
@@ -846,6 +863,7 @@ void HTMLFrame::initializeChildFrame(const blink::WebRect& frame_rect,
frame_rect.height);
const gfx::Rect rect_in_pixels(gfx::ConvertRectToPixel(
global_state()->device_pixel_ratio(), rect_in_dip));
+ frame_size_in_pixels_ = rect_in_pixels.size();
const mojo::RectPtr mojo_rect_in_pixels(mojo::Rect::From(rect_in_pixels));
view_->SetBounds(*mojo_rect_in_pixels);
}
@@ -864,8 +882,17 @@ 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& rect) {
+ // TODO(fsamuel): The content of the iframe should also resize.
+ frame_size_in_pixels_ =
+ gfx::ScaleToCeiledSize(gfx::Size(rect.width, rect.height),
+ global_state()->device_pixel_ratio());
+
+ if (!surface_layer_)
+ return;
+ surface_layer_->SetSurfaceId(cc::SurfaceId(owned_view_->view()->id()),
+ global_state()->device_pixel_ratio(),
+ frame_size_in_pixels_);
}
} // 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