From 0e2550584b9ef90a7e5ee4d467199b8415d25bd0 Mon Sep 17 00:00:00 2001 From: "huayong.xu" Date: Fri, 22 Jan 2021 09:46:44 +0800 Subject: [PATCH] Improve code related to scroll API in web engine. This improvement is suggested by Mr Richard Huang. Change-Id: Ia9e06ca7a12bf6e7e8d845f443afe89c34970b46 --- dali/devel-api/adaptor-framework/web-engine-plugin.h | 12 ++++++------ dali/devel-api/adaptor-framework/web-engine.cpp | 12 ++++++------ dali/devel-api/adaptor-framework/web-engine.h | 6 +++--- dali/internal/web-engine/common/web-engine-impl.cpp | 12 ++++++------ dali/internal/web-engine/common/web-engine-impl.h | 6 +++--- 5 files changed, 24 insertions(+), 24 deletions(-) diff --git a/dali/devel-api/adaptor-framework/web-engine-plugin.h b/dali/devel-api/adaptor-framework/web-engine-plugin.h index eb4a5fe..118446d 100755 --- a/dali/devel-api/adaptor-framework/web-engine-plugin.h +++ b/dali/devel-api/adaptor-framework/web-engine-plugin.h @@ -43,12 +43,12 @@ public: /** * @brief WebEngine signal type related with page loading. */ - typedef Signal WebEnginePageLoadSignalType; + using WebEnginePageLoadSignalType = Signal< void( const std::string& ) >; /** * @brief WebView signal type related with page loading error. */ - typedef Signal WebEnginePageLoadErrorSignalType; + using WebEnginePageLoadErrorSignalType = Signal< void( const std::string&, int ) >; // forward declaration. enum class ScrollEdge; @@ -56,7 +56,7 @@ public: /** * @brief WebView signal type related with scroll edge reached. */ - typedef Signal< void( const ScrollEdge )> WebEngineScrollEdgeReachedSignalType; + using WebEngineScrollEdgeReachedSignalType = Signal< void( const ScrollEdge ) >; /** * @brief Enumeration for the scroll edge. @@ -197,17 +197,17 @@ public: /** * @brief Gets the current scroll position of the given view. */ - virtual void GetScrollPosition( int& x, int& y ) const = 0; + virtual Dali::Vector2 GetScrollPosition() const = 0; /** * @brief Gets the possible scroll size of the given view. */ - virtual void GetScrollSize( int& width, int& height ) const = 0; + virtual Dali::Vector2 GetScrollSize() const = 0; /** * @brief Gets the last known content's size. */ - virtual void GetContentSize( int& width, int& height ) const = 0; + virtual Dali::Vector2 GetContentSize() const = 0; /** * @brief Returns whether forward is possible. diff --git a/dali/devel-api/adaptor-framework/web-engine.cpp b/dali/devel-api/adaptor-framework/web-engine.cpp index 76dfec0..e454f0d 100755 --- a/dali/devel-api/adaptor-framework/web-engine.cpp +++ b/dali/devel-api/adaptor-framework/web-engine.cpp @@ -164,19 +164,19 @@ void WebEngine::SetScrollPosition( int x, int y ) GetImplementation( *this ).SetScrollPosition( x, y ); } -void WebEngine::GetScrollPosition( int& x, int& y ) const +Dali::Vector2 WebEngine::GetScrollPosition() const { - GetImplementation( *this ).GetScrollPosition( x, y ); + return GetImplementation( *this ).GetScrollPosition(); } -void WebEngine::GetScrollSize( int& width, int& height ) const +Dali::Vector2 WebEngine::GetScrollSize() const { - GetImplementation( *this ).GetScrollSize( width, height ); + return GetImplementation( *this ).GetScrollSize(); } -void WebEngine::GetContentSize( int& width, int& height ) const +Dali::Vector2 WebEngine::GetContentSize() const { - GetImplementation( *this ).GetContentSize( width, height ); + return GetImplementation( *this ).GetContentSize(); } bool WebEngine::CanGoForward() diff --git a/dali/devel-api/adaptor-framework/web-engine.h b/dali/devel-api/adaptor-framework/web-engine.h index b733353..040a521 100755 --- a/dali/devel-api/adaptor-framework/web-engine.h +++ b/dali/devel-api/adaptor-framework/web-engine.h @@ -202,17 +202,17 @@ public: /** * @brief Gets the current scroll position of the given view. */ - void GetScrollPosition( int& x, int& y ) const; + Dali::Vector2 GetScrollPosition() const; /** * @brief Gets the possible scroll size of the given view. */ - void GetScrollSize( int& width, int& height ) const; + Dali::Vector2 GetScrollSize() const; /** * @brief Gets the last known content's size. */ - void GetContentSize( int& width, int& height ) const; + Dali::Vector2 GetContentSize() const; /** * @brief Returns whether forward is possible. diff --git a/dali/internal/web-engine/common/web-engine-impl.cpp b/dali/internal/web-engine/common/web-engine-impl.cpp index 0943387..0a6ecf0 100755 --- a/dali/internal/web-engine/common/web-engine-impl.cpp +++ b/dali/internal/web-engine/common/web-engine-impl.cpp @@ -273,19 +273,19 @@ void WebEngine::SetScrollPosition( int x, int y ) mPlugin->SetScrollPosition( x, y ); } -void WebEngine::GetScrollPosition( int& x, int& y ) const +Dali::Vector2 WebEngine::GetScrollPosition() const { - mPlugin->GetScrollPosition( x, y ); + return mPlugin->GetScrollPosition(); } -void WebEngine::GetScrollSize( int& width, int& height ) const +Dali::Vector2 WebEngine::GetScrollSize() const { - mPlugin->GetScrollSize( width, height ); + return mPlugin->GetScrollSize(); } -void WebEngine::GetContentSize( int& width, int& height ) const +Dali::Vector2 WebEngine::GetContentSize() const { - mPlugin->GetContentSize( width, height ); + return mPlugin->GetContentSize(); } bool WebEngine::CanGoForward() diff --git a/dali/internal/web-engine/common/web-engine-impl.h b/dali/internal/web-engine/common/web-engine-impl.h index a2a6571..dea65ba 100755 --- a/dali/internal/web-engine/common/web-engine-impl.h +++ b/dali/internal/web-engine/common/web-engine-impl.h @@ -166,17 +166,17 @@ public: /** * @copydoc Dali::WebEngine::GetScrollPosition() */ - void GetScrollPosition( int& x, int& y ) const; + Dali::Vector2 GetScrollPosition() const; /** * @copydoc Dali::WebEngine::GetScrollSize() */ - void GetScrollSize( int& width, int& height ) const; + Dali::Vector2 GetScrollSize() const; /** * @copydoc Dali::WebEngine::GetContentSize() */ - void GetContentSize( int& width, int& height ) const; + Dali::Vector2 GetContentSize() const; /** * @copydoc Dali::WebEngine::CanGoForward() -- 2.7.4