[Release] Webkit-EFL Ver. 2.0_beta_118996_0.6.24
[framework/web/webkit-efl.git] / Source / WebCore / platform / efl / PlatformScreenEfl.cpp
1 /*
2  * Copyright (C) 2007 Apple Inc.  All rights reserved.
3  * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
4  * Copyright (C) 2008 Holger Hans Peter Freyther
5  * Copyright (C) 2008 INdT - Instituto Nokia de Tecnologia
6  * Copyright (C) 2009-2010 ProFUSION embedded systems
7  * Copyright (C) 2009-2010 Samsung Electronics
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  *
13  * 1.  Redistributions of source code must retain the above copyright
14  *     notice, this list of conditions and the following disclaimer.
15  * 2.  Redistributions in binary form must reproduce the above copyright
16  *     notice, this list of conditions and the following disclaimer in the
17  *     documentation and/or other materials provided with the distribution.
18  * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
19  *     its contributors may be used to endorse or promote products derived
20  *     from this software without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
23  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
24  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25  * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
26  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
27  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
29  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
31  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  */
33
34 #include "config.h"
35 #include "PlatformScreen.h"
36
37 #include "NotImplemented.h"
38 #include "PlatformString.h"
39 #include "Widget.h"
40
41 #include <Ecore_Evas.h>
42 #include <wtf/text/CString.h>
43
44 #if ENABLE(TIZEN_WEBKIT2)
45 #include "Frame.h"
46 #include "FrameView.h"
47 #include "Settings.h"
48 #endif
49
50 #if ENABLE(TIZEN_VIEWPORT_POLICY)
51 #include "Chrome.h"
52 #include "ChromeClient.h"
53 #include "Frame.h"
54 #include "FrameView.h"
55 #include "Page.h"
56 #include "Settings.h"
57 #endif
58
59 namespace WebCore {
60  
61 int screenHorizontalDPI(Widget* widget)
62 {
63     notImplemented();
64     return 0;
65 }
66
67 int screenVerticalDPI(Widget* widget)
68 {
69     notImplemented();
70     return 0;
71 }
72
73 int screenDepth(Widget* widget)
74 {
75     notImplemented();
76     return 8;
77 }
78
79 int screenDepthPerComponent(Widget*)
80 {
81     notImplemented();
82     return 8;
83 }
84
85 bool screenIsMonochrome(Widget*)
86 {
87     notImplemented();
88     return false;
89 }
90
91 FloatRect screenRect(Widget* widget)
92 {
93     if (!widget)
94         return FloatRect();
95
96 #if ENABLE(TIZEN_WEBKIT2)
97     if (!widget->isFrameView())
98         return FloatRect();
99
100     FrameView* frameView = dynamic_cast<FrameView*>(widget);
101     if (!frameView->frame() || !frameView->frame()->settings())
102         return FloatRect();
103
104     // FIXME: We use device width and height for screen size
105     // because evas exists in the UIProcess and we can not get
106     // in the WebProcess. We have to find better solution later.
107     int width = frameView->frame()->settings()->deviceWidth();
108     int height = frameView->frame()->settings()->deviceHeight();
109
110     return FloatRect(0, 0, width, height);
111 #else
112     int x, y, w, h;
113     Evas* e = widget->evas();
114
115     ecore_evas_screen_geometry_get(ecore_evas_ecore_evas_get(e), &x, &y, &w, &h);
116
117     return FloatRect(x, y, w, h);
118 #endif
119 }
120
121 FloatRect screenAvailableRect(Widget* widget)
122 {
123 #if ENABLE(TIZEN_VIEWPORT_POLICY)
124     if (!widget)
125         return FloatRect();
126
127     if (!widget->isFrameView())
128         return FloatRect();
129
130     FrameView* frameView = dynamic_cast<FrameView*>(widget);
131     if (!frameView->frame() || !frameView->frame()->page())
132         return FloatRect();
133
134     return frameView->frame()->page()->chrome()->client()->innerScreenRect();
135 #else
136     notImplemented();
137     return screenRect(widget);
138 #endif
139 }
140
141 }