Apply CornerRadius for webview 56/318856/1
authorsunghyun kim <scholb.kim@samsung.com>
Tue, 23 Jan 2024 09:45:18 +0000 (18:45 +0900)
committerEunki, Hong <eunkiki.hong@samsung.com>
Thu, 10 Oct 2024 04:28:26 +0000 (13:28 +0900)
CornerRadius apply logic not matched with tizen_7.0, the cherry-pick
not works well.

To fix this issue, let we it works well.

Change-Id: Iedc4f12c633db78266054c520172a2e671d2061a

dali-toolkit/internal/controls/web-view/web-view-impl.cpp

index 259937e..6457270 100644 (file)
@@ -953,55 +953,49 @@ void WebView::OnFrameRendered()
   }
 
   // Make sure that mVisual is created only once.
-  if (mVisual)
+  if(!mVisualChangeRequired && mVisual)
+  {
     return;
+  }
 
   // Get webVisual for checking corner radius
   Toolkit::Visual::Base webVisual = Dali::Toolkit::DevelControl::GetVisual(*this, Toolkit::WebView::Property::URL);
-  Property::Map webMap;
+  Property::Map         webMap;
   webVisual.CreatePropertyMap(webMap);
-  Property::Value* cornerRadiusValue =  webMap.Find(Dali::Toolkit::DevelVisual::Property::CORNER_RADIUS);
+  Property::Value* cornerRadiusValue = webMap.Find(Dali::Toolkit::DevelVisual::Property::CORNER_RADIUS);
   if(cornerRadiusValue)
   {
     mCornerRadius = cornerRadiusValue->Get<Vector4>();
   }
-  Property::Value* cornerRadiusValuePolicy =  webMap.Find(Dali::Toolkit::DevelVisual::Property::CORNER_RADIUS_POLICY);
+  Property::Value* cornerRadiusValuePolicy = webMap.Find(Dali::Toolkit::DevelVisual::Property::CORNER_RADIUS_POLICY);
   if(cornerRadiusValuePolicy)
   {
     mCornerRadiusPolicy = cornerRadiusValuePolicy->Get<int>();
   }
 
-  Dali::Toolkit::ImageUrl nativeImageUrl = Dali::Toolkit::Image::GenerateUrl(mWebEngine.GetNativeImageSource());
-  Property::Map propertyMap;
-  propertyMap.Insert(Dali::Toolkit::Visual::Property::TYPE, Dali::Toolkit::Visual::IMAGE);
-  propertyMap.Insert(Dali::Toolkit::ImageVisual::Property::URL, nativeImageUrl.GetUrl());
-  propertyMap.Insert(Dali::Toolkit::DevelVisual::Property::CORNER_RADIUS, mCornerRadius);
-  propertyMap.Insert(Dali::Toolkit::DevelVisual::Property::CORNER_RADIUS_POLICY, mCornerRadiusPolicy);
-  mVisual = Toolkit::VisualFactory::Get().CreateVisual(propertyMap);
-  if(mVisual)
-  {
-    // Reset flag
-    mVisualChangeRequired = false;
+  // Reset flag
+  mVisualChangeRequired = false;
 
-    auto nativeImageSourcePtr = mWebEngine.GetNativeImageSource();
+  auto nativeImageSourcePtr = mWebEngine.GetNativeImageSource();
 
-    mLastRenderedNativeImageWidth  = nativeImageSourcePtr->GetWidth();
-    mLastRenderedNativeImageHeight = nativeImageSourcePtr->GetHeight();
+  mLastRenderedNativeImageWidth  = nativeImageSourcePtr->GetWidth();
+  mLastRenderedNativeImageHeight = nativeImageSourcePtr->GetHeight();
 
-    Dali::Toolkit::ImageUrl nativeImageUrl = Dali::Toolkit::Image::GenerateUrl(nativeImageSourcePtr);
+  Dali::Toolkit::ImageUrl nativeImageUrl = Dali::Toolkit::Image::GenerateUrl(nativeImageSourcePtr);
 
-    mVisual = Toolkit::VisualFactory::Get().CreateVisual(
-      {{Toolkit::Visual::Property::TYPE, Toolkit::Visual::IMAGE},
-       {Toolkit::ImageVisual::Property::URL, nativeImageUrl.GetUrl()},
-       {Toolkit::ImageVisual::Property::PIXEL_AREA, FULL_TEXTURE_RECT},
-       {Toolkit::ImageVisual::Property::WRAP_MODE_U, Dali::WrapMode::CLAMP_TO_EDGE},
-       {Toolkit::ImageVisual::Property::WRAP_MODE_V, Dali::WrapMode::CLAMP_TO_EDGE}});
+  mVisual = Toolkit::VisualFactory::Get().CreateVisual(
+    {{Toolkit::Visual::Property::TYPE, Toolkit::Visual::IMAGE},
+     {Toolkit::ImageVisual::Property::URL, nativeImageUrl.GetUrl()},
+     {Toolkit::ImageVisual::Property::PIXEL_AREA, FULL_TEXTURE_RECT},
+     {Toolkit::ImageVisual::Property::WRAP_MODE_U, Dali::WrapMode::CLAMP_TO_EDGE},
+     {Toolkit::ImageVisual::Property::WRAP_MODE_V, Dali::WrapMode::CLAMP_TO_EDGE},
+     {Toolkit::DevelVisual::Property::CORNER_RADIUS, mCornerRadius},
+     {Toolkit::DevelVisual::Property::CORNER_RADIUS_POLICY, mCornerRadiusPolicy}});
 
-    if(mVisual)
-    {
-      DevelControl::RegisterVisual(*this, Toolkit::WebView::Property::URL, mVisual, DepthIndex::CONTENT);
-      EnableBlendMode(!mVideoHoleEnabled);
-    }
+  if(mVisual)
+  {
+    DevelControl::RegisterVisual(*this, Toolkit::WebView::Property::URL, mVisual, DepthIndex::CONTENT);
+    EnableBlendMode(!mVideoHoleEnabled);
   }
 }