Changeset 120369 in webkit
- Timestamp:
- Jun 14, 2012 4:09:44 PM (12 years ago)
- Location:
- trunk/Source
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r120367 r120369 1 2012-06-14 Ryuan Choi <ryuan.choi@samsung.com> 2 3 [EFL] Move cursor related code from WidgetEfl to ewk_view and EflScreenUtilities. 4 https://bugs.webkit.org/show_bug.cgi?id=88803 5 6 Reviewed by Chang Shu. 7 8 Because WebProcess can not control cursor, 9 setCursor should be passed to ChromeClient like other ports. 10 11 * platform/Widget.h: 12 (Widget): 13 * platform/efl/EflScreenUtilities.cpp: 14 (WebCore::applyFallbackCursor): Moved from WidgetEfl.cpp. 15 (WebCore): 16 (WebCore::isUsingEcoreX): Moved from WidgetEfl.cpp. 17 * platform/efl/EflScreenUtilities.h: 18 (WebCore): 19 * platform/efl/WidgetEfl.cpp: Removes cursor related codes. 20 (WebCore::WidgetPrivate::WidgetPrivate): 21 (WebCore::Widget::~Widget): 22 (WebCore::Widget::setCursor): Redirect to HostWindow. 23 (WebCore::Widget::setEvasObject): 24 1 25 2012-06-14 Ryosuke Niwa <rniwa@webkit.org> 2 26 -
trunk/Source/WebCore/platform/Widget.h
r114367 r120369 272 272 IntRect m_frame; // Not used when a native widget exists. 273 273 274 #if PLATFORM(EFL)275 // FIXME: Please see the previous #if PLATFORM(EFL) block.276 Ecore_Evas* ecoreEvas() const;277 278 void applyFallbackCursor();279 void applyCursor();280 #endif281 282 274 #if PLATFORM(MAC) || PLATFORM(EFL) 283 275 WidgetPrivate* m_data; -
trunk/Source/WebCore/platform/efl/EflScreenUtilities.cpp
r119958 r120369 1 1 /* 2 * Copyright (C) 201 1Samsung Electronics2 * Copyright (C) 2012 Samsung Electronics 3 3 * 4 4 * This library is free software; you can redistribute it and/or … … 21 21 22 22 #ifdef HAVE_ECORE_X 23 #include <Ecore_Evas.h> 23 24 #include <Ecore_X.h> 24 25 #include <wtf/HashMap.h> … … 103 104 #endif 104 105 106 void applyFallbackCursor(Ecore_Evas* ecoreEvas, const char* cursorString) 107 { 108 #ifdef HAVE_ECORE_X 109 int shape = getEcoreCursor(cursorString); 110 if (shape < ECORE_X_CURSOR_X || shape > ECORE_X_CURSOR_XTERM) { 111 LOG_ERROR("cannot map an equivalent X cursor for" 112 " c ursor group %s", cursorString); 113 shape = ECORE_X_CURSOR_LEFT_PTR; 114 } 115 Ecore_X_Window window = ecore_evas_software_x11_window_get(ecoreEvas); 116 Ecore_X_Cursor cursor = ecore_x_cursor_shape_get(shape); 117 ecore_x_window_cursor_set(window, cursor); 118 #endif 119 } 120 105 121 int getDPI() 106 122 { … … 112 128 } 113 129 130 bool isUsingEcoreX(const Evas* evas) 131 { 132 #ifdef HAVE_ECORE_X 133 Ecore_Evas* ecoreEvas = ecore_evas_ecore_evas_get(evas); 134 const char* engine = ecore_evas_engine_name_get(ecoreEvas); 135 return !strcmp(engine, "software_x11") 136 || !strcmp(engine, "software_xcb") 137 || !strcmp(engine, "software_16_x11") 138 || !strncmp(engine, "xrender", sizeof("xrender") - 1); 139 #else 140 return false; 141 #endif 142 } 143 114 144 } // namespace WebCore -
trunk/Source/WebCore/platform/efl/EflScreenUtilities.h
r119958 r120369 1 1 /* 2 * Copyright (C) 201 1Samsung Electronics2 * Copyright (C) 2012 Samsung Electronics 3 3 * 4 4 * This library is free software; you can redistribute it and/or … … 22 22 #include <wtf/text/WTFString.h> 23 23 24 typedef struct _Evas Evas; 25 24 26 namespace WebCore { 25 27 26 #ifdef HAVE_ECORE_X 27 int getEcoreCursor(const String& cursorString); 28 #endif 29 28 void applyFallbackCursor(Ecore_Evas*, const char*); 30 29 int getDPI(); 30 bool isUsingEcoreX(const Evas*); 31 31 32 32 } // namespace WebCore -
trunk/Source/WebCore/platform/efl/WidgetEfl.cpp
r119958 r120369 4 4 * Copyright (C) 2008 Kenneth Rohde Christiansen 5 5 * Copyright (C) 2009-2010 ProFUSION embedded systems 6 * Copyright (C) 2009-201 0Samsung Electronics6 * Copyright (C) 2009-2012 Samsung Electronics 7 7 * All rights reserved. 8 8 * … … 44 44 45 45 #include <Ecore.h> 46 #include <Ecore_Evas.h>47 #include <Edje.h>48 46 #include <Evas.h> 49 50 #ifdef HAVE_ECORE_X51 #include <Ecore_X.h>52 #endif53 47 54 48 namespace WebCore { … … 63 57 : m_evas(0) 64 58 , m_evasObject(0) 65 , m_cursorObject(0)66 #ifdef HAVE_ECORE_X67 , m_isUsingEcoreX(false)68 #endif69 59 { } 70 71 /* cursor */72 String m_cursorGroup;73 Evas_Object* m_cursorObject;74 75 #ifdef HAVE_ECORE_X76 bool m_isUsingEcoreX;77 #endif78 60 }; 79 61 … … 92 74 { 93 75 ASSERT(!parent()); 94 95 if (m_data->m_cursorObject)96 evas_object_del(m_data->m_cursorObject);97 76 98 77 delete m_data; … … 133 112 } 134 113 135 void Widget::applyFallbackCursor()136 {137 #ifdef HAVE_ECORE_X138 if (m_data->m_isUsingEcoreX && !m_data->m_cursorGroup.isNull()) {139 int shape = getEcoreCursor(m_data->m_cursorGroup);140 141 if (shape < ECORE_X_CURSOR_X || shape > ECORE_X_CURSOR_XTERM) {142 LOG_ERROR("cannot map an equivalent X cursor for"143 " c ursor group %s", m_data->m_cursorGroup.utf8().data());144 shape = ECORE_X_CURSOR_LEFT_PTR;145 }146 147 Ecore_X_Window win = ecore_evas_software_x11_window_get(ecoreEvas());148 Ecore_X_Cursor cur = ecore_x_cursor_shape_get(shape);149 ecore_x_window_cursor_set(win, cur);150 return;151 }152 #endif153 }154 155 void Widget::applyCursor()156 {157 CString file = edjeThemeRecursive().utf8();158 159 m_data->m_cursorObject = edje_object_add(evas());160 if (!file.isNull() && !edje_object_file_set(m_data->m_cursorObject, file.data(), m_data->m_cursorGroup.utf8().data())) {161 evas_object_del(m_data->m_cursorObject);162 m_data->m_cursorObject = 0;163 ecore_evas_object_cursor_set(ecoreEvas(), 0, 0, 0, 0);164 applyFallbackCursor();165 } else {166 Evas_Coord x, y, w, h;167 const char *d;168 169 edje_object_size_min_get(m_data->m_cursorObject, &w, &h);170 if ((w <= 0) || (h <= 0))171 edje_object_size_min_calc(m_data->m_cursorObject, &w, &h);172 if ((w <= 0) || (h <= 0))173 w = h = 16;174 evas_object_resize(m_data->m_cursorObject, w, h);175 176 d = edje_object_data_get(m_data->m_cursorObject, "hot.x");177 x = d ? atoi(d) : 0;178 179 d = edje_object_data_get(m_data->m_cursorObject, "hot.y");180 y = d ? atoi(d) : 0;181 182 ecore_evas_object_cursor_set(ecoreEvas(), m_data->m_cursorObject,183 EVAS_LAYER_MAX, x, y);184 }185 }186 187 114 void Widget::setCursor(const Cursor& cursor) 188 115 { 189 if (!evas()) 190 return; 191 192 const char* group = cursor.platformCursor(); 193 if (!group || String(group) == m_data->m_cursorGroup) 116 ScrollView* view = root(); 117 if (!view) 194 118 return; 195 196 m_data->m_cursorGroup = group; 197 198 applyCursor(); 119 view->hostWindow()->setCursor(cursor); 199 120 } 200 121 … … 253 174 } 254 175 255 Ecore_Evas* Widget::ecoreEvas() const256 {257 // FIXME EFL: XXX assume evas was created by ecore_evas258 return static_cast<Ecore_Evas*>(evas_data_attach_get(evas()));259 }260 261 176 void Widget::setEvasObject(Evas_Object *object) 262 177 { … … 268 183 if (!object) { 269 184 m_data->m_evas = 0; 270 #ifdef HAVE_ECORE_X271 m_data->m_isUsingEcoreX = false;272 #endif273 185 return; 274 186 } 275 187 276 188 m_data->m_evas = evas_object_evas_get(object); 277 278 #ifdef HAVE_ECORE_X279 const char *engine = ecore_evas_engine_name_get(ecoreEvas());280 m_data->m_isUsingEcoreX = (!strcmp(engine, "software_x11")281 || !strcmp(engine, "software_xcb")282 || !strcmp(engine, "software_16_x11")283 || !strncmp(engine, "xrender", sizeof("xrender") - 1));284 #endif285 189 286 190 Widget::frameRectsChanged(); -
trunk/Source/WebKit/efl/ChangeLog
r120294 r120369 1 2012-06-14 Ryuan Choi <ryuan.choi@samsung.com> 2 3 [EFL] Move cursor related code from WidgetEfl to ewk_view and EflScreenUtilities. 4 https://bugs.webkit.org/show_bug.cgi?id=88803 5 6 Reviewed by Chang Shu. 7 8 Because WebProcess can not control cursor, 9 setCursor should be passed to ChromeClient like other ports. 10 11 * WebCoreSupport/ChromeClientEfl.cpp: 12 (WebCore::ChromeClientEfl::setCursor): 13 * ewk/ewk_view.cpp: 14 (_Ewk_View_Private_Data): 15 (_ewk_view_priv_new): Check whether ecore_x can be used. 16 (_ewk_view_priv_del): 17 (_ewk_view_smart_add): 18 Change order of initialization to use base structure in _ewk_view_priv_new. 19 (ewk_view_cursor_set): Moved from Widget::applyCursor. 20 * ewk/ewk_view_private.h: 21 (WebCore): 22 1 23 2012-06-14 Sudarsana Nagineni <sudarsana.nagineni@linux.intel.com> 2 24 -
trunk/Source/WebKit/efl/WebCoreSupport/ChromeClientEfl.cpp
r119482 r120369 5 5 * Copyright (C) 2008 Diego Gonzalez 6 6 * Copyright (C) 2009-2010 ProFUSION embedded systems 7 * Copyright (C) 2009-201 0Samsung Electronics7 * Copyright (C) 2009-2012 Samsung Electronics 8 8 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 9 9 * … … 500 500 } 501 501 502 void ChromeClientEfl::setCursor(const Cursor& )503 { 504 notImplemented();502 void ChromeClientEfl::setCursor(const Cursor& cursor) 503 { 504 ewk_view_cursor_set(m_view, cursor); 505 505 } 506 506 -
trunk/Source/WebKit/efl/ewk/ewk_view.cpp
r119527 r120369 67 67 #include "ewk_window_features_private.h" 68 68 #include <Ecore.h> 69 #include <Ecore_Evas.h> 70 #include <Edje.h> 69 71 #include <Eina.h> 70 72 #include <Evas.h> … … 341 343 } animatedZoom; 342 344 SoupSession* soupSession; 345 const char* cursorGroup; 346 Evas_Object* cursorObject; 347 #ifdef HAVE_ECORE_X 348 bool isUsingEcoreX; 349 #endif 343 350 }; 344 351 … … 858 865 priv->pageClient = adoptPtr(new PageClientEfl(smartData->self)); 859 866 867 #ifdef HAVE_ECORE_X 868 priv->isUsingEcoreX = WebCore::isUsingEcoreX(smartData->base.evas); 869 #endif 870 860 871 return priv; 861 872 } … … 888 899 ewk_history_free(priv->history); 889 900 901 if (priv->cursorObject) 902 evas_object_del(priv->cursorObject); 903 890 904 delete priv; 891 905 } … … 914 928 915 929 smartData->self = ewkView; 930 smartData->api = api; 931 932 _parent_sc.add(ewkView); 933 916 934 smartData->_priv = _ewk_view_priv_new(smartData); 917 smartData->api = api;918 919 _parent_sc.add(ewkView);920 921 935 if (!smartData->_priv) 922 936 return; … … 4369 4383 } 4370 4384 4385 void ewk_view_cursor_set(Evas_Object* ewkView, const WebCore::Cursor& cursor) 4386 { 4387 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); 4388 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); 4389 4390 const char* group = cursor.platformCursor(); 4391 if (!group || group == priv->cursorGroup) 4392 return; 4393 4394 priv->cursorGroup = group; 4395 4396 if (priv->cursorObject) 4397 evas_object_del(priv->cursorObject); 4398 priv->cursorObject = edje_object_add(smartData->base.evas); 4399 4400 Ecore_Evas* ecoreEvas = ecore_evas_ecore_evas_get(smartData->base.evas); 4401 if (!priv->settings.theme || !edje_object_file_set(priv->cursorObject, priv->settings.theme, group)) { 4402 evas_object_del(priv->cursorObject); 4403 priv->cursorObject = 0; 4404 4405 ecore_evas_object_cursor_set(ecoreEvas, 0, 0, 0, 0); 4406 #ifdef HAVE_ECORE_X 4407 if (priv->isUsingEcoreX) 4408 WebCore::applyFallbackCursor(ecoreEvas, group); 4409 #endif 4410 } else { 4411 Evas_Coord width, height; 4412 edje_object_size_min_get(priv->cursorObject, &width, &height); 4413 if (width <= 0 || height <= 0) 4414 edje_object_size_min_calc(priv->cursorObject, &width, &height); 4415 if (width <= 0 || height <= 0) { 4416 width = 16; 4417 height = 16; 4418 } 4419 evas_object_resize(priv->cursorObject, width, height); 4420 4421 const char* data; 4422 int hotspotX = 0; 4423 data = edje_object_data_get(priv->cursorObject, "hot.x"); 4424 if (data) 4425 hotspotX = atoi(data); 4426 4427 int hotspotY = 0; 4428 data = edje_object_data_get(priv->cursorObject, "hot.y"); 4429 if (data) 4430 hotspotY = atoi(data); 4431 4432 ecore_evas_object_cursor_set(ecoreEvas, priv->cursorObject, EVAS_LAYER_MAX, hotspotX, hotspotY); 4433 } 4434 } 4435 4371 4436 namespace EWKPrivate { 4372 4437 -
trunk/Source/WebKit/efl/ewk/ewk_view_private.h
r119374 r120369 35 35 #endif 36 36 37 class Cursor; 37 38 class PopupMenuClient; 38 39 } … … 49 50 } 50 51 52 void ewk_view_cursor_set(Evas_Object* ewkView, const WebCore::Cursor& cursor); 51 53 void ewk_view_ready(Evas_Object* ewkView); 52 54 void ewk_view_input_method_state_set(Evas_Object* ewkView, bool active);
Note: See TracChangeset
for help on using the changeset viewer.