Diff
Modified: trunk/Source/WebKit2/ChangeLog (123176 => 123177)
--- trunk/Source/WebKit2/ChangeLog 2012-07-20 04:29:39 UTC (rev 123176)
+++ trunk/Source/WebKit2/ChangeLog 2012-07-20 04:31:58 UTC (rev 123177)
@@ -1,3 +1,19 @@
+2012-07-19 Sudarsana Nagineni <[email protected]>
+
+ [EFL] [WK2] Add methods to get/set a custom text encoding
+ https://bugs.webkit.org/show_bug.cgi?id=90604
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Add methods to get/set custom character encoding.
+
+ * UIProcess/API/efl/ewk_view.cpp:
+ (_Ewk_View_Private_Data):
+ (_ewk_view_priv_del):
+ (ewk_view_setting_encoding_custom_get):
+ (ewk_view_setting_encoding_custom_set):
+ * UIProcess/API/efl/ewk_view.h:
+
2012-07-19 Gyuyoung Kim <[email protected]>
Unreviewed. Fix build break because of changing parameter type of
Modified: trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp (123176 => 123177)
--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp 2012-07-20 04:29:39 UTC (rev 123176)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp 2012-07-20 04:31:58 UTC (rev 123177)
@@ -27,6 +27,7 @@
#include "PageClientImpl.h"
#include "WKAPICast.h"
#include "WKRetainPtr.h"
+#include "WKString.h"
#include "WKURL.h"
#include "ewk_context.h"
#include "ewk_context_private.h"
@@ -50,12 +51,14 @@
const char* uri;
const char* title;
const char* theme;
+ const char* customEncoding;
LoadingResourcesMap loadingResourcesMap;
_Ewk_View_Private_Data()
: uri(0)
, title(0)
, theme(0)
+ , customEncoding(0)
{ }
~_Ewk_View_Private_Data()
@@ -63,6 +66,7 @@
eina_stringshare_del(uri);
eina_stringshare_del(title);
eina_stringshare_del(theme);
+ eina_stringshare_del(customEncoding);
}
};
@@ -960,3 +964,27 @@
return priv->pageClient->page();
}
+
+const char* ewk_view_setting_encoding_custom_get(const Evas_Object* ewkView)
+{
+ EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
+ EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0);
+
+ WKRetainPtr<WKStringRef> wkEncodingName(AdoptWK, WKPageCopyCustomTextEncodingName(toAPI(priv->pageClient->page())));
+ if (WKStringIsEmpty(wkEncodingName.get()))
+ return 0;
+
+ eina_stringshare_replace(&priv->customEncoding, toImpl(wkEncodingName.get())->string().utf8().data());
+ return priv->customEncoding;
+}
+
+Eina_Bool ewk_view_setting_encoding_custom_set(Evas_Object* ewkView, const char* encoding)
+{
+ EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
+ EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
+
+ WKRetainPtr<WKStringRef> wkEncodingName = encoding ? adoptWK(WKStringCreateWithUTF8CString(encoding)) : 0;
+ if (eina_stringshare_replace(&priv->customEncoding, encoding))
+ WKPageSetCustomTextEncodingName(toAPI(priv->pageClient->page()), wkEncodingName.get());
+ return true;
+}
Modified: trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.h (123176 => 123177)
--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.h 2012-07-20 04:29:39 UTC (rev 123176)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.h 2012-07-20 04:31:58 UTC (rev 123177)
@@ -420,6 +420,26 @@
*/
EAPI const char *ewk_view_theme_get(const Evas_Object *o);
+/**
+ * Gets the current custom character encoding name.
+ *
+ * @param o view object to get the current encoding
+ *
+ * @return @c eina_strinshare containing the current encoding, or
+ * @c NULL if it's not set
+ */
+EAPI const char *ewk_view_setting_encoding_custom_get(const Evas_Object *o);
+
+/**
+ * Sets the custom character encoding and reloads the page.
+ *
+ * @param o view to set the encoding
+ * @param encoding the new encoding to set or @c NULL to restore the default one
+ *
+ * @return @c EINA_TRUE on success @c EINA_FALSE otherwise
+ */
+EAPI Eina_Bool ewk_view_setting_encoding_custom_set(Evas_Object *o, const char *encoding);
+
#ifdef __cplusplus
}
#endif
Modified: trunk/Tools/ChangeLog (123176 => 123177)
--- trunk/Tools/ChangeLog 2012-07-20 04:29:39 UTC (rev 123176)
+++ trunk/Tools/ChangeLog 2012-07-20 04:31:58 UTC (rev 123177)
@@ -1,3 +1,16 @@
+2012-07-19 Sudarsana Nagineni <[email protected]>
+
+ [EFL] [WK2] Add methods to get/set a custom text encoding
+ https://bugs.webkit.org/show_bug.cgi?id=90604
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Added support for setting custom character encoding in MiniBrowser.
+ Use 'F3' to set the custom character encoding.
+
+ * MiniBrowser/efl/main.c:
+ (on_key_down):
+
2012-07-19 Dirk Pranke <[email protected]>
webkitpy: executive_unittest still failing when run in parallel
Modified: trunk/Tools/MiniBrowser/efl/main.c (123176 => 123177)
--- trunk/Tools/MiniBrowser/efl/main.c 2012-07-20 04:29:39 UTC (rev 123176)
+++ trunk/Tools/MiniBrowser/efl/main.c 2012-07-20 04:31:58 UTC (rev 123177)
@@ -75,6 +75,12 @@
on_key_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
Evas_Event_Key_Down *ev = (Evas_Event_Key_Down*) event_info;
+ static const char *encodings[] = {
+ "ISO-8859-1",
+ "UTF-8",
+ NULL
+ };
+ static int currentEncoding = -1;
if (!strcmp(ev->key, "F1")) {
info("Back (F1) was pressed\n");
if (!ewk_view_back(obj))
@@ -83,6 +89,10 @@
info("Forward (F2) was pressed\n");
if (!ewk_view_forward(obj))
info("Forward ignored: No forward history\n");
+ } else if (!strcmp(ev->key, "F3")) {
+ currentEncoding = (currentEncoding + 1) % (sizeof(encodings) / sizeof(encodings[0]));
+ info("Set encoding (F3) pressed. New encoding to %s", encodings[currentEncoding]);
+ ewk_view_setting_encoding_custom_set(obj, encodings[currentEncoding]);
} else if (!strcmp(ev->key, "F5")) {
info("Reload (F5) was pressed, reloading.\n");
ewk_view_reload(obj);