Support scroll in web engine. 47/250847/4
authorhuayong.xu <huayong.xu@samsung.com>
Tue, 5 Jan 2021 07:00:51 +0000 (15:00 +0800)
committerhuayong.xu <huayong.xu@samsung.com>
Wed, 13 Jan 2021 08:22:07 +0000 (16:22 +0800)
Some APIs related to scroll are supported.

Change-Id: Ie97364cf57bd40d7a5a855387a188c2e23f7f074

dali/devel-api/adaptor-framework/web-engine-plugin.h [changed mode: 0644->0755]
dali/devel-api/adaptor-framework/web-engine.cpp
dali/devel-api/adaptor-framework/web-engine.h [changed mode: 0644->0755]
dali/internal/web-engine/common/web-engine-impl.cpp [changed mode: 0644->0755]
dali/internal/web-engine/common/web-engine-impl.h

old mode 100644 (file)
new mode 100755 (executable)
index 5914637..c3b9389
@@ -45,6 +45,14 @@ public:
    */
   typedef Signal<void(const std::string&, int)> WebEnginePageLoadErrorSignalType;
 
+  // forward declaration.
+  enum class ScrollEdge;
+
+  /**
+   * @brief WebView signal type related with scroll edge reached.
+   */
+  typedef Signal< void( const ScrollEdge )> WebEngineScrollEdgeReachedSignalType;
+
   /**
    * @brief Enumeration for cache model options.
    */
@@ -88,18 +96,25 @@ public:
   };
 
   /**
-   * @brief Constructor.
+   * @brief Enumeration for the scroll edge.
    */
-  WebEnginePlugin()
+  enum class ScrollEdge
   {
-  }
+    LEFT,   ///< Left edge reached.
+    RIGHT,  ///< Right edge reached.
+    TOP,    ///< Top edge reached.
+    BOTTOM, ///< Bottom edge reached.
+  };
+
+  /**
+   * @brief Constructor.
+   */
+  WebEnginePlugin() = default;
 
   /**
    * @brief Destructor.
    */
-  virtual ~WebEnginePlugin()
-  {
-  }
+  virtual ~WebEnginePlugin() = default;
 
   /**
    * @brief Creates WebEngine instance.
@@ -163,6 +178,31 @@ public:
   virtual void Resume() = 0;
 
   /**
+   * @brief Scrolls the webpage of view by deltaX and deltaY.
+   */
+  virtual void ScrollBy( int deltaX, int deltaY ) = 0;
+
+  /**
+   * @brief Scroll to the specified position of the given view.
+   */
+  virtual void SetScrollPosition( int x, int y ) = 0;
+
+  /**
+   * @brief Gets the current scroll position of the given view.
+   */
+  virtual void GetScrollPosition( int& x, int& y ) const = 0;
+
+  /**
+   * @brief Gets the possible scroll size of the given view.
+   */
+  virtual void GetScrollSize( int& width, int& height ) const = 0;
+
+  /**
+   * @brief Gets the last known content's size.
+   */
+  virtual void GetContentSize( int& width, int& height ) const = 0;
+
+  /**
    * @brief Returns whether forward is possible.
    *
    * @return True if forward is possible, false otherwise
@@ -355,6 +395,13 @@ public:
    * @return A signal object to connect with.
    */
   virtual WebEnginePageLoadErrorSignalType& PageLoadErrorSignal() = 0;
+
+  /**
+   * @brief Connects to this signal to be notified when scroll edge is reached.
+   *
+   * @return A signal object to connect with.
+   */
+  virtual WebEngineScrollEdgeReachedSignalType& ScrollEdgeReachedSignal() = 0;
 };
 
 } // namespace Dali
index 69c2b79..efdc38c 100755 (executable)
@@ -112,6 +112,31 @@ void WebEngine::Resume()
   GetImplementation(*this).Resume();
 }
 
+void WebEngine::ScrollBy( int deltaX, int deltaY )
+{
+  GetImplementation( *this ).ScrollBy( deltaX, deltaY );
+}
+
+void WebEngine::SetScrollPosition( int x, int y )
+{
+  GetImplementation( *this ).SetScrollPosition( x, y );
+}
+
+void WebEngine::GetScrollPosition( int& x, int& y ) const
+{
+  GetImplementation( *this ).GetScrollPosition( x, y );
+}
+
+void WebEngine::GetScrollSize( int& width, int& height ) const
+{
+  GetImplementation( *this ).GetScrollSize( width, height );
+}
+
+void WebEngine::GetContentSize( int& width, int& height ) const
+{
+  GetImplementation( *this ).GetContentSize( width, height );
+}
+
 bool WebEngine::CanGoForward()
 {
   return GetImplementation(*this).CanGoForward();
@@ -262,4 +287,9 @@ Dali::WebEnginePlugin::WebEnginePageLoadErrorSignalType& WebEngine::PageLoadErro
   return GetImplementation(*this).PageLoadErrorSignal();
 }
 
+Dali::WebEnginePlugin::WebEngineScrollEdgeReachedSignalType& WebEngine::ScrollEdgeReachedSignal()
+{
+  return GetImplementation( *this ).ScrollEdgeReachedSignal();
+}
+
 } // namespace Dali
old mode 100644 (file)
new mode 100755 (executable)
index f3622ab..adebcd7
@@ -146,6 +146,31 @@ public:
   void Resume();
 
   /**
+   * @brief Scrolls the webpage of view by deltaX and deltaY.
+   */
+  void ScrollBy( int deltaX, int deltaY );
+
+  /**
+   * @brief Sets an absolute scroll of the given view.
+   */
+  void SetScrollPosition( int x, int y );
+
+  /**
+   * @brief Gets the current scroll position of the given view.
+   */
+  void GetScrollPosition( int& x, int& y ) const;
+
+  /**
+   * @brief Gets the possible scroll size of the given view.
+   */
+  void GetScrollSize( int& width, int& height ) const;
+
+  /**
+   * @brief Gets the last known content's size.
+   */
+  void GetContentSize( int& width, int& height ) const;
+
+  /**
    * @brief Returns whether forward is possible.
    *
    * @return True if forward is possible, false otherwise
@@ -339,6 +364,13 @@ public:
    */
   Dali::WebEnginePlugin::WebEnginePageLoadErrorSignalType& PageLoadErrorSignal();
 
+  /**
+   * @brief Connects to this signal to be notified when scroll edge is reached.
+   *
+   * @return A signal object to connect with.
+   */
+  Dali::WebEnginePlugin::WebEngineScrollEdgeReachedSignalType& ScrollEdgeReachedSignal();
+
 private: // Not intended for application developers
   /**
    * @brief Internal constructor
old mode 100644 (file)
new mode 100755 (executable)
index 8e2d55d..d3718ef
@@ -213,6 +213,31 @@ void WebEngine::Resume()
   mPlugin->Resume();
 }
 
+void WebEngine::ScrollBy( int deltaX, int deltaY )
+{
+  mPlugin->ScrollBy( deltaX, deltaY );
+}
+
+void WebEngine::SetScrollPosition( int x, int y )
+{
+  mPlugin->SetScrollPosition( x, y );
+}
+
+void WebEngine::GetScrollPosition( int& x, int& y ) const
+{
+  mPlugin->GetScrollPosition( x, y );
+}
+
+void WebEngine::GetScrollSize( int& width, int& height ) const
+{
+  mPlugin->GetScrollSize( width, height );
+}
+
+void WebEngine::GetContentSize( int& width, int& height ) const
+{
+  mPlugin->GetContentSize( width, height );
+}
+
 bool WebEngine::CanGoForward()
 {
   return mPlugin->CanGoForward();
@@ -363,6 +388,11 @@ Dali::WebEnginePlugin::WebEnginePageLoadErrorSignalType& WebEngine::PageLoadErro
   return mPlugin->PageLoadErrorSignal();
 }
 
+Dali::WebEnginePlugin::WebEngineScrollEdgeReachedSignalType& WebEngine::ScrollEdgeReachedSignal()
+{
+  return mPlugin->ScrollEdgeReachedSignal();
+}
+
 } // namespace Adaptor;
 } // namespace Internal;
 } // namespace Dali;
index a9a9928..18bb93c 100755 (executable)
@@ -103,6 +103,31 @@ public:
   void Resume();
 
   /**
+   * @copydoc Dali::WebEngine::ScrollBy()
+   */
+  void ScrollBy( int deltaX, int deltaY );
+
+  /**
+   * @copydoc Dali::WebEngine::SetScrollPosition()
+   */
+  void SetScrollPosition( int x, int y );
+
+  /**
+   * @copydoc Dali::WebEngine::GetScrollPosition()
+   */
+  void GetScrollPosition( int& x, int& y ) const;
+
+  /**
+   * @copydoc Dali::WebEngine::GetScrollSize()
+   */
+  void GetScrollSize( int& width, int& height ) const;
+
+  /**
+   * @copydoc Dali::WebEngine::GetContentSize()
+   */
+  void GetContentSize( int& width, int& height ) const;
+
+  /**
    * @copydoc Dali::WebEngine::CanGoForward()
    */
   bool CanGoForward();
@@ -252,6 +277,11 @@ public:
    */
   Dali::WebEnginePlugin::WebEnginePageLoadErrorSignalType& PageLoadErrorSignal();
 
+  /**
+   * @copydoc Dali::WebEngine::ScrollEdgeReachedSignal()
+   */
+  Dali::WebEnginePlugin::WebEngineScrollEdgeReachedSignalType& ScrollEdgeReachedSignal();
+
 private:
 
   /**