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

Unified Diff: mojo/services/view_manager/public/cpp/lib/view_manager_client_impl.cc

Issue 883843002: Update mojo sdk to rev 126532ce21c5c3c55a1e1693731411cb60169efd (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Response to review Created 5 years, 11 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: mojo/services/view_manager/public/cpp/lib/view_manager_client_impl.cc
diff --git a/mojo/services/view_manager/public/cpp/lib/view_manager_client_impl.cc b/mojo/services/view_manager/public/cpp/lib/view_manager_client_impl.cc
index 78daeb3244d4a6b6b953b5fd2ee44893195fbf04..595e03969427397ee53d0849e2e85fc07bfea9c2 100644
--- a/mojo/services/view_manager/public/cpp/lib/view_manager_client_impl.cc
+++ b/mojo/services/view_manager/public/cpp/lib/view_manager_client_impl.cc
@@ -36,7 +36,8 @@ View* AddViewToViewManager(ViewManagerClientImpl* client,
private_view.set_id(view_data->view_id);
private_view.set_visible(view_data->visible);
private_view.set_drawn(view_data->drawn);
- private_view.set_viewport_metrics(view_data->viewport_metrics.Pass());
+ private_view.LocalSetViewportMetrics(ViewportMetrics(),
+ *view_data->viewport_metrics);
private_view.set_properties(
view_data->properties.To<std::map<std::string, std::vector<uint8_t>>>());
client->AddView(view);
@@ -296,6 +297,26 @@ void ViewManagerClientImpl::OnViewBoundsChanged(Id view_id,
ViewPrivate(view).LocalSetBounds(*old_bounds, *new_bounds);
}
+namespace {
+
+void SetViewportMetricsOnDecendants(View* root,
+ const ViewportMetrics& old_metrics,
+ const ViewportMetrics& new_metrics) {
+ ViewPrivate(root).LocalSetViewportMetrics(old_metrics, new_metrics);
+ const View::Children& children = root->children();
+ for (size_t i = 0; i < children.size(); ++i)
+ SetViewportMetricsOnDecendants(children[i], old_metrics, new_metrics);
+}
+}
+
+void ViewManagerClientImpl::OnViewViewportMetricsChanged(
+ ViewportMetricsPtr old_metrics,
+ ViewportMetricsPtr new_metrics) {
+ View* view = GetRoot();
+ if (view)
+ SetViewportMetricsOnDecendants(view, *old_metrics, *new_metrics);
+}
+
void ViewManagerClientImpl::OnViewHierarchyChanged(
Id view_id,
Id new_parent_id,

Powered by Google App Engine
This is Rietveld 408576698