fixup! Fix ewk_view_orientation_send API
authorLukasz Krok <l.krok@samsung.com>
Mon, 19 Jan 2015 08:42:26 +0000 (09:42 +0100)
committerYoungsoo Choi <kenshin.choi@samsung.com>
Tue, 10 Jul 2018 06:57:09 +0000 (06:57 +0000)
During patch review on dev/master some improvements to the fix
were introduced. This patch migrates the improvements to beta.

Bug: http://107.108.218.239/bugzilla/show_bug.cgi?id=9541
Reviewed by: Antonio Gomes, Daniel Waślicki, Piotr Tworek

Change-Id: I9b28cb4ede25770b1d98b42702f218b9b1188f7f
Signed-off-by: Lukasz Krok <l.krok@samsung.com>
tizen_src/impl/browser/web_contents/web_contents_view_efl.cc
tizen_src/impl/browser/web_contents/web_contents_view_efl.h
tizen_src/impl/eweb_view.cc

index 22bd0ab..54770e4 100644 (file)
@@ -12,6 +12,8 @@
 #include "base/strings/utf_string_conversions.h"
 #include "browser/renderer_host/render_widget_host_view_efl.h"
 #include "content/browser/web_contents/web_contents_impl.h"
+#include "content/common/view_messages.h"
+#include "content/public/browser/screen_orientation_dispatcher_host.h"
 #include "content/public/browser/web_contents_view_delegate.h"
 #include "gl/gl_shared_context_efl.h"
 
@@ -32,6 +34,7 @@ WebContentsViewEfl::WebContentsViewEfl(WebContents* contents,
     , native_view_(NULL)
     , drag_dest_delegate_(NULL)
     , view_mode_(tizen_webview::TW_VIEW_MODE_WINDOWED) // default value for webkit
+    , orientation_(0)
     , web_contents_(contents) {}
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -57,7 +60,7 @@ RenderWidgetHostViewBase* WebContentsViewEfl::CreateViewForWidget(
     view->SetViewMode(view_mode_);
   }
 
-  GetEWebView()->SetOrientation(EWebView::GetOrientation());
+  SetOrientation(orientation_);
 
   return view;
 }
@@ -214,6 +217,29 @@ void WebContentsViewEfl::ShowPopupMenu(RenderFrameHost* render_frame_host,
 }
 #endif
 
+void WebContentsViewEfl::SetOrientation(int orientation) {
+  RenderWidgetHostViewEfl* rwhv = static_cast<RenderWidgetHostViewEfl*>(
+                                    web_contents_->GetRenderWidgetHostView());
+
+  if (rwhv) {
+    RenderWidgetHost* rwh = rwhv->GetRenderWidgetHost();
+    blink::WebScreenInfo screen_info;
+    rwh->GetWebScreenInfo(&screen_info);
+    screen_info.orientationAngle = orientation;
+
+    ViewMsg_Resize_Params params;
+    params.screen_info = screen_info;
+
+    rwh->Send(new ViewMsg_Resize(rwh->GetRoutingID(), params));
+    rwhv->UpdateScreenInfo(rwhv->GetNativeView());
+
+    WebContentsImpl& contents_impl = static_cast<WebContentsImpl&>(*web_contents_);
+    contents_impl.screen_orientation_dispatcher_host()->OnOrientationChange();
+  }
+
+  orientation_ = orientation;
+}
+
 EWebView* WebContentsViewEfl::GetEWebView() const {
   // TODO: not best way, but until we merge 5486351bf10375c64ec997e613a2155ca3a24cc7
   // this is the only way to make it work. Fixup ca5b85c82985e02ee7e908952ba894ef7b7d2a32
index a04220f..200607d 100644 (file)
@@ -69,6 +69,8 @@ class WebContentsViewEfl
   virtual void UpdateFormNavigation(int formElementCount, int currentNodeIndex,
       bool prevState, bool nextState) override;
 
+  virtual void SetOrientation(int orientation);
+
 private:
   EWebView* GetEWebView() const;
 
@@ -87,9 +89,12 @@ private:
   // EFL.
   scoped_ptr<WebDragDestEfl> drag_dest_;
 
-  WebContents* web_contents_;
 
   tizen_webview::View_Mode view_mode_;
+
+  int orientation_;
+
+  WebContents* web_contents_;
 };
 
 }
index 1e1c4be..ce1a304 100644 (file)
@@ -34,7 +34,6 @@
 #include "content/public/browser/navigation_controller.h"
 #include "content/public/browser/navigation_entry.h"
 #include "content/public/browser/resource_dispatcher_host.h"
-#include "content/public/browser/screen_orientation_dispatcher_host.h"
 #include "content/public/common/content_client.h"
 #include "content/public/common/user_agent.h"
 #include "content/public/browser/browser_thread.h"
@@ -637,28 +636,13 @@ void EWebView::SetOrientation(int orientation) {
     orientation = 270;
   screen_orientation_ = orientation;
 
-  RenderWidgetHostViewEfl* view = rwhv();
-  if (view && (
-      screen_orientation_ == 0   ||
+  if (screen_orientation_ == 0   ||
       screen_orientation_ == 90  ||
       screen_orientation_ == 180 ||
-      screen_orientation_ == 270
-      )
-     ) {
-    RenderWidgetHost* rwh = view->GetRenderWidgetHost();
-
-    blink::WebScreenInfo screen_info;
-    rwh->GetWebScreenInfo(&screen_info);
-    screen_info.orientationAngle = screen_orientation_;
-
-    ViewMsg_Resize_Params params;
-    params.screen_info = screen_info;
-
-    rwh->Send(new ViewMsg_Resize(rwh->GetRoutingID(), params));
-    view->UpdateScreenInfo(view->GetNativeView());
-
-    WebContentsImpl& contents_impl = static_cast<WebContentsImpl&>(web_contents());
-    contents_impl.screen_orientation_dispatcher_host()->OnOrientationChange();
+      screen_orientation_ == 270) {
+    WebContentsImpl* web_contents = static_cast<WebContentsImpl*>(web_contents_.get());
+    WebContentsViewEfl* web_contents_view = static_cast<WebContentsViewEfl*>(web_contents->GetView());
+    web_contents_view->SetOrientation(screen_orientation_);
   }
 }