Changeset 164168 in webkit
- Timestamp:
- Feb 15, 2014 12:39:12 AM (10 years ago)
- Location:
- trunk
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/efl/ChangeLog
r164028 r164168 1 2014-02-15 Ryuan Choi <ryuan.choi@samsung.com> 2 3 [EFL][WK1] Do not include cairo header in the public headers 4 https://bugs.webkit.org/show_bug.cgi?id=128779 5 6 Reviewed by Gyuyoung Kim. 7 8 Although ewebkit used cairo internally, it's not good for EFL developers 9 to use it. 10 Indeed, almost APIs which returns cairo_surface are duplicated with other APIs 11 which returns evas_object. 12 13 * ewk/ewk_history.cpp: 14 Removed ewk_history_item_icon_surface_get. 15 ewk_history_item_icon_object_add will be used instead. 16 * ewk/ewk_history.h: 17 * ewk/ewk_settings.cpp: 18 Removed ewk_settings_icon_database_icon_surface_get. 19 ewk_settings_icon_database_icon_object_get will be used instead. 20 * ewk/ewk_settings.h: 21 * ewk/ewk_view.cpp: 22 (ewk_view_screenshot_contents_get): 23 Implemented to replace ewk_view_paint and ewk_view_paint_contents. 24 * ewk/ewk_view.h: 25 * tests/test_ewk_view.cpp: 26 (TEST_F): Added test case for ewk_view_screenshot_contents_get 27 1 28 2014-02-13 Ryuan Choi <ryuan.choi@samsung.com> 2 29 -
trunk/Source/WebKit/efl/ewk/ewk_history.cpp
r162919 r164168 327 327 } 328 328 329 cairo_surface_t* ewk_history_item_icon_surface_get(const Ewk_History_Item* item)330 {331 EWK_HISTORY_ITEM_CORE_GET_OR_RETURN(item, core, 0);332 333 RefPtr<cairo_surface_t> icon = WebCore::iconDatabase().synchronousNativeIconForPageURL(core->url(), WebCore::IntSize(16, 16));334 if (!icon)335 ERR("icon is NULL.");336 337 return icon.get();338 }339 340 329 Evas_Object* ewk_history_item_icon_object_add(const Ewk_History_Item* item, Evas* canvas) 341 330 { -
trunk/Source/WebKit/efl/ewk/ewk_history.h
r162919 r164168 24 24 #include <Eina.h> 25 25 #include <Evas.h> 26 #include <cairo.h>27 26 28 27 #ifdef __cplusplus … … 353 352 354 353 /** 355 * Get the icon (aka favicon) associated with this history item.356 *357 * @note in order to have this working, one must open icon database358 * with ewk_settings_icon_database_path_set().359 *360 * @param item history item to query.361 *362 * @return the surface reference or @c NULL on errors. Note that the363 * reference may be to a standard fallback icon.364 */365 EAPI cairo_surface_t *ewk_history_item_icon_surface_get(const Ewk_History_Item *item);366 367 /**368 354 * Add an Evas_Object of type 'image' to given canvas with history item icon. 369 355 * -
trunk/Source/WebKit/efl/ewk/ewk_settings.cpp
r164131 r164168 212 212 } 213 213 214 cairo_surface_t* ewk_settings_icon_database_icon_surface_get(const char* url)215 {216 EINA_SAFETY_ON_NULL_RETURN_VAL(url, 0);217 218 WebCore::URL kurl(WebCore::URL(), WTF::String::fromUTF8(url));219 RefPtr<cairo_surface_t> icon = WebCore::iconDatabase().synchronousNativeIconForPageURL(kurl.string(), WebCore::IntSize(16, 16));220 if (!icon)221 ERR("no icon for url %s", url);222 223 return icon.get();224 }225 226 214 Evas_Object* ewk_settings_icon_database_icon_object_get(const char* url, Evas* canvas) 227 215 { -
trunk/Source/WebKit/efl/ewk/ewk_settings.h
r149719 r164168 25 25 #include <Eina.h> 26 26 #include <Evas.h> 27 #include <cairo.h>28 27 29 28 #ifdef __cplusplus … … 160 159 */ 161 160 EAPI Eina_Bool ewk_settings_icon_database_clear(void); 162 163 /**164 * Queries icon for given URL, returning associated cairo surface.165 *166 * @note In order to have this working, one must open icon database167 * with ewk_settings_icon_database_path_set().168 *169 * @param url which url to query icon170 *171 * @return cairo surface if any, or @c NULL on failure172 */173 EAPI cairo_surface_t *ewk_settings_icon_database_icon_surface_get(const char *url);174 161 175 162 /** -
trunk/Source/WebKit/efl/ewk/ewk_view.cpp
r164028 r164168 2931 2931 } 2932 2932 2933 Eina_Bool ewk_view_paint(Ewk_View_Private_Data* priv, cairo_t* cr, const Eina_Rectangle* area)2934 {2935 EINA_SAFETY_ON_NULL_RETURN_VAL(priv, false);2936 EINA_SAFETY_ON_NULL_RETURN_VAL(cr, false);2937 EINA_SAFETY_ON_NULL_RETURN_VAL(area, false);2938 2939 WebCore::FrameView* view = priv->page->mainFrame().view();2940 EINA_SAFETY_ON_NULL_RETURN_VAL(view, false);2941 2942 view->updateLayoutAndStyleIfNeededRecursive();2943 2944 Ewk_Paint_Context* context = ewk_paint_context_new(cr);2945 bool result = ewk_view_paint(priv, context, area);2946 ewk_paint_context_free(context);2947 2948 return result;2949 }2950 2951 Eina_Bool ewk_view_paint_contents(Ewk_View_Private_Data* priv, cairo_t* cr, const Eina_Rectangle* area)2952 {2953 EINA_SAFETY_ON_NULL_RETURN_VAL(cr, false);2954 2955 Ewk_Paint_Context* context = ewk_paint_context_new(cr);2956 bool result = ewk_view_paint_contents(priv, context, area);2957 ewk_paint_context_free(context);2958 2959 return result;2960 }2961 2962 2933 /* internal methods ****************************************************/ 2963 2934 /** … … 4850 4821 } 4851 4822 4823 Evas_Object* ewk_view_screenshot_contents_get(const Evas_Object* ewkView, const Eina_Rectangle* area, float scale) 4824 { 4825 if (!area || !area->w || !area->h) { 4826 ERR("empty area is not allowed"); 4827 return 0; 4828 } 4829 4830 if (scale < std::numeric_limits<float>::epsilon()) { 4831 ERR("scale factor should be bigger than zero"); 4832 return 0; 4833 } 4834 4835 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0); 4836 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0); 4837 4838 Evas* canvas = evas_object_evas_get(ewkView); 4839 EINA_SAFETY_ON_NULL_RETURN_VAL(canvas, 0); 4840 4841 Evas_Object* screenshotImage = evas_object_image_add(canvas); 4842 int surfaceWidth = area->w * scale; 4843 int surfaceHeight = area->h * scale; 4844 evas_object_image_size_set(screenshotImage, surfaceWidth, surfaceHeight); 4845 evas_object_image_fill_set(screenshotImage, 0, 0, surfaceWidth, surfaceHeight); 4846 evas_object_resize(screenshotImage, surfaceWidth, surfaceHeight); 4847 evas_object_image_colorspace_set(screenshotImage, EVAS_COLORSPACE_ARGB8888); 4848 evas_object_image_smooth_scale_set(screenshotImage, true); 4849 4850 Ewk_Paint_Context* context = ewk_paint_context_from_image_new(screenshotImage); 4851 ewk_paint_context_save(context); 4852 ewk_paint_context_scale(context, scale, scale); 4853 ewk_paint_context_translate(context, -1 * area->x, -1 * area->y); 4854 4855 ewk_view_paint(priv, context, area); 4856 4857 ewk_paint_context_restore(context); 4858 ewk_paint_context_free(context); 4859 4860 return screenshotImage; 4861 } 4862 4852 4863 Eina_Bool ewk_view_setting_tiled_backing_store_enabled_set(Evas_Object* ewkView, Eina_Bool enable) 4853 4864 { -
trunk/Source/WebKit/efl/ewk/ewk_view.h
r164028 r164168 123 123 124 124 #include <Evas.h> 125 #include <cairo.h>126 125 127 126 #ifdef __cplusplus … … 2053 2052 2054 2053 /** 2055 * Paints using given graphics context the given area.2056 *2057 * This uses viewport relative area and will also handle scrollbars2058 * and other extra elements. See ewk_view_paint_contents() for the2059 * alternative function.2060 *2061 * @param priv the pointer to the private data of the view to use as paint source2062 * @param cr the cairo context to use as paint destination, its state will2063 * be saved before operation and restored afterwards2064 * @param area viewport relative geometry to paint2065 *2066 * @return @c EINA_TRUE on success or @c EINA_FALSE on failure2067 *2068 * @note This is an easy to use version, but internal structures are2069 * always created, then graphics context is clipped, then2070 * painted, restored and destroyed. This might not be optimum,2071 * so using @a Ewk_View_Paint_Context may be a better solutions2072 * for large number of operations.2073 *2074 * @see ewk_view_paint_contents()2075 * @see ewk_view_paint_context_paint()2076 *2077 * @note This is not for general use but just for subclasses that want2078 * to define their own backing store.2079 */2080 EAPI Eina_Bool ewk_view_paint(Ewk_View_Private_Data *priv, cairo_t *cr, const Eina_Rectangle *area);2081 2082 /**2083 * Paints just contents using given graphics context the given area.2084 *2085 * This uses absolute coordinates for area and will just handle2086 * contents, no scrollbars or extras. See ewk_view_paint() for the2087 * alternative solution.2088 *2089 * @param priv the pointer to the private data of the view to use as paint source2090 * @param cr the cairo context to use as paint destination, its state will2091 * be saved before operation and restored afterwards2092 * @param area absolute geometry to paint2093 *2094 * @return @c EINA_TRUE on success or @c EINA_FALSE on failure2095 *2096 * @note This is an easy to use version, but internal structures are2097 * always created, then graphics context is clipped, then2098 * painted, restored and destroyed. This might not be optimum,2099 * so using @a Ewk_View_Paint_Context may be a better solutions2100 * for large number of operations.2101 *2102 * @see ewk_view_paint()2103 * @see ewk_view_paint_context_paint_contents()2104 *2105 * @note This is not for general use but just for subclasses that want2106 * to define their own backing store.2107 */2108 EAPI Eina_Bool ewk_view_paint_contents(Ewk_View_Private_Data *priv, cairo_t *cr, const Eina_Rectangle *area);2109 2110 /**2111 2054 * Gets the attributes of the viewport meta tag. 2112 2055 * … … 2543 2486 EAPI Ewk_Context_Menu *ewk_view_context_menu_get(const Evas_Object *o); 2544 2487 2488 /** 2489 * Gets the image object of the specified area of the page 2490 * 2491 * The returned image object @b should be freed after use. 2492 * 2493 * @param o view object to be captured 2494 * @param area The area of the page will be captured. 2495 * @param scale scale factor of captured object. 2496 * 2497 * @return newly allocated image object on sucess or @c NULL on failure. 2498 */ 2499 EAPI Evas_Object *ewk_view_screenshot_contents_get(const Evas_Object *o, const Eina_Rectangle *area, float scale); 2500 2545 2501 #ifdef __cplusplus 2546 2502 } -
trunk/Source/WebKit/efl/tests/test_ewk_view.cpp
r161331 r164168 126 126 ASSERT_TRUE(ewk_view_context_menu_get(webView())); 127 127 } 128 129 TEST_F(EWKTestBase, ewk_view_screenshot_contents_get) 130 { 131 loadUrl(); 132 133 Evas_Coord width, height; 134 135 float scale = 2; 136 Eina_Rectangle area; 137 area.x = 10; 138 area.y = 10; 139 area.w = 20; 140 area.h = 30; 141 Evas_Object* screenshot = ewk_view_screenshot_contents_get(webView(), &area, scale); 142 evas_object_geometry_get(screenshot, 0, 0, &width, &height); 143 ASSERT_EQ(area.w * scale, width); 144 ASSERT_EQ(area.h * scale, height); 145 evas_object_del(screenshot); 146 147 screenshot = ewk_view_screenshot_contents_get(webView(), &area, 0); 148 ASSERT_FALSE(screenshot); 149 150 screenshot = ewk_view_screenshot_contents_get(webView(), 0, 1); 151 ASSERT_FALSE(screenshot); 152 153 area.w = 0; 154 area.h = 0; 155 screenshot = ewk_view_screenshot_contents_get(webView(), &area, scale); 156 ASSERT_FALSE(screenshot); 157 } -
trunk/Tools/ChangeLog
r164165 r164168 1 2014-02-15 Ryuan Choi <ryuan.choi@samsung.com> 2 3 [EFL][WK1] Do not include cairo header in the public headers 4 https://bugs.webkit.org/show_bug.cgi?id=128779 5 6 Reviewed by Gyuyoung Kim. 7 8 * DumpRenderTree/PlatformEfl.cmake: 9 * DumpRenderTree/efl/PixelDumpSupportEfl.cpp: 10 (createBitmapContextFromWebView): 11 Used ewk_view_screenshot_contents_get instead of ewk_view_paint. 12 * EWebLauncher/main.c: 13 (print_history): Replaced ewk_history_item_icon_surface_get to ewk_history_item_icon_object_add 14 (on_key_down): 15 * Scripts/webkitpy/style/checker.py: 16 Added -runtime/ctype_function for EWebLauncher because EWebLauncher is sample 17 and it does not use WTF. 18 1 19 2014-02-15 Samuel White <samuel_white@apple.com> 2 20 -
trunk/Tools/DumpRenderTree/PlatformEfl.cmake
r162060 r164168 47 47 ${WEBCORE_DIR}/platform/graphics/cairo 48 48 ${WEBCORE_DIR}/platform/network/soup 49 ${WTF_DIR}/wtf/efl 49 50 ${TOOLS_DIR}/DumpRenderTree/atk 50 51 ${TOOLS_DIR}/DumpRenderTree/cairo -
trunk/Tools/DumpRenderTree/efl/PixelDumpSupportEfl.cpp
r135118 r164168 38 38 #include "PixelDumpSupportCairo.h" 39 39 #include "RefPtrCairo.h" 40 #include "RefPtrEfl.h" 40 41 #include "WebCoreSupport/DumpRenderTreeSupportEfl.h" 41 42 #include "ewk_view.h" … … 54 55 RefPtr<cairo_t> context = adoptRef(cairo_create(surface.get())); 55 56 56 if (!ewk_view_paint(privateData, context.get(), &rect)) 57 RefPtr<Evas_Object> screenshot = ewk_view_screenshot_contents_get(browser->mainView(), &rect, 1); 58 if (!screenshot) 57 59 return 0; 60 61 uint8_t* pixels = static_cast<uint8_t*>(evas_object_image_data_get(screenshot.get(), false)); 62 RefPtr<cairo_surface_t> sourceSurface = adoptRef(cairo_image_surface_create_for_data(pixels, CAIRO_FORMAT_ARGB32, rect.w, rect.h, rect.w * 4)); 63 cairo_set_source_surface(context.get(), sourceSurface.get(), 0, 0); 58 64 59 65 if (DumpRenderTreeSupportEfl::isTrackingRepaints(mainFrame)) { -
trunk/Tools/EWebLauncher/main.c
r163079 r164168 2 2 * Copyright (C) 2008 INdT - Instituto Nokia de Tecnologia 3 3 * Copyright (C) 2009, 2010 ProFUSION embedded systems 4 * Copyright (C) 2009 , 2010, 2011Samsung Electronics4 * Copyright (C) 2009-2014 Samsung Electronics 5 5 * Copyright (C) 2012 Intel Corporation 6 6 * … … 98 98 "(C)2008 INdT (The Nokia Technology Institute)\n" 99 99 "(C)2009, 2010 ProFUSION embedded systems\n" 100 "(C)2009 , 2010, 2011Samsung Electronics\n"100 "(C)2009-2014 Samsung Electronics\n" 101 101 "(C)2012 Intel Corporation\n", 102 102 "GPL", … … 183 183 184 184 static void 185 print_history(Eina_List *list )185 print_history(Eina_List *list, Evas *e) 186 186 { 187 187 Eina_List *l; … … 189 189 190 190 if (!verbose) 191 return;191 return; 192 192 193 193 printf("Session history contains:\n"); 194 194 195 195 EINA_LIST_FOREACH(list, l, d) { 196 Ewk_History_Item *item = (Ewk_History_Item*)d; 197 cairo_surface_t *cs = ewk_history_item_icon_surface_get(item); 198 char buf[PATH_MAX]; 199 int s = snprintf(buf, sizeof(buf), "/tmp/favicon-%s.png", ewk_history_item_uri_original_get(item)); 200 for (s--; s >= (int)sizeof("/tmp/favicon-"); s--) { 201 if (!isalnum(buf[s]) && buf[s] != '.') 202 buf[s] = '_'; 203 } 204 cs = ewk_history_item_icon_surface_get(item); 205 206 if (cs && cairo_surface_status(cs) == CAIRO_STATUS_SUCCESS) 207 cairo_surface_write_to_png(cs, buf); 208 else 209 buf[0] = '\0'; 210 211 printf("* '%s' title='%s' icon='%s'\n", 212 ewk_history_item_uri_original_get(item), 213 ewk_history_item_title_get(item), buf); 196 Ewk_History_Item *item = (Ewk_History_Item*)d; 197 Evas_Object *icon = ewk_history_item_icon_object_add(item, e); 198 char buf[PATH_MAX]; 199 int s = snprintf(buf, sizeof(buf), "/tmp/favicon-%s.png", ewk_history_item_uri_original_get(item)); 200 for (s--; s >= (int)sizeof("/tmp/favicon-"); s--) { 201 if (!isalnum(buf[s]) && buf[s] != '.') 202 buf[s] = '_'; 203 } 204 205 evas_object_image_save(icon, buf, NULL, NULL); 206 207 printf("* '%s' title='%s' icon='%s'\n", ewk_history_item_uri_original_get(item), ewk_history_item_title_get(item), buf); 214 208 } 215 209 } … … 500 494 Ewk_History *history = ewk_view_history_get(obj); 501 495 Eina_List *list = ewk_history_back_list_get(history); 502 print_history(list );496 print_history(list, e); 503 497 ewk_history_item_list_free(list); 504 498 ewk_view_back(obj); … … 510 504 Ewk_History *history = ewk_view_history_get(obj); 511 505 Eina_List *list = ewk_history_forward_list_get(history); 512 print_history(list );506 print_history(list, e); 513 507 ewk_history_item_list_free(list); 514 508 ewk_view_forward(obj); -
trunk/Tools/Scripts/webkitpy/style/checker.py
r161366 r164168 205 205 ["-readability/naming", 206 206 "-readability/parameter_name", 207 "-runtime/ctype_function", 207 208 "-whitespace/declaration", 208 209 "-build/include_order"]),
Note: See TracChangeset
for help on using the changeset viewer.