From fb222199e44a5352d8c7f6e1c715da1a995e41af Mon Sep 17 00:00:00 2001 From: "huayong.xu" Date: Tue, 29 Dec 2020 14:20:19 +0800 Subject: [PATCH] Support mouse & wheel events in web view. Mouse and wheel events support are added in web view. Change-Id: I89bf564cf49a1448fccfd9df90bc95076448b4e8 --- .../dali-toolkit-test-utils/toolkit-web-engine.cpp | 18 +++ .../src/dali-toolkit/utc-Dali-WebView.cpp | 124 ++++++++++++++++- .../devel-api/controls/web-view/web-view.h | 14 ++ .../internal/controls/web-view/web-view-impl.cpp | 154 +++++++++++++++------ .../internal/controls/web-view/web-view-impl.h | 104 +++++++++----- 5 files changed, 337 insertions(+), 77 deletions(-) diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-web-engine.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-web-engine.cpp index 01b5ae5..0043f2c 100755 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-web-engine.cpp +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-web-engine.cpp @@ -1082,6 +1082,16 @@ bool WebEngine::SendKeyEvent( const KeyEvent& event ) return true; } +bool WebEngine::SendHoverEvent( const HoverEvent& event ) +{ + return true; +} + +bool WebEngine::SendWheelEvent( const WheelEvent& event ) +{ + return true; +} + void WebEngine::SetFocus( bool focused ) { } @@ -1094,6 +1104,14 @@ void WebEngine::EnableVideoHole( bool enabled ) { } +void WebEngine::EnableMouseEvents( bool enabled ) +{ +} + +void WebEngine::EnableKeyEvents( bool enabled ) +{ +} + Dali::WebEnginePlugin::WebEnginePageLoadSignalType& WebEngine::PageLoadStartedSignal() { return Internal::Adaptor::GetImplementation( *this ).PageLoadStartedSignal(); diff --git a/automated-tests/src/dali-toolkit/utc-Dali-WebView.cpp b/automated-tests/src/dali-toolkit/utc-Dali-WebView.cpp index 7b7e397..7668926 100755 --- a/automated-tests/src/dali-toolkit/utc-Dali-WebView.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-WebView.cpp @@ -22,8 +22,10 @@ #include "dali-toolkit-test-utils/toolkit-timer.h" #include +#include #include #include +#include #include #include #include @@ -53,6 +55,8 @@ static int gJavaScriptAlertCallbackCalled = 0; static int gJavaScriptConfirmCallbackCalled = 0; static int gJavaScriptPromptCallbackCalled = 0; static bool gTouched = false; +static bool gHovered = false; +static bool gWheelEventHandled = false; struct CallbackFunctor { @@ -126,6 +130,18 @@ static bool OnTouched( Actor actor, const Dali::TouchEvent& touch ) return true; } +static bool OnHovered( Actor actor, const Dali::HoverEvent& hover ) +{ + gHovered = true; + return true; +} + +static bool OnWheelEvent( Actor actor, const Dali::WheelEvent& wheel ) +{ + gWheelEventHandled = true; + return true; +} + } // namespace void web_view_startup(void) @@ -357,7 +373,7 @@ int UtcDaliWebViewMove(void) END_TEST; } -int UtcDaliWebViewPropertyVideoHole(void) +int UtcDaliWebViewPropertyVideoHoleEnabled(void) { ToolkitTestApplication application; @@ -382,6 +398,112 @@ int UtcDaliWebViewPropertyVideoHole(void) END_TEST; } +int UtcDaliWebViewPropertyMouseEventsEnabled(void) +{ + ToolkitTestApplication application; + + WebView view = WebView::New(); + DALI_TEST_CHECK( view ); + + const bool kDefaultValue = true; + const bool kTestValue = false; + + // Check default value + bool output; + Property::Value value = view.GetProperty( WebView::Property::MOUSE_EVENTS_ENABLED ); + DALI_TEST_CHECK( value.Get( output ) ); + DALI_TEST_EQUALS( output, kDefaultValue, TEST_LOCATION ); + + // Check Set/GetProperty + view.SetProperty( WebView::Property::MOUSE_EVENTS_ENABLED, kTestValue ); + value = view.GetProperty( WebView::Property::MOUSE_EVENTS_ENABLED ); + DALI_TEST_CHECK( value.Get( output ) ); + DALI_TEST_EQUALS( output, kTestValue, TEST_LOCATION ); + + END_TEST; +} + +int UtcDaliWebViewPropertyKeyEventsEnabled(void) +{ + ToolkitTestApplication application; + + WebView view = WebView::New(); + DALI_TEST_CHECK( view ); + + const bool kDefaultValue = true; + const bool kTestValue = false; + + // Check default value + bool output; + Property::Value value = view.GetProperty( WebView::Property::KEY_EVENTS_ENABLED ); + DALI_TEST_CHECK( value.Get( output ) ); + DALI_TEST_EQUALS( output, kDefaultValue, TEST_LOCATION ); + + // Check Set/GetProperty + view.SetProperty( WebView::Property::KEY_EVENTS_ENABLED, kTestValue ); + value = view.GetProperty( WebView::Property::KEY_EVENTS_ENABLED ); + DALI_TEST_CHECK( value.Get( output ) ); + DALI_TEST_EQUALS( output, kTestValue, TEST_LOCATION ); + + END_TEST; +} + +int UtcDaliWebViewHoverAndWheel(void) +{ + ToolkitTestApplication application; + + WebView view = WebView::New(); + DALI_TEST_CHECK( view ); + view.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); + view.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT ); + view.SetProperty( Actor::Property::POSITION, Vector2( 0, 0 )); + view.SetProperty( Actor::Property::SIZE, Vector2( 800, 600 ) ); + + application.GetScene().Add( view ); + application.SendNotification(); + application.Render(); + + view.GetNaturalSize(); + view.HoveredSignal().Connect( &OnHovered ); + view.WheelEventSignal().Connect( &OnWheelEvent ); + + // Hover event + Dali::Integration::HoverEvent event = Dali::Integration::HoverEvent(); + Dali::Integration::Point pointDown; + pointDown.SetState( PointState::DOWN ); + pointDown.SetScreenPosition( Vector2( 10, 10 ) ); + event.AddPoint( pointDown ); + application.ProcessEvent( event ); + + event = Dali::Integration::HoverEvent(); + Dali::Integration::Point pointUp; + pointUp.SetState( PointState::UP ); + pointUp.SetScreenPosition( Vector2( 10, 10 ) ); + event.AddPoint( pointUp ); + application.ProcessEvent( event ); + + event = Dali::Integration::HoverEvent(); + Dali::Integration::Point pointMotion; + pointUp.SetState( PointState::MOTION ); + pointUp.SetScreenPosition( Vector2( 10, 10 ) ); + event.AddPoint( pointMotion ); + application.ProcessEvent( event ); + + // Wheel event + Dali::Integration::WheelEvent wheelEvent; + wheelEvent.type = Dali::Integration::WheelEvent::Type::MOUSE_WHEEL; + wheelEvent.direction = 0; + wheelEvent.point = Vector2( 20, 20 ); + wheelEvent.delta = 10; + application.ProcessEvent( wheelEvent ); + application.SendNotification(); + + DALI_TEST_CHECK( gHovered ); + DALI_TEST_CHECK( gWheelEventHandled ); + + END_TEST; +} + int UtcDaliWebViewGetWebBackForwardList(void) { ToolkitTestApplication application; diff --git a/dali-toolkit/devel-api/controls/web-view/web-view.h b/dali-toolkit/devel-api/controls/web-view/web-view.h index 13ce3c0..d347824 100644 --- a/dali-toolkit/devel-api/controls/web-view/web-view.h +++ b/dali-toolkit/devel-api/controls/web-view/web-view.h @@ -117,6 +117,20 @@ public: * @note The value is read-only. */ VIDEO_HOLE_ENABLED, + + /** + * @brief Whether mouse event is enabled. + * @details name "mouseEventsEnabled", type Property::BOOLEAN. + * @note Default is true. + */ + MOUSE_EVENTS_ENABLED, + + /** + * @brief Whether key event is enabled. + * @details name "keyEventsEnabled", type Property::BOOLEAN. + * @note Default is true. + */ + KEY_EVENTS_ENABLED, }; }; diff --git a/dali-toolkit/internal/controls/web-view/web-view-impl.cpp b/dali-toolkit/internal/controls/web-view/web-view-impl.cpp index 3595b12..8053564 100644 --- a/dali-toolkit/internal/controls/web-view/web-view-impl.cpp +++ b/dali-toolkit/internal/controls/web-view/web-view-impl.cpp @@ -58,13 +58,15 @@ BaseHandle Create() // clang-format off DALI_TYPE_REGISTRATION_BEGIN(Toolkit::WebView, Toolkit::Control, Create) -DALI_PROPERTY_REGISTRATION(Toolkit, WebView, "url", STRING, URL ) -DALI_PROPERTY_REGISTRATION(Toolkit, WebView, "userAgent", STRING, USER_AGENT ) -DALI_PROPERTY_REGISTRATION(Toolkit, WebView, "scrollPosition", VECTOR2, SCROLL_POSITION ) -DALI_PROPERTY_REGISTRATION(Toolkit, WebView, "scrollSize", VECTOR2, SCROLL_SIZE ) -DALI_PROPERTY_REGISTRATION(Toolkit, WebView, "contentSize", VECTOR2, CONTENT_SIZE ) -DALI_PROPERTY_REGISTRATION(Toolkit, WebView, "title", STRING, TITLE ) -DALI_PROPERTY_REGISTRATION(Toolkit, WebView, "videoHoleEnabled", BOOLEAN, VIDEO_HOLE_ENABLED) +DALI_PROPERTY_REGISTRATION(Toolkit, WebView, "url", STRING, URL ) +DALI_PROPERTY_REGISTRATION(Toolkit, WebView, "userAgent", STRING, USER_AGENT ) +DALI_PROPERTY_REGISTRATION(Toolkit, WebView, "scrollPosition", VECTOR2, SCROLL_POSITION ) +DALI_PROPERTY_REGISTRATION(Toolkit, WebView, "scrollSize", VECTOR2, SCROLL_SIZE ) +DALI_PROPERTY_REGISTRATION(Toolkit, WebView, "contentSize", VECTOR2, CONTENT_SIZE ) +DALI_PROPERTY_REGISTRATION(Toolkit, WebView, "title", STRING, TITLE ) +DALI_PROPERTY_REGISTRATION(Toolkit, WebView, "videoHoleEnabled", BOOLEAN, VIDEO_HOLE_ENABLED ) +DALI_PROPERTY_REGISTRATION(Toolkit, WebView, "mouseEventsEnabled", BOOLEAN, MOUSE_EVENTS_ENABLED) +DALI_PROPERTY_REGISTRATION(Toolkit, WebView, "keyEventsEnabled", BOOLEAN, KEY_EVENTS_ENABLED ) DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "pageLoadStarted", PAGE_LOAD_STARTED_SIGNAL ) DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "pageLoadInProgress", PAGE_LOAD_IN_PROGRESS_SIGNAL) @@ -97,7 +99,9 @@ WebView::WebView(const std::string& locale, const std::string& timezoneId) mPageLoadErrorSignal(), mVideoHoleEnabled(true), mWebViewArea(0, 0, mWebViewSize.width, mWebViewSize.height), - mUrlChangedSignal() + mUrlChangedSignal(), + mMouseEventsEnabled(true), + mKeyEventsEnabled(true) { mWebEngine = Dali::WebEngine::New(); @@ -119,7 +123,9 @@ WebView::WebView(int argc, char** argv) mPageLoadErrorSignal(), mVideoHoleEnabled(true), mWebViewArea(0, 0, mWebViewSize.width, mWebViewSize.height), - mUrlChangedSignal() + mUrlChangedSignal(), + mMouseEventsEnabled(true), + mKeyEventsEnabled(true) { mWebEngine = Dali::WebEngine::New(); @@ -176,6 +182,8 @@ void WebView::OnInitialize() self.SetProperty(Actor::Property::KEYBOARD_FOCUSABLE, true); self.TouchedSignal().Connect(this, &WebView::OnTouchEvent); + self.HoveredSignal().Connect(this, &WebView::OnHoverEvent); + self.WheelEventSignal().Connect(this, &WebView::OnWheelEvent); mPositionUpdateNotification = self.AddPropertyNotification(Actor::Property::WORLD_POSITION, StepCondition(1.0f, 1.0f)); mSizeUpdateNotification = self.AddPropertyNotification(Actor::Property::SIZE, StepCondition(1.0f, 1.0f)); @@ -186,11 +194,11 @@ void WebView::OnInitialize() if(mWebEngine) { - mWebEngine.PageLoadStartedSignal().Connect( this, &WebView::OnPageLoadStarted ); + mWebEngine.PageLoadStartedSignal().Connect(this, &WebView::OnPageLoadStarted); mWebEngine.PageLoadInProgressSignal().Connect(this, &WebView::OnPageLoadInProgress); - mWebEngine.PageLoadFinishedSignal().Connect( this, &WebView::OnPageLoadFinished ); - mWebEngine.PageLoadErrorSignal().Connect( this, &WebView::OnPageLoadError ); - mWebEngine.ScrollEdgeReachedSignal().Connect( this, &WebView::OnScrollEdgeReached ); + mWebEngine.PageLoadFinishedSignal().Connect(this, &WebView::OnPageLoadFinished); + mWebEngine.PageLoadErrorSignal().Connect(this, &WebView::OnPageLoadError); + mWebEngine.ScrollEdgeReachedSignal().Connect(this, &WebView::OnScrollEdgeReached); mWebEngine.UrlChangedSignal().Connect(this, &WebView::OnUrlChanged); mWebContext = std::unique_ptr(new WebContext(mWebEngine.GetContext())); @@ -363,51 +371,51 @@ void WebView::AddJavaScriptMessageHandler(const std::string& exposedObjectName, } } -void WebView::RegisterJavaScriptAlertCallback( Dali::WebEnginePlugin::JavaScriptAlertCallback callback ) +void WebView::RegisterJavaScriptAlertCallback(Dali::WebEnginePlugin::JavaScriptAlertCallback callback) { if(mWebEngine) { - mWebEngine.RegisterJavaScriptAlertCallback( callback ); + mWebEngine.RegisterJavaScriptAlertCallback(callback); } } void WebView::JavaScriptAlertReply() { - if ( mWebEngine ) + if(mWebEngine) { mWebEngine.JavaScriptAlertReply(); } } -void WebView::RegisterJavaScriptConfirmCallback( Dali::WebEnginePlugin::JavaScriptConfirmCallback callback ) +void WebView::RegisterJavaScriptConfirmCallback(Dali::WebEnginePlugin::JavaScriptConfirmCallback callback) { - if ( mWebEngine ) + if(mWebEngine) { - mWebEngine.RegisterJavaScriptConfirmCallback( callback ); + mWebEngine.RegisterJavaScriptConfirmCallback(callback); } } -void WebView::JavaScriptConfirmReply( bool confirmed ) +void WebView::JavaScriptConfirmReply(bool confirmed) { - if ( mWebEngine ) + if(mWebEngine) { - mWebEngine.JavaScriptConfirmReply( confirmed ); + mWebEngine.JavaScriptConfirmReply(confirmed); } } -void WebView::RegisterJavaScriptPromptCallback( Dali::WebEnginePlugin::JavaScriptPromptCallback callback ) +void WebView::RegisterJavaScriptPromptCallback(Dali::WebEnginePlugin::JavaScriptPromptCallback callback) { - if ( mWebEngine ) + if(mWebEngine) { - mWebEngine.RegisterJavaScriptPromptCallback( callback ); + mWebEngine.RegisterJavaScriptPromptCallback(callback); } } -void WebView::JavaScriptPromptReply( const std::string& result ) +void WebView::JavaScriptPromptReply(const std::string& result) { - if ( mWebEngine ) + if(mWebEngine) { - mWebEngine.JavaScriptPromptReply( result ); + mWebEngine.JavaScriptPromptReply(result); } } @@ -474,7 +482,7 @@ void WebView::EnableBlendMode(bool blendEnabled) void WebView::ClearAllTilesResources() { - if( mWebEngine ) + if(mWebEngine) { mWebEngine.ClearAllTilesResources(); } @@ -510,7 +518,7 @@ Dali::Toolkit::WebView::WebViewUrlChangedSignalType& WebView::UrlChangedSignal() return mUrlChangedSignal; } -void WebView::OnPageLoadStarted( const std::string& url ) +void WebView::OnPageLoadStarted(const std::string& url) { if(!mPageLoadStartedSignal.Empty()) { @@ -519,16 +527,16 @@ void WebView::OnPageLoadStarted( const std::string& url ) } } -void WebView::OnPageLoadInProgress( const std::string& url ) +void WebView::OnPageLoadInProgress(const std::string& url) { - if ( !mPageLoadInProgressSignal.Empty() ) + if(!mPageLoadInProgressSignal.Empty()) { - Dali::Toolkit::WebView handle( GetOwner() ); - mPageLoadInProgressSignal.Emit( handle, url ); + Dali::Toolkit::WebView handle(GetOwner()); + mPageLoadInProgressSignal.Emit(handle, url); } } -void WebView::OnPageLoadFinished( const std::string& url ) +void WebView::OnPageLoadFinished(const std::string& url) { if(!mPageLoadFinishedSignal.Empty()) { @@ -557,14 +565,14 @@ void WebView::OnScrollEdgeReached(Dali::WebEnginePlugin::ScrollEdge edge) void WebView::OnUrlChanged(const std::string& url) { - if (!mUrlChangedSignal.Empty()) + if(!mUrlChangedSignal.Empty()) { Dali::Toolkit::WebView handle(GetOwner()); mUrlChangedSignal.Emit(handle, url); } } -bool WebView::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor ) +bool WebView::DoConnectSignal(BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor) { Dali::BaseHandle handle(object); @@ -576,7 +584,7 @@ bool WebView::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* t webView.PageLoadStartedSignal().Connect(tracker, functor); connected = true; } - else if (0 == strcmp(signalName.c_str(), PAGE_LOAD_IN_PROGRESS_SIGNAL)) + else if(0 == strcmp(signalName.c_str(), PAGE_LOAD_IN_PROGRESS_SIGNAL)) { webView.PageLoadInProgressSignal().Connect(tracker, functor); connected = true; @@ -596,9 +604,9 @@ bool WebView::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* t webView.ScrollEdgeReachedSignal().Connect(tracker, functor); connected = true; } - else if (0 == strcmp(signalName.c_str(), URL_CHANGED_SIGNAL)) + else if(0 == strcmp(signalName.c_str(), URL_CHANGED_SIGNAL)) { - webView.UrlChangedSignal().Connect( tracker, functor ); + webView.UrlChangedSignal().Connect(tracker, functor); connected = true; } @@ -669,6 +677,24 @@ void WebView::SetProperty(BaseObject* object, Property::Index index, const Prope } break; } + case Toolkit::WebView::Property::MOUSE_EVENTS_ENABLED: + { + bool input; + if(value.Get(input)) + { + impl.EnableMouseEvents(input); + } + break; + } + case Toolkit::WebView::Property::KEY_EVENTS_ENABLED: + { + bool input; + if(value.Get(input)) + { + impl.EnableKeyEvents(input); + } + break; + } } } } @@ -719,6 +745,16 @@ Property::Value WebView::GetProperty(BaseObject* object, Property::Index propert value = impl.mVideoHoleEnabled; break; } + case Toolkit::WebView::Property::MOUSE_EVENTS_ENABLED: + { + value = impl.mMouseEventsEnabled; + break; + } + case Toolkit::WebView::Property::KEY_EVENTS_ENABLED: + { + value = impl.mKeyEventsEnabled; + break; + } default: break; } @@ -749,6 +785,26 @@ bool WebView::OnKeyEvent(const Dali::KeyEvent& event) return result; } +bool WebView::OnHoverEvent(Actor actor, const Dali::HoverEvent& hover) +{ + bool result = false; + if(mWebEngine) + { + result = mWebEngine.SendHoverEvent(hover); + } + return result; +} + +bool WebView::OnWheelEvent(Actor actor, const Dali::WheelEvent& wheel) +{ + bool result = false; + if(mWebEngine) + { + result = mWebEngine.SendWheelEvent(wheel); + } + return result; +} + void WebView::OnKeyInputFocusGained() { if(mWebEngine) @@ -810,6 +866,24 @@ void WebView::SetUserAgent(const std::string& userAgent) } } +void WebView::EnableMouseEvents(bool enabled) +{ + if(mWebEngine) + { + mMouseEventsEnabled = enabled; + mWebEngine.EnableMouseEvents(enabled); + } +} + +void WebView::EnableKeyEvents(bool enabled) +{ + if(mWebEngine) + { + mKeyEventsEnabled = enabled; + mWebEngine.EnableKeyEvents(enabled); + } +} + #undef GET_ENUM_STRING #undef GET_ENUM_VALUE 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 065dc45..9abfd49 100644 --- a/dali-toolkit/internal/controls/web-view/web-view-impl.h +++ b/dali-toolkit/internal/controls/web-view/web-view-impl.h @@ -166,7 +166,7 @@ public: /** * @copydoc Dali::Toolkit::WebView::RegisterJavaScriptAlertCallback() */ - void RegisterJavaScriptAlertCallback( Dali::WebEnginePlugin::JavaScriptAlertCallback callback ); + void RegisterJavaScriptAlertCallback(Dali::WebEnginePlugin::JavaScriptAlertCallback callback); /** * @copydoc Dali::Toolkit::WebView::JavaScriptAlertReply() @@ -176,22 +176,22 @@ public: /** * @copydoc Dali::Toolkit::WebView::RegisterJavaScriptConfirmCallback() */ - void RegisterJavaScriptConfirmCallback( Dali::WebEnginePlugin::JavaScriptConfirmCallback callback ); + void RegisterJavaScriptConfirmCallback(Dali::WebEnginePlugin::JavaScriptConfirmCallback callback); /** * @copydoc Dali::Toolkit::WebView::JavaScriptConfirmReply() */ - void JavaScriptConfirmReply( bool confirmed ); + void JavaScriptConfirmReply(bool confirmed); /** * @copydoc Dali::Toolkit::WebView::RegisterJavaScriptPromptCallback() */ - void RegisterJavaScriptPromptCallback( Dali::WebEnginePlugin::JavaScriptPromptCallback callback); + void RegisterJavaScriptPromptCallback(Dali::WebEnginePlugin::JavaScriptPromptCallback callback); /** * @copydoc Dali::Toolkit::WebView::JavaScriptPromptReply() */ - void JavaScriptPromptReply( const std::string& result ); + void JavaScriptPromptReply(const std::string& result); /** * @copydoc Dali::Toolkit::WebView::ClearHistory() @@ -275,14 +275,6 @@ private: // From Control Vector3 GetNaturalSize() override; /** - * 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::TouchEvent& touch); - - /** * @copydoc Toolkit::Control::OnKeyEvent() */ bool OnKeyEvent(const Dali::KeyEvent& event) override; @@ -374,6 +366,20 @@ private: void EnableBlendMode(bool blendEnabled); /** + * @brief Enables/disables mouse events. The default is enabled. + * + * @param[in] enabled True if mouse events are enabled, false otherwise + */ + void EnableMouseEvents(bool enabled); + + /** + * @brief Enables/disables key events. The default is enabled. + * + * @param[in] enabled True if key events enabled, false otherwise + */ + void EnableKeyEvents(bool enabled); + + /** * @brief Callback function to be called when page load started. * @param[in] url The url currently being loaded */ @@ -383,7 +389,7 @@ private: * @brief Callback function to be called when page is loading in progress. * @param[in] url The url currently being loaded */ - void OnPageLoadInProgress( const std::string& url ); + void OnPageLoadInProgress(const std::string& url); /** * @brief Callback function to be called when page load finished. @@ -408,32 +414,58 @@ private: * @brief Callback function to be called when url is changed. * @param[in] url The url currently being loaded */ - void OnUrlChanged( const std::string& url ); + void OnUrlChanged(const std::string& url); + + /** + * 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::TouchEvent& touch); + + /** + * 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. + */ + bool OnHoverEvent(Actor actor, const Dali::HoverEvent& hover); + + /** + * 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); private: - std::string mUrl; - Dali::Toolkit::Visual::Base mVisual; - Dali::Size mWebViewSize; - Dali::WebEngine mWebEngine; - - Dali::Toolkit::WebView::WebViewPageLoadSignalType mPageLoadStartedSignal; - Dali::Toolkit::WebView::WebViewPageLoadSignalType mPageLoadInProgressSignal; - Dali::Toolkit::WebView::WebViewPageLoadSignalType mPageLoadFinishedSignal; - Dali::Toolkit::WebView::WebViewPageLoadErrorSignalType mPageLoadErrorSignal; + std::string mUrl; + Dali::Toolkit::Visual::Base mVisual; + Dali::Size mWebViewSize; + Dali::WebEngine mWebEngine; + + Dali::Toolkit::WebView::WebViewPageLoadSignalType mPageLoadStartedSignal; + Dali::Toolkit::WebView::WebViewPageLoadSignalType mPageLoadInProgressSignal; + Dali::Toolkit::WebView::WebViewPageLoadSignalType mPageLoadFinishedSignal; + Dali::Toolkit::WebView::WebViewPageLoadErrorSignalType mPageLoadErrorSignal; Dali::Toolkit::WebView::WebViewScrollEdgeReachedSignalType mScrollEdgeReachedSignal; - std::unique_ptr mWebContext; - std::unique_ptr mWebCookieManager; - std::unique_ptr mWebSettings; - std::unique_ptr mWebBackForwardList; - Dali::Toolkit::ImageView mFaviconView; - - Dali::PropertyNotification mPositionUpdateNotification; - Dali::PropertyNotification mSizeUpdateNotification; - Dali::PropertyNotification mScaleUpdateNotification; - bool mVideoHoleEnabled; - Dali::Rect< int > mWebViewArea; - Dali::Toolkit::WebView::WebViewUrlChangedSignalType mUrlChangedSignal; + std::unique_ptr mWebContext; + std::unique_ptr mWebCookieManager; + std::unique_ptr mWebSettings; + std::unique_ptr mWebBackForwardList; + Dali::Toolkit::ImageView mFaviconView; + + Dali::PropertyNotification mPositionUpdateNotification; + Dali::PropertyNotification mSizeUpdateNotification; + Dali::PropertyNotification mScaleUpdateNotification; + bool mVideoHoleEnabled; + Dali::Rect mWebViewArea; + Dali::Toolkit::WebView::WebViewUrlChangedSignalType mUrlChangedSignal; + bool mMouseEventsEnabled; + bool mKeyEventsEnabled; }; } // namespace Internal -- 2.7.4