[M85 Migration][Rotation] Adjust screen orienation for landscape mode 65/245365/2
authorSuneel Kota <suneel.kota@samsung.com>
Wed, 2 May 2018 13:18:03 +0000 (18:48 +0530)
committerBot Blink <blinkbot@samsung.com>
Mon, 12 Oct 2020 06:54:53 +0000 (06:54 +0000)
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 <suneel.kota@samsung.com>
tizen_src/chromium_impl/content/browser/web_contents/web_contents_view_efl.h
tizen_src/ewk/efl_integration/eweb_view.cc
tizen_src/ewk/efl_integration/eweb_view.h
tizen_src/ewk/efl_integration/public/ewk_view.cc

index 0c4745f..1affa93 100644 (file)
@@ -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();
index 900706f..579271f 100644 (file)
@@ -73,8 +73,6 @@ using web_contents_utils::WebViewFromWebContents;
 
 namespace {
 
-int screen_orientation_ = 0;
-
 static const char* kRendererCrashedHTMLMessage =
     "<html><body><h1>Renderer process has crashed!</h1></body></html>";
 
@@ -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() {
index fb9dc85..19e0761 100644 (file)
@@ -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;
index 724a673..5dad47a 100644 (file)
@@ -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);