WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
diff (text/plain), 5.17 KB, created by
KwangYong Choi
on 2013-01-09 20:57:28 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
KwangYong Choi
Created:
2013-01-09 20:57:28 PST
Size:
5.17 KB
patch
obsolete
>diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog >index a2e8825..a7a011d 100644 >--- a/Source/WebKit2/ChangeLog >+++ b/Source/WebKit2/ChangeLog >@@ -1,3 +1,20 @@ >+2013-01-09 KwangYong Choi <ky0.choi@samsung.com> >+ >+ [EFL][WK2] Add ewk_view_mhtml_data_get() API >+ https://bugs.webkit.org/show_bug.cgi?id=106440 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Add ewk_view_mhtml_data_get() API for getting mhtml data of current page. >+ >+ * UIProcess/API/efl/ewk_view.cpp: >+ (ewkViewMHTMLDataCallback): >+ (ewk_view_mhtml_data_get): >+ * UIProcess/API/efl/ewk_view.h: >+ * UIProcess/API/efl/tests/test_ewk2_view.cpp: >+ (MHTMLDataCallback): >+ (TEST_F): >+ > 2013-01-09 Huang Dongsung <luxtella@company100.net> > > Remove deviceScaleFactor argument in computeMinimumScaleFactorForContentContained(). >diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp >index 154e9c6..55d379d 100644 >--- a/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp >+++ b/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp >@@ -39,6 +39,7 @@ > #include "WKRetainPtr.h" > #include "WKString.h" > #include "WebContext.h" >+#include "WebData.h" > #include "WebFullScreenManagerProxy.h" > #include "WebPageGroup.h" > #include "WebPreferences.h" >@@ -928,3 +929,34 @@ void ewk_view_draws_page_background_set(Evas_Object *ewkView, Eina_Bool enabled) > > impl->setDrawsBackground(enabled); > } >+ >+/** >+ * @internal >+ * Callback function used for ewk_view_mhtml_data_get(). >+ */ >+#if ENABLE(MHTML) >+static void ewkViewMHTMLDataCallback(WKDataRef wkData, WKErrorRef, void* context) >+{ >+ RefPtr<WebData> webData = toImpl(wkData); >+ Ewk_View_MHTML_Data_Cb MHTMLDataCallback = reinterpret_cast<Ewk_View_MHTML_Data_Cb>(context); >+ >+ MHTMLDataCallback(reinterpret_cast<const char*>(webData->bytes()), webData->size()); >+} >+#endif >+ >+Eina_Bool ewk_view_mhtml_data_get(const Evas_Object* ewkView, Ewk_View_MHTML_Data_Cb callback) >+{ >+#if ENABLE(MHTML) >+ EINA_SAFETY_ON_NULL_RETURN_VAL(callback, false); >+ EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, false); >+ >+ impl->page()->getContentsAsMHTMLData(DataCallback::create(reinterpret_cast<void*>(callback), >+ ewkViewMHTMLDataCallback), false /* useBinaryEncoding */); >+ >+ return true; >+#else >+ UNUSED_PARAM(ewkView); >+ UNUSED_PARAM(callback); >+ return false; >+#endif >+} >diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view.h b/Source/WebKit2/UIProcess/API/efl/ewk_view.h >index cd5041f..6bb1e4f 100644 >--- a/Source/WebKit2/UIProcess/API/efl/ewk_view.h >+++ b/Source/WebKit2/UIProcess/API/efl/ewk_view.h >@@ -315,6 +315,14 @@ typedef enum { > } Ewk_Pagination_Mode; > > /** >+ * Creates a type name for the callback function used to get the mhtml data. >+ * >+ * @param data string buffer of the mhtml data >+ * @param length length of the mhtml data >+ */ >+typedef void (*Ewk_View_MHTML_Data_Cb)(const char *data, unsigned length); >+ >+/** > * Sets the smart class APIs, enabling view to be inherited. > * > * @param api class definition to set, all members with the >@@ -846,6 +854,16 @@ EAPI Eina_Bool ewk_view_fullscreen_exit(Evas_Object *o); > */ > EAPI void ewk_view_draws_page_background_set(Evas_Object *o, Eina_Bool enabled); > >+/** >+ * Get MHTML data of the current web page. >+ * >+ * @param o view object to get mhtml data >+ * @param callback callback function to be called when the operation is finished >+ * >+ * @return @c EINA_TRUE on success or @c EINA_FALSE otherwise >+ */ >+EAPI Eina_Bool ewk_view_mhtml_data_get(const Evas_Object *o, Ewk_View_MHTML_Data_Cb callback); >+ > #ifdef __cplusplus > } > #endif >diff --git a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp >index 13d7fa8..ef8fffe 100644 >--- a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp >+++ b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp >@@ -916,3 +916,34 @@ TEST_F(EWK2UnitTestBase, ewk_view_contents_size_changed) > > evas_object_smart_callback_del(webView(), "contents,size,changed", onContentsSizeChanged); > } >+ >+#if ENABLE(MHTML) >+static bool MHTMLDataObtained = false; >+ >+static void MHTMLDataCallback(const char* data, unsigned length) >+{ >+ // Compare the length of the string first. >+ ASSERT_EQ(length, strlen(data)); >+ >+ // The variable string should have below text block. >+ const char lines[] = "<=00h=00t=00m=00l=00>=00<=00h=00e=00a=00d=00>=00<=00m=00e=00t=00a=00 =00c=\r\n" >+ "=00h=00a=00r=00s=00e=00t=00=3D=00\"=00U=00T=00F=00-=001=006=00L=00E=00\"=00>=\r\n" >+ "=00<=00/=00h=00e=00a=00d=00>=00<=00b=00o=00d=00y=00>=00<=00p=00>=00S=00i=00=\r\n" >+ "m=00p=00l=00e=00 =00H=00T=00M=00L=00<=00/=00p=00>=00<=00/=00b=00o=00d=00y=\r\n" >+ "=00>=00<=00/=00h=00t=00m=00l=00>=00"; >+ ASSERT_EQ(0, strncmp(data + 359, lines, strlen(lines))); >+ >+ MHTMLDataObtained = true; >+} >+ >+TEST_F(EWK2UnitTestBase, ewk_view_mhtml_data_get) >+{ >+ const char content[] = "<p>Simple HTML</p>"; >+ ewk_view_html_string_load(webView(), content, 0, 0); >+ waitUntilLoadFinished(); >+ >+ ASSERT_TRUE(ewk_view_mhtml_data_get(webView(), MHTMLDataCallback)); >+ while (!MHTMLDataObtained) >+ ecore_main_loop_iterate(); >+} >+#endif // ENABLE(MHTML)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 106440
:
181892
|
182056
|
182057
|
182070
|
182086
|
182233
|
182234
|
182271
|
182274
|
182277