Changeset 141274 in webkit
- Timestamp:
- Jan 30, 2013 8:52:41 AM (11 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r141263 r141274 1 2013-01-30 Christophe Dumez <christophe.dumez@intel.com> 2 3 [EFL][WK2] Use C API inside ewk_window_features 4 https://bugs.webkit.org/show_bug.cgi?id=107924 5 6 Reviewed by Sam Weinig. 7 8 Use C API inside ewk_window_features instead of accessing 9 internal C++ classes directly, to avoid violating API 10 layering. 11 12 * UIProcess/API/efl/EwkView.cpp: 13 (EwkView::createNewPage): 14 * UIProcess/API/efl/EwkView.h: 15 (EwkView): 16 * UIProcess/API/efl/ewk_window_features.cpp: 17 (EwkWindowFeatures::EwkWindowFeatures): 18 (getWindowFeatureValue): 19 (EwkWindowFeatures::getWindowFeatureBoolValue): 20 (EwkWindowFeatures::getWindowFeatureDoubleValue): 21 (ewk_window_features_geometry_get): 22 * UIProcess/API/efl/ewk_window_features_private.h: 23 (EwkWindowFeatures::create): 24 (EwkWindowFeatures::geometry): 25 (EwkWindowFeatures::setGeometry): 26 (EwkWindowFeatures): 27 * UIProcess/efl/PageUIClientEfl.cpp: 28 (WebKit::PageUIClientEfl::createNewPage): 29 1 30 2013-01-30 Zeno Albisser <zeno@webkit.org> 2 31 -
trunk/Source/WebKit2/UIProcess/API/efl/EwkView.cpp
r141040 r141274 918 918 } 919 919 920 WKPageRef EwkView::createNewPage(PassRefPtr<EwkUrlRequest> request, ImmutableDictionary*windowFeatures)920 WKPageRef EwkView::createNewPage(PassRefPtr<EwkUrlRequest> request, WKDictionaryRef windowFeatures) 921 921 { 922 922 Ewk_View_Smart_Data* sd = smartData(); -
trunk/Source/WebKit2/UIProcess/API/efl/EwkView.h
r140961 r141274 174 174 #endif 175 175 176 WKPageRef createNewPage(PassRefPtr<EwkUrlRequest>, W ebKit::ImmutableDictionary*windowFeatures);176 WKPageRef createNewPage(PassRefPtr<EwkUrlRequest>, WKDictionaryRef windowFeatures); 177 177 void close(); 178 178 -
trunk/Source/WebKit2/UIProcess/API/efl/ewk_window_features.cpp
r140686 r141274 27 27 #include "ewk_window_features.h" 28 28 29 #include "WebNumber.h" 29 #include "EwkView.h" 30 #include "WKDictionary.h" 31 #include "WKNumber.h" 32 #include "WKString.h" 30 33 #include "ewk_window_features_private.h" 31 #include <Eina.h>32 34 33 35 using namespace WebKit; 34 36 35 EwkWindowFeatures::EwkWindowFeatures( ImmutableDictionary*windowFeatures, EwkView* view)37 EwkWindowFeatures::EwkWindowFeatures(WKDictionaryRef windowFeatures, EwkView* view) 36 38 : m_view(view) 37 , m_geometry(0, 0, 100, 100) 38 , m_toolbarVisible(true) 39 , m_statusBarVisible(true) 40 , m_scrollbarsVisible(true) 41 , m_menuBarVisible(true) 42 , m_locationBarVisible(true) 43 , m_resizable(true) 44 , m_fullScreen(false) 39 , m_toolbarVisible(getWindowFeatureBoolValue(windowFeatures, "toolBarVisible", true)) 40 , m_statusBarVisible(getWindowFeatureBoolValue(windowFeatures, "statusBarVisible", true)) 41 , m_scrollbarsVisible(getWindowFeatureBoolValue(windowFeatures, "scrollbarsVisible", true)) 42 , m_menuBarVisible(getWindowFeatureBoolValue(windowFeatures, "menuBarVisible", true)) 43 , m_locationBarVisible(getWindowFeatureBoolValue(windowFeatures, "locationBarVisible", true)) 44 , m_resizable(getWindowFeatureBoolValue(windowFeatures, "resizable", true)) 45 , m_fullScreen(getWindowFeatureBoolValue(windowFeatures, "fullscreen", false)) 45 46 { 46 if (windowFeatures) { 47 m_geometry.setX(getWindowFeatureValue<double, WebDouble>(windowFeatures, ASCIILiteral("x"))); 48 m_geometry.setY(getWindowFeatureValue<double, WebDouble>(windowFeatures, ASCIILiteral("y"))); 49 m_geometry.setWidth(getWindowFeatureValue<double, WebDouble>(windowFeatures, ASCIILiteral("width"))); 50 m_geometry.setHeight(getWindowFeatureValue<double, WebDouble>(windowFeatures, ASCIILiteral("height"))); 51 52 m_toolbarVisible = getWindowFeatureValue<bool, WebBoolean>(windowFeatures, ASCIILiteral("toolBarVisible")); 53 m_statusBarVisible = getWindowFeatureValue<bool, WebBoolean>(windowFeatures, ASCIILiteral("statusBarVisible")); 54 m_scrollbarsVisible = getWindowFeatureValue<bool, WebBoolean>(windowFeatures, ASCIILiteral("scrollbarsVisible")); 55 m_menuBarVisible = getWindowFeatureValue<bool, WebBoolean>(windowFeatures, ASCIILiteral("menuBarVisible")); 56 m_locationBarVisible = getWindowFeatureValue<bool, WebBoolean>(windowFeatures, ASCIILiteral("locationBarVisible")); 57 m_resizable = getWindowFeatureValue<bool, WebBoolean>(windowFeatures, ASCIILiteral("resizable")); 58 m_fullScreen = getWindowFeatureValue<bool, WebBoolean>(windowFeatures, ASCIILiteral("fullscreen")); 59 } 47 m_geometry.x = getWindowFeatureDoubleValue(windowFeatures, "x", 0); 48 m_geometry.y = getWindowFeatureDoubleValue(windowFeatures, "y", 0); 49 m_geometry.w = getWindowFeatureDoubleValue(windowFeatures, "width", 0); 50 m_geometry.h = getWindowFeatureDoubleValue(windowFeatures, "height", 0); 60 51 } 61 52 62 template <typename T1, typename T2> 63 T1 EwkWindowFeatures::getWindowFeatureValue(ImmutableDictionary* windowFeatures, const String& featureName) 53 static inline WKTypeRef getWindowFeatureValue(WKDictionaryRef windowFeatures, const char* featureName) 64 54 { 65 T2* featureValue = static_cast<T2*>(windowFeatures->get(featureName)); 55 ASSERT(featureName); 56 if (!windowFeatures) 57 return 0; 66 58 67 if (!featureValue) 68 return false; 59 WKRetainPtr<WKStringRef> key(AdoptWK, WKStringCreateWithUTF8CString(featureName)); 60 return WKDictionaryGetItemForKey(windowFeatures, key.get()); 61 } 69 62 70 return featureValue->value(); 63 bool EwkWindowFeatures::getWindowFeatureBoolValue(WKDictionaryRef windowFeatures, const char* featureName, bool defaultValue) 64 { 65 WKBooleanRef value = static_cast<WKBooleanRef>(getWindowFeatureValue(windowFeatures, featureName)); 66 67 return value ? WKBooleanGetValue(value) : defaultValue; 68 } 69 70 double EwkWindowFeatures::getWindowFeatureDoubleValue(WKDictionaryRef windowFeatures, const char* featureName, double defaultValue) 71 { 72 WKDoubleRef value = static_cast<WKDoubleRef>(getWindowFeatureValue(windowFeatures, featureName)); 73 74 return value ? WKDoubleGetValue(value) : defaultValue; 71 75 } 72 76 … … 148 152 EWK_OBJ_GET_IMPL_OR_RETURN(const EwkWindowFeatures, window_features, impl); 149 153 154 const Evas_Coord_Rectangle& geometry = impl->geometry(); 150 155 if (x) 151 *x = static_cast<Evas_Coord>(impl->geometry().x());156 *x = geometry.x; 152 157 153 158 if (y) 154 *y = static_cast<Evas_Coord>(impl->geometry().y());159 *y = geometry.y; 155 160 156 161 if (width) 157 *width = static_cast<Evas_Coord>(impl->geometry().width());162 *width = geometry.w; 158 163 159 164 if (height) 160 *height = static_cast<Evas_Coord>(impl->geometry().height());165 *height = geometry.h; 161 166 } -
trunk/Source/WebKit2/UIProcess/API/efl/ewk_window_features_private.h
r140686 r141274 27 27 #define ewk_window_features_private_h 28 28 29 #include "EwkView.h"30 #include "ImmutableDictionary.h"31 #include "WindowFeatures.h"32 29 #include "ewk_object_private.h" 33 #include <WebCore/FloatRect.h> 30 #include <Evas.h> 31 #include <WebKit2/WKBase.h> 34 32 #include <wtf/RefCounted.h> 35 33 … … 40 38 EWK_OBJECT_DECLARE(EwkWindowFeatures) 41 39 42 static PassRefPtr<EwkWindowFeatures> create(W ebKit::ImmutableDictionary*windowFeatures, EwkView* viewImpl)40 static PassRefPtr<EwkWindowFeatures> create(WKDictionaryRef windowFeatures, EwkView* viewImpl) 43 41 { 44 42 return adoptRef(new EwkWindowFeatures(windowFeatures, viewImpl)); 45 43 } 46 44 47 WebCore::FloatRectgeometry() const { return m_geometry; }48 void setGeometry( WebCore::FloatRect& geometry) { m_geometry = geometry; }45 const Evas_Coord_Rectangle& geometry() const { return m_geometry; } 46 void setGeometry(const Evas_Coord_Rectangle& geometry) { m_geometry = geometry; } 49 47 50 48 bool toolbarVisible() const { return m_toolbarVisible; } … … 70 68 71 69 private: 72 EwkWindowFeatures(WebKit::ImmutableDictionary* windowFeatures, EwkView* viewImpl); 73 template <typename T1, typename T2> 74 static T1 getWindowFeatureValue(WebKit::ImmutableDictionary* windowFeatures, const String& featureName); 70 EwkWindowFeatures(WKDictionaryRef windowFeatures, EwkView* viewImpl); 71 72 static bool getWindowFeatureBoolValue(WKDictionaryRef windowFeatures, const char* featureName, bool defaultValue); 73 static double getWindowFeatureDoubleValue(WKDictionaryRef windowFeatures, const char* featureName, double defaultValue); 75 74 76 75 EwkView* m_view; 77 76 78 WebCore::FloatRectm_geometry;77 Evas_Coord_Rectangle m_geometry; 79 78 bool m_toolbarVisible; 80 79 bool m_statusBarVisible; -
trunk/Source/WebKit2/UIProcess/efl/PageUIClientEfl.cpp
r140686 r141274 208 208 { 209 209 RefPtr<EwkUrlRequest> request = EwkUrlRequest::create(wkRequest); 210 return toPageUIClientEfl(clientInfo)->m_view->createNewPage(request, toImpl(wkWindowFeatures));210 return toPageUIClientEfl(clientInfo)->m_view->createNewPage(request, wkWindowFeatures); 211 211 } 212 212
Note: See TracChangeset
for help on using the changeset viewer.