touch_events_enabled_(false),
web_contents_(web_contents),
weak_factory_(this) {
- EnsureDeviceDisplayInfoInitialized();
+ parent_view_ = static_cast<Evas_Object*>(web_contents.GetNativeView());
+ evas_ = evas_object_evas_get(parent_view_);
+
+ InitializeDeviceDisplayInfo();
SetDoubleTapSupportEnabled(touch_events_enabled_);
gesture_recognizer_->AddGestureEventHelper(this);
}
-void RenderWidgetHostViewEfl::InitAsChild(gfx::NativeView parent_view) {
- DCHECK(parent_view);
- parent_view_ = static_cast<Evas_Object*>(parent_view);
- evas_ = evas_object_evas_get(parent_view_);
-
- // Update rotation degrees in device display info.
- UpdateRotationDegrees(
- ecore_evas_rotation_get(ecore_evas_ecore_evas_get(evas_)));
-
+void RenderWidgetHostViewEfl::InitAsChild(gfx::NativeView /* parent_view */) {
content_image_elm_host_ = elm_bg_add(parent_view_);
content_image_ = evas_object_image_filled_add(evas_);
elm_object_part_content_set(content_image_elm_host_, "overlay",
renderer_compositor_frame_sink_->DidReceiveCompositorFrameAck(resources);
}
-void RenderWidgetHostViewEfl::EnsureDeviceDisplayInfoInitialized() {
+void RenderWidgetHostViewEfl::InitializeDeviceDisplayInfo() {
static bool initialized = false;
if (initialized)
return;
initialized = true;
- display::DeviceDisplayInfoEfl display_info;
-
- int display_width = 0;
- int display_height = 0;
- int dpi = 0;
-
-#if defined(USE_WAYLAND)
- ecore_wl_screen_size_get(&display_width, &display_height);
- dpi = static_cast<double>(ecore_wl_dpi_get());
-#else // X11
- ecore_x_screen_size_get(ecore_x_default_screen_get(), &display_width,
- &display_height);
- dpi = static_cast<double>(ecore_x_dpi_get());
-#endif
+ int display_width = 0, display_height = 0, dpi = 0;
+ const Ecore_Evas* ee = ecore_evas_ecore_evas_get(evas_);
+ ecore_evas_screen_geometry_get(ee, nullptr, nullptr, &display_width,
+ &display_height);
+ ecore_evas_screen_dpi_get(ee, &dpi, nullptr);
- // Here initialize rotation degrees to 0, as rotation is updated separately
- // after RWHV gets created.
+ display::DeviceDisplayInfoEfl display_info;
display_info.Update(display_width, display_height,
- display_info.ComputeDIPScale(dpi), 0);
+ display_info.ComputeDIPScale(dpi),
+ ecore_evas_rotation_get(ee));
}
void RenderWidgetHostViewEfl::Invalidate(bool immediate) {
display::Display display(0);
display.SetRotationAsDegree(display_info.GetRotationDegrees());
- // TODO(prashant.n): Use DeviceDisplayInfoEfl for width and height.
- // (http://web.sec.samsung.net/bugzilla/show_bug.cgi?id=14917)
- int width, height;
-#if defined(USE_WAYLAND)
- if (display.rotation() == display::Display::ROTATE_90 ||
- display.rotation() == display::Display::ROTATE_270) {
- ecore_wl_screen_size_get(&height, &width);
- } else {
- ecore_wl_screen_size_get(&width, &height);
- }
-#else
- Ecore_X_Screen* screen = ecore_x_default_screen_get();
-
- if (display.rotation() == display::Display::ROTATE_90 ||
- display.rotation() == display::Display::ROTATE_270) {
- ecore_x_screen_size_get(screen, &height, &width);
- } else {
- ecore_x_screen_size_get(screen, &width, &height);
- }
-#endif
+ int width = display_info.GetDisplayWidth();
+ int height = display_info.GetDisplayHeight();
const gfx::Rect bounds_in_pixels = gfx::Rect(width, height);
const gfx::Rect bounds_in_dip =
gfx::NativeWindow Screen::GetWindowForView(gfx::NativeView view) {
return view;
}
-Screen* CreateNativeScreen() {
- return new ui::ScreenEfl();
-}
} // namespace display