- Revision
- 121890
- Author
- commit-qu...@webkit.org
- Date
- 2012-07-05 01:14:58 -0700 (Thu, 05 Jul 2012)
Log Message
[WK2][EFL] Ewk_View needs API to load HTML data
https://bugs.webkit.org/show_bug.cgi?id=90540
Patch by Christophe Dumez <christophe.du...@intel.com> on 2012-07-05
Reviewed by Kenneth Rohde Christiansen.
Source/WebKit2:
Add method to Ewk_View to load provided HTML data.
This is used for e.g. when an URL cannot be reached
and we need to display an error page.
* UIProcess/API/efl/ewk_view.cpp:
(ewk_view_html_load):
* UIProcess/API/efl/ewk_view.h:
Tools:
Update EFL MiniBrowser to catch the "load,error" signal
on the view and display an error page.
* MiniBrowser/efl/main.c:
(on_error):
(browserCreate):
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (121889 => 121890)
--- trunk/Source/WebKit2/ChangeLog 2012-07-05 07:59:25 UTC (rev 121889)
+++ trunk/Source/WebKit2/ChangeLog 2012-07-05 08:14:58 UTC (rev 121890)
@@ -1,5 +1,20 @@
2012-07-05 Christophe Dumez <christophe.du...@intel.com>
+ [WK2][EFL] Ewk_View needs API to load HTML data
+ https://bugs.webkit.org/show_bug.cgi?id=90540
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Add method to Ewk_View to load provided HTML data.
+ This is used for e.g. when an URL cannot be reached
+ and we need to display an error page.
+
+ * UIProcess/API/efl/ewk_view.cpp:
+ (ewk_view_html_load):
+ * UIProcess/API/efl/ewk_view.h:
+
+2012-07-05 Christophe Dumez <christophe.du...@intel.com>
+
[WK2][EFL] Ewk_View needs to report new resource requests
https://bugs.webkit.org/show_bug.cgi?id=90577
Modified: trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp (121889 => 121890)
--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp 2012-07-05 07:59:25 UTC (rev 121889)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp 2012-07-05 08:14:58 UTC (rev 121890)
@@ -705,7 +705,20 @@
evas_object_smart_callback_call(ewkView, "load,error", const_cast<Ewk_Web_Error*>(error));
}
+Eina_Bool ewk_view_html_string_load(Evas_Object* ewkView, const char* html, const char* baseUrl, const char* unreachableUrl)
+{
+ EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
+ EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(html, false);
+ if (unreachableUrl && *unreachableUrl)
+ priv->pageClient->page()->loadAlternateHTMLString(String::fromUTF8(html), baseUrl ? String::fromUTF8(baseUrl) : "", String::fromUTF8(unreachableUrl));
+ else
+ priv->pageClient->page()->loadHTMLString(String::fromUTF8(html), baseUrl ? String::fromUTF8(baseUrl) : "");
+
+ return true;
+}
+
#if ENABLE(WEB_INTENTS_TAG)
/**
* @internal
Modified: trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.h (121889 => 121890)
--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.h 2012-07-05 07:59:25 UTC (rev 121889)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.h 2012-07-05 08:14:58 UTC (rev 121890)
@@ -283,6 +283,25 @@
*/
EAPI double ewk_view_load_progress_get(const Evas_Object *o);
+/**
+ * Loads the specified @a html string as the content of the view.
+ *
+ * External objects such as stylesheets or images referenced in the HTML
+ * document are located relative to @a baseUrl.
+ *
+ * If an @a unreachableUrl is passed it is used as the url for the loaded
+ * content. This is typically used to display error pages for a failed
+ * load.
+ *
+ * @param o view object to load the HTML into
+ * @param html HTML data to load
+ * @param baseUrl Base URL used for relative paths to external objects (optional)
+ * @param unreachableUrl URL that could not be reached (optional)
+ *
+ * @return @c EINA_TRUE if it the HTML was successfully loaded, @c EINA_FALSE otherwise
+ */
+EAPI Eina_Bool ewk_view_html_string_load(Evas_Object *o, const char *html, const char *baseUrl, const char *unreachableUrl);
+
#ifdef __cplusplus
}
#endif
Modified: trunk/Tools/ChangeLog (121889 => 121890)
--- trunk/Tools/ChangeLog 2012-07-05 07:59:25 UTC (rev 121889)
+++ trunk/Tools/ChangeLog 2012-07-05 08:14:58 UTC (rev 121890)
@@ -1,3 +1,17 @@
+2012-07-05 Christophe Dumez <christophe.du...@intel.com>
+
+ [WK2][EFL] Ewk_View needs API to load HTML data
+ https://bugs.webkit.org/show_bug.cgi?id=90540
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Update EFL MiniBrowser to catch the "load,error" signal
+ on the view and display an error page.
+
+ * MiniBrowser/efl/main.c:
+ (on_error):
+ (browserCreate):
+
2012-07-05 Sergio Villar Senin <svil...@igalia.com>
Hidden dirs are not copied when creating the built product archive
Modified: trunk/Tools/MiniBrowser/efl/main.c (121889 => 121890)
--- trunk/Tools/MiniBrowser/efl/main.c 2012-07-05 07:59:25 UTC (rev 121889)
+++ trunk/Tools/MiniBrowser/efl/main.c 2012-07-05 08:14:58 UTC (rev 121890)
@@ -125,6 +125,20 @@
title_set(app->ee, ewk_view_title_get(app->browser), progress * 100);
}
+static void
+on_error(void *user_data, Evas_Object *webview, void *event_info)
+{
+ Eina_Strbuf* buffer;
+ const Ewk_Web_Error *error = (const Ewk_Web_Error *)event_info;
+
+ buffer = eina_strbuf_new();
+ 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>",
+ ewk_web_error_code_get(error), ewk_web_error_description_get(error), ewk_web_error_url_get(error));
+
+ ewk_view_html_string_load(webview, eina_strbuf_string_get(buffer), 0, ewk_web_error_url_get(error));
+ eina_strbuf_free(buffer);
+}
+
static MiniBrowser *browserCreate(const char *url)
{
MiniBrowser *app = malloc(sizeof(MiniBrowser));
@@ -151,6 +165,7 @@
app->browser = ewk_view_add(app->evas);
evas_object_name_set(app->browser, "browser");
+ evas_object_smart_callback_add(app->browser, "load,error", on_error, app);
evas_object_smart_callback_add(app->browser, "load,progress", on_progress, app);
evas_object_smart_callback_add(app->browser, "title,changed", on_title_changed, app);