7db2689f1a258be91e1e58dee3ca87c3b9754a6e
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / web-view / web-view-impl.cpp
1 /*
2  * Copyright (c) 2021 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 // CLASS HEADER
19 #include "web-view-impl.h"
20
21 // EXTERNAL INCLUDES
22 #include <dali/devel-api/adaptor-framework/web-engine-back-forward-list.h>
23 #include <dali/devel-api/adaptor-framework/web-engine-console-message.h>
24 #include <dali/devel-api/adaptor-framework/web-engine-context.h>
25 #include <dali/devel-api/adaptor-framework/web-engine-cookie-manager.h>
26 #include <dali/devel-api/adaptor-framework/web-engine-form-repost-decision.h>
27 #include <dali/devel-api/adaptor-framework/web-engine-request-interceptor.h>
28 #include <dali/devel-api/adaptor-framework/web-engine-load-error.h>
29 #include <dali/devel-api/adaptor-framework/web-engine-policy-decision.h>
30 #include <dali/devel-api/adaptor-framework/web-engine-settings.h>
31 #include <dali/devel-api/common/stage.h>
32 #include <dali/devel-api/scripting/enum-helper.h>
33 #include <dali/devel-api/scripting/scripting.h>
34 #include <dali/public-api/adaptor-framework/native-image-source.h>
35 #include <dali/public-api/object/type-registry-helper.h>
36 #include <dali/public-api/object/type-registry.h>
37 #include <cstring>
38 #include <memory>
39
40 // INTERNAL INCLUDES
41 #include <dali-toolkit/devel-api/controls/control-devel.h>
42 #include <dali-toolkit/devel-api/controls/web-view/web-back-forward-list.h>
43 #include <dali-toolkit/devel-api/controls/web-view/web-context.h>
44 #include <dali-toolkit/devel-api/controls/web-view/web-cookie-manager.h>
45 #include <dali-toolkit/devel-api/controls/web-view/web-form-repost-decision.h>
46 #include <dali-toolkit/devel-api/controls/web-view/web-settings.h>
47 #include <dali-toolkit/devel-api/image-loader/texture-manager.h>
48 #include <dali-toolkit/internal/visuals/visual-factory-impl.h>
49 #include <dali-toolkit/public-api/image-loader/image.h>
50 #include <dali-toolkit/public-api/visuals/image-visual-properties.h>
51
52 namespace Dali
53 {
54 namespace Toolkit
55 {
56 namespace Internal
57 {
58 namespace
59 {
60 BaseHandle Create()
61 {
62   return Toolkit::WebView::New();
63 }
64
65 // clang-format off
66 DALI_TYPE_REGISTRATION_BEGIN(Toolkit::WebView, Toolkit::Control, Create)
67
68 DALI_PROPERTY_REGISTRATION(Toolkit, WebView, "url",                     STRING,  URL                       )
69 DALI_PROPERTY_REGISTRATION(Toolkit, WebView, "userAgent",               STRING,  USER_AGENT                )
70 DALI_PROPERTY_REGISTRATION(Toolkit, WebView, "scrollPosition",          VECTOR2, SCROLL_POSITION           )
71 DALI_PROPERTY_REGISTRATION(Toolkit, WebView, "scrollSize",              VECTOR2, SCROLL_SIZE               )
72 DALI_PROPERTY_REGISTRATION(Toolkit, WebView, "contentSize",             VECTOR2, CONTENT_SIZE              )
73 DALI_PROPERTY_REGISTRATION(Toolkit, WebView, "title",                   STRING,  TITLE                     )
74 DALI_PROPERTY_REGISTRATION(Toolkit, WebView, "videoHoleEnabled",        BOOLEAN, VIDEO_HOLE_ENABLED        )
75 DALI_PROPERTY_REGISTRATION(Toolkit, WebView, "mouseEventsEnabled",      BOOLEAN, MOUSE_EVENTS_ENABLED      )
76 DALI_PROPERTY_REGISTRATION(Toolkit, WebView, "keyEventsEnabled",        BOOLEAN, KEY_EVENTS_ENABLED        )
77 DALI_PROPERTY_REGISTRATION(Toolkit, WebView, "documentBackgroundColor", VECTOR4, DOCUMENT_BACKGROUND_COLOR )
78 DALI_PROPERTY_REGISTRATION(Toolkit, WebView, "tilesClearedWhenHidden",  BOOLEAN, TILES_CLEARED_WHEN_HIDDEN )
79 DALI_PROPERTY_REGISTRATION(Toolkit, WebView, "tileCoverAreaMultiplier", FLOAT,   TILE_COVER_AREA_MULTIPLIER)
80 DALI_PROPERTY_REGISTRATION(Toolkit, WebView, "cursorEnabledByClient",   BOOLEAN, CURSOR_ENABLED_BY_CLIENT  )
81 DALI_PROPERTY_REGISTRATION(Toolkit, WebView, "selectedText",            STRING,  SELECTED_TEXT             )
82 DALI_PROPERTY_REGISTRATION(Toolkit, WebView, "pageZoomFactor",          FLOAT,   PAGE_ZOOM_FACTOR          )
83 DALI_PROPERTY_REGISTRATION(Toolkit, WebView, "textZoomFactor",          FLOAT,   TEXT_ZOOM_FACTOR          )
84 DALI_PROPERTY_REGISTRATION(Toolkit, WebView, "loadProgressPercentage",  FLOAT,   LOAD_PROGRESS_PERCENTAGE  )
85
86 DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "pageLoadStarted",    PAGE_LOAD_STARTED_SIGNAL    )
87 DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "pageLoadInProgress", PAGE_LOAD_IN_PROGRESS_SIGNAL)
88 DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "pageLoadFinished",   PAGE_LOAD_FINISHED_SIGNAL   )
89 DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "pageLoadError",      PAGE_LOAD_ERROR_SIGNAL      )
90 DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "scrollEdgeReached",  SCROLL_EDGE_REACHED_SIGNAL  )
91 DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "urlChanged",         URL_CHANGED_SIGNAL          )
92 DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "formRepostDecision", FORM_REPOST_DECISION_SIGNAL )
93 DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "frameRendered",      FRAME_RENDERED_SIGNAL       )
94 DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "requestInterceptor", REQUEST_INTERCEPTOR_SIGNAL  )
95 DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "consoleMessage",     CONSOLE_MESSAGE_SIGNAL      )
96 DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "policyDecision",     POLICY_DECISION             )
97
98 DALI_TYPE_REGISTRATION_END()
99 // clang-format on
100
101 const std::string kEmptyString;
102
103 } // namespace
104
105 #define GET_ENUM_STRING(structName, inputExp) \
106   Scripting::GetLinearEnumerationName<Toolkit::WebView::structName::Type>(static_cast<Toolkit::WebView::structName::Type>(inputExp), structName##_TABLE, structName##_TABLE_COUNT)
107
108 #define GET_ENUM_VALUE(structName, inputExp, outputExp) \
109   Scripting::GetEnumerationProperty<Toolkit::WebView::structName::Type>(inputExp, structName##_TABLE, structName##_TABLE_COUNT, outputExp)
110
111 WebView::WebView(const std::string& locale, const std::string& timezoneId)
112 : Control(ControlBehaviour(ACTOR_BEHAVIOUR_DEFAULT | DISABLE_STYLE_CHANGE_SIGNALS)),
113   mUrl(),
114   mVisual(),
115   mWebViewSize(Stage::GetCurrent().GetSize()),
116   mWebEngine(),
117   mPageLoadStartedSignal(),
118   mPageLoadFinishedSignal(),
119   mPageLoadErrorSignal(),
120   mUrlChangedSignal(),
121   mWebViewArea(0, 0, mWebViewSize.width, mWebViewSize.height),
122   mVideoHoleEnabled(true),
123   mMouseEventsEnabled(true),
124   mKeyEventsEnabled(true)
125 {
126   mWebEngine = Dali::WebEngine::New();
127
128   // WebEngine is empty when it is not properly initialized.
129   if(mWebEngine)
130   {
131     mWebEngine.Create(mWebViewSize.width, mWebViewSize.height, locale, timezoneId);
132   }
133 }
134
135 WebView::WebView(int argc, char** argv)
136 : Control(ControlBehaviour(ACTOR_BEHAVIOUR_DEFAULT | DISABLE_STYLE_CHANGE_SIGNALS)),
137   mUrl(),
138   mVisual(),
139   mWebViewSize(Stage::GetCurrent().GetSize()),
140   mWebEngine(),
141   mPageLoadStartedSignal(),
142   mPageLoadFinishedSignal(),
143   mPageLoadErrorSignal(),
144   mUrlChangedSignal(),
145   mWebViewArea(0, 0, mWebViewSize.width, mWebViewSize.height),
146   mVideoHoleEnabled(true),
147   mMouseEventsEnabled(true),
148   mKeyEventsEnabled(true)
149 {
150   mWebEngine = Dali::WebEngine::New();
151
152   // WebEngine is empty when it is not properly initialized.
153   if(mWebEngine)
154   {
155     mWebEngine.Create(mWebViewSize.width, mWebViewSize.height, argc, argv);
156   }
157 }
158
159 WebView::WebView()
160 : WebView("", "")
161 {
162 }
163
164 WebView::~WebView()
165 {
166   if(mWebEngine)
167   {
168     mWebEngine.Destroy();
169   }
170 }
171
172 Toolkit::WebView WebView::New()
173 {
174   WebView*         impl   = new WebView();
175   Toolkit::WebView handle = Toolkit::WebView(*impl);
176
177   impl->Initialize();
178   return handle;
179 }
180
181 Toolkit::WebView WebView::New(const std::string& locale, const std::string& timezoneId)
182 {
183   WebView*         impl   = new WebView(locale, timezoneId);
184   Toolkit::WebView handle = Toolkit::WebView(*impl);
185
186   impl->Initialize();
187   return handle;
188 }
189
190 Toolkit::WebView WebView::New(int argc, char** argv)
191 {
192   WebView*         impl   = new WebView(argc, argv);
193   Toolkit::WebView handle = Toolkit::WebView(*impl);
194
195   impl->Initialize();
196   return handle;
197 }
198
199 void WebView::OnInitialize()
200 {
201   Actor self = Self();
202
203   self.SetProperty(Actor::Property::KEYBOARD_FOCUSABLE, true);
204   self.TouchedSignal().Connect(this, &WebView::OnTouchEvent);
205   self.HoveredSignal().Connect(this, &WebView::OnHoverEvent);
206   self.WheelEventSignal().Connect(this, &WebView::OnWheelEvent);
207   Dali::DevelActor::VisibilityChangedSignal(self).Connect(this, &WebView::OnVisibilityChanged);
208
209   mPositionUpdateNotification = self.AddPropertyNotification(Actor::Property::WORLD_POSITION, StepCondition(1.0f, 1.0f));
210   mSizeUpdateNotification     = self.AddPropertyNotification(Actor::Property::SIZE, StepCondition(1.0f, 1.0f));
211   mScaleUpdateNotification    = self.AddPropertyNotification(Actor::Property::WORLD_SCALE, StepCondition(0.1f, 1.0f));
212   mPositionUpdateNotification.NotifySignal().Connect(this, &WebView::UpdateDisplayArea);
213   mSizeUpdateNotification.NotifySignal().Connect(this, &WebView::UpdateDisplayArea);
214   mScaleUpdateNotification.NotifySignal().Connect(this, &WebView::UpdateDisplayArea);
215
216   if(mWebEngine)
217   {
218     mWebEngine.PageLoadStartedSignal().Connect(this, &WebView::OnPageLoadStarted);
219     mWebEngine.PageLoadInProgressSignal().Connect(this, &WebView::OnPageLoadInProgress);
220     mWebEngine.PageLoadFinishedSignal().Connect(this, &WebView::OnPageLoadFinished);
221     mWebEngine.PageLoadErrorSignal().Connect(this, &WebView::OnPageLoadError);
222     mWebEngine.ScrollEdgeReachedSignal().Connect(this, &WebView::OnScrollEdgeReached);
223     mWebEngine.UrlChangedSignal().Connect(this, &WebView::OnUrlChanged);
224     mWebEngine.FormRepostDecisionSignal().Connect(this, &WebView::OnFormRepostDecision);
225     mWebEngine.FrameRenderedSignal().Connect(this, &WebView::OnFrameRendered);
226     mWebEngine.RequestInterceptorSignal().Connect(this, &WebView::OnInterceptRequest);
227     mWebEngine.ConsoleMessageSignal().Connect(this, &WebView::OnConsoleMessage);
228     mWebEngine.PolicyDecisionSignal().Connect(this, &WebView::OnPolicyDecisionRequest);
229
230     mWebContext         = std::unique_ptr<Dali::Toolkit::WebContext>(new WebContext(mWebEngine.GetContext()));
231     mWebCookieManager   = std::unique_ptr<Dali::Toolkit::WebCookieManager>(new WebCookieManager(mWebEngine.GetCookieManager()));
232     mWebSettings        = std::unique_ptr<Dali::Toolkit::WebSettings>(new WebSettings(mWebEngine.GetSettings()));
233     mWebBackForwardList = std::unique_ptr<Dali::Toolkit::WebBackForwardList>(new WebBackForwardList(mWebEngine.GetBackForwardList()));
234   }
235 }
236
237 Dali::Toolkit::WebSettings* WebView::GetSettings() const
238 {
239   return mWebSettings.get();
240 }
241
242 Dali::Toolkit::WebContext* WebView::GetContext() const
243 {
244   return mWebContext.get();
245 }
246
247 Dali::Toolkit::WebCookieManager* WebView::GetCookieManager() const
248 {
249   return mWebCookieManager.get();
250 }
251
252 Dali::Toolkit::WebBackForwardList* WebView::GetBackForwardList() const
253 {
254   return mWebBackForwardList.get();
255 }
256
257 Dali::Toolkit::ImageView& WebView::GetFavicon()
258 {
259   if(mWebEngine)
260   {
261     Dali::PixelData pixelData = mWebEngine.GetFavicon();
262     mFaviconView              = CreateImageView(pixelData);
263   }
264   return mFaviconView;
265 }
266
267 void WebView::LoadUrl(const std::string& url)
268 {
269   mUrl = url;
270   if(mWebEngine)
271   {
272     Texture           texture        = Dali::Texture::New(*mWebEngine.GetNativeImageSource());
273     const std::string nativeImageUrl = Dali::Toolkit::TextureManager::AddTexture(texture);
274     mVisual                          = Toolkit::VisualFactory::Get().CreateVisual(
275       {{Toolkit::Visual::Property::TYPE, Toolkit::Visual::IMAGE},
276        {Toolkit::ImageVisual::Property::URL, nativeImageUrl}});
277
278     if(mVisual)
279     {
280       // Clean up previously registered visual and add new one.
281       DevelControl::RegisterVisual(*this, Toolkit::WebView::Property::URL, mVisual);
282       mWebEngine.LoadUrl(url);
283     }
284
285     if(mVideoHoleEnabled)
286     {
287       EnableBlendMode(false);
288     }
289   }
290 }
291
292 void WebView::LoadHtmlString(const std::string& htmlString)
293 {
294   if(mWebEngine)
295   {
296     Texture           texture        = Dali::Texture::New(*mWebEngine.GetNativeImageSource());
297     const std::string nativeImageUrl = Dali::Toolkit::TextureManager::AddTexture(texture);
298     mVisual                          = Toolkit::VisualFactory::Get().CreateVisual(
299       {{Toolkit::Visual::Property::TYPE, Toolkit::Visual::IMAGE},
300        {Toolkit::ImageVisual::Property::URL, nativeImageUrl}});
301
302     if(mVisual)
303     {
304       DevelControl::RegisterVisual(*this, Toolkit::WebView::Property::URL, mVisual);
305       mWebEngine.LoadHtmlString(htmlString);
306     }
307
308     if(mVideoHoleEnabled)
309     {
310       EnableBlendMode(false);
311     }
312   }
313 }
314
315 bool WebView::LoadHtmlStringOverrideCurrentEntry(const std::string& html, const std::string& basicUri, const std::string& unreachableUrl)
316 {
317   if(!mWebEngine)
318     return false;
319
320   Texture           texture        = Dali::Texture::New(*mWebEngine.GetNativeImageSource());
321   const std::string nativeImageUrl = Dali::Toolkit::TextureManager::AddTexture(texture);
322   mVisual                          = Toolkit::VisualFactory::Get().CreateVisual(
323     {{Toolkit::Visual::Property::TYPE, Toolkit::Visual::IMAGE},
324      {Toolkit::ImageVisual::Property::URL, nativeImageUrl}});
325
326   bool result = false;
327   if(mVisual)
328   {
329     DevelControl::RegisterVisual(*this, Toolkit::WebView::Property::URL, mVisual);
330     result = mWebEngine.LoadHtmlStringOverrideCurrentEntry(html, basicUri, unreachableUrl);
331   }
332
333   if(mVideoHoleEnabled)
334   {
335     EnableBlendMode(false);
336   }
337   return result;
338 }
339
340 bool WebView::LoadContents(const std::string& contents, uint32_t contentSize, const std::string& mimeType, const std::string& encoding, const std::string& baseUri)
341 {
342   if(!mWebEngine)
343     return false;
344
345   Texture           texture        = Dali::Texture::New(*mWebEngine.GetNativeImageSource());
346   const std::string nativeImageUrl = Dali::Toolkit::TextureManager::AddTexture(texture);
347   mVisual                          = Toolkit::VisualFactory::Get().CreateVisual(
348     {{Toolkit::Visual::Property::TYPE, Toolkit::Visual::IMAGE},
349      {Toolkit::ImageVisual::Property::URL, nativeImageUrl}});
350
351   bool result = false;
352   if(mVisual)
353   {
354     DevelControl::RegisterVisual(*this, Toolkit::WebView::Property::URL, mVisual);
355     result = mWebEngine.LoadContents(contents, contentSize, mimeType, encoding, baseUri);
356   }
357
358   if(mVideoHoleEnabled)
359   {
360     EnableBlendMode(false);
361   }
362   return result;
363 }
364
365 void WebView::Reload()
366 {
367   if(mWebEngine)
368   {
369     mWebEngine.Reload();
370   }
371 }
372
373 bool WebView::ReloadWithoutCache()
374 {
375   return mWebEngine ? mWebEngine.ReloadWithoutCache() : false;
376 }
377
378 void WebView::StopLoading()
379 {
380   if(mWebEngine)
381   {
382     mWebEngine.StopLoading();
383   }
384 }
385
386 void WebView::Suspend()
387 {
388   if(mWebEngine)
389   {
390     mWebEngine.Suspend();
391   }
392 }
393
394 void WebView::Resume()
395 {
396   if(mWebEngine)
397   {
398     mWebEngine.Resume();
399   }
400 }
401
402 void WebView::SuspendNetworkLoading()
403 {
404   if(mWebEngine)
405   {
406     mWebEngine.SuspendNetworkLoading();
407   }
408 }
409
410 void WebView::ResumeNetworkLoading()
411 {
412   if(mWebEngine)
413   {
414     mWebEngine.ResumeNetworkLoading();
415   }
416 }
417
418 bool WebView::AddCustomHeader(const std::string& name, const std::string& value)
419 {
420   return mWebEngine ? mWebEngine.AddCustomHeader(name, value) : false;
421 }
422
423 bool WebView::RemoveCustomHeader(const std::string& name)
424 {
425   return mWebEngine ? mWebEngine.RemoveCustomHeader(name) : false;
426 }
427
428 uint32_t WebView::StartInspectorServer(uint32_t port)
429 {
430   return mWebEngine ? mWebEngine.StartInspectorServer(port) : false;
431 }
432
433 bool WebView::StopInspectorServer()
434 {
435   return mWebEngine ? mWebEngine.StopInspectorServer() : false;
436 }
437
438 void WebView::ScrollBy(int deltaX, int deltaY)
439 {
440   if(mWebEngine)
441   {
442     mWebEngine.ScrollBy(deltaX, deltaY);
443   }
444 }
445
446 bool WebView::ScrollEdgeBy(int deltaX, int deltaY)
447 {
448   return mWebEngine ? mWebEngine.ScrollEdgeBy(deltaX, deltaY) : false;
449 }
450
451 bool WebView::CanGoForward()
452 {
453   return mWebEngine ? mWebEngine.CanGoForward() : false;
454 }
455
456 void WebView::GoForward()
457 {
458   if(mWebEngine)
459   {
460     mWebEngine.GoForward();
461   }
462 }
463
464 bool WebView::CanGoBack()
465 {
466   return mWebEngine ? mWebEngine.CanGoBack() : false;
467 }
468
469 void WebView::GoBack()
470 {
471   if(mWebEngine)
472   {
473     mWebEngine.GoBack();
474   }
475 }
476
477 void WebView::EvaluateJavaScript(const std::string& script, std::function<void(const std::string&)> resultHandler)
478 {
479   if(mWebEngine)
480   {
481     mWebEngine.EvaluateJavaScript(script, resultHandler);
482   }
483 }
484
485 void WebView::AddJavaScriptMessageHandler(const std::string& exposedObjectName, std::function<void(const std::string&)> handler)
486 {
487   if(mWebEngine)
488   {
489     mWebEngine.AddJavaScriptMessageHandler(exposedObjectName, handler);
490   }
491 }
492
493 void WebView::RegisterJavaScriptAlertCallback(Dali::WebEnginePlugin::JavaScriptAlertCallback callback)
494 {
495   if(mWebEngine)
496   {
497     mWebEngine.RegisterJavaScriptAlertCallback(callback);
498   }
499 }
500
501 void WebView::JavaScriptAlertReply()
502 {
503   if(mWebEngine)
504   {
505     mWebEngine.JavaScriptAlertReply();
506   }
507 }
508
509 void WebView::RegisterJavaScriptConfirmCallback(Dali::WebEnginePlugin::JavaScriptConfirmCallback callback)
510 {
511   if(mWebEngine)
512   {
513     mWebEngine.RegisterJavaScriptConfirmCallback(callback);
514   }
515 }
516
517 void WebView::JavaScriptConfirmReply(bool confirmed)
518 {
519   if(mWebEngine)
520   {
521     mWebEngine.JavaScriptConfirmReply(confirmed);
522   }
523 }
524
525 void WebView::RegisterJavaScriptPromptCallback(Dali::WebEnginePlugin::JavaScriptPromptCallback callback)
526 {
527   if(mWebEngine)
528   {
529     mWebEngine.RegisterJavaScriptPromptCallback(callback);
530   }
531 }
532
533 void WebView::JavaScriptPromptReply(const std::string& result)
534 {
535   if(mWebEngine)
536   {
537     mWebEngine.JavaScriptPromptReply(result);
538   }
539 }
540
541 void WebView::ClearHistory()
542 {
543   if(mWebEngine)
544   {
545     mWebEngine.ClearHistory();
546   }
547 }
548
549 void WebView::ClearAllTilesResources()
550 {
551   if(mWebEngine)
552   {
553     mWebEngine.ClearAllTilesResources();
554   }
555 }
556
557 void WebView::SetScaleFactor(float scaleFactor, Dali::Vector2 point)
558 {
559   if(mWebEngine)
560   {
561     mWebEngine.SetScaleFactor(scaleFactor, point);
562   }
563 }
564
565 float WebView::GetScaleFactor() const
566 {
567   return mWebEngine ? mWebEngine.GetScaleFactor() : 0.0f;
568 }
569
570 void WebView::ActivateAccessibility(bool activated)
571 {
572   if(mWebEngine)
573   {
574     mWebEngine.ActivateAccessibility(activated);
575   }
576 }
577
578 bool WebView::HighlightText(const std::string& text, Dali::WebEnginePlugin::FindOption options, uint32_t maxMatchCount)
579 {
580   return mWebEngine ? mWebEngine.HighlightText(text, options, maxMatchCount) : false;
581 }
582
583 void WebView::AddDynamicCertificatePath(const std::string& host, const std::string& certPath)
584 {
585   if(mWebEngine)
586   {
587     mWebEngine.AddDynamicCertificatePath(host, certPath);
588   }
589 }
590
591 Dali::Toolkit::ImageView WebView::GetScreenshot(Dali::Rect<int> viewArea, float scaleFactor)
592 {
593   Dali::Toolkit::ImageView imageView;
594   if(mWebEngine)
595   {
596     Dali::PixelData pixelData = mWebEngine.GetScreenshot(viewArea, scaleFactor);
597     imageView                 = CreateImageView(pixelData);
598   }
599   return imageView;
600 }
601
602 bool WebView::GetScreenshotAsynchronously(Dali::Rect<int> viewArea, float scaleFactor, Dali::Toolkit::WebView::WebViewScreenshotCapturedCallback callback)
603 {
604   mScreenshotCapturedCallback = callback;
605   return mWebEngine ? mWebEngine.GetScreenshotAsynchronously(viewArea, scaleFactor, std::bind(&WebView::OnScreenshotCaptured, this, std::placeholders::_1)) : false;
606 }
607
608 bool WebView::CheckVideoPlayingAsynchronously(Dali::WebEnginePlugin::VideoPlayingCallback callback)
609 {
610   return mWebEngine ? mWebEngine.CheckVideoPlayingAsynchronously(callback) : false;
611 }
612
613 void WebView::RegisterGeolocationPermissionCallback(Dali::WebEnginePlugin::GeolocationPermissionCallback callback)
614 {
615   if(mWebEngine)
616   {
617     mWebEngine.RegisterGeolocationPermissionCallback(callback);
618   }
619 }
620
621 void WebView::UpdateDisplayArea(Dali::PropertyNotification& /*source*/)
622 {
623   if(!mWebEngine)
624     return;
625
626   Actor self(Self());
627
628   bool    positionUsesAnchorPoint = self.GetProperty<bool>(Actor::Property::POSITION_USES_ANCHOR_POINT);
629   Vector3 actorSize               = self.GetCurrentProperty<Vector3>(Actor::Property::SIZE) * self.GetCurrentProperty<Vector3>(Actor::Property::SCALE);
630   Vector3 anchorPointOffSet       = actorSize * (positionUsesAnchorPoint ? self.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT) : AnchorPoint::TOP_LEFT);
631   Vector2 screenPosition          = self.GetProperty<Vector2>(Actor::Property::SCREEN_POSITION);
632
633   Dali::Rect<int> displayArea;
634   displayArea.x      = screenPosition.x - anchorPointOffSet.x;
635   displayArea.y      = screenPosition.y - anchorPointOffSet.y;
636   displayArea.width  = actorSize.x;
637   displayArea.height = actorSize.y;
638
639   Size displaySize = Size(displayArea.width, displayArea.height);
640   if(mWebViewSize != displaySize)
641   {
642     mWebViewSize = displaySize;
643   }
644
645   if(mWebViewArea != displayArea)
646   {
647     mWebViewArea = displayArea;
648     mWebEngine.UpdateDisplayArea(mWebViewArea);
649   }
650 }
651
652 void WebView::EnableVideoHole(bool enabled)
653 {
654   mVideoHoleEnabled = enabled;
655
656   EnableBlendMode(!mVideoHoleEnabled);
657
658   if(mWebEngine)
659   {
660     mWebEngine.EnableVideoHole(mVideoHoleEnabled);
661   }
662 }
663
664 void WebView::EnableBlendMode(bool blendEnabled)
665 {
666   Actor self = Self();
667   for(uint32_t i = 0; i < self.GetRendererCount(); i++)
668   {
669     Dali::Renderer render = self.GetRendererAt(i);
670     render.SetProperty(Renderer::Property::BLEND_MODE, blendEnabled ? BlendMode::ON : BlendMode::OFF);
671   }
672 }
673
674 Dali::Toolkit::ImageView WebView::CreateImageView(Dali::PixelData pixel)
675 {
676   std::string              url       = Dali::Toolkit::Image::GenerateUrl(pixel);
677   Dali::Toolkit::ImageView imageView = Dali::Toolkit::ImageView::New(url);
678   imageView.SetProperty(Dali::Actor::Property::SIZE, Vector2(pixel.GetWidth(), pixel.GetHeight()));
679   return imageView;
680 }
681
682 Dali::Toolkit::WebView::WebViewPageLoadSignalType& WebView::PageLoadStartedSignal()
683 {
684   return mPageLoadStartedSignal;
685 }
686
687 Dali::Toolkit::WebView::WebViewPageLoadSignalType& WebView::PageLoadInProgressSignal()
688 {
689   return mPageLoadInProgressSignal;
690 }
691
692 Dali::Toolkit::WebView::WebViewPageLoadSignalType& WebView::PageLoadFinishedSignal()
693 {
694   return mPageLoadFinishedSignal;
695 }
696
697 Dali::Toolkit::WebView::WebViewPageLoadErrorSignalType& WebView::PageLoadErrorSignal()
698 {
699   return mPageLoadErrorSignal;
700 }
701
702 Dali::Toolkit::WebView::WebViewScrollEdgeReachedSignalType& WebView::ScrollEdgeReachedSignal()
703 {
704   return mScrollEdgeReachedSignal;
705 }
706
707 Dali::Toolkit::WebView::WebViewUrlChangedSignalType& WebView::UrlChangedSignal()
708 {
709   return mUrlChangedSignal;
710 }
711
712 Dali::Toolkit::WebView::WebViewFormRepostDecisionSignalType& WebView::FormRepostDecisionSignal()
713 {
714   return mFormRepostDecisionSignal;
715 }
716
717 Dali::Toolkit::WebView::WebViewFrameRenderedSignalType& WebView::FrameRenderedSignal()
718 {
719   return mFrameRenderedSignal;
720 }
721
722 Dali::Toolkit::WebView::WebViewRequestInterceptorSignalType& WebView::RequestInterceptorSignal()
723 {
724   return mRequestInterceptorSignal;
725 }
726
727 Dali::Toolkit::WebView::WebViewConsoleMessageSignalType& WebView::ConsoleMessageSignal()
728 {
729   return mConsoleMessageSignal;
730 }
731
732 Dali::Toolkit::WebView::WebViewPolicyDecisionSignalType& WebView::PolicyDecisionSignal()
733 {
734   return mPolicyDecisionSignal;
735 }
736
737 void WebView::OnPageLoadStarted(const std::string& url)
738 {
739   if(!mPageLoadStartedSignal.Empty())
740   {
741     Dali::Toolkit::WebView handle(GetOwner());
742     mPageLoadStartedSignal.Emit(handle, url);
743   }
744 }
745
746 void WebView::OnPageLoadInProgress(const std::string& url)
747 {
748   if(!mPageLoadInProgressSignal.Empty())
749   {
750     Dali::Toolkit::WebView handle(GetOwner());
751     mPageLoadInProgressSignal.Emit(handle, url);
752   }
753 }
754
755 void WebView::OnPageLoadFinished(const std::string& url)
756 {
757   if(!mPageLoadFinishedSignal.Empty())
758   {
759     Dali::Toolkit::WebView handle(GetOwner());
760     mPageLoadFinishedSignal.Emit(handle, url);
761   }
762 }
763
764 void WebView::OnPageLoadError(std::shared_ptr<Dali::WebEngineLoadError> error)
765 {
766   if(!mPageLoadErrorSignal.Empty())
767   {
768     Dali::Toolkit::WebView handle(GetOwner());
769     mPageLoadErrorSignal.Emit(handle, std::move(error));
770   }
771 }
772
773 void WebView::OnScrollEdgeReached(Dali::WebEnginePlugin::ScrollEdge edge)
774 {
775   if(!mScrollEdgeReachedSignal.Empty())
776   {
777     Dali::Toolkit::WebView handle(GetOwner());
778     mScrollEdgeReachedSignal.Emit(handle, edge);
779   }
780 }
781
782 void WebView::OnUrlChanged(const std::string& url)
783 {
784   if(!mUrlChangedSignal.Empty())
785   {
786     Dali::Toolkit::WebView handle(GetOwner());
787     mUrlChangedSignal.Emit(handle, url);
788   }
789 }
790
791 void WebView::OnFormRepostDecision(std::shared_ptr<Dali::WebEngineFormRepostDecision> decision)
792 {
793   if(!mFormRepostDecisionSignal.Empty())
794   {
795     Dali::Toolkit::WebView                                handle(GetOwner());
796     std::shared_ptr<Dali::Toolkit::WebFormRepostDecision> repostDecision(new Dali::Toolkit::WebFormRepostDecision(decision));
797     mFormRepostDecisionSignal.Emit(handle, std::move(repostDecision));
798   }
799 }
800
801 void WebView::OnFrameRendered()
802 {
803   if(!mFrameRenderedSignal.Empty())
804   {
805     Dali::Toolkit::WebView handle(GetOwner());
806     mFrameRenderedSignal.Emit(handle);
807   }
808 }
809
810 void WebView::OnVisibilityChanged(Actor actor, bool isVisible, Dali::DevelActor::VisibilityChange::Type type)
811 {
812   if(type == Dali::DevelActor::VisibilityChange::Type::SELF)
813   {
814     SetVisibility(isVisible);
815   }
816 }
817
818 void WebView::OnScreenshotCaptured(Dali::PixelData pixel)
819 {
820   if(mScreenshotCapturedCallback)
821   {
822     Dali::Toolkit::ImageView imageView = CreateImageView(pixel);
823     mScreenshotCapturedCallback(imageView);
824   }
825 }
826
827 void WebView::OnInterceptRequest(std::shared_ptr<Dali::WebEngineRequestInterceptor> interceptor)
828 {
829   if(!mRequestInterceptorSignal.Empty())
830   {
831     Dali::Toolkit::WebView handle(GetOwner());
832     mRequestInterceptorSignal.Emit(handle, std::move(interceptor));
833   }
834 }
835
836 void WebView::OnConsoleMessage(std::shared_ptr<Dali::WebEngineConsoleMessage> message)
837 {
838   if(!mConsoleMessageSignal.Empty())
839   {
840     Dali::Toolkit::WebView handle(GetOwner());
841     mConsoleMessageSignal.Emit(handle, std::move(message));
842   }
843 }
844
845 void WebView::OnPolicyDecisionRequest(std::shared_ptr<Dali::WebEnginePolicyDecision> decision)
846 {
847   if(!mPolicyDecisionSignal.Empty())
848   {
849     Dali::Toolkit::WebView handle(GetOwner());
850     mPolicyDecisionSignal.Emit(handle, std::move(decision));
851   }
852 }
853
854 bool WebView::DoConnectSignal(BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor)
855 {
856   Dali::BaseHandle handle(object);
857
858   bool             connected = false;
859   Toolkit::WebView webView   = Toolkit::WebView::DownCast(handle);
860
861   if(0 == strcmp(signalName.c_str(), PAGE_LOAD_STARTED_SIGNAL))
862   {
863     webView.PageLoadStartedSignal().Connect(tracker, functor);
864     connected = true;
865   }
866   else if(0 == strcmp(signalName.c_str(), PAGE_LOAD_IN_PROGRESS_SIGNAL))
867   {
868     webView.PageLoadInProgressSignal().Connect(tracker, functor);
869     connected = true;
870   }
871   else if(0 == strcmp(signalName.c_str(), PAGE_LOAD_FINISHED_SIGNAL))
872   {
873     webView.PageLoadFinishedSignal().Connect(tracker, functor);
874     connected = true;
875   }
876   else if(0 == strcmp(signalName.c_str(), PAGE_LOAD_ERROR_SIGNAL))
877   {
878     webView.PageLoadErrorSignal().Connect(tracker, functor);
879     connected = true;
880   }
881   else if(0 == strcmp(signalName.c_str(), SCROLL_EDGE_REACHED_SIGNAL))
882   {
883     webView.ScrollEdgeReachedSignal().Connect(tracker, functor);
884     connected = true;
885   }
886   else if(0 == strcmp(signalName.c_str(), URL_CHANGED_SIGNAL))
887   {
888     webView.UrlChangedSignal().Connect(tracker, functor);
889     connected = true;
890   }
891   else if(0 == strcmp(signalName.c_str(), FORM_REPOST_DECISION_SIGNAL))
892   {
893     webView.FormRepostDecisionSignal().Connect(tracker, functor);
894     connected = true;
895   }
896   else if(0 == strcmp(signalName.c_str(), FRAME_RENDERED_SIGNAL))
897   {
898     webView.FrameRenderedSignal().Connect(tracker, functor);
899     connected = true;
900   }
901   else if(0 == strcmp(signalName.c_str(), REQUEST_INTERCEPTOR_SIGNAL))
902   {
903     webView.RequestInterceptorSignal().Connect(tracker, functor);
904     connected = true;
905   }
906   else if(0 == strcmp(signalName.c_str(), CONSOLE_MESSAGE_SIGNAL))
907   {
908     webView.ConsoleMessageSignal().Connect(tracker, functor);
909     connected = true;
910   }
911   else if(0 == strcmp(signalName.c_str(), POLICY_DECISION))
912   {
913     webView.PolicyDecisionSignal().Connect(tracker, functor);
914     connected = true;
915   }
916
917   return connected;
918 }
919
920 Vector3 WebView::GetNaturalSize()
921 {
922   if(mVisual)
923   {
924     Vector2 rendererNaturalSize;
925     mVisual.GetNaturalSize(rendererNaturalSize);
926     return Vector3(rendererNaturalSize);
927   }
928
929   return Vector3(mWebViewSize);
930 }
931
932 void WebView::OnSceneConnection(int depth)
933 {
934   Control::OnSceneConnection(depth);
935
936   EnableBlendMode(!mVideoHoleEnabled);
937 }
938
939 void WebView::SetProperty(BaseObject* object, Property::Index index, const Property::Value& value)
940 {
941   Toolkit::WebView webView = Toolkit::WebView::DownCast(Dali::BaseHandle(object));
942
943   if(webView)
944   {
945     WebView& impl = GetImpl(webView);
946     switch(index)
947     {
948       case Toolkit::WebView::Property::URL:
949       {
950         std::string url;
951         if(value.Get(url))
952         {
953           impl.LoadUrl(url);
954         }
955         break;
956       }
957       case Toolkit::WebView::Property::USER_AGENT:
958       {
959         std::string input;
960         if(value.Get(input))
961         {
962           impl.SetUserAgent(input);
963         }
964         break;
965       }
966       case Toolkit::WebView::Property::SCROLL_POSITION:
967       {
968         Vector2 input;
969         if(value.Get(input))
970         {
971           impl.SetScrollPosition(input.x, input.y);
972         }
973         break;
974       }
975       case Toolkit::WebView::Property::VIDEO_HOLE_ENABLED:
976       {
977         bool input;
978         if(value.Get(input))
979         {
980           impl.EnableVideoHole(input);
981         }
982         break;
983       }
984       case Toolkit::WebView::Property::MOUSE_EVENTS_ENABLED:
985       {
986         bool input;
987         if(value.Get(input))
988         {
989           impl.EnableMouseEvents(input);
990         }
991         break;
992       }
993       case Toolkit::WebView::Property::KEY_EVENTS_ENABLED:
994       {
995         bool input;
996         if(value.Get(input))
997         {
998           impl.EnableKeyEvents(input);
999         }
1000         break;
1001       }
1002       case Toolkit::WebView::Property::DOCUMENT_BACKGROUND_COLOR:
1003       {
1004         Vector4 input;
1005         if(value.Get(input))
1006         {
1007           impl.SetDocumentBackgroundColor(input);
1008         }
1009         break;
1010       }
1011       case Toolkit::WebView::Property::TILES_CLEARED_WHEN_HIDDEN:
1012       {
1013         bool input;
1014         if(value.Get(input))
1015         {
1016           impl.ClearTilesWhenHidden(input);
1017         }
1018         break;
1019       }
1020       case Toolkit::WebView::Property::TILE_COVER_AREA_MULTIPLIER:
1021       {
1022         float input;
1023         if(value.Get(input))
1024         {
1025           impl.SetTileCoverAreaMultiplier(input);
1026         }
1027         break;
1028       }
1029       case Toolkit::WebView::Property::CURSOR_ENABLED_BY_CLIENT:
1030       {
1031         bool input;
1032         if(value.Get(input))
1033         {
1034           impl.EnableCursorByClient(input);
1035         }
1036         break;
1037       }
1038       case Toolkit::WebView::Property::PAGE_ZOOM_FACTOR:
1039       {
1040         float input;
1041         if(value.Get(input))
1042         {
1043           impl.SetPageZoomFactor(input);
1044         }
1045         break;
1046       }
1047       case Toolkit::WebView::Property::TEXT_ZOOM_FACTOR:
1048       {
1049         float input;
1050         if(value.Get(input))
1051         {
1052           impl.SetTextZoomFactor(input);
1053         }
1054         break;
1055       }
1056       default:
1057         break;
1058     }
1059   }
1060 }
1061
1062 Property::Value WebView::GetProperty(BaseObject* object, Property::Index propertyIndex)
1063 {
1064   Property::Value value;
1065
1066   Toolkit::WebView webView = Toolkit::WebView::DownCast(Dali::BaseHandle(object));
1067
1068   if(webView)
1069   {
1070     WebView& impl = GetImpl(webView);
1071     switch(propertyIndex)
1072     {
1073       case Toolkit::WebView::Property::URL:
1074       {
1075         value = impl.mUrl;
1076         break;
1077       }
1078       case Toolkit::WebView::Property::USER_AGENT:
1079       {
1080         value = impl.GetUserAgent();
1081         break;
1082       }
1083       case Toolkit::WebView::Property::SCROLL_POSITION:
1084       {
1085         value = impl.GetScrollPosition();
1086         break;
1087       }
1088       case Toolkit::WebView::Property::SCROLL_SIZE:
1089       {
1090         value = impl.GetScrollSize();
1091         break;
1092       }
1093       case Toolkit::WebView::Property::CONTENT_SIZE:
1094       {
1095         value = impl.GetContentSize();
1096         break;
1097       }
1098       case Toolkit::WebView::Property::TITLE:
1099       {
1100         value = impl.GetTitle();
1101         break;
1102       }
1103       case Toolkit::WebView::Property::VIDEO_HOLE_ENABLED:
1104       {
1105         value = impl.mVideoHoleEnabled;
1106         break;
1107       }
1108       case Toolkit::WebView::Property::MOUSE_EVENTS_ENABLED:
1109       {
1110         value = impl.mMouseEventsEnabled;
1111         break;
1112       }
1113       case Toolkit::WebView::Property::KEY_EVENTS_ENABLED:
1114       {
1115         value = impl.mKeyEventsEnabled;
1116         break;
1117       }
1118       case Toolkit::WebView::Property::SELECTED_TEXT:
1119       {
1120         value = impl.GetSelectedText();
1121         break;
1122       }
1123       case Toolkit::WebView::Property::PAGE_ZOOM_FACTOR:
1124       {
1125         value = impl.GetPageZoomFactor();
1126         break;
1127       }
1128       case Toolkit::WebView::Property::TEXT_ZOOM_FACTOR:
1129       {
1130         value = impl.GetTextZoomFactor();
1131         break;
1132       }
1133       case Toolkit::WebView::Property::LOAD_PROGRESS_PERCENTAGE:
1134       {
1135         value = impl.GetLoadProgressPercentage();
1136         break;
1137       }
1138       default:
1139         break;
1140     }
1141   }
1142
1143   return value;
1144 }
1145
1146 bool WebView::OnTouchEvent(Actor actor, const Dali::TouchEvent& touch)
1147 {
1148   bool result = false;
1149
1150   if(mWebEngine)
1151   {
1152     result = mWebEngine.SendTouchEvent(touch);
1153   }
1154   return result;
1155 }
1156
1157 bool WebView::OnKeyEvent(const Dali::KeyEvent& event)
1158 {
1159   bool result = false;
1160
1161   if(mWebEngine)
1162   {
1163     result = mWebEngine.SendKeyEvent(event);
1164   }
1165   return result;
1166 }
1167
1168 bool WebView::OnHoverEvent(Actor actor, const Dali::HoverEvent& hover)
1169 {
1170   bool result = false;
1171   if(mWebEngine)
1172   {
1173     result = mWebEngine.SendHoverEvent(hover);
1174   }
1175   return result;
1176 }
1177
1178 bool WebView::OnWheelEvent(Actor actor, const Dali::WheelEvent& wheel)
1179 {
1180   bool result = false;
1181   if(mWebEngine)
1182   {
1183     result = mWebEngine.SendWheelEvent(wheel);
1184   }
1185   return result;
1186 }
1187
1188 void WebView::OnKeyInputFocusGained()
1189 {
1190   if(mWebEngine)
1191   {
1192     mWebEngine.SetFocus(true);
1193   }
1194
1195   EmitKeyInputFocusSignal(true); // Calls back into the Control hence done last.
1196 }
1197
1198 void WebView::OnKeyInputFocusLost()
1199 {
1200   if(mWebEngine)
1201   {
1202     mWebEngine.SetFocus(false);
1203   }
1204
1205   EmitKeyInputFocusSignal(false); // Calls back into the Control hence done last.
1206 }
1207
1208 void WebView::SetScrollPosition(int x, int y)
1209 {
1210   if(mWebEngine)
1211   {
1212     mWebEngine.SetScrollPosition(x, y);
1213   }
1214 }
1215
1216 Dali::Vector2 WebView::GetScrollPosition() const
1217 {
1218   return mWebEngine ? mWebEngine.GetScrollPosition() : Dali::Vector2::ZERO;
1219 }
1220
1221 Dali::Vector2 WebView::GetScrollSize() const
1222 {
1223   return mWebEngine ? mWebEngine.GetScrollSize() : Dali::Vector2::ZERO;
1224 }
1225
1226 Dali::Vector2 WebView::GetContentSize() const
1227 {
1228   return mWebEngine ? mWebEngine.GetContentSize() : Dali::Vector2::ZERO;
1229 }
1230
1231 std::string WebView::GetTitle() const
1232 {
1233   return mWebEngine ? mWebEngine.GetTitle() : kEmptyString;
1234 }
1235
1236 void WebView::SetDocumentBackgroundColor(Dali::Vector4 color)
1237 {
1238   if(mWebEngine)
1239   {
1240     mWebEngine.SetDocumentBackgroundColor(color);
1241   }
1242 }
1243
1244 void WebView::ClearTilesWhenHidden(bool cleared)
1245 {
1246   if(mWebEngine)
1247   {
1248     mWebEngine.ClearTilesWhenHidden(cleared);
1249   }
1250 }
1251
1252 void WebView::SetTileCoverAreaMultiplier(float multiplier)
1253 {
1254   if(mWebEngine)
1255   {
1256     mWebEngine.SetTileCoverAreaMultiplier(multiplier);
1257   }
1258 }
1259
1260 void WebView::EnableCursorByClient(bool enabled)
1261 {
1262   if(mWebEngine)
1263   {
1264     mWebEngine.EnableCursorByClient(enabled);
1265   }
1266 }
1267
1268 std::string WebView::GetSelectedText() const
1269 {
1270   return mWebEngine ? mWebEngine.GetSelectedText() : kEmptyString;
1271 }
1272
1273 const std::string& WebView::GetUserAgent() const
1274 {
1275   return mWebEngine ? mWebEngine.GetUserAgent() : kEmptyString;
1276 }
1277
1278 void WebView::SetUserAgent(const std::string& userAgent)
1279 {
1280   if(mWebEngine)
1281   {
1282     mWebEngine.SetUserAgent(userAgent);
1283   }
1284 }
1285
1286 void WebView::EnableMouseEvents(bool enabled)
1287 {
1288   if(mWebEngine)
1289   {
1290     mMouseEventsEnabled = enabled;
1291     mWebEngine.EnableMouseEvents(enabled);
1292   }
1293 }
1294
1295 void WebView::EnableKeyEvents(bool enabled)
1296 {
1297   if(mWebEngine)
1298   {
1299     mKeyEventsEnabled = enabled;
1300     mWebEngine.EnableKeyEvents(enabled);
1301   }
1302 }
1303
1304 void WebView::SetPageZoomFactor(float zoomFactor)
1305 {
1306   if(mWebEngine)
1307   {
1308     mWebEngine.SetPageZoomFactor(zoomFactor);
1309   }
1310 }
1311
1312 float WebView::GetPageZoomFactor() const
1313 {
1314   return mWebEngine ? mWebEngine.GetPageZoomFactor() : 0.0f;
1315 }
1316
1317 void WebView::SetTextZoomFactor(float zoomFactor)
1318 {
1319   if(mWebEngine)
1320   {
1321     mWebEngine.SetTextZoomFactor(zoomFactor);
1322   }
1323 }
1324
1325 float WebView::GetTextZoomFactor() const
1326 {
1327   return mWebEngine ? mWebEngine.GetTextZoomFactor() : 0.0f;
1328 }
1329
1330 float WebView::GetLoadProgressPercentage() const
1331 {
1332   return mWebEngine ? mWebEngine.GetLoadProgressPercentage() : 0.0f;
1333 }
1334
1335 bool WebView::SetVisibility(bool visible)
1336 {
1337   return mWebEngine ? mWebEngine.SetVisibility(visible) : false;
1338 }
1339
1340 #undef GET_ENUM_STRING
1341 #undef GET_ENUM_VALUE
1342
1343 } // namespace Internal
1344
1345 } // namespace Toolkit
1346
1347 } // namespace Dali