2 * Copyright (C) 2016 Samsung Electronics
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23 * THE POSSIBILITY OF SUCH DAMAGE.
27 * @file ewk_settings_internal.h
28 * @brief Describes the settings API.
30 * @note The ewk_settings is for setting the preference of specific ewk_view.
31 * We can get the ewk_settings from ewk_view using ewk_view_settings_get() API.
34 #ifndef ewk_settings_internal_h
35 #define ewk_settings_internal_h
37 #include "ewk_settings.h"
44 * Creates a type name for the callback function used to notify the client when
45 * the continuous spell checking setting was changed by WebKit.
47 * @param enable @c EINA_TRUE if continuous spell checking is enabled or @c EINA_FALSE if it's disabled
49 typedef void (*Ewk_Settings_Continuous_Spell_Checking_Change_Cb)(Eina_Bool enable);
52 * \enum _Ewk_Editable_Link_Behavior
54 * @brief Editable link behavior mode (Must remain in sync with WKEditableLinkBehavior)
56 enum _Ewk_Editable_Link_Behavior {
57 EWK_EDITABLE_LINK_BEHAVIOR_DEFAULT,
58 EWK_EDITABLE_LINK_BEHAVIOR_ALWAYS_LIVE,
59 EWK_EDITABLE_LINK_BEHAVIOR_ONLY_LIVE_WITH_SHIFTKEY,
60 EWK_EDITABLE_LINK_BEHAVIOR_LIVE_WHEN_NOT_FOCUSED,
61 EWK_EDITABLE_LINK_BEHAVIOR_NEVER_LIVE
63 typedef enum _Ewk_Editable_Link_Behavior Ewk_Editable_Link_Behavior;
65 enum _Ewk_Legacy_Font_Size_Mode {
66 EWK_LEGACY_FONT_SIZE_MODE_ALWAYS,
67 EWK_LEGACY_FONT_SIZE_MODE_ONLY_IF_PIXEL_VALUES_MATCH,
68 EWK_LEGACY_FONT_SIZE_MODE_NEVER
71 typedef enum _Ewk_Legacy_Font_Size_Mode Ewk_Legacy_Font_Size_Mode;
73 enum _Ewk_List_Style_Position {
74 EWK_LIST_STYLE_POSITION_OUTSIDE, /**< Default WebKit value. */
75 EWK_LIST_STYLE_POSITION_INSIDE
77 typedef enum _Ewk_List_Style_Position Ewk_List_Style_Position;
80 * Enables/disables the Javascript Fullscreen API. The Javascript API allows
81 * to request full screen mode, for more information see:
82 * http://dvcs.w3.org/hg/fullscreen/raw-file/tip/Overview.html
84 * Default value for Javascript Fullscreen API setting is @c EINA_TRUE .
86 * @param settings settings object to enable Javascript Fullscreen API
87 * @param enable @c EINA_TRUE to enable Javascript Fullscreen API or
88 * @c EINA_FALSE to disable
90 * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
92 EXPORT_API Eina_Bool ewk_settings_fullscreen_enabled_set(Ewk_Settings *settings, Eina_Bool enable);
95 * Returns whether the Javascript Fullscreen API is enabled or not.
97 * @param settings settings object to query whether Javascript Fullscreen API is enabled
99 * @return @c EINA_TRUE if the Javascript Fullscreen API is enabled
100 * @c EINA_FALSE if not or on failure
102 EXPORT_API Eina_Bool ewk_settings_fullscreen_enabled_get(const Ewk_Settings *settings);
105 * Requests enables/disables the plug-ins.
107 * @param settings settings object to set the plug-ins
108 * @param enable @c EINA_TRUE to enable the plug-ins
109 * @c EINA_FALSE to disable
111 * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
113 EXPORT_API Eina_Bool ewk_settings_plugins_enabled_set(Ewk_Settings *settings, Eina_Bool enable);
116 * Returs enables/disables the plug-ins.
118 * @param settings settings object to set the plug-ins
120 * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
122 EXPORT_API Eina_Bool ewk_settings_plugins_enabled_get(const Ewk_Settings *settings);
125 * Checks whether WebKit supports the @a encoding.
127 * @param encoding the encoding string to check whether WebKit supports it
129 * @return @c EINA_TRUE if WebKit supports @a encoding or @c EINA_FALSE if not or
132 EXPORT_API Eina_Bool ewk_settings_is_encoding_valid(const char* encoding);
135 * Requests to set default text encoding name.
137 * @param settings settings object to set default text encoding name
138 * @param encoding default text encoding name
140 * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
142 EXPORT_API Eina_Bool ewk_settings_default_encoding_set(Ewk_Settings *settings, const char* encoding);
145 * Sets link magnifier enabled.
147 * @param settings settings object
148 * @param enabled link magnifier enabled
150 EXPORT_API void ewk_settings_link_magnifier_enabled_set(Ewk_Settings *settings, Eina_Bool enabled);
153 * Gets link magnifier enabled.
155 * @param settings settings object
157 * @return @c EINA_TRUE if link magnifier enabled, @c EINA_FALSE otherwise
159 EXPORT_API Eina_Bool ewk_settings_link_magnifier_enabled_get(const Ewk_Settings *settings);
162 * Requests to enable/disable link effect
164 * @param settings settings object to enable/disable link effect
166 * @param linkEffectEnabled @c EINA_TRUE to enable the link effect
167 * @c EINA_FALSE to disable
169 * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
171 EXPORT_API Eina_Bool ewk_settings_link_effect_enabled_set(Ewk_Settings *settings, Eina_Bool linkEffectEnabled);
174 * Returns enable/disable link effect
176 * @param settings settings object to get whether link effect is enabled or disabled
178 * @return @c EINA_TRUE on enable or @c EINA_FALSE on disable
180 EXPORT_API Eina_Bool ewk_settings_link_effect_enabled_get(const Ewk_Settings *settings);
183 * Requests to set using default keypad (default value : true)
185 * @param settings settings object to use default keypad
186 * @param enable @c EINA_TRUE to use default keypad @c EINA_FALSE to disable
188 * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
190 EXPORT_API Eina_Bool ewk_settings_default_keypad_enabled_set(Ewk_Settings *settings, Eina_Bool enable);
193 * Returns enable/disable using default keypad
195 * @param settings settings object to use default keypad
197 * @return @c EINA_TRUE on enable or @c EINA_FALSE on disable
199 EXPORT_API Eina_Bool ewk_settings_default_keypad_enabled_get(const Ewk_Settings *settings);
202 * Requests to set using keypad without user action (default value : true)
204 * @param settings settings object using keypad without user action
205 * @param enable @c EINA_TRUE to use without user action @c EINA_FALSE to disable
207 * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
209 EXPORT_API Eina_Bool ewk_settings_uses_keypad_without_user_action_set(Ewk_Settings *settings, Eina_Bool enable);
212 * Returns using keypad without user action
214 * @param settings settings object using keypad without user action
215 * @param settings settings object to query using keypad without user action
217 * @return @c EINA_TRUE on enable or @c EINA_FALSE on disable
219 EXPORT_API Eina_Bool ewk_settings_uses_keypad_without_user_action_get(const Ewk_Settings *settings);
223 * Requests setting use of text zoom.
225 * @param settings settings object to text zoom
226 * @param enable to text zoom.
228 * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
230 EXPORT_API Eina_Bool ewk_settings_text_zoom_enabled_set(Ewk_Settings *settings, Eina_Bool enable);
233 * Returns whether text zoom is enabled or not.
235 * @param settings settings object to text zoom
237 * @return @c EINA_TRUE if enable text zoom or @c EINA_FALSE.
239 EXPORT_API Eina_Bool ewk_settings_text_zoom_enabled_get(const Ewk_Settings *settings);
242 * Requests enable/disable text selection by default WebKit.
244 * @param settings setting object to set text selection by default WebKit
245 * @param enable @c EINA_TRUE to enable text selection by default WebKit
246 * @c EINA_FALSE to disable
248 * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
250 EXPORT_API Eina_Bool ewk_settings_text_selection_enabled_set(Ewk_Settings* settings, Eina_Bool enable);
253 * Returns if text selection by default WebKit is enabled or disabled.
255 * @param settings setting object to get text selection by default WebKit
257 * @return @c EINA_TRUE if text selection by default WebKit is enabled
258 * @c EINA_FALSE if not or on failure
260 EXPORT_API Eina_Bool ewk_settings_text_selection_enabled_get(const Ewk_Settings* settings);
263 * Requests enables/disables to clear text selection when webview lose focus
265 * @param settings setting object to set to clear text selection when webview lose focus
266 * @param enable @c EINA_TRUE to clear text selection when webview lose focus
267 * @c EINA_FALSE to disable
269 * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
271 EXPORT_API Eina_Bool ewk_settings_clear_text_selection_automatically_set(Ewk_Settings* settings, Eina_Bool enable);
274 * Enables/disables text autosizing.
276 * By default, the text autosizing is disabled.
278 * @param settings settings object to set the text autosizing
279 * @param enable @c EINA_TRUE to enable the text autosizing
280 * @c EINA_FALSE to disable
282 * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
284 * @see ewk_settings_text_autosizing_enabled_get()
286 EXPORT_API Eina_Bool ewk_settings_text_autosizing_enabled_set(Ewk_Settings *settings, Eina_Bool enable);
289 * Returns whether the text autosizing is enabled.
291 * The text autosizing is a feature which adjusts the font size of text in wide
292 * columns, and makes text more legible.
294 * @param settings settings object to query whether text autosizing is enabled
296 * @return @c EINA_TRUE if the text autosizing is enabled
297 * @c EINA_FALSE if not or on failure
299 EXPORT_API Eina_Bool ewk_settings_text_autosizing_enabled_get(const Ewk_Settings *settings);
303 * Sets the scale factor for text autosizing.
305 * Default value is 1.0.
307 * @param settings settings object to set the text autosizing
308 * @param factor font scale factor for text autosizing
310 EXPORT_API Eina_Bool ewk_settings_text_autosizing_font_scale_factor_set(Ewk_Settings *settings, double factor);
313 * Gets the current scale factor for text autosizing.
315 * @param settings settings object to set scale factor for text autosizing
317 * @return the current font scale factor for text autosizing.
318 * In case of error, it returns non-positive value.
320 EXPORT_API double ewk_settings_text_autosizing_font_scale_factor_get(const Ewk_Settings *settings);
323 * Requests to enable/disable edge effect
325 * @param settings settings object to enable/disable edge effect
327 * @param enable @c EINA_TRUE to enable the edge effect
328 * @c EINA_FALSE to disable
330 * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
332 EXPORT_API Eina_Bool ewk_settings_edge_effect_enabled_set(Ewk_Settings* settings, Eina_Bool enable);
335 * Returns enable/disable edge effect
337 * @param settings settings object to get whether edge effect is enabled or disabled
339 * @return @c EINA_TRUE on enable or @c EINA_FALSE on disable
341 EXPORT_API Eina_Bool ewk_settings_edge_effect_enabled_get(const Ewk_Settings* settings);
344 * Sets text style for selection mode enabled.
346 * @param settings settings object
347 * @param enabled text style for selection mode
350 EXPORT_API void ewk_settings_text_style_state_enabled_set(Ewk_Settings *settings, Eina_Bool enabled);
352 * Gets text style for selection mode enabled.
354 * @param settings settings object
356 * @return @c EINA_TRUE if text style for selection mode enabled, @c EINA_FALSE otherwise
358 EXPORT_API Eina_Bool ewk_settings_text_style_state_enabled_get(const Ewk_Settings *settings);
361 * Requests to enable/disable to select word by double tap
363 * @param settings settings object to enable/disable to select word by double tap
364 * @param enable @c EINA_TRUE to select word by double tap
365 * @c EINA_FALSE to disable
367 * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
369 EXPORT_API Eina_Bool ewk_settings_select_word_automatically_set(Ewk_Settings *settings, Eina_Bool enabled);
372 * Returns enable/disable text selection by double tap
374 * @param settings settings object to get whether word by double tap is selected
376 * @return @c EINA_TRUE on enable or @c EINA_FALSE on disable
378 EXPORT_API Eina_Bool ewk_settings_select_word_automatically_get(const Ewk_Settings *settings);
381 * Sets legacy font size mode
383 * @param settings settings object
384 * @param mode legacy font size mode
386 * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
388 EXPORT_API Eina_Bool ewk_settings_current_legacy_font_size_mode_set(Ewk_Settings *settings, Ewk_Legacy_Font_Size_Mode mode);
391 * Returns set legacy font size mode
393 * @param settings settings object
395 * @return @c Ewk_Legacy_Font_Size_Mode set legacy font size mode
397 EXPORT_API Ewk_Legacy_Font_Size_Mode ewk_settings_current_legacy_font_size_mode_get(const Ewk_Settings *settings);
400 * Sets to paste image as URI (default: paste as base64-encoded-data)
402 * @param settings settings object
403 * @param enable @c EINA_TRUE to paste image as URI @c EINA_FALSE to paste image as data
405 * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
407 EXPORT_API Eina_Bool ewk_settings_paste_image_uri_mode_set(Ewk_Settings *settings, Eina_Bool enabled);
410 * Returns whether paste image as URI mode is enabled
412 * @param settings settings object
414 * @return @c EINA_TRUE on enable or @c EINA_FALSE on disable
416 EXPORT_API Eina_Bool ewk_settings_paste_image_uri_mode_get(const Ewk_Settings *settings);
420 * Gets the initial position value for the HTML list element <ul></ul>.
422 * @param settings setting object to get the initial position value
424 * @return the initial position value for the HTML list element.
426 EINA_DEPRECATED EXPORT_API Ewk_List_Style_Position ewk_settings_initial_list_style_position_get(const Ewk_Settings* settings);
430 * Sets the initial position value for the HTML list element <ul></ul>.
432 * This value affect the lists that are going to be created,
433 * does not make sense to manipulate it for existed elements.
435 * @param settings setting object to set the initial list style position
436 * @param style a new style to set
438 * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
440 EINA_DEPRECATED EXPORT_API Eina_Bool ewk_settings_initial_list_style_position_set(Ewk_Settings* settings, Ewk_List_Style_Position style);
443 * Enable or disable supporting of -webkit-text-size-adjust
445 * -webkit-text-size-adjust affects text size adjusting feature.
447 * @param settings setting object to set the support of -webkit-text-size-adjust
448 * @param enable @c EINA_TRUE to support -webkit-text-size-adjust, @c EINA_FALSE not to support
450 * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
452 EXPORT_API Eina_Bool ewk_settings_webkit_text_size_adjust_enabled_set(Ewk_Settings* settings, Eina_Bool enabled);
455 * Requests to enable/disable to detect email address when tapping on email address without link property
457 * @param settings settings object to enable/disable to detect email address when tapping on email address without link property
459 * @param enable @c EINA_TRUE to enable to detect email address when tapping on email address without link property
460 * @c EINA_FALSE to disable
462 EXPORT_API void ewk_settings_detect_contents_automatically_set(Ewk_Settings* settings, Eina_Bool enable);
465 * Returns enable/disable to detect email address when tapping on email address without link property
467 * @param settings settings object to get whether email address is detected when tapping on email address without link property
469 * @return @c EINA_TRUE on enable or @c EINA_FALSE on disable
471 EXPORT_API Eina_Bool ewk_settings_detect_contents_automatically_get(const Ewk_Settings* settings);
474 * Sets cache builder mode enabled.
476 * @param settings settings object
477 * @param enabled cache builder mode
479 EXPORT_API void ewk_settings_cache_builder_enabled_set(Ewk_Settings *settings, Eina_Bool enabled);
482 * Requests enables/disables to the specific extra feature
484 * @param settings setting object to enable/disable the specific extra feature
485 * @param feature feature name
486 * @param enable @c EINA_TRUE to enable the specific extra feature
487 * @c EINA_FALSE to disable
489 * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
491 EXPORT_API void ewk_settings_extra_feature_set(Ewk_Settings* settings, const char* feature, Eina_Bool enable);
494 * Returns enable/disable to the specific extra feature
496 * @param settings settings object to get whether the specific extra feature is enabled or not.
497 * @param feature feature name
499 * @return @c EINA_TRUE on enable or @c EINA_FALSE on disable
501 EXPORT_API Eina_Bool ewk_settings_extra_feature_get(const Ewk_Settings* settings, const char* feature);
504 * Enables/disables the javascript access to clipboard.
506 * By default, JavaScript access to clipboard is disabled.
508 * @param settings settings object to set javascript access to clipboard
509 * @param enable @c EINA_TRUE to enable javascript access to clipboard
510 * @c EINA_FALSE to disable
512 * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
514 EXPORT_API Eina_Bool ewk_settings_javascript_can_access_clipboard_set(Ewk_Settings *settings, Eina_Bool enable);
517 * Returns whether javascript access to clipboard is enabled.
519 * @param settings settings object to query if the javascript can access to clipboard
521 * @return @c EINA_TRUE if the javascript can access to clipboard
522 * @c EINA_FALSE if not or on failure
524 EXPORT_API Eina_Bool ewk_settings_javascript_can_access_clipboard_get(const Ewk_Settings *settings);
527 * Enables/disables the DOM Paste is allowed.
529 * By default, DOM Paste is disabled.
531 * @param settings settings object to set DOM Paste allowance
532 * @param enable @c EINA_TRUE to enable DOM Paste
533 * @c EINA_FALSE to disable
535 * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
537 EXPORT_API Eina_Bool ewk_settings_dom_paste_allowed_set(Ewk_Settings *settings, Eina_Bool enable);
540 * Returns whether DOM Paste is allowed.
542 * @param settings settings object to query if the DOM Paste is enabled.
544 * @return @c EINA_TRUE if the DOM Paste is enabled
545 * @c EINA_FALSE if not or on failure
547 EXPORT_API Eina_Bool ewk_settings_dom_paste_allowed_get(const Ewk_Settings *settings);
552 #endif // ewk_settings_internal_h