ewk_frame.h 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997
  1. /*
  2. Copyright (C) 2009-2010 ProFUSION embedded systems
  3. Copyright (C) 2009-2010 Samsung Electronics
  4. This library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Library General Public
  6. License as published by the Free Software Foundation; either
  7. version 2 of the License, or (at your option) any later version.
  8. This library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Library General Public License for more details.
  12. You should have received a copy of the GNU Library General Public License
  13. along with this library; see the file COPYING.LIB. If not, write to
  14. the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  15. Boston, MA 02110-1301, USA.
  16. */
  17. /**
  18. * @file ewk_frame.h
  19. * @brief WebKit frame smart object.
  20. *
  21. * This object is the low level access to WebKit-EFL browser
  22. * component. It represents both the main and internal frames that
  23. * HTML pages contain.
  24. *
  25. * Every ewk_view has at least one frame, called "main frame" and
  26. * retrieved with ewk_view_frame_main_get(). One can retrieve frame's
  27. * owner view with ewk_frame_view_get(). Parent frame can be retrieved
  28. * with standard smart object's evas_object_smart_parent_get().
  29. * Children can be accessed with ewk_frame_children_iterator_new() or
  30. * ewk_frame_child_find().
  31. *
  32. * The following signals (see evas_object_smart_callback_add()) are emitted:
  33. *
  34. * - "contents,size,changed", Evas_Coord[2]: reports contents size
  35. * were changed due new layout, script actions or any other events.
  36. * - "editorclient,contents,changed", void: reports that editor client's
  37. * contents were changed
  38. * - "icon,changed", void: frame favicon changed.
  39. * - "load,committed", void: reports load committed.
  40. * - "load,document,finished", void: frame finished loading the document.
  41. * - "load,error", const Ewk_Frame_Load_Error*: reports load failed
  42. * and it gives a pointer to structure defining the error as an argument.
  43. * - "load,finished", const Ewk_Frame_Load_Error*: reports load
  44. * finished and it gives @c NULL on success or pointer to
  45. * structure defining the error.
  46. * - "load,resource,finished", unsigned long*: reports resource load finished and it gives
  47. * a pointer to its identifier.
  48. * - "load,resource,failed", Ewk_Frame_Load_Error*: reports resource load failure and it
  49. * gives a pointer to structure defining the error as an argument.
  50. * - "load,firstlayout,finished", void: frame finished first layout.
  51. * - "load,nonemptylayout,finished", void: frame finished first
  52. * non-empty layout.
  53. * - "load,progress", double*: load progress is changed (overall value
  54. * from 0.0 to 1.0, connect to individual frames for fine grained).
  55. * - "load,provisional", void: frame started provisional load.
  56. * - "load,provisional,failed", Ewk_Frame_Load_Error*: frame provisional load failed.
  57. * - "load,started", void: frame started loading the document.
  58. * - "mixedcontent,displayed", void: frame has loaded and displayed mixed content.
  59. * - "mixedcontent,run", void: frame has loaded and run mixed content.
  60. * - "navigation,first", void: first navigation was occurred.
  61. * - "redirect,cancelled", void: client redirect was cancelled.
  62. * - "redirect,load,provisional", void: received server redirect for provisional load.
  63. * - "redirect,requested", const char*: url of the client redirect that will be performed.
  64. * - "resource,request,new", Ewk_Frame_Resource_Request*: reports that
  65. * there's a new resource request.
  66. * - "resource,request,willsend", Ewk_Frame_Resource_Messages*: a resource will be requested.
  67. * and the possible redirect response.
  68. * - "resource,response,received", Ewk_Frame_Resource_Response*: reports that a response
  69. * to a resource request was received.
  70. * - "state,save", void: frame's state will be saved as a history item.
  71. * - "title,changed", Ewk_Text_With_Direction*: title of the main frame was changed.
  72. * - "uri,changed", const char*: uri of the main frame was changed.
  73. * - "xss,detected", Ewk_Frame_Xss_Notification*: reflected XSS is encountered in the page and suppressed.
  74. */
  75. #ifndef ewk_frame_h
  76. #define ewk_frame_h
  77. #include "ewk_security_origin.h"
  78. #include <Evas.h>
  79. #ifdef __cplusplus
  80. extern "C" {
  81. #endif
  82. /// Creates a type name for _Ewk_Frame_Load_Error.
  83. typedef struct _Ewk_Frame_Load_Error Ewk_Frame_Load_Error;
  84. /**
  85. * @brief Structure used to report load errors.
  86. *
  87. * Load errors are reported as signal by ewk_view. All the strings are
  88. * temporary references and should @b not be used after the signal
  89. * callback returns. If it's required, make copies with strdup() or
  90. * eina_stringshare_add() (they are not even guaranteed to be
  91. * stringshared, so must use eina_stringshare_add() and not
  92. * eina_stringshare_ref()).
  93. */
  94. struct _Ewk_Frame_Load_Error {
  95. int code; /**< numeric error code */
  96. Eina_Bool is_cancellation; /**< if load failed because it was canceled */
  97. const char *domain; /**< error domain name */
  98. const char *description; /**< error description already localized */
  99. const char *failing_url; /**< the url that failed to load */
  100. unsigned long resource_identifier; /**< identifier of resource */
  101. Evas_Object *frame; /**< frame where the failure happened */
  102. };
  103. /// Creates a type name for _Ewk_Frame_Resource_Request.
  104. typedef struct _Ewk_Frame_Resource_Request Ewk_Frame_Resource_Request;
  105. /**
  106. * @brief Structure containing details about a resource request.
  107. *
  108. * Details given before a resource is loaded on a given frame. It's used in
  109. * Ewk_Frame_Resource_Messages to inform about the details of a resource request.
  110. */
  111. struct _Ewk_Frame_Resource_Request {
  112. const char *url; /**< url of the resource */
  113. const char *first_party; /**< first party for cookies, can not be changed */
  114. const char *http_method; /**< http method, can not be changed */
  115. const unsigned long identifier; /**< identifier of resource, can not be changed */
  116. Evas_Object *frame; /**< frame where the resource is requested */
  117. Eina_Bool is_main_frame_request; /** < indicates if the request is for the main frame */
  118. };
  119. /// Creates a type name for _Ewk_Frame_Resource_Response.
  120. typedef struct _Ewk_Frame_Resource_Response Ewk_Frame_Resource_Response;
  121. /**
  122. * @brief Structure containing details about a response to a resource request.
  123. *
  124. * Details given in the response to a resource request. It's used by
  125. * ewk_frame_response_received() to inform about the details of a response.
  126. */
  127. struct _Ewk_Frame_Resource_Response {
  128. const char *url; /**< url of the resource */
  129. int status_code; /**< http status code */
  130. unsigned long identifier; /**< identifier of resource */
  131. const char *mime_type; /**< MIME type of the resource */
  132. };
  133. /// Creates a type name for _Ewk_Frame_Resource_Messages.
  134. typedef struct _Ewk_Frame_Resource_Messages Ewk_Frame_Resource_Messages;
  135. struct _Ewk_Frame_Resource_Messages {
  136. Ewk_Frame_Resource_Request *request; /**< resource request */
  137. Ewk_Frame_Resource_Response *redirect_response; /**< redirect response, can not be changed */
  138. };
  139. /// Enum containing text directionality values.
  140. typedef enum {
  141. EWK_TEXT_DIRECTION_DEFAULT, /**< Natural writing direction ("inherit") */
  142. EWK_TEXT_DIRECTION_LEFT_TO_RIGHT,
  143. EWK_TEXT_DIRECTION_RIGHT_TO_LEFT
  144. } Ewk_Text_Direction;
  145. /// Creates a type name for Ewk_Text_With_Direction.
  146. typedef struct _Ewk_Text_With_Direction Ewk_Text_With_Direction;
  147. struct _Ewk_Text_With_Direction {
  148. const char *string;
  149. Ewk_Text_Direction direction;
  150. };
  151. /// Creates a type name for Ewk_Frame_Xss_Notification.
  152. typedef struct _Ewk_Frame_Xss_Notification Ewk_Frame_Xss_Notification;
  153. /**
  154. * @brief Structure used to report reflected XSS is encountered in the page.
  155. *
  156. * This structure contains information received from the XSSAuditor when reflected XSS
  157. * is encountered in the page. The string is temporary reference and should @b not
  158. * be used after the signal callback returns. If it's required, make a copy of it.
  159. */
  160. struct _Ewk_Frame_Xss_Notification {
  161. const char *insecure_url; /**< insecure url of the document */
  162. Eina_Bool is_entire_page_blocked; /** < indicates if the entire page was blocked by XSSAuditor */
  163. };
  164. /// Enum containing hit test data types
  165. typedef enum {
  166. EWK_HIT_TEST_RESULT_CONTEXT_DOCUMENT = 1 << 1,
  167. EWK_HIT_TEST_RESULT_CONTEXT_LINK = 1 << 2,
  168. EWK_HIT_TEST_RESULT_CONTEXT_IMAGE = 1 << 3,
  169. EWK_HIT_TEST_RESULT_CONTEXT_MEDIA = 1 << 4,
  170. EWK_HIT_TEST_RESULT_CONTEXT_SELECTION = 1 << 5,
  171. EWK_HIT_TEST_RESULT_CONTEXT_EDITABLE = 1 << 6
  172. } Ewk_Hit_Test_Result_Context;
  173. /// Enum containing navigation types
  174. typedef enum {
  175. EWK_NAVIGATION_TYPE_LINK_CLICKED,
  176. EWK_NAVIGATION_TYPE_FORM_SUBMITTED,
  177. EWK_NAVIGATION_TYPE_BACK_FORWARD,
  178. EWK_NAVIGATION_TYPE_RELOAD,
  179. EWK_NAVIGATION_TYPE_FORM_RESUBMITTED,
  180. EWK_NAVIGATION_TYPE_OTHER
  181. } Ewk_Navigation_Type;
  182. /// Creates a type name for _Ewk_Hit_Test.
  183. typedef struct _Ewk_Hit_Test Ewk_Hit_Test;
  184. /// Structure used to report hit test result.
  185. struct _Ewk_Hit_Test {
  186. int x; /**< the horizontal position of the hit test */
  187. int y; /**< the vertical position of the hit test */
  188. struct {
  189. int x, y, w, h;
  190. } bounding_box; /**< DEPRECATED, see ewk_frame_hit_test_new() */
  191. Ewk_Text_With_Direction title; /**< title of the element */
  192. const char *alternate_text; /**< the alternate text for image, area, input and applet */
  193. Evas_Object *frame; /**< the pointer to frame where hit test was requested */
  194. struct {
  195. const char *text; /**< the text of the link */
  196. const char *url; /**< URL of the link */
  197. const char *title; /**< the title of link */
  198. Evas_Object *target_frame;
  199. } link;
  200. const char *image_uri;
  201. const char *media_uri;
  202. Ewk_Hit_Test_Result_Context context;
  203. };
  204. /// Represents actions of touch events.
  205. typedef enum {
  206. EWK_TOUCH_START,
  207. EWK_TOUCH_MOVE,
  208. EWK_TOUCH_END,
  209. EWK_TOUCH_CANCEL
  210. } Ewk_Touch_Event_Type;
  211. /// Represents states of touch events.
  212. typedef enum {
  213. EWK_TOUCH_POINT_RELEASED,
  214. EWK_TOUCH_POINT_PRESSED,
  215. EWK_TOUCH_POINT_MOVED,
  216. EWK_TOUCH_POINT_STATIONARY,
  217. EWK_TOUCH_POINT_CANCELLED,
  218. EWK_TOUCH_POINT_END
  219. } Ewk_Touch_Point_Type;
  220. /// Creates a type name for _Ewk_Touch_Point.
  221. typedef struct _Ewk_Touch_Point Ewk_Touch_Point;
  222. /// Represents a touch point.
  223. struct _Ewk_Touch_Point {
  224. unsigned int id; /**< identifier of the touch event */
  225. int x; /**< the horizontal position of the touch event */
  226. int y; /**< the horizontal position of the touch event */
  227. Ewk_Touch_Point_Type state; /**< state of the touch event */
  228. };
  229. typedef enum {
  230. EWK_TEXT_SELECTION_NONE,
  231. EWK_TEXT_SELECTION_CARET,
  232. EWK_TEXT_SELECTION_RANGE
  233. } Ewk_Text_Selection_Type;
  234. /**
  235. * Represents the validity of a X.509 certificate related to the current frame.
  236. *
  237. * A certificate is considered untrusted when any problem is found in it: it may have
  238. * expired, the certificate's Common Name does not match the current host, the certificate
  239. * does not validate against the current set of root CA certificates etc.
  240. *
  241. * @sa ewk_frame_certificate_status_get, ewk_network_tls_ca_certificates_path_set
  242. */
  243. typedef enum {
  244. EWK_CERTIFICATE_STATUS_NO_CERTIFICATE = 1 << 1, /**< No certificate provided (non-HTTPS connection). */
  245. EWK_CERTIFICATE_STATUS_UNTRUSTED = 1 << 2, /**< The certificate provided is not trusted. */
  246. EWK_CERTIFICATE_STATUS_TRUSTED = 1 << 3 /**< The certificate is valid and fully trusted. */
  247. } Ewk_Certificate_Status;
  248. /**
  249. * Retrieves the ewk_view object that owns this frame.
  250. *
  251. * @param o frame object to get view object
  252. *
  253. * @return view object or @c NULL on failure
  254. */
  255. EAPI Evas_Object *ewk_frame_view_get(const Evas_Object *o);
  256. /**
  257. * Retrieves the Ewk_Security_Origin of this frame.
  258. *
  259. * The returned object should be freed by ewk_security_origin_free().
  260. *
  261. * @param o frame object to get the security origin
  262. *
  263. * @return security origin object
  264. */
  265. EAPI Ewk_Security_Origin *ewk_frame_security_origin_get(const Evas_Object *o);
  266. /**
  267. * Returns a new iterator over all direct children frames.
  268. *
  269. * Keep frame object intact while iteration happens otherwise frame
  270. * may be destroyed while iterated.
  271. *
  272. * Iteration results are Evas_Object*, so give eina_iterator_next() a
  273. * pointer to it.
  274. *
  275. * Returned iterator should be freed by eina_iterator_free().
  276. *
  277. * @param o frame object to create the iterator
  278. *
  279. * @return a newly allocated iterator on sucess, or @c NULL if not possible to
  280. * create the iterator
  281. */
  282. EAPI Eina_Iterator *ewk_frame_children_iterator_new(Evas_Object *o);
  283. /**
  284. * Finds a child frame by its name, recursively.
  285. *
  286. * For pre-defined names, returns @a o if @a name is "_self" or
  287. * "_current", returns @a o's parent frame if @a name is "_parent",
  288. * and returns the main frame if @a name is "_top". Also returns @a o
  289. * if it is the main frame and @a name is either "_parent" or
  290. * "_top". For other names, this function returns the first frame that
  291. * matches @a name. This function searches @a o and its descendents
  292. * first, then @a o's parent and its children moving up the hierarchy
  293. * until a match is found. If no match is found in @a o's hierarchy,
  294. * this function will search for a matching frame in other main frame
  295. * hierarchies.
  296. *
  297. * @param o frame object to find a child frame
  298. * @param name child frame name
  299. *
  300. * @return child frame of the given frame, or @c NULL if the the child wasn't found
  301. */
  302. EAPI Evas_Object *ewk_frame_child_find(Evas_Object *o, const char *name);
  303. /**
  304. * Asks the main frame to load the given URI.
  305. *
  306. * @param o frame object to load uri
  307. * @param uri uniform resource identifier to load
  308. *
  309. * @return @c EINA_TRUE on success, or @c EINA_FALSE on failure
  310. */
  311. EAPI Eina_Bool ewk_frame_uri_set(Evas_Object *o, const char *uri);
  312. /**
  313. * Gets the uri of this frame.
  314. *
  315. * It returns an internal string and should not
  316. * be modified. The string is guaranteed to be stringshared.
  317. *
  318. * @param o frame object to get uri
  319. *
  320. * @return frame uri on success or @c NULL on failure
  321. */
  322. EAPI const char *ewk_frame_uri_get(const Evas_Object *o);
  323. /**
  324. * Gets the title of this frame.
  325. *
  326. * It returns an internal string and should not
  327. * be modified. The string is guaranteed to be stringshared.
  328. *
  329. * @param o frame object to get title
  330. *
  331. * @return frame title on success or @c NULL on failure
  332. */
  333. EAPI const Ewk_Text_With_Direction *ewk_frame_title_get(const Evas_Object *o);
  334. /**
  335. * Gets the name of this frame.
  336. *
  337. * It returns an internal string and should not
  338. * be modified. The string is guaranteed to be stringshared.
  339. *
  340. * @param o frame object to get name
  341. *
  342. * @return frame name on success or @c NULL on failure
  343. */
  344. EAPI const char *ewk_frame_name_get(const Evas_Object *o);
  345. /**
  346. * Gets last known contents size.
  347. *
  348. * @param o frame object to get contents size
  349. * @param w pointer to store contents size width, may be @c NULL
  350. * @param h pointer to store contents size height, may be @c NULL
  351. *
  352. * @return @c EINA_TRUE on success or @c EINA_FALSE on failure and
  353. * @a w and @a h will be zeroed
  354. */
  355. EAPI Eina_Bool ewk_frame_contents_size_get(const Evas_Object *o, Evas_Coord *w, Evas_Coord *h);
  356. /**
  357. * Requests loading the given contents in this frame.
  358. *
  359. * @param o frame object to load document
  360. * @param contents what to load into frame
  361. * @param contents_size size of @a contents (in bytes),
  362. * if @c 0 is given, length of @a contents is used
  363. * @param mime_type type of @a contents data, if @c NULL is given "text/html" is assumed
  364. * @param encoding encoding for @a contents data, if @c NULL is given "UTF-8" is assumed
  365. * @param base_uri base uri to use for relative resources, may be @c NULL,
  366. * if provided @b must be an absolute uri
  367. *
  368. * @return @c EINA_TRUE on successful request, @c EINA_FALSE on errors
  369. */
  370. EAPI Eina_Bool ewk_frame_contents_set(Evas_Object *o, const char *contents, size_t contents_size, const char *mime_type, const char *encoding, const char *base_uri);
  371. /**
  372. * Requests loading alternative contents for unreachable URI in this frame.
  373. *
  374. * This is similar to ewk_frame_contents_set(), but is used when some
  375. * URI was failed to load, using the provided content instead. The main
  376. * difference is that back-forward navigation list is not changed.
  377. *
  378. * @param o frame object to load alternative content
  379. * @param contents what to load into frame, must @b not be @c NULL
  380. * @param contents_size size of @a contents (in bytes),
  381. * if @c 0 is given, length of @a contents is used
  382. * @param mime_type type of @a contents data, if @c NULL is given "text/html" is assumed
  383. * @param encoding encoding used for @a contents data, if @c NULL is given "UTF-8" is assumed
  384. * @param base_uri base URI to use for relative resources, may be @c NULL,
  385. * if provided must be an absolute uri
  386. * @param unreachable_uri the URI that failed to load and is getting the
  387. * alternative representation, must @b not be @c NULL
  388. *
  389. * @return @c EINA_TRUE on successful request, @c EINA_FALSE on errors
  390. */
  391. EAPI Eina_Bool ewk_frame_contents_alternate_set(Evas_Object *o, const char *contents, size_t contents_size, const char *mime_type, const char *encoding, const char *base_uri, const char *unreachable_uri);
  392. /**
  393. * Requests execution of the given script.
  394. *
  395. * The returned string @b should be freed by eina_stringshare_del() after use.
  396. *
  397. * @param o frame object to execute script
  398. * @param script Java Script to execute
  399. *
  400. * @return newly allocated string for result or @c NULL if the result cannot be converted to string or failure
  401. */
  402. EAPI const char *ewk_frame_script_execute(Evas_Object *o, const char *script);
  403. /**
  404. * Queries if the frame is editable.
  405. *
  406. * @param o the frame object to query editable state
  407. *
  408. * @return @c EINA_TRUE if the frame is editable, @c EINA_FALSE otherwise
  409. */
  410. EAPI Eina_Bool ewk_frame_editable_get(const Evas_Object *o);
  411. /**
  412. * Sets editable state for frame.
  413. *
  414. * @param o the frame object to set editable state
  415. * @param editable a new state to set
  416. *
  417. * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise
  418. */
  419. EAPI Eina_Bool ewk_frame_editable_set(Evas_Object *o, Eina_Bool editable);
  420. /**
  421. * Gets the copy of the selected text.
  422. *
  423. * The returned string @b should be freed by eina_stringshare_del() after use.
  424. *
  425. * @param o the frame object to get selected text
  426. *
  427. * @return a newly allocated string or @c NULL if nothing is selected or on failure
  428. */
  429. EAPI const char *ewk_frame_selection_get(const Evas_Object *o);
  430. /**
  431. * Searches the given string in a document.
  432. *
  433. * @param o frame object where to search the text
  434. * @param string reference string to search
  435. * @param case_sensitive if search should be case sensitive or not
  436. * @param forward if search is from cursor and on or backwards
  437. * @param wrap if search should wrap at the end
  438. *
  439. * @return @c EINA_TRUE if the given string was found, @c EINA_FALSE if not or failure
  440. */
  441. EAPI Eina_Bool ewk_frame_text_search(const Evas_Object *o, const char *string, Eina_Bool case_sensitive, Eina_Bool forward, Eina_Bool wrap);
  442. /**
  443. * Marks matches the given string in a document.
  444. *
  445. * @param o frame object where to search text
  446. * @param string reference string to match
  447. * @param case_sensitive if match should be case sensitive or not
  448. * @param highlight if matches should be highlighted
  449. * @param limit maximum amount of matches, or zero to unlimited
  450. *
  451. * @return number of matched @a string
  452. */
  453. EAPI unsigned int ewk_frame_text_matches_mark(Evas_Object *o, const char *string, Eina_Bool case_sensitive, Eina_Bool highlight, unsigned int limit);
  454. /**
  455. * Unmarks all marked matches in a document.
  456. * Reverses the effect of ewk_frame_text_matches_mark().
  457. *
  458. * @param o frame object where to unmark matches
  459. *
  460. * @return @c EINA_TRUE on success, @c EINA_FALSE on failure
  461. */
  462. EAPI Eina_Bool ewk_frame_text_matches_unmark_all(Evas_Object *o);
  463. /**
  464. * Sets whether matches marked with ewk_frame_text_matches_mark() should be highlighted.
  465. *
  466. * @param o frame object where to set if matches are highlighted or not
  467. * @param highlight @c EINA_TRUE if matches are highlighted, @c EINA_FALSE if not
  468. *
  469. * @return @c EINA_TRUE on success, @c EINA_FALSE on failure
  470. */
  471. EAPI Eina_Bool ewk_frame_text_matches_highlight_set(Evas_Object *o, Eina_Bool highlight);
  472. /**
  473. * Returns whether matches marked with ewk_frame_text_matches_mark() are highlighted.
  474. *
  475. * @param o frame object to query if matches are highlighted or not
  476. *
  477. * @return @c EINA_TRUE if matches are highlighted, @c EINA_FALSE otherwise
  478. */
  479. EAPI Eina_Bool ewk_frame_text_matches_highlight_get(const Evas_Object *o);
  480. /**
  481. * Returns the position of the n-th matched text in the frame.
  482. *
  483. * @param o frame object where matches are marked
  484. * @param n index of element
  485. * @param x the pointer to store the horizontal position of @a n matched text, may be @c NULL
  486. * @param y the pointer to store the vertical position of @a n matched text, may be @c NULL
  487. *
  488. * @return @c EINA_TRUE on success, @c EINA_FALSE when no matches were found or
  489. * @a n is bigger than search results or on failure
  490. */
  491. EAPI Eina_Bool ewk_frame_text_matches_nth_pos_get(const Evas_Object *o, size_t n, int *x, int *y);
  492. /**
  493. * Asks frame to stop loading.
  494. *
  495. * @param o frame object to stop loading
  496. *
  497. * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise
  498. */
  499. EAPI Eina_Bool ewk_frame_stop(Evas_Object *o);
  500. /**
  501. * Asks frame to reload current document.
  502. *
  503. * @param o frame object to reload current document
  504. *
  505. * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise
  506. *
  507. * @see ewk_frame_reload_full()
  508. */
  509. EAPI Eina_Bool ewk_frame_reload(Evas_Object *o);
  510. /**
  511. * Asks frame to fully reload current document, using no previous caches.
  512. *
  513. * @param o frame object to reload current document
  514. *
  515. * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise
  516. */
  517. EAPI Eina_Bool ewk_frame_reload_full(Evas_Object *o);
  518. /**
  519. * Asks the frame to navigate back in the history.
  520. *
  521. * @param o frame object to navigate back
  522. *
  523. * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise
  524. *
  525. * @see ewk_frame_navigate()
  526. */
  527. EAPI Eina_Bool ewk_frame_back(Evas_Object *o);
  528. /**
  529. * Asks frame to navigate forward in the history.
  530. *
  531. * @param o frame object to navigate forward
  532. *
  533. * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise
  534. *
  535. * @see ewk_frame_navigate()
  536. */
  537. EAPI Eina_Bool ewk_frame_forward(Evas_Object *o);
  538. /**
  539. * Navigates back or forward in the history.
  540. *
  541. * @param o frame object to navigate
  542. * @param steps if positive navigates that amount forwards, if negative
  543. * does backwards
  544. *
  545. * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise
  546. */
  547. EAPI Eina_Bool ewk_frame_navigate(Evas_Object *o, int steps);
  548. /**
  549. * Queries if it's possible to navigate backwards one item in the history.
  550. *
  551. * @param o frame object to query if backward navigation is possible
  552. *
  553. * @return @c EINA_TRUE if it's possible to navigate backwards one item in the history, @c EINA_FALSE otherwise
  554. *
  555. * @see ewk_frame_navigate_possible()
  556. */
  557. EAPI Eina_Bool ewk_frame_back_possible(Evas_Object *o);
  558. /**
  559. * Queries if it's possible to navigate forwards one item in the history.
  560. *
  561. * @param o frame object to query if forward navigation is possible
  562. *
  563. * @return @c EINA_TRUE if it's possible to navigate forwards in the history, @c EINA_FALSE otherwise
  564. *
  565. * @see ewk_frame_navigate_possible()
  566. */
  567. EAPI Eina_Bool ewk_frame_forward_possible(Evas_Object *o);
  568. /**
  569. * Queries if it's possible to navigate given @a steps in the history.
  570. *
  571. * @param o frame object to query if is possible to navigate @a steps in the history
  572. * @param steps positive value navigates that amount forwards, negative value
  573. * does backwards
  574. *
  575. * @return @c EINA_TRUE if it's possible to navigate @a steps in the history, @c EINA_FALSE otherwise
  576. */
  577. EAPI Eina_Bool ewk_frame_navigate_possible(Evas_Object *o, int steps);
  578. /**
  579. * Gets the current page zoom level used by this frame.
  580. *
  581. * @param o frame object to get zoom level
  582. *
  583. * @return page zoom level for the frame or @c -1.0 on failure
  584. *
  585. * @see ewk_frame_text_zoom_get()
  586. */
  587. EAPI float ewk_frame_page_zoom_get(const Evas_Object *o);
  588. /**
  589. * Sets the current page zoom level used by this frame.
  590. *
  591. * @param o frame object to change zoom level
  592. * @param page_zoom_factor a new zoom level
  593. *
  594. * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
  595. *
  596. * @see ewk_frame_text_zoom_set()
  597. */
  598. EAPI Eina_Bool ewk_frame_page_zoom_set(Evas_Object *o, float page_zoom_factor);
  599. /**
  600. * Gets the current text zoom level used by this frame.
  601. *
  602. * @param o frame object to get zoom level
  603. *
  604. * @return text zoom level for the frame or @c -1.0 on failure
  605. *
  606. * @see ewk_frame_page_zoom_get()
  607. */
  608. EAPI float ewk_frame_text_zoom_get(const Evas_Object *o);
  609. /**
  610. * Sets the current text zoom level used by this frame.
  611. *
  612. * @param o frame object to change zoom level
  613. * @param textZoomFactor a new zoom level
  614. *
  615. * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
  616. *
  617. * @see ewk_frame_page_zoom_set()
  618. */
  619. EAPI Eina_Bool ewk_frame_text_zoom_set(Evas_Object *o, float text_zoom_factor);
  620. /**
  621. * Frees hit test instance created by ewk_frame_hit_test_new().
  622. *
  623. * @param hit_test instance
  624. */
  625. EAPI void ewk_frame_hit_test_free(Ewk_Hit_Test *hit_test);
  626. /**
  627. * Creates a new hit test for the given frame and point.
  628. *
  629. * The returned object should be freed by ewk_frame_hit_test_free().
  630. *
  631. * @param o frame object to do hit test on
  632. * @param x the horizontal position to query
  633. * @param y the vertical position to query
  634. *
  635. * @return a newly allocated hit test on success, @c NULL otherwise
  636. */
  637. EAPI Ewk_Hit_Test *ewk_frame_hit_test_new(const Evas_Object *o, int x, int y);
  638. /**
  639. * Sets a relative scroll of the given frame.
  640. *
  641. * This function does scroll @a dx and @a dy pixels
  642. * from the current position of scroll.
  643. *
  644. * @param o frame object to scroll
  645. * @param dx horizontal offset to scroll
  646. * @param dy vertical offset to scroll
  647. *
  648. * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise
  649. */
  650. EAPI Eina_Bool ewk_frame_scroll_add(Evas_Object *o, int dx, int dy);
  651. /**
  652. * Sets an absolute scroll of the given frame.
  653. *
  654. * Both values are from zero to the contents size minus the viewport
  655. * size. See ewk_frame_scroll_size_get().
  656. *
  657. * @param o frame object to scroll
  658. * @param x horizontal position to scroll
  659. * @param y vertical position to scroll
  660. *
  661. * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise
  662. */
  663. EAPI Eina_Bool ewk_frame_scroll_set(Evas_Object *o, int x, int y);
  664. /**
  665. * Gets the possible scroll size of the given frame.
  666. *
  667. * Possible scroll size is contents size minus the viewport
  668. * size. It's the last allowed value for ewk_frame_scroll_set()
  669. *
  670. * @param o frame object to get scroll size
  671. * @param w the pointer to store the horizontal size that is possible to scroll,
  672. * may be @c NULL
  673. * @param h the pointer to store the vertical size that is possible to scroll,
  674. * may be @c NULL
  675. *
  676. * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise and
  677. * values are zeroed
  678. */
  679. EAPI Eina_Bool ewk_frame_scroll_size_get(const Evas_Object *o, int *w, int *h);
  680. /**
  681. * Gets the current scroll position of given frame.
  682. *
  683. * @param o frame object to get the current scroll position
  684. * @param x the pointer to store the horizontal position, may be @c NULL
  685. * @param y the pointer to store the vertical position. may be @c NULL
  686. *
  687. * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise and
  688. * values are zeroed.
  689. */
  690. EAPI Eina_Bool ewk_frame_scroll_pos_get(const Evas_Object *o, int *x, int *y);
  691. /**
  692. * Gets the visible content geometry of the frame.
  693. *
  694. * @param o frame object to query visible content geometry
  695. * @param include_scrollbars whenever to include scrollbars size
  696. * @param x the pointer to store the horizontal position, may be @c NULL
  697. * @param y the pointer to store the vertical position, may be @c NULL
  698. * @param w the pointer to store width, may be @c NULL
  699. * @param h the pointer to store height, may be @c NULL
  700. *
  701. * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise and
  702. * values are zeroed
  703. */
  704. EAPI Eina_Bool ewk_frame_visible_content_geometry_get(const Evas_Object *o, Eina_Bool include_scrollbars, int *x, int *y, int *w, int *h);
  705. /**
  706. * Queries if the frame should be repainted completely.
  707. *
  708. * Function tells if dirty areas should be repainted
  709. * even if they are out of the screen.
  710. *
  711. * @param o frame object to query if the frame should be repainted completely
  712. *
  713. * @return @c EINA_TRUE if any dirty areas should be repainted, @c EINA_FALSE
  714. * otherwise
  715. */
  716. EAPI Eina_Bool ewk_frame_paint_full_get(const Evas_Object *o);
  717. /**
  718. * Sets if the frame should be repainted completely.
  719. *
  720. * Function sets if dirty areas should be repainted
  721. * even if they are out of the screen.
  722. *
  723. * @param o frame object to set if the frame should be repainted completely
  724. * @param flag @c EINA_TRUE to repaint the frame completely,
  725. * @c EINA_FALSE if not
  726. */
  727. EAPI void ewk_frame_paint_full_set(Evas_Object *o, Eina_Bool flag);
  728. /**
  729. * Feeds the focus in event to the frame.
  730. *
  731. * @param o frame object to feed focus
  732. *
  733. * @return @c EINA_TRUE if the focus was handled, @c EINA_FALSE otherwise
  734. */
  735. EAPI Eina_Bool ewk_frame_feed_focus_in(Evas_Object *o);
  736. /**
  737. * Feeds the focus out event to the frame.
  738. *
  739. * @param o frame object to remove focus
  740. *
  741. * @return @c EINA_FALSE since the feature is not implemented
  742. */
  743. EAPI Eina_Bool ewk_frame_feed_focus_out(Evas_Object *o);
  744. /**
  745. * Gets the geometry, relative to the frame, of the focused element in the
  746. * document.
  747. *
  748. * @param o frame object containing the focused element
  749. * @param x pointer where to store the X value of the geometry, may be @c NULL
  750. * @param x pointer where to store the Y value of the geometry, may be @c NULL
  751. * @param x pointer where to store width of the geometry, may be @c NULL
  752. * @param x pointer where to store height of the geometry, may be @c NULL
  753. *
  754. * @return @c EINA_TRUE if the frame contains the currently focused element and
  755. * its geometry was correctly fetched, @c EINA_FALSE in any other case
  756. */
  757. EAPI Eina_Bool ewk_frame_focused_element_geometry_get(const Evas_Object *o, int *x, int *y, int *w, int *h);
  758. /**
  759. * Feeds the mouse wheel event to the frame.
  760. *
  761. * @param o frame object to feed the mouse wheel event
  762. * @param ev the mouse wheel event
  763. *
  764. * @return @c EINA_TRUE if the mouse wheel event was handled, @c EINA_FALSE otherwise
  765. */
  766. EAPI Eina_Bool ewk_frame_feed_mouse_wheel(Evas_Object *o, const Evas_Event_Mouse_Wheel *ev);
  767. /**
  768. * Feeds the mouse down event to the frame.
  769. *
  770. * @param o frame object to feed the mouse down event
  771. * @param ev the mouse down event
  772. *
  773. * @return @c EINA_TRUE if the mouse down event was handled, @c EINA_FALSE otherwise
  774. */
  775. EAPI Eina_Bool ewk_frame_feed_mouse_down(Evas_Object *o, const Evas_Event_Mouse_Down *ev);
  776. /**
  777. * Feeds the mouse up event to the frame.
  778. *
  779. * @param o frame object to feed the mouse up event
  780. * @param ev the mouse up event
  781. *
  782. * @return @c EINA_TRUE if the mouse up event was handled, @c EINA_FALSE otherwise
  783. */
  784. EAPI Eina_Bool ewk_frame_feed_mouse_up(Evas_Object *o, const Evas_Event_Mouse_Up *ev);
  785. /**
  786. * Feeds the mouse move event to the frame.
  787. *
  788. * @param o frame object to feed the mouse move event
  789. * @param ev the mouse move event
  790. *
  791. * @return @c EINA_TRUE if the mouse move event was handled, @c EINA_FALSE otherwise
  792. */
  793. EAPI Eina_Bool ewk_frame_feed_mouse_move(Evas_Object *o, const Evas_Event_Mouse_Move *ev);
  794. /**
  795. * Feeds the touch event to the frame.
  796. *
  797. * @param o frame object to feed touch event
  798. * @param action the action of touch event
  799. * @param points a list of points (Ewk_Touch_Point) to process
  800. * @param metaState modifiers state of touch event. Users are expected to pass ORed values of the ECORE_EVENT_MODIFIER macros in Ecore_Input.h, such as ECORE_EVENT_MODIFIER_ALT or ECORE_EVENT_MODIFIER_SHIFT
  801. *
  802. * @return @c EINA_TRUE if touch event was handled, @c EINA_FALSE otherwise
  803. */
  804. EAPI Eina_Bool ewk_frame_feed_touch_event(Evas_Object *o, Ewk_Touch_Event_Type action, Eina_List *points, unsigned modifiers);
  805. /**
  806. * Feeds the keyboard key down event to the frame.
  807. *
  808. * @param o frame object to feed event
  809. * @param ev keyboard key down event
  810. *
  811. * @return @c EINA_TRUE if the key down event was handled, @c EINA_FALSE otherwise
  812. */
  813. EAPI Eina_Bool ewk_frame_feed_key_down(Evas_Object *o, const Evas_Event_Key_Down *ev);
  814. /**
  815. * Feeds the keyboard key up event to the frame.
  816. *
  817. * @param o frame object to feed event
  818. * @param ev keyboard key up event
  819. *
  820. * @return @c EINA_TRUE if the key up event was handled, @c EINA_FALSE otherwise
  821. */
  822. EAPI Eina_Bool ewk_frame_feed_key_up(Evas_Object *o, const Evas_Event_Key_Up *ev);
  823. /**
  824. * Returns current text selection type.
  825. *
  826. * @param o a frame object to check selection type
  827. * @return current text selection type on success or no selection otherwise
  828. */
  829. EAPI Ewk_Text_Selection_Type ewk_frame_text_selection_type_get(const Evas_Object *o);
  830. /**
  831. * Gets the frame source.
  832. *
  833. * It's part of HTML saving feature. Currently only HTML documents are supported.
  834. *
  835. * @param o frame smart object to get the frame source
  836. * @param frame_source a pointer to store the source of frame,
  837. * must @b not be @c NULL, this value @b should be freed after use
  838. *
  839. * @return @c length of @a frame_source on success, or @c -1 on failure
  840. *
  841. * @see ewk_frame_resources_location_get()
  842. */
  843. EAPI ssize_t ewk_frame_source_get(const Evas_Object *o, char **frame_source);
  844. /**
  845. * Gets the resource list of this frame.
  846. *
  847. * It's part of HTML saving feature. Currently only locations of images are supported.
  848. * An application might find these values in frame source and
  849. * replace them to the local paths. Values are not duplicated and they are decoded.
  850. *
  851. * @param o frame smart object to get the resources list
  852. * @return @c Eina_List with location of resources on success, or @c NULL on failure,
  853. * the Eina_List should be freed after use
  854. *
  855. * @see ewk_frame_source_get()
  856. */
  857. EAPI Eina_List *ewk_frame_resources_location_get(const Evas_Object *o);
  858. /**
  859. * Retrieve the frame's contents in plain text.
  860. *
  861. * This function returns the contents of the given frame converted to plain text,
  862. * removing all the HTML formatting.
  863. *
  864. * The returned string @b should be freed by eina_stringshare_del() after use.
  865. *
  866. * @param ewkFrame Frame object whose contents to retrieve.
  867. *
  868. * @return A newly allocated string (which must be freed by the caller with @c free())
  869. * or @c NULL in case of failure.
  870. */
  871. EAPI const char *ewk_frame_plain_text_get(const Evas_Object *o);
  872. /**
  873. * Returns whether the frame has displayed mixed content.
  874. *
  875. * When a frame has displayed mixed content, its current URI is an HTTPS one, but it has
  876. * loaded and displayed a resource (such as an image) from an insecure (non-HTTPS) URI.
  877. * Both the frame and the container view send a "mixedcontent,displayed" signal in this case.
  878. *
  879. * The status is reset only when a load event occurs (eg. the page is reloaded or a new page is loaded).
  880. *
  881. * @param o The frame to query.
  882. *
  883. * @sa ewk_view_mixed_content_displayed_get
  884. */
  885. EAPI Eina_Bool ewk_frame_mixed_content_displayed_get(const Evas_Object *o);
  886. /**
  887. * Returns whether the frame has run mixed content.
  888. *
  889. * When a frame has run mixed content, its current URI is an HTTPS one, but it has
  890. * loaded and run a resource (such as an image) from an insecure (non-HTTPS) URI.
  891. * Both the frame and the container view send a "mixedcontent,run" signal in this case.
  892. *
  893. * The status is reset only when a load event occurs (eg. the page is reloaded or a new page is loaded).
  894. *
  895. * @param o The frame to query.
  896. *
  897. * @sa ewk_view_mixed_content_run_get
  898. */
  899. EAPI Eina_Bool ewk_frame_mixed_content_run_get(const Evas_Object *o);
  900. /**
  901. * Returns the validity of the X.509 certificate related to the current frame.
  902. */
  903. EAPI Ewk_Certificate_Status ewk_frame_certificate_status_get(Evas_Object *o);
  904. #ifdef __cplusplus
  905. }
  906. #endif
  907. #endif // ewk_frame_h