2 Copyright (C) 2009-2010 ProFUSION embedded systems
3 Copyright (C) 2009-2012 Samsung Electronics
4 Copyright (C) 2012 Intel Corporation
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public
8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version.
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details.
16 You should have received a copy of the GNU Library General Public License
17 along with this library; see the file COPYING.LIB. If not, write to
18 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 Boston, MA 02110-1301, USA.
21 #define __STDC_FORMAT_MACROS
25 #include "BackForwardListImpl.h"
28 #include "ChromeClientEfl.h"
29 #include "ContextMenuController.h"
30 #include "DocumentLoader.h"
31 #include "DragClientEfl.h"
32 #include "EditorClientEfl.h"
33 #include "EflScreenUtilities.h"
34 #include "EventHandler.h"
35 #include "FocusController.h"
36 #include "FrameLoaderClientEfl.h"
37 #include "FrameView.h"
38 #include "GraphicsContext.h"
39 #include "HTMLElement.h"
40 #include "HTMLInputElement.h"
41 #include "HTMLNames.h"
42 #if ENABLE(TIZEN_PAGE_CACHE)
43 #include "HistoryItem.h"
45 #include "InspectorClientEfl.h"
46 #if ENABLE(TIZEN_REMOTE_WEB_INSPECTOR)
47 #include "InspectorController.h"
48 #include "InspectorServerEfl.h"
51 #include "JSDOMBinding.h"
52 #include "JSDOMWindow.h"
54 #include "LayoutTypes.h"
55 #include "PageClientEfl.h"
56 #include "PageGroup.h"
57 #include "PlatformMouseEvent.h"
58 #include "PopupMenuClient.h"
59 #include "ProgressTracker.h"
60 #include "RefPtrCairo.h"
61 #include "RenderTheme.h"
62 #include "ResourceHandle.h"
64 #include "c_instance.h"
65 #include "ewk_frame.h"
66 #include "ewk_frame_private.h"
67 #include "ewk_history_private.h"
68 #include "ewk_js_private.h"
69 #include "ewk_private.h"
70 #include "ewk_settings_private.h"
71 #include "ewk_view_private.h"
72 #include "ewk_window_features_private.h"
74 #include <Ecore_Evas.h>
78 #include <eina_safety_checks.h>
80 #include <libsoup/soup-session.h>
85 #if ENABLE(DEVICE_ORIENTATION)
86 #include "DeviceMotionClientEfl.h"
87 #include "DeviceOrientationClientEfl.h"
90 #if ENABLE(BATTERY_STATUS)
91 #include "BatteryClientEfl.h"
94 #if ENABLE(TIZEN_DYNAMIC_LOADED_PLUGINS) || ENABLE(TIZEN_ON_OFF_SPECIFIED_PLUGINS)
95 #include "PluginDatabase.h"
96 #include "PluginPackage.h"
99 #if ENABLE(TIZEN_JS_EXT_API)
100 #include "JSStringRef.h"
101 #include <wtf/Vector.h>
104 #if ENABLE(TIZEN_EFL_EXT_API)
105 #include "CachedImage.h"
106 #include "HTMLCollection.h"
107 #include "HTMLImageElement.h"
108 #include "HTMLOptionElement.h"
109 #include "HTMLOptionsCollection.h"
110 #include "HTMLSelectElement.h"
111 #include "HitTestRequest.h"
112 #include "HitTestResult.h"
115 #include "MemoryCache.h" // needed by ewk_webcore_cache_clean function
116 #include "MouseEventWithHitTestResults.h"
117 #include "NamedNodeMap.h"
118 #include "SharedBuffer.h"
121 #if ENABLE(NETSCAPE_PLUGIN_API)
122 #if ENABLE(TIZEN_SUPPORT_PLUGINS)
123 #include "PluginView.h"
125 #if ENABLE(TIZEN_NPAPI)
126 #include "HTMLObjectElement.h"
127 #include "HTMLPlugInElement.h"
128 #define FLASH_CLASS_ID "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
129 #define FLASH_SERVICE_TYPE "application/x-shockwave-flash"
133 #if ENABLE(TIZEN_PASSWORD_MANAGER)
134 #include "HTMLFormElement.h"
137 #if ENABLE(TIZEN_PAUSE_NETWORK)
138 #include "HTMLMediaElement.h"
139 #include "HTMLVideoElement.h"
140 #include "MainResourceLoader.h"
141 #include "MediaPlayer.h"
142 #include "NodeList.h"
143 #include "ResourceHandleInternal.h"
146 #if ENABLE(TIZEN_WEBCORE_SELECTIVE_RENDERING)
150 #if ENABLE(TIZEN_SUPPORT_RSS_LINK_PARSING)
151 #include "HTMLAllCollection.h"
152 #include "HTMLLinkElement.h"
155 #if USE(ACCELERATED_COMPOSITING) && ENABLE(TIZEN_ACCELERATED_COMPOSITING)
156 #include "AcceleratedCompositor.h"
159 #if ENABLE(TIZEN_INSTALL_CONTENT)
160 #include "InstallContentClientEfl.h"
163 #if ENABLE(TIZEN_ISF_PORT)
164 #include <Ecore_IMF_Evas.h>
167 #if ENABLE(TIZEN_DROPDOWN_SUPPORT)
168 #include "KeyboardEvent.h"
171 #if ENABLE(TIZEN_CONTEXT_MENU)
172 #include "ContextMenuClientEfl.h"
175 #if ENABLE(TIZEN_IMAGE_PASTE)
180 #include "PlatformContextSkia.h"
181 #include "SkBitmap.h"
182 #include "SkImageEncoder.h"
184 #include "platform_canvas.h"
187 #if ENABLE(TIZEN_RENDERING_PROFILE_TEST)
188 #include "TizenProfiler.h"
189 #endif // ENABLE(TIZEN_RENDERING_PROFILE_TEST)
191 #if ENABLE(TIZEN_RECORDING_SURFACE)
192 #include "ewk_recording_surface_set.h"
195 #if ENABLE(TIZEN_NOTIFICATION)
196 #if ENABLE(NOTIFICATIONS)
197 #include "NotificationController.h"
198 #include "NotificationClientEfl.h"
202 #if ENABLE(VIBRATION)
203 #include "VibrationClientEfl.h"
206 #if ENABLE(BATTERY_STATUS)
207 #include "BatteryClientEfl.h"
210 #if USE(ACCELERATED_COMPOSITING)
211 #include "NotImplemented.h"
214 #if ENABLE(NETWORK_INFO)
215 #include "NetworkInfoClientEfl.h"
218 #if ENABLE(INPUT_TYPE_COLOR)
219 #include "ColorChooserClient.h"
222 static const float zoomMinimum = 0.05;
223 static const float zoomMaximum = 4.0;
225 static const float devicePixelRatio = 1.0;
227 #define CENTI_PER_INCH 2.54
229 #if ENABLE(TIZEN_BG_RECT_SUPPORT)
230 #define ZOOM_BOUNCE_LIMIT_RATIO (0.25f)
233 #if ENABLE(CDOM_BINDINGS)
234 #include "WebKitDOM_Defines.h"
235 #include "WebKitDOM_Object.h"
236 #include "WebKitDOM_Document.h"
237 #include "WebKitDOM_Document_Private.h"
240 #if ENABLE(TIZEN_PARAGRAPH_SELECTION)
241 #include "RenderThemeEfl.h"
244 #if ENABLE(TIZEN_PLUGIN_PARENT_WINDOW)
245 #include <Ecore_Evas.h>
248 #if ENABLE(TIZEN_SUPPORT_WEBAPP_META_TAG)
249 #include "HTMLLinkElement.h"
250 #include "HTMLMetaElement.h"
253 static const char ewkViewTypeString[] = "EWK_View";
255 static const size_t ewkViewRepaintsSizeInitial = 32;
256 static const size_t ewkViewRepaintsSizeStep = 8;
257 static const size_t ewkViewRepaintsSizeMaximumFree = 64;
259 static const size_t ewkViewScrollsSizeInitial = 8;
260 static const size_t ewkViewScrollsSizeStep = 2;
261 static const size_t ewkViewScrollsSizeMaximumFree = 32;
262 #if !ENABLE(TIZEN_DAILY_UPVERSIONING)
263 static const Evas_Smart_Cb_Description _ewk_view_callback_names[] = {
264 { "colorchooser,create", "(yyyy)" },
265 { "colorchooser,willdelete", "" },
266 { "colorchooser,color,changed", "(yyyy)" },
267 { "download,request", "p" },
268 { "editorclient,contents,changed", "" },
269 { "editorclient,selection,changed", "" },
270 { "frame,created", "p" },
271 { "icon,received", "" },
272 { "inputmethod,changed", "b" },
273 { "js,windowobject,clear", "" },
274 { "link,hover,in", "p" },
275 { "link,hover,out", "" },
276 { "load,document,finished", "p" },
277 { "load,error", "p" },
278 { "load,finished", "p" },
279 { "load,newwindow,show", "" },
280 { "load,progress", "d" },
281 { "load,provisional", "" },
282 { "load,started", "" },
283 { "menubar,visible,get", "b" },
284 { "menubar,visible,set", "b" },
285 { "popup,created", "p" },
286 { "popup,willdelete", "p" },
288 { "scrollbars,visible,get", "b" },
289 { "scrollbars,visible,set", "b" },
290 { "statusbar,text,set", "s" },
291 { "statusbar,visible,get", "b" },
292 { "statusbar,visible,set", "b" },
293 { "title,changed", "s" },
294 { "toolbars,visible,get", "b" },
295 { "toolbars,visible,set", "b" },
296 { "tooltip,text,set", "s" },
297 { "uri,changed", "s" },
298 { "view,resized", "" },
299 { "zoom,animated,end", "" },
304 * @brief Private data that is used internally by EFL Port Page Cache
305 * and should never be modified from outside.
309 #if ENABLE(TIZEN_PAGE_CACHE)
310 struct Ewk_View_Pagecache_Data {
311 Eina_Bool isRestored;
313 WebCore::IntPoint scrollPos;
317 struct EditorCommand {
318 Ewk_Editor_Command ewkEditorCommand;
319 const char* editorCommandString;
323 * @brief A table grouping Ewk_Editor_Command enums with corresponding command
324 * strings used by WebCore::EditorCommand, keeping both in sync.
328 static const EditorCommand editorCommands[] = {
329 { EWK_EDITOR_COMMAND_UNDO, "Undo" },
330 { EWK_EDITOR_COMMAND_REDO, "Redo" },
331 { EWK_EDITOR_COMMAND_TOGGLE_BOLD, "ToggleBold" },
332 { EWK_EDITOR_COMMAND_TOGGLE_ITALIC, "ToggleItalic" },
333 { EWK_EDITOR_COMMAND_TOGGLE_UNDERLINE, "ToggleUnderline" },
334 { EWK_EDITOR_COMMAND_TOGGLE_STRIKETHROUGH, "Strikethrough" },
335 { EWK_EDITOR_COMMAND_TOGGLE_SUBSCRIPT, "SubScript" },
336 { EWK_EDITOR_COMMAND_TOGGLE_SUPERSCRIPT, "SuperScript" },
337 { EWK_EDITOR_COMMAND_INDENT, "Indent" },
338 { EWK_EDITOR_COMMAND_OUTDENT, "Outdent" },
339 { EWK_EDITOR_COMMAND_INSERT_ORDEREDLIST, "InsertOrderedList" },
340 { EWK_EDITOR_COMMAND_INSERT_UNORDEREDLIST, "InsertUnorderedList" },
341 { EWK_EDITOR_COMMAND_INSERT_IMAGE, "InsertImage" },
342 { EWK_EDITOR_COMMAND_INSERT_TEXT, "InsertText" },
343 { EWK_EDITOR_COMMAND_INSERT_HTML, "InsertHTML" },
344 { EWK_EDITOR_COMMAND_INSERT_PARAGRAPH, "InsertParagraph" },
345 { EWK_EDITOR_COMMAND_INSERT_PARAGRAPH_SEPARATOR, "InsertNewLine" },
346 { EWK_EDITOR_COMMAND_INSERT_LINE_SEPARATOR, "InsertLineBreak" },
347 { EWK_EDITOR_COMMAND_BACK_COLOR, "BackColor" },
348 { EWK_EDITOR_COMMAND_FORE_COLOR, "ForeColor" },
349 { EWK_EDITOR_COMMAND_HILITE_COLOR, "HiliteColor" },
350 { EWK_EDITOR_COMMAND_FONT_SIZE, "FontSize" },
351 { EWK_EDITOR_COMMAND_ALIGN_CENTER, "AlignCenter" },
352 { EWK_EDITOR_COMMAND_ALIGN_JUSTIFIED, "AlignJustified" },
353 { EWK_EDITOR_COMMAND_ALIGN_LEFT, "AlignLeft" },
354 { EWK_EDITOR_COMMAND_ALIGN_RIGHT, "AlignRight" },
355 { EWK_EDITOR_COMMAND_MOVE_TO_NEXT_CHAR, "MoveForward" },
356 { EWK_EDITOR_COMMAND_MOVE_TO_PREVIOUS_CHAR, "MoveBackward" },
357 { EWK_EDITOR_COMMAND_MOVE_TO_NEXT_WORD, "MoveWordForward" },
358 { EWK_EDITOR_COMMAND_MOVE_TO_PREVIOUS_WORD, "MoveWordBackward" },
359 { EWK_EDITOR_COMMAND_MOVE_TO_NEXT_LINE, "MoveDown" },
360 { EWK_EDITOR_COMMAND_MOVE_TO_PREVIOUS_LINE, "MoveUp" },
361 { EWK_EDITOR_COMMAND_MOVE_TO_BEGINNING_OF_LINE, "MoveToBeginningOfLine" },
362 { EWK_EDITOR_COMMAND_MOVE_TO_END_OF_LINE, "MoveToEndOfLine" },
363 { EWK_EDITOR_COMMAND_MOVE_TO_BEGINNING_OF_PARAGRAPH, "MoveToBeginningOfParagraph" },
364 { EWK_EDITOR_COMMAND_MOVE_TO_END_OF_PARAGRAPH, "MoveToEndOfParagraph" },
365 { EWK_EDITOR_COMMAND_MOVE_TO_BEGINNING_OF_DOCUMENT, "MoveToBeginningOfDocument" },
366 { EWK_EDITOR_COMMAND_MOVE_TO_END_OF_DOCUMENT, "MoveToEndOfDocument" },
367 { EWK_EDITOR_COMMAND_SELECT_NONE, "SelectNone" },
368 { EWK_EDITOR_COMMAND_SELECT_ALL, "SelectAll" },
369 { EWK_EDITOR_COMMAND_SELECT_PARAGRAPH, "SelectParagraph" },
370 { EWK_EDITOR_COMMAND_SELECT_SENTENCE, "SelectSentence" },
371 { EWK_EDITOR_COMMAND_SELECT_LINE, "SelectLine" },
372 { EWK_EDITOR_COMMAND_SELECT_WORD, "SelectWord" },
373 { EWK_EDITOR_COMMAND_SELECT_NEXT_CHAR, "MoveForwardAndModifySelection" },
374 { EWK_EDITOR_COMMAND_SELECT_PREVIOUS_CHAR, "MoveBackwardAndModifySelection" },
375 { EWK_EDITOR_COMMAND_SELECT_NEXT_WORD, "MoveWordForwardAndModifySelection" },
376 { EWK_EDITOR_COMMAND_SELECT_PREVIOUS_WORD, "MoveWordBackwardAndModifySelection" },
377 { EWK_EDITOR_COMMAND_SELECT_NEXT_LINE, "MoveDownAndModifySelection" },
378 { EWK_EDITOR_COMMAND_SELECT_PREVIOUS_LINE, "MoveUpAndModifySelection" },
379 { EWK_EDITOR_COMMAND_SELECT_START_OF_LINE, "MoveToBeginningOfLineAndModifySelection" },
380 { EWK_EDITOR_COMMAND_SELECT_END_OF_LINE, "MoveToEndOfLineAndModifySelection" },
381 { EWK_EDITOR_COMMAND_SELECT_START_OF_PARAGRAPH, "MoveToBeginningOfParagraphAndModifySelection" },
382 { EWK_EDITOR_COMMAND_SELECT_END_OF_PARAGRAPH, "MoveToEndOfParagraphAndModifySelection" },
383 { EWK_EDITOR_COMMAND_SELECT_START_OF_DOCUMENT, "MoveToBeginningOfDocumentAndModifySelection" },
384 { EWK_EDITOR_COMMAND_SELECT_END_OF_DOCUMENT, "MoveToEndOfDocumentAndModifySelection" },
385 { EWK_EDITOR_COMMAND_DELETE_WORD_BACKWARD, "DeleteWordBackward" },
386 { EWK_EDITOR_COMMAND_DELETE_WORD_FORWARD, "DeleteWordForward" },
387 { EWK_EDITOR_COMMAND_NONE, 0 } // EWK_EDITOR_COMMAND_NONE must be the last element.
390 >>>>>>> 7933b20e3b4cf85cba3b092c5effe184f784be72
392 * @brief Private data that is used internally by EFL WebKit
393 * and should never be modified from outside.
397 struct _Ewk_View_Private_Data {
398 OwnPtr<WebCore::Page> page;
399 WebCore::Settings* pageSettings;
400 WebCore::Frame* mainFrame;
401 WebCore::ViewportArguments viewportArguments;
402 #if ENABLE(TIZEN_VIEWPORT_META_TAG)
403 Ewk_Viewport_Attributes viewportAttributes;
405 #if ENABLE(TIZEN_ISF_PORT)
406 Ecore_IMF_Context* imContext;
408 Ewk_History* history;
409 OwnPtr<PageClientEfl> pageClient;
410 #if ENABLE(NETWORK_INFO)
411 OwnPtr<WebCore::NetworkInfoClientEfl> networkInfoClient;
413 #if ENABLE(INPUT_TYPE_COLOR)
414 WebCore::ColorChooserClient* colorChooserClient;
416 #if ENABLE(TIZEN_ORIENTATION_EVENTS)
417 Ewk_Screen_Orientation orientation;
421 WebCore::PopupMenuClient* menuClient;
423 #if USE(ACCELERATED_COMPOSITING) && ENABLE(TIZEN_ACCELERATED_COMPOSITING)
424 OwnPtr<WebCore::AcceleratedCompositor> compositor;
425 Evas_Object* compositingSurface;
426 bool compositingActive;
429 Eina_Rectangle* array;
434 Ewk_Scroll_Request* array;
438 unsigned int imh; /**< input method hints */
440 bool viewCleared : 1;
441 #if ENABLE(TIZEN_VIEW_ACTIVE_SET)
444 bool needTouchEvents : 1;
445 bool hasDisplayedMixedContent : 1;
446 bool hasRunMixedContent : 1;
449 const char* userAgent;
450 const char* userStylesheet;
451 const char* encodingDefault;
452 const char* encodingCustom;
454 const char* localStorageDatabasePath;
456 int fontMinimumLogicalSize;
458 int fontMonospaceSize;
459 const char* fontStandard;
460 const char* fontCursive;
461 const char* fontMonospace;
462 const char* fontFantasy;
463 const char* fontSerif;
464 const char* fontSansSerif;
465 bool autoLoadImages : 1;
466 bool autoShrinkImages : 1;
467 bool enableAutoResizeWindow : 1;
468 bool enableDeveloperExtras : 1;
469 bool enableScripts : 1;
470 bool enablePlugins : 1;
471 bool enableFrameFlattening : 1;
472 bool encodingDetector : 1;
473 bool hyperlinkAuditingEnabled : 1;
474 bool scriptsCanOpenWindows : 1;
475 bool scriptsCanCloseWindows : 1;
476 #if ENABLE(VIDEO_TRACK)
477 bool shouldDisplayCaptions : 1;
478 bool shouldDisplaySubtitles : 1;
479 bool shouldDisplayTextDescriptions: 1;
481 bool scriptsCanAccessClipboard : 1;
482 bool resizableTextareas : 1;
483 bool privateBrowsing : 1;
484 bool caretBrowsing : 1;
485 bool spatialNavigation : 1;
486 bool localStorage : 1;
487 #if ENABLE(TIZEN_WEB_AUDIO)
490 bool offlineAppCache : 1;
492 #if ENABLE(TIZEN_ONSCROLL_EVENT_SUPPRESSION)
493 Eina_Bool enableOnscrollEventSuppression : 1;
495 #if ENABLE(TIZEN_WEBKIT_EFL_DRT)
496 Eina_Bool scriptsWindowClose : 1;
498 bool enableXSSAuditor : 1;
499 #if ENABLE(WEB_AUDIO)
502 bool webGLEnabled : 1;
503 bool tabsToLinks : 1;
507 Eina_Bool userScalable : 1;
509 float devicePixelRatio;
510 double domTimerInterval;
511 #if ENABLE(TIZEN_CUSTOM_HEADERS)
512 WebCore::HTTPHeaderMap customHeaders;
514 #if ENABLE(TIZEN_GEOLOCATION)
515 Eina_Bool geolocation:1;
517 #if ENABLE(TIZEN_EDITABLE_LINK_ACTIVE_SET)
518 Eina_Bool editableLinkBehavior:1;
520 #if ENABLE(TIZEN_SUPPORT_PLUGINS) && ENABLE(TIZEN_DONT_PAN_OVER_SOME_PLUGINS)
521 Eina_Bool blockPanning: 1;
523 #if ENABLE(TIZEN_PLUGIN_PARENT_WINDOW)
524 Evas_Object* parentWindow; /**< application's window used by flash engine to popups and ui gadgets */
526 #if ENABLE(TIZEN_CSS_FIXED_AS_ABSOLUTE)
527 Eina_Bool fixedAsAbsolute: 1;
529 #if ENABLE(TIZEN_CSS_FIXED_FAST_PATH)
530 Eina_Bool fixedFastPath: 1;
532 #if ENABLE(TIZEN_AUTOFOCUS_BLOCK)
533 Eina_Bool showImeOnAutofocus: 1;
535 #if ENABLE(TIZEN_FOCUS_RING)
536 Eina_Bool enableFocusRing: 1;
553 Ecore_Animator* animator;
555 SoupSession* soupSession;
556 #if ENABLE(TIZEN_DROPDOWN_SUPPORT)
557 WebCore::Node* currentSelectedNode;
559 #if ENABLE(TIZEN_FORM_SUBMIT_SUPPORT)
560 Evas_Object* formWindow;
561 const char* frameName;
563 #if ENABLE(TIZEN_WEBCORE_SELECTIVE_RENDERING)
564 Eina_Bool delaysHeavyTiles;
566 #if ENABLE(TIZEN_PAGE_CACHE)
567 Ewk_View_Pagecache_Data cachedPageData;
569 #if ENABLE(TIZEN_RECORDING_SURFACE)
570 Eina_Bool callOnceAfterLoadFinished;
571 Eina_Bool recordingSurfaceEnable;
572 Eina_List * recordingSurfaceSetList;
573 int recordingSurfaceSetState;
574 Eina_Bool recordingSurfaceSetLoadFinished;
575 Eina_Bool recordingSurfaceSetScrollState;
577 const char* cursorGroup;
578 Evas_Object* cursorObject;
584 #if ENABLE(TIZEN_SMART_CLASS_TYPE_STR)
586 #ifndef EWK_TYPE_CHECK
587 #define EWK_VIEW_TYPE_CHECK(ewkView, ...) do { } while (0)
589 #define EWK_VIEW_TYPE_CHECK(ewkView, ...) \
591 const char *_tmp_otype = evas_object_type_get(ewkView); \
592 const Evas_Smart *_tmp_s = evas_object_smart_smart_get(ewkView); \
593 if (EINA_UNLIKELY(!_tmp_s)) { \
595 ("%p (%s) is not a smart object!", ewkView, \
596 _tmp_otype ? _tmp_otype : "(null)"); \
597 return __VA_ARGS__; \
599 const Evas_Smart_Class *_tmp_sc = evas_smart_class_get(_tmp_s); \
600 if (EINA_UNLIKELY(!_tmp_sc)) { \
602 ("%p (%s) is not a smart object!", ewkView, \
603 _tmp_otype ? _tmp_otype : "(null)"); \
604 return __VA_ARGS__; \
606 if (EINA_UNLIKELY(!_tmp_sc->data)) { \
607 EINA_LOG_CRIT("%p (null) is not of an ewk_view", ewkView); \
608 return __VA_ARGS__; \
610 if (EINA_UNLIKELY(strncmp((char*)_tmp_sc->data, ewkViewTypeString, strlen(ewkViewTypeString)))) { \
612 ("%p (%s) is not of an ewk_view (need %p, got %p)!", \
613 ewkView, _tmp_otype ? _tmp_otype : "(null)", \
614 ewkViewTypeString, _tmp_sc->data); \
615 return __VA_ARGS__; \
620 #else //ENABLE(TIZEN_SMART_CLASS_TYPE_STR)
622 #ifndef EWK_TYPE_CHECK
623 #define EWK_VIEW_TYPE_CHECK(ewkView, ...) do { } while (0)
625 #define EWK_VIEW_TYPE_CHECK(ewkView, ...) \
627 const char* _tmp_otype = evas_object_type_get(ewkView); \
628 const Evas_Smart* _tmp_s = evas_object_smart_smart_get(ewkView); \
629 if (EINA_UNLIKELY(!_tmp_s)) { \
631 ("%p (%s) is not a smart object!", ewkView, \
632 _tmp_otype ? _tmp_otype : "(null)"); \
633 return __VA_ARGS__; \
635 const Evas_Smart_Class* _tmp_sc = evas_smart_class_get(_tmp_s); \
636 if (EINA_UNLIKELY(!_tmp_sc)) { \
638 ("%p (%s) is not a smart object!", ewkView, \
639 _tmp_otype ? _tmp_otype : "(null)"); \
640 return __VA_ARGS__; \
642 if (EINA_UNLIKELY(_tmp_sc->data != ewkViewTypeString)) { \
644 ("%p (%s) is not of an ewk_view (need %p, got %p)!", \
645 ewkView, _tmp_otype ? _tmp_otype : "(null)", \
646 ewkViewTypeString, _tmp_sc->data); \
647 return __VA_ARGS__; \
654 #define EWK_VIEW_SD_GET(ewkView, pointer) \
655 Ewk_View_Smart_Data* pointer = static_cast<Ewk_View_Smart_Data*>(evas_object_smart_data_get(ewkView))
657 #define EWK_VIEW_SD_GET_OR_RETURN(ewkView, pointer, ...) \
658 EWK_VIEW_TYPE_CHECK(ewkView, __VA_ARGS__); \
659 EWK_VIEW_SD_GET(ewkView, pointer); \
661 CRITICAL("no smart data for object %p (%s)", \
662 ewkView, evas_object_type_get(ewkView)); \
663 return __VA_ARGS__; \
666 #define EWK_VIEW_PRIV_GET(smartData, pointer) \
667 Ewk_View_Private_Data* pointer = smartData->_priv
669 #define EWK_VIEW_PRIV_GET_OR_RETURN(smartData, pointer, ...) \
670 EWK_VIEW_PRIV_GET(smartData, pointer); \
672 CRITICAL("no private data for object %p (%s)", \
673 smartData->self, evas_object_type_get(smartData->self)); \
674 return __VA_ARGS__; \
678 * Iterating through frame tree. For each node in frame tree, delivered function is invoked
680 * @param [in] frame which will be iterated
681 * @param [in] pointer to function which will be invoked
682 * @param [in] data which will be passed to fun
684 void _iterate_frames(WebCore::Frame* frameIt, void (*fun)(WebCore::Frame* frame, void* data), void* data)
686 WebCore::FrameTree* frameTree = frameIt->tree();
687 for (unsigned int i = 0; i < frameTree->childCount(); ++i) {
688 WebCore::Frame* child = frameTree->child(i);
689 _iterate_frames(child, fun, data);
694 #if ENABLE(TIZEN_WEBCORE_SELECTIVE_RENDERING)
695 static Eina_Bool _ewk_view_update_delayed_updates(Ewk_View_Smart_Data* smartData)
697 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
699 WebCore::FrameView* view = priv->mainFrame->view();
700 Eina_Bool old = priv->delaysHeavyTiles;
701 priv->delaysHeavyTiles = false;
703 view->paintDelayedUpdateRegions();
704 priv->delaysHeavyTiles = old;
710 static void _ewk_view_smart_changed(Ewk_View_Smart_Data* smartData)
712 if (smartData->changed.any)
714 smartData->changed.any = true;
715 evas_object_smart_changed(smartData->self);
718 static Eina_Bool _ewk_view_repaints_resize(Ewk_View_Private_Data* priv, size_t size)
720 void* tmp = realloc(priv->repaints.array, size * sizeof(Eina_Rectangle));
722 CRITICAL("could not realloc repaints array to %zu elements.", size);
725 priv->repaints.allocated = size;
726 priv->repaints.array = static_cast<Eina_Rectangle*>(tmp);
730 static void _ewk_view_repaint_add(Ewk_View_Private_Data* priv, Evas_Coord x, Evas_Coord y, Evas_Coord width, Evas_Coord height)
734 if (priv->repaints.allocated == priv->repaints.count)
735 newSize = priv->repaints.allocated + ewkViewRepaintsSizeStep;
736 else if (!priv->repaints.count && priv->repaints.allocated > ewkViewRepaintsSizeInitial)
737 newSize = ewkViewRepaintsSizeInitial;
740 if (!_ewk_view_repaints_resize(priv, newSize))
744 Eina_Rectangle* rect = priv->repaints.array + priv->repaints.count;
745 priv->repaints.count++;
752 DBG("add repaint %d, %d+%dx%d", x, y, width, height);
755 static void _ewk_view_repaints_flush(Ewk_View_Private_Data* priv)
757 priv->repaints.count = 0;
758 if (priv->repaints.allocated <= ewkViewRepaintsSizeMaximumFree)
760 _ewk_view_repaints_resize(priv, ewkViewRepaintsSizeMaximumFree);
763 static Eina_Bool _ewk_view_scrolls_resize(Ewk_View_Private_Data* priv, size_t size)
765 void* tmp = realloc(priv->scrolls.array, size * sizeof(Ewk_Scroll_Request));
767 CRITICAL("could not realloc scrolls array to %zu elements.", size);
770 priv->scrolls.allocated = size;
771 priv->scrolls.array = static_cast<Ewk_Scroll_Request*>(tmp);
775 static void _ewk_view_scroll_add(Ewk_View_Private_Data* priv, Evas_Coord deltaX, Evas_Coord deltaY, Evas_Coord x, Evas_Coord y, Evas_Coord width, Evas_Coord height)
777 Ewk_Scroll_Request* rect;
778 Ewk_Scroll_Request* rect_end;
779 Evas_Coord x2 = x + width, y2 = y + height;
781 rect = priv->scrolls.array;
782 rect_end = rect + priv->scrolls.count;
783 for (; rect < rect_end; rect++) {
784 if (rect->x == x && rect->y == y && rect->w == width && rect->h == height) {
785 DBG("region already scrolled %d,%d+%dx%d %+03d,%+03d add "
787 rect->x, rect->y, rect->w, rect->h, rect->dx, rect->dy, deltaX, deltaY);
792 if ((x <= rect->x && x2 >= rect->x2) && (y <= rect->y && y2 >= rect->y2)) {
793 DBG("old viewport (%d,%d+%dx%d %+03d,%+03d) was scrolled itself, "
795 rect->x, rect->y, rect->w, rect->h, rect->dx, rect->dy, deltaX, deltaY);
801 if (priv->scrolls.allocated == priv->scrolls.count) {
803 if (!priv->scrolls.allocated)
804 size = ewkViewScrollsSizeInitial;
806 size = priv->scrolls.allocated + ewkViewScrollsSizeStep;
807 if (!_ewk_view_scrolls_resize(priv, size))
811 rect = priv->scrolls.array + priv->scrolls.count;
812 priv->scrolls.count++;
822 DBG("add scroll in region: %d, %d+%dx%d %+03d, %+03d", x, y, width, height, deltaX, deltaY);
824 #if !ENABLE(TIZEN_SCROLL_ADDING_FIX)
826 Eina_Rectangle* pr_end;
828 pr = priv->repaints.array;
829 count = priv->repaints.count;
831 for (; pr < pr_end; pr++) {
838 static void _ewk_view_scrolls_flush(Ewk_View_Private_Data* priv)
840 priv->scrolls.count = 0;
841 if (priv->scrolls.allocated <= ewkViewScrollsSizeMaximumFree)
843 _ewk_view_scrolls_resize(priv, ewkViewScrollsSizeMaximumFree);
846 // Default Event Handling //////////////////////////////////////////////
847 static Eina_Bool _ewk_view_smart_focus_in(Ewk_View_Smart_Data* smartData)
849 EWK_VIEW_PRIV_GET(smartData, priv);
850 WebCore::FocusController* focusController = priv->page->focusController();
851 DBG("ewkView=%p, focusController=%p", smartData->self, focusController);
852 EINA_SAFETY_ON_NULL_RETURN_VAL(focusController, false);
854 focusController->setActive(true);
855 focusController->setFocused(true);
856 #if ENABLE(TIZEN_SHOW_IME_ON_FOCUS_IN)
857 WebCore::Frame* focusedFrame = focusController->focusedOrMainFrame();
859 && focusedFrame->document()
860 && focusedFrame->document()->focusedNode())
861 priv->page->editorClient()->setInputMethodState(focusedFrame->document()->focusedNode()->shouldUseInputMethod());
866 static Eina_Bool _ewk_view_smart_focus_out(Ewk_View_Smart_Data* smartData)
868 EWK_VIEW_PRIV_GET(smartData, priv);
869 #if ENABLE(TIZEN_ISF_PORT)
870 // input panel should be hided when webview is focused out.
871 // actually, it is the normal operation and input panel should be hided without this patch.
872 // However, we do not show/hide ime when we are not click the any area,
873 // because of html5demos.com/contenteditable issue in the EditClientEfl.cpp.
874 // so, we have to hide input panel explicitly here.
875 if (priv && priv->imContext) {
876 ecore_imf_context_input_panel_hide(priv->imContext);
877 ecore_imf_context_focus_out(priv->imContext);
880 WebCore::FocusController* focusController = priv->page->focusController();
881 DBG("ewkView=%p, fc=%p", smartData->self, focusController);
882 EINA_SAFETY_ON_NULL_RETURN_VAL(focusController, false);
884 focusController->setActive(false);
885 focusController->setFocused(false);
889 static Eina_Bool _ewk_view_smart_mouse_wheel(Ewk_View_Smart_Data* smartData, const Evas_Event_Mouse_Wheel* wheelEvent)
891 return ewk_frame_feed_mouse_wheel(smartData->main_frame, wheelEvent);
894 static Eina_Bool _ewk_view_smart_mouse_down(Ewk_View_Smart_Data* smartData, const Evas_Event_Mouse_Down* downEvent)
896 return ewk_frame_feed_mouse_down(smartData->main_frame, downEvent);
899 static Eina_Bool _ewk_view_smart_mouse_up(Ewk_View_Smart_Data* smartData, const Evas_Event_Mouse_Up* upEvent)
901 return ewk_frame_feed_mouse_up(smartData->main_frame, upEvent);
904 static Eina_Bool _ewk_view_smart_mouse_move(Ewk_View_Smart_Data* smartData, const Evas_Event_Mouse_Move* moveEvent)
906 return ewk_frame_feed_mouse_move(smartData->main_frame, moveEvent);
909 static Eina_Bool _ewk_view_smart_key_down(Ewk_View_Smart_Data* smartData, const Evas_Event_Key_Down* downEvent)
911 Evas_Object* frame = ewk_view_frame_focused_get(smartData->self);
914 frame = smartData->main_frame;
916 return ewk_frame_feed_key_down(frame, downEvent);
919 static Eina_Bool _ewk_view_smart_key_up(Ewk_View_Smart_Data* smartData, const Evas_Event_Key_Up* upEvent)
921 Evas_Object* frame = ewk_view_frame_focused_get(smartData->self);
924 frame = smartData->main_frame;
926 return ewk_frame_feed_key_up(frame, upEvent);
929 static void _ewk_view_smart_add_console_message(Ewk_View_Smart_Data* smartData, const char* message, unsigned int lineNumber, const char* sourceID)
931 INF("console message: %s @%d: %s\n", sourceID, lineNumber, message);
934 static void _ewk_view_smart_run_javascript_alert(Ewk_View_Smart_Data* smartData, Evas_Object* frame, const char* message)
936 INF("javascript alert: %s\n", message);
939 static Eina_Bool _ewk_view_smart_run_javascript_confirm(Ewk_View_Smart_Data* smartData, Evas_Object* frame, const char* message)
941 INF("javascript confirm: %s", message);
942 INF("javascript confirm (HARD CODED)? YES");
946 static Eina_Bool _ewk_view_smart_should_interrupt_javascript(Ewk_View_Smart_Data* smartData)
948 INF("should interrupt javascript?\n"
949 "\t(HARD CODED) NO");
953 static Eina_Bool _ewk_view_smart_run_javascript_prompt(Ewk_View_Smart_Data* smartData, Evas_Object* frame, const char* message, const char* defaultValue, char** value)
955 *value = strdup("test");
956 Eina_Bool result = true;
957 INF("javascript prompt:\n"
959 "\tdefault value: %s\n"
960 "\tgiving answer: %s\n"
961 "\t button: %s", message, defaultValue, *value, result ? "ok" : "cancel");
966 // Event Handling //////////////////////////////////////////////////////
967 static void _ewk_view_on_focus_in(void* data, Evas*, Evas_Object*, void*)
969 Ewk_View_Smart_Data* smartData = static_cast<Ewk_View_Smart_Data*>(data);
970 EINA_SAFETY_ON_NULL_RETURN(smartData->api);
971 EINA_SAFETY_ON_NULL_RETURN(smartData->api->focus_in);
972 smartData->api->focus_in(smartData);
975 static void _ewk_view_on_focus_out(void* data, Evas*, Evas_Object*, void*)
977 Ewk_View_Smart_Data* smartData = static_cast<Ewk_View_Smart_Data*>(data);
978 EINA_SAFETY_ON_NULL_RETURN(smartData->api);
979 EINA_SAFETY_ON_NULL_RETURN(smartData->api->focus_out);
980 smartData->api->focus_out(smartData);
983 static void _ewk_view_on_mouse_wheel(void* data, Evas*, Evas_Object*, void* eventInfo)
985 Evas_Event_Mouse_Wheel* wheelEvent = static_cast<Evas_Event_Mouse_Wheel*>(eventInfo);
986 Ewk_View_Smart_Data* smartData = static_cast<Ewk_View_Smart_Data*>(data);
987 EINA_SAFETY_ON_NULL_RETURN(smartData->api);
988 EINA_SAFETY_ON_NULL_RETURN(smartData->api->mouse_wheel);
989 smartData->api->mouse_wheel(smartData, wheelEvent);
992 static void _ewk_view_on_mouse_down(void* data, Evas*, Evas_Object*, void* eventInfo)
994 Evas_Event_Mouse_Down* downEvent = static_cast<Evas_Event_Mouse_Down*>(eventInfo);
995 Ewk_View_Smart_Data* smartData = static_cast<Ewk_View_Smart_Data*>(data);
996 EINA_SAFETY_ON_NULL_RETURN(smartData->api);
997 EINA_SAFETY_ON_NULL_RETURN(smartData->api->mouse_down);
998 smartData->api->mouse_down(smartData, downEvent);
1001 static void _ewk_view_on_mouse_up(void* data, Evas*, Evas_Object*, void* eventInfo)
1003 Evas_Event_Mouse_Up* upEvent = static_cast<Evas_Event_Mouse_Up*>(eventInfo);
1004 Ewk_View_Smart_Data* smartData = static_cast<Ewk_View_Smart_Data*>(data);
1005 EINA_SAFETY_ON_NULL_RETURN(smartData->api);
1006 EINA_SAFETY_ON_NULL_RETURN(smartData->api->mouse_up);
1007 smartData->api->mouse_up(smartData, upEvent);
1010 static void _ewk_view_on_mouse_move(void* data, Evas*, Evas_Object*, void* eventInfo)
1012 Evas_Event_Mouse_Move* moveEvent = static_cast<Evas_Event_Mouse_Move*>(eventInfo);
1013 Ewk_View_Smart_Data* smartData = static_cast<Ewk_View_Smart_Data*>(data);
1014 EINA_SAFETY_ON_NULL_RETURN(smartData->api);
1015 EINA_SAFETY_ON_NULL_RETURN(smartData->api->mouse_move);
1016 smartData->api->mouse_move(smartData, moveEvent);
1019 static void _ewk_view_on_key_down(void* data, Evas*, Evas_Object*, void* eventInfo)
1021 Evas_Event_Key_Down* downEvent = static_cast<Evas_Event_Key_Down*>(eventInfo);
1022 Ewk_View_Smart_Data* smartData = static_cast<Ewk_View_Smart_Data*>(data);
1023 EINA_SAFETY_ON_NULL_RETURN(smartData->api);
1024 EINA_SAFETY_ON_NULL_RETURN(smartData->api->key_down);
1025 #if ENABLE(TIZEN_ISF_PORT)
1026 EWK_VIEW_PRIV_GET(smartData, priv);
1027 Ecore_IMF_Event_Key_Down ecore_ev;
1028 ecore_imf_evas_event_key_down_wrap(downEvent, &ecore_ev);
1029 if (ecore_imf_context_filter_event(priv->imContext, ECORE_IMF_EVENT_KEY_DOWN, (Ecore_IMF_Event*)&ecore_ev))
1032 smartData->api->key_down(smartData, downEvent);
1035 static void _ewk_view_on_key_up(void* data, Evas*, Evas_Object*, void* eventInfo)
1037 Evas_Event_Key_Up* upEvent = static_cast<Evas_Event_Key_Up*>(eventInfo);
1038 Ewk_View_Smart_Data* smartData = static_cast<Ewk_View_Smart_Data*>(data);
1039 EINA_SAFETY_ON_NULL_RETURN(smartData->api);
1040 EINA_SAFETY_ON_NULL_RETURN(smartData->api->key_up);
1041 smartData->api->key_up(smartData, upEvent);
1044 #if ENABLE(TIZEN_PRE_RENDERING_ENABLE)
1045 static void _ewk_view_on_pan_end(void* data, Evas_Object* ewkView, void*)
1047 Ewk_View_Smart_Data* smartData = static_cast<Ewk_View_Smart_Data*>(data);
1048 EINA_SAFETY_ON_NULL_RETURN(smartData->api->pre_render_start);
1050 smartData->api->pre_render_start(smartData, false);
1054 static WTF::PassRefPtr<WebCore::Frame> _ewk_view_core_frame_new(Ewk_View_Smart_Data* smartData, Ewk_View_Private_Data* priv, WebCore::HTMLFrameOwnerElement* owner)
1056 WebCore::FrameLoaderClientEfl* frameLoaderClient = new WebCore::FrameLoaderClientEfl(smartData->self);
1057 frameLoaderClient->setCustomUserAgent(String::fromUTF8(priv->settings.userAgent));
1058 #if ENABLE(TIZEN_CUSTOM_HEADERS)
1059 frameLoaderClient->setCustomHeaders(priv->settings.customHeaders);
1062 return WebCore::Frame::create(priv->page.get(), owner, frameLoaderClient);
1065 static Evas_Smart_Class _parent_sc = EVAS_SMART_CLASS_INIT_NULL;
1067 static Ewk_View_Private_Data* _ewk_view_priv_new(Ewk_View_Smart_Data* smartData)
1069 Ewk_View_Private_Data* priv = new Ewk_View_Private_Data;
1070 memset(priv, 0, sizeof(Ewk_View_Private_Data));
1071 AtomicString string;
1074 #if ENABLE(TIZEN_ISF_PORT)
1077 const char* ctx_id = ecore_imf_context_default_id_get();
1079 priv->imContext = ecore_imf_context_add(ctx_id);
1081 smartData->_priv = priv;
1084 WebCore::Page::PageClients pageClients;
1085 pageClients.chromeClient = new WebCore::ChromeClientEfl(smartData->self);
1086 pageClients.editorClient = new WebCore::EditorClientEfl(smartData->self);
1087 pageClients.dragClient = new WebCore::DragClientEfl;
1088 #if ENABLE(TIZEN_CONTEXT_MENU)
1089 pageClients.contextMenuClient = static_cast<WebCore::ContextMenuClient*>(new WebCore::ContextMenuClientEfl(smartData->self));
1092 #if ENABLE(TIZEN_REMOTE_WEB_INSPECTOR)
1093 pageClients.inspectorClient = new WebCore::InspectorClientEfl(smartData->self);
1095 pageClients.inspectorClient = new WebCore::InspectorClientEfl;
1098 #if ENABLE(TIZEN_INSTALL_CONTENT)
1099 pageClients.installContentClient = static_cast<WebCore::InstallContentClient*>(new WebCore::InstallContentClientEfl(smartData->self));
1101 priv->page = adoptPtr(new WebCore::Page(pageClients));
1102 #if ENABLE(TIZEN_VIEW_MODE)
1103 priv->page->setViewMode(WebCore::Page::ViewModeMaximized);
1106 #if ENABLE(DEVICE_ORIENTATION)
1107 WebCore::provideDeviceMotionTo(priv->page.get(), new WebCore::DeviceMotionClientEfl);
1108 WebCore::provideDeviceOrientationTo(priv->page.get(), new WebCore::DeviceOrientationClientEfl);
1111 #if ENABLE(TIZEN_NOTIFICATION)
1112 #if ENABLE(NOTIFICATIONS)
1113 WebCore::provideNotification(priv->page.get(), new WebCore::NotificationClientEfl(smartData->self));
1117 #if ENABLE(NETWORK_INFO)
1118 priv->networkInfoClient = adoptPtr(new WebCore::NetworkInfoClientEfl);
1119 WebCore::provideNetworkInfoTo(priv->page.get(), priv->networkInfoClient.get());
1122 #if ENABLE(VIBRATION)
1123 WebCore::provideVibrationTo(priv->page.get(), new WebCore::VibrationClientEfl(smartData->self));
1126 #if ENABLE(BATTERY_STATUS)
1127 WebCore::provideBatteryTo(priv->page.get(), new BatteryClientEfl);
1130 priv->pageSettings = priv->page->settings();
1132 priv->viewportArguments.width = WebCore::ViewportArguments::ValueAuto;
1133 priv->viewportArguments.height = WebCore::ViewportArguments::ValueAuto;
1134 priv->viewportArguments.initialScale = WebCore::ViewportArguments::ValueAuto;
1135 priv->viewportArguments.minimumScale = WebCore::ViewportArguments::ValueAuto;
1136 priv->viewportArguments.maximumScale = WebCore::ViewportArguments::ValueAuto;
1137 priv->viewportArguments.targetDensityDpi = WebCore::ViewportArguments::ValueAuto;
1138 priv->viewportArguments.userScalable = true;
1140 #if ENABLE(TIZEN_VIEWPORT_META_TAG)
1141 priv->viewportAttributes.width = WebCore::ViewportArguments::ValueAuto;
1142 priv->viewportAttributes.height = WebCore::ViewportArguments::ValueAuto;
1143 priv->viewportAttributes.initial_scale = WebCore::ViewportArguments::ValueAuto;
1144 priv->viewportAttributes.minimum_scale = WebCore::ViewportArguments::ValueAuto;
1145 priv->viewportAttributes.maximum_scale = WebCore::ViewportArguments::ValueAuto;
1146 priv->viewportAttributes.device_pixel_ratio = devicePixelRatio;
1147 priv->viewportAttributes.user_scalable = true;
1148 #if ENABLE(TIZEN_VIEWPORT_ORIENTATION)
1149 priv->viewportAttributes.orientation = EWK_VIEWPORT_ORIENTATION_AUTO;
1153 priv->pageSettings->setLoadsImagesAutomatically(true);
1154 priv->pageSettings->setDefaultFixedFontSize(12);
1155 priv->pageSettings->setDefaultFontSize(16);
1156 priv->pageSettings->setSerifFontFamily("serif");
1157 priv->pageSettings->setFixedFontFamily("monotype");
1158 priv->pageSettings->setSansSerifFontFamily("sans");
1159 priv->pageSettings->setStandardFontFamily("sans");
1160 priv->pageSettings->setHyperlinkAuditingEnabled(false);
1161 priv->pageSettings->setScriptEnabled(true);
1162 priv->pageSettings->setPluginsEnabled(true);
1163 priv->pageSettings->setLocalStorageEnabled(true);
1164 #if ENABLE(TIZEN_WEB_AUDIO)
1165 priv->pageSettings->setWebAudioEnabled(true);
1167 priv->pageSettings->setOfflineWebApplicationCacheEnabled(true);
1168 priv->pageSettings->setUsesPageCache(true);
1169 #if ENABLE(TIZEN_REMOTE_WEB_INSPECTOR)
1170 priv->pageSettings->setDeveloperExtrasEnabled(true);
1172 #if ENABLE(TIZEN_ENCODING_DETECTOR_TRUE)
1173 priv->pageSettings->setUsesEncodingDetector(true);
1175 priv->pageSettings->setUsesEncodingDetector(false);
1177 #if ENABLE(WEB_AUDIO)
1178 priv->pageSettings->setWebAudioEnabled(false);
1180 priv->pageSettings->setWebGLEnabled(true);
1181 #if ENABLE(TIZEN_PASSWORD_SHOW_PATCH)
1182 priv->pageSettings->setPasswordEchoEnabled(true);
1183 priv->pageSettings->setPasswordEchoDurationInSeconds(1);
1185 priv->pageSettings->setXSSAuditorEnabled(true);
1186 #if ENABLE(FULLSCREEN_API)
1187 priv->pageSettings->setFullScreenEnabled(true);
1190 url = priv->pageSettings->userStyleSheetLocation();
1191 priv->settings.userStylesheet = eina_stringshare_add(url.string().utf8().data());
1193 priv->settings.encodingDefault = eina_stringshare_add
1194 (priv->pageSettings->defaultTextEncodingName().utf8().data());
1195 priv->settings.encodingCustom = 0;
1197 string = priv->pageSettings->localStorageDatabasePath();
1198 priv->settings.localStorageDatabasePath = eina_stringshare_add(string.string().utf8().data());
1200 priv->settings.fontMinimumSize = priv->pageSettings->minimumFontSize();
1201 priv->settings.fontMinimumLogicalSize = priv->pageSettings->minimumLogicalFontSize();
1202 priv->settings.fontDefaultSize = priv->pageSettings->defaultFontSize();
1203 priv->settings.fontMonospaceSize = priv->pageSettings->defaultFixedFontSize();
1205 string = priv->pageSettings->standardFontFamily();
1206 priv->settings.fontStandard = eina_stringshare_add(string.string().utf8().data());
1207 string = priv->pageSettings->cursiveFontFamily();
1208 priv->settings.fontCursive = eina_stringshare_add(string.string().utf8().data());
1209 string = priv->pageSettings->fixedFontFamily();
1210 priv->settings.fontMonospace = eina_stringshare_add(string.string().utf8().data());
1211 string = priv->pageSettings->fantasyFontFamily();
1212 priv->settings.fontFantasy = eina_stringshare_add(string.string().utf8().data());
1213 string = priv->pageSettings->serifFontFamily();
1214 priv->settings.fontSerif = eina_stringshare_add(string.string().utf8().data());
1215 string = priv->pageSettings->sansSerifFontFamily();
1216 priv->settings.fontSansSerif = eina_stringshare_add(string.string().utf8().data());
1218 priv->settings.autoLoadImages = priv->pageSettings->loadsImagesAutomatically();
1219 priv->settings.autoShrinkImages = priv->pageSettings->shrinksStandaloneImagesToFit();
1220 priv->settings.enableAutoResizeWindow = true;
1221 priv->settings.enableDeveloperExtras = priv->pageSettings->developerExtrasEnabled();
1222 priv->settings.enableScripts = priv->pageSettings->isScriptEnabled();
1223 priv->settings.enablePlugins = priv->pageSettings->arePluginsEnabled();
1224 priv->settings.enableFrameFlattening = priv->pageSettings->frameFlatteningEnabled();
1225 #if ENABLE(TIZEN_ONSCROLL_EVENT_SUPPRESSION)
1226 priv->settings.enableOnscrollEventSuppression = priv->pageSettings->onscrollEventSuppressionEnabled();
1228 #if !ENABLE(TIZEN_DAILY_UPVERSIONING)
1229 priv->settings.scriptsWindowOpen = priv->pageSettings->allowScriptsToCloseWindows();
1231 priv->settings.enableXSSAuditor = priv->pageSettings->xssAuditorEnabled();
1232 priv->settings.hyperlinkAuditingEnabled = priv->pageSettings->hyperlinkAuditingEnabled();
1233 priv->settings.scriptsCanOpenWindows = priv->pageSettings->javaScriptCanOpenWindowsAutomatically();
1234 #if ENABLE(TIZEN_WEBKIT_EFL_DRT)
1235 priv->settings.scriptsWindowClose = priv->pageSettings->allowScriptsToCloseWindows();
1237 #if ENABLE(TIZEN_ONSCROLL_EVENT_SUPPRESSION)
1238 priv->settings.enableOnscrollEventSuppression = priv->pageSettings->onscrollEventSuppressionEnabled();
1240 priv->settings.scriptsCanCloseWindows = priv->pageSettings->allowScriptsToCloseWindows();
1241 #if ENABLE(VIDEO_TRACK)
1242 priv->settings.shouldDisplayCaptions = priv->pageSettings->shouldDisplayCaptions();
1243 priv->settings.shouldDisplaySubtitles = priv->pageSettings->shouldDisplaySubtitles();
1244 priv->settings.shouldDisplayTextDescriptions = priv->pageSettings->shouldDisplayTextDescriptions();
1246 priv->settings.scriptsCanAccessClipboard = priv->pageSettings->javaScriptCanAccessClipboard() && priv->pageSettings->isDOMPasteAllowed();
1247 priv->settings.resizableTextareas = priv->pageSettings->textAreasAreResizable();
1248 priv->settings.privateBrowsing = priv->pageSettings->privateBrowsingEnabled();
1249 priv->settings.caretBrowsing = priv->pageSettings->caretBrowsingEnabled();
1250 priv->settings.spatialNavigation = priv->pageSettings->isSpatialNavigationEnabled();
1251 priv->settings.localStorage = priv->pageSettings->localStorageEnabled();
1252 #if ENABLE(TIZEN_WEB_AUDIO)
1253 priv->settings.webAudio = priv->pageSettings->webAudioEnabled();
1255 priv->settings.offlineAppCache = true; // XXX no function to read setting; this keeps the original setting
1256 priv->settings.pageCache = priv->pageSettings->usesPageCache();
1257 priv->settings.encodingDetector = priv->pageSettings->usesEncodingDetector();
1258 priv->settings.webGLEnabled = priv->pageSettings->webGLEnabled();
1259 priv->settings.tabsToLinks = true;
1261 priv->settings.userAgent = ewk_settings_default_user_agent_get();
1262 #if ENABLE(WEB_AUDIO)
1263 priv->settings.webAudio = priv->pageSettings->webAudioEnabled();
1266 // Since there's no scale separated from zooming in webkit-efl, this functionality of
1267 // viewport meta tag is implemented using zoom. When scale zoom is supported by webkit-efl,
1268 // this functionality will be modified by the scale zoom patch.
1269 priv->settings.zoomRange.minScale = zoomMinimum;
1270 priv->settings.zoomRange.maxScale = zoomMaximum;
1271 priv->settings.zoomRange.userScalable = true;
1272 priv->settings.devicePixelRatio = devicePixelRatio;
1274 priv->settings.domTimerInterval = priv->pageSettings->defaultMinDOMTimerInterval();
1276 #if ENABLE(TIZEN_PLUGIN_PARENT_WINDOW)
1277 priv->settings.parentWindow = 0;
1279 #if ENABLE(TIZEN_CSS_FIXED_AS_ABSOLUTE)
1280 priv->settings.fixedAsAbsolute = false;
1281 priv->pageSettings->setFixedAsAbsoluteEnabled(false);
1283 #if ENABLE(TIZEN_CSS_FIXED_FAST_PATH)
1284 priv->settings.fixedFastPath = true;
1285 priv->pageSettings->setFixedFastPathImprovementsEnabled(true);
1287 #if ENABLE(TIZEN_AUTOFOCUS_BLOCK)
1288 priv->settings.showImeOnAutofocus = true;
1290 #if ENABLE(TIZEN_GEOLOCATION)
1291 priv->settings.geolocation = 0;
1292 priv->pageSettings->setGeolocationEnabled(false);
1294 #if ENABLE(TIZEN_FOCUS_RING)
1295 priv->settings.enableFocusRing = priv->pageSettings->isFocusRingEnabled();
1298 priv->mainFrame = _ewk_view_core_frame_new(smartData, priv, 0).get();
1300 priv->history = ewk_history_new(static_cast<WebCore::BackForwardListImpl*>(priv->page->backForwardList()));
1302 priv->soupSession = WebCore::ResourceHandle::defaultSession();
1304 #if ENABLE(TIZEN_REMOTE_WEB_INSPECTOR)
1305 // ewk_view_inspector_server_start(9222);
1308 #if USE(ACCELERATED_COMPOSITING) && ENABLE(TIZEN_ACCELERATED_COMPOSITING)
1309 priv->compositingSurface = 0;
1310 priv->compositingActive = false;
1311 priv->compositor = nullptr;
1312 priv->pageSettings->setAcceleratedCompositingEnabled(true);
1313 priv->pageSettings->setAcceleratedCompositingFor3DTransformsEnabled(true);
1314 priv->pageSettings->setAcceleratedCompositingForAnimationEnabled(false);
1315 priv->pageSettings->setAcceleratedCompositingForVideoEnabled(true);
1316 priv->pageSettings->setAcceleratedCompositingForCanvasEnabled(true);
1317 priv->pageSettings->setAcceleratedCompositingForPluginsEnabled(false);
1318 priv->pageSettings->setWebGLEnabled(true);
1321 #if ENABLE(TIZEN_FULLSCREEN_API)
1322 priv->pageSettings->setFullScreenEnabled(true);
1324 priv->pageClient = adoptPtr(new PageClientEfl(smartData->self));
1326 priv->isUsingEcoreX = WebCore::isUsingEcoreX(smartData->base.evas);
1332 static void _ewk_view_priv_del(Ewk_View_Private_Data* priv)
1337 #if ENABLE(TIZEN_ISF_PORT)
1338 ecore_imf_shutdown();
1341 /* do not delete priv->mainFrame */
1343 free(priv->repaints.array);
1344 free(priv->scrolls.array);
1346 eina_stringshare_del(priv->settings.userAgent);
1347 eina_stringshare_del(priv->settings.userStylesheet);
1348 eina_stringshare_del(priv->settings.encodingDefault);
1349 eina_stringshare_del(priv->settings.encodingCustom);
1350 eina_stringshare_del(priv->settings.fontStandard);
1351 eina_stringshare_del(priv->settings.fontCursive);
1352 eina_stringshare_del(priv->settings.fontMonospace);
1353 eina_stringshare_del(priv->settings.fontFantasy);
1354 eina_stringshare_del(priv->settings.fontSerif);
1355 eina_stringshare_del(priv->settings.fontSansSerif);
1356 eina_stringshare_del(priv->settings.localStorageDatabasePath);
1358 if (priv->animatedZoom.animator)
1359 ecore_animator_del(priv->animatedZoom.animator);
1361 ewk_history_free(priv->history);
1363 #if USE(ACCELERATED_COMPOSITING) && ENABLE(TIZEN_ACCELERATED_COMPOSITING)
1364 priv->compositor.clear();
1365 evas_object_del(priv->compositingSurface);
1366 priv->compositingSurface = 0;
1367 priv->compositingActive = false;
1369 if (priv->cursorObject)
1370 evas_object_del(priv->cursorObject);
1375 #if ENABLE(NETSCAPE_PLUGIN_API) && ENABLE(TIZEN_NPAPI)
1378 * Checking specified HTMLPlugInElement if it is proper running plugin
1380 * @param [in] HTMLPlugInElement to check
1382 * @return PluginView's pointer representing running plugin, or 0 otherwise
1384 WebCore::PluginView* _check_for_running_plugin(WebCore::HTMLPlugInElement* pluginElement)
1389 WebCore::Widget* widget = pluginElement->pluginWidget();
1390 if (widget && widget->isPluginView()) {
1391 WebCore::PluginView* pluginView = static_cast<WebCore::PluginView*>(widget);
1392 if (pluginView && pluginView->isPluginStarted())
1399 * Send TNPEvent to all plugins in specified Frame
1402 * @param [in] pointer to TNPEvent which will be send to plugins
1404 void _send_event_to_all_plugins(WebCore::Frame* frame, void* data)
1406 // plugins can be created as object tag with data attribute or embed tag with src
1407 RefPtr<WebCore::HTMLCollection> objects = frame->document()->objects(); // /< getting all objects from current frame
1408 for (unsigned int i = 0; i < objects->length(); ++i) {
1409 WebCore::Node* node = objects->item(i);
1411 WebCore::HTMLObjectElement* objectElement = static_cast<WebCore::HTMLObjectElement*>(node);
1412 // check this objectElement contains Flash classid.
1413 if ((!objectElement->classId().isEmpty() && objectElement->classId() == WTF::String(FLASH_CLASS_ID))
1414 || (!objectElement->serviceType().isEmpty() && objectElement->serviceType() == WTF::String(FLASH_SERVICE_TYPE))) {
1415 WebCore::PluginView* pluginView = _check_for_running_plugin(static_cast<WebCore::HTMLPlugInElement*>(node));
1417 pluginView->dispatchTNPEvent(static_cast<TNPEvent*>(data));
1422 RefPtr<WebCore::HTMLCollection> plugins = frame->document()->plugins();
1423 for (unsigned int i = 0; i < plugins->length(); ++i) {
1424 WebCore::Node* node = plugins->item(i);
1426 WebCore::HTMLPlugInElement* pluginElement = static_cast<WebCore::HTMLPlugInElement*>(node);
1428 WebCore::PluginView* pluginView = _check_for_running_plugin(pluginElement);
1430 pluginView->dispatchTNPEvent(static_cast<TNPEvent*>(data));
1434 #endif // ENABLE(NETSCAPE_PLUGIN_API) && ENABLE(TIZEN_NPAPI)
1436 #if ENABLE(TIZEN_EVAS_OBJECT_PLUGIN)
1437 Evas_Object* ewk_plugin_store_add(Evas* e);
1439 static Evas_Object* _ewk_view_plugin_store_add(Ewk_View_Smart_Data* smartData)
1441 Evas_Object* bs = ewk_plugin_store_add(smartData->base.evas);
1445 Evas_Object* ewk_plugin_store_add(Evas* e)
1447 static Evas_Smart* smart = 0;
1450 #if ENABLE(TIZEN_SMART_CLASS_TYPE_STR)
1451 static Evas_Smart_Class sc = EVAS_SMART_CLASS_INIT_VERSION;
1452 const char* name = eina_stringshare_add("Ewk_Plugin_Store");
1455 static Evas_Smart_Class sc =
1456 EVAS_SMART_CLASS_INIT_NAME_VERSION("Ewk_Plugin_Store");
1458 evas_object_smart_clipped_smart_set(&sc);
1459 smart = evas_smart_class_new(&sc);
1462 return evas_object_smart_add(e, smart);
1466 static void _ewk_view_smart_add(Evas_Object* ewkView)
1468 const Evas_Smart* smart = evas_object_smart_smart_get(ewkView);
1469 const Evas_Smart_Class* smartClass = evas_smart_class_get(smart);
1470 const Ewk_View_Smart_Class* api = reinterpret_cast<const Ewk_View_Smart_Class*>(smartClass);
1471 EINA_SAFETY_ON_NULL_RETURN(api->backing_store_add);
1472 EWK_VIEW_SD_GET(ewkView, smartData);
1475 smartData = static_cast<Ewk_View_Smart_Data*>(calloc(1, sizeof(Ewk_View_Smart_Data)));
1477 CRITICAL("could not allocate Ewk_View_Smart_Data");
1480 evas_object_smart_data_set(ewkView, smartData);
1483 smartData->bg_color.r = 255;
1484 smartData->bg_color.g = 255;
1485 smartData->bg_color.b = 255;
1486 smartData->bg_color.a = 255;
1488 smartData->self = ewkView;
1489 smartData->api = api;
1491 _parent_sc.add(ewkView);
1493 smartData->_priv = _ewk_view_priv_new(smartData);
1494 if (!smartData->_priv)
1497 EWK_VIEW_PRIV_GET(smartData, priv);
1499 smartData->backing_store = api->backing_store_add(smartData);
1500 if (!smartData->backing_store) {
1501 ERR("Could not create backing store object.");
1505 #if ENABLE(TIZEN_EVAS_OBJECT_PLUGIN)
1506 smartData->plugin_store = _ewk_view_plugin_store_add(smartData);
1507 if (!smartData->plugin_store) {
1508 ERR("Could not create plugin store object.");
1513 #if ENABLE(TIZEN_BG_RECT_SUPPORT)
1514 smartData->bg_rect.bg_rect = evas_object_rectangle_add(smartData->base.evas);
1515 ewk_view_bg_rect_color_set(ewkView, 255, 255, 255, 255);
1516 evas_object_smart_member_add(smartData->bg_rect.bg_rect, ewkView);
1517 evas_object_show(smartData->bg_rect.bg_rect);
1520 evas_object_smart_member_add(smartData->backing_store, ewkView);
1521 evas_object_show(smartData->backing_store);
1522 evas_object_pass_events_set(smartData->backing_store, true);
1524 #if ENABLE(TIZEN_EVAS_OBJECT_PLUGIN)
1525 evas_object_smart_member_add(smartData->plugin_store, ewkView);
1526 evas_object_show(smartData->plugin_store);
1527 // evas_object_pass_events_set(smartData->plugin_store, true);
1530 smartData->events_rect = evas_object_rectangle_add(smartData->base.evas);
1531 evas_object_color_set(smartData->events_rect, 0, 0, 0, 0);
1532 evas_object_smart_member_add(smartData->events_rect, ewkView);
1533 evas_object_show(smartData->events_rect);
1535 smartData->main_frame = ewk_frame_add(smartData->base.evas);
1536 if (!smartData->main_frame) {
1537 ERR("Could not create main frame object.");
1541 if (!ewk_frame_init(smartData->main_frame, ewkView, priv->mainFrame)) {
1542 ERR("Could not initialize main frme object.");
1543 evas_object_del(smartData->main_frame);
1544 smartData->main_frame = 0;
1546 delete priv->mainFrame;
1547 priv->mainFrame = 0;
1551 evas_object_name_set(smartData->main_frame, "EWK_Frame:main");
1552 evas_object_smart_member_add(smartData->main_frame, ewkView);
1553 evas_object_show(smartData->main_frame);
1555 #define CONNECT(s, c) evas_object_event_callback_add(ewkView, s, c, smartData)
1556 CONNECT(EVAS_CALLBACK_FOCUS_IN, _ewk_view_on_focus_in);
1557 CONNECT(EVAS_CALLBACK_FOCUS_OUT, _ewk_view_on_focus_out);
1558 CONNECT(EVAS_CALLBACK_MOUSE_WHEEL, _ewk_view_on_mouse_wheel);
1559 CONNECT(EVAS_CALLBACK_MOUSE_DOWN, _ewk_view_on_mouse_down);
1560 CONNECT(EVAS_CALLBACK_MOUSE_UP, _ewk_view_on_mouse_up);
1561 CONNECT(EVAS_CALLBACK_MOUSE_MOVE, _ewk_view_on_mouse_move);
1562 CONNECT(EVAS_CALLBACK_KEY_DOWN, _ewk_view_on_key_down);
1563 CONNECT(EVAS_CALLBACK_KEY_UP, _ewk_view_on_key_up);
1565 #if ENABLE(TIZEN_PRE_RENDERING_ENABLE)
1566 evas_object_smart_callback_add(ewkView, "pan,end", _ewk_view_on_pan_end, smartData);
1570 static void _ewk_view_smart_del(Evas_Object* ewkView)
1572 EWK_VIEW_SD_GET(ewkView, smartData);
1573 Ewk_View_Private_Data* priv = smartData ? smartData->_priv : 0;
1575 #if ENABLE(TIZEN_RECORDING_SURFACE)
1576 if (smartData->_priv->recordingSurfaceEnable) {
1577 smartData->_priv->recordingSurfaceSetState = RECORDING_SURFACE_SET_STATE_INIT;
1578 smartData->_priv->recordingSurfaceSetList = ewk_recording_surface_set_free(smartData->_priv->recordingSurfaceSetList);
1579 smartData->_priv->recordingSurfaceSetScrollState = false;
1580 smartData->_priv->recordingSurfaceSetLoadFinished = false;
1584 ewk_view_stop(ewkView);
1585 #if ENABLE(TIZEN_ISF_PORT)
1586 if (priv && priv->imContext) {
1587 ecore_imf_context_input_panel_hide(priv->imContext);
1588 ecore_imf_context_del(priv->imContext);
1589 priv->imContext = 0;
1592 #if ENABLE(TIZEN_INSTALL_CONTENT)
1593 WebCore::Page* page = EWKPrivate::corePage(ewkView);
1595 WebCore::InstallContentClient* installContentClient = page->installContentClient();
1596 installContentClient->removeTempDir();
1599 #if !ENABLE(TIZEN_DESTROY_FIX)
1600 _parent_sc.del(ewkView);
1602 evas_object_del(smartData->main_frame);
1605 _ewk_view_priv_del(priv);
1606 #if ENABLE(TIZEN_DESTROY_FIX)
1607 _parent_sc.del(ewkView);
1611 static void _ewk_view_smart_resize(Evas_Object* ewkView, Evas_Coord w, Evas_Coord h)
1613 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
1615 #if ENABLE(TIZEN_ACCELERATED_COMPOSITING)
1616 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
1618 // these should be queued and processed in calculate as well!
1619 evas_object_resize(smartData->backing_store, w, h);
1621 smartData->changed.size = true;
1623 _ewk_view_smart_changed(smartData);
1626 static void _ewk_view_smart_move(Evas_Object* ewkView, Evas_Coord x, Evas_Coord y)
1628 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
1629 smartData->changed.position = true;
1630 _ewk_view_smart_changed(smartData);
1633 static void _ewk_view_smart_calculate(Evas_Object* ewkView)
1635 EWK_VIEW_SD_GET(ewkView, smartData);
1636 EWK_VIEW_PRIV_GET(smartData, priv);
1637 EINA_SAFETY_ON_NULL_RETURN(smartData->api->contents_resize);
1638 EINA_SAFETY_ON_NULL_RETURN(smartData->api->scrolls_process);
1639 EINA_SAFETY_ON_NULL_RETURN(smartData->api->repaints_process);
1640 Evas_Coord x, y, width, height;
1642 smartData->changed.any = false;
1644 if (!smartData->main_frame || !priv->mainFrame)
1647 evas_object_geometry_get(ewkView, &x, &y, &width, &height);
1649 DBG("ewkView=%p geo=[%d, %d + %dx%d], changed: size=%hhu, "
1650 "scrolls=%zu, repaints=%zu",
1651 ewkView, x, y, width, height, smartData->changed.size,
1652 priv->scrolls.count, priv->repaints.count);
1654 if (smartData->changed.size && ((width != smartData->view.w) || (height != smartData->view.h))) {
1655 WebCore::FrameView* view = priv->mainFrame->view();
1657 view->resize(width, height);
1658 view->forceLayout();
1659 view->adjustViewSize();
1661 evas_object_resize(smartData->main_frame, width, height);
1662 evas_object_resize(smartData->events_rect, width, height);
1663 #if ENABLE(TIZEN_BG_RECT_SUPPORT)
1664 evas_object_resize(smartData->bg_rect.bg_rect, width, height);
1666 smartData->changed.frame_rect = true;
1667 smartData->view.w = width;
1668 smartData->view.h = height;
1670 _ewk_view_repaint_add(priv, 0, 0, width, height);
1671 #if ENABLE(TIZEN_ACCELERATED_COMPOSITING)
1672 if (priv->compositingActive) {
1673 evas_object_image_native_surface_set(priv->compositingSurface, 0);
1674 evas_object_image_size_set(priv->compositingSurface, width, height);
1676 priv->compositor->resize(priv->compositingSurface);
1678 evas_object_resize(priv->compositingSurface, width, height);
1680 ewk_view_mark_for_sync(ewkView, false);
1683 // This callback is a good place e.g. to change fixed layout size (ewk_view_fixed_layout_size_set).
1684 evas_object_smart_callback_call(ewkView, "view,resized", 0);
1686 smartData->changed.size = false;
1688 if (smartData->changed.position && ((x != smartData->view.x) || (y != smartData->view.y))) {
1689 evas_object_move(smartData->main_frame, x, y);
1690 evas_object_move(smartData->backing_store, x, y);
1691 evas_object_move(smartData->events_rect, x, y);
1692 #if ENABLE(TIZEN_BG_RECT_SUPPORT)
1693 evas_object_move(smartData->bg_rect.bg_rect, x, y);
1695 #if USE(ACCELERATED_COMPOSITING) && ENABLE(TIZEN_ACCELERATED_COMPOSITING)
1696 if (priv->compositingSurface)
1697 evas_object_move(priv->compositingSurface, x, y);
1699 smartData->changed.frame_rect = true;
1700 smartData->view.x = x;
1701 smartData->view.y = y;
1703 smartData->changed.position = false;
1705 if (!smartData->api->scrolls_process(smartData))
1706 ERR("failed to process scrolls.");
1707 _ewk_view_scrolls_flush(priv);
1709 if (!smartData->api->repaints_process(smartData))
1710 ERR("failed to process repaints.");
1712 if (smartData->changed.frame_rect) {
1713 WebCore::FrameView* view = priv->mainFrame->view();
1714 view->frameRectsChanged(); /* force tree to get position from root */
1715 smartData->changed.frame_rect = false;
1719 static void _ewk_view_smart_show(Evas_Object* ewkView)
1721 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
1723 #if ENABLE(TIZEN_RECORDING_SURFACE)
1724 if (smartData->_priv->recordingSurfaceEnable) {
1725 unsigned int cnt = eina_list_count(smartData->_priv->recordingSurfaceSetList);
1727 if (smartData->_priv->recordingSurfaceSetLoadFinished && !cnt) {
1728 float zoom = ewk_view_zoom_get(ewkView);
1729 smartData->_priv->recordingSurfaceSetState = RECORDING_SURFACE_SET_STATE_INIT;
1730 smartData->_priv->recordingSurfaceSetList = ewk_recording_surface_set_free(smartData->_priv->recordingSurfaceSetList);
1731 smartData->_priv->recordingSurfaceSetList = ewk_recording_surface_set_base_record(smartData->_priv->recordingSurfaceSetList, ewkView, zoom);
1732 smartData->_priv->recordingSurfaceSetState = RECORDING_SURFACE_SET_STATE_COMPLETE;
1737 #if ENABLE(TIZEN_VIEW_ACTIVE_SET)
1738 ewk_view_active_set(ewkView, true);
1741 if (evas_object_clipees_get(smartData->base.clipper))
1742 evas_object_show(smartData->base.clipper);
1743 evas_object_show(smartData->backing_store);
1746 static void _ewk_view_smart_hide(Evas_Object* ewkView)
1748 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
1750 #if ENABLE(TIZEN_RECORDING_SURFACE)
1751 if (smartData->_priv->recordingSurfaceEnable) {
1752 smartData->_priv->recordingSurfaceSetState = RECORDING_SURFACE_SET_STATE_INIT;
1753 smartData->_priv->recordingSurfaceSetList = ewk_recording_surface_set_free(smartData->_priv->recordingSurfaceSetList);
1754 smartData->_priv->recordingSurfaceSetScrollState = false;
1755 smartData->_priv->recordingSurfaceSetLoadFinished = false;
1759 evas_object_hide(smartData->base.clipper);
1760 evas_object_hide(smartData->backing_store);
1762 #if ENABLE(TIZEN_VIEW_ACTIVE_SET)
1763 ewk_view_active_set(ewkView, false);
1767 static Eina_Bool _ewk_view_smart_contents_resize(Ewk_View_Smart_Data* smartData, int width, int height)
1772 static Eina_Bool _ewk_view_smart_zoom_set(Ewk_View_Smart_Data* smartData, float zoom, Evas_Coord centerX, Evas_Coord centerY)
1774 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
1776 float currentScaleFactor = ewk_view_scale_get(smartData->self);
1777 if (currentScaleFactor == -1)
1781 ewk_frame_scroll_pos_get(smartData->main_frame, &x, &y);
1783 x = static_cast<int>(((x + centerX) / currentScaleFactor) * zoom) - centerX;
1784 y = static_cast<int>(((y + centerY) / currentScaleFactor) * zoom) - centerY;
1786 priv->page->setPageScaleFactor(zoom, WebCore::LayoutPoint(x, y));
1788 #if ENABLE(TIZEN_PLUGIN_EXT)
1789 /* update plugins position after weak zoom even if view's size and position were not changed
1790 to enusure plugins position after zoom bounce */
1791 smartData->changed.frame_rect = true;
1792 _ewk_view_smart_changed(smartData);
1798 static void _ewk_view_smart_flush(Ewk_View_Smart_Data* smartData)
1800 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
1801 _ewk_view_repaints_flush(priv);
1802 _ewk_view_scrolls_flush(priv);
1805 static Eina_Bool _ewk_view_smart_pre_render_region(Ewk_View_Smart_Data* smartData, Evas_Coord x, Evas_Coord y, Evas_Coord width, Evas_Coord height, float zoom)
1807 WRN("not supported by engine. smartData=%p area=%d,%d+%dx%d, zoom=%f",
1808 smartData, x, y, width, height, zoom);
1812 static Eina_Bool _ewk_view_smart_pre_render_relative_radius(Ewk_View_Smart_Data* smartData, unsigned int number, float zoom)
1814 WRN("not supported by engine. smartData=%p, n=%u zoom=%f",
1815 smartData, number, zoom);
1819 #if ENABLE(TIZEN_PRE_RENDERING_ENABLE)
1820 static Eina_Bool _ewk_view_smart_pre_render_start(Ewk_View_Smart_Data* smartData, Eina_Bool forceToPrerender)
1822 static Eina_Bool _ewk_view_smart_pre_render_start(Ewk_View_Smart_Data* smartData)
1825 WRN("not supported by engine. smartData=%p", smartData);
1829 static void _ewk_view_smart_pre_render_cancel(Ewk_View_Smart_Data* smartData)
1831 WRN("not supported by engine. smartData=%p", smartData);
1834 static void _ewk_view_zoom_animated_mark_stop(Ewk_View_Smart_Data* smartData)
1836 smartData->animated_zoom.zoom.start = 0.0;
1837 smartData->animated_zoom.zoom.end = 0.0;
1838 smartData->animated_zoom.zoom.current = 0.0;
1841 static void _ewk_view_zoom_animated_finish(Ewk_View_Smart_Data* smartData)
1843 EWK_VIEW_PRIV_GET(smartData, priv);
1844 ecore_animator_del(priv->animatedZoom.animator);
1845 priv->animatedZoom.animator = 0;
1846 _ewk_view_zoom_animated_mark_stop(smartData);
1847 evas_object_smart_callback_call(smartData->self, "zoom,animated,end", 0);
1850 static float _ewk_view_zoom_animated_current(Ewk_View_Private_Data* priv)
1852 double now = ecore_loop_time_get();
1853 double delta = now - priv->animatedZoom.time.start;
1855 if (delta > priv->animatedZoom.time.duration)
1856 delta = priv->animatedZoom.time.duration;
1857 if (delta < 0.0) // time went back, clock adjusted?
1860 delta /= priv->animatedZoom.time.duration;
1862 return ((priv->animatedZoom.zoom.range * delta)
1863 + priv->animatedZoom.zoom.start);
1866 static Eina_Bool _ewk_view_zoom_animator_cb(void* data)
1868 Ewk_View_Smart_Data* smartData = static_cast<Ewk_View_Smart_Data*>(data);
1869 Evas_Coord centerX, centerY;
1870 EWK_VIEW_PRIV_GET(smartData, priv);
1871 double now = ecore_loop_time_get();
1873 centerX = priv->animatedZoom.center.x;
1874 centerY = priv->animatedZoom.center.y;
1876 // TODO: progressively center (cx, cy) -> (view.x + view.h/2, view.y + view.h/2)
1877 if (centerX >= smartData->view.w)
1878 centerX = smartData->view.w - 1;
1879 if (centerY >= smartData->view.h)
1880 centerY = smartData->view.h - 1;
1882 if ((now >= priv->animatedZoom.time.end)
1883 || (now < priv->animatedZoom.time.start)) {
1884 _ewk_view_zoom_animated_finish(smartData);
1885 ewk_view_zoom_set(smartData->self, priv->animatedZoom.zoom.end, centerX, centerY);
1886 smartData->api->sc.calculate(smartData->self);
1890 smartData->animated_zoom.zoom.current = _ewk_view_zoom_animated_current(priv);
1891 smartData->api->zoom_weak_set(smartData, smartData->animated_zoom.zoom.current, centerX, centerY);
1895 static void _ewk_view_zoom_animation_start(Ewk_View_Smart_Data* smartData)
1897 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
1898 if (priv->animatedZoom.animator)
1900 priv->animatedZoom.animator = ecore_animator_add
1901 (_ewk_view_zoom_animator_cb, smartData);
1904 static WebCore::ViewportAttributes _ewk_view_viewport_attributes_compute(const Evas_Object* ewkView)
1906 EWK_VIEW_SD_GET(ewkView, smartData); // how to notify about failure?
1907 EWK_VIEW_PRIV_GET(smartData, priv);
1909 int desktop_width = 980;
1910 int device_dpi = WebCore::getDPI();
1912 WebCore::IntRect available_rect = enclosingIntRect(priv->page->chrome()->client()->pageRect());
1913 WebCore::IntRect device_rect = enclosingIntRect(priv->page->chrome()->client()->windowRect());
1915 #if ENABLE(TIZEN_VIEWPORT_META_TAG)
1916 device_dpi = WebCore::getMobileDPI();
1919 WebCore::ViewportAttributes attributes = WebCore::computeViewportAttributes(priv->viewportArguments, desktop_width, device_rect.width(), device_rect.height(), device_dpi, available_rect.size());
1920 WebCore::restrictMinimumScaleFactorToViewportSize(attributes, available_rect.size());
1921 WebCore::restrictScaleFactorToInitialScaleIfNotUserScalable(attributes);
1923 #if ENABLE(TIZEN_VIEWPORT_META_TAG)
1924 const char* url = ewk_view_uri_get(ewkView);
1925 String problem_url(url);
1926 // FIXME: Emberwind is developed on fixed position value.
1927 // Therefore, if we do not revert dPR on it, game screen is to small to show full contents.
1928 if (problem_url.startsWith("http://operasoftware.github.com/Emberwind/")) {
1929 // revert applied devicePixelRatio
1930 attributes.layoutSize.setWidth((int)(attributes.layoutSize.width() * attributes.devicePixelRatio));
1931 attributes.layoutSize.setHeight((int)(attributes.layoutSize.height() * attributes.devicePixelRatio));
1934 float device_width, device_height;
1935 ewk_view_device_size_get(ewkView, &device_width, &device_height);
1936 WebCore::ViewportAttributes opt_attributes = ewk_viewport_attributes_optimize(attributes, device_rect.width(), device_rect.height(), device_width, device_height);
1938 // FIXME : This code should be removed after finishing scale page patch.
1939 // Adjust zoom of tiled backing store to initialScale for now.
1940 Evas_Coord tw = defaultTileWidth;
1941 #if ENABLE(TIZEN_TILE_SIZE_GET)
1942 ewk_view_tiled_tile_size_get(ewkView, &tw, 0);
1944 opt_attributes.initialScale = ROUNDED_ZOOM(tw, opt_attributes.initialScale);
1945 opt_attributes.minimumScale = ROUNDED_ZOOM(tw, opt_attributes.minimumScale);
1946 opt_attributes.maximumScale = ROUNDED_ZOOM(tw, opt_attributes.maximumScale);
1947 opt_attributes.devicePixelRatio = ROUNDED_ZOOM(tw, opt_attributes.devicePixelRatio);
1949 return opt_attributes;
1954 static Eina_Bool _ewk_view_smart_disable_render(Ewk_View_Smart_Data* smartData)
1956 WRN("not supported by engine. smartData=%p", smartData);
1960 static Eina_Bool _ewk_view_smart_enable_render(Ewk_View_Smart_Data* smartData)
1962 WRN("not supported by engine. smartData=%p", smartData);
1965 #if ENABLE(TIZEN_WINDOW_CLOSE)
1966 static void _ewk_view_smart_window_close(Ewk_View_Smart_Data* smartData)
1968 evas_object_smart_callback_call(smartData->self, "window,close", 0);
1972 #if ENABLE(TIZEN_DYNAMIC_LOADED_PLUGINS) || ENABLE(TIZEN_ON_OFF_SPECIFIED_PLUGINS)
1973 WebCore::PluginPackage* _ewk_view_plugin_for_mime_type(const Vector<WebCore::PluginPackage*> &pluginsDB, const char* mimeType)
1976 WTF::String key = WTF::String(mimeType).lower();
1978 Vector<WebCore::PluginPackage*, 2> pluginChoices;
1980 for (unsigned int i = 0; i < pluginsDB.size(); i++) {
1981 WebCore::PluginPackage* plugin = pluginsDB[i];
1983 if (plugin->mimeToDescriptions().contains(key))
1984 pluginChoices.append(plugin);
1987 if (!pluginChoices.isEmpty()) {
1988 qsort(pluginChoices.data(), pluginChoices.size(), sizeof(WebCore::PluginPackage*), WebCore::PluginDatabase::preferredPluginCompare);
1989 return pluginChoices[0];
1995 Eina_Bool _ewk_view_setting_enable_plugins_set(Eina_Bool enable)
1997 static Eina_Bool startApplication = true;
1999 // If we have disabled option "Run flash/enable plugins" on start an application we don't want to scan the directories to find plugins
2001 if (startApplication)
2002 WebCore::PluginDatabase::installedPlugins(false); // do installedPlugins without scanning directories
2003 else // if we've disabled option "Run flash/enable plugins" in runtime of application
2004 // Plugins aren't being destroyed now. Plugins will be destroyed by Browser if any tab/pages won't have any flash elements
2006 } else { // enables reading plugins from default directories
2007 WebCore::PluginDatabase* pluginDatabase = WebCore::PluginDatabase::installedPlugins(false);
2008 if (pluginDatabase && pluginDatabase->pluginDirectories().isEmpty())
2009 pluginDatabase->setPluginDirectories(WebCore::PluginDatabase::defaultPluginDirectories());
2012 if (startApplication)
2013 startApplication = false;
2018 Eina_Bool _ewk_view_setting_enable_specified_plugin_set(Eina_Bool enable, const char* mimeType)
2025 WebCore::PluginDatabase* pluginDatabase = WebCore::PluginDatabase::installedPlugins(false); // don't do scan
2027 if (!pluginDatabase)
2030 if (!pluginDatabase->plugins().isEmpty()) { // this means that there are plugins working
2031 const Vector<WebCore::PluginPackage*> pluginsDB = pluginDatabase->plugins();
2032 WebCore::PluginPackage* pluginForMime = _ewk_view_plugin_for_mime_type(pluginsDB, mimeType);
2034 pluginForMime->setEnabled(enable);
2037 #if ENABLE(TIZEN_DYNAMIC_LOADED_PLUGINS) && ENABLE(TIZEN_ON_OFF_SPECIFIED_PLUGINS)
2038 // store info in hash map for situation that plugins will be unloaded and loaded again
2039 pluginDatabase->setSpecifiedPluginEnabled(WTF::String(mimeType), enable);
2045 #if ENABLE(TIZEN_FIRST_PAINT_NOTI)
2046 static void _ewk_view_first_paint_noti(void* data, Evas_Object* ewkView, void* ev)
2048 Ewk_View_Smart_Data* smartData = (Ewk_View_Smart_Data*) data;
2049 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
2051 /* dispatchDidFirstVisuallyNonEmptyLayout will set priv->flags.viewCleared to TRUE */
2052 if (priv->flags.viewCleared) {
2053 evas_object_smart_callback_call(smartData->self, "paint,first", 0);
2054 evas_object_smart_callback_del(ewkView, "paint,first", _ewk_view_first_paint_noti);
2059 #if ENABLE(TIZEN_VIEW_ACTIVE_SET)
2060 static Eina_Bool _ewk_view_smart_active_set(Ewk_View_Smart_Data* smartData, Eina_Bool value)
2062 WRN("not supported by engine. smartData=%p", smartData);
2068 * Sending document loaded event to all plugins in specified view
2070 * @param [in] view object
2072 void _ewk_view_send_document_loaded_to_plugins(Evas_Object* ewkView)
2074 #if ENABLE(TIZEN_EVAS_OBJECT_PLUGIN) && ENABLE(NETSCAPE_PLUGIN_API) && ENABLE(TIZEN_NPAPI)
2075 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
2076 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
2079 tnpevent.type = TNPDocumentLoaded;
2081 _iterate_frames(priv->mainFrame, _send_event_to_all_plugins, &tnpevent);
2083 LOG_ERROR("TIZEN_EVAS_OBJECT_PLUGIN or netscape api or tizen npapi are disabled. \n");
2087 static const char* _ewk_view_editor_command_string_get(Ewk_View_Private_Data* priv, Ewk_Editor_Command ewkCommand)
2089 static OwnPtr<Eina_Hash> editorCommandHash;
2091 if (!editorCommandHash) {
2092 editorCommandHash = adoptPtr(eina_hash_int32_new(0));
2093 for (int i = 0; editorCommands[i].ewkEditorCommand != EWK_EDITOR_COMMAND_NONE; i++)
2094 eina_hash_add(editorCommandHash.get(), &editorCommands[i].ewkEditorCommand, editorCommands[i].editorCommandString);
2096 return reinterpret_cast<const char*>(eina_hash_find(editorCommandHash.get(), &ewkCommand));
2099 Eina_Bool ewk_view_base_smart_set(Ewk_View_Smart_Class* api)
2101 EINA_SAFETY_ON_NULL_RETURN_VAL(api, false);
2103 if (api->version != EWK_VIEW_SMART_CLASS_VERSION) {
2105 ("Ewk_View_Smart_Class %p is version %lu while %lu was expected.",
2106 api, api->version, EWK_VIEW_SMART_CLASS_VERSION);
2110 if (EINA_UNLIKELY(!_parent_sc.add))
2111 evas_object_smart_clipped_smart_set(&_parent_sc);
2113 evas_object_smart_clipped_smart_set(&api->sc);
2114 api->sc.add = _ewk_view_smart_add;
2115 api->sc.del = _ewk_view_smart_del;
2116 api->sc.resize = _ewk_view_smart_resize;
2117 api->sc.move = _ewk_view_smart_move;
2118 api->sc.calculate = _ewk_view_smart_calculate;
2119 api->sc.show = _ewk_view_smart_show;
2120 api->sc.hide = _ewk_view_smart_hide;
2121 #if ENABLE(TIZEN_SMART_CLASS_TYPE_STR)
2122 api->sc.data = eina_stringshare_add("EWK_View"); /* used by type checking */
2124 api->sc.data = ewkViewTypeString; /* used by type checking */
2126 #if !ENABLE(TIZEN_DAILY_UPVERSIONING)
2127 api->sc.callbacks = _ewk_view_callback_names;
2129 api->contents_resize = _ewk_view_smart_contents_resize;
2130 api->zoom_set = _ewk_view_smart_zoom_set;
2131 api->flush = _ewk_view_smart_flush;
2132 api->pre_render_region = _ewk_view_smart_pre_render_region;
2133 api->pre_render_relative_radius = _ewk_view_smart_pre_render_relative_radius;
2134 api->pre_render_start = _ewk_view_smart_pre_render_start;
2135 api->pre_render_cancel = _ewk_view_smart_pre_render_cancel;
2136 api->disable_render = _ewk_view_smart_disable_render;
2137 api->enable_render = _ewk_view_smart_enable_render;
2138 #if ENABLE(TIZEN_VIEW_ACTIVE_SET)
2139 api->active_set = _ewk_view_smart_active_set;
2142 api->focus_in = _ewk_view_smart_focus_in;
2143 api->focus_out = _ewk_view_smart_focus_out;
2144 api->mouse_wheel = _ewk_view_smart_mouse_wheel;
2145 api->mouse_down = _ewk_view_smart_mouse_down;
2146 api->mouse_up = _ewk_view_smart_mouse_up;
2147 api->mouse_move = _ewk_view_smart_mouse_move;
2148 api->key_down = _ewk_view_smart_key_down;
2149 api->key_up = _ewk_view_smart_key_up;
2151 api->add_console_message = _ewk_view_smart_add_console_message;
2152 api->run_javascript_alert = _ewk_view_smart_run_javascript_alert;
2153 api->run_javascript_confirm = _ewk_view_smart_run_javascript_confirm;
2154 api->run_javascript_prompt = _ewk_view_smart_run_javascript_prompt;
2155 api->should_interrupt_javascript = _ewk_view_smart_should_interrupt_javascript;
2157 #if ENABLE(TIZEN_WINDOW_CLOSE)
2158 api->window_close = _ewk_view_smart_window_close;
2163 void ewk_view_fixed_layout_size_set(Evas_Object* ewkView, Evas_Coord width, Evas_Coord height)
2165 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
2166 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
2168 WebCore::FrameView* view = priv->mainFrame->view();
2172 WebCore::IntSize layoutSize(width, height);
2173 #if ENABLE(TIZEN_VIEWPORT_META_TAG)
2174 if (priv->viewportAttributes.width != width || priv->viewportAttributes.height != height) {
2175 priv->viewportAttributes.width = width;
2176 priv->viewportAttributes.height = height;
2179 if (layoutSize.width() <= 0 && layoutSize.height() <= 0) {
2180 if (!view->useFixedLayout())
2182 view->setUseFixedLayout(false);
2184 WebCore::IntSize fixedLayoutSize = view->fixedLayoutSize();
2185 if (fixedLayoutSize == layoutSize)
2187 view->setFixedLayoutSize(layoutSize);
2188 view->setUseFixedLayout(true);
2191 view->setNeedsLayout();
2194 void ewk_view_fixed_layout_size_get(const Evas_Object* ewkView, Evas_Coord* width, Evas_Coord* height)
2200 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
2201 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
2202 WebCore::FrameView* view = priv->mainFrame->view();
2203 if (view->useFixedLayout()) {
2204 WebCore::IntSize size = view->fixedLayoutSize();
2206 *width = size.width();
2208 *height = size.height();
2212 void ewk_view_theme_set(Evas_Object* ewkView, const char* path)
2214 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
2215 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
2216 if (!eina_stringshare_replace(&priv->settings.theme, path))
2219 WebCore::FrameView* view = priv->mainFrame->view();
2221 view->setEdjeTheme(WTF::String(path));
2222 priv->page->theme()->themeChanged();
2227 const char* ewk_view_theme_get(const Evas_Object* ewkView)
2229 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
2230 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0);
2231 return priv->settings.theme;
2234 Evas_Object* ewk_view_frame_main_get(const Evas_Object* ewkView)
2236 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
2237 return smartData->main_frame;
2240 Evas_Object* ewk_view_frame_focused_get(const Evas_Object* ewkView)
2242 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
2243 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0);
2245 WebCore::Frame* core = priv->page->focusController()->focusedFrame();
2249 WebCore::FrameLoaderClientEfl* client = static_cast<WebCore::FrameLoaderClientEfl*>(core->loader()->client());
2252 return client->webFrame();
2255 Eina_Bool ewk_view_uri_set(Evas_Object* ewkView, const char* uri)
2257 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2258 return ewk_frame_uri_set(smartData->main_frame, uri);
2261 const char* ewk_view_uri_get(const Evas_Object* ewkView)
2263 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
2264 return ewk_frame_uri_get(smartData->main_frame);
2267 const Ewk_Text_With_Direction* ewk_view_title_get(const Evas_Object* ewkView)
2269 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
2270 return ewk_frame_title_get(smartData->main_frame);
2273 Eina_Bool ewk_view_editable_get(const Evas_Object* ewkView)
2275 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2276 return ewk_frame_editable_get(smartData->main_frame);
2279 void ewk_view_bg_color_set(Evas_Object* ewkView, int red, int green, int blue, int alpha)
2281 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
2282 EINA_SAFETY_ON_NULL_RETURN(smartData->api);
2283 EINA_SAFETY_ON_NULL_RETURN(smartData->api->bg_color_set);
2286 WRN("Alpha less than zero (%d).", alpha);
2288 } else if (alpha > 255) {
2289 WRN("Alpha is larger than 255 (%d).", alpha);
2293 #define CHECK_PREMUL_COLOR(color, alpha) \
2295 WRN("Color component " #color " is less than zero (%d).", color); \
2297 } else if (color > alpha) { \
2298 WRN("Color component " #color " is greater than alpha (%d, alpha=%d).", \
2302 CHECK_PREMUL_COLOR(red, alpha);
2303 CHECK_PREMUL_COLOR(green, alpha);
2304 CHECK_PREMUL_COLOR(blue, alpha);
2305 #undef CHECK_PREMUL_COLOR
2307 smartData->bg_color.r = red;
2308 smartData->bg_color.g = green;
2309 smartData->bg_color.b = blue;
2310 smartData->bg_color.a = alpha;
2312 smartData->api->bg_color_set(smartData, red, green, blue, alpha);
2314 WebCore::FrameView* view = smartData->_priv->mainFrame->view();
2316 WebCore::Color color;
2319 color = WebCore::Color(0, 0, 0, 0);
2320 else if (alpha == 255)
2321 color = WebCore::Color(red, green, blue, alpha);
2323 color = WebCore::Color(red * 255 / alpha, green * 255 / alpha, blue * 255 / alpha, alpha);
2325 view->updateBackgroundRecursively(color, !alpha);
2329 void ewk_view_bg_color_get(const Evas_Object* ewkView, int* red, int* green, int* blue, int* alpha)
2339 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
2341 *red = smartData->bg_color.r;
2343 *green = smartData->bg_color.g;
2345 *blue = smartData->bg_color.b;
2347 *alpha = smartData->bg_color.a;
2350 #if ENABLE(TIZEN_BG_RECT_SUPPORT)
2352 * Set view's background rect color
2354 * This is used for setting the color of the rectangle behind the view. Unlike
2355 * what is done in ewk_view_bg_color_set(), this color is not passed to WebCore.
2356 * It's sole purpose is instead to put a rectangle behind the view in order to
2357 * be possible to have different backgrounds for bouncer effects and for areas
2360 * Just as in Evas, colors are pre-multiplied, so 50% red is
2361 * (128, 0, 0, 128) and not (255, 0, 0, 128)!
2363 * @param ewkView view object to change.
2364 * @param r red component.
2365 * @param g green component.
2366 * @param b blue component.
2367 * @param a transparency.
2369 void ewk_view_bg_rect_color_set(Evas_Object* ewkView, int r, int g, int b, int a)
2371 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
2372 EINA_SAFETY_ON_NULL_RETURN(smartData->bg_rect.bg_rect);
2375 WRN("Alpha less than zero (%d).", a);
2377 } else if (a > 255) {
2378 WRN("Alpha is larger than 255 (%d).", a);
2382 #define CHECK_PREMUL_COLOR(c, a) \
2384 WRN("Color component "#c" is less than zero (%d).", c); \
2386 } else if (c > a) { \
2387 WRN("Color component "#c" is greater than alpha (%d, alpha=%d).", \
2391 CHECK_PREMUL_COLOR(r, a);
2392 CHECK_PREMUL_COLOR(g, a);
2393 CHECK_PREMUL_COLOR(b, a);
2394 #undef CHECK_PREMUL_COLOR
2396 smartData->bg_rect.color.r = r;
2397 smartData->bg_rect.color.g = g;
2398 smartData->bg_rect.color.b = b;
2399 smartData->bg_rect.color.a = a;
2400 evas_object_color_set(smartData->bg_rect.bg_rect, smartData->bg_rect.color.r, smartData->bg_rect.color.g,
2401 smartData->bg_rect.color.b, smartData->bg_rect.color.a);
2405 * Get view's background rect color
2407 * This is used for getting the color of the rectangle behind the view. Unlike
2408 * what is done in ewk_view_bg_color_get(), this color is not passed to WebCore.
2409 * It's sole purpose is instead to put a rectangle behind the view in order to
2410 * be possible to have different backgrounds for bouncer effects and for areas
2413 * Just as in Evas, colors are pre-multiplied, so 50% red is
2414 * (128, 0, 0, 128) and not (255, 0, 0, 128)!
2416 * @param ewkView view object to query.
2417 * @param r where to return red color component.
2418 * @param g where to return green color component.
2419 * @param b where to return blue color component.
2420 * @param a where to return alpha value.
2422 void ewk_view_bg_rect_color_get(const Evas_Object* ewkView, int* r, int* g, int* b, int* a)
2432 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
2434 *r = smartData->bg_rect.color.r;
2436 *g = smartData->bg_rect.color.g;
2438 *b = smartData->bg_rect.color.b;
2440 *a = smartData->bg_rect.color.a;
2445 * Search the given text string in document.
2447 * @param ewkView view object where to search text.
2448 * @param string reference string to search.
2449 * @param case_sensitive if search should be case sensitive or not.
2450 * @param forward if search is from cursor and on or backwards.
2451 * @param wrap if search should wrap at end.
2453 * @return @c true if found, @c false if not or failure.
2455 Eina_Bool ewk_view_text_search(const Evas_Object* ewkView, const char* string, Eina_Bool caseSensitive, Eina_Bool forward, Eina_Bool wrap)
2457 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2458 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
2459 EINA_SAFETY_ON_NULL_RETURN_VAL(string, false);
2460 WTF::TextCaseSensitivity sensitive;
2461 WebCore::FindDirection direction;
2464 sensitive = WTF::TextCaseSensitive;
2466 sensitive = WTF::TextCaseInsensitive;
2469 direction = WebCore::FindDirectionForward;
2471 direction = WebCore::FindDirectionBackward;
2473 return priv->page->findString(String::fromUTF8(string), sensitive, direction, wrap);
2477 * Mark matches the given text string in document.
2479 * @param ewkView view object where to search text.
2480 * @param string reference string to match.
2481 * @param caseSensitive if match should be case sensitive or not.
2482 * @param heightighlight if matches should be highlighted.
2483 * @param limit maximum amount of matches, or zero to unlimited.
2485 * @return number of matches.
2487 unsigned int ewk_view_text_matches_mark(Evas_Object* ewkView, const char* string, Eina_Bool caseSensitive, Eina_Bool highlight, unsigned int limit)
2489 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
2490 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0);
2491 EINA_SAFETY_ON_NULL_RETURN_VAL(string, 0);
2492 WTF::TextCaseSensitivity sensitive;
2495 sensitive = WTF::TextCaseSensitive;
2497 sensitive = WTF::TextCaseInsensitive;
2499 return priv->page->markAllMatchesForText(String::fromUTF8(string), sensitive, highlight, limit);
2502 Eina_Bool ewk_view_text_matches_unmark_all(Evas_Object* ewkView)
2504 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2505 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
2506 priv->page->unmarkAllTextMatches();
2510 Eina_Bool ewk_view_text_matches_highlight_set(Evas_Object* ewkView, Eina_Bool highlight)
2512 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2513 return ewk_frame_text_matches_highlight_set(smartData->main_frame, highlight);
2516 Eina_Bool ewk_view_text_matches_highlight_get(const Evas_Object* ewkView)
2518 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2519 return ewk_frame_text_matches_highlight_get(smartData->main_frame);
2522 Eina_Bool ewk_view_editable_set(Evas_Object* ewkView, Eina_Bool editable)
2524 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2525 return ewk_frame_editable_set(smartData->main_frame, editable);
2528 char* ewk_view_selection_get(const Evas_Object* ewkView)
2530 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
2531 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0);
2532 CString selectedString = priv->page->focusController()->focusedOrMainFrame()->editor()->selectedText().utf8();
2533 if (selectedString.isNull())
2535 return strdup(selectedString.data());
2538 Eina_Bool ewk_view_editor_command_execute(const Evas_Object* ewkView, const Ewk_Editor_Command command, const char* value)
2540 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2541 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
2543 #if ENABLE(TIZEN_EDITOR_COMMAND)
2544 case EWK_EDITOR_COMMAND_TOGGLE_BOLD:
2545 return _ewk_view_editor_command(priv, "ToggleBold");
2546 case EWK_EDITOR_COMMAND_TOGGLE_ITALIC:
2547 return _ewk_view_editor_command(priv, "ToggleItalic");
2548 case EWK_EDITOR_COMMAND_TOGGLE_UNDERLINE:
2549 return _ewk_view_editor_command(priv, "ToggleUnderline");
2550 case EWK_EDITOR_COMMAND_UNDO:
2551 return _ewk_view_editor_command(priv, "Undo");
2552 case EWK_EDITOR_COMMAND_REDO:
2553 return _ewk_view_editor_command(priv, "Redo");
2554 case EWK_EDITOR_COMMAND_INDENT:
2555 return _ewk_view_editor_command(priv, "Indent");
2556 case EWK_EDITOR_COMMAND_OUTDENT:
2557 return _ewk_view_editor_command(priv, "Outdent");
2558 case EWK_EDITOR_COMMAND_INSERT_ORDEREDLIST:
2559 return _ewk_view_editor_command(priv, "InsertOrderedList");
2560 case EWK_EDITOR_COMMAND_INSERT_UNORDEREDLIST:
2561 return _ewk_view_editor_command(priv, "InsertUnorderedList");
2562 case EWK_EDITOR_COMMAND_INSERT_PARAGRAPH:
2563 return _ewk_view_editor_command(priv, "InsertParagraph");
2564 case EWK_EDITOR_COMMAND_ALIGN_CENTER:
2565 return _ewk_view_editor_command(priv, "AlignCenter");
2566 case EWK_EDITOR_COMMAND_ALIGN_JUSTIFIED:
2567 return _ewk_view_editor_command(priv, "AlignJustified");
2568 case EWK_EDITOR_COMMAND_ALIGN_LEFT:
2569 return _ewk_view_editor_command(priv, "AlignLeft");
2570 case EWK_EDITOR_COMMAND_ALIGN_RIGHT:
2571 return _ewk_view_editor_command(priv, "AlignRight");
2572 case EWK_EDITOR_COMMAND_BACKCOLOR:
2573 return _ewk_view_editor_command(priv, "BackColor", value);
2574 case EWK_EDITOR_COMMAND_FORECOLOR:
2575 return _ewk_view_editor_command(priv, "ForeColor", value);
2576 case EWK_EDITOR_COMMAND_FONTSIZE:
2577 return _ewk_view_editor_command(priv, "FontSize", value);
2578 case EWK_EDITOR_COMMAND_INSERT_HTML:
2579 return _ewk_view_editor_command(priv, "InsertHTML", value);
2580 case EWK_EDITOR_COMMAND_MOVE_TO_BEGINNING_OF_DOCUMENT:
2581 return _ewk_view_editor_command(priv, "MoveToBeginningOfDocument");
2582 #endif // ENABLE(TIZEN_EDITOR_COMMAND)
2585 const char* commandString = _ewk_view_editor_command_string_get(priv, command);
2589 return priv->page->focusController()->focusedOrMainFrame()->editor()->command(commandString).execute(WTF::String::fromUTF8(value));
2592 Eina_Bool ewk_view_context_menu_forward_event(Evas_Object* ewkView, const Evas_Event_Mouse_Down* downEvent)
2594 #if ENABLE(CONTEXT_MENUS)
2595 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2596 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
2597 Eina_Bool mouse_press_handled = false;
2599 priv->page->contextMenuController()->clearContextMenu();
2600 WebCore::Frame* mainFrame = priv->page->mainFrame();
2602 evas_object_geometry_get(smartData->self, &x, &y, 0, 0);
2604 WebCore::PlatformMouseEvent event(downEvent, WebCore::IntPoint(x, y));
2606 if (mainFrame->view()) {
2607 mouse_press_handled =
2608 mainFrame->eventHandler()->handleMousePressEvent(event);
2611 if (mainFrame->eventHandler()->sendContextMenuEvent(event))
2614 WebCore::ContextMenu* coreMenu =
2615 priv->page->contextMenuController()->contextMenu();
2617 // WebCore decided not to create a context menu, return true if event
2618 // was handled by handleMouseReleaseEvent
2619 return mouse_press_handled;
2628 double ewk_view_load_progress_get(const Evas_Object* ewkView)
2630 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, -1.0);
2631 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, -1.0);
2632 return priv->page->progress()->estimatedProgress();
2635 Eina_Bool ewk_view_stop(Evas_Object* ewkView)
2637 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2638 evas_object_smart_callback_call(ewkView, "load,stop", 0);
2639 return ewk_frame_stop(smartData->main_frame);
2642 Eina_Bool ewk_view_reload(Evas_Object* ewkView)
2644 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2645 return ewk_frame_reload(smartData->main_frame);
2648 Eina_Bool ewk_view_reload_full(Evas_Object* ewkView)
2650 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2651 return ewk_frame_reload_full(smartData->main_frame);
2654 Eina_Bool ewk_view_back(Evas_Object* ewkView)
2656 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2657 return ewk_frame_back(smartData->main_frame);
2660 Eina_Bool ewk_view_forward(Evas_Object* ewkView)
2662 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2663 return ewk_frame_forward(smartData->main_frame);
2666 Eina_Bool ewk_view_load_in_progress(Evas_Object* ewkView)
2668 #if ENABLE(TIZEN_LOADING_STATE_CHECK)
2669 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2670 return ewk_frame_load_in_progress(smartData->main_frame);
2672 LOG_ERROR("TIZEN_LOADING_STATE_CHECK is disabled. \n");
2677 Eina_Bool ewk_view_contents_set(Evas_Object* ewkView, const char* contents, size_t contents_size, const char* mime_type, const char* encoding, const char* base_uri)
2679 #if ENABLE(TIZEN_CONTENTS_SET)
2680 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2681 return ewk_frame_contents_set(smartData->main_frame, (char*)contents, contents_size, mime_type, encoding, base_uri);
2683 LOG_ERROR("TIZEN_CONTENTS_SET is disabled. \n");
2688 Eina_Bool ewk_view_navigate(Evas_Object* ewkView, int steps)
2690 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2691 return ewk_frame_navigate(smartData->main_frame, steps);
2694 Eina_Bool ewk_view_back_possible(Evas_Object* ewkView)
2696 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2697 return ewk_frame_back_possible(smartData->main_frame);
2700 Eina_Bool ewk_view_forward_possible(Evas_Object* ewkView)
2702 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2703 return ewk_frame_forward_possible(smartData->main_frame);
2706 Eina_Bool ewk_view_navigate_possible(Evas_Object* ewkView, int steps)
2708 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2709 return ewk_frame_navigate_possible(smartData->main_frame, steps);
2712 Eina_Bool ewk_view_history_enable_get(const Evas_Object* ewkView)
2714 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2715 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
2716 return static_cast<WebCore::BackForwardListImpl*>(priv->page->backForwardList())->enabled();
2719 Eina_Bool ewk_view_history_enable_set(Evas_Object* ewkView, Eina_Bool enable)
2721 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2722 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
2723 static_cast<WebCore::BackForwardListImpl*>(priv->page->backForwardList())->setEnabled(enable);
2727 Ewk_History* ewk_view_history_get(const Evas_Object* ewkView)
2729 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
2730 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0);
2731 if (!static_cast<WebCore::BackForwardListImpl*>(priv->page->backForwardList())->enabled()) {
2732 ERR("asked history, but it's disabled! Returning 0!");
2735 return priv->history;
2738 Eina_Bool ewk_view_visited_link_add(Evas_Object* ewkView, const char* visitedUrl)
2740 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2741 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
2743 EINA_SAFETY_ON_NULL_RETURN_VAL(priv->page, false);
2744 EINA_SAFETY_ON_NULL_RETURN_VAL(priv->page->groupPtr(), false);
2746 WebCore::KURL kurl(WebCore::KURL(), WTF::String::fromUTF8(visitedUrl));
2747 priv->page->groupPtr()->addVisitedLink(kurl);
2751 float ewk_view_zoom_get(const Evas_Object* ewkView)
2753 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, -1.0);
2755 return ewk_view_scale_get(ewkView);
2758 Eina_Bool ewk_view_zoom_set(Evas_Object* ewkView, float zoom, Evas_Coord centerX, Evas_Coord centerY)
2760 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2761 EWK_VIEW_PRIV_GET(smartData, priv);
2763 EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->api, false);
2764 EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->api->zoom_set, false);
2766 Eina_Bool ret = true;
2767 #if ENABLE(TIZEN_WEBCORE_SELECTIVE_RENDERING)
2768 WebCore::FrameView* view = priv->mainFrame->view();
2769 view->clearDelayedUpdateRegions();
2771 if (!priv->settings.zoomRange.userScalable) {
2772 WRN("userScalable is false");
2776 if (zoom < priv->settings.zoomRange.minScale) {
2777 WRN("zoom level is < %f : %f", (double)priv->settings.zoomRange.minScale, (double)zoom);
2778 #if ENABLE(TIZEN_FIX_MESH_TILE_ISSUE)
2779 zoom = priv->settings.zoomRange.minScale;
2785 if (zoom > priv->settings.zoomRange.maxScale) {
2786 WRN("zoom level is > %f : %f", (double)priv->settings.zoomRange.maxScale, (double)zoom);
2787 #if ENABLE(TIZEN_FIX_MESH_TILE_ISSUE)
2788 zoom = priv->settings.zoomRange.maxScale;
2795 #if USE(ACCELERATED_COMPOSITING) && ENABLE(TIZEN_ACCELERATED_COMPOSITING)
2796 if (priv->compositingActive) {
2797 priv->compositor->setZoom(zoom);
2798 ewk_view_mark_for_sync(ewkView, false);
2800 #endif // USE(ACCELERATED_COMPOSITING) && ENABLE(TIZEN_ACCELERATED_COMPOSITING)
2801 _ewk_view_zoom_animated_mark_stop(smartData);
2803 #if ENABLE(TIZEN_RECORDING_SURFACE)
2804 if (priv->recordingSurfaceEnable && priv->recordingSurfaceSetLoadFinished) {
2805 priv->recordingSurfaceSetState = RECORDING_SURFACE_SET_STATE_INIT;
2806 priv->recordingSurfaceSetList = ewk_recording_surface_set_free(priv->recordingSurfaceSetList);
2807 priv->recordingSurfaceSetList = ewk_recording_surface_set_base_record(priv->recordingSurfaceSetList, ewkView, zoom);
2808 priv->recordingSurfaceSetState = RECORDING_SURFACE_SET_STATE_COMPLETE;
2809 return smartData->api->zoom_set(smartData, zoom, centerX, centerY);
2811 #if ENABLE(TIZEN_FIX_MESH_TILE_ISSUE)
2812 return ret & smartData->api->zoom_set(smartData, zoom, centerX, centerY);
2814 return smartData->api->zoom_set(smartData, zoom, centerX, centerY);
2817 #if ENABLE(TIZEN_FIX_MESH_TILE_ISSUE)
2818 #if ENABLE(TIZEN_FIX_PAINT_BEFORE_NONEMPTYLAYOUT_ISSUE)
2819 if (!view->isVisuallyNonEmpty())
2820 ret = ret & _ewk_view_smart_zoom_set(smartData, zoom, centerX, centerY);
2822 ret = ret & smartData->api->zoom_set(smartData, zoom, centerX, centerY);
2824 ret = ret & smartData->api->zoom_set(smartData, zoom, centerX, centerY);
2826 #if ENABLE(TIZEN_PRE_RENDERING_ENABLE)
2827 ewk_view_pre_render_start(ewkView);
2829 #if ENABLE(TIZEN_RECORDING_SURFACE)
2830 ewk_view_recording_surface_start(ewkView);
2834 return smartData->api->zoom_set(smartData, zoom, centerX, centerY);
2836 #endif // ENABLE(TIZEN_RECORDING_SURFACE)
2839 float ewk_view_page_zoom_get(const Evas_Object* ewkView)
2841 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, -1.0);
2842 return ewk_frame_page_zoom_get(smartData->main_frame);
2845 Eina_Bool ewk_view_page_zoom_set(Evas_Object* ewkView, float pageZoomFactor)
2847 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2848 return ewk_frame_page_zoom_set(smartData->main_frame, pageZoomFactor);
2851 float ewk_view_scale_get(const Evas_Object* ewkView)
2853 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, -1.0);
2854 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, -1.0);
2855 return priv->page->pageScaleFactor();
2858 Eina_Bool ewk_view_scale_set(Evas_Object* ewkView, float scaleFactor, Evas_Coord scrollX, Evas_Coord scrollY)
2860 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2861 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
2863 float currentScaleFactor = ewk_view_scale_get(ewkView);
2864 if (currentScaleFactor == -1)
2867 priv->page->setPageScaleFactor(scaleFactor, WebCore::IntPoint(scrollX, scrollY));
2871 float ewk_view_text_zoom_get(const Evas_Object* ewkView)
2873 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, -1.0);
2874 return ewk_frame_text_zoom_get(smartData->main_frame);
2877 Eina_Bool ewk_view_text_zoom_set(Evas_Object* ewkView, float textZoomFactor)
2879 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2880 return ewk_frame_text_zoom_set(smartData->main_frame, textZoomFactor);
2883 Eina_Bool ewk_view_zoom_weak_smooth_scale_get(const Evas_Object* ewkView)
2885 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2886 return smartData->zoom_weak_smooth_scale;
2889 void ewk_view_zoom_weak_smooth_scale_set(Evas_Object* ewkView, Eina_Bool smoothScale)
2891 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
2892 smoothScale = !!smoothScale;
2893 if (smartData->zoom_weak_smooth_scale == smoothScale)
2895 smartData->zoom_weak_smooth_scale = smoothScale;
2896 EINA_SAFETY_ON_NULL_RETURN(smartData->api);
2897 EINA_SAFETY_ON_NULL_RETURN(smartData->api->zoom_weak_smooth_scale_set);
2898 smartData->api->zoom_weak_smooth_scale_set(smartData, smoothScale);
2901 Eina_Bool ewk_view_zoom_weak_set(Evas_Object* ewkView, float zoom, Evas_Coord centerX, Evas_Coord centerY)
2903 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2904 EWK_VIEW_PRIV_GET(smartData, priv);
2906 EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->api, EINA_FALSE);
2907 EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->api->zoom_weak_set, EINA_FALSE);
2909 #if ENABLE(TIZEN_WEAK_ZOOM_POSITION)
2910 zoom = ROUNDED_ZOOM(defaultTileWidth, zoom);
2913 #if ENABLE(TIZEN_BG_RECT_SUPPORT)
2914 double limit_max_zoom_level = priv->settings.zoomRange.maxScale * (1.0f + ZOOM_BOUNCE_LIMIT_RATIO);
2915 double limit_min_zoom_level = priv->settings.zoomRange.minScale * (1.0f - ZOOM_BOUNCE_LIMIT_RATIO);
2917 if (limit_min_zoom_level < 0)
2918 limit_min_zoom_level = 0;
2921 EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->api, false);
2922 EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->api->zoom_weak_set, false);
2924 if (!priv->settings.zoomRange.userScalable) {
2925 WRN("userScalable is false");
2929 #if ENABLE(TIZEN_BG_RECT_SUPPORT)
2930 if (zoom < limit_min_zoom_level) {
2931 WRN("zoom level is < %f : %f", (double)limit_min_zoom_level, (double)zoom);
2934 if (zoom > limit_max_zoom_level) {
2935 WRN("zoom level is > %f : %f", (double) limit_max_zoom_level, (double)zoom);
2939 if (zoom < priv->settings.zoomRange.minScale) {
2940 WRN("zoom level is < %f : %f", priv->settings.zoomRange.minScale, zoom);
2943 if (zoom > priv->settings.zoomRange.maxScale) {
2944 WRN("zoom level is > %f : %f", priv->settings.zoomRange.maxScale, zoom);
2949 smartData->animated_zoom.zoom.start = ewk_frame_page_zoom_get(smartData->main_frame);
2950 smartData->animated_zoom.zoom.end = zoom;
2951 smartData->animated_zoom.zoom.current = zoom;
2953 #if ENABLE(TIZEN_EVAS_OBJECT_PLUGIN) && ENABLE(TIZEN_PLUGIN_EXT) && ENABLE(NETSCAPE_PLUGIN_API) && ENABLE(TIZEN_NPAPI)
2955 tnpevent.type = TNPWeakZoom;
2956 // add view's location to (centerX, centerY)
2957 // because (centerX, centerY)'s basis is webview's left-top
2958 tnpevent.zoom.position.x = centerX + smartData->view.x;
2959 tnpevent.zoom.position.y = centerY + smartData->view.y;
2960 tnpevent.zoom.zoomFactor = zoom / smartData->animated_zoom.zoom.start;
2962 _iterate_frames(priv->mainFrame, _send_event_to_all_plugins, &tnpevent);
2963 #endif // ENABLE(TIZEN_EVAS_OBJECT_PLUGIN) && ENABLE(TIZEN_PLUGIN_EXT) && ENABLE(NETSCAPE_PLUGIN_API) && ENABLE(TIZEN_NPAPI)
2965 #if USE(ACCELERATED_COMPOSITING) && ENABLE(TIZEN_ACCELERATED_COMPOSITING)
2966 if (priv->compositingActive) {
2967 priv->compositor->setWeakZoom(smartData->animated_zoom.zoom.start, zoom, centerX, centerY);
2968 ewk_view_mark_for_sync(ewkView, false);
2970 #endif // USE(ACCELERATED_COMPOSITING) & ENABLE(TIZEN_ACCELERATED_COMPOSITING)
2971 return smartData->api->zoom_weak_set(smartData, zoom, centerX, centerY);
2974 Eina_Bool ewk_view_zoom_animated_mark_start(Evas_Object* ewkView, float zoom)
2976 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2977 smartData->animated_zoom.zoom.start = zoom;
2981 Eina_Bool ewk_view_zoom_animated_mark_end(Evas_Object* ewkView, float zoom)
2983 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2984 smartData->animated_zoom.zoom.end = zoom;
2988 Eina_Bool ewk_view_zoom_animated_mark_current(Evas_Object* ewkView, float zoom)
2990 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2991 smartData->animated_zoom.zoom.current = zoom;
2995 Eina_Bool ewk_view_zoom_animated_mark_stop(Evas_Object* ewkView)
2997 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2998 _ewk_view_zoom_animated_mark_stop(smartData);
3002 Eina_Bool ewk_view_zoom_animated_set(Evas_Object* ewkView, float zoom, float duration, Evas_Coord centerX, Evas_Coord centerY)
3005 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3006 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
3007 EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->api, false);
3008 EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->api->zoom_weak_set, false);
3010 if (!priv->settings.zoomRange.userScalable) {
3011 WRN("userScalable is false");
3015 if (zoom < priv->settings.zoomRange.minScale) {
3016 WRN("zoom level is < %f : %f", priv->settings.zoomRange.minScale, zoom);
3019 if (zoom > priv->settings.zoomRange.maxScale) {
3020 WRN("zoom level is > %f : %f", priv->settings.zoomRange.maxScale, zoom);
3024 if (priv->animatedZoom.animator)
3025 priv->animatedZoom.zoom.start = _ewk_view_zoom_animated_current(priv);
3027 priv->animatedZoom.zoom.start = ewk_frame_page_zoom_get(smartData->main_frame);
3028 _ewk_view_zoom_animation_start(smartData);
3036 now = ecore_loop_time_get();
3037 priv->animatedZoom.time.start = now;
3038 priv->animatedZoom.time.end = now + duration;
3039 priv->animatedZoom.time.duration = duration;
3040 priv->animatedZoom.zoom.end = zoom;
3041 priv->animatedZoom.zoom.range = (priv->animatedZoom.zoom.end - priv->animatedZoom.zoom.start);
3042 priv->animatedZoom.center.x = centerX;
3043 priv->animatedZoom.center.y = centerY;
3044 smartData->animated_zoom.zoom.current = priv->animatedZoom.zoom.start;
3045 smartData->animated_zoom.zoom.start = priv->animatedZoom.zoom.start;
3046 smartData->animated_zoom.zoom.end = priv->animatedZoom.zoom.end;
3051 Eina_Bool ewk_view_pre_render_region(Evas_Object* ewkView, Evas_Coord x, Evas_Coord y, Evas_Coord width, Evas_Coord height, float zoom)
3053 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3054 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
3055 EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->api->pre_render_region, false);
3057 Evas_Coord contentsWidth, contentsHeight;
3059 /* When doing animated zoom it's not possible to call pre-render since it
3060 * would screw up parameters that animation is currently using
3062 if (priv->animatedZoom.animator)
3065 currentZoom = ewk_frame_page_zoom_get(smartData->main_frame);
3067 if (currentZoom < 0.00001)
3069 if (!ewk_frame_contents_size_get(smartData->main_frame, &contentsWidth, &contentsHeight))
3072 contentsWidth *= zoom / currentZoom;
3073 contentsHeight *= zoom / currentZoom;
3074 DBG("region %d,%d+%dx%d @ %f contents=%dx%d", x, y, width, height, zoom, contentsWidth, contentsHeight);
3076 if (x + width > contentsWidth)
3077 width = contentsWidth - x;
3079 if (y + height > contentsHeight)
3080 height = contentsHeight - y;
3091 return smartData->api->pre_render_region(smartData, x, y, width, height, zoom);
3094 #if ENABLE(TIZEN_RECORDING_SURFACE)
3095 Eina_Bool ewk_view_recording_surface_start(Evas_Object* ewkView)
3097 EWK_VIEW_TYPE_CHECK_OR_RETURN(ewkView, ewkViewTiledName, false);
3098 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3099 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
3101 if (priv->recordingSurfaceEnable)
3102 ewk_view_recording_surface_set_base_if_needed(ewkView);
3108 * Hint engine to pre-render region, given n extra cols/rows
3110 * This is an alternative method to ewk_view_pre_render_region(). It does not
3111 * make sense in all engines and therefore it might not be implemented at all.
3113 * It's only useful if engine divide the area being rendered in smaller tiles,
3114 * forming a grid. Then, browser could call this function to pre-render @param n
3115 * rows/cols involving the current viewport.
3117 * @param ewkView view to ask pre-render on.
3118 * @param n number of cols/rows that must be part of the region pre-rendered
3120 * @see ewk_view_pre_render_region()
3122 Eina_Bool ewk_view_pre_render_relative_radius(Evas_Object* ewkView, unsigned int number)
3124 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3125 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
3126 EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->api->pre_render_relative_radius, false);
3129 if (priv->animatedZoom.animator)
3132 currentZoom = ewk_frame_page_zoom_get(smartData->main_frame);
3133 return smartData->api->pre_render_relative_radius(smartData, number, currentZoom);
3136 Eina_Bool ewk_view_pre_render_start(Evas_Object* ewkView)
3138 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3139 EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->api->pre_render_start, false);
3141 #if ENABLE(TIZEN_PRE_RENDERING_ENABLE)
3142 return smartData->api->pre_render_start(smartData, true);
3144 return smartData->api->pre_render_start(smartData);
3148 unsigned int ewk_view_imh_get(const Evas_Object* ewkView)
3150 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
3151 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0);
3156 * Cancel (clear) previous pre-render requests.
3158 * @param ewkView view to clear pre-render requests.
3160 void ewk_view_pre_render_cancel(Evas_Object* ewkView)
3162 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
3163 EINA_SAFETY_ON_NULL_RETURN(smartData->api->pre_render_cancel);
3164 smartData->api->pre_render_cancel(smartData);
3167 Eina_Bool ewk_view_enable_render(const Evas_Object* ewkView)
3169 #if ENABLE(TIZEN_RENDERING_PROFILE_TEST)
3172 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3173 EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->api->enable_render, false);
3175 #if ENABLE(TIZEN_RECORDING_SURFACE)
3176 if (smartData->_priv->recordingSurfaceEnable)
3177 smartData->_priv->recordingSurfaceSetScrollState = false;
3180 return smartData->api->enable_render(smartData);
3183 Eina_Bool ewk_view_disable_render(const Evas_Object* ewkView)
3185 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3186 EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->api->disable_render, false);
3188 #if ENABLE(TIZEN_RECORDING_SURFACE)
3189 if (smartData->_priv->recordingSurfaceEnable)
3190 smartData->_priv->recordingSurfaceSetScrollState = true;
3193 return smartData->api->disable_render(smartData);
3196 const char* ewk_view_setting_user_agent_get(const Evas_Object* ewkView)
3198 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
3199 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0);
3200 return priv->settings.userAgent;
3203 Eina_Bool ewk_view_setting_user_agent_set(Evas_Object* ewkView, const char* userAgent)
3205 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3206 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
3207 if (eina_stringshare_replace(&priv->settings.userAgent, userAgent)) {
3208 WebCore::FrameLoaderClientEfl* client = static_cast<WebCore::FrameLoaderClientEfl*>(priv->mainFrame->loader()->client());
3209 client->setCustomUserAgent(String::fromUTF8(userAgent));
3214 const char* ewk_view_setting_user_stylesheet_get(const Evas_Object* ewkView)
3216 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
3217 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0);
3218 return priv->settings.userStylesheet;
3221 Eina_Bool ewk_view_setting_user_stylesheet_set(Evas_Object* ewkView, const char* uri)
3223 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3224 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
3225 if (eina_stringshare_replace(&priv->settings.userStylesheet, uri)) {
3226 WebCore::KURL kurl(WebCore::KURL(), String::fromUTF8(uri));
3227 priv->pageSettings->setUserStyleSheetLocation(kurl);
3232 Eina_Bool ewk_view_setting_auto_load_images_get(const Evas_Object* ewkView)
3234 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3235 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
3236 return priv->settings.autoLoadImages;
3239 Eina_Bool ewk_view_setting_auto_load_images_set(Evas_Object* ewkView, Eina_Bool automatic)
3241 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3242 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
3243 automatic = !!automatic;
3244 if (priv->settings.autoLoadImages != automatic) {
3245 priv->pageSettings->setLoadsImagesAutomatically(automatic);
3246 priv->settings.autoLoadImages = automatic;
3251 Eina_Bool ewk_view_setting_auto_shrink_images_get(const Evas_Object* ewkView)
3253 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3254 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
3255 return priv->settings.autoShrinkImages;
3258 Eina_Bool ewk_view_setting_auto_shrink_images_set(Evas_Object* ewkView, Eina_Bool automatic)
3260 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3261 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
3262 automatic = !!automatic;
3263 if (priv->settings.autoShrinkImages != automatic) {
3264 priv->pageSettings->setShrinksStandaloneImagesToFit(automatic);
3265 priv->settings.autoShrinkImages = automatic;
3270 Eina_Bool ewk_view_setting_enable_auto_resize_window_get(const Evas_Object* ewkView)
3272 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3273 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
3274 return priv->settings.enableAutoResizeWindow;
3277 Eina_Bool ewk_view_setting_enable_auto_resize_window_set(Evas_Object* ewkView, Eina_Bool resizable)
3279 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3280 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
3281 priv->settings.enableAutoResizeWindow = resizable;
3285 Eina_Bool ewk_view_setting_enable_scripts_get(const Evas_Object* ewkView)
3287 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3288 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
3289 return priv->settings.enableScripts;
3292 Eina_Bool ewk_view_setting_enable_scripts_set(Evas_Object* ewkView, Eina_Bool enable)
3294 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3295 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
3297 if (priv->settings.enableScripts != enable) {
3298 priv->pageSettings->setScriptEnabled(enable);
3299 priv->settings.enableScripts = enable;
3304 Eina_Bool ewk_view_setting_enable_plugins_get(const Evas_Object* ewkView)
3306 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3307 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
3308 return priv->settings.enablePlugins;
3311 Eina_Bool ewk_view_setting_enable_plugins_set(Evas_Object* ewkView, Eina_Bool enable)
3313 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3314 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
3316 #if ENABLE(TIZEN_DYNAMIC_LOADED_PLUGINS)
3317 Eina_Bool pluginsStatus = _ewk_view_setting_enable_plugins_set(enable);
3319 if (priv->settings.enablePlugins != enable) {
3320 priv->pageSettings->setPluginsEnabled(enable);
3321 priv->settings.enablePlugins = enable;
3323 #if ENABLE(TIZEN_DYNAMIC_LOADED_PLUGINS)
3324 return pluginsStatus;
3330 Eina_Bool ewk_view_setting_enable_frame_flattening_get(const Evas_Object* ewkView)
3332 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3333 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
3334 return priv->settings.enableFrameFlattening;
3337 Eina_Bool ewk_view_setting_enable_frame_flattening_set(Evas_Object* ewkView, Eina_Bool enable)
3339 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3340 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
3342 if (priv->settings.enableFrameFlattening != enable) {
3343 priv->pageSettings->setFrameFlatteningEnabled(enable);
3344 priv->settings.enableFrameFlattening = enable;
3349 Eina_Bool ewk_view_setting_scripts_can_open_windows_get(const Evas_Object* ewkView)
3351 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3352 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
3353 return priv->settings.scriptsCanOpenWindows;
3356 Eina_Bool ewk_view_setting_scripts_can_open_windows_set(Evas_Object* ewkView, Eina_Bool allow)
3358 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3359 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
3361 if (priv->settings.scriptsCanOpenWindows != allow) {
3362 priv->pageSettings->setJavaScriptCanOpenWindowsAutomatically(allow);
3363 priv->settings.scriptsCanOpenWindows = allow;
3368 Eina_Bool ewk_view_setting_scripts_can_close_windows_get(const Evas_Object* ewkView)
3370 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3371 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
3372 return priv->settings.scriptsCanCloseWindows;
3375 Eina_Bool ewk_view_setting_scripts_can_close_windows_set(Evas_Object* ewkView, Eina_Bool allow)
3377 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3378 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
3380 if (priv->settings.scriptsCanCloseWindows != allow) {
3381 priv->pageSettings->setAllowScriptsToCloseWindows(allow);
3382 priv->settings.scriptsCanCloseWindows = allow;
3387 Eina_Bool ewk_view_setting_scripts_can_access_clipboard_get(const Evas_Object* ewkView)
3389 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3390 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
3391 return priv->settings.scriptsCanAccessClipboard;
3394 Eina_Bool ewk_view_setting_scripts_can_access_clipboard_set(Evas_Object* ewkView, Eina_Bool allow)
3396 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3397 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
3399 if (priv->settings.scriptsCanAccessClipboard != allow) {
3400 priv->pageSettings->setJavaScriptCanAccessClipboard(allow);
3401 priv->pageSettings->setDOMPasteAllowed(allow);
3402 priv->settings.scriptsCanAccessClipboard = allow;
3407 #if ENABLE(TIZEN_WEBKIT_EFL_DRT)
3409 * Returns whether scripts can close windows automatically.
3411 * @param ewkView View whose settings to check.
3413 * @return @c true if scripts can close windows, @c false otherwise.
3415 Eina_Bool ewk_view_setting_scripts_window_close_get(const Evas_Object* ewkView)
3417 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3418 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
3419 return priv->settings.scriptsWindowClose;
3423 * Sets whether scripts are allowed to close windows automatically.
3425 * @param ewkView View whose settings to change.
3426 * @param allow @c true to allow scripts to close windows,
3427 * @c false otherwise.
3429 * @return @c true if the setting could be changed successfully,
3430 * @c false in case an error occurred.
3432 Eina_Bool ewk_view_setting_scripts_window_close_set(Evas_Object* ewkView, Eina_Bool allow)
3434 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3435 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
3437 if (priv->settings.scriptsWindowClose != allow) {
3438 priv->pageSettings->setAllowScriptsToCloseWindows(allow);
3439 priv->settings.scriptsWindowClose = allow;
3447 void ewk_view_page_scale(const Evas_Object* ewkView, float scaleFactor, float x, float y)
3449 EWK_VIEW_SD_GET(ewkView, smartData);
3450 EWK_VIEW_PRIV_GET(smartData, priv);
3452 #if ENABLE(TIZEN_DAILY_UPVERSIONING)
3453 if (WebCore::Page* page = priv->mainFrame->page())
3454 page->setPageScaleFactor(scaleFactor, WebCore::IntPoint(x, y));
3456 priv->mainFrame->scalePage(scaleFactor, WebCore::IntPoint(x, y));
3460 Eina_Bool ewk_view_text_search_with_options(const Evas_Object* ewkView, const char* string, WebCore::FindOptions options)
3462 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3463 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
3464 EINA_SAFETY_ON_NULL_RETURN_VAL(string, false);
3466 return priv->page->findString(String::fromUTF8(string), options);
3470 Eina_Bool ewk_view_setting_resizable_textareas_get(const Evas_Object* ewkView)
3472 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3473 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
3474 return priv->settings.resizableTextareas;
3477 Eina_Bool ewk_view_setting_resizable_textareas_set(Evas_Object* ewkView, Eina_Bool enable)
3479 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3480 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
3482 if (priv->settings.resizableTextareas != enable) {
3483 priv->pageSettings->setTextAreasAreResizable(enable);
3484 priv->settings.resizableTextareas = enable;
3489 Eina_Bool ewk_view_setting_private_browsing_get(const Evas_Object* ewkView)
3491 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3492 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
3493 return priv->settings.privateBrowsing;
3496 Eina_Bool ewk_view_setting_private_browsing_set(Evas_Object* ewkView, Eina_Bool enable)
3498 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3499 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
3501 if (priv->settings.privateBrowsing != enable) {
3502 priv->pageSettings->setPrivateBrowsingEnabled(enable);
3503 priv->settings.privateBrowsing = enable;
3508 Eina_Bool ewk_view_setting_application_cache_get(const Evas_Object* ewkView)
3510 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3511 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
3512 return priv->settings.offlineAppCache;
3515 Eina_Bool ewk_view_setting_application_cache_set(Evas_Object* ewkView, Eina_Bool enable)
3517 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3518 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
3520 if (priv->settings.offlineAppCache != enable) {
3521 priv->pageSettings->setOfflineWebApplicationCacheEnabled(enable);
3522 priv->settings.offlineAppCache = enable;
3527 Eina_Bool ewk_view_setting_caret_browsing_get(const Evas_Object* ewkView)
3529 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3530 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
3531 return priv->settings.caretBrowsing;
3534 Eina_Bool ewk_view_setting_caret_browsing_set(Evas_Object* ewkView, Eina_Bool enable)
3536 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3537 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
3539 if (priv->settings.caretBrowsing != enable) {
3540 priv->pageSettings->setCaretBrowsingEnabled(enable);
3541 priv->settings.caretBrowsing = enable;
3546 const char* ewk_view_setting_encoding_custom_get(const Evas_Object* ewkView)
3548 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
3549 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0);
3550 Evas_Object* mainFrame = ewk_view_frame_main_get(ewkView);
3551 WebCore::Frame* core_frame = EWKPrivate::coreFrame(mainFrame);
3553 String overrideEncoding = core_frame->loader()->documentLoader()->overrideEncoding();
3555 if (overrideEncoding.isEmpty())
3558 eina_stringshare_replace(&priv->settings.encodingCustom, overrideEncoding.utf8().data());
3559 return priv->settings.encodingCustom;
3562 Eina_Bool ewk_view_setting_encoding_custom_set(Evas_Object* ewkView, const char* encoding)
3564 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3565 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
3566 Evas_Object* mainFrame = ewk_view_frame_main_get(ewkView);
3567 WebCore::Frame* coreFrame = EWKPrivate::coreFrame(mainFrame);
3568 DBG("%s", encoding);
3569 if (eina_stringshare_replace(&priv->settings.encodingCustom, encoding))
3570 coreFrame->loader()->reloadWithOverrideEncoding(String::fromUTF8(encoding));
3574 const char* ewk_view_setting_encoding_default_get(const Evas_Object* ewkView)
3576 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
3577 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0);
3578 return priv->settings.encodingDefault;
3581 Eina_Bool ewk_view_setting_encoding_default_set(Evas_Object* ewkView, const char* encoding)
3583 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3584 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
3585 if (eina_stringshare_replace(&priv->settings.encodingDefault, encoding))
3586 priv->pageSettings->setDefaultTextEncodingName(String::fromUTF8(encoding));
3588 #if ENABLE(TIZEN_SET_DEFAULT_ENCODING)
3589 Evas_Object* mainFrame = ewk_view_frame_main_get(ewkView);
3590 WebCore::Frame* core_frame = ewk_frame_core_get(mainFrame);
3591 core_frame->loader()->documentLoader()->setOverrideEncoding(String::fromUTF8(encoding));
3597 Eina_Bool ewk_view_setting_encoding_detector_set(Evas_Object* ewkView, Eina_Bool enable)
3599 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3600 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
3602 if (priv->settings.encodingDetector != enable) {
3603 priv->pageSettings->setUsesEncodingDetector(enable);
3604 priv->settings.encodingDetector = enable;
3609 Eina_Bool ewk_view_setting_encoding_detector_get(const Evas_Object* ewkView)
3611 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3612 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
3613 return priv->settings.encodingDetector;
3616 Eina_Bool ewk_view_setting_enable_developer_extras_get(const Evas_Object* ewkView)
3618 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3619 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
3620 return priv->settings.enableDeveloperExtras;
3623 Eina_Bool ewk_view_setting_enable_developer_extras_set(Evas_Object* ewkView, Eina_Bool enable)
3625 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3626 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
3628 if (priv->settings.enableDeveloperExtras != enable) {
3629 priv->pageSettings->setDeveloperExtrasEnabled(enable);
3630 priv->settings.enableDeveloperExtras = enable;
3635 int ewk_view_setting_font_minimum_size_get(const Evas_Object* ewkView)
3637 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
3638 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0);
3639 return priv->settings.fontMinimumSize;
3642 Eina_Bool ewk_view_setting_font_minimum_size_set(Evas_Object* ewkView, int size)
3644 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3645 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
3646 if (priv->settings.fontMinimumSize != size) {
3647 priv->pageSettings->setMinimumFontSize(size);
3648 priv->settings.fontMinimumSize = size;
3653 int ewk_view_setting_font_minimum_logical_size_get(const Evas_Object* ewkView)
3655 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
3656 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0);
3657 return priv->settings.fontMinimumLogicalSize;
3660 Eina_Bool ewk_view_setting_font_minimum_logical_size_set(Evas_Object* ewkView, int size)
3662 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3663 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
3664 if (priv->settings.fontMinimumLogicalSize != size) {
3665 priv->pageSettings->setMinimumLogicalFontSize(size);
3666 priv->settings.fontMinimumLogicalSize = size;
3671 int ewk_view_setting_font_default_size_get(const Evas_Object* ewkView)
3673 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
3674 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0);
3675 return priv->settings.fontDefaultSize;
3678 Eina_Bool ewk_view_setting_font_default_size_set(Evas_Object* ewkView, int size)
3680 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3681 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
3682 if (priv->settings.fontDefaultSize != size) {
3683 priv->pageSettings->setDefaultFontSize(size);
3684 priv->settings.fontDefaultSize = size;
3689 int ewk_view_setting_font_monospace_size_get(const Evas_Object* ewkView)
3691 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
3692 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0);
3693 return priv->settings.fontMonospaceSize;
3696 Eina_Bool ewk_view_setting_font_monospace_size_set(Evas_Object* ewkView, int size)
3698 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3699 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
3700 if (priv->settings.fontMonospaceSize != size) {
3701 priv->pageSettings->setDefaultFixedFontSize(size);
3702 priv->settings.fontMonospaceSize = size;
3707 const char* ewk_view_font_family_name_get(const Evas_Object* ewkView, Ewk_Font_Family fontFamily)
3709 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
3710 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0);
3712 switch (fontFamily) {
3713 case EWK_FONT_FAMILY_STANDARD:
3714 return priv->settings.fontStandard;
3715 case EWK_FONT_FAMILY_CURSIVE:
3716 return priv->settings.fontCursive;
3717 case EWK_FONT_FAMILY_FANTASY:
3718 return priv->settings.fontFantasy;
3719 case EWK_FONT_FAMILY_MONOSPACE:
3720 return priv->settings.fontMonospace;
3721 case EWK_FONT_FAMILY_SERIF:
3722 return priv->settings.fontSerif;
3723 case EWK_FONT_FAMILY_SANS_SERIF:
3724 return priv->settings.fontSansSerif;
3729 Eina_Bool ewk_view_font_family_name_set(Evas_Object* ewkView, Ewk_Font_Family fontFamily, const char* name)
3731 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3732 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
3734 switch (fontFamily) {
3735 case EWK_FONT_FAMILY_STANDARD:
3736 if (eina_stringshare_replace(&priv->settings.fontStandard, name))
3737 priv->pageSettings->setStandardFontFamily(AtomicString::fromUTF8(name));
3739 case EWK_FONT_FAMILY_CURSIVE:
3740 if (eina_stringshare_replace(&priv->settings.fontCursive, name))
3741 priv->pageSettings->setCursiveFontFamily(AtomicString::fromUTF8(name));
3743 case EWK_FONT_FAMILY_FANTASY:
3744 if (eina_stringshare_replace(&priv->settings.fontFantasy, name))
3745 priv->pageSettings->setFantasyFontFamily(AtomicString::fromUTF8(name));
3747 case EWK_FONT_FAMILY_MONOSPACE:
3748 if (eina_stringshare_replace(&priv->settings.fontMonospace, name))
3749 priv->pageSettings->setFixedFontFamily(AtomicString::fromUTF8(name));
3751 case EWK_FONT_FAMILY_SERIF:
3752 if (eina_stringshare_replace(&priv->settings.fontSerif, name))
3753 priv->pageSettings->setSerifFontFamily(AtomicString::fromUTF8(name));
3755 case EWK_FONT_FAMILY_SANS_SERIF:
3756 if (eina_stringshare_replace(&priv->settings.fontSansSerif, name))
3757 priv->pageSettings->setSansSerifFontFamily(AtomicString::fromUTF8(name));
3766 Eina_Bool ewk_view_setting_spatial_navigation_get(const Evas_Object* ewkView)
3768 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3769 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
3770 return priv->settings.spatialNavigation;
3773 Eina_Bool ewk_view_setting_spatial_navigation_set(Evas_Object* ewkView, Eina_Bool enable)
3775 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3776 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
3778 if (priv->settings.spatialNavigation != enable) {
3779 priv->pageSettings->setSpatialNavigationEnabled(enable);
3780 priv->settings.spatialNavigation = enable;
3785 Eina_Bool ewk_view_setting_local_storage_get(const Evas_Object* ewkView)
3787 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3788 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
3789 return priv->settings.localStorage;
3792 Eina_Bool ewk_view_setting_local_storage_set(Evas_Object* ewkView, Eina_Bool enable)
3794 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3795 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
3797 if (priv->settings.localStorage != enable) {
3798 priv->pageSettings->setLocalStorageEnabled(enable);
3799 priv->settings.localStorage = enable;
3804 Eina_Bool ewk_view_setting_web_audio_get(const Evas_Object* ewkView)
3806 #if ENABLE(TIZEN_WEB_AUDIO)
3807 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, EINA_FALSE);
3808 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, EINA_FALSE);
3809 return priv->settings.webAudio;
3815 Eina_Bool ewk_view_setting_web_audio_set(Evas_Object* ewkView, Eina_Bool enable)
3817 #if ENABLE(TIZEN_WEB_AUDIO)
3818 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, EINA_FALSE);
3819 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, EINA_FALSE);
3821 if (priv->settings.webAudio != enable) {
3822 priv->pageSettings->setWebAudioEnabled(enable);
3823 priv->settings.webAudio = enable;
3831 Eina_Bool ewk_view_setting_page_cache_get(const Evas_Object* ewkView)
3833 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3834 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
3835 return priv->settings.pageCache;
3838 Eina_Bool ewk_view_setting_page_cache_set(Evas_Object* ewkView, Eina_Bool enable)
3840 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3841 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
3843 if (priv->settings.pageCache != enable) {
3844 priv->pageSettings->setUsesPageCache(enable);
3845 priv->settings.pageCache = enable;
3850 const char* ewk_view_setting_local_storage_database_path_get(const Evas_Object* ewkView)
3852 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
3853 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0);
3854 return priv->settings.localStorageDatabasePath;
3857 Eina_Bool ewk_view_setting_local_storage_database_path_set(Evas_Object* ewkView, const char* path)
3859 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3860 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
3861 if (eina_stringshare_replace(&priv->settings.localStorageDatabasePath, path))
3862 priv->pageSettings->setLocalStorageDatabasePath(String::fromUTF8(path));
3866 Eina_Bool ewk_view_setting_minimum_timer_interval_set(Evas_Object* ewkView, double interval)
3868 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3869 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
3870 if (fabs(priv->settings.domTimerInterval - interval) >= std::numeric_limits<double>::epsilon()) {
3871 priv->pageSettings->setMinDOMTimerInterval(interval);
3872 priv->settings.domTimerInterval = interval;
3877 double ewk_view_setting_minimum_timer_interval_get(const Evas_Object* ewkView)
3879 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3880 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
3881 return priv->settings.domTimerInterval;
3884 Eina_Bool ewk_view_setting_enable_focus_ring_get(const Evas_Object* ewkView)
3886 #if ENABLE(TIZEN_FOCUS_RING)
3887 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3888 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
3889 return priv->settings.enableFocusRing;
3895 Eina_Bool ewk_view_setting_enable_focus_ring_set(Evas_Object* ewkView, Eina_Bool enable)
3897 #if ENABLE(TIZEN_FOCUS_RING)
3898 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3899 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
3901 if (priv->settings.enableFocusRing != enable) {
3902 priv->pageSettings->setFocusRingEnabled(enable);
3903 priv->settings.enableFocusRing = enable;
3912 * Get status of onscroll event suppression.
3914 * @param ewkView view to check status
3916 * @return true if suppression is enabled, false
3917 * otherwise (errors, suppression disabled).
3920 Eina_Bool ewk_view_setting_enable_onscroll_event_suppression_get(const Evas_Object* ewkView)
3922 #if ENABLE(TIZEN_ONSCROLL_EVENT_SUPPRESSION)
3923 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3924 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
3925 return priv->settings.enableOnscrollEventSuppression;
3927 LOG_ERROR("TIZEN_ONSCROLL_EVENT_SUPPRESSION is disabled. \n");
3933 * Set onscroll event suppression.
3935 * @param ewkView view to set suppression
3937 * @return true if suppression status set, false
3938 * otherwise (errors).
3940 Eina_Bool ewk_view_setting_enable_onscroll_event_suppression_set(Evas_Object* ewkView, Eina_Bool enable)
3942 #if ENABLE(TIZEN_ONSCROLL_EVENT_SUPPRESSION)
3943 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3944 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
3946 if (priv->settings.enableOnscrollEventSuppression != enable) {
3947 priv->pageSettings->setOnscrollEventSuppressionEnabled(enable);
3948 priv->settings.enableOnscrollEventSuppression = enable;
3952 LOG_ERROR("TIZEN_ONSCROLL_EVENT_SUPPRESSION is disabled. \n");
3958 * Function sets selection visibility.
3960 * @param [in] ewkView view
3961 * @param [in] flag @c true if selection should be visibile, @c false if not
3963 * @return true If setting visibility succeeds, false if setting visibility was not possible
3965 Eina_Bool ewk_view_selection_visibility_set(Evas_Object* ewkView, Eina_Bool flag)
3967 #if ENABLE(TIZEN_PARAGRAPH_SELECTION)
3968 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3969 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
3970 WebCore::Page* page = priv->page.get();
3973 // Invisible background and black text for selection.
3974 ((WebCore::RenderThemeEfl*)page->theme())->setActiveSelectionColor(0, 0, 0, 255, 255, 255, 255, 0);
3975 ((WebCore::RenderThemeEfl*)page->theme())->setInactiveSelectionColor(0, 0, 0, 255, 255, 255, 255, 0);
3977 // Not really changing theme but I want to use defined colors again.
3978 ((WebCore::RenderThemeEfl*)page->theme())->themeChanged();
3982 LOG_ERROR("TIZEN_PARAGRAPH_SELECTION is disabled. \n");
3987 Eina_Bool ewk_view_setting_enable_webgl_get(const Evas_Object* ewkView)
3989 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3990 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
3991 return priv->settings.webGLEnabled;
3994 Eina_Bool ewk_view_setting_enable_webgl_set(Evas_Object* ewkView, Eina_Bool enable)
3996 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3997 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
3999 if (priv->settings.webGLEnabled != enable) {
4000 priv->pageSettings->setWebGLEnabled(enable);
4001 priv->settings.webGLEnabled = enable;
4006 Eina_Bool ewk_view_setting_include_links_in_focus_chain_get(const Evas_Object* ewkView)
4008 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
4009 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
4010 return priv->settings.tabsToLinks;
4013 Eina_Bool ewk_view_setting_include_links_in_focus_chain_set(Evas_Object* ewkView, Eina_Bool enable)
4015 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
4016 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
4018 priv->settings.tabsToLinks = enable;
4022 Eina_Bool ewk_view_setting_enable_hyperlink_auditing_get(const Evas_Object* ewkView)
4024 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
4025 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
4026 return priv->settings.hyperlinkAuditingEnabled;
4029 Eina_Bool ewk_view_setting_enable_hyperlink_auditing_set(Evas_Object* ewkView, Eina_Bool enable)
4031 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
4032 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
4034 if (priv->settings.hyperlinkAuditingEnabled != enable) {
4035 priv->pageSettings->setHyperlinkAuditingEnabled(enable);
4036 priv->settings.hyperlinkAuditingEnabled = enable;
4041 Ewk_View_Smart_Data* ewk_view_smart_data_get(const Evas_Object* ewkView)
4043 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
4048 * Gets the internal array of repaint requests.
4050 * This array should not be modified anyhow. It should be processed
4051 * immediately as any further ewk_view call might change it, like
4052 * those that add repaints or flush them, so be sure that your code
4053 * does not call any of those while you process the repaints,
4054 * otherwise copy the array.
4056 * @param priv private handle pointer of the view to get repaints.
4057 * @param count where to return the number of elements of returned array, may be @c 0.
4059 * @return reference to array of requested repaints.
4061 * @note this is not for general use but just for subclasses that want
4062 * to define their own backing store.
4064 const Eina_Rectangle* ewk_view_repaints_pop(Ewk_View_Private_Data* priv, size_t* count)
4068 EINA_SAFETY_ON_NULL_RETURN_VAL(priv, 0);
4070 *count = priv->repaints.count;
4072 priv->repaints.count = 0;
4074 return priv->repaints.array;
4078 * Gets the internal array of scroll requests.
4080 * This array should not be modified anyhow. It should be processed
4081 * immediately as any further ewk_view call might change it, like
4082 * those that add scrolls or flush them, so be sure that your code
4083 * does not call any of those while you process the scrolls,
4084 * otherwise copy the array.
4086 * @param priv private handle pointer of the view to get scrolls.
4087 * @param count where to return the number of elements of returned array, may be @c 0.
4089 * @return reference to array of requested scrolls.
4091 * @note this is not for general use but just for subclasses that want
4092 * to define their own backing store.
4094 const Ewk_Scroll_Request* ewk_view_scroll_requests_get(const Ewk_View_Private_Data* priv, size_t* count)
4098 EINA_SAFETY_ON_NULL_RETURN_VAL(priv, 0);
4100 *count = priv->scrolls.count;
4101 return priv->scrolls.array;
4105 * Add a new repaint request to queue.
4107 * The repaints are assumed to be relative to current viewport.
4109 * @param priv private handle pointer of the view to add repaint request.
4110 * @param x horizontal position relative to current view port (scrolled).
4111 * @param y vertical position relative to current view port (scrolled).
4112 * @param width width of area to be repainted
4113 * @param height height of area to be repainted
4115 * @note this is not for general use but just for subclasses that want
4116 * to define their own backing store.
4118 void ewk_view_repaint_add(Ewk_View_Private_Data* priv, Evas_Coord x, Evas_Coord y, Evas_Coord width, Evas_Coord height)
4120 EINA_SAFETY_ON_NULL_RETURN(priv);
4121 _ewk_view_repaint_add(priv, x, y, width, height);
4125 * Do layout if required, applied recursively.
4127 * @param priv private handle pointer of the view to layout.
4129 * @note this is not for general use but just for subclasses that want
4130 * to define their own backing store.
4132 void ewk_view_layout_if_needed_recursive(Ewk_View_Private_Data* priv)
4134 EINA_SAFETY_ON_NULL_RETURN(priv);
4136 WebCore::FrameView* view = priv->mainFrame->view();
4138 ERR("no main frame view");
4141 view->updateLayoutAndStyleIfNeededRecursive();
4144 void ewk_view_scrolls_process(Ewk_View_Smart_Data* smartData)
4146 EINA_SAFETY_ON_NULL_RETURN(smartData);
4147 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
4148 if (!smartData->api->scrolls_process(smartData))
4149 ERR("failed to process scrolls.");
4150 _ewk_view_scrolls_flush(priv);
4154 * @brief Structure that keeps the paint context.
4158 * @note This is not for general use but just for subclasses that want
4159 * to define their own backing store.
4161 struct _Ewk_View_Paint_Context {
4162 WebCore::FrameView* view;
4163 OwnPtr<WebCore::GraphicsContext> graphicContext;
4164 RefPtr<cairo_t> cairo;
4167 Ewk_View_Paint_Context* ewk_view_paint_context_new(Ewk_View_Private_Data* priv, cairo_t* cairo)
4169 EINA_SAFETY_ON_NULL_RETURN_VAL(priv, 0);
4170 EINA_SAFETY_ON_NULL_RETURN_VAL(cairo, 0);
4171 EINA_SAFETY_ON_NULL_RETURN_VAL(priv->mainFrame, 0);
4172 EINA_SAFETY_ON_NULL_RETURN_VAL(priv->mainFrame->view(), 0);
4174 Ewk_View_Paint_Context* context = new Ewk_View_Paint_Context;
4175 context->view = priv->mainFrame->view();
4176 context->graphicContext = adoptPtr(new WebCore::GraphicsContext(cairo));
4177 context->cairo = adoptRef(cairo_reference(cairo));
4181 void ewk_view_paint_context_free(Ewk_View_Paint_Context* context)
4183 EINA_SAFETY_ON_NULL_RETURN(context);
4188 void ewk_view_paint_context_save(Ewk_View_Paint_Context* context)
4190 EINA_SAFETY_ON_NULL_RETURN(context);
4192 cairo_save(context->cairo.get());
4193 context->graphicContext->save();
4196 void ewk_view_paint_context_restore(Ewk_View_Paint_Context* context)
4198 EINA_SAFETY_ON_NULL_RETURN(context);
4200 context->graphicContext->restore();
4201 cairo_restore(context->cairo.get());
4204 void ewk_view_paint_context_clip(Ewk_View_Paint_Context* context, const Eina_Rectangle* area)
4206 EINA_SAFETY_ON_NULL_RETURN(context);
4207 EINA_SAFETY_ON_NULL_RETURN(area);
4208 context->graphicContext->clip(WebCore::IntRect(*area));
4211 void ewk_view_paint_context_paint(Ewk_View_Paint_Context* context, const Eina_Rectangle* area)
4213 EINA_SAFETY_ON_NULL_RETURN(context);
4214 EINA_SAFETY_ON_NULL_RETURN(area);
4216 WebCore::IntRect rect(*area);
4218 if (context->view->isTransparent())
4219 context->graphicContext->clearRect(rect);
4220 context->view->paint(context->graphicContext.get(), rect);
4223 void ewk_view_paint_context_paint_contents(Ewk_View_Paint_Context* context, const Eina_Rectangle* area)
4225 EINA_SAFETY_ON_NULL_RETURN(context);
4226 EINA_SAFETY_ON_NULL_RETURN(area);
4228 WebCore::IntRect rect(*area);
4230 if (context->view->isTransparent())
4231 context->graphicContext->clearRect(rect);
4233 context->view->paintContents(context->graphicContext.get(), rect);
4236 void ewk_view_paint_context_scale(Ewk_View_Paint_Context* context, float scaleX, float scaleY)
4238 EINA_SAFETY_ON_NULL_RETURN(context);
4240 context->graphicContext->scale(WebCore::FloatSize(scaleX, scaleY));
4243 void ewk_view_paint_context_translate(Ewk_View_Paint_Context* context, float x, float y)
4245 EINA_SAFETY_ON_NULL_RETURN(context);
4247 context->graphicContext->translate(x, y);
4250 Eina_Bool ewk_view_paint(Ewk_View_Private_Data* priv, cairo_t* cr, const Eina_Rectangle* area)
4252 EINA_SAFETY_ON_NULL_RETURN_VAL(priv, false);
4253 EINA_SAFETY_ON_NULL_RETURN_VAL(cr, false);
4254 EINA_SAFETY_ON_NULL_RETURN_VAL(area, false);
4255 WebCore::FrameView* view = priv->mainFrame->view();
4256 EINA_SAFETY_ON_NULL_RETURN_VAL(view, false);
4258 view->updateLayoutAndStyleIfNeededRecursive();
4259 WebCore::GraphicsContext graphicsContext(cr);
4260 WebCore::IntRect rect(*area);
4263 graphicsContext.save();
4264 graphicsContext.clip(rect);
4265 if (view->isTransparent())
4266 graphicsContext.clearRect(rect);
4267 view->paint(&graphicsContext, rect);
4268 graphicsContext.restore();
4275 #if ENABLE(TIZEN_SKIA_FOR_PROFILE)
4279 Eina_Bool ewk_view_paint_contents_for_profile(Ewk_View_Private_Data* priv, uint8_t* pixels, float zoom, const Eina_Rectangle* dst_area, const Eina_Rectangle* area);
4283 Eina_Bool ewk_view_paint_contents_for_profile(Ewk_View_Private_Data* priv, uint8_t* pixels, float zoom, const Eina_Rectangle* dst_area, const Eina_Rectangle* area)
4285 EINA_SAFETY_ON_NULL_RETURN_VAL(priv, false);
4286 EINA_SAFETY_ON_NULL_RETURN_VAL(pixels, false);
4287 EINA_SAFETY_ON_NULL_RETURN_VAL(area, false);
4288 WebCore::FrameView* view = priv->mainFrame->view();
4289 EINA_SAFETY_ON_NULL_RETURN_VAL(view, false);
4291 cairo_status_t status;
4293 Eina_Bool result = true;
4296 cairo_surface_t* surface;
4297 surface = cairo_image_surface_create_for_data(pixels, CAIRO_FORMAT_ARGB32, dst_area->w, dst_area->h, dst_area->w * 4);
4298 cr = cairo_create(surface);
4299 cairo_scale(cr, zoom, zoom);
4300 cairo_translate(cr, -dst_area->x, -dst_area->y);
4301 cairo_set_antialias(cairo, CAIRO_ANTIALIAS_NONE);
4302 WebCore::GraphicsContext gc(cr);
4304 skia::PlatformCanvas canvas(dst_area->w, dst_area->h, 1, pixels);
4305 WebCore::PlatformContextSkia sContext(&canvas);
4306 WebCore::GraphicsContext gc(&sContext);
4307 gc.scale(WebCore::FloatSize(zoom, zoom));
4308 gc.translate(-dst_area->x, -dst_area->y);
4310 WebCore::IntRect rect(area->x, area->y, area->w, area->h);
4316 if (view->isTransparent())
4318 view->paintContents(&gc, rect);
4321 status = cairo_status(cr);
4322 if (status != CAIRO_STATUS_SUCCESS) {
4323 ERR("Invalid status of cario context: %s", cairo_status_to_string(status));
4330 cairo_identity_matrix(cr);
4331 cairo_surface_destroy(surface);
4338 Eina_Bool ewk_view_paint_contents(Ewk_View_Private_Data* priv, cairo_t* cr, const Eina_Rectangle* area)
4340 EINA_SAFETY_ON_NULL_RETURN_VAL(priv, false);
4341 EINA_SAFETY_ON_NULL_RETURN_VAL(cr, false);
4342 EINA_SAFETY_ON_NULL_RETURN_VAL(area, false);
4343 WebCore::FrameView* view = priv->mainFrame->view();
4344 EINA_SAFETY_ON_NULL_RETURN_VAL(view, false);
4346 WebCore::GraphicsContext graphicsContext(cr);
4347 WebCore::IntRect rect(*area);
4349 view->updateLayoutAndStyleIfNeededRecursive();
4351 graphicsContext.save();
4352 graphicsContext.clip(rect);
4353 if (view->isTransparent())
4354 graphicsContext.clearRect(rect);
4356 #if ENABLE(TIZEN_WEBCORE_SELECTIVE_RENDERING)
4357 view->paintContents(&graphicsContext, rect, priv->delaysHeavyTiles);
4359 view->paintContents(&graphicsContext, rect);
4362 #if ENABLE(INSPECTOR) && ENABLE(TIZEN_REMOTE_WEB_INSPECTOR)
4363 WebCore::InspectorController* controller = priv->page->inspectorController();
4364 if (controller && controller->highlightedNode())
4365 controller->drawHighlight(graphicsContext);
4368 graphicsContext.restore();
4375 /* internal methods ****************************************************/
4378 * Reports the view is ready to be displayed as all elements are aready.
4380 * Emits signal: "ready" with no parameters.
4382 void ewk_view_ready(Evas_Object* ewkView)
4384 DBG("ewkView=%p", ewkView);
4385 evas_object_smart_callback_call(ewkView, "ready", 0);
4390 * Reports the state of input method changed. This is triggered, for example
4391 * when a input field received/lost focus
4393 * Emits signal: "inputmethod,changed" with a boolean indicating whether it's
4396 void ewk_view_input_method_state_set(Evas_Object* ewkView, bool active)
4398 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
4399 EWK_VIEW_PRIV_GET(smartData, priv);
4400 WebCore::Frame* focusedFrame = priv->page->focusController()->focusedOrMainFrame();
4404 && focusedFrame->document()
4405 && focusedFrame->document()->focusedNode()
4406 && focusedFrame->document()->focusedNode()->hasTagName(WebCore::HTMLNames::inputTag)) {
4407 WebCore::HTMLInputElement* inputElement;
4409 inputElement = static_cast<WebCore::HTMLInputElement*>(focusedFrame->document()->focusedNode());
4411 // for password fields, active == false
4413 active = inputElement->isPasswordField();
4414 priv->imh = inputElement->isPasswordField() * EWK_IMH_PASSWORD;
4416 // Set input method hints for "number", "tel", "email", and "url" input elements.
4417 priv->imh |= inputElement->isTelephoneField() * EWK_IMH_TELEPHONE;
4418 priv->imh |= inputElement->isNumberField() * EWK_IMH_NUMBER;
4419 priv->imh |= inputElement->isEmailField() * EWK_IMH_EMAIL;
4420 priv->imh |= inputElement->isURLField() * EWK_IMH_URL;
4421 #if ENABLE(TIZEN_INPUT_TAG_SUPPORT)
4422 priv->imh |= inputElement->isColorField() * EWK_IMH_COLOR;
4423 priv->imh |= inputElement->isDateField() * EWK_IMH_DATE;
4424 priv->imh |= inputElement->isDateTimeField() * EWK_IMH_DATETIME;
4425 priv->imh |= inputElement->isDateTimeLocalField() * EWK_IMH_DATETIMELOCAL;
4426 priv->imh |= inputElement->isMonthField() * EWK_IMH_MONTH;
4427 priv->imh |= inputElement->isTimeField() * EWK_IMH_TIME;
4428 priv->imh |= inputElement->isWeekField() * EWK_IMH_WEEK;
4433 #if ENABLE(TIZEN_ISF_PORT)
4434 // pass the focused input element's rect as a event-info.
4437 && focusedFrame->document()) {
4438 if (focusedFrame->document()->focusedNode()) {
4439 WebCore::IntRect focusedRect = focusedFrame->document()->focusedNode()->getRect();
4441 // add for inner frame
4442 WebCore::Frame* mainFrame = priv->page->mainFrame();
4443 WebCore::Frame* innerFrame = focusedFrame;
4444 while (innerFrame && innerFrame != mainFrame) {
4445 WebCore::Node* owner = innerFrame->ownerElement();
4447 focusedRect.move(owner->getRect().x(), owner->getRect().y());
4448 innerFrame = owner->document()->frame();
4453 // pass rect with inputmethod,changed event
4454 Eina_Rectangle rect = {focusedRect.x(), focusedRect.y(), focusedRect.width(), focusedRect.height()};
4455 evas_object_smart_callback_call(ewkView, "inputmethod,changed", (void*)&rect);
4457 // if we get an input method state true without focused node we pass 0 but we do not clear selection
4458 // zoom will not work but a keyboard will remain shown
4459 evas_object_smart_callback_call(ewkView, "inputmethod,changed", 0);
4462 // if there is no focused inputElement, the inputmethod,changed's data will be null.
4463 evas_object_smart_callback_call(ewkView, "inputmethod,changed", 0);
4466 evas_object_smart_callback_call(ewkView, "inputmethod,changed", (void*)active);
4472 * The view title was changed by the frame loader.
4474 * Emits signal: "title,changed" with pointer to new title string.
4476 void ewk_view_title_set(Evas_Object* ewkView, const Ewk_Text_With_Direction* title)
4478 DBG("ewkView=%p, title=%s", ewkView, (title && title->string) ? title->string : "(null)");
4479 evas_object_smart_callback_call(ewkView, "title,changed", (void*)title);
4484 * Reports that main frame's uri changed.
4486 * Emits signal: "uri,changed" with pointer to the new uri string.
4488 void ewk_view_uri_changed(Evas_Object* ewkView)
4490 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
4491 const char* uri = ewk_frame_uri_get(smartData->main_frame);
4492 DBG("ewkView=%p, uri=%s", ewkView, uri ? uri : "(null)");
4493 evas_object_smart_callback_call(ewkView, "uri,changed", (void*)uri);
4498 * Reports that a DOM document object has finished loading for @p frame.
4500 * @param ewkView View which contains the frame.
4501 * @param frame The frame whose load has triggered the event.
4503 * Emits signal: "load,document,finished" with @p frame as the parameter.
4505 void ewk_view_load_document_finished(Evas_Object* ewkView, Evas_Object* frame)
4507 evas_object_smart_callback_call(ewkView, "load,document,finished", frame);
4512 * Reports the view started loading something.
4514 * @param ewkView View.
4515 * @param ewkFrame Frame being loaded.
4517 * Emits signal: "load,started" with no parameters.
4519 void ewk_view_load_started(Evas_Object* ewkView, Evas_Object* ewkFrame)
4521 DBG("ewkView=%p, ewkFrame=%p", ewkView, ewkFrame);
4522 #if ENABLE(TIZEN_ISF_PORT) || ENABLE(TIZEN_FIRST_PAINT_NOTI)
4523 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
4524 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
4526 evas_object_smart_callback_call(ewkView, "load,started", ewkFrame);
4528 #if ENABLE(TIZEN_RECORDING_SURFACE)
4529 if (priv->recordingSurfaceEnable) {
4530 priv->recordingSurfaceSetLoadFinished = false;
4531 priv->recordingSurfaceSetState = RECORDING_SURFACE_SET_STATE_INIT;
4532 priv->recordingSurfaceSetList = ewk_recording_surface_set_free(priv->recordingSurfaceSetList);
4536 #if ENABLE(TIZEN_FIRST_PAINT_NOTI)
4537 evas_object_smart_callback_del(smartData->backing_store, "paint,first", _ewk_view_first_paint_noti); // in order to prevent duplicated registration
4538 evas_object_smart_callback_add(smartData->backing_store, "paint,first", _ewk_view_first_paint_noti, smartData);
4541 #if ENABLE(TIZEN_ISF_PORT)
4543 && (ecore_imf_context_input_panel_state_get(priv->imContext) == ECORE_IMF_INPUT_PANEL_STATE_SHOW)) {
4544 ecore_imf_context_input_panel_hide(priv->imContext);
4545 ecore_imf_context_focus_out(priv->imContext);
4551 * Reports the frame started loading something.
4553 * @param ewkView View.
4555 * Emits signal: "load,started" on main frame with no parameters.
4557 void ewk_view_frame_main_load_started(Evas_Object* ewkView)
4559 DBG("ewkView=%p", ewkView);
4560 Evas_Object* frame = ewk_view_frame_main_get(ewkView);
4561 evas_object_smart_callback_call(frame, "load,started", 0);
4566 * Reports the main frame started provisional load.
4568 * @param ewkView View.
4570 * Emits signal: "load,provisional" on View with no parameters.
4572 void ewk_view_load_provisional(Evas_Object* ewkView)
4574 DBG("ewkView=%p", ewkView);
4575 evas_object_smart_callback_call(ewkView, "load,provisional", 0);
4580 * Reports the main frame provisional load failed.
4582 * @param ewkView View.
4583 * @param error Load error.
4585 * Emits signal: "load,provisional" on View with pointer to Ewk_Frame_Load_Error.
4587 void ewk_view_load_provisional_failed(Evas_Object* ewkView, const Ewk_Frame_Load_Error* error)
4589 DBG("ewkView=%p, error=%p", ewkView, error);
4590 evas_object_smart_callback_call(ewkView, "load,provisional,failed", const_cast<Ewk_Frame_Load_Error*>(error));
4595 * Reports view can be shown after a new window is created.
4597 * @param ewkView Frame.
4599 * Emits signal: "load,newwindow,show" on view with no parameters.
4601 void ewk_view_load_show(Evas_Object* ewkView)
4603 DBG("ewkView=%p", ewkView);
4604 evas_object_smart_callback_call(ewkView, "load,newwindow,show", 0);
4609 * Reports an onload event for @p frame.
4611 * @param ewkView View which contains the frame.
4612 * @param frame The frame whose onload event was received.
4614 * Emits signal: "onload,event" with @p frame as the parameter.
4616 void ewk_view_onload_event(Evas_Object* ewkView, Evas_Object* frame)
4618 evas_object_smart_callback_call(ewkView, "onload,event", frame);
4623 * Reports the main frame was cleared.
4625 * @param ewkView View.
4627 void ewk_view_frame_main_cleared(Evas_Object* ewkView)
4629 DBG("ewkView=%p", ewkView);
4630 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
4631 EINA_SAFETY_ON_NULL_RETURN(smartData->api->flush);
4632 smartData->api->flush(smartData);
4634 ewk_view_mixed_content_displayed_set(ewkView, false);
4635 ewk_view_mixed_content_run_set(ewkView, false);
4640 * Reports the main frame received an icon.
4642 * @param ewkView View.
4644 * Emits signal: "icon,received" with no parameters.
4646 void ewk_view_frame_main_icon_received(Evas_Object* ewkView)
4648 DBG("ewkView=%p", ewkView);
4649 Evas_Object* frame = ewk_view_frame_main_get(ewkView);
4650 evas_object_smart_callback_call(frame, "icon,received", 0);
4655 * Reports load finished, optionally with error information.
4657 * Emits signal: "load,finished" with pointer to #Ewk_Frame_Load_Error
4658 * if any error, or @c 0 if successful load.
4660 * @note there should not be any error stuff here, but trying to be
4661 * compatible with previous WebKit.
4663 void ewk_view_load_finished(Evas_Object* ewkView, const Ewk_Frame_Load_Error* error)
4665 DBG("ewkView=%p, error=%p", ewkView, error);
4666 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
4667 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
4668 #if ENABLE(TIZEN_WHITE_LOADING_FIX)
4669 /* If we reach this point and rendering is still disabled, WebCore will not
4670 * trigger the didFirstVisuallyNonEmptyLayout signal anymore. So, we
4671 * forcefully re-enable the rendering.
4672 * This is needed e.g. for standalone svg loading
4674 ewk_view_enable_render(ewkView);
4677 #if ENABLE(TIZEN_RECORDING_SURFACE)
4678 priv->callOnceAfterLoadFinished = true;
4679 #if !ENABLE(TIZEN_PRE_RENDERING_ENABLE)
4680 if (priv->recordingSurfaceEnable) {
4681 float zoom = ewk_view_zoom_get(ewkView);
4682 priv->recordingSurfaceSetState = RECORDING_SURFACE_SET_STATE_INIT;
4683 priv->recordingSurfaceSetList = ewk_recording_surface_set_free(priv->recordingSurfaceSetList);
4684 priv->recordingSurfaceSetList = ewk_recording_surface_set_base_record(priv->recordingSurfaceSetList, ewkView, zoom);
4685 priv->recordingSurfaceSetState= RECORDING_SURFACE_SET_STATE_COMPLETE;
4686 priv->recordingSurfaceSetLoadFinished = true;
4691 evas_object_smart_callback_call(ewkView, "load,finished", (void*)error);
4693 #if ENABLE(TIZEN_PAGE_CACHE)
4694 if (priv->cachedPageData.isRestored) {
4695 priv->cachedPageData.isRestored = false;
4696 ewk_view_zoom_set(ewkView, priv->cachedPageData.zoomLevel, 0, 0);
4697 ewk_frame_scroll_set(smartData->main_frame, priv->cachedPageData.scrollPos.x(), priv->cachedPageData.scrollPos.y());
4700 #if ENABLE(TIZEN_PRE_RENDERING_ENABLE)
4701 // when load finished, it need to pre-render forcely.
4702 ewk_view_pre_render_start(ewkView);
4704 #if ENABLE(TIZEN_RECORDING_SURFACE)
4705 ewk_view_recording_surface_start(ewkView);
4711 * Reports load failed with error information.
4713 * Emits signal: "load,error" with pointer to Ewk_Frame_Load_Error.
4715 void ewk_view_load_error(Evas_Object* ewkView, const Ewk_Frame_Load_Error* error)
4717 DBG("ewkView=%p, error=%p", ewkView, error);
4718 evas_object_smart_callback_call(ewkView, "load,error", (void*)error);
4723 * Reports load progress changed.
4725 * Emits signal: "load,progress" with pointer to a double from 0.0 to 1.0.
4727 void ewk_view_load_progress_changed(Evas_Object* ewkView)
4729 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
4730 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
4732 // Evas_Coord width, height;
4733 double progress = priv->page->progress()->estimatedProgress();
4735 DBG("ewkView=%p (p=%0.3f)", ewkView, progress);
4737 evas_object_smart_callback_call(ewkView, "load,progress", &progress);
4742 * Reports view @param ewkView should be restored to default conditions
4744 * @param ewkView View.
4745 * @param frame Frame that originated restore.
4747 * Emits signal: "restore" with frame.
4749 void ewk_view_restore_state(Evas_Object* ewkView, Evas_Object* frame)
4751 evas_object_smart_callback_call(ewkView, "restore", frame);
4756 * Delegates to browser the creation of a new window. If it is not implemented,
4757 * current view is returned, so navigation might continue in same window. If
4758 * browser supports the creation of new windows, a new Ewk_Window_Features is
4759 * created and passed to browser. If it intends to keep the request for opening
4760 * the window later it must increments the Ewk_Winwdow_Features ref count by
4761 * calling ewk_window_features_ref(window_features). Otherwise this struct will
4762 * be freed after returning to this function.
4764 * @param ewkView Current view.
4765 * @param javascript @c true if the new window is originated from javascript,
4766 * @c false otherwise
4767 * @param window_features Features of the new window being created. If it's @c
4768 * 0, it will be created a window with default features.
4770 * @return New view, in case smart class implements the creation of new windows;
4771 * else, current view @param ewkView or @c 0 on failure.
4773 * @see ewk_window_features_ref().
4775 #if ENABLE(TIZEN_FORM_SUBMIT_SUPPORT)
4776 Evas_Object* ewk_view_window_create(Evas_Object* ewkView, bool javascript, bool isMobile, const WebCore::WindowFeatures* coreFeatures, const WebCore::NavigationAction& action, const WTF::String& frameName)
4778 Evas_Object* ewk_view_window_create(Evas_Object* ewkView, bool javascript, const WebCore::WindowFeatures* coreFeatures)
4781 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
4782 #if ENABLE(TIZEN_FORM_SUBMIT_SUPPORT)
4783 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0);
4784 if (!smartData->api->window_create)
4788 if (!frameName.isEmpty())
4789 priv->frameName = eina_stringshare_add(frameName.utf8().data());
4791 priv->frameName = 0;
4794 Ewk_Window_Features* window_features = ewk_window_features_new_from_core(coreFeatures);
4795 Evas_Object* view = smartData->api->window_create(smartData, javascript, isMobile, window_features, action.type(), priv->frameName);
4798 priv->formWindow = view;
4800 ewk_window_features_unref(window_features);
4802 if (!smartData->api->window_create)
4805 Ewk_Window_Features* windowFeatures = ewk_window_features_new_from_core(coreFeatures);
4806 if (!windowFeatures)
4809 Evas_Object* view = smartData->api->window_create(smartData, javascript, windowFeatures);
4810 ewk_window_features_unref(windowFeatures);
4816 #if ENABLE(TIZEN_FORM_SUBMIT_SUPPORT)
4817 Evas_Object* ewk_view_form_window_get(Evas_Object* ewkView)
4819 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
4820 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0);
4821 return priv->formWindow;
4827 * Reports a window should be closed. It's client responsibility to decide if
4828 * the window should in fact be closed. So, if only windows created by javascript
4829 * are allowed to be closed by this call, browser needs to save the javascript
4830 * flag when the window is created. Since a window can close itself (for example
4831 * with a 'self.close()' in Javascript) browser must postpone the deletion to an
4834 * @param ewkView View to be closed.
4836 void ewk_view_window_close(Evas_Object* ewkView)
4838 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
4839 #if ENABLE(TIZEN_FORM_SUBMIT_SUPPORT)
4840 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
4843 ewk_view_stop(ewkView);
4844 if (!smartData->api->window_close)
4846 smartData->api->window_close(smartData);
4851 * Reports mouse has moved over a link.
4853 * Emits signal: "link,hover,in"
4855 void ewk_view_mouse_link_hover_in(Evas_Object* ewkView, void* data)
4857 evas_object_smart_callback_call(ewkView, "link,hover,in", data);
4862 * Reports mouse is not over a link anymore.
4864 * Emits signal: "link,hover,out"
4866 void ewk_view_mouse_link_hover_out(Evas_Object* ewkView)
4868 evas_object_smart_callback_call(ewkView, "link,hover,out", 0);
4873 * Set toolbar visible.
4875 * Emits signal: "toolbars,visible,set" with a pointer to a boolean.
4877 void ewk_view_toolbars_visible_set(Evas_Object* ewkView, bool visible)
4879 DBG("ewkView=%p (visible=%d)", ewkView, !!visible);
4880 evas_object_smart_callback_call(ewkView, "toolbars,visible,set", &visible);
4885 * Get toolbar visibility.
4887 * @param ewkView View.
4888 * @param visible boolean pointer in which to save the result. It defaults
4889 * to @c FALSE, i.e. if browser does no listen to emitted signal, it means
4890 * there are no toolbars and therefore they are not visible.
4892 * Emits signal: "toolbars,visible,get" with a pointer to a boolean.
4894 void ewk_view_toolbars_visible_get(Evas_Object* ewkView, bool* visible)
4896 DBG("%s, ewkView=%p", __func__, ewkView);
4898 evas_object_smart_callback_call(ewkView, "toolbars,visible,get", visible);
4903 * Set statusbar visible.
4905 * @param ewkView View.
4906 * @param visible @c TRUE if statusbar are visible, @c FALSE otherwise.
4908 * Emits signal: "statusbar,visible,set" with a pointer to a boolean.
4910 void ewk_view_statusbar_visible_set(Evas_Object* ewkView, bool visible)
4912 DBG("ewkView=%p (visible=%d)", ewkView, !!visible);
4913 evas_object_smart_callback_call(ewkView, "statusbar,visible,set", &visible);
4918 * Get statusbar visibility.
4920 * @param ewkView View.
4921 * @param visible boolean pointer in which to save the result. It defaults
4922 * to @c FALSE, i.e. if browser does no listen to emitted signal, it means
4923 * there is no statusbar and therefore it is not visible.
4925 * Emits signal: "statusbar,visible,get" with a pointer to a boolean.
4927 void ewk_view_statusbar_visible_get(Evas_Object* ewkView, bool* visible)
4929 DBG("%s, ewkView=%p", __func__, ewkView);
4931 evas_object_smart_callback_call(ewkView, "statusbar,visible,get", visible);
4936 * Set text of statusbar
4938 * @param ewkView View.
4939 * @param text New text to put on statusbar.
4941 * Emits signal: "statusbar,text,set" with a string.
4943 void ewk_view_statusbar_text_set(Evas_Object* ewkView, const char* text)
4945 DBG("ewkView=%p (text=%s)", ewkView, text);
4946 INF("status bar text set: %s", text);
4947 evas_object_smart_callback_call(ewkView, "statusbar,text,set", (void*)text);
4952 * Set scrollbars visible.
4954 * @param ewkView View.
4955 * @param visible @c TRUE if scrollbars are visible, @c FALSE otherwise.
4957 * Emits signal: "scrollbars,visible,set" with a pointer to a boolean.
4959 void ewk_view_scrollbars_visible_set(Evas_Object* ewkView, bool visible)
4961 DBG("ewkView=%p (visible=%d)", ewkView, !!visible);
4962 evas_object_smart_callback_call(ewkView, "scrollbars,visible,set", &visible);
4967 * Get scrollbars visibility.
4969 * @param ewkView View.
4970 * @param visible boolean pointer in which to save the result. It defaults
4971 * to @c FALSE, i.e. if browser does no listen to emitted signal, it means
4972 * there are no scrollbars and therefore they are not visible.
4974 * Emits signal: "scrollbars,visible,get" with a pointer to a boolean.
4976 void ewk_view_scrollbars_visible_get(Evas_Object* ewkView, bool* visible)
4978 DBG("%s, ewkView=%p", __func__, ewkView);
4980 evas_object_smart_callback_call(ewkView, "scrollbars,visible,get", visible);
4985 * Set menubar visible.
4987 * @param ewkView View.
4988 * @param visible @c TRUE if menubar is visible, @c FALSE otherwise.
4990 * Emits signal: "menubar,visible,set" with a pointer to a boolean.
4992 void ewk_view_menubar_visible_set(Evas_Object* ewkView, bool visible)
4994 DBG("ewkView=%p (visible=%d)", ewkView, !!visible);
4995 evas_object_smart_callback_call(ewkView, "menubar,visible,set", &visible);
5000 * Get menubar visibility.
5002 * @param ewkView View.
5003 * @param visible boolean pointer in which to save the result. It defaults
5004 * to @c FALSE, i.e. if browser does no listen to emitted signal, it means
5005 * there is no menubar and therefore it is not visible.
5007 * Emits signal: "menubar,visible,get" with a pointer to a boolean.
5009 void ewk_view_menubar_visible_get(Evas_Object* ewkView, bool* visible)
5011 DBG("%s, ewkView=%p", __func__, ewkView);
5013 evas_object_smart_callback_call(ewkView, "menubar,visible,get", visible);
5018 * Set tooltip text and display if it is currently hidden.
5020 * @param ewkView View.
5021 * @param text Text to set tooltip to.
5023 * Emits signal: "tooltip,text,set" with a string. If tooltip must be actually
5024 * removed, text will be 0 or '\0'
5026 void ewk_view_tooltip_text_set(Evas_Object* ewkView, const char* text)
5028 DBG("ewkView=%p text=%s", ewkView, text);
5029 evas_object_smart_callback_call(ewkView, "tooltip,text,set", (void*)text);
5035 * @param ewkView View.
5036 * @param message String to show on console.
5037 * @param lineNumber Line number.
5038 * @sourceID Source id.
5041 void ewk_view_add_console_message(Evas_Object* ewkView, const char* message, unsigned int lineNumber, const char* sourceID)
5043 DBG("ewkView=%p message=%s lineNumber=%u sourceID=%s", ewkView, message, lineNumber, sourceID);
5044 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
5045 EINA_SAFETY_ON_NULL_RETURN(smartData->api);
5046 EINA_SAFETY_ON_NULL_RETURN(smartData->api->add_console_message);
5047 smartData->api->add_console_message(smartData, message, lineNumber, sourceID);
5053 * Reports that FrameView object has been created.
5054 * Allows to repaint the frame completely even if the areas are out of the screen
5055 * when @ewkView is an instance of ewk_view_tiled.
5057 * @param ewkView view object
5059 void ewk_view_frame_view_creation_notify(Evas_Object* ewkView)
5061 EWK_VIEW_TYPE_CHECK_OR_RETURN(ewkView, ewkViewTiledName);
5062 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
5063 ewk_frame_paint_full_set(smartData->main_frame, true);
5066 bool ewk_view_focus_can_cycle(Evas_Object* ewkView, Ewk_Focus_Direction direction)
5068 DBG("ewkView=%p direction=%d", ewkView, direction);
5069 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
5070 EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->api, false);
5072 if (!smartData->api->focus_can_cycle)
5075 return smartData->api->focus_can_cycle(smartData, direction);
5078 void ewk_view_run_javascript_alert(Evas_Object* ewkView, Evas_Object* frame, const char* message)
5080 DBG("ewkView=%p frame=%p message=%s", ewkView, frame, message);
5081 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
5082 EINA_SAFETY_ON_NULL_RETURN(smartData->api);
5084 if (!smartData->api->run_javascript_alert)
5087 smartData->api->run_javascript_alert(smartData, frame, message);
5090 bool ewk_view_run_javascript_confirm(Evas_Object* ewkView, Evas_Object* frame, const char* message)
5092 DBG("ewkView=%p frame=%p message=%s", ewkView, frame, message);
5093 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
5094 EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->api, false);
5096 if (!smartData->api->run_javascript_confirm)
5099 return smartData->api->run_javascript_confirm(smartData, frame, message);
5102 bool ewk_view_run_javascript_prompt(Evas_Object* ewkView, Evas_Object* frame, const char* message, const char* defaultValue, char** value)
5104 DBG("ewkView=%p frame=%p message=%s", ewkView, frame, message);
5105 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
5106 EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->api, false);
5108 if (!smartData->api->run_javascript_prompt)
5111 return smartData->api->run_javascript_prompt(smartData, frame, message, defaultValue, value);
5116 * Delegates to client to decide whether a script must be stopped because it's
5117 * running for too long. If client does not implement it, it goes to default
5118 * implementation, which logs and returns false. Client may remove log by
5119 * setting this function 0, which will just return false.
5121 * @param ewkView View.
5123 * @return @c true if script should be stopped; @c false otherwise
5125 bool ewk_view_should_interrupt_javascript(Evas_Object* ewkView)
5127 DBG("ewkView=%p", ewkView);
5128 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
5129 EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->api, false);
5131 if (!smartData->api->should_interrupt_javascript)
5134 return smartData->api->should_interrupt_javascript(smartData);
5139 * This is called whenever the application is asking to store data to the cache and the
5140 * quota allocated to that application is exceeded. Browser may use this to increase the
5141 * size of quota before the originating operation fails.
5143 * @param ewkView View.
5144 * @param origin Security origin.
5145 * @param defaultOriginQuota Default quota for origin.
5146 * @param totalSpaceNeeded The total space needed in the cache in order to fulfill
5147 * application's requirement.
5149 int64_t ewk_view_exceeded_application_cache_quota(Evas_Object* ewkView, Ewk_Security_Origin *origin, int64_t defaultOriginQuota, int64_t totalSpaceNeeded)
5151 DBG("ewkView=%p", ewkView);
5152 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
5153 EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->api, 0);
5154 if (!smartData->api->exceeded_application_cache_quota)
5157 INF("defaultOriginQuota=%" PRIu64 " totalSpaceNeeded=%" PRIu64, defaultOriginQuota, totalSpaceNeeded);
5158 return smartData->api->exceeded_application_cache_quota(smartData, origin, defaultOriginQuota, totalSpaceNeeded);
5163 * This is called whenever the web site shown in @param frame is asking to store data
5164 * to the database @param databaseName and the quota allocated to that web site
5165 * is exceeded. Browser may use this to increase the size of quota before the
5166 * originating operationa fails.
5168 * @param ewkView View.
5169 * @param frame The frame whose web page exceeded its database quota.
5170 * @param databaseName Database name.
5171 * @param currentSize Current size of this database
5172 * @param expectedSize The expected size of this database in order to fulfill
5173 * site's requirement.
5175 uint64_t ewk_view_exceeded_database_quota(Evas_Object* ewkView, Evas_Object* frame, const char* databaseName, uint64_t currentSize, uint64_t expectedSize)
5177 DBG("ewkView=%p", ewkView);
5178 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
5179 EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->api, 0);
5180 if (!smartData->api->exceeded_database_quota)
5183 INF("currentSize=%" PRIu64 " expectedSize=%" PRIu64, currentSize, expectedSize);
5184 return smartData->api->exceeded_database_quota(smartData, frame, databaseName, currentSize, expectedSize);
5189 * Open panel to choose a file.
5191 * @param ewkView View.
5192 * @param frame Frame in which operation is required.
5193 * @param allowsMultipleFiles @c true when more than one file may be selected, @c false otherwise.
5194 * @param acceptMIMETypes List of accepted mime types. It is passed to child objects as an Eina_List of char pointers that is freed automatically.
5195 * @param selectedFilenames List of files selected.
5197 * @return @false if user canceled file selection; @true if confirmed.
5199 bool ewk_view_run_open_panel(Evas_Object* ewkView, Evas_Object* frame, bool allowsMultipleFiles, const WTF::Vector<WTF::String>& acceptMIMETypes, Eina_List** selectedFilenames)
5201 DBG("ewkView=%p frame=%p allows_multiple_files=%d", ewkView, frame, allowsMultipleFiles);
5202 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
5203 EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->api, false);
5205 if (!smartData->api->run_open_panel)
5208 *selectedFilenames = 0;
5210 Eina_List* cAcceptMIMETypes = 0;
5211 for (WTF::Vector<WTF::String>::const_iterator iterator = acceptMIMETypes.begin(); iterator != acceptMIMETypes.end(); ++iterator)
5212 cAcceptMIMETypes = eina_list_append(cAcceptMIMETypes, strdup((*iterator).utf8().data()));
5214 bool confirm = smartData->api->run_open_panel(smartData, frame, allowsMultipleFiles, cAcceptMIMETypes, selectedFilenames);
5215 if (!confirm && *selectedFilenames)
5216 ERR("Canceled file selection, but selected filenames != 0. Free names before return.");
5219 EINA_LIST_FREE(cAcceptMIMETypes, item)
5225 void ewk_view_repaint(Evas_Object* ewkView, Evas_Coord x, Evas_Coord y, Evas_Coord width, Evas_Coord height)
5227 DBG("ewkView=%p, region=%d,%d + %dx%d", ewkView, x, y, width, height);
5228 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
5229 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
5231 if (!priv->mainFrame->contentRenderer()) {
5232 ERR("no main frame content renderer.");
5236 _ewk_view_repaint_add(priv, x, y, width, height);
5237 _ewk_view_smart_changed(smartData);
5240 void ewk_view_scroll(Evas_Object* ewkView, Evas_Coord deltaX, Evas_Coord deltaY, Evas_Coord scrollX, Evas_Coord scrollY, Evas_Coord scrollWidth, Evas_Coord scrollHeight, Evas_Coord centerX, Evas_Coord centerY, Evas_Coord centerWidth, Evas_Coord centerHeight)
5242 DBG("ewkView=%p, delta: %d,%d, scroll: %d,%d+%dx%d, clip: %d,%d+%dx%d",
5243 ewkView, deltaX, deltaY, scrollX, scrollY, scrollWidth, scrollHeight, centerX, centerY, centerWidth, centerHeight);
5245 if ((scrollX != centerX) || (scrollY != centerY) || (scrollWidth != centerWidth) || (scrollHeight != centerHeight))
5246 WRN("scroll region and clip are different! %d,%d+%dx%d and %d,%d+%dx%d",
5247 scrollX, scrollY, scrollWidth, scrollHeight, centerX, centerY, centerWidth, centerHeight);
5249 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
5251 #if ENABLE(TIZEN_WEAK_SCROLL)
5252 if (!ewk_frame_weak_scroll_moving_viewport_get(smartData->main_frame))
5256 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
5257 EINA_SAFETY_ON_TRUE_RETURN(!deltaX && !deltaY);
5259 _ewk_view_scroll_add(priv, deltaX, deltaY, scrollX, scrollY, scrollWidth, scrollHeight);
5261 _ewk_view_smart_changed(smartData);
5265 * Creates a new frame for given url and owner element.
5267 * Emits "frame,created" with the new frame object on success.
5269 WTF::PassRefPtr<WebCore::Frame> ewk_view_frame_create(Evas_Object* ewkView, Evas_Object* frame, const WTF::String& name, WebCore::HTMLFrameOwnerElement* ownerElement, const WebCore::KURL& url, const WTF::String& referrer)
5271 DBG("ewkView=%p, frame=%p, name=%s, ownerElement=%p, url=%s, referrer=%s",
5272 ewkView, frame, name.utf8().data(), ownerElement,
5273 url.string().utf8().data(), referrer.utf8().data());
5275 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
5276 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0);
5278 WTF::RefPtr<WebCore::Frame> coreFrame = _ewk_view_core_frame_new
5279 (smartData, priv, ownerElement);
5281 ERR("Could not create child core frame '%s'", name.utf8().data());
5285 if (!ewk_frame_child_add(frame, coreFrame, name, url, referrer)) {
5286 ERR("Could not create child frame object '%s'", name.utf8().data());
5290 // The creation of the frame may have removed itself already.
5291 if (!coreFrame->page() || !coreFrame->tree() || !coreFrame->tree()->parent())
5294 smartData->changed.frame_rect = true;
5295 _ewk_view_smart_changed(smartData);
5297 return coreFrame.release();
5300 WTF::PassRefPtr<WebCore::Widget> ewk_view_plugin_create(Evas_Object* ewkView, Evas_Object* frame, const WebCore::IntSize& pluginSize, WebCore::HTMLPlugInElement* element, const WebCore::KURL& url, const WTF::Vector<WTF::String>& paramNames, const WTF::Vector<WTF::String>& paramValues, const WTF::String& mimeType, bool loadManually)
5302 DBG("ewkView=%p, frame=%p, size=%dx%d, element=%p, url=%s, mimeType=%s",
5303 ewkView, frame, pluginSize.width(), pluginSize.height(), element,
5304 url.string().utf8().data(), mimeType.utf8().data());
5306 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
5307 smartData->changed.frame_rect = true;
5308 _ewk_view_smart_changed(smartData);
5310 return ewk_frame_plugin_create
5311 (frame, pluginSize, element, url, paramNames, paramValues,
5312 mimeType, loadManually);
5318 * Creates a new popup with options when a select widget was clicked.
5320 * @param client PopupMenuClient instance that allows communication with webkit.
5321 * @param selected Selected item.
5322 * @param rect Menu's position.
5324 * Emits: "popup,create" with a list of Ewk_Menu containing each item's data
5326 void ewk_view_popup_new(Evas_Object* ewkView, WebCore::PopupMenuClient* client, int selected, const WebCore::IntRect& rect)
5328 INF("ewkView=%p", ewkView);
5329 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
5330 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
5332 if (priv->popup.menuClient)
5333 ewk_view_popup_destroy(ewkView);
5335 priv->popup.menuClient = client;
5338 const int size = client->listSize();
5339 for (int i = 0; i < size; ++i) {
5340 Ewk_Menu_Item* item = new Ewk_Menu_Item;
5341 if (client->itemIsSeparator(i))
5342 item->type = EWK_MENU_SEPARATOR;
5343 else if (client->itemIsLabel(i))
5344 item->type = EWK_MENU_GROUP;
5346 item->type = EWK_MENU_OPTION;
5347 item->text = eina_stringshare_add(client->itemText(i).utf8().data());
5349 priv->popup.menu.items = eina_list_append(priv->popup.menu.items, item);
5352 priv->popup.menu.x = rect.x();
5353 priv->popup.menu.y = rect.y();
5354 priv->popup.menu.width = rect.width();
5355 priv->popup.menu.height = rect.height();
5356 evas_object_smart_callback_call(ewkView, "popup,create", &priv->popup.menu);
5359 Eina_Bool ewk_view_popup_destroy(Evas_Object* ewkView)
5361 INF("ewkView=%p", ewkView);
5362 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
5363 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
5365 if (!priv->popup.menuClient)
5368 evas_object_smart_callback_call(ewkView, "popup,willdelete", &priv->popup.menu);
5371 EINA_LIST_FREE(priv->popup.menu.items, itemv) {
5372 Ewk_Menu_Item* item = static_cast<Ewk_Menu_Item*>(itemv);
5373 eina_stringshare_del(item->text);
5376 priv->popup.menuClient->popupDidHide();
5377 priv->popup.menuClient = 0;
5382 void ewk_view_popup_selected_set(Evas_Object* ewkView, int index)
5384 INF("ewkView=%p", ewkView);
5385 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
5386 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
5387 EINA_SAFETY_ON_NULL_RETURN(priv->popup.menuClient);
5389 priv->popup.menuClient->valueChanged(index);
5392 #if ENABLE(INPUT_TYPE_COLOR)
5396 * Creates a new color chooser with an initial selected color.
5398 * @param client ColorChooserClient instance that allows communication with webkit.
5399 * @param initialColor The initial selected color.
5402 void ewk_view_color_chooser_new(Evas_Object* ewkView, WebCore::ColorChooserClient* client, const WebCore::Color& initialColor)
5404 INF("ewkView=%p", ewkView);
5405 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
5406 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
5408 if (priv->colorChooserClient)
5409 ewk_view_color_chooser_destroy(ewkView);
5411 priv->colorChooserClient = client;
5414 color.r = initialColor.red();
5415 color.g = initialColor.green();
5416 color.b = initialColor.blue();
5417 color.a = initialColor.alpha();
5419 evas_object_smart_callback_call(ewkView, "colorchooser,create", &color);
5422 Eina_Bool ewk_view_color_chooser_destroy(Evas_Object* ewkView)
5424 INF("ewkView=%p", ewkView);
5425 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
5426 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
5428 if (!priv->colorChooserClient)
5431 evas_object_smart_callback_call(ewkView, "colorchooser,willdelete", 0);
5433 priv->colorChooserClient->didEndChooser();
5434 priv->colorChooserClient = 0;
5439 void ewk_view_color_chooser_color_set(Evas_Object *ewkView, int r, int g, int b)
5441 INF("ewkView=%p", ewkView);
5442 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
5443 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
5444 EINA_SAFETY_ON_NULL_RETURN(priv->colorChooserClient);
5446 // Alpha channel is not allowed, see ColorInputType::sanitizeValue().
5447 priv->colorChooserClient->didChooseColor(WebCore::Color(r, g, b));
5453 * The selected color of the color input associated with the color chooser has
5454 * changed. Usually the browser should updated the current selected value on the
5455 * color picker if the user is not interacting.
5457 * @param newColor The new selected color.
5460 void ewk_view_color_chooser_changed(Evas_Object* ewkView, const WebCore::Color& newColor)
5462 INF("ewkView=%p", ewkView);
5465 color.r = newColor.red();
5466 color.g = newColor.green();
5467 color.b = newColor.blue();
5468 color.a = newColor.alpha();
5470 evas_object_smart_callback_call(ewkView, "colorchooser,color,changed", &color);
5476 * Request a download to user.
5478 * @param ewkView View.
5479 * @oaram download Ewk_Download struct to be sent.
5481 * Emits: "download,request" with an Ewk_Download containing the details of the
5482 * requested download. The download per se must be handled outside of webkit.
5484 void ewk_view_download_request(Evas_Object* ewkView, Ewk_Download* download)
5486 DBG("ewkView=%p", ewkView);
5487 evas_object_smart_callback_call(ewkView, "download,request", download);
5490 #if ENABLE(NETSCAPE_PLUGIN_API)
5493 * Reports the JS window object was cleared.
5495 * @param ewkView view.
5496 * @param frame the frame.
5498 void ewk_view_js_window_object_clear(Evas_Object* ewkView, Evas_Object* frame)
5500 evas_object_smart_callback_call(ewkView, "js,windowobject,clear", frame);
5506 * Reports the viewport has changed.
5508 * @param arguments viewport argument.
5510 * Emits signal: "viewport,changed" with no parameters.
5512 void ewk_view_viewport_attributes_set(Evas_Object* ewkView, const WebCore::ViewportArguments& arguments)
5514 EWK_VIEW_SD_GET(ewkView, smartData);
5515 EWK_VIEW_PRIV_GET(smartData, priv);
5517 priv->viewportArguments = arguments;
5518 #if ENABLE(TIZEN_VIEWPORT_META_TAG)
5519 bool isViewportArgumentExist = !(arguments == WebCore::ViewportArguments());
5520 evas_object_smart_callback_call(ewkView, "viewport,changed", &isViewportArgumentExist);
5523 evas_object_smart_callback_call(ewkView, "viewport,changed", 0);
5526 void ewk_view_viewport_attributes_get(const Evas_Object* ewkView, int* width, int* height, float* initScale, float* maxScale, float* minScale, float* devicePixelRatio, Eina_Bool* userScalable)
5528 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
5529 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
5530 WebCore::ViewportAttributes attributes = _ewk_view_viewport_attributes_compute(ewkView);
5533 *width = attributes.layoutSize.width();
5535 *height = attributes.layoutSize.height();
5537 *initScale = attributes.initialScale;
5539 *maxScale = attributes.maximumScale;
5541 *minScale = attributes.minimumScale;
5542 if (devicePixelRatio)
5543 *devicePixelRatio = attributes.devicePixelRatio;
5545 *userScalable = static_cast<bool>(attributes.userScalable);
5548 Eina_Bool ewk_view_zoom_range_set(Evas_Object* ewkView, float minScale, float maxScale)
5550 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
5551 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
5553 if (maxScale < minScale) {
5554 WRN("minScale is larger than maxScale");
5558 #if ENABLE(TIZEN_WEAK_ZOOM_POSITION)
5559 minScale = ROUNDED_ZOOM(defaultTileWidth, minScale);
5560 maxScale = ROUNDED_ZOOM(defaultTileWidth, maxScale);
5563 priv->settings.zoomRange.minScale = minScale;
5564 priv->settings.zoomRange.maxScale = maxScale;
5569 float ewk_view_zoom_range_min_get(const Evas_Object* ewkView)
5571 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, -1.0);
5572 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, -1.0);
5574 return priv->settings.zoomRange.minScale;
5577 float ewk_view_zoom_range_max_get(const Evas_Object* ewkView)
5579 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, -1.0);
5580 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, -1.0);
5582 return priv->settings.zoomRange.maxScale;
5585 Eina_Bool ewk_view_user_scalable_set(Evas_Object* ewkView, Eina_Bool userScalable)
5587 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
5588 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
5590 priv->settings.zoomRange.userScalable = userScalable;
5595 Eina_Bool ewk_view_user_scalable_get(const Evas_Object* ewkView)
5597 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
5598 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
5600 return priv->settings.zoomRange.userScalable;
5603 float ewk_view_device_pixel_ratio_get(const Evas_Object* ewkView)
5605 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, -1.0);
5606 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, -1.0);
5608 return priv->settings.devicePixelRatio;
5611 void ewk_view_did_first_visually_nonempty_layout(Evas_Object* ewkView)
5613 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
5614 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
5615 if (!priv->flags.viewCleared) {
5616 ewk_view_frame_main_cleared(ewkView);
5617 ewk_view_enable_render(ewkView);
5618 priv->flags.viewCleared = true;
5620 #if ENABLE(TIZEN_CONTENTS_SIZE_SET_ON_FLUSH)
5621 //Prevent loss of content size after backing store flush.
5623 ewk_frame_contents_size_get(smartData->main_frame, &width, &height);
5625 EINA_SAFETY_ON_NULL_RETURN(smartData->api);
5626 EINA_SAFETY_ON_NULL_RETURN(smartData->api->contents_resize);
5627 if (!smartData->api->contents_resize(smartData, width, height))
5628 ERR("failed to resize contents to %dx%d", width, height);
5636 * Dispatch finished loading.
5638 * @param ewkView view.
5640 void ewk_view_dispatch_did_finish_loading(Evas_Object* ewkView)
5642 #if !ENABLE(TIZEN_WHITE_LOADING_FIX)
5643 /* If we reach this point and rendering is still disabled, WebCore will not
5644 * trigger the didFirstVisuallyNonEmptyLayout signal anymore. So, we
5645 * forcefully re-enable the rendering.
5647 ewk_view_did_first_visually_nonempty_layout(ewkView);
5651 void ewk_view_transition_to_commited_for_newpage(Evas_Object* ewkView)
5653 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
5654 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
5656 ewk_view_disable_render(ewkView);
5657 priv->flags.viewCleared = false;
5663 * Reports a requeset will be loaded. It's client responsibility to decide if
5664 * request would be used. If @return is true, loader will try to load. Else,
5665 * Loader ignore action of request.
5667 * @param ewkView View to load
5668 * @param request Request which contain url to navigate
5669 * @param navigationType navigation type
5671 bool ewk_view_navigation_policy_decision(Evas_Object* ewkView, Ewk_Frame_Resource_Request* request, Ewk_Navigation_Type navigationType)
5673 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, true);
5674 EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->api, true);
5676 if (!smartData->api->navigation_policy_decision)
5679 return smartData->api->navigation_policy_decision(smartData, request, navigationType);
5682 Eina_Bool ewk_view_js_object_add(Evas_Object* ewkView, Ewk_JS_Object* object, const char* objectName)
5684 #if ENABLE(NETSCAPE_PLUGIN_API)
5685 #if ENABLE(TIZEN_JS_API_FIX)
5686 EINA_SAFETY_ON_NULL_RETURN_VAL(object, false);
5687 #endif // ENABLE_TIZEN_JS_API_FIX
5688 if (object->view) // object has already been added to another ewk_view
5690 object->name = eina_stringshare_add(objectName);
5691 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
5692 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
5694 JSC::JSLock lock(JSC::SilenceAssertionsOnly);
5695 WebCore::JSDOMWindow* window = toJSDOMWindow(priv->mainFrame, WebCore::mainThreadNormalWorld());
5696 JSC::Bindings::RootObject* root;
5697 root = priv->mainFrame->script()->bindingRootObject();
5700 ERR("Warning: couldn't get window object");
5704 JSC::ExecState* executeState = window->globalExec();
5706 object->view = ewkView;
5707 JSC::JSObject* runtimeObject = (JSC::JSObject*)JSC::Bindings::CInstance::create((NPObject*)object, root)->createRuntimeObject(executeState);
5708 JSC::Identifier id = JSC::Identifier(executeState, objectName);
5710 JSC::PutPropertySlot slot;
5711 window->methodTable()->put(window, executeState, id, runtimeObject, slot);
5715 #endif // ENABLE(NETSCAPE_PLUGIN_API)
5718 #if ENABLE(TIZEN_VIEWPORT_META_TAG)
5721 * Reports that the contents will be resized. This function decidess whether
5722 * to allow the resize.
5724 * @param ewkView view.
5725 * @param w new content width.
5726 * @param h new content height.
5728 Eina_Bool ewk_view_contents_size_change_possible(Evas_Object* ewkView, int w, int h)
5730 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, true);
5731 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, true);
5733 const char* url = ewk_view_uri_get(ewkView);
5734 String problem_url(url);
5736 int viewportWidth = priv->viewportAttributes.width;
5738 viewportWidth *= ewk_view_zoom_get(ewkView);
5746 * Reports that the contents have resized. The ewk_view calls contents_resize,
5747 * which can be reimplemented as needed.
5749 * @param ewkView view.
5750 * @param width new content width.
5751 * @param height new content height.
5753 void ewk_view_contents_size_changed(Evas_Object* ewkView, int width, int height)
5755 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
5756 EINA_SAFETY_ON_NULL_RETURN(smartData->api);
5757 EINA_SAFETY_ON_NULL_RETURN(smartData->api->contents_resize);
5759 #if ENABLE(TIZEN_RECORDING_SURFACE)
5760 if (smartData->_priv->recordingSurfaceEnable && smartData->_priv->recordingSurfaceSetLoadFinished) {
5761 float zoom = ewk_view_zoom_get(ewkView);
5763 smartData->_priv->recordingSurfaceSetState = RECORDING_SURFACE_SET_STATE_INIT;
5764 smartData->_priv->recordingSurfaceSetList = ewk_recording_surface_set_free(smartData->_priv->recordingSurfaceSetList);
5765 smartData->_priv->recordingSurfaceSetList = ewk_recording_surface_set_base_record(smartData->_priv->recordingSurfaceSetList, ewkView, zoom);
5766 smartData->_priv->recordingSurfaceSetState = RECORDING_SURFACE_SET_STATE_COMPLETE;
5770 if (!smartData->api->contents_resize(smartData, width, height))
5771 ERR("failed to resize contents to %dx%d", width, height);
5776 * Gets page size from frameview.
5778 * @param ewkView view.
5780 * @return page size.
5782 WebCore::FloatRect ewk_view_page_rect_get(const Evas_Object* ewkView)
5784 EWK_VIEW_SD_GET(ewkView, smartData);
5785 EWK_VIEW_PRIV_GET(smartData, priv);
5787 WebCore::Frame* mainFrame = priv->page->mainFrame();
5788 return mainFrame->view()->frameRect();
5791 #if ENABLE(TOUCH_EVENTS)
5792 void ewk_view_need_touch_events_set(Evas_Object* ewkView, bool needed)
5794 EWK_VIEW_SD_GET(ewkView, smartData);
5795 EWK_VIEW_PRIV_GET(smartData, priv);
5797 priv->flags.needTouchEvents = needed;
5800 bool ewk_view_need_touch_events_get(const Evas_Object* ewkView)
5802 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
5803 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
5804 return priv->flags.needTouchEvents;
5808 Eina_Bool ewk_view_mode_set(Evas_Object* ewkView, Ewk_View_Mode viewMode)
5810 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
5811 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
5813 priv->page->setViewMode(static_cast<WebCore::Page::ViewMode>(viewMode));
5817 Ewk_View_Mode ewk_view_mode_get(const Evas_Object* ewkView)
5819 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, EWK_VIEW_MODE_INVALID);
5820 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, EWK_VIEW_MODE_INVALID);
5822 return static_cast<Ewk_View_Mode>(priv->page->viewMode());
5825 Eina_Bool ewk_view_mixed_content_displayed_get(const Evas_Object* ewkView)
5827 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
5828 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
5829 return priv->flags.hasDisplayedMixedContent;
5832 Eina_Bool ewk_view_mixed_content_run_get(const Evas_Object* ewkView)
5834 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
5835 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
5836 return priv->flags.hasRunMixedContent;
5841 * Reports the view that editor client selection has changed.
5843 * @param ewkView View.
5845 * Emits signal: "editorclient,selection,changed" with no parameters.
5847 void ewk_view_editor_client_selection_changed(Evas_Object* ewkView)
5849 evas_object_smart_callback_call(ewkView, "editorclient,selection,changed", 0);
5854 void ewk_view_device_size_get(const Evas_Object* ewkView, float* w, float* h)
5856 EWK_VIEW_SD_GET(ewkView, smartData);
5857 EWK_VIEW_PRIV_GET(smartData, priv);
5859 float device_dpi = WebCore::getDPI();
5861 int device_width_resolution = (int) priv->page->chrome()->client()->windowRect().width();
5862 int device_height_resolution = (int) priv->page->chrome()->client()->windowRect().height();
5864 float aspect_ratio = (float)(device_height_resolution) / (float)(device_width_resolution);
5866 float width_size = (device_width_resolution + device_height_resolution) / (device_dpi * (1 + aspect_ratio));
5867 float height_size = width_size * aspect_ratio;
5869 *w = width_size * CENTI_PER_INCH;
5870 *h = height_size * CENTI_PER_INCH;
5873 #if ENABLE(TIZEN_ISF_PORT)
5874 Ecore_IMF_Context* getImContextFromeView(Evas_Object* webview)
5879 EWK_VIEW_SD_GET_OR_RETURN(webview, smartData, 0);
5880 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0);
5881 return priv->imContext; /* 'priv' can not be 0 */
5885 #if ENABLE(TIZEN_PLUGIN_PARENT_WINDOW)
5886 static Evas_Object* _ewk_view_parent_window_get(Evas_Object* ewkView)
5888 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
5889 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0);
5890 Evas_Object* window = priv->settings.parentWindow;
5891 if (!window && smartData->base.evas) {
5892 Ecore_Evas* ee = ecore_evas_ecore_evas_get(smartData->base.evas);
5894 window = ecore_evas_object_associate_get(ee);
5898 #endif // ENABLE(TIZEN_PLUGIN_PARENT_WINDOW)
5900 #if ENABLE(TIZEN_SUPPORT_PLUGINS) && ENABLE(TIZEN_DONT_PAN_OVER_SOME_PLUGINS) && ENABLE(TIZEN_EVAS_OBJECT_PLUGIN)
5901 void ewk_view_events_repeat_to_plugin(Evas_Object* ewkView, Eina_Bool enabled)
5903 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
5904 evas_object_repeat_events_set(smartData->events_rect, enabled);
5907 void ewk_view_events_handled_by_plugin_changed(Evas_Object* ewkView, Eina_Bool newState)
5909 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
5910 EINA_SAFETY_ON_NULL_RETURN(smartData->api->events_handled_by_plugin_changed);
5912 smartData->api->events_handled_by_plugin_changed(smartData, newState);
5916 void ewk_view_events_invalidate_on_plugin(Evas_Object* ewkView, Eina_Bool enabled)
5918 #if ENABLE(NETSCAPE_PLUGIN_API) && ENABLE(TIZEN_SUPPORT_PLUGINS) && ENABLE(TIZEN_DONT_PAN_OVER_SOME_PLUGINS) && ENABLE(TIZEN_EVAS_OBJECT_PLUGIN)
5919 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
5920 if (WebCore::PluginView::currentPluginHandlingEvents()) {
5922 evas_object_data_set(WebCore::PluginView::currentPluginHandlingEvents()->getPluginCanvas(), "ev",
5923 reinterpret_cast<void*>(static_cast<intptr_t>(0x01)));
5925 evas_object_data_del(WebCore::PluginView::currentPluginHandlingEvents()->getPluginCanvas(), "ev");
5928 ERR("NETSCAPE_PLUGIN_API && TIZEN_SUPPORT_PLUGINS && TIZEN_DONT_PAN_OVER_SOME_PLUGINS && TIZEN_EVAS_OBJECT_PLUGIN not enabled!");
5932 #if ENABLE(TIZEN_EVAS_OBJECT_PLUGIN)
5933 void ewk_view_get_plugin_storage(Evas_Object* ewkView , PluginStorage* pluginStorage)
5935 pluginStorage->pluginCanvas = 0;
5936 pluginStorage->pluginClipper = 0;
5937 pluginStorage->parentWindow = 0;
5938 pluginStorage->webview = 0;
5940 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
5941 Evas_Object* pluginCanvas = evas_object_image_add(smartData->base.evas);
5945 evas_object_image_colorspace_set(pluginCanvas, EVAS_COLORSPACE_ARGB8888);
5946 evas_object_image_alpha_set(pluginCanvas, false);
5947 evas_object_image_filled_set(pluginCanvas, true);
5948 evas_object_show(pluginCanvas);
5950 pluginStorage->pluginCanvas = pluginCanvas;
5952 evas_object_smart_member_add(pluginCanvas, smartData->plugin_store);
5954 Evas_Object* pluginEvasObjectClipper = evas_object_rectangle_add(smartData->base.evas);
5955 if (pluginEvasObjectClipper) {
5956 evas_object_smart_member_add(pluginEvasObjectClipper, smartData->plugin_store);
5957 evas_object_show(pluginEvasObjectClipper);
5958 pluginStorage->pluginClipper = pluginEvasObjectClipper;
5961 #if ENABLE(TIZEN_PLUGIN_PARENT_WINDOW)
5962 pluginStorage->parentWindow = _ewk_view_parent_window_get(ewkView);
5964 pluginStorage->parentWindow = 0;
5965 #endif // ENABLE(TIZEN_PLUGIN_PARENT_WINDOW)
5966 pluginStorage->webview = ewkView;
5969 #endif // ENABLE(TIZEN_EVAS_OBJECT_PLUGIN)
5972 #if ENABLE(TIZEN_RENDER_SUSPEND)
5973 static void _ewk_view_smart_disable_render(Ewk_View_Smart_Data* smartData)
5975 WRN("not supported by engine. smartData=%p", smartData);
5978 static void _ewk_view_smart_enable_render(Ewk_View_Smart_Data* smartData)
5980 WRN("not supported by engine. smartData=%p", smartData);
5984 Eina_Bool ewk_view_selective_rendering_is_enabled(const Evas_Object* ewkView)
5986 #if ENABLE(TIZEN_SELECTIVE_RENDERING)
5987 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
5988 EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->api->selective_rendering_is_enabled, false);
5990 return smartData->api->selective_rendering_is_enabled(smartData);
5996 Eina_Bool ewk_view_selective_rendering_set(const Evas_Object* ewkView, Eina_Bool value)
5998 #if ENABLE(TIZEN_SELECTIVE_RENDERING)
5999 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
6000 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
6001 EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->api->selective_rendering_set, false);
6003 Eina_Bool result = smartData->api->selective_rendering_set(smartData, value);
6004 #if ENABLE(TIZEN_WEBCORE_SELECTIVE_RENDERING)
6005 priv->delaysHeavyTiles = value;
6007 if (value == false) {
6008 _ewk_view_update_delayed_updates(smartData);
6019 * Reports to the view that editor client's contents were changed.
6021 * @param ewkView View.
6023 * Emits signal: "editorclient,contents,changed" with no parameters.
6025 void ewk_view_editor_client_contents_changed(Evas_Object* ewkView)
6027 evas_object_smart_callback_call(ewkView, "editorclient,contents,changed", 0);
6032 * Defines whether the view has displayed mixed content.
6034 * When a view has displayed mixed content, any of its frames has loaded an HTTPS URI
6035 * which has itself loaded and displayed a resource (such as an image) from an insecure,
6036 * that is, non-HTTPS, URI.
6038 * @param hasDisplayed Do or do not clear the flag from the view.
6040 * Emits signal: "mixedcontent,displayed" with no parameters when @p hasDisplayed is @c true.
6042 void ewk_view_mixed_content_displayed_set(Evas_Object* ewkView, bool hasDisplayed)
6044 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
6045 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
6047 priv->flags.hasDisplayedMixedContent = hasDisplayed;
6050 evas_object_smart_callback_call(ewkView, "mixedcontent,displayed", 0);
6055 * Defines whether the view has run mixed content.
6057 * When a view has run mixed content, any of its frames has loaded an HTTPS URI
6058 * which has itself loaded and run a resource (such as a script) from an insecure,
6059 * that is, non-HTTPS, URI.
6061 * @param hasRun Do or do not clear the flag from the view.
6063 * Emits signal: "mixedcontent,run" with no parameters when @p hasRun is @c true.
6065 void ewk_view_mixed_content_run_set(Evas_Object* ewkView, bool hasRun)
6067 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
6068 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
6070 priv->flags.hasRunMixedContent = hasRun;
6073 evas_object_smart_callback_call(ewkView, "mixedcontent,run", 0);
6076 Eina_Bool ewk_view_visibility_state_set(Evas_Object* ewkView, Ewk_Page_Visibility_State pageVisibilityState, Eina_Bool initialState)
6078 #if ENABLE(PAGE_VISIBILITY_API)
6079 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
6080 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
6082 priv->page->setVisibilityState(static_cast<WebCore::PageVisibilityState>(pageVisibilityState), initialState);
6086 DBG("PAGE_VISIBILITY_API is disabled.");
6090 Ewk_Page_Visibility_State ewk_view_visibility_state_get(const Evas_Object* ewkView)
6092 #if ENABLE(PAGE_VISIBILITY_API)
6093 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, EWK_PAGE_VISIBILITY_STATE_VISIBLE);
6094 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, EWK_PAGE_VISIBILITY_STATE_VISIBLE);
6096 return static_cast<Ewk_Page_Visibility_State>(priv->page->visibilityState());
6098 DBG("PAGE_VISIBILITY_API is disabled.");
6099 return EWK_PAGE_VISIBILITY_STATE_VISIBLE;
6103 SoupSession* ewk_view_soup_session_get(const Evas_Object* ewkView)
6105 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
6106 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0);
6107 return priv->soupSession;
6110 void ewk_view_soup_session_set(Evas_Object* ewkView, SoupSession* session)
6112 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
6113 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
6114 if (!SOUP_IS_SESSION_ASYNC(session)) {
6115 ERR("WebKit requires an SoupSessionAsync to work properly, but "
6116 "a SoupSessionSync was provided.");
6119 priv->soupSession = session;
6122 Eina_Bool ewk_view_setting_enable_xss_auditor_get(const Evas_Object* ewkView)
6124 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, EINA_FALSE);
6125 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, EINA_FALSE);
6126 return priv->settings.enableXSSAuditor;
6129 void ewk_view_setting_enable_xss_auditor_set(Evas_Object* ewkView, Eina_Bool enable)
6131 EWK_VIEW_SD_GET(ewkView, smartData);
6132 EWK_VIEW_PRIV_GET(smartData, priv);
6134 if (priv->settings.enableXSSAuditor != enable) {
6135 priv->pageSettings->setXSSAuditorEnabled(enable);
6136 priv->settings.enableXSSAuditor = enable;
6140 Eina_Bool ewk_view_setting_should_display_subtitles_get(const Evas_Object *ewkView)
6142 #if ENABLE(VIDEO_TRACK)
6143 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
6144 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
6145 return priv->settings.shouldDisplaySubtitles;
6151 Eina_Bool ewk_view_setting_should_display_captions_get(const Evas_Object *ewkView)
6153 #if ENABLE(VIDEO_TRACK)
6154 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
6155 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
6156 return priv->settings.shouldDisplayCaptions;
6162 void ewk_view_setting_should_display_captions_set(Evas_Object *ewkView, Eina_Bool enable)
6164 #if ENABLE(VIDEO_TRACK)
6165 EWK_VIEW_SD_GET(ewkView, smartData);
6166 EWK_VIEW_PRIV_GET(smartData, priv);
6168 if (priv->settings.shouldDisplayCaptions != enable) {
6169 priv->pageSettings->setShouldDisplayCaptions(enable);
6170 priv->settings.shouldDisplayCaptions = enable;
6175 void ewk_view_setting_should_display_subtitles_set(Evas_Object *ewkView, Eina_Bool enable)
6177 #if ENABLE(VIDEO_TRACK)
6178 EWK_VIEW_SD_GET(ewkView, smartData);
6179 EWK_VIEW_PRIV_GET(smartData, priv);
6181 if (priv->settings.shouldDisplaySubtitles != enable) {
6182 priv->pageSettings->setShouldDisplaySubtitles(enable);
6183 priv->settings.shouldDisplaySubtitles = enable;
6188 Eina_Bool ewk_view_setting_should_display_text_descriptions_get(const Evas_Object *ewkView)
6190 #if ENABLE(VIDEO_TRACK)
6191 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
6192 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
6193 return priv->settings.shouldDisplayTextDescriptions;
6199 void ewk_view_setting_should_display_text_descriptions_set(Evas_Object *ewkView, Eina_Bool enable)
6201 #if ENABLE(VIDEO_TRACK)
6202 EWK_VIEW_SD_GET(ewkView, smartData);
6203 EWK_VIEW_PRIV_GET(smartData, priv);
6205 if (priv->settings.shouldDisplayTextDescriptions != enable) {
6206 priv->pageSettings->setShouldDisplayTextDescriptions(enable);
6207 priv->settings.shouldDisplayTextDescriptions = enable;
6212 Eina_Bool ewk_view_setting_custom_header_add(Evas_Object* ewkView, const char* name, const char* value)
6214 #if ENABLE(TIZEN_CUSTOM_HEADERS)
6215 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
6216 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
6217 priv->settings.customHeaders.add(WTF::String::fromUTF8(name), WTF::String::fromUTF8(value));
6219 WebCore::FrameLoaderClientEfl* client = static_cast<WebCore::FrameLoaderClientEfl*>(priv->mainFrame->loader()->client());
6220 client->addCustomHeader(WTF::String::fromUTF8(name), WTF::String::fromUTF8(value));
6223 ERR("TIZEN_CUSTOM_HEADERS not enabled!");
6229 * Get amount of plugins
6231 * @param ewkView view to get amount of plugins
6233 * @return amount of plugins, -1 otherwise
6235 #if ENABLE(TIZEN_DYNAMIC_LOADED_PLUGINS)
6236 unsigned int ewk_view_plugins_size_get(Evas_Object* ewkView)
6238 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, -1);
6239 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, -1);
6241 if (priv && priv->mainFrame && priv->mainFrame->document())
6242 return priv->mainFrame->document()->plugins()->length();
6249 * Parameter Evas_Object *ewkView is obsolete since plugin's database is not related with specified webview. Will be removed.
6251 Eina_Bool ewk_view_setting_enable_specified_plugin_set(Evas_Object* ewkView, Eina_Bool enable, const char* mimeType)
6253 #if ENABLE(TIZEN_ON_OFF_SPECIFIED_PLUGINS)
6254 EINA_SAFETY_ON_NULL_RETURN_VAL(mimeType, false);
6258 #if ENABLE(TIZEN_DYNAMIC_LOADED_PLUGINS)
6259 return _ewk_view_setting_enable_specified_plugin_set(enable, mimeType);
6261 WebCore::PluginDatabase* pluginDatabase = WebCore::PluginDatabase::installedPlugins(true);
6262 EINA_SAFETY_ON_NULL_RETURN_VAL(pluginDatabase, false);
6263 const Vector<WebCore::PluginPackage*> pluginsDB = pluginDatabase->plugins();
6264 WebCore::PluginPackage* pluginForMime = _ewk_view_plugin_for_mime_type(pluginsDB, mimeType);
6266 pluginForMime->setEnabled(enable);
6275 Eina_Bool ewk_view_setting_editable_link_active_set(Evas_Object* ewkView, Eina_Bool clickable)
6277 #if ENABLE(TIZEN_EDITABLE_LINK_ACTIVE_SET)
6278 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
6279 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
6280 WebCore::EditableLinkBehavior linkBehavior;
6282 linkBehavior = WebCore::EditableLinkDefaultBehavior;
6284 linkBehavior = WebCore::EditableLinkNeverLive;
6286 if (priv->settings.editableLinkBehavior != linkBehavior) {
6287 priv->pageSettings->setEditableLinkBehavior(linkBehavior);
6288 priv->settings.editableLinkBehavior = linkBehavior;
6296 Eina_Bool ewk_view_setting_geolocation_get(Evas_Object* ewkView)
6298 #if ENABLE(TIZEN_GEOLOCATION)
6299 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
6300 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
6301 return priv->settings.geolocation;
6307 Eina_Bool ewk_view_setting_geolocation_set(Evas_Object* ewkView, Eina_Bool enable)
6309 #if ENABLE(TIZEN_GEOLOCATION)
6310 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
6311 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
6313 if (priv->settings.geolocation != enable) {
6314 priv->pageSettings->setGeolocationEnabled(enable);
6315 priv->settings.geolocation = enable;
6323 Eina_Bool ewk_view_setting_css_fixed_as_absolute_set(Evas_Object* ewkView, Eina_Bool enable)
6325 #if ENABLE(TIZEN_CSS_FIXED_AS_ABSOLUTE)
6326 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
6327 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
6328 if (priv->settings.fixedAsAbsolute != enable) {
6329 priv->pageSettings->setFixedAsAbsoluteEnabled(enable);
6330 priv->settings.fixedAsAbsolute = enable;
6338 Eina_Bool ewk_view_setting_css_fixed_as_absolute_get(Evas_Object* ewkView)
6340 #if ENABLE(TIZEN_CSS_FIXED_AS_ABSOLUTE)
6341 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
6342 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
6343 return priv->settings.fixedAsAbsolute;
6350 * Sets if fast path improvements should be used.
6352 * @param ewkView view object to set
6353 * @param enable @c true if we want to use fast path modifications
6354 * @return @c true on success and @c false on failure.
6356 Eina_Bool ewk_view_setting_css_fixed_fast_path_set(Evas_Object* ewkView, Eina_Bool enable)
6358 #if ENABLE(TIZEN_CSS_FIXED_FAST_PATH)
6359 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
6360 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
6362 if (priv->settings.fixedFastPath != enable) {
6363 priv->pageSettings->setFixedFastPathImprovementsEnabled(enable);
6364 priv->settings.fixedFastPath = enable;
6373 * Gets if fast path modifications are enabled.
6375 * @param ewkView view object to get
6377 * @return @c true if encoding detector is enabled, @c false if not or on errors.
6379 Eina_Bool ewk_view_setting_css_fixed_fast_path_get(Evas_Object* ewkView)
6381 #if ENABLE(TIZEN_CSS_FIXED_FAST_PATH)
6382 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
6383 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
6384 return priv->settings.fixedFastPath;
6390 Eina_Bool ewk_view_setting_accelerated_compositing_enable_set(Evas_Object* ewkView, Eina_Bool enable)
6392 #if USE(ACCELERATED_COMPOSITING)
6393 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
6394 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
6396 WebCore::Settings* settings = priv->page->settings();
6400 #if ENABLE(TIZEN_CSS_FIXED_ACCELERATION)
6401 ewk_view_setting_css_fixed_as_absolute_set(ewkView, !enable);
6402 ewk_view_setting_css_fixed_fast_path_set(ewkView, !enable);
6405 if (enable == false) {
6406 settings->setAcceleratedCompositingEnabled(false);
6407 settings->setAcceleratedCompositingFor3DTransformsEnabled(false);
6408 settings->setAcceleratedCompositingForVideoEnabled(false);
6409 settings->setAcceleratedCompositingForPluginsEnabled(false);
6410 settings->setAcceleratedCompositingForCanvasEnabled(false);
6411 settings->setAcceleratedCompositingForAnimationEnabled(false);
6412 #if ENABLE(TIZEN_CSS_FIXED_ACCELERATION)
6413 settings->setAcceleratedCompositingForFixedPositionEnabled(false);
6415 settings->setShowDebugBorders(false);
6417 settings->setWebGLEnabled(false);
6422 settings->setAcceleratedCompositingEnabled(true);
6424 settings->setWebGLEnabled(true);
6425 settings->setAcceleratedCompositingForCanvasEnabled(true);
6428 #if ENABLE(TIZEN_CSS_FIXED_ACCELERATION)
6429 settings->setAcceleratedCompositingForFixedPositionEnabled(true);
6432 #define ENV_VALUE (str.toInt()?true:false)
6433 String str = String(getenv("AC_3DTRANSFORMS"));
6435 settings->setAcceleratedCompositingFor3DTransformsEnabled(true); // default
6437 settings->setAcceleratedCompositingFor3DTransformsEnabled(ENV_VALUE);
6439 str = String(getenv("AC_PLUGINS"));
6441 settings->setAcceleratedCompositingForPluginsEnabled(false); // default
6443 settings->setAcceleratedCompositingForPluginsEnabled(ENV_VALUE);
6445 str = String(getenv("AC_ANIMATION"));
6447 settings->setAcceleratedCompositingForAnimationEnabled(false); // default
6449 settings->setAcceleratedCompositingForAnimationEnabled(ENV_VALUE);
6458 Eina_Bool ewk_view_setting_accelerated_compositing_enable_get(Evas_Object* ewkView)
6460 #if USE(ACCELERATED_COMPOSITING)
6461 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
6462 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
6463 return (priv->pageSettings->acceleratedCompositingEnabled() ? true : false);
6469 Eina_Bool ewk_view_setting_html5video_external_player_enable_set(Evas_Object* ewkView, Eina_Bool enable)
6471 #if USE(ACCELERATED_COMPOSITING)
6472 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
6473 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
6475 WebCore::Settings* settings = priv->page->settings();
6479 if (!settings->acceleratedCompositingEnabled())
6482 settings->setAcceleratedCompositingForVideoEnabled((enable == false ? true : false));
6489 Eina_Bool ewk_view_setting_html5video_external_player_enable_get(Evas_Object* ewkView)
6491 #if USE(ACCELERATED_COMPOSITING)
6492 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
6493 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
6494 return (priv->pageSettings->acceleratedCompositingForVideoEnabled() ? false : true);
6500 EAPI Eina_Bool ewk_view_setting_layer_borders_enable_set(Evas_Object* o, Eina_Bool enable)
6502 #if USE(ACCELERATED_COMPOSITING)
6503 EWK_VIEW_SD_GET_OR_RETURN(o, smartData, EINA_FALSE);
6504 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, EINA_FALSE);
6506 WebCore::Settings* settings = priv->page->settings();
6510 if (!settings->acceleratedCompositingEnabled())
6513 settings->setShowDebugBorders((enable == EINA_TRUE ? true : false));
6520 EAPI Eina_Bool ewk_view_setting_layer_borders_enable_get(Evas_Object* o)
6522 #if USE(ACCELERATED_COMPOSITING)
6523 EWK_VIEW_SD_GET_OR_RETURN(o, smartData, EINA_FALSE);
6524 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, EINA_FALSE);
6525 return (priv->pageSettings->showDebugBorders() ? EINA_TRUE : EINA_FALSE);
6533 * Asks if URI should be opened.
6535 * @param ewkView View.
6536 * @param uri URI that will be opened.
6538 * Emits signal: "should,allow,open" with Ewk_Should_Allow_Open_Uri_Return.
6540 Eina_Bool ewk_should_allow_open_uri(Evas_Object* ewkView, const char* uri)
6542 #if ENABLE(TIZEN_SHOULD_ALLOW_OPEN_URL)
6543 Ewk_Should_Allow_Open_Uri_Return callbackData;
6544 callbackData.uri = uri;
6545 callbackData.ret = true;
6547 evas_object_smart_callback_call( ewkView, "should,allow,open", (void*)(&callbackData));
6549 if (callbackData.ret)
6559 * Returns current Ecore IMF context
6561 * @param [in] webview a view object
6563 * @return Ecore_IMF_Context on success and 0 otherwise
6565 #if ENABLE(TIZEN_ISF_PORT)
6566 Ecore_IMF_Context* ewk_view_core_imContext_get(Evas_Object* webview)
6568 EINA_SAFETY_ON_NULL_RETURN_VAL(webview, 0);
6569 EWK_VIEW_SD_GET_OR_RETURN(webview, smartData, 0);
6570 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0);
6571 return priv->imContext; /* 'priv' can not be 0 */
6574 Ecore_IMF_Context* ewk_view_imf_context_get(Evas_Object* webview)
6576 EINA_SAFETY_ON_NULL_RETURN_VAL(webview, 0);
6577 EWK_VIEW_SD_GET_OR_RETURN(webview, smartData, 0);
6578 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0);
6579 return priv->imContext; /* 'priv' can not be 0 */
6583 #if ENABLE(TIZEN_EFL_EXT_API)
6585 * Gathers images from the passed frame and puts them in a list.
6587 * @param [in] frame Frame to collect images from.
6588 * @param [in][out] data Eina_List where the image pointers will be stored.
6590 void _collect_images_from_frame(WebCore::Frame* frame, void* data)
6592 // getting the list containing list of images and list of urls
6593 Eina_List* listOfLists = (Eina_List*)data;
6595 // getting specific lists
6596 Eina_List** listOfImages = (Eina_List**)eina_list_nth(listOfLists, 0);
6597 Eina_List** listOfUrls = (Eina_List**)eina_list_nth(listOfLists, 1);
6599 // getting collection of all images in the frame
6600 RefPtr<WebCore::HTMLCollection> images = frame->document()->images();
6602 for (unsigned i = 0; i < images->length(); ++i) {
6603 WebCore::HTMLImageElement* imageElement = (WebCore::HTMLImageElement*) images->item(i);
6607 WebCore::CachedImage* cachedImage = imageElement->cachedImage();
6611 WebCore::Image* image = cachedImage->image();
6612 if (!image || image->isNull())
6616 // getting native (cairo) representation of the image
6617 cairo_surface_t* cairoImage = image->nativeImageForCurrentFrame()->surface();
6621 // appending image ptr & url to the lists
6622 *listOfImages = eina_list_append(*listOfImages, (void*)cairoImage);
6623 *listOfUrls = eina_list_append(*listOfUrls, (void*)strdup(WebCore::decodeURLEscapeSequences(imageElement->src().string()).utf8().data()));
6629 Eina_Bool ewk_view_autofill_personal_data(Evas_Object* ewkView, const char* username, const char* password)
6631 #if ENABLE(TIZEN_PASSWORD_MANAGER)
6632 EWK_VIEW_SD_GET_OR_RETURN(ewkView , smartData, false);
6633 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
6634 EINA_SAFETY_ON_NULL_RETURN_VAL(username, false);
6635 EINA_SAFETY_ON_NULL_RETURN_VAL(password, false);
6637 // Getting all forms of the page
6638 RefPtr<WebCore::HTMLCollection> forms = priv->mainFrame->document()->forms();
6642 for (unsigned i = 0; i < forms->length(); i++) {
6643 WebCore::HTMLFormElement* formElement = static_cast<WebCore::HTMLFormElement*>(forms->item(i));
6647 // Getting all elements of the form
6648 for (unsigned j = 0; j < formElement->associatedElements().size(); j++) {
6649 WebCore::FormAssociatedElement* associatedElement = formElement->associatedElements()[j];
6650 if (!associatedElement)
6653 WebCore::HTMLElement* htmlElement = toHTMLElement(associatedElement);
6654 if (!htmlElement || !htmlElement->hasTagName(WebCore::HTMLNames::inputTag))
6657 WebCore::HTMLInputElement* inputElement = static_cast<WebCore::HTMLInputElement*>(htmlElement);
6658 if (!inputElement || !inputElement->isEnabledFormControl())
6661 if (inputElement->isPasswordField()) {
6662 inputElement->setValue(password);
6664 // Then, search backwards for the username field
6665 for (int index = j-1; index >= 0; index--) {
6666 WebCore::FormAssociatedElement* associatedElement = formElement->associatedElements()[index];
6667 if (!associatedElement)
6670 WebCore::HTMLElement* htmlElement = toHTMLElement(associatedElement);
6671 if (!htmlElement || !htmlElement->hasTagName(WebCore::HTMLNames::inputTag))
6674 WebCore::HTMLInputElement* inputElement = static_cast<WebCore::HTMLInputElement*>(htmlElement);
6675 if (!inputElement || !inputElement->isEnabledFormControl())
6678 if (inputElement->isTextField()) {
6679 inputElement->setValue(username);
6683 } // End. if (inputElement->isPasswordField())
6684 } // End. for (unsigned j = 0; j < formElement->formElements.size(); j++)
6689 LOG_ERROR("TIZEN_PASSWORD_MANAGER is disabled. \n");
6694 Eina_Bool ewk_view_personal_data_fill(Evas_Object* ewkView, const char* username, const char* password)
6696 #if ENABLE(TIZEN_PASSWORD_MANAGER)
6697 EWK_VIEW_SD_GET_OR_RETURN(ewkView , smartData, false);
6698 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
6699 EINA_SAFETY_ON_NULL_RETURN_VAL(username, false);
6700 EINA_SAFETY_ON_NULL_RETURN_VAL(password, false);
6702 // Getting all forms of the page
6703 RefPtr<WebCore::HTMLCollection> forms = priv->mainFrame->document()->forms();
6707 for (unsigned i = 0; i < forms->length(); i++) {
6708 WebCore::HTMLFormElement* formElement = static_cast<WebCore::HTMLFormElement*>(forms->item(i));
6712 // Getting all elements of the form
6713 for (unsigned j = 0; j < formElement->associatedElements().size(); j++) {
6714 WebCore::FormAssociatedElement* associatedElement = formElement->associatedElements()[j];
6715 if (!associatedElement)
6718 WebCore::HTMLElement* htmlElement = toHTMLElement(associatedElement);
6719 if (!htmlElement || !htmlElement->hasTagName(WebCore::HTMLNames::inputTag))
6722 WebCore::HTMLInputElement* inputElement = static_cast<WebCore::HTMLInputElement*>(htmlElement);
6723 if (!inputElement || !inputElement->isEnabledFormControl())
6726 if (inputElement->isPasswordField()) {
6727 inputElement->setValue(password);
6729 // Then, search backwards for the username field
6730 for (int index = j-1; index >= 0; index--) {
6731 WebCore::FormAssociatedElement* associatedElement = formElement->associatedElements()[index];
6732 if (!associatedElement)
6735 WebCore::HTMLElement* htmlElement = toHTMLElement(associatedElement);
6736 if (!htmlElement || !htmlElement->hasTagName(WebCore::HTMLNames::inputTag))
6739 WebCore::HTMLInputElement* inputElement = static_cast<WebCore::HTMLInputElement*>(htmlElement);
6740 if (!inputElement || !inputElement->isEnabledFormControl())
6743 if (inputElement->isTextField()) {
6744 inputElement->setValue(username);
6748 } // End. if (inputElement->isPasswordField())
6749 } // End. for (unsigned j = 0; j < formElement->formElements.size(); j++)
6754 LOG_ERROR("TIZEN_PASSWORD_MANAGER is disabled. \n");
6759 EAPI void ewk_view_get_images_list(Evas_Object* view, Eina_List** listOfImages, Eina_List** listOfImageUrls)
6761 #if ENABLE(TIZEN_EFL_EXT_API)
6762 EINA_SAFETY_ON_NULL_RETURN(view);
6763 EWK_VIEW_SD_GET_OR_RETURN(view, smartData);
6764 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
6766 // creating a list containing both listOfImages and listOfImageUrls
6767 Eina_List* lisfOfLists = 0;
6768 lisfOfLists = eina_list_append(lisfOfLists, listOfImages);
6769 lisfOfLists = eina_list_append(lisfOfLists, listOfImageUrls);
6771 // iterating all frames on the page and getting images inside
6772 _iterate_frames(priv->mainFrame, _collect_images_from_frame, (void*)(lisfOfLists));
6774 // freeing the list of lists, not needed anymore
6775 eina_list_free(lisfOfLists);
6777 LOG_ERROR("TIZEN_EFL_EXT_API is disabled. \n");
6781 EAPI void ewk_view_image_list_get(Evas_Object* view, Eina_List** listOfImages, Eina_List** listOfImageUrls)
6783 #if ENABLE(TIZEN_EFL_EXT_API)
6784 EINA_SAFETY_ON_NULL_RETURN(view);
6785 EWK_VIEW_SD_GET_OR_RETURN(view, smartData);
6786 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
6788 // creating a list containing both listOfImages and listOfImageUrls
6789 Eina_List* lisfOfLists = 0;
6790 lisfOfLists = eina_list_append(lisfOfLists, listOfImages);
6791 lisfOfLists = eina_list_append(lisfOfLists, listOfImageUrls);
6793 // iterating all frames on the page and getting images inside
6794 _iterate_frames(priv->mainFrame, _collect_images_from_frame, static_cast<void*>(lisfOfLists));
6796 // freeing the list of lists, not needed anymore
6797 eina_list_free(lisfOfLists);
6799 LOG_ERROR("TIZEN_EFL_EXT_API is disabled. \n");
6804 * Samsung Modification from here
6807 JSGlobalContextRef ewk_view_get_global_context(Evas_Object* obj)
6809 #if ENABLE(TIZEN_JS_EXT_API)
6813 Evas_Object* mainFrame = ewk_view_frame_main_get(obj);
6814 WebCore::Frame* frame = ewk_frame_core_get(mainFrame);
6816 return reinterpret_cast<JSGlobalContextRef>(frame->script()->globalObject(WebCore::mainThreadNormalWorld())->globalExec());
6818 LOG_ERROR("TIZEN_JS_EXT_API is disabled. \n");
6823 JSGlobalContextRef ewk_view_global_context_get(Evas_Object* ewkView)
6825 #if ENABLE(TIZEN_JS_EXT_API)
6829 Evas_Object* mainFrame = ewk_view_frame_main_get(ewkView);
6830 WebCore::Frame* frame = ewk_frame_core_get(mainFrame);
6832 return reinterpret_cast<JSGlobalContextRef>(frame->script()->globalObject(WebCore::mainThreadNormalWorld())->globalExec());
6834 LOG_ERROR("TIZEN_JS_EXT_API is disabled. \n");
6839 JSGlobalContextRef ewk_view_js_global_context_get(Evas_Object* ewkView)
6841 #if ENABLE(TIZEN_JS_EXT_API)
6845 Evas_Object* mainFrame = ewk_view_frame_main_get(ewkView);
6846 WebCore::Frame* frame = ewk_frame_core_get(mainFrame);
6848 return reinterpret_cast<JSGlobalContextRef>(frame->script()->globalObject(WebCore::mainThreadNormalWorld())->globalExec());
6850 LOG_ERROR("TIZEN_JS_EXT_API is disabled. \n");
6855 Eina_Bool ewk_view_is_jscript_running(Evas_Object* ewkView)
6857 LOG_ERROR("This function is deprecated. So, this is will be removed soon.\n");
6861 void ewk_view_javascript_suspend(Evas_Object* ewkView)
6863 #if ENABLE(TIZEN_JS_PERMISSION_CHECKER)
6864 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
6865 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
6866 WebCore::Frame* mainFrame = priv->mainFrame;
6867 mainFrame->page()->suspendJavaScript();
6871 void ewk_view_javascript_resume(Evas_Object* ewkView)
6873 #if ENABLE(TIZEN_JS_PERMISSION_CHECKER)
6874 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
6875 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
6876 WebCore::Frame* mainFrame = priv->mainFrame;
6877 mainFrame->page()->resumeJavaScript();
6882 ewk_view_smart_selection_rect_get(Evas_Object* ewkView, int x, int y, Eina_Rectangle* rect)
6884 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
6885 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
6886 EINA_SAFETY_ON_NULL_RETURN_VAL(rect, false);
6891 void ewk_view_screenshot_contents(const Evas_Object* ewkView, cairo_t* cr, const Eina_Rectangle* area)
6893 #if ENABLE(TIZEN_EFL_EXT_API)
6894 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
6895 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
6897 WebCore::FrameView* view = priv->mainFrame->view();
6898 EINA_SAFETY_ON_NULL_RETURN(view);
6900 // Sometimes, mostly when the loading is stopped by user, the view needs to be relayouted.
6901 // Without this, the resulting screenshot would be black.
6902 // See check for needsLayout() in FrameView::paintContents()
6903 if (view->needsLayout())
6904 view->forceLayout();
6906 ewk_view_paint_contents(priv, cr, area);
6908 #if ENABLE(TIZEN_ACCELERATED_COMPOSITING)
6909 if (priv->compositingActive) {
6910 int width = 0, height= 0;
6911 evas_object_image_size_get(priv->compositingSurface, &width, &height);
6912 if (!width || !height)
6915 float zoomLevel = ewk_view_zoom_get(ewkView);
6918 cairo_get_matrix(cr, &mat);
6920 if (zoomLevel == (float)mat.xx || zoomLevel == (float)mat.yy)
6923 Eina_Rectangle imageArea;
6927 imageArea.w = width;
6928 imageArea.h = height;
6930 float zoomFactorX = mat.xx / zoomLevel;
6931 float zoomFactorY = mat.yy / zoomLevel;
6933 unsigned int rowBytes = cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32, imageArea.w);
6934 unsigned int totalBytes = rowBytes * imageArea.h;
6935 unsigned char* pixels = new unsigned char[totalBytes];
6939 priv->compositor->readPixelData(imageArea.x, imageArea.y, imageArea.w, imageArea.h, pixels);
6942 for (int i = 0; i < totalBytes; i += 4)
6943 std::swap(pixels[i], pixels[i + 2]);
6945 cairo_surface_t* fbCairoSurface = cairo_image_surface_create_for_data(pixels,
6946 CAIRO_FORMAT_ARGB32,
6951 cairo_matrix_t resultMat;
6952 cairo_matrix_t t1Mat, t2Mat;
6953 cairo_matrix_t flipMat;
6955 float offsetRateY = 2.0 / 3.0;
6957 cairo_matrix_init_identity(&resultMat);
6958 cairo_matrix_init_translate(&t1Mat, imageArea.w * 0.5 , imageArea.h * 0.5);
6959 cairo_matrix_init(&flipMat, 1.0, 0.0, 0.0, -1.0, 0.0, 0.0);
6960 cairo_matrix_init_translate(&t2Mat, -imageArea.w * 0.5, -imageArea.h * 0.5);
6962 cairo_matrix_multiply(&resultMat, &resultMat, &t2Mat);
6963 cairo_matrix_multiply(&resultMat, &resultMat, &flipMat);
6964 cairo_matrix_multiply(&resultMat, &resultMat, &t1Mat);
6966 cairo_matrix_scale(&resultMat, zoomFactorX, zoomFactorY);
6969 cairo_set_matrix(cr, &resultMat);
6971 cairo_translate(cr, 0, (float)imageArea.h * offsetRateY);
6973 cairo_set_source_surface(cr, fbCairoSurface, 0, 0);
6981 LOG_ERROR("TIZEN_EFL_EXT_API is disabled. \n");
6985 void ewk_view_force_layout(const Evas_Object* ewkView)
6987 #if ENABLE(TIZEN_EFL_EXT_API)
6988 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
6989 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
6991 WebCore::FrameView* view = priv->mainFrame->view();
6992 EINA_SAFETY_ON_NULL_RETURN(view);
6994 view->forceLayout();
6996 LOG_ERROR("TIZEN_EFL_EXT_API is disabled. \n");
7000 Eina_Bool ewk_view_image_get(const Evas_Object* ewkView, Evas_Object* evasImage, int x, int y)
7002 #if ENABLE(TIZEN_EFL_EXT_API)
7003 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
7004 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
7005 WebCore::Frame* frame = priv->mainFrame;
7006 EINA_SAFETY_ON_NULL_RETURN_VAL(frame, false);
7007 EINA_SAFETY_ON_NULL_RETURN_VAL(evasImage, false);
7009 WebCore::DragImageRef dragImageRef = (WebCore::DragImageRef) evasImage;
7010 WebCore::IntPoint dragImageOrigin(0, 0); // not used currently
7011 WebCore::IntPoint eventPos(x, y);
7013 WebCore::DragClientEfl dragClient; // in the future this should be static field or something
7014 dragClient.startDrag(dragImageRef, dragImageOrigin, eventPos, 0, frame);
7018 LOG_ERROR("TIZEN_EFL_EXT_API is disabled. \n");
7023 Eina_Bool ewk_page_dropdown_set_current_index(Evas_Object* ewkView, int newOptionIndex)
7025 #if ENABLE(TIZEN_DROPDOWN_SUPPORT)
7026 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
7027 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
7029 if (!priv->mainFrame->view())
7032 WebCore::Node* node = priv->currentSelectedNode;
7033 if (!node || node->nodeType() != WebCore::Node::ELEMENT_NODE
7034 || !equalIgnoringCase(node->nodeName(), "SELECT"))
7037 WebCore::HTMLSelectElement* selectElement = static_cast<WebCore::HTMLSelectElement*>(node);
7041 if (newOptionIndex < 0 || newOptionIndex >= selectElement->length())
7044 selectElement->optionSelectedByUser(newOptionIndex, true, true);
7046 // Pure WebKit EFL supports tp show popup. However, TIZEN_ browser doesn't
7047 // use the popup APIs. The popup instance created by WebCore need to be
7049 #if ENABLE(TIZEN_POPUP_FIX)
7050 ewk_view_popup_destroy(ewkView);
7055 LOG_ERROR("TIZEN_EFL_EXT_API is disabled. \n");
7060 #if ENABLE(TIZEN_DROPDOWN_SUPPORT)
7061 bool _ewk_view_get_select_rect(Evas_Object* ewkView, Eina_Rectangle* rect)
7063 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
7064 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0);
7066 WebCore::Node* node = priv->currentSelectedNode;
7068 rect->x = node->getRect().x();
7069 rect->y = node->getRect().y();
7070 rect->w = node->getRect().width();
7071 rect->h = node->getRect().height();
7075 bool _ewk_view_dropdown_check_node_exist(Evas_Object* ewkView, bool* is_prev, bool* is_next)
7077 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
7078 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0);
7080 RefPtr<WebCore::KeyboardEvent> event = WebCore::KeyboardEvent::create();
7081 WebCore::KeyboardEvent* keyEvent = static_cast<WebCore::KeyboardEvent*>(event.get());
7083 WebCore::Node* prevNode = priv->currentSelectedNode;
7084 WebCore::Node* nextNode = priv->currentSelectedNode;
7089 prevNode = priv->page->focusController()->previousFocusableNode(WebCore::FocusScope::focusScopeOf(prevNode), prevNode, keyEvent);
7091 if ((prevNode) && (equalIgnoringCase(prevNode->nodeName(), "SELECT"))) {
7097 nextNode = priv->page->focusController()->nextFocusableNode(WebCore::FocusScope::focusScopeOf(nextNode), nextNode, keyEvent);
7099 if ((nextNode) && (equalIgnoringCase(nextNode->nodeName(), "SELECT"))) {
7108 char** ewk_page_dropdown_get_options(Evas_Object* ewkView, int x, int y, int* numberOfOptionsReturned, int* curentOptionIndex, Eina_Rectangle* rect, bool* is_prev, bool* is_next)
7110 #if ENABLE(TIZEN_DROPDOWN_SUPPORT)
7111 EINA_SAFETY_ON_NULL_RETURN_VAL(numberOfOptionsReturned, 0);
7112 EINA_SAFETY_ON_NULL_RETURN_VAL(curentOptionIndex, 0);
7114 *numberOfOptionsReturned = 0;
7115 *curentOptionIndex = -1;
7118 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
7119 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0);
7121 if (!priv->mainFrame->view())
7124 WebCore::IntPoint pt = priv->mainFrame->view()->windowToContents(WebCore::IntPoint(x, y));
7125 WebCore::HitTestResult hitResult = priv->mainFrame->eventHandler()->hitTestResultAtPoint(pt, false);
7126 WebCore::Node* node = hitResult.innerNode()? hitResult.innerNode(): 0;
7127 if (!node || node->nodeType() != WebCore::Node::ELEMENT_NODE)
7130 priv->currentSelectedNode = node;
7132 WTF::AtomicString nodeName = node->nodeName();
7133 if (equalIgnoringCase(nodeName, "SELECT")) {
7134 WebCore::HTMLSelectElement* selectElem = (WebCore::HTMLSelectElement*)node;
7135 RefPtr<WebCore::HTMLOptionsCollection> availableOptions = selectElem->options();
7138 if (!availableOptions->length())
7141 *numberOfOptionsReturned = availableOptions->length();
7143 *curentOptionIndex = availableOptions->selectedIndex();
7144 // malloc'ing the table
7145 result = (char**)malloc((*numberOfOptionsReturned) * sizeof(char*));
7149 // iterating options
7150 for (int i = 0; i < *numberOfOptionsReturned; ++i) {
7151 WebCore::Node* node = availableOptions->item(i);
7152 WebCore::HTMLOptionElement* optionElement = (WebCore::HTMLOptionElement*)node;
7154 WTF::String optionText = optionElement->text();
7155 result[i] = strdup(optionText.utf8().data());
7157 _ewk_view_get_select_rect(ewkView, rect);
7158 _ewk_view_dropdown_check_node_exist(ewkView, is_prev, is_next);
7165 LOG_ERROR("TIZEN_DROPDOWN_SUPPORT is disabled. \n");
7170 char** ewk_view_dropdown_get_next_options(Evas_Object* ewkView, int* numberOfOptionsReturned, int* curentOptionIndex, Eina_Rectangle* rect, bool* is_prev, bool* is_next)
7172 #if ENABLE(TIZEN_DROPDOWN_SUPPORT)
7173 EINA_SAFETY_ON_NULL_RETURN_VAL(numberOfOptionsReturned, 0);
7174 EINA_SAFETY_ON_NULL_RETURN_VAL(curentOptionIndex, 0);
7175 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
7176 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0);
7180 WebCore::Node* node = priv->currentSelectedNode;
7182 RefPtr<WebCore::KeyboardEvent> event = WebCore::KeyboardEvent::create();
7183 WebCore::KeyboardEvent* keyEvent = static_cast<WebCore::KeyboardEvent*>(event.get());
7186 node = priv->page->focusController()->nextFocusableNode(WebCore::FocusScope::focusScopeOf(node), node, keyEvent);
7191 WTF::AtomicString nodeName = node->nodeName();
7193 if (equalIgnoringCase(nodeName, "SELECT")) {
7194 WebCore::HTMLSelectElement* selectElem = (WebCore::HTMLSelectElement*)node;
7195 RefPtr<WebCore::HTMLOptionsCollection> availableOptions = selectElem->options();
7198 if (!availableOptions->length())
7201 *numberOfOptionsReturned = availableOptions->length();
7203 *curentOptionIndex = availableOptions->selectedIndex();
7204 // malloc'ing the table
7205 result = (char**)malloc((*numberOfOptionsReturned) * sizeof(char*));
7209 // iterating options
7210 for (int i = 0; i < *numberOfOptionsReturned; ++i) {
7211 WebCore::Node* node = availableOptions->item(i);
7212 WebCore::HTMLOptionElement* optionElement = (WebCore::HTMLOptionElement*)node;
7214 WTF::String optionText = optionElement->text();
7215 result[i] = strdup(optionText.utf8().data());
7216 printf("<< next name = %s \n", result[i]);
7218 priv->currentSelectedNode = node;
7220 _ewk_view_get_select_rect(ewkView, rect);
7221 _ewk_view_dropdown_check_node_exist(ewkView, is_prev, is_next);
7223 #if 0 // Implementing to move focus by gyuyoung
7224 RefPtr<WebCore::KeyboardEvent> event = WebCore::KeyboardEvent::create();
7225 WebCore::KeyboardEvent* keyEvent = static_cast<WebCore::KeyboardEvent*>(event.get());
7227 WebCore::FocusController* c = priv->mainFrame->page()->focusController();
7228 WebCore::FocusDirection focusDirection = WebCore::FocusDirectionForward;
7230 c->advanceFocus(focusDirection, keyEvent);
7231 keyEvent->setDefaultHandled();
7239 LOG_ERROR("TIZEN_DROPDOWN_SUPPORT is disabled. \n");
7244 char** ewk_view_dropdown_get_prev_options(Evas_Object* ewkView, int* numberOfOptionsReturned, int* curentOptionIndex, Eina_Rectangle* rect, bool* is_prev, bool* is_next)
7246 #if ENABLE(TIZEN_DROPDOWN_SUPPORT)
7247 EINA_SAFETY_ON_NULL_RETURN_VAL(numberOfOptionsReturned, 0);
7248 EINA_SAFETY_ON_NULL_RETURN_VAL(curentOptionIndex, 0);
7249 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
7250 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0);
7254 WebCore::Node* node = priv->currentSelectedNode;
7256 RefPtr<WebCore::KeyboardEvent> event = WebCore::KeyboardEvent::create();
7257 WebCore::KeyboardEvent* keyEvent = static_cast<WebCore::KeyboardEvent*>(event.get());
7260 node = priv->page->focusController()->previousFocusableNode(WebCore::FocusScope::focusScopeOf(node), node, keyEvent);
7265 WTF::AtomicString nodeName = node->nodeName();
7267 if (equalIgnoringCase(nodeName, "SELECT")) {
7268 WebCore::HTMLSelectElement* selectElem = (WebCore::HTMLSelectElement*)node;
7269 RefPtr<WebCore::HTMLOptionsCollection> availableOptions = selectElem->options();
7272 if (!availableOptions->length())
7275 *numberOfOptionsReturned = availableOptions->length();
7277 *curentOptionIndex = availableOptions->selectedIndex();
7278 // malloc'ing the table
7279 result = (char**)malloc((*numberOfOptionsReturned) * sizeof(char*));
7283 // iterating options
7284 for (int i = 0; i < *numberOfOptionsReturned; ++i) {
7285 WebCore::Node* node = availableOptions->item(i);
7286 WebCore::HTMLOptionElement* optionElement = (WebCore::HTMLOptionElement*)node;
7288 WTF::String optionText = optionElement->text();
7289 result[i] = strdup(optionText.utf8().data());
7290 printf("<< prev name = %s \n", result[i]);
7292 #if 0 // Implementing to move focus by gyuyoung
7293 RefPtr<WebCore::KeyboardEvent> event = WebCore::KeyboardEvent::create();
7294 WebCore::KeyboardEvent* keyEvent = static_cast<WebCore::KeyboardEvent*>(event.get());
7296 WebCore::FocusController* c = priv->mainFrame->page()->focusController();
7297 WebCore::FocusDirection focusDirection = WebCore::FocusDirectionBackward;
7299 c->advanceFocus(focusDirection, keyEvent);
7300 keyEvent->setDefaultHandled();
7302 priv->currentSelectedNode = node;
7304 _ewk_view_get_select_rect(ewkView, rect);
7305 _ewk_view_dropdown_check_node_exist(ewkView, is_prev, is_next);
7313 LOG_ERROR("TIZEN_DROPDOWN_SUPPORT is disabled. \n");
7319 * Checking point for virtual keyboard enabling
7320 * Virtual keyboard is enabled for following html tags
7321 * input which type is not equal checkbox|radio|submit|reset|file|hidden|image|button,
7322 * because default and wrong types are text textarea
7324 * @param[in] obj a Evas_Object webview
7325 * @param[in] x x coordinate of checking point
7326 * @param[in] y y coordinate of checking point
7327 * @return TRUE if element needs virtual keyboard or FALSE in other case
7329 * Looks for a specified string inside #web_view.
7331 char* ewk_page_check_point_for_keyboard(Evas_Object* ewkView, int x, int y, Eina_Bool* ret)
7333 #if ENABLE(TIZEN_EFL_EXT_API)
7334 EINA_SAFETY_ON_NULL_RETURN_VAL(ret, 0);
7335 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
7336 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0);
7338 WebCore::Document* doc = priv->mainFrame->documentAtPoint(WebCore::IntPoint(x, y));
7339 WebCore::Element* elem = doc->elementFromPoint(x, y);
7341 WebCore::Frame* frame = EWKPrivate::corePage(ewkView)->focusController()->focusedOrMainFrame();
7342 *ret = frame->editor()->canEdit();
7344 WTF::String val = elem->getAttribute("value");
7347 return strdup(val.utf8().data());
7352 LOG_ERROR("TIZEN_EFL_EXT_API is disabled. \n");
7357 Eina_Bool ewk_page_check_point(Evas_Object* ewkView, int x, int y, Evas_Event_Mouse_Down* event , Eina_Bool* haveLink, Eina_Bool* haveImg, Eina_Bool* haveFlash, char** linkURL, char** linkText, char** imgURL)
7359 #if ENABLE(TIZEN_EFL_EXT_API)
7360 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
7361 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
7363 WebCore::Document* doc = priv->mainFrame->documentAtPoint(WebCore::IntPoint(x, y));
7367 WebCore::HitTestRequest hitRequest(WebCore::HitTestRequest::ReadOnly);
7368 WebCore::IntPoint point(x, y);
7369 WebCore::PlatformMouseEvent platformEvent(event, point);
7371 WebCore::MouseEventWithHitTestResults mouseWithHitResult = doc->prepareMouseEvent(hitRequest, point, platformEvent);
7373 const WebCore::HitTestResult &hitResult = mouseWithHitResult.hitTestResult();
7375 if (hitResult.absoluteLinkURL().isNull()) {
7380 *linkURL = strdup(hitResult.absoluteLinkURL().string().utf8().data());
7381 *linkText = strdup(hitResult.textContent().utf8().data());
7384 if (hitResult.absoluteImageURL().isNull()) {
7389 *imgURL = strdup(hitResult.absoluteImageURL().string().utf8().data());
7394 // detect flash content
7395 WebCore::Node* node = hitResult.innerNonSharedNode();
7396 WebCore::Element* element = 0;
7397 if (node && node->isElementNode())
7398 element = static_cast<WebCore::Element*>(hitResult.innerNonSharedNode());
7400 if (element && (element->hasTagName(WebCore::HTMLNames::objectTag) || element->hasTagName(WebCore::HTMLNames::embedTag))) {
7401 WebCore::HTMLPlugInElement* pluginElement = static_cast<WebCore::HTMLPlugInElement*>(element);
7402 if (_check_for_running_plugin(pluginElement))
7408 return true; // fix prevent defect
7410 LOG_ERROR("TIZEN_EFL_EXT_API is disabled. \n");
7415 EAPI Eina_Bool ewk_view_reduce_plugins_frame_rate(Evas_Object* view, Eina_Bool reduceFPS)
7417 #if ENABLE(TIZEN_PLUGIN_EXT) && ENABLE(NETSCAPE_PLUGIN_API) && ENABLE(TIZEN_NPAPI)
7418 EWK_VIEW_SD_GET_OR_RETURN(view, smartData, false);
7419 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
7423 tnpevent.type = TNPReduceFPS;
7425 tnpevent.type = TNPRevertFPS;
7427 _iterate_frames(priv->mainFrame, _send_event_to_all_plugins, &tnpevent);
7430 LOG_ERROR("Tizen plugin extension, netscape api or tizen npapi are disabled.\n");
7435 Eina_Bool ewk_view_pause_or_resume_plugins(Evas_Object* view, Eina_Bool pausePlugin)
7437 #if ENABLE(TIZEN_PLUGIN_EXT) && ENABLE(NETSCAPE_PLUGIN_API) && ENABLE(TIZEN_NPAPI)
7438 EWK_VIEW_SD_GET_OR_RETURN(view, smartData, false);
7439 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
7443 tnpevent.type = TNPPausePlugin;
7445 tnpevent.type = TNPResumePlugin;
7447 _iterate_frames(priv->mainFrame, _send_event_to_all_plugins, &tnpevent);
7450 LOG_ERROR("Pause/resume plugins, netscape api or tizen npapi are disabled.\n");
7456 * Pausing/resuming html5 video and audio
7458 * @param [in] view object
7459 * @param [in] true if pause media, false to resume
7461 void ewk_view_pause_or_resume_video_audio(Evas_Object* view, Eina_Bool pauseMedia)
7463 #if ENABLE(TIZEN_MM_PLAYER)
7464 bool pause = pauseMedia;
7465 evas_object_smart_callback_call(view, "html5video,pauseresume", &pause);
7467 LOG_ERROR("tizen mm-player is disabled. \n");
7471 Eina_Bool ewk_view_suspend_request(Evas_Object* ewkView)
7473 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
7474 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
7476 WebCore::Frame* mainFrame = priv->mainFrame;
7478 #if ENABLE(TIZEN_PAUSE_NETWORK)
7479 mainFrame->loader()->suspendAllLoaders();
7482 #if !ENABLE(TIZEN_MM_PLAYER)
7484 WebCore::Document* document = mainFrame->document();
7485 RefPtr<WebCore::NodeList> list = document->getElementsByTagName("video");
7487 unsigned len = list->length();
7488 for (unsigned i = 0; i < len; i++) {
7489 if (list->item(i)->hasTagName(WebCore::HTMLNames::videoTag)) {
7490 WebCore::HTMLMediaElement* media = static_cast<WebCore::HTMLMediaElement*>(list->item(i));
7491 if (media->player()->hasVideo())
7492 media->player()->pause();
7495 #endif // ENABLE(VIDEO)
7496 #endif // !ENABLE(TIZEN_MM_PLAYER)
7500 Eina_Bool ewk_view_resume_request(Evas_Object* ewkView)
7502 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
7503 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
7505 WebCore::Frame* mainFrame = priv->mainFrame;
7507 #if ENABLE(TIZEN_PAUSE_NETWORK)
7508 mainFrame->loader()->resumeAllLoaders();
7511 #if !ENABLE(TIZEN_MM_PLAYER)
7513 // for playing video again
7514 WebCore::Document* document = mainFrame->document();
7515 RefPtr<WebCore::NodeList> list = document->getElementsByTagName("video");
7517 unsigned len = list->length();
7518 for (unsigned i = 0; i < len; i++) {
7519 if (list->item(i)->hasTagName(WebCore::HTMLNames::videoTag)) {
7520 WebCore::HTMLMediaElement* media = static_cast<WebCore::HTMLMediaElement*>(list->item(i));
7521 if (media->player()->hasVideo())
7522 media->player()->play();
7525 #endif // ENABLE(VIDEO)
7526 #endif // !ENABLE(TIZEN_MM_PLAYER)
7530 Eina_Bool ewk_view_text_size_adjust(Evas_Object* ewkView)
7532 #if ENABLE(TIZEN_TEXT_SIZE_ADJUST)
7533 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
7534 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
7536 WebCore::Document* document = priv->mainFrame->document();
7540 WebCore::Element* element = document->documentElement();
7544 WebCore::RenderStyle* rootStyle = element->renderStyle();
7546 return rootStyle->textSizeAdjust();
7550 LOG_ERROR("TIZEN_TEXT_SIZE_ADJUST is disabled. \n");
7555 void ewk_view_set_text_size_adjust(Evas_Object* ewkView, Eina_Bool set)
7557 #if ENABLE(TIZEN_TEXT_SIZE_ADJUST)
7558 if (ewk_view_text_size_adjust(ewkView) != set) {
7559 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
7560 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
7562 WebCore::Document* document = priv->mainFrame->document();
7566 WebCore::Element* element = document->documentElement();
7570 WebCore::RenderStyle* rootStyle = element->renderStyle();
7573 rootStyle->setTextSizeAdjust(set);
7576 LOG_ERROR("TIZEN_TEXT_SIZE_ADJUST is disabled. \n");
7580 void ewk_webcore_cache_clean()
7582 #if ENABLE(TIZEN_EFL_EXT_API)
7583 (WebCore::memoryCache())->setDisabled(true);
7584 (WebCore::memoryCache())->setDisabled(false);
7586 LOG_ERROR("TIZEN_EFL_EXT_API is disabled. \n");
7590 #if ENABLE(TIZEN_EFL_EXT_API)
7591 void _rescale_images_from_frame(WebCore::Frame* frame, void* data)
7595 width = *static_cast<int*>(data);
7599 RefPtr<WebCore::HTMLCollection> images = frame->document()->images();
7601 for (unsigned i = 0 ; i < images->length() ; ++i) {
7602 WebCore::HTMLImageElement* htmlImageElement = static_cast<WebCore::HTMLImageElement*>(images->item(i));
7603 if (!htmlImageElement)
7606 int imageW = htmlImageElement->width();
7607 int imageH = htmlImageElement->height();
7609 if (imageW > 0 && imageH > 0 && width > 0 && imageW > width) { // image extends webview and need to be rescaled
7610 int newImageW, newImageH;
7612 newImageH = (newImageW * imageH) / imageW;
7614 htmlImageElement->setWidth(newImageW);
7615 htmlImageElement->setHeight(newImageH);
7621 void ewk_view_rescale_images_to_width(Evas_Object* ewkView, int w)
7623 #if ENABLE(TIZEN_EFL_EXT_API)
7624 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
7625 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
7627 if (priv->mainFrame) {
7628 WebCore::Document* document = priv->mainFrame->document();
7631 _iterate_frames(priv->mainFrame, _rescale_images_from_frame, (void*)&width);
7635 LOG_ERROR("TIZEN_EFL_EXT_API is disabled. \n");
7640 #if ENABLE(TIZEN_EFL_EXT_API)
7641 // FIXME: NEED TO REMOVE
7642 static Eina_Bool (*g_navigation_policy_decision)(Ewk_View_Smart_Data* smartData, Ewk_Frame_Resource_Request* request);
7644 // FIXME: NEED TO REMOVE
7645 EAPI void ewk_view_navigation_policy_decision_set(Eina_Bool (*navigation_policy_decision)(Ewk_View_Smart_Data*, Ewk_Frame_Resource_Request*))
7647 g_navigation_policy_decision = navigation_policy_decision;
7652 * This method returns allocated list containing rss links in the document which view object load.
7654 * @param ewkView view object.
7656 * @return eina_list containing Ewk_RSS_Items or 0. It should be freed via ewk_view_rss_items_free().
7658 * @see ewk_view_rss_items_free()
7660 EAPI Eina_List* ewk_view_rss_items_get(Evas_Object* ewkView)
7662 #if ENABLE(TIZEN_SUPPORT_RSS_LINK_PARSING)
7663 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
7664 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0);
7666 WebCore::Document* document = priv->mainFrame->document();
7667 RefPtr<WebCore::HTMLAllCollection>collection = document->all();
7669 WTF::String Rss("application/rss+xml");
7670 WTF::String Atom("application/atom+xml");
7671 WTF::String Alternate("alternate");
7674 for (WebCore::Node* node = collection->firstItem(); node; node = collection->nextItem()) {
7675 WebCore::HTMLLinkElement* linkElement = static_cast<WebCore::HTMLLinkElement*>(node);
7676 if (linkElement->rel() == Alternate) {
7678 if (linkElement->type() == Rss)
7679 type = EWK_LINK_TYPE_RSS;
7680 else if (linkElement->type() == Atom)
7681 type = EWK_LINK_TYPE_ATOM;
7685 Ewk_RSS_Item* linkItem = static_cast<Ewk_RSS_Item*>(malloc(sizeof(Ewk_RSS_Item)));
7689 linkItem->type = type;
7691 WTF::String href = linkElement->href();
7692 if (!href.isEmpty())
7693 linkItem->href = strdup(href.utf8().data());
7697 if (!linkElement->title().isEmpty())
7698 linkItem->title = strdup(linkElement->title().utf8().data());
7700 linkItem->title = 0;
7702 ret = eina_list_append(ret, linkItem);
7713 * This method clear list assigned by ewk_view_rss_items_get().
7716 * @param list list which assigned by ewk_view_rss_items_get().
7718 * @see ewk_view_rss_items_get()
7720 EAPI void ewk_view_rss_items_free(Eina_List* list)
7722 #if ENABLE(TIZEN_SUPPORT_RSS_LINK_PARSING)
7726 EINA_LIST_FREE(list, p) {
7727 Ewk_RSS_Item* item = static_cast<Ewk_RSS_Item*>(p);
7729 free(const_cast<char*>(item->href));
7731 free(const_cast<char*>(item->title));
7737 EAPI void ewk_view_get_rss_links(Evas_Object* ewkView, Ewk_RSS_Link** pRssLink, int* rssCount)
7739 #if ENABLE(TIZEN_SUPPORT_RSS_LINK_PARSING)
7740 // This method is deprecated.
7745 #if USE(ACCELERATED_COMPOSITING) && ENABLE(TIZEN_ACCELERATED_COMPOSITING)
7746 static void _ewk_view_accelerated_compositing_pixels_cb(void* data, Evas_Object* obj)
7748 Evas_Object* ewkView = static_cast<Evas_Object*>(data);
7750 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
7751 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
7753 if (priv->compositingActive) {
7754 priv->mainFrame->view()->updateLayoutAndStyleIfNeededRecursive();
7755 priv->compositor->syncLayers();
7759 void ewk_view_compositor_create(Evas_Object* ewkView)
7761 EWK_VIEW_SD_GET(ewkView, smartData);
7762 EWK_VIEW_PRIV_GET(smartData, priv);
7764 if (priv->compositor)
7766 priv->compositor = WebCore::AcceleratedCompositor::create(priv->page->chrome());
7769 Evas_Object* ewk_view_evas_gl_object_create(Evas_Object* ewkView, Evas_Native_Surface* nativeSurface, int x, int y, int w, int h)
7771 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
7772 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0);
7774 if (!priv->compositingSurface) {
7775 Evas_Object* evas_gl_object = evas_object_image_add(smartData->base.evas);
7777 evas_object_pass_events_set(evas_gl_object, true); // ignore events
7778 evas_object_image_alpha_set(evas_gl_object, true);
7779 evas_object_image_content_hint_set(evas_gl_object, EVAS_IMAGE_CONTENT_HINT_DYNAMIC);
7781 evas_object_smart_member_add(evas_gl_object, ewkView);
7783 priv->compositingSurface = evas_gl_object;
7786 evas_object_image_size_set(priv->compositingSurface, w, h);
7787 evas_object_image_fill_set(priv->compositingSurface, 0, 0, w, h);
7789 evas_object_image_native_surface_set(priv->compositingSurface, nativeSurface);
7791 evas_object_image_pixels_get_callback_set(priv->compositingSurface, _ewk_view_accelerated_compositing_pixels_cb, ewkView);
7793 evas_object_move(priv->compositingSurface, x, y);
7794 evas_object_resize(priv->compositingSurface, w, h);
7796 return priv->compositingSurface;
7799 void ewk_view_root_graphics_layer_set(Evas_Object* ewkView, WebCore::GraphicsLayer* rootLayer)
7801 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
7802 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
7804 bool active = rootLayer ? true : false;
7806 if (priv->compositingActive == active)
7809 priv->compositingActive = active;
7811 if (priv->compositingActive) {
7812 ewk_view_compositor_create(ewkView);
7814 if (priv->compositingSurface && priv->compositor) {
7815 evas_object_show(priv->compositingSurface);
7817 priv->compositor->setRootLayer(rootLayer);
7819 float zoom = ewk_view_zoom_get(ewkView);
7820 priv->compositor->setZoom(zoom);
7822 priv->compositingActive = false;
7825 if (!priv->compositingActive && priv->compositingSurface)
7826 evas_object_hide(priv->compositingSurface);
7829 void ewk_view_mark_for_sync(Evas_Object* ewkView, bool b)
7831 EWK_VIEW_SD_GET(ewkView, smartData);
7832 EWK_VIEW_PRIV_GET(smartData, priv);
7834 evas_object_image_pixels_dirty_set(priv->compositingSurface, true);
7838 Evas_Object* ewk_view_evas_object_for_compositing_create(Evas_Object* ewkView)
7840 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
7841 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0);
7843 if (!priv->compositingSurface) {
7844 int x = 0, y = 0, w = 0, h = 0;
7845 evas_object_geometry_get(ewkView, &x, &y, &w, &h);
7847 Evas_Object* evasObject = evas_object_image_add(smartData->base.evas);
7849 evas_object_image_alpha_set(evasObject, true);
7850 evas_object_move(evasObject, x, y);
7851 evas_object_image_content_hint_set(evasObject, EVAS_IMAGE_CONTENT_HINT_DYNAMIC);
7852 evas_object_image_size_set(evasObject, w, h);
7853 evas_object_image_fill_set(evasObject, 0, 0, w, h);
7854 evas_object_resize(evasObject, w, h);
7855 evas_object_hide(evasObject);
7856 evas_object_pass_events_set(evasObject, true); // ignore events
7857 evas_object_smart_member_add(evasObject, ewkView);
7859 priv->compositingSurface = evasObject;
7861 return priv->compositingSurface;
7864 #if ENABLE(TIZEN_CSS_OVERFLOW_SCROLL_ACCELERATION)
7865 void ewk_view_add_or_update_scrolling_layer(Evas_Object* ewkView, WebCore::PlatformLayer* scrollingLayer, WebCore::PlatformLayer* contentsLayer, const WebCore::IntSize& scrollSize)
7867 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
7868 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
7870 if (!priv->compositingActive || !priv->compositingSurface || !priv->compositor)
7873 priv->compositor->addOrUpdateScrollingLayer(scrollingLayer, contentsLayer, scrollSize);
7876 void ewk_view_remove_scrolling_layer(Evas_Object* ewkView, WebCore::PlatformLayer* scrollingLayer, WebCore::PlatformLayer* contentsLayer)
7878 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
7879 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
7881 if (!priv->compositingActive || !priv->compositingSurface || !priv->compositor)
7884 priv->compositor->removeScrollingLayer(scrollingLayer, contentsLayer);
7887 #endif // USE(ACCELERATED_COMPOSITING) && ENABLE(TIZEN_ACCELERATED_COMPOSITING)
7890 * @fn Ewk_Dom_Input_Picker_Type ewk_view_cur_selected_element_type_check(Evas_Object* ewkView, int x, int y)
7891 * @brief Check DOM-element and attribute type for UI picker
7892 * @param [in] ewkView Webview.Evas_Object
7893 * @param [in] x X coordinate
7894 * @param [in] y Y coodinate
7895 * @return enum value of Ewk_Dom_Input_Picker_Type is a current selected element and attribute
7897 Ewk_Dom_Input_Picker_Type ewk_view_cur_selected_element_type_check(Evas_Object* ewkView, int x, int y)
7899 #if ENABLE(TIZEN_EFL_EXT_API)
7900 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, EWK_DOM_ELEMENT_NONE);
7901 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, EWK_DOM_ELEMENT_NONE);
7902 if (!priv->mainFrame->view())
7903 return EWK_DOM_ELEMENT_NONE;
7905 WebCore::IntPoint pt = priv->mainFrame->view()->windowToContents(WebCore::IntPoint(x, y));
7906 WebCore::HitTestResult hitResult = priv->mainFrame->eventHandler()->hitTestResultAtPoint(pt, false);
7907 WebCore::Node* node = hitResult.innerNode() ? hitResult.innerNode() : 0;
7909 if (!node || node->nodeType() != WebCore::Node::ELEMENT_NODE)
7910 return EWK_DOM_ELEMENT_NONE;
7912 WTF::AtomicString nodeName = node->nodeName();
7913 if (equalIgnoringCase(nodeName, "SELECT"))
7914 return EWK_DOM_ELEMENT_SELECT;
7915 if (equalIgnoringCase(nodeName, "INPUT")) {
7916 if (!node->attributes())
7917 return EWK_DOM_ELEMENT_INPUT_ELSE;
7918 RefPtr<WebCore::Node> n = node->attributes()->getNamedItem("type");
7920 return EWK_DOM_ELEMENT_INPUT_ELSE;
7922 WTF::AtomicString nodeValue = n.get()->nodeValue();
7924 if (equalIgnoringCase(nodeValue, "COLOR"))
7925 return EWK_DOM_ELEMENT_INPUT_COLOR;
7926 if (equalIgnoringCase(nodeValue, "TIME"))
7927 return EWK_DOM_ELEMENT_INPUT_TIME;
7928 if (equalIgnoringCase(nodeValue, "DATE"))
7929 return EWK_DOM_ELEMENT_INPUT_DATE;
7931 return EWK_DOM_ELEMENT_INPUT_ELSE;
7934 return EWK_DOM_ELEMENT_ELSE;
7936 LOG_ERROR("TIZEN_EFL_EXT_API is disabled. \n");
7937 return EWK_DOM_ELEMENT_ERROR;
7942 * @fn Eina_Bool ewk_view_cur_selected_input_element_value_set(Evas_Object* ewkView, int x, int y, const char* value, Ewk_Dom_Input_Picker_Type type)
7943 * @brief Check DOM-element and attribute type for UI picker
7944 * @param [in] ewkView Webview.Evas_Object
7945 * @param [in] x X coordinate
7946 * @param [in] y Y coodinate
7947 * @param [in] value Setting value for current input element
7948 * @param [in] type Ewk_Dom_Input_Picker_Type for setting value validation checking
7949 * @return true if operation is success; false if not
7951 Eina_Bool ewk_view_cur_selected_input_element_value_set(Evas_Object* ewkView, int x, int y, const char* value, Ewk_Dom_Input_Picker_Type type)
7953 #if ENABLE(TIZEN_EFL_EXT_API)
7954 if (!ewk_view_input_element_value_check(value, type))
7957 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
7958 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
7960 if (!priv->mainFrame->view())
7963 WebCore::IntPoint pt = priv->mainFrame->view()->windowToContents(WebCore::IntPoint(x, y));
7964 WebCore::HitTestResult hitResult = priv->mainFrame->eventHandler()->hitTestResultAtPoint(pt, false);
7965 WebCore::Node* node = hitResult.innerNode()? hitResult.innerNode() : 0;
7966 if (!node || node->nodeType() != WebCore::Node::ELEMENT_NODE)
7969 if (equalIgnoringCase(node->nodeName(), "INPUT")) {
7970 WebCore::HTMLInputElement* htmlInputElement = (WebCore::HTMLInputElement*)node;
7971 htmlInputElement->setValue(value, WebCore::DispatchChangeEvent);
7977 LOG_ERROR("TIZEN_EFL_EXT_API is disabled. \n");
7984 * @fn char* ewk_view_cur_selected_element_value_get(Evas_Object* ewkView, int x, int y, Ewk_Dom_Input_Picker_Type type)
7985 * @brief Check DOM-element and attribute type for UI picker
7986 * @param [in] ewkView Webview.Evas_Object
7987 * @param [in] x X coordinate
7988 * @param [in] y Y coodinate
7989 * @param [in] type Ewk_Dom_Input_Picker_Type for getting value
7990 * @return String of current selected input element's value (Tis is had to be freed after use)
7992 char* ewk_view_cur_selected_element_value_get(Evas_Object* ewkView, int x, int y, Ewk_Dom_Input_Picker_Type type)
7994 #if ENABLE(TIZEN_EFL_EXT_API)
7995 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
7996 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0);
7998 if (!priv->mainFrame->view())
8001 WebCore::IntPoint pt = priv->mainFrame->view()->windowToContents(WebCore::IntPoint(x, y));
8002 WebCore::HitTestResult hitResult = priv->mainFrame->eventHandler()->hitTestResultAtPoint(pt, false);
8003 WebCore::Node* node = hitResult.innerNode() ? hitResult.innerNode() : 0;
8005 if (!node || node->nodeType() != WebCore::Node::ELEMENT_NODE)
8008 if (equalIgnoringCase(node->nodeName(), "INPUT")) {
8009 WebCore::HTMLInputElement* htmlInputElement = (WebCore::HTMLInputElement*)node;
8010 if (!ewk_view_input_element_value_check(htmlInputElement->value().utf8().data(), type))
8013 return strdup(htmlInputElement->value().utf8().data());
8018 LOG_ERROR("TIZEN_EFL_EXT_API is disabled. \n");
8025 * @fn Eina_Bool ewk_view_input_element_value_check(const char* value, Ewk_Dom_Input_Picker_Type type)
8026 * @brief Check DOM-element and attribute type for UI picker
8028 * @param [in] value A value for validation checking
8029 * @param [in] type For validation checking type of input element
8030 * @return true if value is valid; false if not
8032 Eina_Bool ewk_view_input_element_value_check(const char* value, Ewk_Dom_Input_Picker_Type type)
8034 #if ENABLE(TIZEN_EFL_EXT_API)
8035 String tempValue(value);
8038 case EWK_DOM_ELEMENT_INPUT_TIME: {
8039 if (tempValue.length() !=5 || tempValue[2] != ':')
8042 int h = tempValue.substring(0, 2).toInt();
8043 int m = tempValue.substring(3, 2).toInt();
8045 if ((h > 23 || h < 0) || (m > 59 || m < 0))
8049 case EWK_DOM_ELEMENT_INPUT_DATE: {
8050 if (tempValue.length() !=10 || tempValue[4] != '-' || tempValue[7] != '-')
8053 int y = tempValue.substring(0, 4).toInt();
8054 int m = tempValue.substring(5, 2).toInt();
8055 int d = tempValue.substring(8, 2).toInt();
8057 if ((y > 9999 || y < 0) || (m > 12 || m < 1) || (d > 31 || d < 1))
8061 case EWK_DOM_ELEMENT_INPUT_COLOR: {
8062 if (tempValue.length() !=7 || tempValue[0] != '#')
8072 LOG_ERROR("TIZEN_EFL_EXT_API is disabled. \n");
8077 Eina_Bool ewk_view_paste_image(Evas_Object* ewkView, const char* path)
8079 #if ENABLE(TIZEN_IMAGE_PASTE)
8080 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
8082 String filePath(path);
8083 filePath.remove(filePath.find("file://"), 7);
8085 while (!filePath.find("//"))
8086 filePath.remove(0, 1);
8088 FILE* file = fopen(filePath.utf8().data(), "r");
8090 LOG_ERROR("Could not open the file: %s\n", filePath.utf8().data());
8094 if (fseek(file, 0, SEEK_END)) {
8095 LOG_ERROR("Reading error\n");
8099 unsigned long size = ftell(file);
8102 char* buffer = (char*)malloc(sizeof(char)*size);
8104 LOG_ERROR("Memory error\n");
8109 size_t result = fread(buffer, sizeof(char), size, file);
8112 if (result != size) {
8113 LOG_ERROR("Reading error\n");
8118 String stringToEncode(buffer, result);
8122 in.append(stringToEncode.characters(), stringToEncode.length());
8124 WebCore::base64Encode(in, out);
8126 size_t dotPos = filePath.reverseFind(".");
8127 if (dotPos == notFound) {
8128 LOG_ERROR("Unknown image extension");
8132 String fileExtension = filePath.substring(dotPos + 1);
8133 if (equalIgnoringCase(fileExtension, "jpeg"))
8134 fileExtension = "jpg";
8135 else if (equalIgnoringCase(fileExtension, "jpg") && equalIgnoringCase(fileExtension, "png")) { // only png and jpg supported for now, got to test other images types
8136 LOG_ERROR("Unknown image extension");
8140 String encodedString = String("data:image/");
8141 encodedString.append(fileExtension);
8142 encodedString.append(";base64,");
8143 encodedString.append(String(out.data(), out.size()));
8145 return ewk_view_execute_editor_command(ewkView, EWK_EDITOR_COMMAND_INSERT_IMAGE, encodedString.utf8().data());
8147 LOG_ERROR("TIZEN_PASTE_IMAGE is disabled. \n");
8153 * This method allows to set value to the focused input element
8155 * @param[in] ewkView a Evas_Object webview
8156 * @param[in] value value to set
8157 * @return true if it is succeeded or false in other case
8159 Eina_Bool ewk_view_focused_input_element_value_set(Evas_Object* ewkView, const char* value)
8161 #if ENABLE(TIZEN_INPUT_TAG_SUPPORT)
8162 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
8163 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
8165 WebCore::Frame* focusedFrame = priv->page->focusController()->focusedOrMainFrame();
8167 && focusedFrame->document()
8168 && focusedFrame->document()->focusedNode()) {
8169 WebCore::Node* node = focusedFrame->document()->focusedNode();
8170 if (node->nodeType() == WebCore::Node::ELEMENT_NODE) {
8171 if (node->hasTagName(WebCore::HTMLNames::inputTag)) {
8172 (static_cast<WebCore::HTMLInputElement*>(node))->setValue(value, WebCore::DispatchChangeEvent);
8179 LOG_ERROR("TIZEN_EFL_EXT_API is disabled.\n");
8185 * This method allows to get value from the focused input element
8187 * @param[in] ewkView a Evas_Object webview
8188 * @return focused input element's value if it is succeeded or "" in other case
8190 const char* ewk_view_focused_input_element_value_get(Evas_Object* ewkView)
8192 #if ENABLE(TIZEN_EFL_EXT_API)
8193 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, "");
8194 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, "");
8196 WebCore::Frame* focusedFrame = priv->page->focusController()->focusedOrMainFrame();
8198 && focusedFrame->document()
8199 && focusedFrame->document()->focusedNode()) {
8200 WebCore::Node* node = focusedFrame->document()->focusedNode();
8201 if (node->nodeType() == WebCore::Node::ELEMENT_NODE)
8202 if (node->hasTagName(WebCore::HTMLNames::inputTag))
8203 return strdup((static_cast<WebCore::HTMLInputElement*>(node))->value().utf8().data());
8207 LOG_ERROR("TIZEN_EFL_EXT_API is disabled.\n");
8213 * Informs that this view is active.
8215 * This can be used by the backing store to release resources or disable
8216 * updates on this view if necessary, being able to have many views without
8217 * all the implied cost associated. By default each created view is active.
8219 * @param ewkView view to set as active.
8220 * @param value @c true if this view is active, @c false otherwise.
8222 * @return @c true if view was set as active/inactive, @c false
8223 * otherwise (errors, inactive set not supported).
8225 Eina_Bool ewk_view_active_set(Evas_Object* ewkView, Eina_Bool value)
8227 #if ENABLE(TIZEN_VIEW_ACTIVE_SET)
8228 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
8229 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
8230 EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->api->active_set, false);
8232 if (priv->flags.active == value)
8235 #if ENABLE(TIZEN_PLUGIN_EXT) && ENABLE(TIZEN_NPAPI)
8236 ewk_view_pause_or_resume_plugins(ewkView, !value);
8239 #if ENABLE(NETSCAPE_PLUGIN_API) && ENABLE(TIZEN_SUPPORT_PLUGINS) && ENABLE(TIZEN_DONT_PAN_OVER_SOME_PLUGINS)
8240 if (!value && WebCore::PluginView::isPluginHandlingEvents())
8241 WebCore::PluginView::setPluginHandlingEvents(false);
8244 if (smartData->api->active_set(smartData, value)) {
8245 priv->flags.active = value;
8251 LOG_ERROR("TIZEN_VIEW_ACTIVE_SET is disabled.\n");
8257 * Returns if this view is set as active.
8259 * @param ewkView view to fetch information from.
8261 * @return @c true if the view is active, @c false otherwise.
8263 Eina_Bool ewk_view_active_get(const Evas_Object* ewkView)
8265 #if ENABLE(TIZEN_VIEW_ACTIVE_SET)
8266 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
8267 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
8269 return priv->flags.active;
8271 LOG_ERROR("TIZEN_VIEW_ACTIVE_SET is disabled.\n");
8276 Eina_Bool ewk_view_dom_document_get(Evas_Object* ewkView, WebKitDOM_Document* ret)
8278 #if ENABLE(CDOM_BINDINGS)
8279 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
8280 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
8282 if (priv->mainFrame && ret) {
8283 _to_webkit_document(priv->mainFrame->document(), ret);
8288 LOG_ERROR("CDOM_BINDINGS is disabled.\n");
8293 /* Code for painting performance profile for Cairo/Skia */
8294 #if ENABLE(TIZEN_RENDERING_PROFILE_TEST)
8298 EAPI unsigned int ewk_view_screenshot_test(const Evas_Object* ewkView, float zoom, int input_w, int input_h, int output_w, int output_h, unsigned char* pixels, const char* aImageFileName, void* fp_logfile, const char* info_logfile);
8302 unsigned int ewk_view_screenshot_test(const Evas_Object* ewkView, float zoom, int input_w, int input_h, int output_w, int output_h, unsigned char* pixels, const char* aImageFileName, void* fp_logfile, const char* info_logfile)
8304 unsigned long s = 0, e = 0;
8305 struct timeval currentTime;
8307 #if ENABLE(TIZEN_EFL_EXT_API)
8308 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
8309 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0);
8311 WebCore::FrameView* view = priv->mainFrame->view();
8313 if (view->needsLayout())
8314 view->forceLayout();
8316 cairo_surface_t* cairo_surface = cairo_image_surface_create_for_data(pixels, CAIRO_FORMAT_ARGB32, output_w, output_h, output_w * 4);
8317 cairo_t* cr = cairo_create(cairo_surface);
8318 WebCore::GraphicsContext gc(cr);
8320 skia::PlatformCanvas canvas(output_w, output_h, 1, (uint8_t*)pixels);
8321 WebCore::PlatformContextSkia sContext(&canvas);
8322 WebCore::GraphicsContext gc(&sContext);
8324 WebCore::IntRect rect(0, 0, input_w, input_h);
8329 gettimeofday(¤tTime, 0);
8330 s = currentTime.tv_sec * 1000000 + currentTime.tv_usec;
8332 gc.scale(WebCore::FloatSize(zoom, zoom));
8334 if (view->isTransparent())
8336 view->paintContents(&gc, rect);
8338 gettimeofday(¤tTime, 0);
8339 e = currentTime.tv_sec * 1000000 + currentTime.tv_usec;
8344 WebCore::TizenProfiler::printByFunctions(static_cast<FILE*>(fp_logfile));
8345 if (aImageFileName) {
8347 cairo_surface_write_to_png(cairo_surface, aImageFileName);
8349 SkBitmap dst_bitmap;
8350 dst_bitmap.setConfig(SkBitmap::kARGB_8888_Config, output_w, output_h);
8351 dst_bitmap.setPixels((uint8_t*)pixels);
8352 SkImageEncoder::EncodeFile(aImageFileName, dst_bitmap, SkImageEncoder::kPNG_Type, 100);
8358 cairo_surface_destroy(cairo_surface);
8363 LOG_ERROR("TIZEN_EFL_EXT_API is disabled. \n");
8367 #endif // ENABLE(TIZEN_RENDERING_PROFILE_TEST)
8369 void ewk_view_show_ime_on_autofocus_set(Evas_Object* ewkView, Eina_Bool enabled)
8371 #if ENABLE(TIZEN_AUTOFOCUS_BLOCK)
8372 EWK_VIEW_SD_GET(ewkView, smartData);
8373 EWK_VIEW_PRIV_GET(smartData, priv);
8375 priv->settings.showImeOnAutofocus = enabled;
8379 Eina_Bool ewk_view_show_ime_on_autofocus_get(Evas_Object* ewkView)
8381 #if ENABLE(TIZEN_AUTOFOCUS_BLOCK)
8382 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
8383 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
8385 return priv->settings.showImeOnAutofocus;
8391 #if ENABLE(TIZEN_PAGE_CACHE)
8394 * Restore cached page contents size.
8396 * This method must be called before cached page restored().
8398 * @param ewkView view object to change cached page contents size.
8400 void ewk_view_cached_page_restore(Evas_Object* ewkView)
8402 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
8403 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
8405 WebCore::HistoryItem* item = priv->mainFrame->loader()->history()->currentItem();
8410 if (item->isInPageCache()) {
8411 ewk_view_viewport_attributes_set(ewkView, priv->viewportArguments);
8412 priv->mainFrame->view()->adjustViewSize();
8413 ewk_frame_load_firstlayout_nonempty_finished(smartData->main_frame);
8414 ewk_view_cached_page_data_save(ewkView, item->viewZoomFactor(), item->scrollPoint());
8419 * save cached page zoom level and scroll positoin in ewk_view.
8421 * @param ewkView view object to change cached page zoom and scroll data.
8422 * @param zoom_level to restore cached page zoom level.
8423 * @param pos to restore cached page scroll position.
8425 void ewk_view_cached_page_data_save(Evas_Object* ewkView, float zoom_level, WebCore::IntPoint pos)
8427 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
8428 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
8430 priv->cachedPageData.isRestored = true;
8431 priv->cachedPageData.zoomLevel = zoom_level;
8432 priv->cachedPageData.scrollPos = pos;
8436 Eina_Bool ewk_view_setting_recording_surface_enable_set(Evas_Object* ewkView, Eina_Bool enable)
8438 #if ENABLE(TIZEN_RECORDING_SURFACE)
8439 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
8440 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
8442 if (enable == false) {
8443 if (priv->recordingSurfaceEnable) {
8444 priv->recordingSurfaceSetState = RECORDING_SURFACE_SET_STATE_INIT;
8445 priv->recordingSurfaceSetList = ewk_recording_surface_set_free(smartData->_priv->recordingSurfaceSetList);
8446 priv->recordingSurfaceSetScrollState = false;
8449 priv->recordingSurfaceEnable = false;
8453 priv->recordingSurfaceEnable = true;
8460 #if ENABLE(TIZEN_RECORDING_SURFACE)
8461 int ewk_view_recording_surface_set_status_get(Ewk_View_Private_Data* priv, int status)
8464 case RECORDING_SURFACE_SET_ENABLE_CHECK:
8465 return priv->recordingSurfaceEnable;
8466 case RECORDING_SURFACE_SET_LOAD_FINISHED_CHECK:
8467 return priv->recordingSurfaceSetLoadFinished;
8468 case RECORDING_SURFACE_SET_RECORDING_STATE_CHECK:
8469 return priv->recordingSurfaceSetState;
8470 case RECORDING_SURFACE_SET_SCROLL_CHECK:
8471 return priv->recordingSurfaceSetScrollState;
8477 Eina_Bool ewk_view_recording_surface_set_paint_contents(Ewk_View_Private_Data* priv, cairo_t* cr, const Eina_Rectangle* area)
8479 EINA_SAFETY_ON_NULL_RETURN_VAL(priv, false);
8480 EINA_SAFETY_ON_NULL_RETURN_VAL(cr, false);
8481 EINA_SAFETY_ON_NULL_RETURN_VAL(area, false);
8483 if (priv->recordingSurfaceSetState == RECORDING_SURFACE_SET_STATE_COMPLETE)
8484 return ewk_recording_surface_set_tiled_replay(priv->recordingSurfaceSetList, cr, area);
8489 void ewk_view_recording_surface_set_base_if_needed(Evas_Object* ewkView)
8491 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
8492 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
8494 if (priv->callOnceAfterLoadFinished && !priv->recordingSurfaceSetLoadFinished) {
8495 float zoom = ewk_view_zoom_get(ewkView);
8497 priv->recordingSurfaceSetState = RECORDING_SURFACE_SET_STATE_INIT;
8498 priv->recordingSurfaceSetList = ewk_recording_surface_set_free(priv->recordingSurfaceSetList);
8499 priv->recordingSurfaceSetList = ewk_recording_surface_set_base_record(priv->recordingSurfaceSetList, ewkView, zoom);
8500 priv->recordingSurfaceSetState = RECORDING_SURFACE_SET_STATE_COMPLETE;
8501 priv->recordingSurfaceSetLoadFinished = true;
8503 priv->callOnceAfterLoadFinished = false;
8507 unsigned int ewk_view_inspector_server_start(unsigned int port)
8509 #if ENABLE(TIZEN_REMOTE_WEB_INSPECTOR)
8510 Eina_Bool ret = WebCore::InspectorServerEfl::server()->startServer(port);
8512 return WebCore::InspectorServerEfl::server()->getServerPort();
8516 LOG_ERROR("TIZEN_REMOTE_WEB_INSPECTOR is disabled.\n");
8521 Eina_Bool ewk_view_inspector_server_stop()
8523 #if ENABLE(TIZEN_REMOTE_WEB_INSPECTOR)
8524 return WebCore::InspectorServerEfl::server()->stopServer();
8526 LOG_ERROR("TIZEN_REMOTE_WEB_INSPECTOR is disabled.\n");
8531 #if ENABLE(NOTIFICATIONS)
8532 #if ENABLE(TIZEN_NOTIFICATION)
8533 WebCore::NotificationClient* ewk_view_notification_presenter_get(const Evas_Object* ewkView)
8535 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
8536 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0);
8537 return WebCore::NotificationController::from(priv->page.get())->client();
8540 void ewk_view_notification_show(Evas_Object* ewkView, WebCore::Notification* notification)
8542 char* iconUrl = strdup(notification->iconURL().string().utf8().data());
8543 char* title = strdup(notification->title().utf8().data());
8544 char* body = strdup(notification->body().utf8().data());
8545 Ewk_Notification ewk_notification = { static_cast<void*>(notification), iconUrl, title, body, 0 };
8547 evas_object_smart_callback_call(ewkView, "notification,contents,show", (void*)&ewk_notification);
8554 void ewk_view_notification_html_show(Evas_Object* ewkView, WebCore::Notification* notification)
8556 char* url = strdup(notification->url().string().utf8().data());
8557 Ewk_Notification ewk_notification = { static_cast<void*>(notification), 0, 0, 0, url };
8559 evas_object_smart_callback_call(ewkView, "notification,contents,htmlshow", (void*)&ewk_notification);
8564 void ewk_view_notification_cancel(Evas_Object* ewkView, WebCore::Notification* notification)
8566 Ewk_Notification ewk_notification = { static_cast<void*>(notification), 0, 0, 0, 0 };
8568 evas_object_smart_callback_call(ewkView, "notification,contents,cancel", (void*)&ewk_notification);
8571 void ewk_view_notification_request_permission(Evas_Object* ewkView, const char* domain)
8573 evas_object_smart_callback_call(ewkView, "notification,contents,requestPermission", (void*)domain);
8577 void ewk_view_notification_displayed(const Evas_Object* ewkView, const Ewk_Notification* ewkNotification)
8579 #if ENABLE(TIZEN_NOTIFICATION)
8580 if (!ewkNotification)
8582 EWK_VIEW_SD_GET(ewkView, smartData);
8583 EWK_VIEW_PRIV_GET(smartData, priv);
8584 static_cast<WebCore::NotificationClientEfl*>(WebCore::NotificationController::from(priv->page.get())->client())->notificationDisplayed(static_cast<WebCore::Notification*>(ewkNotification->notification));
8588 void ewk_view_notification_clicked(const Evas_Object* ewkView, const Ewk_Notification* ewkNotification)
8590 #if ENABLE(TIZEN_NOTIFICATION)
8591 EWK_VIEW_SD_GET(ewkView, smartData);
8592 EWK_VIEW_PRIV_GET(smartData, priv);
8593 static_cast<WebCore::NotificationClientEfl*>(WebCore::NotificationController::from(priv->page.get())->client())->notificationClicked(static_cast<WebCore::Notification*>(ewkNotification->notification));
8597 void ewk_view_notification_closed(const Evas_Object* ewkView, const Ewk_Notification* ewkNotification)
8599 #if ENABLE(TIZEN_NOTIFICATION)
8600 EWK_VIEW_SD_GET(ewkView, smartData);
8601 EWK_VIEW_PRIV_GET(smartData, priv);
8602 static_cast<WebCore::NotificationClientEfl*>(WebCore::NotificationController::from(priv->page.get())->client())->notificationClosed(static_cast<WebCore::Notification*>(ewkNotification->notification));
8606 void ewk_view_notification_error(const Evas_Object* ewkView, const Ewk_Notification* ewkNotification)
8608 #if ENABLE(TIZEN_NOTIFICATION)
8609 EWK_VIEW_SD_GET(ewkView, smartData);
8610 EWK_VIEW_PRIV_GET(smartData, priv);
8611 static_cast<WebCore::NotificationClientEfl*>(WebCore::NotificationController::from(priv->page.get())->client())->notificationError(static_cast<WebCore::Notification*>(ewkNotification->notification));
8615 void ewk_view_notification_permission_callback(const Evas_Object* ewkView, Eina_Bool permit, const char* domain)
8617 #if ENABLE(TIZEN_NOTIFICATION)
8621 EWK_VIEW_SD_GET(ewkView, smartData);
8622 EWK_VIEW_PRIV_GET(smartData, priv);
8623 static_cast<WebCore::NotificationClientEfl*>(WebCore::NotificationController::from(priv->page.get())->client())->permittedCallbackCall(domain);
8627 void ewk_view_notification_allowed_set(const Evas_Object* ewkView, Eina_Bool permit, const char* domain)
8629 #if ENABLE(TIZEN_NOTIFICATION)
8630 if (!permit || !domain)
8633 EWK_VIEW_SD_GET(ewkView, smartData);
8634 EWK_VIEW_PRIV_GET(smartData, priv);
8635 static_cast<WebCore::NotificationClientEfl*>(WebCore::NotificationController::from(priv->page.get())->client())->permittedCallbackCall(domain);
8640 void ewk_view_notification_add_permitted_domains(const Evas_Object* ewkView, char** domains, int size)
8642 #if ENABLE(TIZEN_NOTIFICATION)
8643 EWK_VIEW_SD_GET(ewkView, smartData);
8644 EWK_VIEW_PRIV_GET(smartData, priv);
8645 static_cast<WebCore::NotificationClientEfl*>(WebCore::NotificationController::from(priv->page.get())->client())->makePermissionCache(domains, size);
8650 void ewk_view_orientation_feed(Evas_Object* ewkView, Ewk_Screen_Orientation orientation)
8652 #if ENABLE(TIZEN_ORIENTATION_EVENTS)
8653 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
8654 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
8656 if (priv->orientation == orientation)
8659 priv->orientation = orientation;
8661 //FIXME: This assume that default orientation of device is portrait.
8662 // landscape device is also considered.
8663 int newOrientation = 0;
8664 switch (orientation) {
8665 case EWK_PORTRAIT_PRIMARY:
8668 case EWK_PORTRAIT_SECONDARY:
8669 newOrientation = 180;
8671 case EWK_LANDSCAPE_PRIMARY:
8672 newOrientation = 90;
8674 case EWK_LANDSCAPE_SECONDARY:
8675 newOrientation = -90;
8678 if (priv->mainFrame->orientation() == newOrientation)
8681 priv->mainFrame->sendOrientationChangeEvent(newOrientation);
8682 for (WebCore::Frame* child = priv->mainFrame->tree()->firstChild(); child; child = child->tree()->nextSibling())
8683 child->sendOrientationChangeEvent(newOrientation);
8687 Eina_Bool ewk_view_webapp_capable_get(const Evas_Object *ewkView)
8689 #if ENABLE(TIZEN_SUPPORT_WEBAPP_META_TAG)
8690 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
8691 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0);
8693 if (!priv->mainFrame || !priv->mainFrame->document())
8696 RefPtr<WebCore::NodeList> nodeList = priv->mainFrame->document()->getElementsByTagName("meta");
8697 for (unsigned i = 0; i < nodeList->length(); i++) {
8698 WebCore::HTMLMetaElement* metaElement = static_cast<WebCore::HTMLMetaElement*>(nodeList->item(i));
8699 if (metaElement->name() == "apple-mobile-web-app-capable")
8700 return metaElement->content() == "yes" ? true : false;
8706 char* ewk_view_webapp_icon_get(const Evas_Object *ewkView)
8708 #if ENABLE(TIZEN_SUPPORT_WEBAPP_META_TAG)
8709 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
8710 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0);
8712 if (!priv->mainFrame || !priv->mainFrame->document())
8715 RefPtr<WebCore::NodeList> nodeList = priv->mainFrame->document()->getElementsByTagName("link");
8716 for (unsigned i = 0; i < nodeList->length(); i++) {
8717 WebCore::HTMLLinkElement* linkElement = static_cast<WebCore::HTMLLinkElement*>(nodeList->item(i));
8718 if (linkElement->rel() == "apple-touch-icon" || linkElement->rel() == "apple-touch-icon-precomposed")
8719 return strdup(linkElement->href().string().utf8().data());
8725 #if USE(ACCELERATED_COMPOSITING)
8726 bool ewk_view_accelerated_compositing_object_create(Evas_Object* ewkView, Evas_Native_Surface* nativeSurface, const WebCore::IntRect& rect)
8732 WebCore::GraphicsContext3D* ewk_view_accelerated_compositing_context_get(Evas_Object* ewkView)
8734 EWK_VIEW_SD_GET(ewkView, smartData);
8735 EWK_VIEW_PRIV_GET(smartData, priv);
8737 ewk_view_compositor_create(ewkView);
8739 return (priv->compositor ? priv->compositor->context() : 0);
8743 Eina_Bool ewk_view_setting_web_audio_get(const Evas_Object* ewkView)
8745 #if ENABLE(WEB_AUDIO)
8746 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
8747 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
8748 return priv->settings.webAudio;
8754 Eina_Bool ewk_view_setting_web_audio_set(Evas_Object* ewkView, Eina_Bool enable)
8756 #if ENABLE(WEB_AUDIO)
8757 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
8758 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
8759 if (priv->settings.webAudio != enable) {
8760 priv->pageSettings->setWebAudioEnabled(enable);
8761 priv->settings.webAudio = enable;
8769 void ewk_view_cursor_set(Evas_Object* ewkView, const WebCore::Cursor& cursor)
8771 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
8772 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
8774 const char* group = cursor.platformCursor();
8775 if (!group || group == priv->cursorGroup)
8778 priv->cursorGroup = group;
8780 if (priv->cursorObject)
8781 evas_object_del(priv->cursorObject);
8782 priv->cursorObject = edje_object_add(smartData->base.evas);
8784 Ecore_Evas* ecoreEvas = ecore_evas_ecore_evas_get(smartData->base.evas);
8785 if (!priv->settings.theme || !edje_object_file_set(priv->cursorObject, priv->settings.theme, group)) {
8786 evas_object_del(priv->cursorObject);
8787 priv->cursorObject = 0;
8789 ecore_evas_object_cursor_set(ecoreEvas, 0, 0, 0, 0);
8791 if (priv->isUsingEcoreX)
8792 WebCore::applyFallbackCursor(ecoreEvas, group);
8795 Evas_Coord width, height;
8796 edje_object_size_min_get(priv->cursorObject, &width, &height);
8797 if (width <= 0 || height <= 0)
8798 edje_object_size_min_calc(priv->cursorObject, &width, &height);
8799 if (width <= 0 || height <= 0) {
8803 evas_object_resize(priv->cursorObject, width, height);
8807 data = edje_object_data_get(priv->cursorObject, "hot.x");
8809 hotspotX = atoi(data);
8812 data = edje_object_data_get(priv->cursorObject, "hot.y");
8814 hotspotY = atoi(data);
8816 ecore_evas_object_cursor_set(ecoreEvas, priv->cursorObject, EVAS_LAYER_MAX, hotspotX, hotspotY);
8820 namespace EWKPrivate {
8822 WebCore::Page* corePage(const Evas_Object* ewkView)
8824 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
8825 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0);
8826 return priv->page.get();
8829 PlatformPageClient corePageClient(Evas_Object* ewkView)
8831 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
8832 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0);
8833 return priv->pageClient.get();
8836 } // namespace EWKPrivate