Title: [96362] trunk/Source/WebKit/efl
Revision
96362
Author
[email protected]
Date
2011-09-29 15:02:37 -0700 (Thu, 29 Sep 2011)

Log Message

[EFL] API to get plain text of the frame
https://bugs.webkit.org/show_bug.cgi?id=67114

Patch by Raphael Kubo da Costa <[email protected]> on 2011-09-29
Reviewed by Ryosuke Niwa.

Add a function to return a frame's contents converted to plain text,
as already exposed by other ports and needed by DRT when dumping a
frame's contents.

* ewk/ewk_frame.cpp:
(ewk_frame_plain_text_get):
* ewk/ewk_frame.h:

Modified Paths

Diff

Modified: trunk/Source/WebKit/efl/ChangeLog (96361 => 96362)


--- trunk/Source/WebKit/efl/ChangeLog	2011-09-29 21:58:53 UTC (rev 96361)
+++ trunk/Source/WebKit/efl/ChangeLog	2011-09-29 22:02:37 UTC (rev 96362)
@@ -1,3 +1,18 @@
+2011-09-29  Raphael Kubo da Costa  <[email protected]>
+
+        [EFL] API to get plain text of the frame
+        https://bugs.webkit.org/show_bug.cgi?id=67114
+
+        Reviewed by Ryosuke Niwa.
+
+        Add a function to return a frame's contents converted to plain text,
+        as already exposed by other ports and needed by DRT when dumping a
+        frame's contents.
+
+        * ewk/ewk_frame.cpp:
+        (ewk_frame_plain_text_get):
+        * ewk/ewk_frame.h:
+
 2011-09-28  KwangHyuk Kim  <[email protected]>
 
         [EFL] Remove useless assignment code in _ewk_tiled_backing_store_zoom_set_internal.

Modified: trunk/Source/WebKit/efl/ewk/ewk_frame.cpp (96361 => 96362)


--- trunk/Source/WebKit/efl/ewk/ewk_frame.cpp	2011-09-29 21:58:53 UTC (rev 96361)
+++ trunk/Source/WebKit/efl/ewk/ewk_frame.cpp	2011-09-29 22:02:37 UTC (rev 96362)
@@ -1587,6 +1587,22 @@
     return 0;
 }
 
+char* ewk_frame_plain_text_get(const Evas_Object* ewkFrame)
+{
+    EWK_FRAME_SD_GET_OR_RETURN(ewkFrame, sd, 0);
+    EINA_SAFETY_ON_NULL_RETURN_VAL(sd->frame, 0);
+
+    if (!sd->frame->document())
+        return 0;
+
+    WebCore::Element* documentElement = sd->frame->document()->documentElement();
+
+    if (!documentElement)
+        return 0;
+
+    return strdup(documentElement->innerText().utf8().data());
+}
+
 /**
  * @internal
  * Reports uri changed and swap internal string reference.

Modified: trunk/Source/WebKit/efl/ewk/ewk_frame.h (96361 => 96362)


--- trunk/Source/WebKit/efl/ewk/ewk_frame.h	2011-09-29 21:58:53 UTC (rev 96361)
+++ trunk/Source/WebKit/efl/ewk/ewk_frame.h	2011-09-29 22:02:37 UTC (rev 96362)
@@ -804,6 +804,19 @@
  */
 EAPI Eina_List *ewk_frame_resources_location_get(const Evas_Object *o);
 
+/**
+ * Retrieve the frame's contents in plain text.
+ *
+ * This function returns the contents of the given frame converted to plain text,
+ * removing all the HTML formatting.
+ *
+ * @param ewkFrame Frame object whose contents to retrieve.
+ *
+ * @return A newly allocated string (which must be freed by the caller with @c free())
+ *         or @c 0 in case of failure.
+ */
+EAPI char* ewk_frame_plain_text_get(const Evas_Object* o);
+
 #ifdef __cplusplus
 }
 #endif
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to