X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Fweb-view%2Fweb-view-impl.h;h=4031ee6a17873891772eee7f09ed01669f7e5393;hp=54a679ff142df43e581ddb12833912e33fc61449;hb=HEAD;hpb=2b6baa7ad447110327e4ac22e7b3c3b6524c14da diff --git a/dali-toolkit/internal/controls/web-view/web-view-impl.h b/dali-toolkit/internal/controls/web-view/web-view-impl.h index 54a679f..6415a8b 100644 --- a/dali-toolkit/internal/controls/web-view/web-view-impl.h +++ b/dali-toolkit/internal/controls/web-view/web-view-impl.h @@ -2,7 +2,7 @@ #define DALI_TOOLKIT_INTERNAL_WEB_VIEW_H /* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. + * Copyright (c) 2024 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,39 +19,44 @@ */ // EXTERNAL INCLUDES -#include +#include +#include +#include #include +#include +#include // INTERNAL INCLUDES +#include +#include #include #include -#include +#include namespace Dali { - namespace Toolkit { - class KeyEvent; -class TouchData; +class TouchEvent; +class WebBackForwardList; +class WebSettings; class WebView; namespace Internal { - class WebView : public Control { protected: - WebView(); - WebView( const std::string& locale, const std::string& timezoneId ); + WebView(const std::string& locale, const std::string& timezoneId); + + WebView(uint32_t argc, char** argv); virtual ~WebView(); public: - /** * @copydoc Dali::Toolkit::WebView::New() */ @@ -60,98 +65,362 @@ public: /** * @copydoc Dali::Toolkit::WebView::New( const std::string&, const std::string& ) */ - static Toolkit::WebView New( const std::string& locale, const std::string& timezoneId ); + static Toolkit::WebView New(const std::string& locale, const std::string& timezoneId); /** - * @copydoc Dali::Toolkit::WebView::LoadUrl() + * @copydoc Dali::Toolkit::WebView::New( uint32_t, char** ) + */ + static Toolkit::WebView New(uint32_t argc, char** argv); + + /** + * @copydoc Dali::Toolkit::WebView::FindWebView() + */ + static Toolkit::WebView FindWebView(Dali::WebEnginePlugin* plugin); + + /** + * @copydoc Dali::Toolkit::WebView::GetContext() + */ + static Dali::WebEngineContext* GetContext(); + + /** + * @copydoc Dali::Toolkit::WebView::GetCookieManager() + */ + static Dali::WebEngineCookieManager* GetCookieManager(); + + /** + * @copydoc Dali::Toolkit::WebView::GetSettings() + */ + Dali::Toolkit::WebSettings* GetSettings() const; + + /** + * @copydoc Dali::Toolkit::WebView::GetBackForwardList() */ - void LoadUrl( const std::string& url ); + Dali::Toolkit::WebBackForwardList* GetBackForwardList() const; /** - * @copydoc Dali::Toolkit::WebView::GetUrl() + * @copydoc Dali::Toolkit::WebView::GetPlugin() */ - const std::string& GetUrl(); + Dali::WebEnginePlugin* GetPlugin() const; + + /** + * @copydoc Dali::Toolkit::WebView::GetFavicon() + */ + Dali::Toolkit::ImageView GetFavicon() const; + + /** + * @copydoc Dali::Toolkit::WebView::LoadUrl() + */ + void LoadUrl(const std::string& url); /** * @copydoc Dali::WebEngine::LoadHTMLString() */ - void LoadHTMLString( const std::string& htmlString ); + void LoadHtmlString(const std::string& htmlString); + + /** + * @copydoc Dali::WebEngine::LoadHtmlStringOverrideCurrentEntry() + */ + bool LoadHtmlStringOverrideCurrentEntry(const std::string& html, const std::string& basicUri, const std::string& unreachableUrl); /** - * @copydoc Dali::WebEngine::Reload() + * @copydoc Dali::WebEngine::LoadContents() + */ + bool LoadContents(const int8_t* contents, uint32_t contentSize, const std::string& mimeType, const std::string& encoding, const std::string& baseUri); + + /** + * @copydoc Dali::Toolkit::WebView::Reload() */ void Reload(); /** - * @copydoc Dali::WebEngine::StopLoading() + * @copydoc Dali::WebEngine::ReloadWithoutCache() + */ + bool ReloadWithoutCache(); + + /** + * @copydoc Dali::Toolkit::WebView::StopLoading() */ void StopLoading(); /** - * @copydoc Dali::WebEngine::CanGoForward() + * @copydoc Dali::Toolkit::WebView::StopLoading() + */ + void Suspend(); + + /** + * @copydoc Dali::Toolkit::WebView::Resume() + */ + void Resume(); + + /** + * @copydoc Dali::WebEngine::SuspendNetworkLoading() + */ + void SuspendNetworkLoading(); + + /** + * @copydoc Dali::WebEngine::ResumeNetworkLoading() + */ + void ResumeNetworkLoading(); + + /** + * @copydoc Dali::WebEngine::AddCustomHeader() + */ + bool AddCustomHeader(const std::string& name, const std::string& value); + + /** + * @copydoc Dali::WebEngine::RemoveCustomHeader() + */ + bool RemoveCustomHeader(const std::string& name); + + /** + * @copydoc Dali::WebEngine::StartInspectorServer() + */ + uint32_t StartInspectorServer(uint32_t port); + + /** + * @copydoc Dali::WebEngine::StopInspectorServer() + */ + bool StopInspectorServer(); + + /** + * @copydoc Dali::Toolkit::WebView::ScrollBy() + */ + void ScrollBy(int32_t deltaX, int32_t deltaY); + + /** + * @copydoc Dali::WebEngine::ScrollEdgeBy() + */ + bool ScrollEdgeBy(int32_t deltaX, int32_t deltaY); + + /** + * @copydoc Dali::Toolkit::WebView::CanGoForward() */ bool CanGoForward(); /** - * @copydoc Dali::WebEngine::GoForward() + * @copydoc Dali::Toolkit::WebView::GoForward() */ void GoForward(); /** - * @copydoc Dali::WebEngine::CanGoBack() + * @copydoc Dali::Toolkit::WebView::CanGoBack() */ bool CanGoBack(); /** - * @copydoc Dali::WebEngine::GoBack() + * @copydoc Dali::Toolkit::WebView::GoBack() */ void GoBack(); /** - * @copydoc Dali::WebEngine::EvaluateJavaScript() + * @copydoc Dali::Toolkit::WebView::EvaluateJavaScript() + */ + void EvaluateJavaScript(const std::string& script, Dali::WebEnginePlugin::JavaScriptMessageHandlerCallback resultHandler); + + /** + * @copydoc Dali::Toolkit::WebView::AddJavaScriptMessageHandler() + */ + void AddJavaScriptMessageHandler(const std::string& exposedObjectName, Dali::WebEnginePlugin::JavaScriptMessageHandlerCallback handler); + + /** + * @copydoc Dali::Toolkit::WebView::RegisterJavaScriptAlertCallback() */ - void EvaluateJavaScript( const std::string& script ); + void RegisterJavaScriptAlertCallback(Dali::WebEnginePlugin::JavaScriptAlertCallback callback); /** - * @copydoc Dali::WebEngine::AddJavaScriptInterface() + * @copydoc Dali::Toolkit::WebView::JavaScriptAlertReply() */ - void AddJavaScriptInterface( const std::string& exposedObjectName, const std::string& jsFunctionName, std::function< std::string(const std::string&) > callback ); + void JavaScriptAlertReply(); /** - * @copydoc Dali::WebEngine::RemoveJavascriptInterface() + * @copydoc Dali::Toolkit::WebView::RegisterJavaScriptConfirmCallback() */ - void RemoveJavascriptInterface( const std::string& exposedObjectName, const std::string& jsFunctionName ); + void RegisterJavaScriptConfirmCallback(Dali::WebEnginePlugin::JavaScriptConfirmCallback callback); /** - * @copydoc Dali::WebEngine::ClearHistory() + * @copydoc Dali::Toolkit::WebView::JavaScriptConfirmReply() + */ + void JavaScriptConfirmReply(bool confirmed); + + /** + * @copydoc Dali::Toolkit::WebView::RegisterJavaScriptPromptCallback() + */ + void RegisterJavaScriptPromptCallback(Dali::WebEnginePlugin::JavaScriptPromptCallback callback); + + /** + * @copydoc Dali::Toolkit::WebView::JavaScriptPromptReply() + */ + void JavaScriptPromptReply(const std::string& result); + + /** + * @copydoc Dali::Toolkit::WebView::CreateHitTest() + */ + std::unique_ptr CreateHitTest(int32_t x, int32_t y, Dali::WebEngineHitTest::HitTestMode mode); + + /** + * @copydoc Dali::Toolkit::WebView::CreateHitTestAsynchronously() + */ + bool CreateHitTestAsynchronously(int32_t x, int32_t y, Dali::WebEngineHitTest::HitTestMode mode, Dali::WebEnginePlugin::WebEngineHitTestCreatedCallback callback); + + /** + * @copydoc Dali::Toolkit::WebView::ClearHistory() */ void ClearHistory(); /** - * @copydoc Dali::WebEngine::ClearCache() + * @copydoc Dali::Toolkit::WebView::ClearAllTilesResources() */ - void ClearCache(); + void ClearAllTilesResources(); /** - * @copydoc Dali::Toolkit::WebView::PageLoadStartedSignal() + * @copydoc Dali::Toolkit::WebView::SetScaleFactor() */ - Dali::Toolkit::WebView::WebViewSignalType& PageLoadStartedSignal(); + void SetScaleFactor(float scaleFactor, Dali::Vector2 point); /** - * @copydoc Dali::Toolkit::WebView::PageLoadFinishedSignal() + * @copydoc Dali::Toolkit::WebView::GetScaleFactor() */ - Dali::Toolkit::WebView::WebViewSignalType& PageLoadFinishedSignal(); + float GetScaleFactor() const; -public: // Properties + /** + * @copydoc Dali::Toolkit::WebView::ActivateAccessibility() + */ + void ActivateAccessibility(bool activated); + + /** + * @copydoc Dali::Toolkit::WebView::HighlightText() + */ + bool HighlightText(const std::string& text, Dali::WebEnginePlugin::FindOption options, uint32_t maxMatchCount); + + /** + * @copydoc Dali::Toolkit::WebView::AddDynamicCertificatePath() + */ + void AddDynamicCertificatePath(const std::string& host, const std::string& certPath); + + /** + * @copydoc Dali::Toolkit::WebView::GetScreenshot() + */ + Dali::Toolkit::ImageView GetScreenshot(Dali::Rect viewArea, float scaleFactor); + + /** + * @copydoc Dali::Toolkit::WebView::GetScreenshotAsynchronously() + */ + bool GetScreenshotAsynchronously(Dali::Rect viewArea, float scaleFactor, Dali::Toolkit::WebView::WebViewScreenshotCapturedCallback callback); + + /** + * @copydoc Dali::Toolkit::WebView::CheckVideoPlayingAsynchronously() + */ + bool CheckVideoPlayingAsynchronously(Dali::WebEnginePlugin::VideoPlayingCallback callback); + + /** + * @copydoc Dali::Toolkit::WebView::RegisterGeolocationPermissionCallback() + */ + void RegisterGeolocationPermissionCallback(Dali::WebEnginePlugin::GeolocationPermissionCallback callback); + + /** + * @copydoc Dali::Toolkit::WebView::SetTtsFocus() + */ + void SetTtsFocus(bool focused); + + /** + * @copydoc Dali::Toolkit::WebView::RegisterPageLoadStartedCallback() + */ + void RegisterPageLoadStartedCallback(Dali::WebEnginePlugin::WebEnginePageLoadCallback callback); + + /** + * @copydoc Dali::Toolkit::WebView::RegisterPageLoadInProgressCallback() + */ + void RegisterPageLoadInProgressCallback(Dali::WebEnginePlugin::WebEnginePageLoadCallback callback); + + /** + * @copydoc Dali::Toolkit::WebView::RegisterPageLoadFinishedCallback() + */ + void RegisterPageLoadFinishedCallback(Dali::WebEnginePlugin::WebEnginePageLoadCallback callback); + + /** + * @copydoc Dali::Toolkit::WebView::RegisterPageLoadErrorCallback() + */ + void RegisterPageLoadErrorCallback(Dali::WebEnginePlugin::WebEnginePageLoadErrorCallback callback); + + /** + * @copydoc Dali::Toolkit::WebView::RegisterScrollEdgeReachedCallback() + */ + void RegisterScrollEdgeReachedCallback(Dali::WebEnginePlugin::WebEngineScrollEdgeReachedCallback callback); + + /** + * @copydoc Dali::Toolkit::WebView::RegisterUrlChangedCallback() + */ + void RegisterUrlChangedCallback(Dali::WebEnginePlugin::WebEngineUrlChangedCallback callback); + + /** + * @copydoc Dali::Toolkit::WebView::RegisterFormRepostDecidedCallback() + */ + void RegisterFormRepostDecidedCallback(Dali::WebEnginePlugin::WebEngineFormRepostDecidedCallback callback); + + /** + * @copydoc Dali::Toolkit::WebView::RegisterFrameRenderedCallback() + */ + void RegisterFrameRenderedCallback(Dali::WebEnginePlugin::WebEngineFrameRenderedCallback callback); + + /** + * @copydoc Dali::Toolkit::WebView::RegisterConsoleMessageReceivedCallback() + */ + void RegisterConsoleMessageReceivedCallback(Dali::WebEnginePlugin::WebEngineConsoleMessageReceivedCallback callback); + + /** + * @copydoc Dali::Toolkit::WebView::RegisterResponsePolicyDecidedCallback() + */ + void RegisterResponsePolicyDecidedCallback(Dali::WebEnginePlugin::WebEngineResponsePolicyDecidedCallback callback); + + /** + * @copydoc Dali::Toolkit::WebView::RegisterNavigationPolicyDecidedCallback() + */ + void RegisterNavigationPolicyDecidedCallback(Dali::WebEnginePlugin::WebEngineNavigationPolicyDecidedCallback callback); + + /** + * @copydoc Dali::Toolkit::WebView::RegisterNewWindowCreatedCallback() + */ + void RegisterNewWindowCreatedCallback(Dali::WebEnginePlugin::WebEngineNewWindowCreatedCallback callback); + + /** + * @copydoc Dali::Toolkit::WebView::RegisterCertificateConfirmedCallback() + */ + void RegisterCertificateConfirmedCallback(Dali::WebEnginePlugin::WebEngineCertificateCallback callback); + + /** + * @copydoc Dali::Toolkit::WebView::RegisterSslCertificateChangedCallback() + */ + void RegisterSslCertificateChangedCallback(Dali::WebEnginePlugin::WebEngineCertificateCallback callback); /** + * @copydoc Dali::Toolkit::WebView::RegisterHttpAuthHandlerCallback() + */ + void RegisterHttpAuthHandlerCallback(Dali::WebEnginePlugin::WebEngineHttpAuthHandlerCallback callback); + + /** + * @copydoc Dali::Toolkit::WebView::RegisterContextMenuShownCallback() + */ + void RegisterContextMenuShownCallback(Dali::WebEnginePlugin::WebEngineContextMenuShownCallback callback); + + /** + * @copydoc Dali::Toolkit::WebView::RegisterContextMenuHiddenCallback() + */ + void RegisterContextMenuHiddenCallback(Dali::WebEnginePlugin::WebEngineContextMenuHiddenCallback callback); + + /** + * @copydoc Dali::Toolkit::WebView::GetPlainTextAsynchronously() + */ + void GetPlainTextAsynchronously(Dali::WebEnginePlugin::PlainTextReceivedCallback callback); + +public: // Properties + /** * @brief Called when a property of an object of this type is set. * * @param[in] object The object whose property is set. * @param[in] index The property index. * @param[in] value The new property value. */ - static void SetProperty( Dali::BaseObject* object, Dali::Property::Index index, const Dali::Property::Value& value ); + static void SetProperty(Dali::BaseObject* object, Dali::Property::Index index, const Dali::Property::Value& value); /** * @brief Called to retrieve a property of an object of this type. @@ -160,84 +429,365 @@ public: // Properties * @param[in] index The property index. * @return The current value of the property. */ - static Dali::Property::Value GetProperty( Dali::BaseObject* object, Dali::Property::Index propertyIndex ); + static Dali::Property::Value GetProperty(Dali::BaseObject* object, Dali::Property::Index propertyIndex); +private: // From Control /** - * Connects a callback function with the object's signals. - * @param[in] object The object providing the signal. - * @param[in] tracker Used to disconnect the signal. - * @param[in] signalName The signal to connect to. - * @param[in] functor A newly allocated FunctorDelegate. - * @return True if the signal was connected. - * @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the c + * @copydoc Toolkit::Control::OnInitialize() */ - static bool DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor ); + void OnInitialize() override; -private: // From Control + /** + * @copydoc Toolkit::Internal::Control::CreateAccessibleObject() + */ + DevelControl::ControlAccessible* CreateAccessibleObject() override; /** - * @copydoc Toolkit::Control::OnInitialize() + * @copydoc Toolkit::Internal::Control::OnRelayout() */ - virtual void OnInitialize(); + void OnRelayout(const Vector2& size, RelayoutContainer& container) override; /** * @copydoc Toolkit::Control::GetNaturalSize */ - virtual Vector3 GetNaturalSize(); + Vector3 GetNaturalSize() override; + + /** + * @copydoc Toolkit::Control::OnKeyEvent() + */ + bool OnKeyEvent(const Dali::KeyEvent& event) override; + + /** + * @copydoc Toolkit::Control::OnKeyInputFocusGained() + */ + void OnKeyInputFocusGained() override; + + /** + * @copydoc Toolkit::Control::OnKeyInputFocusLost() + */ + void OnKeyInputFocusLost() override; + + /** + * @copydoc Toolkit::Control::OnSceneConnection() + */ + void OnSceneConnection(int depth) override; + + /** + * @copydoc Toolkit::Control::OnSceneDisconnection() + */ + void OnSceneDisconnection() override; + +private: + // Undefined + WebView(const WebView& webView); + + WebView& operator=(const WebView& webView); + + /** + * @brief Set an absolute scroll of the given view. + * @param[in] x The coordinate x of scroll + * @param[in] y The coordinate y of scroll + */ + void SetScrollPosition(int32_t x, int32_t y); + + /** + * @brief Get the current scroll position of the given view. + * @param[out] x The coordinate x of scroll + * @param[out] y The coordinate y of scroll + */ + Dali::Vector2 GetScrollPosition() const; + + /** + * @brief Get the possible scroll size of the given view. + * @param[out] width The width of scroll size + * @param[out] height The height of scroll size + */ + Dali::Vector2 GetScrollSize() const; + + /** + * @brief Get the last known content's size. + * @param[out] width The width of content's size + * @param[out] height The height of content's size + */ + Dali::Vector2 GetContentSize() const; + + /** + * @brief Return the title of the Web. + * + * @return The title of web page + */ + std::string GetTitle() const; + + /** + * @brief Set the background color of web page. + * @param[in] color The value of background color. + */ + void SetDocumentBackgroundColor(Dali::Vector4 color); + + /** + * @brief Clear tiles when hidden. + * + * @param[in] cleared Whether tiles are cleared or not + */ + void ClearTilesWhenHidden(bool cleared); + + /** + * @brief Set multiplier of cover area of tile. + * + * @param[in] multiplier The multiplier of cover area + */ + void SetTileCoverAreaMultiplier(float multiplier); + + /** + * @brief Enable cursor by client. + * @param[in] enabled Whether cursor is enabled or not. + */ + void EnableCursorByClient(bool enabled); + + /** + * @brief Get the selected text. + * @return The selected text + */ + std::string GetSelectedText() const; + + /** + * @brief Get url of web page. + * @return The string of url + */ + std::string GetUrl() const; + + /** + * @brief Get user agent string. + * @return The string value of user agent + */ + std::string GetUserAgent() const; + + /** + * @brief Set user agent string. + * @param[in] userAgent The string value of user agent + */ + void SetUserAgent(const std::string& userAgent); + + /** + * @brief Set zoom factor of the current page. + * @param[in] zoomFactor a new factor to be set. + */ + void SetPageZoomFactor(float zoomFactor); + + /** + * @brief Query the current zoom factor of the page。 + * @return The current page zoom factor. + */ + float GetPageZoomFactor() const; + + /** + * @brief Set the current text zoom level。. + * @param[in] zoomFactor a new factor to be set. + */ + void SetTextZoomFactor(float zoomFactor); + + /** + * @brief Get the current text zoom level. + * @return The current text zoom factor. + */ + float GetTextZoomFactor() const; + + /** + * @brief Get the current load progress of the page. + * @return The load progress of the page. + */ + float GetLoadProgressPercentage() const; + + /** + * @brief Request to set the current page's visibility. + * @param[in] visible Visible or not. + * + * @return true if succeeded, false otherwise + */ + bool SetVisibility(bool visible); + + /** + * @brief Enable/Disable video hole for video playing. + * @param[in] enabled True if video hole is enabled, false otherwise. + */ + void EnableVideoHole(bool enabled); + + /** + * @brief Enable blend mode. + * @param[in] blendEnabled True if turn on blend mode, false otherwise. + */ + void EnableBlendMode(bool blendEnabled); + + /** + * @brief Enable/disable mouse events. The default is enabled. + * + * @param[in] enabled True if mouse events are enabled, false otherwise + */ + void EnableMouseEvents(bool enabled); + + /** + * @brief Enable/disable key events. The default is enabled. + * + * @param[in] enabled True if key events enabled, false otherwise + */ + void EnableKeyEvents(bool enabled); /** - * @copydoc Toolkit::Control::OnRelayout() + * @brief Create image view by pixel data. + * @param[in] pixel Pixel data + * @return The new image view */ - virtual void OnRelayout( const Vector2& size, RelayoutContainer& container ); + Dali::Toolkit::ImageView CreateImageView(Dali::PixelData pixel) const; /** - * Signal occurs when the Web View has been touched. + * @brief Signal occurs when the Web View has been touched. * @param[in] actor The Actor Touched * @param[in] touch The Touch Data. * @return Whether to consume event or not. */ - bool OnTouchEvent( Actor actor, const Dali::TouchData& touch ); + bool OnTouchEvent(Actor actor, const Dali::TouchEvent& touch); /** - * @copydoc Toolkit::Control::OnKeyEvent() + * @brief Signal occurs when the Web View has been hovered. + * @param[in] actor The Actor Hovered + * @param[in] hover The Hover Data. + * @return Whether to consume event or not. */ - virtual bool OnKeyEvent( const Dali::KeyEvent& event ); + bool OnHoverEvent(Actor actor, const Dali::HoverEvent& hover); -private: + /** + * @brief Signal occurs when the Web View receives wheel event. + * @param[in] actor The Actor that receives Wheel event. + * @param[in] wheel The Wheel Data. + * @return Whether to consume event or not. + */ + bool OnWheelEvent(Actor actor, const Dali::WheelEvent& wheel); - // Undefined - WebView( const WebView& webView ); + /** + * @brief Callback function to be called when frame is rendered. + */ + void OnFrameRendered(); + + /** + * @brief Callback for updating display area of web view. + * @param[in] source The soource triggers Notification. + */ + void OnDisplayAreaUpdated(Dali::PropertyNotification& source); + + /** + * @brief Callback function to be called when visibility is changed. + * @param[in] actor The actor, or child of actor, whose visibility has changed + * @param[in] isVisible Whether the actor is now visible or not + * @param[in] type, Whether the actor's visible property has changed or a parent's + */ + void OnVisibilityChanged(Actor actor, bool isVisible, Dali::DevelActor::VisibilityChange::Type type); - WebView& operator=( const WebView& webView ); + /** + * @brief Callback when the visibility of the window is changed. + * @param[in] window The window whose visibility has changed + * @param[in] visible Whether the window is now visible or not + */ + void OnWindowVisibilityChanged(Window window, bool visible); - void OnPageLoadStarted( const std::string& url ); + /** + * @brief callback for screen shot captured. + * @param[in] pixel Pixel data of screen shot. + */ + void OnScreenshotCaptured(Dali::PixelData pixel); - void OnPageLoadFinished( const std::string& url ); + /** + * @brief Set DisplayArea by input value. + * It will send changes area infomations to webengine internally. + * + * @param[in] displayArea The display area for current webview want to show. + */ + void SetDisplayArea(const Dali::Rect& displayArea); -private: + /** + * @brief Apply self visibility state and send visibility chagend to web engine. + */ + void ApplyVisibilityCheck(); + +protected: + class WebViewAccessible : public DevelControl::ControlAccessible + { + public: + WebViewAccessible() = delete; + + WebViewAccessible(Dali::Actor self, Dali::WebEngine& webEngine); + + protected: + /** + * @copydoc Dali::Accessibility::Accessible::GetAttributes() + */ + Dali::Accessibility::Attributes GetAttributes() const override; - std::string mUrl; + /** + * @copydoc Dali::Accessibility::ActorAccessible::DoGetChildren() + */ + void DoGetChildren(std::vector& children) override; + + private: + void OnAccessibilityEnabled(); + void OnAccessibilityDisabled(); + void SetRemoteChildAddress(Dali::Accessibility::Address address); + + Dali::Accessibility::ProxyAccessible mRemoteChild; + Dali::WebEngine& mWebEngine; + }; + +private: Dali::Toolkit::Visual::Base mVisual; - Dali::Size mWebViewSize; - Dali::WebEngine mWebEngine; - Dali::Toolkit::WebView::WebViewSignalType mPageLoadStartedSignal; - Dali::Toolkit::WebView::WebViewSignalType mPageLoadFinishedSignal; + Dali::Size mWebViewSize; + Dali::WebEngine mWebEngine; + + uint32_t mLastRenderedNativeImageWidth; + uint32_t mLastRenderedNativeImageHeight; + + enum WebViewVisibleStateFlag + { + NONE = 0, + SCENE_ON = 1 << 0, + WINDOW_SHOW = 1 << 1, + SELF_SHOW = 1 << 2, + PARENT_SHOW = 1 << 3, + + VISIBLE = SCENE_ON | WINDOW_SHOW | SELF_SHOW | PARENT_SHOW, + }; + uint32_t mWebViewVisibleState{WebViewVisibleStateFlag::NONE}; /// Flag of web view visible. + WeakHandle mPlacementWindow; + + std::unique_ptr mWebSettings; + std::unique_ptr mWebBackForwardList; + + Dali::PropertyNotification mPositionUpdateNotification; + Dali::PropertyNotification mSizeUpdateNotification; + Dali::PropertyNotification mScaleUpdateNotification; + Dali::Rect mWebViewArea; + bool mVideoHoleEnabled; + bool mMouseEventsEnabled; + bool mKeyEventsEnabled; + + bool mVisualChangeRequired; + + Dali::Toolkit::WebView::WebViewScreenshotCapturedCallback mScreenshotCapturedCallback; + Dali::WebEnginePlugin::WebEngineFrameRenderedCallback mFrameRenderedCallback; }; } // namespace Internal -inline Toolkit::Internal::WebView& GetImpl( Toolkit::WebView& handle ) +inline Toolkit::Internal::WebView& GetImpl(Toolkit::WebView& handle) { - DALI_ASSERT_ALWAYS( handle ); + DALI_ASSERT_ALWAYS(handle); Dali::RefObject& impl = handle.GetImplementation(); - return static_cast< Toolkit::Internal::WebView& >( impl ); + return static_cast(impl); } -inline const Toolkit::Internal::WebView& GetImpl( const Toolkit::WebView& handle ) +inline const Toolkit::Internal::WebView& GetImpl(const Toolkit::WebView& handle) { - DALI_ASSERT_ALWAYS( handle ); + DALI_ASSERT_ALWAYS(handle); const Dali::RefObject& impl = handle.GetImplementation(); - return static_cast< const Toolkit::Internal::WebView& >( impl ); + return static_cast(impl); } } // namespace Toolkit