fixup! [EWK_REFACTOR] Get orientation from native window, not ewebview
authoryh106.jung <yh106.jung@samsung.com>
Wed, 10 Jun 2015 12:12:52 +0000 (21:12 +0900)
committerYoungsoo Choi <kenshin.choi@samsung.com>
Tue, 10 Jul 2018 06:57:09 +0000 (06:57 +0000)
Native screen sent invalid orientation, it always returned 0.
So set orientation value once app informs to WebCotentsViewEfl.

Bug: http://web.sec.samsung.net/bugzilla/show_bug.cgi?id=13156
Reviewed by: Antonio Gomes, Hyunhak Kim, SeungSeop Park, arno renevier

Change-Id: Iee806175b3616d31188687f0dafd2dabc0fb1cb6
Signed-off-by: yh106.jung <yh106.jung@samsung.com>
tizen_src/chromium_impl/content/browser/web_contents/web_contents_view_efl.cc
tizen_src/chromium_impl/media/video/capture/tizen/video_capture_device_tizen.cc
tizen_src/chromium_impl/ui/gfx/screen_efl.cc
tizen_src/chromium_impl/ui/gfx/screen_efl.h

index 0f2a14b..37ab132 100644 (file)
@@ -23,6 +23,7 @@
 #include "efl/window_factory.h"
 #include "ui/events/event_switches.h"
 #include "ui/gfx/image/image_skia.h"
+#include "ui/gfx/screen_efl.h"
 #include "ui/gl/gl_shared_context_efl.h"
 
 namespace content {
@@ -296,6 +297,8 @@ void WebContentsViewEfl::SetOrientation(int orientation) {
     contents_impl.screen_orientation_dispatcher_host()->OnOrientationChange();
   }
 
+  ui::SetScreenOrientation(orientation);
+
   orientation_ = orientation;
 }
 
index 495e04f..0132a85 100644 (file)
 #endif
 
 #include "base/bind.h"
-#if defined(OS_TIZEN_MOBILE)
-#include "ui/gfx/display.h"
 #include "ui/gfx/screen.h"
-#endif
 
 #if defined(WEBRTC_DEBUG_DUMPFILE)
 int fd_1 = -1;
@@ -238,12 +235,9 @@ void VideoCaptureDeviceTizen::OnCameraCaptured(camera_preview_data_s* frame,
   DVLOG(3)  << " width:" << frame->width
             << " height:" << frame->height;
 
-#if defined(OS_TIZEN_MOBILE)
-  const gfx::Display display = gfx::Screen::GetNativeScreen()->GetPrimaryDisplay();
+  const gfx::Display display =
+      gfx::Screen::GetNativeScreen()->GetPrimaryDisplay();
   int orientation = display.RotationAsDegree();
-#else
-  int orientation = 0;
-#endif
   gfx::Size target_resolution(frame->width, frame->height);
   int target_rotation = (orientation +
       GetCameraOrientation(self->device_name_.id().c_str())) % DEGREE_360;
index 2736226..a2b4c33 100644 (file)
@@ -26,6 +26,7 @@ const float kDefaultDeviceScaleFactor = 2.0f;
 #else
 const float kDefaultDeviceScaleFactor = 1.0f;
 #endif
+int g_screen_orientation = 0;
 } // namespace
 
 class ScreenEfl : public gfx::Screen {
@@ -79,12 +80,7 @@ class ScreenEfl : public gfx::Screen {
 
     gfx::Display display(0);
 
-# warning "Figure out proper way to get current screen orientation"
-#if 0
-    // TODO(Youngsoo Choi): If there's a way to get orientation
-    // from platform not using saved value, it would be better.
-    display.SetRotationAsDegree(EWebView::GetOrientation());
-#endif
+    display.SetRotationAsDegree(g_screen_orientation);
 
     int width, height;
 #if defined(USE_WAYLAND)
@@ -135,6 +131,10 @@ void InstallScreenInstance()
     gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, new ui::ScreenEfl());
   }
 }
+
+void SetScreenOrientation(int screen_orientation) {
+  g_screen_orientation = screen_orientation;
+}
 } // namespace ui
 
 namespace gfx {
index 784d601..b451352 100644 (file)
@@ -9,6 +9,8 @@ namespace ui {
 
 void InstallScreenInstance();
 
+void SetScreenOrientation(int screen_orientation);
+
 }
 
 #endif