Fix orientation angle value
[framework/web/webkit-efl.git] / Source / WebCore / platform / efl / PlatformScreenEfl.cpp
index 1a73e5d..443b122 100644 (file)
@@ -117,7 +117,9 @@ bool screenIsMonochrome(Widget* widget)
 FloatRect screenRect(Widget* widget)
 {
 #ifdef HAVE_ECORE_X
+#if !ENABLE(ORIENTATION_EVENTS)
     UNUSED_PARAM(widget);
+#endif
     // Fallback to realistic values if the EcoreX call fails
     // and we cannot accurately detect the screen size.
     int width = 800;
@@ -125,6 +127,24 @@ FloatRect screenRect(Widget* widget)
     ecore_x_screen_size_get(ecore_x_default_screen_get(), &width, &height);
 
 #if OS(TIZEN)
+#if ENABLE(ORIENTATION_EVENTS)
+    // Getting orientation via Ecore_X_Window cannot be fully synced
+    // So, we use Frame::orientation() if we have widget here
+    if (widget) {
+        FrameView* frameView = static_cast<FrameView*>(widget);
+        Frame* frame = frameView->frame();
+        int orientation = frame ? frame->orientation() : 0;
+        // landscape orientation value is 90 or -90
+        // ref. ewk_view_orientation_send()
+        if (orientation == 90 || orientation == -90) {
+            int temp = width;
+            width = height;
+            height = temp;
+        }
+        return FloatRect(0, 0, width, height);
+    }
+#endif
+
     int count = 0;
     unsigned char *prop_data = NULL;
     Ecore_X_Window xWindow = ecore_x_window_root_first_get();