Changeset 121890 in webkit
- Timestamp:
- Jul 5, 2012 1:14:58 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r121889 r121890 1 2012-07-05 Christophe Dumez <christophe.dumez@intel.com> 2 3 [WK2][EFL] Ewk_View needs API to load HTML data 4 https://bugs.webkit.org/show_bug.cgi?id=90540 5 6 Reviewed by Kenneth Rohde Christiansen. 7 8 Add method to Ewk_View to load provided HTML data. 9 This is used for e.g. when an URL cannot be reached 10 and we need to display an error page. 11 12 * UIProcess/API/efl/ewk_view.cpp: 13 (ewk_view_html_load): 14 * UIProcess/API/efl/ewk_view.h: 15 1 16 2012-07-05 Christophe Dumez <christophe.dumez@intel.com> 2 17 -
trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp
r121889 r121890 706 706 } 707 707 708 Eina_Bool ewk_view_html_string_load(Evas_Object* ewkView, const char* html, const char* baseUrl, const char* unreachableUrl) 709 { 710 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); 711 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); 712 EINA_SAFETY_ON_NULL_RETURN_VAL(html, false); 713 714 if (unreachableUrl && *unreachableUrl) 715 priv->pageClient->page()->loadAlternateHTMLString(String::fromUTF8(html), baseUrl ? String::fromUTF8(baseUrl) : "", String::fromUTF8(unreachableUrl)); 716 else 717 priv->pageClient->page()->loadHTMLString(String::fromUTF8(html), baseUrl ? String::fromUTF8(baseUrl) : ""); 718 719 return true; 720 } 708 721 709 722 #if ENABLE(WEB_INTENTS_TAG) -
trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.h
r121889 r121890 284 284 EAPI double ewk_view_load_progress_get(const Evas_Object *o); 285 285 286 /** 287 * Loads the specified @a html string as the content of the view. 288 * 289 * External objects such as stylesheets or images referenced in the HTML 290 * document are located relative to @a baseUrl. 291 * 292 * If an @a unreachableUrl is passed it is used as the url for the loaded 293 * content. This is typically used to display error pages for a failed 294 * load. 295 * 296 * @param o view object to load the HTML into 297 * @param html HTML data to load 298 * @param baseUrl Base URL used for relative paths to external objects (optional) 299 * @param unreachableUrl URL that could not be reached (optional) 300 * 301 * @return @c EINA_TRUE if it the HTML was successfully loaded, @c EINA_FALSE otherwise 302 */ 303 EAPI Eina_Bool ewk_view_html_string_load(Evas_Object *o, const char *html, const char *baseUrl, const char *unreachableUrl); 304 286 305 #ifdef __cplusplus 287 306 } -
trunk/Tools/ChangeLog
r121886 r121890 1 2012-07-05 Christophe Dumez <christophe.dumez@intel.com> 2 3 [WK2][EFL] Ewk_View needs API to load HTML data 4 https://bugs.webkit.org/show_bug.cgi?id=90540 5 6 Reviewed by Kenneth Rohde Christiansen. 7 8 Update EFL MiniBrowser to catch the "load,error" signal 9 on the view and display an error page. 10 11 * MiniBrowser/efl/main.c: 12 (on_error): 13 (browserCreate): 14 1 15 2012-07-05 Sergio Villar Senin <svillar@igalia.com> 2 16 -
trunk/Tools/MiniBrowser/efl/main.c
r121830 r121890 126 126 } 127 127 128 static void 129 on_error(void *user_data, Evas_Object *webview, void *event_info) 130 { 131 Eina_Strbuf* buffer; 132 const Ewk_Web_Error *error = (const Ewk_Web_Error *)event_info; 133 134 buffer = eina_strbuf_new(); 135 eina_strbuf_append_printf(buffer, "<html><body><div style=\"color:#ff0000\">ERROR!</div><br><div>Code: %d<br>Description: %s<br>URL: %s</div></body</html>", 136 ewk_web_error_code_get(error), ewk_web_error_description_get(error), ewk_web_error_url_get(error)); 137 138 ewk_view_html_string_load(webview, eina_strbuf_string_get(buffer), 0, ewk_web_error_url_get(error)); 139 eina_strbuf_free(buffer); 140 } 141 128 142 static MiniBrowser *browserCreate(const char *url) 129 143 { … … 152 166 evas_object_name_set(app->browser, "browser"); 153 167 168 evas_object_smart_callback_add(app->browser, "load,error", on_error, app); 154 169 evas_object_smart_callback_add(app->browser, "load,progress", on_progress, app); 155 170 evas_object_smart_callback_add(app->browser, "title,changed", on_title_changed, app);
Note: See TracChangeset
for help on using the changeset viewer.