Title: [150332] trunk/Source/WebKit2
Revision
150332
Author
[email protected]
Date
2013-05-18 01:48:44 -0700 (Sat, 18 May 2013)

Log Message

[EFL][WK2] Refactor ewk_view_custom_encoding_set/get API
https://bugs.webkit.org/show_bug.cgi?id=116386

Patch by Jinwoo Song <[email protected]> on 2013-05-18
Reviewed by Christophe Dumez.

Refactor the API to handle 'const char*' parameter in right way and
enable the unit test which was disabled in r136230 as there is no assertion now.

* UIProcess/API/efl/EwkView.cpp:
(EwkView::setCustomTextEncodingName):
* UIProcess/API/efl/EwkView.h:
(EwkView::customTextEncodingName):
(EwkView):
* UIProcess/API/efl/ewk_view.cpp:
(ewk_view_custom_encoding_set):
* UIProcess/API/efl/tests/test_ewk2_view.cpp:
(TEST_F):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (150331 => 150332)


--- trunk/Source/WebKit2/ChangeLog	2013-05-18 08:39:57 UTC (rev 150331)
+++ trunk/Source/WebKit2/ChangeLog	2013-05-18 08:48:44 UTC (rev 150332)
@@ -1,3 +1,23 @@
+2013-05-18  Jinwoo Song  <[email protected]>
+
+        [EFL][WK2] Refactor ewk_view_custom_encoding_set/get API
+        https://bugs.webkit.org/show_bug.cgi?id=116386
+
+        Reviewed by Christophe Dumez.
+
+        Refactor the API to handle 'const char*' parameter in right way and
+        enable the unit test which was disabled in r136230 as there is no assertion now.
+
+        * UIProcess/API/efl/EwkView.cpp:
+        (EwkView::setCustomTextEncodingName):
+        * UIProcess/API/efl/EwkView.h:
+        (EwkView::customTextEncodingName):
+        (EwkView):
+        * UIProcess/API/efl/ewk_view.cpp:
+        (ewk_view_custom_encoding_set):
+        * UIProcess/API/efl/tests/test_ewk2_view.cpp:
+        (TEST_F):
+
 2013-05-18  Csaba Osztrogonác  <[email protected]>
 
         [CMake] Unreviewed speculative build fix after r150305 and r150306.

Modified: trunk/Source/WebKit2/UIProcess/API/efl/EwkView.cpp (150331 => 150332)


--- trunk/Source/WebKit2/UIProcess/API/efl/EwkView.cpp	2013-05-18 08:39:57 UTC (rev 150331)
+++ trunk/Source/WebKit2/UIProcess/API/efl/EwkView.cpp	2013-05-18 08:48:44 UTC (rev 150332)
@@ -670,23 +670,16 @@
     }
 }
 
-const char* EwkView::customTextEncodingName() const
+void EwkView::setCustomTextEncodingName(const char* customEncoding)
 {
-    WKRetainPtr<WKStringRef> customEncoding = adoptWK(WKPageCopyCustomTextEncodingName(wkPage()));
-    if (WKStringIsEmpty(customEncoding.get()))
-        return 0;
+    if (m_customEncoding == customEncoding)
+        return;
 
-    m_customEncoding = WKEinaSharedString(customEncoding.get());
-
-    return m_customEncoding;
+    m_customEncoding = customEncoding;
+    WKRetainPtr<WKStringRef> wkCustomEncoding = adoptWK(WKStringCreateWithUTF8CString(customEncoding));
+    WKPageSetCustomTextEncodingName(wkPage(), wkCustomEncoding.get());
 }
 
-void EwkView::setCustomTextEncodingName(const String& encoding)
-{
-    WKRetainPtr<WKStringRef> wkEncoding = adoptWK(toCopiedAPI(encoding));
-    WKPageSetCustomTextEncodingName(wkPage(), wkEncoding.get());
-}
-
 void EwkView::setUserAgent(const char* userAgent)
 {
     if (m_userAgent == userAgent)

Modified: trunk/Source/WebKit2/UIProcess/API/efl/EwkView.h (150331 => 150332)


--- trunk/Source/WebKit2/UIProcess/API/efl/EwkView.h	2013-05-18 08:39:57 UTC (rev 150331)
+++ trunk/Source/WebKit2/UIProcess/API/efl/EwkView.h	2013-05-18 08:48:44 UTC (rev 150332)
@@ -136,8 +136,8 @@
 
     const char* themePath() const;
     void setThemePath(const char* theme);
-    const char* customTextEncodingName() const;
-    void setCustomTextEncodingName(const String& encoding);
+    const char* customTextEncodingName() const { return m_customEncoding; }
+    void setCustomTextEncodingName(const char* customEncoding);
     const char* userAgent() const { return m_userAgent; }
     void setUserAgent(const char* userAgent);
 
@@ -271,7 +271,7 @@
     WKEinaSharedString m_url;
     mutable WKEinaSharedString m_title;
     WKEinaSharedString m_theme;
-    mutable WKEinaSharedString m_customEncoding;
+    WKEinaSharedString m_customEncoding;
     WKEinaSharedString m_userAgent;
     bool m_mouseEventsEnabled;
 #if ENABLE(TOUCH_EVENTS)

Modified: trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp (150331 => 150332)


--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp	2013-05-18 08:39:57 UTC (rev 150331)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp	2013-05-18 08:48:44 UTC (rev 150332)
@@ -342,7 +342,7 @@
 {
     EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, false);
 
-    impl->setCustomTextEncodingName(encoding ? encoding : String());
+    impl->setCustomTextEncodingName(encoding);
 
     return true;
 }

Modified: trunk/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp (150331 => 150332)


--- trunk/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp	2013-05-18 08:39:57 UTC (rev 150331)
+++ trunk/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp	2013-05-18 08:48:44 UTC (rev 150332)
@@ -133,7 +133,7 @@
     ASSERT_FALSE(ewk_view_forward_possible(webView()));
 }
 
-TEST_F(EWK2UnitTestBase, DISABLED_ewk_view_setting_encoding_custom)
+TEST_F(EWK2UnitTestBase, ewk_view_custom_encoding)
 {
     ASSERT_FALSE(ewk_view_custom_encoding_get(webView()));
     ASSERT_TRUE(ewk_view_custom_encoding_set(webView(), "UTF-8"));
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to