#include <dali-toolkit/public-api/image-loader/image.h>
#include <dali-toolkit/public-api/image-loader/image-url.h>
#include <dali-toolkit/public-api/visuals/image-visual-properties.h>
+#include <dali/integration-api/debug.h>
#include <functional>
#include <memory>
mMouseEventsEnabled(true),
mKeyEventsEnabled(true),
mScreenshotCapturedCallback{nullptr},
- mFrameRenderedCallback{nullptr}
+ mFrameRenderedCallback{nullptr},
+ mCornerRadius(Vector4::ZERO),
+ mCornerRadiusPolicy(1.0f)
{
mWebEngine = Dali::WebEngine::New();
mMouseEventsEnabled(true),
mKeyEventsEnabled(true),
mScreenshotCapturedCallback{nullptr},
- mFrameRenderedCallback{nullptr}
+ mFrameRenderedCallback{nullptr},
+ mCornerRadius(Vector4::ZERO),
+ mCornerRadiusPolicy(1.0f)
{
mWebEngine = Dali::WebEngine::New();
mSizeUpdateNotification.NotifySignal().Connect(this, &WebView::OnDisplayAreaUpdated);
mScaleUpdateNotification.NotifySignal().Connect(this, &WebView::OnDisplayAreaUpdated);
+ // Create WebVisual for WebView
+ Property::Map propertyMap;
+ propertyMap.Insert(Dali::Toolkit::Visual::Property::TYPE, Dali::Toolkit::Visual::COLOR);
+ propertyMap.Insert(Dali::Toolkit::Visual::Property::MIX_COLOR, Color::TRANSPARENT);
+ Toolkit::Visual::Base webVisual = Toolkit::VisualFactory::Get().CreateVisual(propertyMap);
+ if(webVisual)
+ {
+ Dali::Toolkit::DevelControl::RegisterVisual(*this, Toolkit::WebView::Property::URL, webVisual);
+ }
+ else
+ {
+ DALI_LOG_ERROR("fail to create webVisual for CornerRadius");
+ Dali::Toolkit::DevelControl::UnregisterVisual(*this, Toolkit::WebView::Property::URL);
+ }
+
if(mWebEngine)
{
mWebEngine.RegisterFrameRenderedCallback(std::bind(&WebView::OnFrameRendered, this));
if (mVisual)
return;
+ // Get webVisual for checking corner radius
+ Toolkit::Visual::Base webVisual = Dali::Toolkit::DevelControl::GetVisual(*this, Toolkit::WebView::Property::URL);
+ Property::Map webMap;
+ webVisual.CreatePropertyMap(webMap);
+ 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);
+ if(cornerRadiusValuePolicy)
+ {
+ mCornerRadiusPolicy = cornerRadiusValuePolicy->Get<int>();
+ }
+
Dali::Toolkit::ImageUrl nativeImageUrl = Dali::Toolkit::Image::GenerateUrl(mWebEngine.GetNativeImageSource());
- mVisual = Toolkit::VisualFactory::Get().CreateVisual({{Toolkit::Visual::Property::TYPE, Toolkit::Visual::IMAGE}, {Toolkit::ImageVisual::Property::URL, nativeImageUrl.GetUrl()}});
+ 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)
{
DevelControl::RegisterVisual(*this, Toolkit::WebView::Property::URL, mVisual);