From fac8e80924d6b292eef5c43479c72562f9d39362 Mon Sep 17 00:00:00 2001 From: Suneel Kota Date: Wed, 2 May 2018 18:48:03 +0530 Subject: [PATCH] [M85 Migration][Rotation] Adjust screen orienation for landscape mode Currently, screen is reversed on landscape mode. In order to fix it, this patch migrates below patches which are related with screen orientation. The below patch also contains changes of context menu, which will be migrated along with context menu patches Ref: https://review.tizen.org/gerrit/c/platform/framework/web/chromium-efl/+/219674 Change-Id: Id642a5144656550105065cbea8059fad109742f2 Signed-off-by: Suneel Kota --- .../browser/web_contents/web_contents_view_efl.h | 1 + tizen_src/ewk/efl_integration/eweb_view.cc | 21 ++++++--------------- tizen_src/ewk/efl_integration/eweb_view.h | 2 +- tizen_src/ewk/efl_integration/public/ewk_view.cc | 13 ------------- 4 files changed, 8 insertions(+), 29 deletions(-) diff --git a/tizen_src/chromium_impl/content/browser/web_contents/web_contents_view_efl.h b/tizen_src/chromium_impl/content/browser/web_contents/web_contents_view_efl.h index 0c4745f..1affa93 100644 --- a/tizen_src/chromium_impl/content/browser/web_contents/web_contents_view_efl.h +++ b/tizen_src/chromium_impl/content/browser/web_contents/web_contents_view_efl.h @@ -86,6 +86,7 @@ class CONTENT_EXPORT WebContentsViewEfl bool IsDragging() const; void SetOrientation(int orientation); + int GetOrientation() const { return orientation_; } void SetTouchEventsEnabled(bool); void SetPageScaleFactor(float); void QuerySelectionStyle(); diff --git a/tizen_src/ewk/efl_integration/eweb_view.cc b/tizen_src/ewk/efl_integration/eweb_view.cc index 900706f..579271f 100644 --- a/tizen_src/ewk/efl_integration/eweb_view.cc +++ b/tizen_src/ewk/efl_integration/eweb_view.cc @@ -73,8 +73,6 @@ using web_contents_utils::WebViewFromWebContents; namespace { -int screen_orientation_ = 0; - static const char* kRendererCrashedHTMLMessage = "

Renderer process has crashed!

"; @@ -477,19 +475,12 @@ void EWebView::ExecuteEditCommand(const char* command, const char* value) { } void EWebView::SetOrientation(int orientation) { - // For backward compatibility, a value in range of [0, 360] is used - // instead of [-90, 180] because the class gfx::Display, containing - // orientaion value, supports the former range. - if (orientation == -90) - orientation = 270; - screen_orientation_ = orientation; - - if (screen_orientation_ == 0 || screen_orientation_ == 90 || - screen_orientation_ == 180 || screen_orientation_ == 270) { - GetWebContentsViewEfl()->SetOrientation(screen_orientation_); + if (GetOrientation() == orientation) + return; - // workaround for platform issue not resizing popup after rotation - // this should be removed when when proper fix will be applied for platorm. + if (orientation == 0 || orientation == 90 || orientation == 180 || + orientation == 270) { + GetWebContentsViewEfl()->SetOrientation(orientation); int width = 0; int height = 0; @@ -513,7 +504,7 @@ void EWebView::SetOrientation(int orientation) { } int EWebView::GetOrientation() { - return screen_orientation_; + return GetWebContentsViewEfl()->GetOrientation(); } void EWebView::Show() { diff --git a/tizen_src/ewk/efl_integration/eweb_view.h b/tizen_src/ewk/efl_integration/eweb_view.h index fb9dc85..19e0761 100644 --- a/tizen_src/ewk/efl_integration/eweb_view.h +++ b/tizen_src/ewk/efl_integration/eweb_view.h @@ -164,7 +164,6 @@ class PermissionPopupManager; class EWebView { public: static EWebView* FromEvasObject(Evas_Object* eo); - static int GetOrientation(); EWebView(Ewk_Context*, Evas_Object* smart_object); ~EWebView(); @@ -215,6 +214,7 @@ class EWebView { void SetPageZoomFactor(double page_zoom_factor); void ExecuteEditCommand(const char* command, const char* value); void SetOrientation(int orientation); + int GetOrientation(); bool TouchEventsEnabled() const; void SetTouchEventsEnabled(bool enabled); bool MouseEventsEnabled() const; diff --git a/tizen_src/ewk/efl_integration/public/ewk_view.cc b/tizen_src/ewk/efl_integration/public/ewk_view.cc index 724a673..5dad47a 100644 --- a/tizen_src/ewk/efl_integration/public/ewk_view.cc +++ b/tizen_src/ewk/efl_integration/public/ewk_view.cc @@ -690,19 +690,6 @@ Eina_Bool ewk_view_popup_menu_multiple_select(Evas_Object* ewkView, Eina_Inarray return false; } -/* - * Sends the new orientation of the device. - * - * If orientation value is changed, orientationchanged event will occur. - * - * @param view object to receive orientation event. - * @param orientation the new orientation of the device. (degree) - * - * orientation will be 0 degrees when the device is oriented to natural position, - * 90 degrees when it's left side is at the top, - * -90 degrees when it's right side is at the top, - * 180 degrees when it is upside down. - */ void ewk_view_orientation_send(Evas_Object* ewkView, int orientation) { EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl); -- 2.7.4