Merge "Do not substarct outline width in text-controller" into devel/master
authorAdeel Kazmi <adeel.kazmi@samsung.com>
Wed, 26 Sep 2018 09:06:25 +0000 (09:06 +0000)
committerGerrit Code Review <gerrit@review.ap-northeast-2.compute.internal>
Wed, 26 Sep 2018 09:06:26 +0000 (09:06 +0000)
32 files changed:
automated-tests/src/dali-toolkit/CMakeLists.txt
automated-tests/src/dali-toolkit/custom-layout-impl.cpp
automated-tests/src/dali-toolkit/custom-layout-impl.h
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-web-engine.cpp [new file with mode: 0755]
automated-tests/src/dali-toolkit/utc-Dali-Layouting.cpp
automated-tests/src/dali-toolkit/utc-Dali-WebView.cpp [new file with mode: 0644]
build/tizen/dali-toolkit/Makefile.am
dali-toolkit/devel-api/controls/web-view/web-view.cpp [new file with mode: 0644]
dali-toolkit/devel-api/controls/web-view/web-view.h [new file with mode: 0644]
dali-toolkit/devel-api/file.list
dali-toolkit/devel-api/layouting/layout-group-impl.cpp
dali-toolkit/devel-api/layouting/layout-item-impl.cpp
dali-toolkit/devel-api/layouting/layout-length.h
dali-toolkit/devel-api/layouting/layout-size.h
dali-toolkit/devel-api/layouting/measure-spec.h
dali-toolkit/devel-api/layouting/measured-size.h
dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp
dali-toolkit/internal/controls/text-controls/text-field-impl.cpp
dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.cpp
dali-toolkit/internal/controls/text-controls/text-selection-toolbar-impl.cpp
dali-toolkit/internal/controls/web-view/web-view-impl.cpp [new file with mode: 0644]
dali-toolkit/internal/controls/web-view/web-view-impl.h [new file with mode: 0644]
dali-toolkit/internal/file.list
dali-toolkit/internal/layouting/absolute-layout-impl.cpp
dali-toolkit/internal/layouting/flex-layout-impl.cpp
dali-toolkit/internal/layouting/grid-impl.cpp
dali-toolkit/internal/layouting/grid-impl.h
dali-toolkit/internal/layouting/layout-controller-impl.cpp
dali-toolkit/internal/layouting/layout-item-data-impl.cpp
dali-toolkit/internal/layouting/linear-layout-impl.cpp
dali-toolkit/public-api/dali-toolkit-version.cpp
packaging/dali-toolkit.spec

index 086f621..9d79595 100755 (executable)
@@ -66,6 +66,7 @@ SET(TC_SOURCES
   utc-Dali-VisualFactory.cpp
   utc-Dali-ImageAtlas.cpp
   utc-Dali-VideoView.cpp
+  utc-Dali-WebView.cpp
   utc-Dali-AsyncImageLoader.cpp
   utc-Dali-SyncImageLoader.cpp
   utc-Dali-ControlWrapper.cpp
@@ -91,6 +92,7 @@ LIST(APPEND TC_SOURCES
   dali-toolkit-test-utils/toolkit-tts-player.cpp
   dali-toolkit-test-utils/toolkit-native-image-source.cpp
   dali-toolkit-test-utils/toolkit-video-player.cpp
+  dali-toolkit-test-utils/toolkit-web-engine.cpp
   dali-toolkit-test-utils/toolkit-trigger-event-factory.cpp
   dali-toolkit-test-utils/dali-test-suite-utils.cpp
   dali-toolkit-test-utils/dummy-control.cpp
index 115336a..37b6936 100644 (file)
@@ -41,7 +41,7 @@ CustomLayoutPtr CustomLayout::New()
   return layout;
 }
 
-void CustomLayout::MeasureChildren( Dali::Toolkit::Internal::LayoutItemPtr childLayout, MeasureSpec widthMeasureSpec, MeasureSpec heightMeasureSpec, int resultingWidth, int resultingHeight )
+void CustomLayout::MeasureChildren( Dali::Toolkit::Internal::LayoutItemPtr childLayout, MeasureSpec widthMeasureSpec, MeasureSpec heightMeasureSpec, LayoutLength resultingWidth, LayoutLength resultingHeight )
 {
   // Initially use the measure spec of the child's parent
   auto childWidthMeasureSpec = widthMeasureSpec;
@@ -61,7 +61,7 @@ void CustomLayout::MeasureChildren( Dali::Toolkit::Internal::LayoutItemPtr child
 
   MeasureChild( childLayout, childWidthMeasureSpec, childHeightMeasureSpec );
   resultingWidth += childLayout->GetMeasuredWidth();
-  resultingHeight = std::max( childLayout->GetMeasuredHeight().mValue, resultingHeight );
+  resultingHeight = std::max( childLayout->GetMeasuredHeight(), resultingHeight );
 }
 
 void CustomLayout::OnMeasure( MeasureSpec widthMeasureSpec, MeasureSpec heightMeasureSpec )
@@ -93,15 +93,15 @@ void CustomLayout::OnLayout( bool changed, LayoutLength left, LayoutLength top,
   LayoutLength childLeft( 0 );
 
   // We want to vertically align the children to the middle
-  auto height = bottom - top;
-  auto middle = height / 2;
+  LayoutLength height = bottom - top;
+  LayoutLength middle = height / 2;
 
   auto owner = GetOwner();
   auto actor = Actor::DownCast(owner);
 
   // Horizontally align the children to the left
   int count = actor.GetChildCount();
-  int currentLeft = 0;
+  LayoutLength currentLeft = 0;
 
   for( int i = 0; i < count; i++)
   {
@@ -116,10 +116,10 @@ void CustomLayout::OnLayout( bool changed, LayoutLength left, LayoutLength top,
     {
       Dali::Toolkit::Internal::LayoutItem& childLayoutImpl = GetImplementation( childLayout );
 
-      auto childWidth = childLayoutImpl.GetMeasuredWidth();
-      auto childHeight = childLayoutImpl.GetMeasuredHeight();
+      LayoutLength childWidth = childLayoutImpl.GetMeasuredWidth();
+      LayoutLength childHeight = childLayoutImpl.GetMeasuredHeight();
 
-      childTop = middle - (childHeight / 2);
+      childTop = middle - childHeight / 2;
       childLayoutImpl.Layout( currentLeft, childTop, currentLeft + childWidth, childTop + childHeight );
       currentLeft += childWidth;
     }
index 7fb7be2..06c67e0 100644 (file)
@@ -107,7 +107,7 @@ private:
    * @param[out] resultingWidth resulting width of layout after children are measured
    * @param[out] resultingHeight resulting height of layout after children are measured
    */
-  void MeasureChildren( Dali::Toolkit::Internal::LayoutItemPtr childLayout, MeasureSpec widthMeasureSpec, MeasureSpec heightMeasureSpec, int resultingWidth, int resultingHeight );
+  void MeasureChildren( Dali::Toolkit::Internal::LayoutItemPtr childLayout, MeasureSpec widthMeasureSpec, MeasureSpec heightMeasureSpec, LayoutLength resultingWidth, LayoutLength resultingHeight );
 
   private:
 
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
new file mode 100755 (executable)
index 0000000..3f2797a
--- /dev/null
@@ -0,0 +1,352 @@
+/*
+ * Copyright (c) 2018 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include "toolkit-timer.h"
+
+#include <dali/devel-api/adaptor-framework/web-engine.h>
+#include <dali/public-api/object/any.h>
+#include <dali/public-api/object/base-object.h>
+#include <dali/public-api/adaptor-framework/native-image-source.h>
+#include <dali/public-api/images/native-image.h>
+#include <toolkit-application.h>
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+class WebEngine;
+
+namespace
+{
+static WebEngine* gInstance = NULL;
+static int gInstanceCount = 0;
+
+bool OnGoBack();
+bool OnGoForward();
+bool OnLoadUrl();
+bool OnClearHistory();
+
+static void ConnectToGlobalSignal( bool (*func)() )
+{
+  Dali::Timer timer = Dali::Timer::New( 0 );
+  timer.TickSignal().Connect( func );
+}
+
+static void DisconnectFromGlobalSignal( bool (*func)() )
+{
+  Dali::Timer timer = Dali::Timer::New( 0 );
+  timer.TickSignal().Disconnect( func );
+}
+}
+
+class WebEngine: public Dali::BaseObject
+{
+public:
+
+  WebEngine()
+    : mUrl()
+    , mCurrentPlusOnePos( 0 )
+  {
+    gInstanceCount++;
+    gInstance = this;
+  }
+
+  virtual ~WebEngine()
+  {
+    gInstanceCount--;
+    if ( !gInstanceCount )
+    {
+      gInstance = NULL;
+    }
+  }
+
+  void LoadUrl( const std::string& url )
+  {
+    mUrl = url;
+    ConnectToGlobalSignal( &OnLoadUrl );
+  }
+
+  const std::string& GetUrl() const
+  {
+    return mUrl;
+  }
+
+  bool CanGoForward() const
+  {
+    return mHistory.size() > mCurrentPlusOnePos;
+  }
+
+  void GoForward()
+  {
+    ConnectToGlobalSignal( &OnGoForward );
+  }
+
+  bool CanGoBack() const
+  {
+    return mCurrentPlusOnePos > 1;
+  }
+
+  void GoBack()
+  {
+    ConnectToGlobalSignal( &OnGoBack );
+  }
+
+  void ClearHistory()
+  {
+    ConnectToGlobalSignal( &OnClearHistory );
+  }
+
+  Dali::WebEnginePlugin::WebEngineSignalType& PageLoadStartedSignal()
+  {
+    return mPageLoadStartedSignal;
+  }
+
+  Dali::WebEnginePlugin::WebEngineSignalType& PageLoadFinishedSignal()
+  {
+    return mPageLoadFinishedSignal;
+  }
+
+  std::string mUrl;
+  std::vector< std::string > mHistory;
+  size_t mCurrentPlusOnePos;
+  Dali::WebEnginePlugin::WebEngineSignalType mPageLoadStartedSignal;
+  Dali::WebEnginePlugin::WebEngineSignalType mPageLoadFinishedSignal;
+};
+
+inline WebEngine& GetImplementation( Dali::WebEngine& webEngine )
+{
+  DALI_ASSERT_ALWAYS( webEngine && "WebEngine handle is empty." );
+  BaseObject& handle = webEngine.GetBaseObject();
+  return static_cast< Internal::Adaptor::WebEngine& >( handle );
+}
+
+inline const WebEngine& GetImplementation( const Dali::WebEngine& webEngine )
+{
+  DALI_ASSERT_ALWAYS( webEngine && "WebEngine handle is empty." );
+  const BaseObject& handle = webEngine.GetBaseObject();
+  return static_cast< const Internal::Adaptor::WebEngine& >( handle );
+}
+
+namespace
+{
+
+bool OnGoBack()
+{
+  DisconnectFromGlobalSignal( &OnGoBack );
+
+  if ( gInstance && gInstance->CanGoBack() )
+  {
+    gInstance->mCurrentPlusOnePos--;
+  }
+  return false;
+}
+
+bool OnGoForward()
+{
+  DisconnectFromGlobalSignal( &OnGoForward );
+
+  if ( gInstance && gInstance->CanGoForward() )
+  {
+    gInstance->mCurrentPlusOnePos++;
+  }
+  return false;
+}
+
+bool OnLoadUrl()
+{
+  DisconnectFromGlobalSignal( &OnLoadUrl );
+
+  if ( gInstance )
+  {
+    if ( gInstance->mHistory.size() > gInstance->mCurrentPlusOnePos )
+    {
+      gInstance->mHistory.erase( gInstance->mHistory.begin() + gInstance->mCurrentPlusOnePos, gInstance->mHistory.end() );
+    }
+    gInstance->mHistory.push_back( gInstance->mUrl );
+    gInstance->mCurrentPlusOnePos++;
+    gInstance->mPageLoadStartedSignal.Emit( gInstance->mUrl );
+    gInstance->mPageLoadFinishedSignal.Emit( gInstance->mUrl );
+  }
+
+  return false;
+}
+
+bool OnClearHistory()
+{
+  DisconnectFromGlobalSignal( &OnClearHistory );
+
+  if ( gInstance && gInstance->mCurrentPlusOnePos ) {
+    std::string url = gInstance->mHistory[ gInstance->mCurrentPlusOnePos - 1 ];
+    std::vector< std::string >().swap( gInstance->mHistory );
+    gInstance->mHistory.push_back( url );
+    gInstance->mCurrentPlusOnePos = 1;
+  }
+  return false;
+}
+} // namespace
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+
+// Dali::WebEngine Implementation
+WebEngine::WebEngine()
+{
+}
+
+WebEngine::WebEngine( Internal::Adaptor::WebEngine* internal )
+: BaseHandle( internal )
+{
+}
+
+WebEngine::~WebEngine()
+{
+}
+
+WebEngine WebEngine::New()
+{
+  Internal::Adaptor::WebEngine* baseObject = new Internal::Adaptor::WebEngine();
+
+  return WebEngine( baseObject );
+}
+
+WebEngine::WebEngine( const WebEngine& WebEngine )
+: BaseHandle( WebEngine )
+{
+}
+
+WebEngine& WebEngine::operator=( const WebEngine& webEngine )
+{
+  BaseHandle::operator=( webEngine );
+  return *this;
+}
+
+WebEngine WebEngine::DownCast( BaseHandle handle )
+{
+  return WebEngine( dynamic_cast< Internal::Adaptor::WebEngine* >( handle.GetObjectPtr() ) );
+}
+
+void WebEngine::Create( int width, int height, const std::string& locale, const std::string& timezoneId )
+{
+}
+
+void WebEngine::Destroy()
+{
+}
+
+void WebEngine::LoadUrl( const std::string& url )
+{
+  return Internal::Adaptor::GetImplementation( *this ).LoadUrl( url );
+}
+
+const std::string& WebEngine::GetUrl()
+{
+  return Internal::Adaptor::GetImplementation( *this ).GetUrl();
+}
+
+NativeImageInterfacePtr WebEngine::GetNativeImageSource()
+{
+  Any source;
+  Dali::NativeImageSourcePtr sourcePtr = Dali::NativeImageSource::New( source );
+  return sourcePtr;
+}
+
+void WebEngine::LoadHTMLString( const std::string& htmlString )
+{
+}
+
+void WebEngine::Reload()
+{
+}
+
+void WebEngine::StopLoading()
+{
+}
+
+bool WebEngine::CanGoForward()
+{
+  return Internal::Adaptor::GetImplementation( *this ).CanGoForward();
+}
+
+void WebEngine::GoForward()
+{
+  Internal::Adaptor::GetImplementation( *this ).GoForward();
+}
+
+bool WebEngine::CanGoBack()
+{
+  return Internal::Adaptor::GetImplementation( *this ).CanGoBack();
+}
+
+void WebEngine::GoBack()
+{
+  Internal::Adaptor::GetImplementation( *this ).GoBack();
+}
+
+void WebEngine::EvaluateJavaScript( const std::string& script )
+{
+}
+
+void WebEngine::AddJavaScriptInterface( const std::string& exposedObjectName, const std::string& jsFunctionName, std::function< std::string(const std::string&) > cb )
+{
+}
+
+void WebEngine::RemoveJavascriptInterface( const std::string& exposedObjectName, const std::string& jsFunctionName )
+{
+}
+
+void WebEngine::ClearHistory()
+{
+  Internal::Adaptor::GetImplementation( *this ).ClearHistory();
+}
+
+void WebEngine::ClearCache()
+{
+}
+
+void WebEngine::SetSize( int width, int height )
+{
+}
+
+bool WebEngine::SendTouchEvent( const TouchData& touch )
+{
+  return true;
+}
+
+bool WebEngine::SendKeyEvent( const KeyEvent& event )
+{
+  return true;
+}
+
+Dali::WebEnginePlugin::WebEngineSignalType& WebEngine::PageLoadStartedSignal()
+{
+  return Internal::Adaptor::GetImplementation( *this ).PageLoadStartedSignal();
+}
+
+Dali::WebEnginePlugin::WebEngineSignalType& WebEngine::PageLoadFinishedSignal()
+{
+  return Internal::Adaptor::GetImplementation( *this ).PageLoadFinishedSignal();
+}
+
+} // namespace Dali;
+
index 6e8cc16..f0540f4 100644 (file)
@@ -70,6 +70,246 @@ void utc_dali_toolkit_layouting_cleanup(void)
   test_return_value = TET_PASS;
 }
 
+int UtcDaliLayouting_LayoutLength_Types(void)
+{
+  tet_infoline("UtcDaliLayouting_LayoutLength Types");
+
+  // testing that operators return correct type
+  // operator+
+  {
+    auto value = LayoutLength( 10 ) + LayoutLength();
+    DALI_TEST_EQUALS( typeid(value).name(), typeid(LayoutLength).name(), TEST_LOCATION );
+  }
+  {
+    auto value = LayoutLength( 10 ) + 20;
+    DALI_TEST_EQUALS( typeid(value).name(), typeid(LayoutLength).name(), TEST_LOCATION );
+  }
+  {
+    auto value = 22 + LayoutLength( 10 );
+    DALI_TEST_EQUALS( typeid(value).name(), typeid(LayoutLength).name(), TEST_LOCATION );
+  }
+  {
+    auto value = LayoutLength( 10 ) + 2.1f;
+    DALI_TEST_EQUALS( typeid(value).name(), typeid(LayoutLength).name(), TEST_LOCATION );
+  }
+  {
+    auto value = 2.2f + LayoutLength( 10 );
+    DALI_TEST_EQUALS( typeid(value).name(), typeid(LayoutLength).name(), TEST_LOCATION );
+  }
+  // operator-
+  {
+    auto value = LayoutLength() - LayoutLength( 10 );
+    DALI_TEST_EQUALS( typeid(value).name(), typeid(LayoutLength).name(), TEST_LOCATION );
+  }
+  {
+    auto value = LayoutLength( 10 ) - 99;
+    DALI_TEST_EQUALS( typeid(value).name(), typeid(LayoutLength).name(), TEST_LOCATION );
+  }
+  {
+    auto value = 20 - LayoutLength( 10 );
+    DALI_TEST_EQUALS( typeid(value).name(), typeid(LayoutLength).name(), TEST_LOCATION );
+  }
+  {
+    auto value = LayoutLength( 10 ) - 9.9f;
+    DALI_TEST_EQUALS( typeid(value).name(), typeid(LayoutLength).name(), TEST_LOCATION );
+  }
+  {
+    auto value = 2.0f - LayoutLength( 10 );
+    DALI_TEST_EQUALS( typeid(value).name(), typeid(LayoutLength).name(), TEST_LOCATION );
+  }
+
+  // operator*
+  {
+    auto value = LayoutLength() * LayoutLength( 10 );
+    DALI_TEST_EQUALS( typeid(value).name(), typeid(LayoutLength).name(), TEST_LOCATION );
+  }
+  {
+    auto value = LayoutLength( 10 ) * 2;
+    DALI_TEST_EQUALS( typeid(value).name(), typeid(LayoutLength).name(), TEST_LOCATION );
+  }
+  {
+    auto value = 10 * LayoutLength( 10 );
+    DALI_TEST_EQUALS( typeid(value).name(), typeid(LayoutLength).name(), TEST_LOCATION );
+  }
+  {
+    auto value = LayoutLength( 10 ) * 2.1f;
+    DALI_TEST_EQUALS( typeid(value).name(), typeid(LayoutLength).name(), TEST_LOCATION );
+  }
+  {
+    auto value = 1.0f * LayoutLength( 10 );
+    DALI_TEST_EQUALS( typeid(value).name(), typeid(LayoutLength).name(), TEST_LOCATION );
+  }
+  // operator/
+  {
+    auto value = LayoutLength( 10 ) / 2.0f;
+    DALI_TEST_EQUALS( typeid(value).name(), typeid(LayoutLength).name(), TEST_LOCATION );
+  }
+
+  // combinations
+  {
+    auto value = ( LayoutLength( 10 ) * 2.0f ) / 1.5f;
+    DALI_TEST_EQUALS( typeid(value).name(), typeid(LayoutLength).name(), TEST_LOCATION );
+  }
+  {
+    auto value = 20 + ( LayoutLength( 10 ) * 2.0f ) / 1.5f;
+    DALI_TEST_EQUALS( typeid(value).name(), typeid(LayoutLength).name(), TEST_LOCATION );
+  }
+
+  END_TEST;
+}
+
+int UtcDaliLayouting_LayoutLength_Values(void)
+{
+  tet_infoline("UtcDaliLayouting_LayoutLength Values");
+
+  // operator+
+  {
+    LayoutLength value = LayoutLength( 10 ) + LayoutLength();
+    DALI_TEST_EQUALS( value.AsInteger(), 10.0f, 0.0001f, TEST_LOCATION );
+  }
+  {
+    LayoutLength value = LayoutLength( 10 ) + 20;
+    DALI_TEST_EQUALS( value.AsInteger(), 30.0f, 0.0001f, TEST_LOCATION );
+  }
+  {
+    LayoutLength value = 22 - LayoutLength( 10 );
+    DALI_TEST_EQUALS( value.AsInteger(), 12.0f, 0.0001f, TEST_LOCATION );
+  }
+  {
+    LayoutLength value = LayoutLength( 10 ) + 2.1f;
+    DALI_TEST_EQUALS( value.AsDecimal(), 12.1f, 0.0001f, TEST_LOCATION );
+    DALI_TEST_EQUALS( value.AsTruncated(), 12.0f, 0.0001f, TEST_LOCATION );
+  }
+  {
+    LayoutLength value = 2.3f - LayoutLength( 10 );
+    DALI_TEST_EQUALS( value.AsDecimal(), -7.7f, 0.0001f, TEST_LOCATION );
+    DALI_TEST_EQUALS( value.AsInteger(), -8.0f, 0.0001f, TEST_LOCATION );
+    DALI_TEST_EQUALS( value.AsTruncated(), -7.0f, 0.0001f, TEST_LOCATION );
+  }
+  // operator-
+  {
+    LayoutLength value = LayoutLength() - LayoutLength( 10 );
+    DALI_TEST_EQUALS( value.AsInteger(), -10.0f, 0.0001f, TEST_LOCATION );
+  }
+  {
+    LayoutLength value = LayoutLength( 10 ) - 99;
+    DALI_TEST_EQUALS( value.AsInteger(), -89.0f, 0.0001f, TEST_LOCATION );
+  }
+  {
+    LayoutLength value = 20 - LayoutLength( 10 );
+    DALI_TEST_EQUALS( value.AsInteger(), 10.0f, 0.0001f, TEST_LOCATION );
+    DALI_TEST_EQUALS( value.AsTruncated(), 10.f, 0.0001f, TEST_LOCATION );
+  }
+  {
+    LayoutLength value = LayoutLength( 10 ) - 9.9f;
+    DALI_TEST_EQUALS( value.AsInteger(), 0.0f, 0.0001f, TEST_LOCATION );
+    DALI_TEST_EQUALS( value.AsDecimal(), 0.1f, 0.0001f, TEST_LOCATION );
+    DALI_TEST_EQUALS( value.AsTruncated(), 0.0f, 0.0001f, TEST_LOCATION );
+  }
+  {
+    LayoutLength value = 10.9f - LayoutLength( 10 );
+    DALI_TEST_EQUALS( value.AsInteger(), 1.0f, 0.0001f, TEST_LOCATION );
+    DALI_TEST_EQUALS( value.AsDecimal(), 0.9f, 0.0001f, TEST_LOCATION );
+    DALI_TEST_EQUALS( value.AsTruncated(), 0.0f, 0.0001f, TEST_LOCATION );
+  }
+  // operator*
+  {
+    LayoutLength value = LayoutLength() * LayoutLength( 10 );
+    DALI_TEST_EQUALS( value.AsInteger(), 0.0f, 0.0001f, TEST_LOCATION );
+  }
+  {
+    LayoutLength value = LayoutLength(1) * 10;
+    DALI_TEST_EQUALS( value.AsInteger(), 10.0f, 0.0001f, TEST_LOCATION );
+  }
+  {
+    LayoutLength value = 11 * LayoutLength( 10 );
+    DALI_TEST_EQUALS( value.AsInteger(), 110.0f, 0.0001f, TEST_LOCATION );
+  }
+  {
+    LayoutLength value = LayoutLength( 10 ) * 2.12f;
+    DALI_TEST_EQUALS( value.AsDecimal(), 21.2f, 0.0001f, TEST_LOCATION );
+    DALI_TEST_EQUALS( value.AsInteger(), 21.0f, 0.0001f, TEST_LOCATION );
+    DALI_TEST_EQUALS( value.AsTruncated(), 21.0f, 0.0001f, TEST_LOCATION );
+  }
+  {
+    LayoutLength value = 2.189f * LayoutLength( 10 );
+    DALI_TEST_EQUALS( value.AsDecimal(), 21.89f, 0.0001f, TEST_LOCATION );
+    DALI_TEST_EQUALS( value.AsInteger(), 22.0f, 0.0001f, TEST_LOCATION );
+    DALI_TEST_EQUALS( value.AsTruncated(), 21.0f, 0.0001f, TEST_LOCATION );
+  }
+  // operator/
+  {
+    LayoutLength value = LayoutLength( 11 ) / 2.0f;
+    DALI_TEST_EQUALS( value.AsDecimal(), 5.5f, 0.0001f, TEST_LOCATION );
+    DALI_TEST_EQUALS( value.AsInteger(), 6.0f, 0.0001f, TEST_LOCATION );
+  }
+
+  // combinations
+  {
+    LayoutLength value;
+    value = 20 + ( LayoutLength( 10 ) * 2.0f ) / 1.5f;
+    DALI_TEST_EQUALS( value.AsInteger(), 33.0f, 0.0001f, TEST_LOCATION );
+    DALI_TEST_EQUALS( value.AsDecimal(), 33.3333f, 0.0001f, TEST_LOCATION );
+  }
+  {
+    uint16_t padding( 1 );
+    LayoutLength right(35), left(10), mTotalLength(2);
+    LayoutLength value;
+    value = padding + ( right - left - mTotalLength ) / 2.0f;
+    //    = 1 + ( 35 - 10 - 2 ) / 2
+    DALI_TEST_EQUALS( value.AsInteger(), 13.0f, 0.0001f, TEST_LOCATION );
+    DALI_TEST_EQUALS( value.AsDecimal(), 12.5f, 0.0001f, TEST_LOCATION );
+  }
+  {
+    uint16_t padding = 1, top = 2, bottom = 3;
+    LayoutLength childSpace( 44 ), childHeight( 23 );
+    LayoutLength value;
+    value = padding + ( ( childSpace - childHeight ) / 2.0f ) + top - bottom;
+    //    = 1       + ( ( 44 - 23                  ) / 2 ) + 2 - 3
+    DALI_TEST_EQUALS( value.AsInteger(), 11.0f, 0.0001f, TEST_LOCATION );
+    DALI_TEST_EQUALS( value.AsDecimal(), 10.5f, 0.0001f, TEST_LOCATION );
+  }
+
+  END_TEST;
+}
+
+int UtcDaliLayouting_LayoutLength_Operators(void)
+{
+  tet_infoline("UtcDaliLayouting_LayoutLength operators");
+
+  {
+    LayoutLength value = 10;
+    DALI_TEST_EQUALS( (int)value.AsInteger(), 10, TEST_LOCATION );
+    value += 1;
+    DALI_TEST_EQUALS( (int)value.AsInteger(), 11, TEST_LOCATION );
+    value -= 12;
+    DALI_TEST_EQUALS( (int)value.AsInteger(), -1, TEST_LOCATION );
+    LayoutLength value2 = value;
+    DALI_TEST_EQUALS( value == value2, true, TEST_LOCATION );
+    value2 = 123;
+    DALI_TEST_EQUALS( value != value2, true, TEST_LOCATION );
+    DALI_TEST_EQUALS( value < value2, true, TEST_LOCATION );
+    DALI_TEST_EQUALS( value <= value2, true, TEST_LOCATION );
+    value = 456;
+    DALI_TEST_EQUALS( value > value2, true, TEST_LOCATION );
+    DALI_TEST_EQUALS( value >= value2, true, TEST_LOCATION );
+  }
+
+  {
+    LayoutLength value( 123 );
+    std::stringstream ss;
+    ss << value;
+    DALI_TEST_EQUALS( ss.str(), "123", TEST_LOCATION );
+  }
+  {
+    LayoutLength value( 0.123f );
+    std::stringstream ss;
+    ss << value;
+    DALI_TEST_EQUALS( ss.str(), "0.123", TEST_LOCATION );
+  }
+  END_TEST;
+}
+
 int UtcDaliLayouting_HboxLayout01(void)
 {
   ToolkitTestApplication application;
diff --git a/automated-tests/src/dali-toolkit/utc-Dali-WebView.cpp b/automated-tests/src/dali-toolkit/utc-Dali-WebView.cpp
new file mode 100644 (file)
index 0000000..f2a4f75
--- /dev/null
@@ -0,0 +1,279 @@
+/*
+ * Copyright (c) 2018 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <iostream>
+#include <stdlib.h>
+
+#include <dali-toolkit-test-suite-utils.h>
+#include "dali-toolkit-test-utils/toolkit-timer.h"
+
+#include <dali.h>
+#include <dali/integration-api/events/key-event-integ.h>
+#include <dali/integration-api/events/touch-event-integ.h>
+#include <dali-toolkit/public-api/focus-manager/keyboard-focus-manager.h>
+#include <dali-toolkit/devel-api/controls/web-view/web-view.h>
+
+
+using namespace Dali;
+using namespace Toolkit;
+
+namespace
+{
+
+const char* const TEST_URL1( "http://www.somewhere.valid1.com" );
+const char* const TEST_URL2( "http://www.somewhere.valid2.com" );
+
+static int gPageLoadStartedCallbackCalled = 0;
+static int gPageLoadFinishedCallbackCalled = 0;
+static bool gTouched = false;
+
+struct CallbackFunctor
+{
+  CallbackFunctor(bool* callbackFlag)
+  : mCallbackFlag( callbackFlag )
+  {
+  }
+
+  void operator()()
+  {
+    *mCallbackFlag = true;
+  }
+  bool* mCallbackFlag;
+};
+
+static void OnPageLoadStarted( WebView view, const std::string& url )
+{
+  gPageLoadStartedCallbackCalled++;
+}
+
+static void OnPageLoadFinished( WebView view, const std::string& url )
+{
+  gPageLoadFinishedCallbackCalled++;
+}
+
+static bool OnTouched( Actor actor, const Dali::TouchData& touch )
+{
+  gTouched = true;
+  return true;
+}
+
+} // namespace
+
+void web_view_startup(void)
+{
+  test_return_value = TET_UNDEF;
+}
+
+void web_view_cleanup(void)
+{
+  test_return_value = TET_PASS;
+}
+
+int UtcDaliWebViewBasics(void)
+{
+  ToolkitTestApplication application;
+
+  // Copy and Assignment Test
+  tet_infoline( "UtcDaliWebViewBasic Copy and Assignment Test" );
+  WebView view = WebView::New();
+  DALI_TEST_CHECK( view );
+
+  WebView copy( view );
+  DALI_TEST_CHECK( view == copy );
+
+  WebView assign;
+  DALI_TEST_CHECK( !assign );
+
+  assign = copy;
+  DALI_TEST_CHECK( assign == view );
+
+
+  // DownCast Test
+  tet_infoline( "UtcDaliWebViewBasic DownCast Test" );
+  BaseHandle handle(view);
+
+  WebView view2 = WebView::DownCast( handle );
+  DALI_TEST_CHECK( view );
+  DALI_TEST_CHECK( view2 );
+  DALI_TEST_CHECK( view == view2 );
+
+
+  // TypeRegistry Test
+  tet_infoline( "UtcDaliWebViewBasic TypeRegistry Test" );
+  TypeRegistry typeRegistry = TypeRegistry::Get();
+  DALI_TEST_CHECK( typeRegistry );
+
+  TypeInfo typeInfo = typeRegistry.GetTypeInfo( "WebView" );
+  DALI_TEST_CHECK( typeInfo );
+
+  BaseHandle handle2 = typeInfo.CreateInstance();
+  DALI_TEST_CHECK( handle2 );
+
+  WebView view3 = WebView::DownCast( handle2 );
+  DALI_TEST_CHECK( view3 );
+
+  END_TEST;
+}
+
+int UtcDaliWebViewPageNavigation(void)
+{
+  ToolkitTestApplication application;
+
+  WebView view = WebView::New();
+  view.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+  view.SetParentOrigin( ParentOrigin::TOP_LEFT );
+  view.SetPosition( 0, 0 );
+  view.SetSize( 800, 600 );
+  Stage::GetCurrent().Add( view );
+  application.SendNotification();
+  application.Render();
+  DALI_TEST_CHECK( view );
+
+  ConnectionTracker* testTracker = new ConnectionTracker();
+  view.PageLoadStartedSignal().Connect( &OnPageLoadStarted );
+  view.PageLoadFinishedSignal().Connect( &OnPageLoadFinished );
+  bool signal1 = false;
+  bool signal2 = false;
+  bool signal3 = false;
+  view.ConnectSignal( testTracker, "pageLoadStarted", CallbackFunctor(&signal1) );
+  view.ConnectSignal( testTracker, "pageLoadFinished", CallbackFunctor(&signal2) );
+  view.ConnectSignal( testTracker, "invalidname", CallbackFunctor(&signal3) );
+  DALI_TEST_EQUALS( gPageLoadStartedCallbackCalled, 0, TEST_LOCATION );
+  DALI_TEST_EQUALS( gPageLoadFinishedCallbackCalled, 0, TEST_LOCATION );
+
+
+  view.LoadUrl( TEST_URL1 );
+  view.GetNaturalSize();
+  Test::EmitGlobalTimerSignal();
+  DALI_TEST_CHECK( view.GetUrl().find( TEST_URL1 ) != std::string::npos );
+  DALI_TEST_EQUALS( view.CanGoBack(), false, TEST_LOCATION );
+  DALI_TEST_EQUALS( gPageLoadStartedCallbackCalled, 1, TEST_LOCATION );
+  DALI_TEST_EQUALS( gPageLoadFinishedCallbackCalled, 1, TEST_LOCATION );
+  DALI_TEST_CHECK( signal1 & signal2 );
+  DALI_TEST_CHECK( !signal3 );
+
+  view.LoadUrl( TEST_URL2 );
+  view.SetSize( 400, 300 );
+  application.SendNotification();
+  application.Render();
+  Test::EmitGlobalTimerSignal();
+  DALI_TEST_CHECK( view.GetUrl().find( TEST_URL2 ) != std::string::npos );
+  DALI_TEST_EQUALS( view.CanGoBack(), true, TEST_LOCATION );
+  DALI_TEST_EQUALS( view.CanGoForward(), false, TEST_LOCATION );
+  DALI_TEST_EQUALS( gPageLoadStartedCallbackCalled, 2, TEST_LOCATION );
+  DALI_TEST_EQUALS( gPageLoadFinishedCallbackCalled, 2, TEST_LOCATION );
+
+  view.GoBack();
+  Test::EmitGlobalTimerSignal();
+  DALI_TEST_CHECK( !view.CanGoBack() );
+  DALI_TEST_CHECK( view.CanGoForward() );
+
+  view.GoForward();
+  Test::EmitGlobalTimerSignal();
+  DALI_TEST_CHECK( view.CanGoBack() );
+  DALI_TEST_CHECK( !view.CanGoForward() );
+
+  view.Reload();
+  view.StopLoading();
+  view.ClearHistory();
+  view.ClearCache();
+  Test::EmitGlobalTimerSignal();
+  DALI_TEST_CHECK( !view.CanGoBack() );
+  DALI_TEST_CHECK( !view.CanGoForward() );
+
+  END_TEST;
+}
+
+int UtcDaliWebViewTouchAndKeys(void)
+{
+  ToolkitTestApplication application;
+
+  WebView view = WebView::New();
+  view.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+  view.SetParentOrigin( ParentOrigin::TOP_LEFT );
+  view.SetPosition( 0, 0 );
+  view.SetSize( 800, 600 );
+
+  Stage::GetCurrent().Add( view );
+  application.SendNotification();
+  application.Render();
+
+  view.GetNaturalSize();
+  view.TouchSignal().Connect( &OnTouched );
+
+  // Touch event
+  Dali::Integration::TouchEvent event;
+  Dali::Integration::Point pointDown, pointUp;
+
+  event = Dali::Integration::TouchEvent();
+  pointDown.SetState( PointState::DOWN );
+  pointDown.SetScreenPosition( Vector2( 10, 10 ) );
+  event.AddPoint( pointDown );
+  application.ProcessEvent( event );
+
+  event = Dali::Integration::TouchEvent();
+  pointUp.SetState( PointState::UP );
+  pointUp.SetScreenPosition( Vector2( 10, 10 ) );
+  event.AddPoint( pointUp );
+  application.ProcessEvent( event );
+
+  // Key event
+  Toolkit::KeyboardFocusManager::Get().SetCurrentFocusActor( view );
+  application.ProcessEvent( Integration::KeyEvent( "", "", DALI_KEY_ESCAPE, 0, 0, Integration::KeyEvent::Down, "", "", Device::Class::NONE, Device::Subclass::NONE ) );
+  application.SendNotification();
+
+  DALI_TEST_CHECK( gTouched );
+  DALI_TEST_CHECK( view );
+
+  END_TEST;
+}
+
+int UtcDaliWebViewProperty1(void)
+{
+  ToolkitTestApplication application;
+
+  WebView view = WebView::New();
+  DALI_TEST_CHECK( view );
+
+  std::string local;
+  view.SetProperty( WebView::Property::URL, TEST_URL1 );
+  Property::Value val = view.GetProperty( WebView::Property::URL );
+  DALI_TEST_CHECK( val.Get( local ) );
+  DALI_TEST_EQUALS( local, TEST_URL1, TEST_LOCATION );
+
+  END_TEST;
+}
+
+int UtcDaliWebViewMethodsForCoverage(void)
+{
+  ToolkitTestApplication application;
+
+  WebView view = WebView::New( "ko-KR", "Asia/Seoul" );
+
+  view.LoadHTMLString( "<body>Hello World!</body>" );
+  view.AddJavaScriptInterface( "jsObject", "jsFunction",
+    []( const std::string& arg ) -> std::string {
+      return arg + " World!";
+    }
+  );
+  view.EvaluateJavaScript( "jsObject.jsFunction('Hello')" );
+  view.RemoveJavascriptInterface( "jsObject", "jsFunction" );
+
+  DALI_TEST_CHECK( view );
+
+  END_TEST;
+}
index bbaf116..62fa7ae 100644 (file)
@@ -144,6 +144,7 @@ develapipageturnviewdir =       $(develapicontrolsdir)/page-turn-view
 develapipopupdir =              $(develapicontrolsdir)/popup
 develapishadowviewdir =         $(develapicontrolsdir)/shadow-view
 develapisuperblurviewdir =      $(develapicontrolsdir)/super-blur-view
+develapiwebviewdir =            $(develapicontrolsdir)/web-view
 develapifocusmanagerdir =       $(develapidir)/focus-manager
 develapiimageloaderdir =        $(develapidir)/image-loader
 develapilayoutingdir =          $(develapidir)/layouting
@@ -183,6 +184,7 @@ develapishadowview_HEADERS =        $(devel_api_shadow_view_header_files)
 develapishadereffects_HEADERS =     $(devel_api_shader_effects_header_files)
 develapistyling_HEADERS =           $(devel_api_styling_header_files)
 develapisuperblurview_HEADERS =     $(devel_api_super_blur_view_header_files)
+develapiwebview_HEADERS =           $(devel_api_web_view_header_files)
 develapitoolbar_HEADERS =           $(devel_api_tool_bar_header_files)
 develapitooltip_HEADERS =           $(devel_api_tooltip_header_files)
 develapitransitioneffects_HEADERS = $(devel_api_transition_effects_header_files)
diff --git a/dali-toolkit/devel-api/controls/web-view/web-view.cpp b/dali-toolkit/devel-api/controls/web-view/web-view.cpp
new file mode 100644 (file)
index 0000000..0b3698b
--- /dev/null
@@ -0,0 +1,161 @@
+/*
+ * Copyright (c) 2018 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include <dali-toolkit/devel-api/controls/web-view/web-view.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/internal/controls/web-view/web-view-impl.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+WebView::WebView()
+{
+}
+
+WebView::WebView( const WebView& WebView )
+: Control( WebView )
+{
+}
+
+WebView& WebView::operator=( const WebView& view )
+{
+  if( &view != this )
+  {
+    Control::operator=( view );
+  }
+
+  return *this;
+}
+
+WebView::~WebView()
+{
+}
+
+WebView WebView::New()
+{
+  return Internal::WebView::New();
+}
+
+WebView WebView::New( const std::string& locale, const std::string& timezoneId )
+{
+  return Internal::WebView::New( locale, timezoneId );
+}
+
+WebView WebView::DownCast( BaseHandle handle )
+{
+  return Control::DownCast< WebView, Internal::WebView >( handle );
+}
+
+void WebView::LoadUrl( const std::string& url )
+{
+  Dali::Toolkit::GetImpl( *this ).LoadUrl( url );
+}
+
+const std::string& WebView::GetUrl()
+{
+  return Dali::Toolkit::GetImpl( *this ).GetUrl();
+}
+
+void WebView::LoadHTMLString( const std::string& htmlString )
+{
+  Dali::Toolkit::GetImpl( *this ).LoadHTMLString( htmlString );
+}
+
+void WebView::Reload()
+{
+  Dali::Toolkit::GetImpl( *this ).Reload();
+}
+
+void WebView::StopLoading()
+{
+  Dali::Toolkit::GetImpl( *this ).StopLoading();
+}
+
+bool WebView::CanGoForward()
+{
+  return Dali::Toolkit::GetImpl( *this ).CanGoForward();
+}
+
+void WebView::GoForward()
+{
+  Dali::Toolkit::GetImpl( *this ).GoForward();
+}
+
+bool WebView::CanGoBack()
+{
+  return Dali::Toolkit::GetImpl( *this ).CanGoBack();
+}
+
+void WebView::GoBack()
+{
+  Dali::Toolkit::GetImpl( *this ).GoBack();
+}
+
+void WebView::EvaluateJavaScript( const std::string& script )
+{
+  Dali::Toolkit::GetImpl( *this ).EvaluateJavaScript( script );
+}
+
+void WebView::AddJavaScriptInterface( const std::string& exposedObjectName, const std::string& jsFunctionName, std::function< std::string(const std::string&) > callback )
+{
+  Dali::Toolkit::GetImpl( *this ).AddJavaScriptInterface( exposedObjectName, jsFunctionName, callback );
+}
+
+void WebView::RemoveJavascriptInterface( const std::string& exposedObjectName, const std::string& jsFunctionName )
+{
+  Dali::Toolkit::GetImpl( *this ).RemoveJavascriptInterface( exposedObjectName, jsFunctionName );
+}
+
+void WebView::ClearHistory()
+{
+  Dali::Toolkit::GetImpl( *this ).ClearHistory();
+}
+
+void WebView::ClearCache()
+{
+  Dali::Toolkit::GetImpl( *this ).ClearCache();
+}
+
+WebView::WebViewSignalType& WebView::PageLoadStartedSignal()
+{
+  return Dali::Toolkit::GetImpl( *this ).PageLoadStartedSignal();
+}
+
+WebView::WebViewSignalType& WebView::PageLoadFinishedSignal()
+{
+  return Dali::Toolkit::GetImpl( *this ).PageLoadFinishedSignal();
+}
+
+WebView::WebView( Internal::WebView& implementation )
+: Control( implementation )
+{
+}
+
+WebView::WebView( Dali::Internal::CustomActor* internal )
+: Control( internal )
+{
+  VerifyCustomActorPointer< Internal::WebView >( internal );
+}
+
+} // namespace Toolkit
+
+} // namespace Dali
diff --git a/dali-toolkit/devel-api/controls/web-view/web-view.h b/dali-toolkit/devel-api/controls/web-view/web-view.h
new file mode 100644 (file)
index 0000000..71d05d3
--- /dev/null
@@ -0,0 +1,269 @@
+#ifndef DALI_TOOLKIT_WEB_VIEW_H
+#define DALI_TOOLKIT_WEB_VIEW_H
+
+/*
+ * Copyright (c) 2018 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <functional>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/controls/control.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Internal DALI_INTERNAL
+{
+  class WebView;
+} // namespace Internal
+
+/**
+ * @addtogroup dali_toolkit_controls_web_view
+ * @{
+ */
+
+/**
+ * @brief WebView is a control for displaying web content.
+ *
+ * This enables embedding web pages in the application.
+ *
+ * For working WebView, a web engine plugin for a platform should be provided.
+ *
+ */
+class DALI_TOOLKIT_API WebView : public Control
+{
+public:
+
+  /**
+   * @brief Enumeration for the start and end property ranges for this control.
+   */
+  enum PropertyRange
+  {
+    PROPERTY_START_INDEX = Control::CONTROL_PROPERTY_END_INDEX + 1,
+    PROPERTY_END_INDEX = PROPERTY_START_INDEX + 1000,
+  };
+
+  /**
+   * @brief Enumeration for the instance of properties belonging to the WebView class.
+   */
+  struct Property
+  {
+    enum
+    {
+      /**
+       * @brief name "url", type string
+       *
+       * @details Sets the url to load
+       */
+      URL = PROPERTY_START_INDEX
+    };
+  };
+
+  typedef Signal< void ( WebView, const std::string& ) > WebViewSignalType;
+
+public:
+
+  /**
+   * @brief Creates an initialized WebView.
+   * @return A handle to a newly allocated Dali WebView
+   *
+   * @note WebView will not display anything
+   */
+  static WebView New();
+
+  /**
+   * @brief Creates an initialized WebView.
+   *
+   * @param [in] locale The locale of Web
+   * @param [in] timezoneId The timezoneId of Web
+   */
+  static WebView New( const std::string& locale, const std::string& timezoneId );
+
+  /**
+   * @brief Creates an uninitialized WebView.
+   */
+  WebView();
+
+  /**
+   * @brief Destructor.
+   *
+   * This is non-virtual since derived Handel types must not contain data or virtual methods.
+   */
+  ~WebView();
+
+  /*
+   * @brief Copy constructor.
+   *
+   * @param[in] WebView WebView to copy. The copied WebView will point at the same implementation
+   */
+  WebView( const WebView& WebView );
+
+  /**
+   * @brief Assignment operator.
+   *
+   * @param[in] WebView The WebView to assign from
+   * @return The updated WebView
+   */
+  WebView& operator=( const WebView& WebView );
+
+  /**
+   * @brief Downcasts a handle to WebView handle.
+   *
+   * If handle points to a WebView, the downcast produces valid handle.
+   * If not, the returned handle is left uninitialized.
+   *
+   * @param[in] handle Handle to an object
+   * @return Handle to a WebView or an uninitialized handle
+   */
+  static WebView DownCast( BaseHandle handle );
+
+  /**
+   * @brief Loads a web page based on a given URL.
+   *
+   * @param [in] url The URL of the resource to load
+   */
+  void LoadUrl( const std::string& url );
+
+  /**
+   * @brief Returns the URL of the Web.
+   *
+   * @return Url of string type
+   */
+  const std::string& GetUrl();
+
+  /**
+   * @brief Loads a given string as web contents.
+   *
+   * @param [in] htmlString The string to use as the contents of the web page
+   */
+  void LoadHTMLString( const std::string& htmlString );
+
+  /**
+   * @brief Reloads the Web.
+   */
+  void Reload();
+
+  /**
+   * @brief Stops loading web contents on the current page.
+   */
+  void StopLoading();
+
+  /**
+   * @brief Returns whether forward is possible.
+   *
+   * @return True if forward is possible, false otherwise
+   */
+  bool CanGoForward();
+
+  /**
+   * @brief Goes forward in the navigation history.
+   */
+  void GoForward();
+
+  /**
+   * @brief Returns whether backward is possible.
+   *
+   * @return True if backward is possible, false otherwise
+   */
+  bool CanGoBack();
+
+  /**
+   * @brief Goes back in the navigation history.
+   */
+  void GoBack();
+
+  /**
+    * @brief Evaluates JavaScript code represented as a string.
+    *
+    * @param[in] script The JavaScript code
+    */
+  void EvaluateJavaScript( const std::string& script );
+
+  /**
+    * @brief Adds a JavaScript interface.
+    *
+    * @param[in] exposedObjectName The name of exposed object
+    * @param[in] jsFunctionName The name of JavaScript function
+    * @param[in] callback The callback function
+    */
+  void AddJavaScriptInterface( const std::string& exposedObjectName, const std::string& jsFunctionName, std::function< std::string(const std::string&) > callback );
+
+  /**
+    * @brief Removes a JavaScript interface.
+    *
+    * @param[in] exposedObjectName The name of exposed object
+    * @param[in] jsFunctionName The name of JavaScript function
+    */
+  void RemoveJavascriptInterface( const std::string& exposedObjectName, const std::string& jsFunctionName );
+
+  /**
+   * @brief Clears the history of Web.
+   */
+  void ClearHistory();
+
+  /**
+   * @brief Clears the cache of Web.
+   */
+  void ClearCache();
+
+  /**
+   * @brief Connects to this signal to be notified when page loading is started.
+   *
+   * @return A signal object to connect with
+   */
+  WebViewSignalType& PageLoadStartedSignal();
+
+  /**
+   * @brief Connects to this signal to be notified when page loading is finished.
+   *
+   * @return A signal object to connect with
+   */
+  WebViewSignalType& PageLoadFinishedSignal();
+
+public: // Not intended for application developers
+
+  /// @cond internal
+  /**
+   * @brief Creates a handle using the Toolkit::Internal implementation.
+   *
+   * @param[in] implementation The WebView implementation
+   */
+  DALI_INTERNAL WebView( Internal::WebView& implementation );
+
+  /**
+   * @brief Allows the creation of this WebView from an Internal::CustomActor pointer.
+   *
+   * @param[in] internal A pointer to the internal CustomActor
+   */
+  explicit DALI_INTERNAL WebView( Dali::Internal::CustomActor* internal );
+  /// @endcond
+
+};
+
+/**
+ * @}
+ */
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // DALI_TOOLKIT_WEB_VIEW_H
index 754c815..48e1214 100755 (executable)
@@ -26,6 +26,7 @@ devel_api_src_files = \
   $(devel_api_src_dir)/controls/text-controls/text-selection-popup.cpp \
   $(devel_api_src_dir)/controls/text-controls/text-selection-toolbar.cpp \
   $(devel_api_src_dir)/controls/tool-bar/tool-bar.cpp \
+  $(devel_api_src_dir)/controls/web-view/web-view.cpp \
   $(devel_api_src_dir)/focus-manager/keyinput-focus-manager.cpp \
   $(devel_api_src_dir)/focus-manager/keyboard-focus-manager-devel.cpp \
   $(devel_api_src_dir)/image-loader/async-image-loader-devel.cpp \
@@ -186,3 +187,6 @@ devel_api_transition_effects_header_files = \
 
 devel_api_gaussian_blur_view_header_files = \
   $(devel_api_src_dir)/controls/gaussian-blur-view/gaussian-blur-view.h
+
+devel_api_web_view_header_files = \
+  $(devel_api_src_dir)/controls/web-view/web-view.h
index 8cdd8bc..856ca18 100644 (file)
@@ -288,7 +288,7 @@ void LayoutGroup::DoRegisterChildProperties( const std::string& containerType )
 
 void LayoutGroup::OnSetChildProperties( Handle& handle, Property::Index index, Property::Value value )
 {
-  DALI_LOG_INFO( gLogFilter, Debug::Verbose, "LayoutGroup::OnSetChildProperties property(%s)\n", handle.GetPropertyName(index).c_str());
+  DALI_LOG_STREAM( gLogFilter, Debug::Verbose, "LayoutGroup::OnSetChildProperties property(" << handle.GetPropertyName(index) << ")\n" );
 
   if ( ( ( index >= CHILD_PROPERTY_REGISTRATION_START_INDEX ) &&
          ( index <= CHILD_PROPERTY_REGISTRATION_MAX_INDEX ) )
@@ -374,13 +374,13 @@ void LayoutGroup::MeasureChildWithMargins( LayoutItemPtr child,
   DALI_LOG_INFO( gLogFilter, Debug::Verbose, "LayoutGroup::MeasureChildWithMargins desiredWidth(%d)\n",  desiredWidth );
 
   MeasureSpec childWidthMeasureSpec = GetChildMeasureSpec( parentWidthMeasureSpec,
-                                                           padding.start + padding.end +
+                                                           LayoutLength( padding.start + padding.end ) +
                                                            widthUsed, desiredWidth );
 
   DALI_LOG_INFO( gLogFilter, Debug::Verbose, "LayoutGroup::MeasureChildWithMargins desiredHeight(%d)\n",  desiredHeight );
 
   MeasureSpec childHeightMeasureSpec = GetChildMeasureSpec( parentHeightMeasureSpec,
-                                                            padding.top + padding.bottom +
+                                                            LayoutLength( padding.top + padding.bottom )+
                                                             heightUsed, desiredHeight );
 
   child->Measure( childWidthMeasureSpec, childHeightMeasureSpec );
@@ -395,9 +395,9 @@ MeasureSpec LayoutGroup::GetChildMeasureSpec(
   auto specMode = measureSpec.GetMode();
   LayoutLength specSize = measureSpec.GetSize();
 
-  auto size = std::max( LayoutLength(0), specSize - padding ); // reduce available size by the owners padding
+  LayoutLength size = std::max( LayoutLength(0), specSize - padding ); // reduce available size by the owners padding
 
-  MeasureSpec::IntType resultSize = 0;
+  LayoutLength resultSize = 0;
   MeasureSpec::Mode resultMode = MeasureSpec::Mode::UNSPECIFIED;
 
   switch( specMode )
@@ -489,8 +489,7 @@ MeasureSpec LayoutGroup::GetChildMeasureSpec(
     }
   }
 
-  DALI_LOG_INFO( gLogFilter, Debug::Verbose, "LayoutGroup::GetChildMeasureSpec resultSize(%u)\n", resultSize );
-
+  DALI_LOG_STREAM( gLogFilter, Debug::Verbose, "LayoutGroup::GetChildMeasureSpec resultSize(" << resultSize << ")\n" );
 
   //noinspection ResourceType
   return MeasureSpec( resultSize, resultMode );
@@ -602,10 +601,8 @@ void LayoutGroup::ChildAddedToOwner( Actor child )
       }
       childLayout->SetAnimateLayout( IsLayoutAnimated() ); // @todo this essentially forces animation inheritance. Bad?
 
-      DALI_LOG_STREAM( gLogFilter, Debug::Verbose, "LayoutGroup::ChildAddedToOwner control:" <<  control.GetName().c_str() <<
-                       " desiredWidth: " <<  control.GetNaturalSize().width <<
-                       " desiredHeight:"  << control.GetNaturalSize().height
-                       );
+      DALI_LOG_STREAM( gLogFilter, Debug::Verbose, "LayoutGroup::ChildAddedToOwner control:" <<  control.GetName() <<
+                       " desiredWidth: " <<  control.GetNaturalSize().width << " desiredHeight:"  << control.GetNaturalSize().height );
 
       childControlDataImpl.SetLayout( *childLayout.Get() );
 
@@ -758,14 +755,14 @@ void LayoutGroup::OnMeasure( MeasureSpec widthMeasureSpec, MeasureSpec heightMea
 
         // Get size of child
         MeasureChild( childLayout, widthMeasureSpec, heightMeasureSpec );
-        auto childWidth = childLayout->GetMeasuredWidth();
-        auto childHeight = childLayout->GetMeasuredHeight();
-        auto childMargin = childLayout->GetMargin();
-        DALI_LOG_INFO( gLogFilter, Debug::Verbose, "LayoutGroup::OnMeasure child width[%d] height(%d)\n", childWidth.mValue, childHeight.mValue );
+        LayoutLength childWidth = childLayout->GetMeasuredWidth();
+        LayoutLength childHeight = childLayout->GetMeasuredHeight();
+        Extents childMargin = childLayout->GetMargin();
+        DALI_LOG_STREAM( gLogFilter, Debug::Verbose, "LayoutGroup::OnMeasure child width[" << childWidth << "] height[" << childHeight << "]\n" );
 
         layoutWidth = std::max( layoutWidth, childWidth + childMargin.start + childMargin.end );
         layoutHeight = std::max( layoutHeight, childHeight + childMargin.top + childMargin.bottom );
-        DALI_LOG_INFO( gLogFilter, Debug::Verbose, "LayoutGroup::OnMeasure calculated child width[%d] calculated height(%d)\n", layoutWidth.mValue, layoutHeight.mValue );
+        DALI_LOG_STREAM( gLogFilter, Debug::Verbose, "LayoutGroup::OnMeasure calculated child width[" << layoutWidth << "] height[" << layoutHeight << "]\n" );
       }
       else
       {
@@ -818,7 +815,7 @@ void LayoutGroup::OnMeasure( MeasureSpec widthMeasureSpec, MeasureSpec heightMea
     layoutHeight = heightSpecSize;
   }
 
-  DALI_LOG_INFO( gLogFilter, Debug::General, "LayoutGroup::OnMeasure Measured size(%d,%d) for : %s \n", layoutWidth.mValue, layoutHeight.mValue, Actor::DownCast(GetOwner()).GetName().c_str() );
+  DALI_LOG_STREAM( gLogFilter, Debug::General, "LayoutGroup::OnMeasure Measured size(" << layoutWidth << "," << layoutHeight << ") for : " << Actor::DownCast(GetOwner()).GetName() << " \n" );
   SetMeasuredDimensions( MeasuredSize( layoutWidth ), MeasuredSize( layoutHeight ) );
 }
 
@@ -835,20 +832,17 @@ void LayoutGroup::OnLayout( bool changed, LayoutLength left, LayoutLength top, L
     {
 
       auto childOwner = childLayout->GetOwner();
-      auto childWidth = childLayout->GetMeasuredWidth();
-      auto childHeight = childLayout->GetMeasuredHeight();
-      auto childMargin = childLayout->GetMargin();
+      LayoutLength childWidth = childLayout->GetMeasuredWidth();
+      LayoutLength childHeight = childLayout->GetMeasuredHeight();
+      Extents childMargin = childLayout->GetMargin();
       auto control = Toolkit::Control::DownCast( childOwner );
       Extents padding = GetPadding();
 
       auto childPosition = control.GetProperty< Vector3 >( Actor::Property::POSITION );
       auto anchorPoint = control.GetProperty< Vector3 >( Actor::Property::ANCHOR_POINT );
 
-      DALI_LOG_INFO( gLogFilter, Debug::General, "LayoutGroup::OnLayout child[%s] position(%f,%f) child width[%d] height(%d)\n",
-                      control.GetName().c_str(),
-                      childPosition.x, childPosition.y,
-                      childWidth.mValue, childHeight.mValue
-                      );
+      DALI_LOG_STREAM( gLogFilter, Debug::General, "LayoutGroup::OnLayout child[" << control.GetName() <<
+                       "] position(" << childPosition << ") child width[" << childWidth << "] height[" << childHeight << "]\n" );
 
       // Margin and Padding only supported when child anchor point is TOP_LEFT.
       int paddingAndMarginOffsetX = ( AnchorPoint::TOP_LEFT == anchorPoint ) ? ( padding.top + childMargin.top ) : 0;
index 987b799..78cd532 100644 (file)
@@ -346,10 +346,7 @@ void LayoutItem::SetLayoutRequested()
 
 void LayoutItem::SetMeasuredDimensions( MeasuredSize measuredWidth, MeasuredSize measuredHeight )
 {
-  DALI_LOG_INFO( gLayoutFilter, Debug::Verbose, "LayoutItem::SetMeasuredDimensions width(%d) height(%d) \n",
-                                                 MeasureSpec::IntType( measuredWidth.GetSize() ),
-                                                 MeasureSpec::IntType( measuredHeight.GetSize() )
-               );
+  DALI_LOG_STREAM( gLayoutFilter, Debug::Verbose, "LayoutItem::SetMeasuredDimensions width(" << measuredWidth.GetSize() << ") height(" << measuredHeight.GetSize() << ") \n" );
 
   mImpl->SetPrivateFlag( Impl::PRIVATE_FLAG_MEASURED_DIMENSION_SET );
   mImpl->mMeasuredWidth = measuredWidth;
@@ -383,7 +380,7 @@ LayoutLength LayoutItem::GetSuggestedMinimumWidth() const
   auto actor = Actor::DownCast(owner);
   auto naturalSize = actor ? actor.GetNaturalSize() : Vector3::ZERO;
 
-  return std::max( mImpl->mMinimumSize.GetWidth(), LayoutLength::IntType( naturalSize.width ) );
+  return std::max( mImpl->mMinimumSize.GetWidth(), LayoutLength( naturalSize.width ) );
 }
 
 LayoutLength LayoutItem::GetSuggestedMinimumHeight() const
@@ -392,7 +389,7 @@ LayoutLength LayoutItem::GetSuggestedMinimumHeight() const
   auto actor = Actor::DownCast(owner);
   auto naturalSize = actor ? actor.GetNaturalSize() : Vector3::ZERO;
 
-  return std::max( mImpl->mMinimumSize.GetHeight(), LayoutLength::IntType(naturalSize.height) );
+  return std::max( mImpl->mMinimumSize.GetHeight(), LayoutLength( naturalSize.height ) );
 }
 
 MeasuredSize LayoutItem::ResolveSizeAndState( LayoutLength size, MeasureSpec measureSpec, MeasuredSize::State childMeasuredState )
@@ -439,16 +436,16 @@ bool LayoutItem::SetFrame( LayoutLength left, LayoutLength top, LayoutLength rig
 {
   bool changed = false;
 
-  DALI_LOG_INFO( gLayoutFilter, Debug::Verbose, "LayoutItem::SetFrame enter(%d, %d, %d, %d)\n", left.mValue, top.mValue, right.mValue, bottom.mValue );
+  DALI_LOG_STREAM( gLayoutFilter, Debug::Verbose, "LayoutItem::SetFrame enter(" << left << ", " << top << ", " << right << ", " << bottom << ")\n" );
 
   if( mImpl->mLeft != left || mImpl->mRight != right || mImpl->mTop != top || mImpl->mBottom != bottom || !mImpl->GetPrivateFlag( Impl::PRIVATE_FLAG_FORCE_SET_FRAME ) )
   {
     changed = true;
 
-    auto oldWidth = mImpl->mRight - mImpl->mLeft;
-    auto oldHeight = mImpl->mBottom - mImpl->mTop;
-    auto newWidth = right - left;
-    auto newHeight = bottom - top;
+    LayoutLength oldWidth = mImpl->mRight - mImpl->mLeft;
+    LayoutLength oldHeight = mImpl->mBottom - mImpl->mTop;
+    LayoutLength newWidth = right - left;
+    LayoutLength newHeight = bottom - top;
     bool sizeChanged = (newWidth != oldWidth) || (newHeight != oldHeight);
 
     mImpl->mLeft = left;
@@ -464,16 +461,16 @@ bool LayoutItem::SetFrame( LayoutLength left, LayoutLength top, LayoutLength rig
     auto actor = Actor::DownCast(owner);
     if( actor )
     {
-      DALI_LOG_INFO( gLayoutFilter, Debug::Verbose, "LayoutItem::SetFrame owner(%s) (%d, %d, %d, %d)\n",  actor.GetName().c_str(),
-                                    left.mValue, top.mValue, right.mValue, bottom.mValue );
+      DALI_LOG_STREAM( gLayoutFilter, Debug::Verbose, "LayoutItem::SetFrame owner(" << left << ", " << top << ", " << right << ", " << bottom << ")\n" );
+
       if( mImpl->mAnimated )
       {
         auto animation = Animation::New( 0.5f );
-        animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), float( left.mValue ) );
-        animation.AnimateTo( Property( actor, Actor::Property::POSITION_Y ), float( top.mValue ) );
+        animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), left.AsInteger() );
+        animation.AnimateTo( Property( actor, Actor::Property::POSITION_Y ), top.AsInteger() );
 
-        animation.AnimateTo( Property( actor, Actor::Property::SIZE_WIDTH ), float( newWidth ) );
-        animation.AnimateTo( Property( actor, Actor::Property::SIZE_HEIGHT ), float( newHeight ) );
+        animation.AnimateTo( Property( actor, Actor::Property::SIZE_WIDTH ), newWidth.AsInteger() );
+        animation.AnimateTo( Property( actor, Actor::Property::SIZE_HEIGHT ), newHeight.AsInteger() );
 
         animation.FinishedSignal().Connect( mSlotDelegate, &LayoutItem::OnLayoutAnimationFinished );
         animation.Play();
@@ -481,10 +478,10 @@ bool LayoutItem::SetFrame( LayoutLength left, LayoutLength top, LayoutLength rig
       else
       {
         // @todo Collate into list of Property & Property::Value pairs.
-        actor.SetX( float( left.mValue ) );
-        actor.SetY( float( top.mValue ) );
-        actor.SetProperty( Actor::Property::SIZE_WIDTH, float( newWidth ) );
-        actor.SetProperty( Actor::Property::SIZE_HEIGHT, float( newHeight ) );
+        actor.SetX( left.AsInteger() );
+        actor.SetY( top.AsInteger() );
+        actor.SetProperty( Actor::Property::SIZE_WIDTH, newWidth.AsInteger() );
+        actor.SetProperty( Actor::Property::SIZE_HEIGHT, newHeight.AsInteger() );
       }
     }
 
@@ -494,7 +491,7 @@ bool LayoutItem::SetFrame( LayoutLength left, LayoutLength top, LayoutLength rig
     }
   }
 
-  DALI_LOG_INFO( gLayoutFilter, Debug::Verbose, "LayoutItem::SetFrame  exit(%d, %d, %d, %d)\n", left.mValue, top.mValue, right.mValue, bottom.mValue );
+  DALI_LOG_STREAM( gLayoutFilter, Debug::Verbose, "LayoutItem::SetFrame  exit(" << left << ", " << top << ", " << right << ", " << bottom << ")\n" );
 
   return changed;
 }
@@ -505,7 +502,7 @@ void LayoutItem::OnLayoutAnimationFinished( Animation& animation )
   auto actor = Actor::DownCast(owner);
   if( actor )
   {
-    actor.SetSize( Vector3( mImpl->mRight-mImpl->mLeft, mImpl->mBottom-mImpl->mTop, 0.0f ) );
+    actor.SetSize( Vector3( mImpl->mRight.AsInteger() - mImpl->mLeft.AsInteger(), mImpl->mBottom.AsInteger() - mImpl->mTop.AsInteger(), 0.0f ) );
   }
 }
 
index 9953ed8..6004b77 100644 (file)
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
+// EXTERNAL INCLUDES
 #include <cstdint>
+#include <cmath>
 #include <iostream>
 
 namespace Dali
 {
+
 namespace Toolkit
 {
 
 /**
  * @brief A type that represents a layout length.
  *
- * Currently, this implies pixels, but could be extended to handle device dependant sizes, etc.
+ * Currently, this implies pixels, but could be extended to handle device dependent sizes, etc.
  */
 class LayoutLength
 {
 public:
-  using IntType = int;
 
-  LayoutLength( IntType value )
+  /**
+   * @brief default constructor, initialises to 0
+   */
+  LayoutLength()
+  : mValue( 0 )
+  {
+  }
+
+  /**
+   * @brief constructor
+   *
+   * @param value the value to initialise with
+   */
+  LayoutLength( int value )
   : mValue( value )
   {
   }
 
+  /**
+   * @brief constructor from float
+   *
+   * @param value the value to initialise with
+   */
+  LayoutLength( float value )
+  : mValue( value )
+  {
+  }
+
+  /**
+   * @brief constructor
+   *
+   * @param layoutLength the value to initialise with
+   */
   LayoutLength( const LayoutLength& layoutLength )
   : mValue( layoutLength.mValue )
   {
   }
 
-  LayoutLength& operator=(const LayoutLength& rhs)
+  /**
+   * @brief assignment operator
+   *
+   * @param rhs LayoutLength to assign
+   * @return reference to itself
+   */
+  LayoutLength& operator=( const LayoutLength& rhs )
   {
     if( this != &rhs )
     {
@@ -53,127 +90,219 @@ public:
     return *this;
   }
 
-  bool operator==( const LayoutLength& rhs )
+  /**
+   * @brief assignment operator from int
+   *
+   * @param value the value to assign
+   * @return reference to itself
+   */
+  LayoutLength& operator=( int value )
   {
-    return mValue == rhs.mValue;
+    mValue = value;
+    return *this;
   }
 
-  bool operator==( LayoutLength::IntType rhs )
+  /**
+   * @brief assignment operator from float
+   *
+   * @param value the value to assign
+   * @return reference to itself
+   */
+  LayoutLength& operator=( float value )
   {
-    return mValue == rhs;
+    mValue = value;
+    return *this;
   }
 
-  bool operator!=( const LayoutLength& rhs )
+  /**
+   * @brief plus equals operator
+   *
+   * @param rhs to add to this
+   * @return reference to itself
+   */
+  LayoutLength& operator+=( LayoutLength rhs )
   {
-    return !operator==(rhs);
+    mValue += rhs.mValue;
+    return *this;
   }
 
-  bool operator<( const LayoutLength& rhs )
+  /**
+   * @brief minus equals operator
+   *
+   * @param rhs to subtract from this
+   * @return reference to itself
+   */
+  LayoutLength& operator-=( LayoutLength rhs )
   {
-    return mValue < rhs.mValue;
+    mValue -= rhs.mValue;
+    return *this;
   }
 
-  bool operator<( const LayoutLength rhs ) const
+  /**
+   * @brief return value as decimal value (full raw value)
+   *
+   * @return the LayoutLength as full decimal value
+   */
+  float AsDecimal() const
   {
-    return mValue < rhs.mValue;
+    return mValue;
   }
 
-  bool operator<=( const LayoutLength& rhs )
+  /**
+   * @brief return value as rounded integer value (whole number)
+   *
+   * @return the LayoutLength rounded to next integer value
+   */
+  float AsInteger() const
   {
-    return mValue <= rhs.mValue;
-  }
-  bool operator<=( LayoutLength rhs )
-  {
-    return mValue <= rhs.mValue;
-  }
-  bool operator>( const LayoutLength& rhs )
-  {
-    return mValue > rhs.mValue;
-  }
-  bool operator>( LayoutLength rhs )
-  {
-    return mValue > rhs.mValue;
-  }
-  bool operator>=( const LayoutLength& rhs )
-  {
-    return mValue >= rhs.mValue;
-  }
-  bool operator>=( LayoutLength rhs )
-  {
-    return mValue >= rhs.mValue;
+    return round( mValue );
   }
 
-  LayoutLength operator+( const LayoutLength& rhs )
+  /**
+   * @brief return value as truncated integral value (whole number)
+   *
+   * @return the LayoutLength rounded to next integral value
+   */
+  float AsTruncated() const
   {
-    return mValue + rhs.mValue;
+    return trunc( mValue );
   }
 
-  LayoutLength operator+( LayoutLength::IntType rhs )
-  {
-    return mValue + rhs;
-  }
+private:
 
-  LayoutLength operator-( const LayoutLength& rhs )
-  {
-    return mValue - rhs.mValue;
-  }
-  LayoutLength operator-( LayoutLength::IntType rhs )
-  {
-    return mValue - rhs;
-  }
+  float mValue;
 
-  LayoutLength& operator+=( const LayoutLength& rhs )
-  {
-    mValue += rhs.mValue;
-    return *this;
-  }
-  LayoutLength& operator+=( LayoutLength::IntType rhs )
-  {
-    mValue += rhs;
-    return *this;
-  }
+};
 
-  LayoutLength& operator-=( const LayoutLength& rhs )
-  {
-    mValue -= rhs.mValue;
-    return *this;
-  }
+/**
+ * @brief equal to operator
+ *
+ * @param lhs value to compare
+ * @param rhs value to compare against
+ * @note Using value instead of reference to allow conversions from int and float
+ * @return true if identical, false otherwise
+ */
+inline bool operator==( LayoutLength lhs, LayoutLength rhs )
+{
+  return lhs.AsDecimal() == rhs.AsDecimal();
+}
 
-  LayoutLength& operator-=( LayoutLength::IntType rhs )
-  {
-    mValue -= rhs;
-    return *this;
-  }
+/**
+ * @brief not equal to operator
+ *
+ * @param lhs value to compare
+ * @param rhs value to compare against
+ * @note Using value instead of reference to allow conversions from int and float
+ * @return true if value is not identical, false otherwise
+ */
+inline bool operator!=( LayoutLength lhs, LayoutLength rhs )
+{
+  return !operator==( lhs, rhs );
+}
 
-  LayoutLength operator/( const LayoutLength& rhs )
-  {
-    return mValue / rhs.mValue;
-  }
-  LayoutLength operator/(  LayoutLength::IntType rhs )
-  {
-    return mValue / rhs;
-  }
+/**
+ * @brief less than operator
+ *
+ * @param lhs value to compare
+ * @param rhs value to compare against
+ * @note Using value instead of reference to allow conversions from int and float
+ * @return true if lhs value is less, false otherwise
+ */
+inline bool operator<( LayoutLength lhs, LayoutLength rhs )
+{
+  return lhs.AsDecimal() < rhs.AsDecimal();
+}
 
-  LayoutLength operator*( const LayoutLength& rhs )
-  {
-    return mValue * rhs.mValue;
-  }
-  LayoutLength operator*( LayoutLength::IntType rhs )
-  {
-    return mValue * rhs;
-  }
-  LayoutLength operator*( float rhs )
-  {
-    return LayoutLength(LayoutLength::IntType(float(mValue) * rhs));
-  }
+/**
+ * @brief greater than operator
+ *
+ * @param lhs value to compare
+ * @param rhs value to compare against
+ * @note Using value instead of reference to allow conversions from int and float
+ * @return true if lhs value is greater, false otherwise
+ */
+inline bool operator>( LayoutLength lhs, LayoutLength rhs )
+{
+  return rhs < lhs;
+}
 
-  operator float()
-  {
-    return float( mValue );
-  }
+/**
+ * @brief less than or equal to operator
+ *
+ * @param lhs value to compare
+ * @param rhs value to compare against
+ * @note Using value instead of reference to allow conversions from int and float
+ * @return true if lhs value is less than or equal to, false otherwise
+ */
+inline bool operator<=( LayoutLength lhs, LayoutLength rhs )
+{
+  return !(lhs > rhs);
+}
 
-  IntType mValue;
-};
+/**
+ * @brief greater than or equal to operator
+ *
+ * @param lhs value to compare
+ * @param rhs value to compare against
+ * @note Using value instead of reference to allow conversions from int and float
+ * @return true if lhs value is greater than or equal to, false otherwise
+ */
+inline bool operator>=( LayoutLength lhs, LayoutLength rhs )
+{
+  return !(lhs < rhs);
+}
+
+/**
+ * @brief add two LayoutLengths
+ *
+ * @param lhs The LayoutLength to add
+ * @param rhs The LayoutLength to add
+ * @note Using value instead of reference to allow conversions from int and float
+ * @return the resulting LayoutLength
+ */
+inline LayoutLength operator+( LayoutLength lhs, LayoutLength rhs )
+{
+  return lhs.AsDecimal() + rhs.AsDecimal();
+}
+
+/**
+ * @brief subtract two LayoutLengths
+ *
+ * @param lhs The LayoutLength to subtract from
+ * @param rhs The LayoutLength to subtract
+ * @note Using value instead of reference to allow conversions from int and float
+ * @return the resulting LayoutLength
+ */
+inline LayoutLength operator-( LayoutLength lhs, LayoutLength rhs )
+{
+  return lhs.AsDecimal() - rhs.AsDecimal();
+}
+
+/**
+ * @brief multiply two LayoutLengths
+ *
+ * @param lhs The LayoutLength to multiply
+ * @param rhs The LayoutLength to multiply
+ * @note Using value instead of reference to allow conversions from int and float
+ * @return the resulting LayoutLength
+ */
+inline LayoutLength operator*( LayoutLength lhs, LayoutLength rhs )
+{
+  return lhs.AsDecimal() * rhs.AsDecimal();
+}
+
+/**
+ * @brief divide LayoutLength by a LayoutLength
+ *
+ * @param lhs The LayoutLength to divide
+ * @param rhs The LayoutLength to divide by
+ * @note Using value instead of reference to allow conversions from int and float
+ * @return the resulting value as float
+ */
+inline LayoutLength operator/( LayoutLength lhs, LayoutLength rhs )
+{
+  return lhs.AsDecimal() / rhs.AsDecimal();
+}
 
 /**
  * @brief Prints a LayoutLength
@@ -184,7 +313,7 @@ public:
  */
 inline std::ostream& operator<<( std::ostream& o, const LayoutLength& layoutLength )
 {
-  return o<<layoutLength.mValue;
+  return o << layoutLength.AsDecimal();
 }
 
 } // namespace Toolkit
index b7ec71e..d025ea7 100644 (file)
@@ -31,12 +31,12 @@ class LayoutSize
 {
 public:
   LayoutSize()
-  : x(0u),
-    y(0u)
+  : x( 0 ),
+    y( 0 )
   {
   }
 
-  LayoutSize( LayoutLength::IntType anX, LayoutLength::IntType aY )
+  LayoutSize( LayoutLength anX, LayoutLength aY )
   : x( anX ),
     y( aY )
   {
@@ -55,31 +55,24 @@ public:
     return *this;
   }
 
-  LayoutLength::IntType GetWidth()
+  void SetWidth( LayoutLength value )
   {
-    return width;
+    width = value;
   }
 
-  LayoutLength::IntType GetHeight()
+  LayoutLength GetWidth()
   {
-    return height;
+    return width;
   }
 
-  void SetWidth(LayoutLength::IntType value)
-  {
-    width=value;
-  }
-  void SetHeight(LayoutLength::IntType value)
+  void SetHeight( LayoutLength value )
   {
-    height=value;
+    height = value;
   }
-  void SetWidth(LayoutLength value)
-  {
-    width=value.mValue;
-  }
-  void SetHeight(LayoutLength value)
+
+  LayoutLength GetHeight()
   {
-    height=value.mValue;
+    return height;
   }
 
   bool operator==( const LayoutSize& rhs )
@@ -94,14 +87,14 @@ public:
 
   union
   {
-    LayoutLength::IntType x;
-    LayoutLength::IntType width;
+    LayoutLength x;
+    LayoutLength width;
   };
 
   union
   {
-    LayoutLength::IntType y;
-    LayoutLength::IntType height;
+    LayoutLength y;
+    LayoutLength height;
   };
 };
 
index 04c4d01..378464a 100644 (file)
  * limitations under the License.
  */
 
+// EXTERNAL INCLUDES
+#include <sstream>
 #include <dali/public-api/common/dali-common.h>
+
+// INTERNAL INCLUDES
 #include <dali-toolkit/devel-api/layouting/layout-length.h>
 #include <dali-toolkit/public-api/dali-toolkit-common.h>
 
-#include <sstream>
-
 namespace Dali
 {
 namespace Toolkit
@@ -36,7 +38,6 @@ namespace Toolkit
 class DALI_TOOLKIT_API MeasureSpec
 {
 public:
-  using IntType = LayoutLength::IntType;
 
   enum class Mode
   {
@@ -48,12 +49,12 @@ public:
   };
 
   MeasureSpec( LayoutLength measureSpec, MeasureSpec::Mode mode )
-  : mSize( measureSpec.mValue ),
+  : mSize( measureSpec ),
     mMode( mode )
   {
   }
 
-  MeasureSpec( IntType measureSpec )
+  MeasureSpec( LayoutLength measureSpec )
   : mSize( measureSpec ),
     mMode( Mode::UNSPECIFIED )
   {
@@ -82,6 +83,16 @@ public:
   }
 
   /**
+   * @brief Set the mode of the measure spec.
+   *
+   * @param mode The mode to set
+   */
+  void SetMode( MeasureSpec::Mode mode )
+  {
+    mMode = mode;
+  }
+
+  /**
    * @brief Get the mode of the measure spec.
    *
    * @return The mode of the measure spec
@@ -92,11 +103,21 @@ public:
   }
 
   /**
+   * @brief Set the size of the measure spec
+   *
+   * @param size the size to set
+   */
+  void SetSize( LayoutLength size )
+  {
+    mSize = size;
+  }
+
+  /**
    * @brief Get the size of the measure spec
    *
    * @return the size of the measure spec
    */
-  IntType GetSize() const
+  LayoutLength GetSize() const
   {
     return mSize;
   }
@@ -121,7 +142,7 @@ public:
       return MeasureSpec( size, MeasureSpec::Mode::UNSPECIFIED );
     }
 
-    if( delta < 0 && measureSpec.mSize < static_cast<IntType>(abs(delta)) )
+    if( delta < 0 && measureSpec.mSize < abs(delta) )
     {
       size = 0;
     }
@@ -132,9 +153,11 @@ public:
     return MeasureSpec( size, mode );
   }
 
-public:
-  IntType  mSize; ///< The specified size
+private:
+
+  LayoutLength  mSize; ///< The specified size
   Mode     mMode; ///< The measure mode
+
 };
 
 inline std::ostream& operator<< (std::ostream& o, const MeasureSpec& measureSpec )
index 4acdd70..f04be0a 100644 (file)
@@ -40,7 +40,7 @@ public:
   };
 
   MeasuredSize()
-  : mMeasuredSize( 0u ),
+  : mMeasuredSize( 0 ),
     mState ( MeasuredSize::State::MEASURED_SIZE_OK )
   {
   }
@@ -69,7 +69,7 @@ public:
     return *this;
   }
 
-  MeasuredSize& operator=( LayoutLength::IntType rhs )
+  MeasuredSize& operator=( LayoutLength rhs )
   {
     this->mMeasuredSize = rhs;
     this->mState = State::MEASURED_SIZE_OK;
@@ -86,11 +86,6 @@ public:
     return mMeasuredSize != value.mMeasuredSize;
   }
 
-  inline operator LayoutLength::IntType()
-  {
-    return mMeasuredSize.mValue;
-  }
-
   inline void SetState( MeasuredSize::State state )
   {
     mState = state;
index 3360256..94d0f20 100755 (executable)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
@@ -1266,7 +1266,7 @@ void TextEditor::OnInitialize()
                         Add( ColorVisual::Property::MIX_COLOR, Color::TRANSPARENT ) );
 
   // Enable the clipping property.
-  mStencil.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN );
+  mStencil.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX );
   mStencil.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
 
   self.Add( mStencil );
index dd34031..95e4765 100755 (executable)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
@@ -1748,7 +1748,7 @@ void TextField::EnableClipping()
                           Add( ColorVisual::Property::MIX_COLOR, Color::TRANSPARENT ) );
 
     // Enable the clipping property.
-    mStencil.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN );
+    mStencil.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX );
     mStencil.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
 
     Self().Add( mStencil );
index 26b14b6..c6ef0dc 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
@@ -414,10 +414,6 @@ void TextSelectionPopup::OnInitialize()
   Actor self = Self();
   self.SetResizePolicy( ResizePolicy::FIT_TO_CHILDREN, Dimension::ALL_DIMENSIONS );
   self.SetProperty( Actor::Property::COLOR_ALPHA, 0.0f );
-
-  // The Popup Control background is a nine-patch image. We clip against this so the
-  // contents are correctly clipped against the edges of the nine-patch.
-  self.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN );
 }
 
 void TextSelectionPopup::HideAnimationFinished( Animation& animation )
index 612ca8b..358ace6 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
@@ -208,6 +208,7 @@ void TextSelectionToolbar::SetUpScrollView()
   mScrollView.SetAxisAutoLock( true );
   mScrollView.ScrollStartedSignal().Connect( this, &TextSelectionToolbar::OnScrollStarted );
   mScrollView.ScrollCompletedSignal().Connect( this, &TextSelectionToolbar::OnScrollCompleted );
+  mScrollView.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX ); // In a new layer, so clip to scroll-view's bounding box
 
   mRulerX = new DefaultRuler();  // IntrusivePtr which is unreferenced when ScrollView is destroyed.
 
diff --git a/dali-toolkit/internal/controls/web-view/web-view-impl.cpp b/dali-toolkit/internal/controls/web-view/web-view-impl.cpp
new file mode 100644 (file)
index 0000000..7da5f9d
--- /dev/null
@@ -0,0 +1,377 @@
+/*
+ * Copyright (c) 2018 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include "web-view-impl.h"
+
+// EXTERNAL INCLUDES
+#include <cstring>
+#include <dali/public-api/common/stage.h>
+#include <dali/public-api/images/native-image.h>
+#include <dali/public-api/adaptor-framework/native-image-source.h>
+#include <dali/public-api/object/type-registry.h>
+#include <dali/public-api/object/type-registry-helper.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/devel-api/controls/control-devel.h>
+#include <dali-toolkit/internal/visuals/visual-factory-impl.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Internal
+{
+
+namespace
+{
+
+BaseHandle Create()
+{
+  return Toolkit::WebView::New();
+}
+
+DALI_TYPE_REGISTRATION_BEGIN( Toolkit::WebView, Toolkit::Control, Create );
+
+DALI_PROPERTY_REGISTRATION( Toolkit, WebView, "url", STRING, URL );
+
+DALI_SIGNAL_REGISTRATION( Toolkit, WebView, "pageLoadStarted", PAGE_LOAD_STARTED_SIGNAL );
+DALI_SIGNAL_REGISTRATION( Toolkit, WebView, "pageLoadFinished", PAGE_LOAD_FINISHED_SIGNAL );
+
+DALI_TYPE_REGISTRATION_END()
+
+} // anonymous namepsace
+
+WebView::WebView( const std::string& locale, const std::string& timezoneId )
+: Control( ControlBehaviour( ACTOR_BEHAVIOUR_DEFAULT | DISABLE_STYLE_CHANGE_SIGNALS ) ),
+  mUrl(),
+  mWebViewSize( Stage::GetCurrent().GetSize() )
+{
+  mWebEngine = Dali::WebEngine::New();
+  if ( mWebEngine )
+  {
+    mWebEngine.Create( mWebViewSize.width, mWebViewSize.height, locale, timezoneId );
+  }
+}
+
+WebView::WebView()
+: WebView( "", "" )
+{
+}
+
+WebView::~WebView()
+{
+}
+
+Toolkit::WebView WebView::New()
+{
+  WebView* impl = new WebView();
+  Toolkit::WebView handle = Toolkit::WebView( *impl );
+
+  impl->Initialize();
+  return handle;
+}
+
+Toolkit::WebView WebView::New( const std::string& locale, const std::string& timezoneId )
+{
+  WebView* impl = new WebView( locale, timezoneId );
+  Toolkit::WebView handle = Toolkit::WebView( *impl );
+
+  impl->Initialize();
+  return handle;
+}
+
+void WebView::OnInitialize()
+{
+  Self().SetKeyboardFocusable( true );
+  Self().TouchSignal().Connect( this, &WebView::OnTouchEvent );
+
+  if ( mWebEngine )
+  {
+    mWebEngine.PageLoadStartedSignal().Connect( this, &WebView::OnPageLoadStarted );
+    mWebEngine.PageLoadFinishedSignal().Connect( this, &WebView::OnPageLoadFinished );
+  }
+}
+
+void WebView::LoadUrl( const std::string& url )
+{
+  mUrl = url;
+  if ( mWebEngine )
+  {
+    Dali::Image image = Dali::NativeImage::New( *mWebEngine.GetNativeImageSource() );
+    mVisual = Toolkit::VisualFactory::Get().CreateVisual( image );
+
+    if ( mVisual )
+    {
+      // Clean up previously registered visual and add new one.
+      DevelControl::RegisterVisual( *this, Toolkit::WebView::Property::URL, mVisual );
+      mWebEngine.LoadUrl( url );
+    }
+  }
+}
+
+const std::string& WebView::GetUrl()
+{
+  return mWebEngine ? mWebEngine.GetUrl() : mUrl;
+}
+
+void WebView::LoadHTMLString( const std::string& htmlString )
+{
+  if ( mWebEngine )
+  {
+    Dali::Image image = Dali::NativeImage::New( *mWebEngine.GetNativeImageSource() );
+    mVisual = Toolkit::VisualFactory::Get().CreateVisual( image );
+
+    if ( mVisual )
+    {
+      DevelControl::RegisterVisual( *this, Toolkit::WebView::Property::URL, mVisual );
+      mWebEngine.LoadHTMLString( htmlString );
+    }
+  }
+}
+
+void WebView::Reload()
+{
+  if ( mWebEngine )
+  {
+    mWebEngine.Reload();
+  }
+}
+
+void WebView::StopLoading()
+{
+  if ( mWebEngine )
+  {
+    mWebEngine.StopLoading();
+  }
+}
+
+bool WebView::CanGoForward()
+{
+  return mWebEngine ? mWebEngine.CanGoForward() : false;
+}
+
+void WebView::GoForward()
+{
+  if ( mWebEngine )
+  {
+    mWebEngine.GoForward();
+  }
+}
+
+bool WebView::CanGoBack()
+{
+  return mWebEngine ? mWebEngine.CanGoBack() : false;
+}
+
+void WebView::GoBack()
+{
+  if ( mWebEngine )
+  {
+    mWebEngine.GoBack();
+  }
+}
+
+void WebView::EvaluateJavaScript( const std::string& script )
+{
+  if ( mWebEngine )
+  {
+    mWebEngine.EvaluateJavaScript( script );
+  }
+}
+
+void WebView::AddJavaScriptInterface( const std::string& exposedObjectName, const std::string& jsFunctionName, std::function< std::string(const std::string&) > callback )
+{
+  if ( mWebEngine )
+  {
+    mWebEngine.AddJavaScriptInterface( exposedObjectName, jsFunctionName, callback );
+  }
+}
+
+void WebView::RemoveJavascriptInterface( const std::string& exposedObjectName, const std::string& jsFunctionName )
+{
+  if ( mWebEngine )
+  {
+    mWebEngine.RemoveJavascriptInterface( exposedObjectName, jsFunctionName );
+  }
+}
+
+void WebView::ClearHistory()
+{
+  if ( mWebEngine )
+  {
+    mWebEngine.ClearHistory();
+  }
+}
+
+void WebView::ClearCache()
+{
+  if ( mWebEngine )
+  {
+    mWebEngine.ClearCache();
+  }
+}
+
+Dali::Toolkit::WebView::WebViewSignalType& WebView::PageLoadStartedSignal()
+{
+  return mPageLoadStartedSignal;
+}
+
+Dali::Toolkit::WebView::WebViewSignalType& WebView::PageLoadFinishedSignal()
+{
+  return mPageLoadFinishedSignal;
+}
+
+void WebView::OnPageLoadStarted( const std::string& url )
+{
+  if( !mPageLoadStartedSignal.Empty() )
+  {
+    Dali::Toolkit::WebView handle( GetOwner() );
+    mPageLoadStartedSignal.Emit( handle, url );
+  }
+}
+
+void WebView::OnPageLoadFinished( const std::string& url )
+{
+  if( !mPageLoadFinishedSignal.Empty() )
+  {
+    Dali::Toolkit::WebView handle( GetOwner() );
+    mPageLoadFinishedSignal.Emit( handle, url );
+  }
+}
+
+bool WebView::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
+{
+  Dali::BaseHandle handle( object );
+
+  bool connected = false;
+  Toolkit::WebView webView = Toolkit::WebView::DownCast( handle );
+
+  if( 0 == strcmp( signalName.c_str(), PAGE_LOAD_STARTED_SIGNAL ) )
+  {
+    webView.PageLoadStartedSignal().Connect( tracker, functor );
+    connected = true;
+  }
+  else if( 0 == strcmp( signalName.c_str(), PAGE_LOAD_FINISHED_SIGNAL ) )
+  {
+    webView.PageLoadFinishedSignal().Connect( tracker, functor );
+    connected = true;
+  }
+
+  return connected;
+}
+
+Vector3 WebView::GetNaturalSize()
+{
+  if( mVisual )
+  {
+    Vector2 rendererNaturalSize;
+    mVisual.GetNaturalSize( rendererNaturalSize );
+    return Vector3( rendererNaturalSize );
+  }
+
+  return Vector3( mWebViewSize );
+}
+
+void WebView::OnRelayout( const Vector2& size, RelayoutContainer& container )
+{
+  Control::OnRelayout( size, container );
+
+  if( size.width > 0 && size.height > 0 && mWebViewSize != size )
+  {
+    mWebViewSize = size;
+
+    if( mWebEngine )
+    {
+      mWebEngine.SetSize( size.width, size.height );
+    }
+  }
+}
+
+void WebView::SetProperty( BaseObject* object, Property::Index index, const Property::Value& value )
+{
+  Toolkit::WebView webView = Toolkit::WebView::DownCast( Dali::BaseHandle( object ) );
+
+  if( webView )
+  {
+    WebView& impl = GetImpl( webView );
+    switch( index )
+    {
+      case Toolkit::WebView::Property::URL:
+      {
+        std::string url;
+        if( value.Get( url ) )
+        {
+          impl.LoadUrl( url );
+        }
+        break;
+      }
+    }
+  }
+}
+
+Property::Value WebView::GetProperty( BaseObject* object, Property::Index propertyIndex )
+{
+  Property::Value value;
+
+  Toolkit::WebView webView = Toolkit::WebView::DownCast( Dali::BaseHandle( object ) );
+
+  if( webView )
+  {
+    WebView& impl = GetImpl( webView );
+    switch( propertyIndex )
+    {
+      case Toolkit::WebView::Property::URL:
+      {
+        value = impl.GetUrl();
+        break;
+      }
+    }
+  }
+
+  return value;
+}
+
+bool WebView::OnTouchEvent( Actor actor, const Dali::TouchData& touch )
+{
+  bool result = false;
+
+  if ( mWebEngine )
+  {
+    result = mWebEngine.SendTouchEvent( touch );
+  }
+  return result;
+}
+
+bool WebView::OnKeyEvent( const Dali::KeyEvent& event )
+{
+  bool result = false;
+
+  if ( mWebEngine )
+  {
+    result = mWebEngine.SendKeyEvent( event );
+  }
+  return result;
+}
+
+} // namespace Internal
+
+} // namespace Toolkit
+
+} // namespace Dali
diff --git a/dali-toolkit/internal/controls/web-view/web-view-impl.h b/dali-toolkit/internal/controls/web-view/web-view-impl.h
new file mode 100644 (file)
index 0000000..54a679f
--- /dev/null
@@ -0,0 +1,247 @@
+#ifndef DALI_TOOLKIT_INTERNAL_WEB_VIEW_H
+#define DALI_TOOLKIT_INTERNAL_WEB_VIEW_H
+
+/*
+ * Copyright (c) 2018 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <dali/devel-api/adaptor-framework/web-engine.h>
+#include <dali/public-api/images/image-operations.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/devel-api/visual-factory/visual-base.h>
+#include <dali-toolkit/public-api/controls/control-impl.h>
+#include <dali-toolkit/devel-api/controls/web-view/web-view.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+class KeyEvent;
+class TouchData;
+class WebView;
+
+namespace Internal
+{
+
+class WebView : public Control
+{
+protected:
+
+  WebView();
+
+  WebView( const std::string& locale, const std::string& timezoneId );
+
+  virtual ~WebView();
+
+public:
+
+  /**
+   * @copydoc Dali::Toolkit::WebView::New()
+   */
+  static Toolkit::WebView New();
+
+  /**
+   * @copydoc Dali::Toolkit::WebView::New( const std::string&, const std::string& )
+   */
+  static Toolkit::WebView New( const std::string& locale, const std::string& timezoneId );
+
+  /**
+   * @copydoc Dali::Toolkit::WebView::LoadUrl()
+   */
+  void LoadUrl( const std::string& url );
+
+  /**
+   * @copydoc Dali::Toolkit::WebView::GetUrl()
+   */
+  const std::string& GetUrl();
+
+  /**
+   * @copydoc Dali::WebEngine::LoadHTMLString()
+   */
+  void LoadHTMLString( const std::string& htmlString );
+
+  /**
+   * @copydoc Dali::WebEngine::Reload()
+   */
+  void Reload();
+
+  /**
+   * @copydoc Dali::WebEngine::StopLoading()
+   */
+  void StopLoading();
+
+  /**
+   * @copydoc Dali::WebEngine::CanGoForward()
+   */
+  bool CanGoForward();
+
+  /**
+   * @copydoc Dali::WebEngine::GoForward()
+   */
+  void GoForward();
+
+  /**
+   * @copydoc Dali::WebEngine::CanGoBack()
+   */
+  bool CanGoBack();
+
+  /**
+   * @copydoc Dali::WebEngine::GoBack()
+   */
+  void GoBack();
+
+  /**
+   * @copydoc Dali::WebEngine::EvaluateJavaScript()
+   */
+  void EvaluateJavaScript( const std::string& script );
+
+  /**
+   * @copydoc Dali::WebEngine::AddJavaScriptInterface()
+   */
+  void AddJavaScriptInterface( const std::string& exposedObjectName, const std::string& jsFunctionName, std::function< std::string(const std::string&) > callback );
+
+  /**
+   * @copydoc Dali::WebEngine::RemoveJavascriptInterface()
+   */
+  void RemoveJavascriptInterface( const std::string& exposedObjectName, const std::string& jsFunctionName );
+
+  /**
+   * @copydoc Dali::WebEngine::ClearHistory()
+   */
+  void ClearHistory();
+
+  /**
+   * @copydoc Dali::WebEngine::ClearCache()
+   */
+  void ClearCache();
+
+  /**
+   * @copydoc Dali::Toolkit::WebView::PageLoadStartedSignal()
+   */
+  Dali::Toolkit::WebView::WebViewSignalType& PageLoadStartedSignal();
+
+  /**
+   * @copydoc Dali::Toolkit::WebView::PageLoadFinishedSignal()
+   */
+  Dali::Toolkit::WebView::WebViewSignalType& PageLoadFinishedSignal();
+
+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 );
+
+  /**
+   * @brief Called to retrieve a property of an object of this type.
+   *
+   * @param[in] object The object whose property is to be retrieved.
+   * @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 );
+
+  /**
+   * 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
+   */
+  static bool DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor );
+
+private: // From Control
+
+  /**
+   * @copydoc Toolkit::Control::OnInitialize()
+   */
+  virtual void OnInitialize();
+
+  /**
+   * @copydoc Toolkit::Control::GetNaturalSize
+   */
+  virtual Vector3 GetNaturalSize();
+
+  /**
+   * @copydoc Toolkit::Control::OnRelayout()
+   */
+  virtual void OnRelayout( const Vector2& size, RelayoutContainer& container );
+
+  /**
+   * 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 );
+
+  /**
+   * @copydoc Toolkit::Control::OnKeyEvent()
+   */
+  virtual bool OnKeyEvent( const Dali::KeyEvent& event );
+
+private:
+
+  // Undefined
+  WebView( const WebView& webView );
+
+  WebView& operator=( const WebView& webView );
+
+  void OnPageLoadStarted( const std::string& url );
+
+  void OnPageLoadFinished( const std::string& url );
+
+private:
+
+  std::string mUrl;
+  Dali::Toolkit::Visual::Base mVisual;
+  Dali::Size mWebViewSize;
+  Dali::WebEngine mWebEngine;
+  Dali::Toolkit::WebView::WebViewSignalType mPageLoadStartedSignal;
+  Dali::Toolkit::WebView::WebViewSignalType mPageLoadFinishedSignal;
+};
+
+} // namespace Internal
+
+inline Toolkit::Internal::WebView& GetImpl( Toolkit::WebView& handle )
+{
+  DALI_ASSERT_ALWAYS( handle );
+  Dali::RefObject& impl = handle.GetImplementation();
+  return static_cast< Toolkit::Internal::WebView& >( impl );
+}
+
+inline const Toolkit::Internal::WebView& GetImpl( const Toolkit::WebView& handle )
+{
+  DALI_ASSERT_ALWAYS( handle );
+  const Dali::RefObject& impl = handle.GetImplementation();
+  return static_cast< const Toolkit::Internal::WebView& >( impl );
+}
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // DALI_TOOLKIT_INTERNAL_WEB_VIEW_H
index 3f0bd91..64f8251 100755 (executable)
@@ -102,6 +102,7 @@ toolkit_src_files = \
    $(toolkit_src_dir)/controls/tool-bar/tool-bar-impl.cpp \
    $(toolkit_src_dir)/controls/tooltip/tooltip.cpp \
    $(toolkit_src_dir)/controls/video-view/video-view-impl.cpp \
+   $(toolkit_src_dir)/controls/web-view/web-view-impl.cpp \
    $(toolkit_src_dir)/accessibility-manager/accessibility-manager-impl.cpp \
    \
    $(toolkit_src_dir)/feedback/feedback-style.cpp \
index 5c5989d..8a635af 100644 (file)
@@ -78,8 +78,10 @@ void AbsoluteLayout::OnMeasure( MeasureSpec widthMeasureSpec, MeasureSpec height
     MeasuredSize::State heightState;
   } childState = { MeasuredSize::State::MEASURED_SIZE_OK, MeasuredSize::State::MEASURED_SIZE_OK };
 
-  auto minPosition = Vector3( Vector3::ZERO );
-  auto maxPosition = Vector3( Vector3::ZERO );
+  LayoutLength minPositionX( 0 );
+  LayoutLength minPositionY( 0 );
+  LayoutLength maxPositionX( 0 );
+  LayoutLength maxPositionY( 0 );
 
   // measure children
   for( unsigned int i=0; i<GetChildCount(); ++i )
@@ -91,22 +93,25 @@ void AbsoluteLayout::OnMeasure( MeasureSpec widthMeasureSpec, MeasureSpec height
 
       // Get size of child
       MeasureChild( childLayout, widthMeasureSpec, heightMeasureSpec );
-      auto childWidth = childLayout->GetMeasuredWidth();
-      auto childHeight = childLayout->GetMeasuredHeight();
+      LayoutLength childWidth = childLayout->GetMeasuredWidth();
+      LayoutLength childHeight = childLayout->GetMeasuredHeight();
 
       // Determine the width and height needed by the children using their given position and size.
       // Children could overlap so find the left most and right most child.
       auto childPosition = childOwner.GetProperty< Vector3 >( Actor::Property::POSITION );
-      minPosition.x = std::min( minPosition.x, childPosition.x );
-      maxPosition.x = std::max( maxPosition.x, childPosition.x + childWidth );
+      LayoutLength childLeft = childPosition.x;
+      LayoutLength childTop = childPosition.y;
+
+      minPositionX = std::min( minPositionX, childLeft );
+      maxPositionX = std::max( maxPositionX, childLeft + childWidth );
       // Children could overlap so find the highest and lowest child.
-      minPosition.y = std::min( minPosition.y, childPosition.y );
-      maxPosition.y = std::max( maxPosition.y, childPosition.y + childHeight );
+      minPositionY = std::min( minPositionY, childTop );
+      maxPositionY = std::max( maxPositionY, childTop + childHeight );
 
       // Store current width and height needed to contain all children.
-      totalWidth = maxPosition.x - minPosition.x;
-      totalHeight = maxPosition.y - minPosition.y;
-      DALI_LOG_INFO( gLogFilter, Debug::Verbose, "AbsoluteLayout::OnMeasure child width(%f) height(%f) \n", (float)totalWidth, (float)totalHeight  );
+      totalWidth = maxPositionX - minPositionX;
+      totalHeight = maxPositionY - minPositionY;
+      DALI_LOG_INFO( gLogFilter, Debug::Concise, "AbsoluteLayout::OnMeasure child width(%f) height(%f) \n", totalWidth.AsDecimal(), totalHeight.AsDecimal() );
 
       if( childLayout->GetMeasuredWidthAndState().GetState() == MeasuredSize::State::MEASURED_SIZE_TOO_SMALL )
       {
@@ -149,19 +154,17 @@ void AbsoluteLayout::OnLayout( bool changed, LayoutLength left, LayoutLength top
     if( childLayout != nullptr )
     {
       auto childOwner = childLayout->GetOwner();
-      auto childWidth = childLayout->GetMeasuredWidth();
-      auto childHeight = childLayout->GetMeasuredHeight();
+      LayoutLength childWidth = childLayout->GetMeasuredWidth();
+      LayoutLength childHeight = childLayout->GetMeasuredHeight();
 
       auto childPosition = childOwner.GetProperty< Vector3 >( Actor::Property::POSITION );
 
-      auto childTop = childPosition.y;
-      auto childLeft = childPosition.x;
+      LayoutLength childTop = childPosition.y;
+      LayoutLength childLeft = childPosition.x;
 
-      DALI_LOG_INFO( gLogFilter, Debug::General, "AbsoluteLayout::OnLayout child[%s] position(%f,%f) child width[%d] height(%d)\n",
-                      Toolkit::Control::DownCast( childOwner ).GetName().c_str(),
-                      childPosition.x, childPosition.y,
-                      childWidth.mValue, childHeight.mValue
-                      );
+      DALI_LOG_STREAM( gLogFilter, Debug::General,
+                       "AbsoluteLayout::OnLayout child[" << Toolkit::Control::DownCast( childOwner ).GetName().c_str() <<
+                       "] position(" << childPosition << ") child width[" << childWidth << "] height[" << childHeight << "]\n" );
 
       childLayout->Layout( childLeft, childTop, childLeft + childWidth, childTop + childHeight );
     }
index bf5d084..65b46c1 100644 (file)
@@ -218,23 +218,23 @@ void FlexLayout::OnMeasure( MeasureSpec widthMeasureSpec, MeasureSpec heightMeas
 
   if( widthMeasureSpec.GetMode() == MeasureSpec::Mode::EXACTLY )
   {
-    width = widthMeasureSpec.GetSize();
+    width = widthMeasureSpec.GetSize().AsDecimal();
     YGNodeStyleSetWidth( mRoot, width );
   }
   else if( widthMeasureSpec.GetMode() == MeasureSpec::Mode::AT_MOST )
   {
-    width = widthMeasureSpec.GetSize();
+    width = widthMeasureSpec.GetSize().AsDecimal();
     YGNodeStyleSetMaxWidth( mRoot, width );
   }
 
   if ( heightMeasureSpec.GetMode() == MeasureSpec::Mode::EXACTLY )
   {
-    height = heightMeasureSpec.GetSize();
+    height = heightMeasureSpec.GetSize().AsDecimal();
     YGNodeStyleSetHeight( mRoot, height );
   }
   else if ( heightMeasureSpec.GetMode() == MeasureSpec::Mode::AT_MOST )
   {
-    height = heightMeasureSpec.GetSize();
+    height = heightMeasureSpec.GetSize().AsDecimal();
     YGNodeStyleSetMaxHeight( mRoot, height );
   }
 
@@ -249,8 +249,8 @@ void FlexLayout::OnLayout( bool changed, LayoutLength left, LayoutLength top, La
   auto owner = GetOwner();
   auto actor = Actor::DownCast(owner);
   bool isLayoutRtl = actor ? actor.GetProperty( Actor::Property::LAYOUT_DIRECTION ).Get<int>() == LayoutDirection::RIGHT_TO_LEFT: false;
-  auto width = right - left;
-  auto height = bottom - top;
+  LayoutLength width = right - left;
+  LayoutLength height = bottom - top;
 
 #if defined(DEBUG_ENABLED)
   std::ostringstream oss;
@@ -263,7 +263,7 @@ void FlexLayout::OnLayout( bool changed, LayoutLength left, LayoutLength top, La
   DALI_LOG_INFO( gLogFilter, Debug::Concise, oss.str().c_str() );
 #endif
 
-  YGNodeCalculateLayout( mRoot, width, height, isLayoutRtl ? YGDirectionRTL : YGDirectionLTR );
+  YGNodeCalculateLayout( mRoot, width.AsDecimal(), height.AsDecimal(), isLayoutRtl ? YGDirectionRTL : YGDirectionLTR );
 
   auto count = GetChildCount();
   for( unsigned int childIndex = 0; childIndex < count; childIndex++)
@@ -272,10 +272,10 @@ void FlexLayout::OnLayout( bool changed, LayoutLength left, LayoutLength top, La
     if( childLayout != nullptr )
     {
       YGNodeRef node = YGNodeGetChild(mRoot, childIndex);
-      auto childLeft = YGNodeLayoutGetLeft( node ) + left;
-      auto childTop = YGNodeLayoutGetTop( node ) + top;
-      auto childWidth = YGNodeLayoutGetWidth( node );
-      auto childHeight = YGNodeLayoutGetHeight( node );
+      LayoutLength childLeft = LayoutLength( YGNodeLayoutGetLeft( node ) )+ left;
+      LayoutLength childTop = LayoutLength( YGNodeLayoutGetTop( node ) ) + top;
+      LayoutLength childWidth = LayoutLength( YGNodeLayoutGetWidth( node ) );
+      LayoutLength childHeight = LayoutLength( YGNodeLayoutGetHeight( node ) );
       childLayout->Layout( childLeft, childTop, childLeft + childWidth, childTop + childHeight );
     }
   }
@@ -290,7 +290,7 @@ YGSize FlexLayout::OnChildMeasure( YGNodeRef node,
   auto childOwner = childLayout->GetOwner();
   auto desiredWidth = childOwner.GetProperty<int>( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION );
   auto desiredHeight = childOwner.GetProperty<int>( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION );
-  auto parentWidthMeasureSpec = MeasureSpec( 0 );
+  MeasureSpec parentWidthMeasureSpec( 0 );
   if ( innerWidth != YGUndefined )
   {
     parentWidthMeasureSpec = MeasureSpec( innerWidth, static_cast<MeasureSpec::Mode>(widthMode) );
@@ -332,12 +332,12 @@ YGSize FlexLayout::OnChildMeasure( YGNodeRef node,
 
   // Remove padding here since Yoga doesn't consider it as a part of the node size
   Extents padding = childLayout->GetPadding();
-  auto measuredWidth = childLayout->GetMeasuredWidth() - padding.end - padding.start;
-  auto measuredHeight = childLayout->GetMeasuredHeight() - padding.bottom - padding.top;
+  LayoutLength measuredWidth = childLayout->GetMeasuredWidth() - padding.end - padding.start;
+  LayoutLength measuredHeight = childLayout->GetMeasuredHeight() - padding.bottom - padding.top;
 
   return YGSize{
-    .width = measuredWidth,
-    .height = measuredHeight,
+    .width = measuredWidth.AsDecimal(),
+    .height = measuredHeight.AsDecimal(),
   };
 }
 
index af9b82e..09224ee 100644 (file)
@@ -76,14 +76,14 @@ int Grid::GetNumberOfColumns() const
   return mNumColumns;
 }
 
-void Grid::DetermineNumberOfColumns( int availableSpace )
+void Grid::DetermineNumberOfColumns( LayoutLength availableSpace )
 {
   if( mRequestedNumColumns == AUTO_FIT )
   {
     if( availableSpace > 0 )
     {
       // Can only calculate number of columns if a column width has been set
-      mNumColumns = ( mRequestedColumnWidth > 0 ) ? ( availableSpace / mRequestedColumnWidth ) : 1;
+      mNumColumns = ( mRequestedColumnWidth > 0 ) ? ( availableSpace.AsInteger() / mRequestedColumnWidth ) : 1;
     }
   }
 }
@@ -100,8 +100,8 @@ void Grid::OnMeasure( MeasureSpec widthMeasureSpec, MeasureSpec heightMeasureSpe
   LayoutLength widthSize = widthMeasureSpec.GetSize();
   LayoutLength heightSize = heightMeasureSpec.GetSize();
 
-  int availableContentWidth(0);
-  int availableContentHeight(0);
+  LayoutLength availableContentWidth( 0 );
+  LayoutLength availableContentHeight( 0 );
 
   LayoutLength desiredChildHeight( 0 );
   LayoutLength desiredChildWidth( 0 );
@@ -132,7 +132,7 @@ void Grid::OnMeasure( MeasureSpec widthMeasureSpec, MeasureSpec heightMeasureSpe
       desiredChildWidth += childMargin.start + childMargin.end;
 
       mTotalWidth = desiredChildWidth * mNumColumns;
-      DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Grid::OnMeasure TotalDesiredWidth(%d) \n", mTotalWidth.mValue );
+      DALI_LOG_STREAM( gLogFilter, Debug::Verbose, "Grid::OnMeasure TotalDesiredWidth(" << mTotalWidth << ") \n" );
     } // Child is LayoutItem
   } // Child exists
 
@@ -152,9 +152,7 @@ void Grid::OnMeasure( MeasureSpec widthMeasureSpec, MeasureSpec heightMeasureSpe
   availableContentWidth = mTotalWidth - gridLayoutPadding.start - gridLayoutPadding.end;
   widthSize = mTotalWidth;
 
-  DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Grid::OnMeasure availableContentWidth(%d) mTotalWidth(%d) \n",
-                 availableContentWidth,
-                 mTotalWidth.mValue );
+  DALI_LOG_STREAM( gLogFilter, Debug::Verbose, "Grid::OnMeasure availableContentWidth" << availableContentWidth << " mTotalWidth(" << mTotalWidth << ") \n" );
   // HEIGHT SPECIFICATIONS
 
   // heightMode EXACTLY so grid must be the given height
@@ -168,8 +166,7 @@ void Grid::OnMeasure( MeasureSpec widthMeasureSpec, MeasureSpec heightMeasureSpe
       {
         mTotalHeight += desiredChildHeight;
       }
-      DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Grid::OnMeasure TotalDesiredHeight(%d) \n",
-                      mTotalHeight.mValue );
+      DALI_LOG_STREAM( gLogFilter, Debug::Verbose, "Grid::OnMeasure TotalDesiredHeight(" << mTotalHeight << ") \n" );
 
       // Ensure ourHeight does not exceed specified atmost height
       mTotalHeight = std::min( mTotalHeight, heightSize );
@@ -199,7 +196,7 @@ void Grid::OnMeasure( MeasureSpec widthMeasureSpec, MeasureSpec heightMeasureSpe
   DetermineNumberOfColumns( availableContentWidth );
 
   // Locations define the start, end,top and bottom of each cell.
-  mLocations->CalculateLocations( mNumColumns, availableContentWidth, availableContentHeight, childCount, 0, 0 );
+  mLocations->CalculateLocations( mNumColumns, availableContentWidth.AsInteger(), availableContentHeight.AsInteger(), childCount, 0, 0 );
 
 
   SetMeasuredDimensions( ResolveSizeAndState( widthSize, widthMeasureSpec, MeasuredSize::State::MEASURED_SIZE_OK ),
index f21a9dd..264f11d 100644 (file)
@@ -93,7 +93,7 @@ private:
    * For the given availableSpace, calculate or retreive the number of required columns.
    * @param[in] availableSpace the space available for a child in each column.
    */
-  void DetermineNumberOfColumns( int availableSpace );
+  void DetermineNumberOfColumns( LayoutLength availableSpace );
 
 private:
 
@@ -130,4 +130,4 @@ inline const Internal::Grid& GetImplementation( const Dali::Toolkit::Grid& handl
 } // namespace Toolkit
 } // namespace Dali
 
-#endif // DALI_TOOLKIT_INTERNAL_LAYOUTINGInner
\ No newline at end of file
+#endif // DALI_TOOLKIT_INTERNAL_LAYOUTINGInner
index cfceb62..f912810 100644 (file)
@@ -84,8 +84,8 @@ void LayoutController::Process()
     auto stageWidth  = stage.GetSize().width;
     auto stageHeight = stage.GetSize().height;
 
-    auto widthSpec = MeasureSpec( stageWidth, MeasureSpec::Mode::EXACTLY );
-    auto heightSpec = MeasureSpec( stageHeight, MeasureSpec::Mode::EXACTLY );
+    MeasureSpec widthSpec( stageWidth, MeasureSpec::Mode::EXACTLY );
+    MeasureSpec heightSpec( stageHeight, MeasureSpec::Mode::EXACTLY );
 
     // Test how to perform a measure on each control.
     MeasureHierarchy( stage.GetRootLayer(), widthSpec, heightSpec );
index cd0460d..0833b3b 100644 (file)
@@ -30,11 +30,11 @@ bool LayoutItem::Impl::sUseZeroUnspecifiedMeasureSpec = false;
 LayoutItem::Impl::Impl()
 : mOwner( nullptr ),
   mLayoutParent( nullptr ),
-  mOldWidthMeasureSpec( 0u ),
-  mOldHeightMeasureSpec( 0u ),
+  mOldWidthMeasureSpec( 0 ),
+  mOldHeightMeasureSpec( 0 ),
   mMinimumSize(),
-  mMeasuredWidth(0u),
-  mMeasuredHeight(0u),
+  mMeasuredWidth(0),
+  mMeasuredHeight(0),
   mLeft( 0 ),
   mRight( 0 ),
   mTop( 0 ),
index fdba7e6..b077f54 100644 (file)
@@ -192,7 +192,7 @@ void LinearLayout::MeasureHorizontal( MeasureSpec widthMeasureSpec, MeasureSpec
   LayoutLength alternativeMaxHeight = 0;
   LayoutLength weightedMaxHeight = 0;
   float totalWeight = 0;
-  int usedExcessSpace = 0;
+  LayoutLength usedExcessSpace = 0;
   struct
   {
     MeasuredSize::State widthState;
@@ -215,10 +215,10 @@ void LinearLayout::MeasureHorizontal( MeasureSpec widthMeasureSpec, MeasureSpec
     if( childLayout )
     {
       auto childOwner = childLayout->GetOwner();
-      auto desiredHeight = childOwner.GetProperty<int>( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION );
-      auto desiredWidth = childOwner.GetProperty<int>( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION );
-      auto childWeight = childOwner.GetProperty<float>( Toolkit::LinearLayout::ChildProperty::WEIGHT );
-      auto childMargin = childLayout->GetMargin();
+      LayoutLength desiredHeight = childOwner.GetProperty<int>( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION );
+      LayoutLength desiredWidth = childOwner.GetProperty<int>( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION );
+      float childWeight = childOwner.GetProperty<float>( Toolkit::LinearLayout::ChildProperty::WEIGHT );
+      Extents childMargin = childLayout->GetMargin();
 
       totalWeight += childWeight;
 
@@ -236,7 +236,7 @@ void LinearLayout::MeasureHorizontal( MeasureSpec widthMeasureSpec, MeasureSpec
           // this child is only laid out using excess space. Measure
           // using WRAP_CONTENT so that we can find out the view's
           // optimal width.
-          auto padding = GetPadding();
+          Extents padding = GetPadding();
           const MeasureSpec childWidthMeasureSpec = GetChildMeasureSpec( widthMeasureSpec, padding.start + padding.end, Toolkit::ChildLayoutData::WRAP_CONTENT );
           const MeasureSpec childHeightMeasureSpec = GetChildMeasureSpec( heightMeasureSpec, padding.top + padding.bottom, desiredHeight );
           childLayout->Measure( childWidthMeasureSpec, childHeightMeasureSpec );
@@ -249,16 +249,16 @@ void LinearLayout::MeasureHorizontal( MeasureSpec widthMeasureSpec, MeasureSpec
           childWidth = childLayout->GetMeasuredWidth();
         }
 
-        DALI_LOG_INFO( gLogFilter, Debug::Verbose, "LinearLayout::OnMeasure childWidth(%d)\n", MeasureSpec::IntType( childWidth ) );
-        auto length = childWidth + LayoutLength::IntType( childMargin.start + childMargin.end );
-        auto cellPadding = i < GetChildCount() - 1 ? mCellPadding.width : 0;
+        DALI_LOG_STREAM( gLogFilter, Debug::Verbose, "LinearLayout::OnMeasure childWidth(" << childWidth << ")\n" );
+        LayoutLength length = childWidth + childMargin.start + childMargin.end;
+        LayoutLength cellPadding = i < GetChildCount() - 1 ? mCellPadding.width : 0;
         if( isExactly )
         {
           mTotalLength += length;
         }
         else
         {
-          auto totalLength = mTotalLength;
+          LayoutLength totalLength = mTotalLength;
           mTotalLength = std::max( totalLength, totalLength + length + cellPadding );
         }
       }
@@ -271,8 +271,8 @@ void LinearLayout::MeasureHorizontal( MeasureSpec widthMeasureSpec, MeasureSpec
         matchHeightLocally = true;
       }
 
-      auto marginHeight = LayoutLength( childMargin.top + childMargin.bottom );
-      auto childHeight = childLayout->GetMeasuredHeight() + marginHeight;
+      LayoutLength marginHeight = childMargin.top + childMargin.bottom;
+      LayoutLength childHeight = childLayout->GetMeasuredHeight() + marginHeight;
 
       if( childLayout->GetMeasuredWidthAndState().GetState() == MeasuredSize::State::MEASURED_SIZE_TOO_SMALL )
       {
@@ -302,7 +302,7 @@ void LinearLayout::MeasureHorizontal( MeasureSpec widthMeasureSpec, MeasureSpec
 
   Extents padding = GetPadding();
   mTotalLength += padding.start + padding.end;
-  auto widthSize = mTotalLength;
+  LayoutLength widthSize = mTotalLength;
   widthSize = std::max( widthSize, GetSuggestedMinimumWidth() );
   MeasuredSize widthSizeAndState = ResolveSizeAndState( widthSize, widthMeasureSpec, MeasuredSize::State::MEASURED_SIZE_OK);
   widthSize = widthSizeAndState.GetSize();
@@ -312,7 +312,7 @@ void LinearLayout::MeasureHorizontal( MeasureSpec widthMeasureSpec, MeasureSpec
   // We cycle through weighted children now (children with weight > 0).
   // The children are measured with exact size equal to their share of the available space based on their weights.
   // mTotalLength is updated to include weighted children measured sizes.
-  int remainingExcess = widthSize - mTotalLength + usedExcessSpace;
+  LayoutLength remainingExcess = widthSize - mTotalLength + usedExcessSpace;
   if( remainingExcess != 0 && totalWeight > 0 )
   {
     float remainingWeightSum = totalWeight;
@@ -323,15 +323,15 @@ void LinearLayout::MeasureHorizontal( MeasureSpec widthMeasureSpec, MeasureSpec
     {
       auto childLayout = GetChildAt( i );
       auto childOwner = childLayout->GetOwner();
-      auto desiredWidth = childOwner.GetProperty<int>( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION );
-      auto desiredHeight = childOwner.GetProperty<int>( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION );
-      auto childWeight = childOwner.GetProperty<float>( Toolkit::LinearLayout::ChildProperty::WEIGHT );
-      auto childMargin = childLayout->GetMargin();
+      LayoutLength desiredWidth = childOwner.GetProperty<int>( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION );
+      LayoutLength desiredHeight = childOwner.GetProperty<int>( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION );
+      float childWeight = childOwner.GetProperty<float>( Toolkit::LinearLayout::ChildProperty::WEIGHT );
+      Extents childMargin = childLayout->GetMargin();
 
       LayoutLength childWidth = 0;
       if( childWeight > 0 )
       {
-        int share = static_cast<int>( childWeight * remainingExcess / remainingWeightSum );
+        LayoutLength share = ( childWeight * remainingExcess ) / remainingWeightSum;
         remainingExcess -= share;
         remainingWeightSum -= childWeight;
 
@@ -361,21 +361,21 @@ void LinearLayout::MeasureHorizontal( MeasureSpec widthMeasureSpec, MeasureSpec
         }
       }
 
-      auto length = childLayout->GetMeasuredWidth() + LayoutLength::IntType( childMargin.start + childMargin.end );
-      auto cellPadding = i < GetChildCount() - 1 ? mCellPadding.width : 0;
+      LayoutLength length = childLayout->GetMeasuredWidth() + LayoutLength( childMargin.start + childMargin.end );
+      LayoutLength cellPadding = i < GetChildCount() - 1 ? mCellPadding.width : 0;
       if( isExactly )
       {
         mTotalLength += length;
       }
       else
       {
-        auto totalLength = mTotalLength;
+        LayoutLength totalLength = mTotalLength;
         mTotalLength = std::max( totalLength, totalLength + length + cellPadding );
       }
 
       bool matchHeightLocally = heightMode != MeasureSpec::Mode::EXACTLY && desiredHeight == Toolkit::ChildLayoutData::MATCH_PARENT;
-      auto marginHeight = LayoutLength( childMargin.top + childMargin.bottom );
-      auto childHeight = childLayout->GetMeasuredHeight() + marginHeight;
+      LayoutLength marginHeight = childMargin.top + childMargin.bottom;
+      LayoutLength childHeight = childLayout->GetMeasuredHeight() + marginHeight;
 
       maxHeight = std::max( maxHeight, childHeight );
       alternativeMaxHeight = std::max( alternativeMaxHeight, matchHeightLocally ? marginHeight : childHeight );
@@ -412,26 +412,26 @@ void LinearLayout::ForceUniformHeight( int count, MeasureSpec widthMeasureSpec )
   // Pretend that the linear layout has an exact size. This is the measured height of
   // ourselves. The measured height should be the max height of the children, changed
   // to accommodate the heightMeasureSpec from the parent
-  auto uniformMeasureSpec = MeasureSpec( GetMeasuredHeight(), MeasureSpec::Mode::EXACTLY );
+  MeasureSpec uniformMeasureSpec( GetMeasuredHeight(), MeasureSpec::Mode::EXACTLY );
   for (int i = 0; i < count; ++i)
   {
     LayoutItemPtr childLayout = GetChildAt(i);
     if( childLayout != nullptr )
     {
       auto childOwner = childLayout->GetOwner();
-      auto desiredWidth = childOwner.GetProperty<int>( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION );
-      auto desiredHeight = childOwner.GetProperty<int>( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION );
+      LayoutLength desiredWidth = childOwner.GetProperty<int>( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION );
+      LayoutLength desiredHeight = childOwner.GetProperty<int>( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION );
 
       if( desiredHeight == Toolkit::ChildLayoutData::MATCH_PARENT )
       {
         // Temporarily force children to reuse their old measured width
-        int oldWidth = desiredWidth;
-        childOwner.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, childLayout->GetMeasuredWidth().mValue );
+        LayoutLength oldWidth = desiredWidth;
+        childOwner.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, childLayout->GetMeasuredWidth().AsInteger() );
 
         // Remeasure with new dimensions
-        MeasureChildWithMargins( childLayout, widthMeasureSpec, 0, uniformMeasureSpec, 0);
+        MeasureChildWithMargins( childLayout, widthMeasureSpec, 0, uniformMeasureSpec, 0 );
 
-        childOwner.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, oldWidth );
+        childOwner.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, oldWidth.AsInteger() );
       }
     }
   }
@@ -449,10 +449,10 @@ void LinearLayout::LayoutHorizontal( LayoutLength left, LayoutLength top, Layout
   LayoutLength childLeft( padding.start );
 
   // Where bottom of child should go
-  auto height = bottom - top;
+  LayoutLength height = bottom - top;
 
   // Space available for child
-  auto childSpace = height - padding.top - padding.bottom;
+  LayoutLength childSpace = height - padding.top - padding.bottom;
 
   auto count = GetChildCount();
 
@@ -463,10 +463,12 @@ void LinearLayout::LayoutHorizontal( LayoutLength left, LayoutLength top, Layout
     {
       // mTotalLength contains the padding already
       // In case of RTL map BEGIN alignment to the right edge
-      if ( isLayoutRtl ) {
+      if ( isLayoutRtl )
+      {
         childLeft = LayoutLength( padding.start ) + right - left - mTotalLength;
       }
-      else {
+      else
+      {
         childLeft = LayoutLength( padding.start );
       }
       break;
@@ -475,10 +477,12 @@ void LinearLayout::LayoutHorizontal( LayoutLength left, LayoutLength top, Layout
     {
       // mTotalLength contains the padding already
       // In case of RTL map END alignment to the left edge
-      if ( isLayoutRtl ) {
+      if ( isLayoutRtl )
+      {
         childLeft = LayoutLength( padding.start );
       }
-      else {
+      else
+      {
         childLeft = LayoutLength( padding.start ) + right - left - mTotalLength;
       }
       break;
@@ -486,7 +490,7 @@ void LinearLayout::LayoutHorizontal( LayoutLength left, LayoutLength top, Layout
     case Dali::Toolkit::LinearLayout::Alignment::CENTER_HORIZONTAL:
     {
       // mTotalLength contains the padding already
-      childLeft = LayoutLength( padding.start ) + ( right - left - mTotalLength ) / 2;
+      childLeft = padding.start + ( right - left - mTotalLength ) / 2.0f;
       break;
     }
   }
@@ -495,7 +499,8 @@ void LinearLayout::LayoutHorizontal( LayoutLength left, LayoutLength top, Layout
   int dir = 1;
 
   // In case of RTL, start drawing from the last child.
-  if( isLayoutRtl ) {
+  if( isLayoutRtl )
+  {
     start = count - 1;
     dir = -1;
   }
@@ -506,9 +511,9 @@ void LinearLayout::LayoutHorizontal( LayoutLength left, LayoutLength top, Layout
     LayoutItemPtr childLayout = GetChildAt( childIndex );
     if( childLayout != nullptr )
     {
-      auto childWidth = childLayout->GetMeasuredWidth();
-      auto childHeight = childLayout->GetMeasuredHeight();
-      auto childMargin = childLayout->GetMargin();
+      LayoutLength childWidth = childLayout->GetMeasuredWidth();
+      LayoutLength childHeight = childLayout->GetMeasuredHeight();
+      Extents childMargin = childLayout->GetMargin();
 
       switch ( mAlignment & VERTICAL_ALIGNMENT_MASK )
       {
@@ -522,10 +527,10 @@ void LinearLayout::LayoutHorizontal( LayoutLength left, LayoutLength top, Layout
           childTop = height - padding.bottom - childHeight - childMargin.bottom;
           break;
         }
-        case Dali::Toolkit::LinearLayout::Alignment::CENTER_VERTICAL:
+        case Dali::Toolkit::LinearLayout::Alignment::CENTER_VERTICAL: // FALLTHROUGH
         default:
         {
-          childTop = LayoutLength( padding.top ) + ( ( childSpace - childHeight ) / 2 ) + childMargin.top - childMargin.bottom;
+          childTop = padding.top + ( ( childSpace - childHeight ) / 2.0f ) + childMargin.top - childMargin.bottom;
           break;
         }
       }
@@ -548,7 +553,7 @@ void LinearLayout::MeasureVertical( MeasureSpec widthMeasureSpec, MeasureSpec he
   LayoutLength alternativeMaxWidth = 0;
   LayoutLength weightedMaxWidth = 0;
   float totalWeight = 0;
-  int usedExcessSpace = 0;
+  LayoutLength usedExcessSpace = 0;
   struct
   {
     MeasuredSize::State widthState;
@@ -571,10 +576,10 @@ void LinearLayout::MeasureVertical( MeasureSpec widthMeasureSpec, MeasureSpec he
     if( childLayout )
     {
       auto childOwner = childLayout->GetOwner();
-      auto desiredWidth = childOwner.GetProperty<int>( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION );
-      auto desiredHeight = childOwner.GetProperty<int>( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION );
-      auto childWeight = childOwner.GetProperty<float>( Toolkit::LinearLayout::ChildProperty::WEIGHT );
-      auto childMargin = childLayout->GetMargin();
+      LayoutLength desiredWidth = childOwner.GetProperty<int>( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION );
+      LayoutLength desiredHeight = childOwner.GetProperty<int>( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION );
+      float childWeight = childOwner.GetProperty<float>( Toolkit::LinearLayout::ChildProperty::WEIGHT );
+      Extents childMargin = childLayout->GetMargin();
 
       totalWeight += childWeight;
 
@@ -595,7 +600,7 @@ void LinearLayout::MeasureVertical( MeasureSpec widthMeasureSpec, MeasureSpec he
           // using WRAP_CONTENT so that we can find out the view's
           // optimal height. We'll restore the original height of 0
           // after measurement.
-          auto padding = GetPadding();
+          Extents padding = GetPadding();
           const MeasureSpec childWidthMeasureSpec = GetChildMeasureSpec( widthMeasureSpec, padding.start + padding.end, desiredWidth );
           const MeasureSpec childHeightMeasureSpec = GetChildMeasureSpec( heightMeasureSpec, padding.top + padding.bottom, Toolkit::ChildLayoutData::WRAP_CONTENT );
           childLayout->Measure( childWidthMeasureSpec, childHeightMeasureSpec );
@@ -608,11 +613,11 @@ void LinearLayout::MeasureVertical( MeasureSpec widthMeasureSpec, MeasureSpec he
           childHeight = childLayout->GetMeasuredHeight();
         }
 
-        DALI_LOG_INFO( gLogFilter, Debug::Verbose, "LinearLayout::MeasureVertical childHeight(%d)\n", MeasureSpec::IntType( childHeight ) );
+        DALI_LOG_STREAM( gLogFilter, Debug::Verbose, "LinearLayout::MeasureVertical childHeight(" << childHeight << ")\n" );
 
-        auto length = childHeight + LayoutLength::IntType( childMargin.top + childMargin.bottom );
-        auto cellPadding = i < GetChildCount() - 1 ? mCellPadding.height : 0;
-        auto totalLength = mTotalLength;
+        LayoutLength length = childHeight + childMargin.top + childMargin.bottom;
+        LayoutLength cellPadding = i < GetChildCount() - 1 ? mCellPadding.height : 0;
+        LayoutLength totalLength = mTotalLength;
         mTotalLength = std::max( totalLength, totalLength + length + cellPadding );
       }
 
@@ -624,8 +629,8 @@ void LinearLayout::MeasureVertical( MeasureSpec widthMeasureSpec, MeasureSpec he
         matchWidthLocally = true;
       }
 
-      auto marginWidth = LayoutLength( childMargin.start + childMargin.end );
-      auto childWidth = childLayout->GetMeasuredWidth() + marginWidth;
+      LayoutLength marginWidth = childMargin.start + childMargin.end;
+      LayoutLength childWidth = childLayout->GetMeasuredWidth() + marginWidth;
 
       // was combineMeasuredStates()
       if( childLayout->GetMeasuredWidthAndState().GetState() == MeasuredSize::State::MEASURED_SIZE_TOO_SMALL )
@@ -656,7 +661,7 @@ void LinearLayout::MeasureVertical( MeasureSpec widthMeasureSpec, MeasureSpec he
 
   Extents padding = GetPadding();
   mTotalLength += padding.top + padding.bottom;
-  auto heightSize = mTotalLength;
+  LayoutLength heightSize = mTotalLength;
   heightSize = std::max( heightSize, GetSuggestedMinimumHeight() );
   MeasuredSize heightSizeAndState = ResolveSizeAndState( heightSize, heightMeasureSpec, MeasuredSize::State::MEASURED_SIZE_OK);
   heightSize = heightSizeAndState.GetSize();
@@ -669,7 +674,7 @@ void LinearLayout::MeasureVertical( MeasureSpec widthMeasureSpec, MeasureSpec he
   // We cycle through weighted children now (children with weight > 0).
   // The children are measured with exact size equal to their share of the available space based on their weights.
   // mTotalLength is updated to include weighted children measured sizes.
-  int remainingExcess = heightSize - mTotalLength + usedExcessSpace;
+  LayoutLength remainingExcess = heightSize - mTotalLength + usedExcessSpace;
   if( remainingExcess != 0 && totalWeight > 0.0f )
   {
     float remainingWeightSum = totalWeight;
@@ -680,15 +685,15 @@ void LinearLayout::MeasureVertical( MeasureSpec widthMeasureSpec, MeasureSpec he
     {
       auto childLayout = GetChildAt( i );
       auto childOwner = childLayout->GetOwner();
-      auto desiredWidth = childOwner.GetProperty<int>( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION );
-      auto desiredHeight = childOwner.GetProperty<int>( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION );
-      auto childWeight = childOwner.GetProperty<float>( Toolkit::LinearLayout::ChildProperty::WEIGHT );
-      auto childMargin = childLayout->GetMargin();
+      LayoutLength desiredWidth = childOwner.GetProperty<int>( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION );
+      LayoutLength desiredHeight = childOwner.GetProperty<int>( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION );
+      float childWeight = childOwner.GetProperty<float>( Toolkit::LinearLayout::ChildProperty::WEIGHT );
+      Extents childMargin = childLayout->GetMargin();
 
       LayoutLength childHeight = 0;
       if( childWeight > 0 )
       {
-        int share = static_cast<int>( childWeight * remainingExcess / remainingWeightSum );
+        LayoutLength share = ( childWeight * remainingExcess ) / remainingWeightSum;
         remainingExcess -= share;
         remainingWeightSum -= childWeight;
 
@@ -726,16 +731,16 @@ void LinearLayout::MeasureVertical( MeasureSpec widthMeasureSpec, MeasureSpec he
         matchWidthLocally = true;
       }
 
-      auto marginWidth = LayoutLength( childMargin.start + childMargin.end );
-      auto childWidth = childLayout->GetMeasuredWidth() + marginWidth;
+      LayoutLength marginWidth = childMargin.start + childMargin.end;
+      LayoutLength childWidth = childLayout->GetMeasuredWidth() + marginWidth;
       maxWidth = std::max( maxWidth, childWidth );
       allFillParent = allFillParent && desiredWidth == Toolkit::ChildLayoutData::MATCH_PARENT;
       alternativeMaxWidth = std::max( alternativeMaxWidth, matchWidthLocally ? marginWidth : childWidth );
 
       childHeight = childLayout->GetMeasuredHeight();
-      auto length = childHeight + LayoutLength::IntType( childMargin.top + childMargin.bottom );
-      auto cellPadding = i < GetChildCount() - 1 ? mCellPadding.height : 0;
-      auto totalLength = mTotalLength;
+      LayoutLength length = childHeight + childMargin.top + childMargin.bottom;
+      LayoutLength cellPadding = i < GetChildCount() - 1 ? mCellPadding.height : 0;
+      LayoutLength totalLength = mTotalLength;
       mTotalLength = std::max( totalLength, totalLength + length + cellPadding );
     }
 
@@ -768,26 +773,26 @@ void LinearLayout::MeasureVertical( MeasureSpec widthMeasureSpec, MeasureSpec he
 void LinearLayout::ForceUniformWidth( int count, MeasureSpec heightMeasureSpec )
 {
   // Pretend that the linear layout has an exact size.
-  auto uniformMeasureSpec = MeasureSpec( GetMeasuredWidth(), MeasureSpec::Mode::EXACTLY );
+  MeasureSpec uniformMeasureSpec( GetMeasuredWidth(), MeasureSpec::Mode::EXACTLY );
   for (int i = 0; i < count; ++i)
   {
     LayoutItemPtr childLayout = GetChildAt(i);
     if( childLayout != nullptr )
     {
       auto childOwner = childLayout->GetOwner();
-      auto desiredWidth = childOwner.GetProperty<int>( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION );
-      auto desiredHeight = childOwner.GetProperty<int>( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION );
+      LayoutLength desiredWidth = childOwner.GetProperty<int>( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION );
+      LayoutLength desiredHeight = childOwner.GetProperty<int>( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION );
 
       if( desiredWidth == Toolkit::ChildLayoutData::MATCH_PARENT )
       {
         // Temporarily force children to reuse their old measured height
-        int oldHeight = desiredHeight;
-        childOwner.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, childLayout->GetMeasuredHeight().mValue );
+        LayoutLength oldHeight = desiredHeight;
+        childOwner.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, childLayout->GetMeasuredHeight().AsInteger() );
 
         // Remeasure with new dimensions
         MeasureChildWithMargins( childLayout, uniformMeasureSpec, 0, heightMeasureSpec, 0 );
 
-        childOwner.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, oldHeight );
+        childOwner.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, oldHeight.AsInteger() );
       }
     }
   }
@@ -801,10 +806,10 @@ void LinearLayout::LayoutVertical( LayoutLength left, LayoutLength top, LayoutLe
   LayoutLength childLeft( padding.start );
 
   // Where end of child should go
-  auto width = right - left;
+  LayoutLength width = right - left;
 
   // Space available for child
-  auto childSpace = width - padding.start - padding.end;
+  LayoutLength childSpace = width - padding.start - padding.end;
   auto count = GetChildCount();
 
   switch ( mAlignment & VERTICAL_ALIGNMENT_MASK )
@@ -825,7 +830,7 @@ void LinearLayout::LayoutVertical( LayoutLength left, LayoutLength top, LayoutLe
     default:
     {
       // mTotalLength contains the padding already
-      childTop = LayoutLength( padding.top ) + ( bottom - top - mTotalLength ) / 2;
+      childTop = padding.top + ( bottom - top - mTotalLength ) / 2.0f;
       break;
     }
   }
@@ -835,9 +840,9 @@ void LinearLayout::LayoutVertical( LayoutLength left, LayoutLength top, LayoutLe
     LayoutItemPtr childLayout = GetChildAt( childIndex );
     if( childLayout != nullptr )
     {
-      auto childWidth = childLayout->GetMeasuredWidth();
-      auto childHeight = childLayout->GetMeasuredHeight();
-      auto childMargin = childLayout->GetMargin();
+      LayoutLength childWidth = childLayout->GetMeasuredWidth();
+      LayoutLength childHeight = childLayout->GetMeasuredHeight();
+      Extents childMargin = childLayout->GetMargin();
 
       childTop += childMargin.top;
       switch ( mAlignment & HORIZONTAL_ALIGNMENT_MASK )
@@ -855,7 +860,7 @@ void LinearLayout::LayoutVertical( LayoutLength left, LayoutLength top, LayoutLe
         }
         case Dali::Toolkit::LinearLayout::Alignment::CENTER_HORIZONTAL:
         {
-          childLeft = LayoutLength( padding.start ) + ( childSpace - childWidth ) / 2 + childMargin.start - childMargin.end;
+          childLeft = padding.start + ( childSpace - childWidth ) / 2.0f + childMargin.start - childMargin.end;
           break;
         }
       }
index b30269a..f497b96 100644 (file)
@@ -31,7 +31,7 @@ namespace Toolkit
 
 const unsigned int TOOLKIT_MAJOR_VERSION = 1;
 const unsigned int TOOLKIT_MINOR_VERSION = 3;
-const unsigned int TOOLKIT_MICRO_VERSION = 40;
+const unsigned int TOOLKIT_MICRO_VERSION = 42;
 const char * const TOOLKIT_BUILD_DATE    = __DATE__ " " __TIME__;
 
 #ifdef DEBUG_ENABLED
index c0bcf68..e515a73 100644 (file)
@@ -1,6 +1,6 @@
 Name:       dali-toolkit
 Summary:    Dali 3D engine Toolkit
-Version:    1.3.40
+Version:    1.3.42
 Release:    1
 Group:      System/Libraries
 License:    Apache-2.0 and BSD-3-Clause and MIT