Index: content/common/render_widget_surface_properties.cc |
diff --git a/content/common/render_widget_surface_properties.cc b/content/common/render_widget_surface_properties.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..fd262a59df034b5eceb3cd1fdbbd2ff4e28b7455 |
--- /dev/null |
+++ b/content/common/render_widget_surface_properties.cc |
@@ -0,0 +1,47 @@ |
+// 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 "content/common/render_widget_surface_properties.h" |
+ |
+namespace content { |
+ |
+// static |
+RenderWidgetSurfaceProperties |
+RenderWidgetSurfaceProperties::FromCompositorFrame( |
+ const cc::CompositorFrame& frame) { |
+ RenderWidgetSurfaceProperties properties; |
+ properties.frame_size = frame.render_pass_list.back()->output_rect.size(); |
+ properties.device_scale_factor = frame.metadata.device_scale_factor; |
+#ifdef OS_ANDROID |
+ properties.top_controls_height = frame.metadata.top_controls_height; |
+ properties.top_controls_shown_ratio = frame.metadata.top_controls_shown_ratio; |
+ properties.bottom_controls_height = frame.metadata.bottom_controls_height; |
+ properties.bottom_controls_shown_ratio = |
+ frame.metadata.bottom_controls_shown_ratio; |
+ properties.selection = frame.metadata.selection; |
+ properties.has_transparent_background = root_pass->has_transparent_background; |
+#endif |
+ return properties; |
+} |
+ |
+bool RenderWidgetSurfaceProperties::operator==( |
+ const RenderWidgetSurfaceProperties& other) const { |
+ return other.device_scale_factor == device_scale_factor && |
+#ifdef OS_ANDROID |
+ other.top_controls_height == top_controls_height && |
+ other.top_controls_shown_ratio == top_controls_shown_ratio && |
+ other.bottom_controls_height == bottom_controls_height && |
+ other.bottom_controls_shown_ratio == bottom_controls_shown_ratio && |
+ other.selection == selection && |
+ other.has_transparent_background == has_transparent_background && |
+#endif |
+ other.frame_size == frame_size; |
+} |
+ |
+bool RenderWidgetSurfaceProperties::operator!=( |
+ const RenderWidgetSurfaceProperties& other) const { |
+ return !(*this == other); |
+} |
+ |
+} // namespace content |