From: Eunki, Hong Date: Mon, 28 Apr 2025 07:54:58 +0000 (+0900) Subject: (WebView + SceneView) Make follow Control's corner radius and borderline X-Git-Tag: dali_2.4.17~7 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e4beec08e9acea64d5960e533539416c3e70b79c;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git (WebView + SceneView) Make follow Control's corner radius and borderline Change-Id: Ie246165f178edf082ea8d65682125d5d03561bfe Signed-off-by: Eunki, Hong --- diff --git a/automated-tests/src/dali-scene3d/utc-Dali-SceneView.cpp b/automated-tests/src/dali-scene3d/utc-Dali-SceneView.cpp index 61582f76e8..82ae899c9e 100644 --- a/automated-tests/src/dali-scene3d/utc-Dali-SceneView.cpp +++ b/automated-tests/src/dali-scene3d/utc-Dali-SceneView.cpp @@ -1199,83 +1199,6 @@ int UtcDaliSceneViewMasking(void) END_TEST; } -int UtcDaliSceneViewCornerRadius(void) -{ - ToolkitTestApplication application; - - Scene3D::SceneView view = Scene3D::SceneView::New(); - application.GetScene().Add(view); - - DALI_TEST_EQUALS(view.GetProperty(Dali::Scene3D::SceneView::Property::CORNER_RADIUS), Vector4::ZERO, TEST_LOCATION); - DALI_TEST_EQUALS(view.GetProperty(Dali::Scene3D::SceneView::Property::CORNER_RADIUS_POLICY), static_cast(Visual::Transform::Policy::ABSOLUTE), TEST_LOCATION); - - Vector4 expectCornerRadius = Vector4(0.5f, 0.3f, 0.2f, 0.0f); - int expectCornerRadiusPolicy = static_cast(Visual::Transform::Policy::RELATIVE); - - view.UseFramebuffer(true); - view.SetProperty(Dali::Scene3D::SceneView::Property::CORNER_RADIUS, expectCornerRadius); - view.SetProperty(Dali::Scene3D::SceneView::Property::CORNER_RADIUS_POLICY, expectCornerRadiusPolicy); - - DALI_TEST_EQUALS(view.GetProperty(Dali::Scene3D::SceneView::Property::CORNER_RADIUS), expectCornerRadius, TEST_LOCATION); - DALI_TEST_EQUALS(view.GetProperty(Dali::Scene3D::SceneView::Property::CORNER_RADIUS_POLICY), expectCornerRadiusPolicy, TEST_LOCATION); - - END_TEST; -} - -int UtcDaliSceneViewBorderline(void) -{ - ToolkitTestApplication application; - - Scene3D::SceneView view = Scene3D::SceneView::New(); - application.GetScene().Add(view); - - DALI_TEST_EQUALS(view.GetProperty(Dali::Scene3D::SceneView::Property::BORDERLINE_WIDTH), 0.0f, TEST_LOCATION); - DALI_TEST_EQUALS(view.GetProperty(Dali::Scene3D::SceneView::Property::BORDERLINE_COLOR), Color::BLACK, TEST_LOCATION); - DALI_TEST_EQUALS(view.GetProperty(Dali::Scene3D::SceneView::Property::BORDERLINE_OFFSET), 0.0f, TEST_LOCATION); - - float expectBorderlineWidth = 10.0f; - Vector4 expectBorderlineColor = Vector4(0.5f, 0.3f, 0.2f, 0.1f); - float expectBorderlineOffset = -1.0f; - - view.UseFramebuffer(true); - view.SetProperty(Dali::Scene3D::SceneView::Property::BORDERLINE_WIDTH, expectBorderlineWidth); - view.SetProperty(Dali::Scene3D::SceneView::Property::BORDERLINE_COLOR, expectBorderlineColor); - view.SetProperty(Dali::Scene3D::SceneView::Property::BORDERLINE_OFFSET, expectBorderlineOffset); - - DALI_TEST_EQUALS(view.GetProperty(Dali::Scene3D::SceneView::Property::BORDERLINE_WIDTH), expectBorderlineWidth, TEST_LOCATION); - DALI_TEST_EQUALS(view.GetProperty(Dali::Scene3D::SceneView::Property::BORDERLINE_COLOR), expectBorderlineColor, TEST_LOCATION); - DALI_TEST_EQUALS(view.GetProperty(Dali::Scene3D::SceneView::Property::BORDERLINE_OFFSET), expectBorderlineOffset, TEST_LOCATION); - - END_TEST; -} - -int UtcDaliSceneViewCornerSquareness(void) -{ - ToolkitTestApplication application; - - Scene3D::SceneView view = Scene3D::SceneView::New(); - application.GetScene().Add(view); - - DALI_TEST_EQUALS(view.GetProperty(Dali::Scene3D::SceneView::Property::CORNER_RADIUS), Vector4::ZERO, TEST_LOCATION); - DALI_TEST_EQUALS(view.GetProperty(Dali::Scene3D::SceneView::Property::CORNER_SQUARENESS), Vector4::ZERO, TEST_LOCATION); - DALI_TEST_EQUALS(view.GetProperty(Dali::Scene3D::SceneView::Property::CORNER_RADIUS_POLICY), static_cast(Visual::Transform::Policy::ABSOLUTE), TEST_LOCATION); - - Vector4 expectCornerRadius = Vector4(0.5f, 0.3f, 0.2f, 0.0f); - Vector4 expectCornerSquareness = Vector4(0.1f, 0.2f, 0.3f, 0.4f); - int expectCornerRadiusPolicy = static_cast(Visual::Transform::Policy::RELATIVE); - - view.UseFramebuffer(true); - view.SetProperty(Dali::Scene3D::SceneView::Property::CORNER_RADIUS, expectCornerRadius); - view.SetProperty(Dali::Scene3D::SceneView::Property::CORNER_SQUARENESS, expectCornerSquareness); - view.SetProperty(Dali::Scene3D::SceneView::Property::CORNER_RADIUS_POLICY, expectCornerRadiusPolicy); - - DALI_TEST_EQUALS(view.GetProperty(Dali::Scene3D::SceneView::Property::CORNER_RADIUS), expectCornerRadius, TEST_LOCATION); - DALI_TEST_EQUALS(view.GetProperty(Dali::Scene3D::SceneView::Property::CORNER_SQUARENESS), expectCornerSquareness, TEST_LOCATION); - DALI_TEST_EQUALS(view.GetProperty(Dali::Scene3D::SceneView::Property::CORNER_RADIUS_POLICY), expectCornerRadiusPolicy, TEST_LOCATION); - - END_TEST; -} - namespace { static bool gCaptureFinishedCalled{false}; diff --git a/automated-tests/src/dali-toolkit-internal/utc-Dali-Control-internal.cpp b/automated-tests/src/dali-toolkit-internal/utc-Dali-Control-internal.cpp index 9a53b40e93..312891f04a 100644 --- a/automated-tests/src/dali-toolkit-internal/utc-Dali-Control-internal.cpp +++ b/automated-tests/src/dali-toolkit-internal/utc-Dali-Control-internal.cpp @@ -123,7 +123,7 @@ int UtcDaliControlOverrideCornerProperties(void) dummyImpl.RegisterVisual(Toolkit::DummyControl::Property::TEST_VISUAL, visual); tet_infoline("Register image visual into derived dummy control"); - DevelControl::EnableCornerPropertiesOverridden(dummy, visual, true); + DevelControl::EnableCornerPropertiesOverridden(dummyImpl, visual, true); Property::Map map; visual.CreatePropertyMap(map); diff --git a/dali-scene3d/internal/controls/scene-view/scene-view-impl.cpp b/dali-scene3d/internal/controls/scene-view/scene-view-impl.cpp index ba316933ba..e0a7cf0bd7 100644 --- a/dali-scene3d/internal/controls/scene-view/scene-view-impl.cpp +++ b/dali-scene3d/internal/controls/scene-view/scene-view-impl.cpp @@ -66,12 +66,6 @@ DALI_TYPE_REGISTRATION_BEGIN(Scene3D::SceneView, Toolkit::Control, Create); DALI_PROPERTY_REGISTRATION(Scene3D, SceneView, "AlphaMaskUrl", STRING, ALPHA_MASK_URL) DALI_PROPERTY_REGISTRATION(Scene3D, SceneView, "MaskContentScale", FLOAT, MASK_CONTENT_SCALE) DALI_PROPERTY_REGISTRATION(Scene3D, SceneView, "CropToMask", BOOLEAN, CROP_TO_MASK) -DALI_PROPERTY_REGISTRATION(Scene3D, SceneView, "CornerRadius", VECTOR4, CORNER_RADIUS) -DALI_PROPERTY_REGISTRATION(Scene3D, SceneView, "CornerRadiusPolicy", FLOAT, CORNER_RADIUS_POLICY) -DALI_PROPERTY_REGISTRATION(Scene3D, SceneView, "BorderlineWidth", FLOAT, BORDERLINE_WIDTH) -DALI_PROPERTY_REGISTRATION(Scene3D, SceneView, "BorderlineColor", VECTOR4, BORDERLINE_COLOR) -DALI_PROPERTY_REGISTRATION(Scene3D, SceneView, "BorderlineOffset", FLOAT, BORDERLINE_OFFSET) -DALI_PROPERTY_REGISTRATION(Scene3D, SceneView, "CornerSquareness", VECTOR4, CORNER_SQUARENESS) DALI_TYPE_REGISTRATION_END() Property::Index RENDERING_BUFFER = Dali::Toolkit::Control::CONTROL_PROPERTY_END_INDEX + 1; @@ -343,7 +337,6 @@ SceneView::SceneView() mSkyboxIntensity(1.0f), mFailedCaptureCallbacks(nullptr), mLightObservers(), - mCornerRadiusPolicy(static_cast(Toolkit::Visual::Transform::Policy::ABSOLUTE)), mShaderManager(new Scene3D::Loader::ShaderManager()) { } @@ -1111,114 +1104,6 @@ bool SceneView::IsEnabledCropToMask() return mCropToMask; } -void SceneView::SetCornerRadius(Vector4 cornerRadius) -{ - if(mCornerRadius != cornerRadius) - { - mCornerRadius = cornerRadius; - if(mUseFrameBuffer) - { - mDecoratedVisualPropertyChanged = true; - UpdateRenderTask(); - } - } -} - -Vector4 SceneView::GetCornerRadius() const -{ - return mCornerRadius; -} - -void SceneView::SetCornerSquareness(Vector4 cornerSquareness) -{ - if(mCornerSquareness != cornerSquareness) - { - mCornerSquareness = cornerSquareness; - if(mUseFrameBuffer) - { - mDecoratedVisualPropertyChanged = true; - UpdateRenderTask(); - } - } -} - -Vector4 SceneView::GetCornerSquareness() const -{ - return mCornerSquareness; -} - -void SceneView::SetCornerRadiusPolicy(int cornerRadiusPolicy) -{ - if(mCornerRadiusPolicy != cornerRadiusPolicy) - { - mCornerRadiusPolicy = cornerRadiusPolicy; - if(mUseFrameBuffer) - { - mDecoratedVisualPropertyChanged = true; - UpdateRenderTask(); - } - } -} - -int SceneView::GetCornerRadiusPolicy() const -{ - return mCornerRadiusPolicy; -} - -void SceneView::SetBorderlineWidth(float borderlineWidth) -{ - if(!Dali::Equals(mBorderlineWidth, borderlineWidth)) - { - mBorderlineWidth = borderlineWidth; - if(mUseFrameBuffer) - { - mDecoratedVisualPropertyChanged = true; - UpdateRenderTask(); - } - } -} - -float SceneView::GetBorderlineWidth() const -{ - return mBorderlineWidth; -} - -void SceneView::SetBorderlineColor(Vector4 borderlineColor) -{ - if(mBorderlineColor != borderlineColor) - { - mBorderlineColor = borderlineColor; - if(mUseFrameBuffer) - { - mDecoratedVisualPropertyChanged = true; - UpdateRenderTask(); - } - } -} - -Vector4 SceneView::GetBorderlineColor() const -{ - return mBorderlineColor; -} - -void SceneView::SetBorderlineOffset(float borderlineOffset) -{ - if(!Dali::Equals(mBorderlineOffset, borderlineOffset)) - { - mBorderlineOffset = borderlineOffset; - if(mUseFrameBuffer) - { - mDecoratedVisualPropertyChanged = true; - UpdateRenderTask(); - } - } -} - -float SceneView::GetBorderlineOffset() const -{ - return mBorderlineOffset; -} - Dali::RenderTask SceneView::GetRenderTask() { return mRenderTask; @@ -1250,36 +1135,6 @@ void SceneView::SetProperty(BaseObject* object, Property::Index index, const Pro sceneViewImpl.EnableCropToMask(value.Get()); break; } - case Scene3D::SceneView::Property::CORNER_RADIUS: - { - sceneViewImpl.SetCornerRadius(value.Get()); - break; - } - case Scene3D::SceneView::Property::CORNER_RADIUS_POLICY: - { - sceneViewImpl.SetCornerRadiusPolicy(value.Get()); - break; - } - case Scene3D::SceneView::Property::BORDERLINE_WIDTH: - { - sceneViewImpl.SetBorderlineWidth(value.Get()); - break; - } - case Scene3D::SceneView::Property::BORDERLINE_COLOR: - { - sceneViewImpl.SetBorderlineColor(value.Get()); - break; - } - case Scene3D::SceneView::Property::BORDERLINE_OFFSET: - { - sceneViewImpl.SetBorderlineOffset(value.Get()); - break; - } - case Scene3D::SceneView::Property::CORNER_SQUARENESS: - { - sceneViewImpl.SetCornerSquareness(value.Get()); - break; - } } } } @@ -1311,36 +1166,6 @@ Property::Value SceneView::GetProperty(BaseObject* object, Property::Index index value = sceneViewImpl.IsEnabledCropToMask(); break; } - case Scene3D::SceneView::Property::CORNER_RADIUS: - { - value = sceneViewImpl.GetCornerRadius(); - break; - } - case Scene3D::SceneView::Property::CORNER_RADIUS_POLICY: - { - value = sceneViewImpl.GetCornerRadiusPolicy(); - break; - } - case Scene3D::SceneView::Property::BORDERLINE_WIDTH: - { - value = sceneViewImpl.GetBorderlineWidth(); - break; - } - case Scene3D::SceneView::Property::BORDERLINE_COLOR: - { - value = sceneViewImpl.GetBorderlineColor(); - break; - } - case Scene3D::SceneView::Property::BORDERLINE_OFFSET: - { - value = sceneViewImpl.GetBorderlineOffset(); - break; - } - case Scene3D::SceneView::Property::CORNER_SQUARENESS: - { - value = sceneViewImpl.GetCornerSquareness(); - break; - } } } return value; @@ -1598,7 +1423,6 @@ void SceneView::UpdateRenderTask() !Dali::Equals(currentFrameBuffer.GetColorTexture().GetWidth(), width) || !Dali::Equals(currentFrameBuffer.GetColorTexture().GetHeight(), height) || mMaskingPropertyChanged || - mDecoratedVisualPropertyChanged || mWindowSizeChanged) { mRootLayer.SetProperty(Dali::Actor::Property::COLOR_MODE, ColorMode::USE_OWN_COLOR); @@ -1626,32 +1450,17 @@ void SceneView::UpdateRenderTask() imagePropertyMap.Insert(Toolkit::DevelImageVisual::Property::MASKING_TYPE, Toolkit::DevelImageVisual::MaskingType::MASKING_ON_RENDERING); Self().RegisterProperty(Y_FLIP_MASK_TEXTURE, FLIP_MASK_TEXTURE); } - if(mCornerRadius != Vector4::ZERO) - { - imagePropertyMap.Insert(Toolkit::DevelVisual::Property::CORNER_RADIUS, mCornerRadius); - imagePropertyMap.Insert(Toolkit::DevelVisual::Property::CORNER_RADIUS_POLICY, mCornerRadiusPolicy); - if(mCornerSquareness != Vector4::ZERO) - { - imagePropertyMap.Insert(Toolkit::DevelVisual::Property::CORNER_SQUARENESS, mCornerSquareness); - } - } - if(!Dali::EqualsZero(mBorderlineWidth)) - { - imagePropertyMap.Insert(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, mBorderlineWidth); - imagePropertyMap.Insert(Toolkit::DevelVisual::Property::BORDERLINE_COLOR, mBorderlineColor); - imagePropertyMap.Insert(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, mBorderlineOffset); - } mVisual = Toolkit::VisualFactory::Get().CreateVisual(imagePropertyMap); Toolkit::DevelControl::RegisterVisual(*this, RENDERING_BUFFER, mVisual); + Toolkit::DevelControl::EnableCornerPropertiesOverridden(*this, mVisual, true); mRenderTask.SetFrameBuffer(mFrameBuffer); mRenderTask.SetClearEnabled(true); mRenderTask.SetClearColor(Color::TRANSPARENT); - mMaskingPropertyChanged = false; - mDecoratedVisualPropertyChanged = false; - mWindowSizeChanged = false; + mMaskingPropertyChanged = false; + mWindowSizeChanged = false; } } else diff --git a/dali-scene3d/internal/controls/scene-view/scene-view-impl.h b/dali-scene3d/internal/controls/scene-view/scene-view-impl.h index a0a4de0024..873fdeb43e 100644 --- a/dali-scene3d/internal/controls/scene-view/scene-view-impl.h +++ b/dali-scene3d/internal/controls/scene-view/scene-view-impl.h @@ -2,7 +2,7 @@ #define DALI_SCENE3D_INTERNAL_SCENE_VIEW_H /* - * Copyright (c) 2024 Samsung Electronics Co., Ltd. + * Copyright (c) 2025 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. @@ -337,78 +337,6 @@ public: */ bool IsEnabledCropToMask(); - /** - * @brief Sets the radius value of each corner. - * @param[in] cornerRadius Radius value of each corner. - */ - void SetCornerRadius(Vector4 cornerRadius); - - /** - * @brief Retrieves the radius value of each corner. - * @return The radius value of each corner. - */ - Vector4 GetCornerRadius() const; - - /** - * @brief Sets the squareness value of each corner. - * @param[in] cornerSquareness Squareness value of each corner. - */ - void SetCornerSquareness(Vector4 cornerSquareness); - - /** - * @brief Retrieves the squareness value of each corner. - * @return The squareness value of each corner. - */ - Vector4 GetCornerSquareness() const; - - /** - * @brief Sets the policy of corner radius value. - * @param[in] cornerRadiusPolicy Policy of corner radius value. - */ - void SetCornerRadiusPolicy(int cornerRadiusPolicy); - - /** - * @brief Retrieves the policy of corner radius value. - * @return The policy of corner radius value. - */ - int GetCornerRadiusPolicy() const; - - /** - * @brief Sets the width of borderline. - * @param[in] borderlineWidth The width of borderline. - */ - void SetBorderlineWidth(float borderlineWidth); - - /** - * @brief Retrieves the width of borderline. - * @return The width of borderline. - */ - float GetBorderlineWidth() const; - - /** - * @brief Sets the color of borderline. - * @param[in] borderlineColor The color of borderline. - */ - void SetBorderlineColor(Vector4 borderlineColor); - - /** - * @brief Retrieves the color of borderline. - * @return The color of borderline. - */ - Vector4 GetBorderlineColor() const; - - /** - * @brief Sets the offset of borderline. - * @param[in] borderlineOffset The offset of borderline. - */ - void SetBorderlineOffset(float borderlineOffset); - - /** - * @brief Retrieves the offset of borderline. - * @return The offset of borderline. - */ - float GetBorderlineOffset() const; - /** * @brief Gets current RenderTask */ @@ -688,18 +616,6 @@ private: // Implementation of Processor bool mCropToMask{true}; bool mMaskingPropertyChanged{false}; - // Corner Radius - Vector4 mCornerRadius{Vector4::ZERO}; - Vector4 mCornerSquareness{Vector4::ZERO}; - int mCornerRadiusPolicy; ///< Should be initialize at .cpp - - // Borderline - float mBorderlineWidth{0.0f}; - Vector4 mBorderlineColor{Color::BLACK}; - float mBorderlineOffset{0.0f}; - - bool mDecoratedVisualPropertyChanged{false}; - // Shader Factory Dali::Scene3D::Loader::ShaderManagerPtr mShaderManager; diff --git a/dali-scene3d/public-api/controls/scene-view/scene-view.h b/dali-scene3d/public-api/controls/scene-view/scene-view.h index 98e20b5891..961e6fc4f6 100644 --- a/dali-scene3d/public-api/controls/scene-view/scene-view.h +++ b/dali-scene3d/public-api/controls/scene-view/scene-view.h @@ -2,7 +2,7 @@ #define DALI_SCENE3D_SCENE_VIEW_H /* - * Copyright (c) 2024 Samsung Electronics Co., Ltd. + * Copyright (c) 2025 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. @@ -149,71 +149,6 @@ public: * @note If this is false, then the mask is scaled to fit the rendered result before being applied. */ CROP_TO_MASK, - - /** - * @brief The radius for the rounded corners of the scene view. - * @details Name "cornerRadius", type Property::VECTOR4. - * @note By default, it is Vector::ZERO. - * @note Corner radius is only available when framebuffer is used. - * @note Each radius will clamp internally to the half of smaller of the SceneView width and height. - * @note Radius value are used in clockwise order from top-left-corner to bottom-left-corner. - * When radius is Vector4(x, y, z, w) - * x y - * +--+ - * | | - * +--+ - * w z - */ - CORNER_RADIUS, - - /** - * @brief Whether the corner radius value is relative (percentage [0.0f to 0.5f] of the SceneView size) or absolute (in world units). - * @details Name "cornerRadiusPolicy", type Property::INTEGER. - * @see Dali::Visual::Transform::Policy::Type - * @note By default, it is ABSOLUTE to the SceneView's size. - * If it it RELATIVE, the corner radius value is relative to the smaller of the SceneView width and height. - */ - CORNER_RADIUS_POLICY, - - /** - * @brief The width for the borderline of the scene view. - * @details Name "borderlineWidth", type Property::FLOAT. - * @note Optional. Default value is 0.0f. - * @note Borderline is only available when framebuffer is used. - */ - BORDERLINE_WIDTH, - - /** - * @brief The color for the borderline of the scene view. - * @details Name "borderlineColor", type Property::VECTOR4. - * @note Default value is Color::BLACK. - */ - BORDERLINE_COLOR, - - /** - * @brief The offset from the scene view borderline (recommend [-1.0f to 1.0f]). - * @details Name "borderlineOffset", type Property::FLOAT - * @note Default value is 0.0f. - * @note This value will clamp internally to [-1.0f to 1.0f]. - */ - BORDERLINE_OFFSET, - - /** - * @brief The squareness for the rounded corners of the scene view. - * @details Name "cornerSquareness", type Property::VECTOR4. - * @note By default, it is Vector::ZERO. - * @note Corner radius is only available when framebuffer is used. - * @note Each squareness will clamp internally as [0.0 1.0]. - * @note If squareness is not zero, the width of borderline might not equal with it's real value. - * @note Squareness value are used in clockwise order from top-left-corner to bottom-left-corner. - * When squareness is Vector4(x, y, z, w) - * x y - * +--+ - * | | - * +--+ - * w z - */ - CORNER_SQUARENESS, }; }; diff --git a/dali-toolkit/devel-api/controls/control-devel.cpp b/dali-toolkit/devel-api/controls/control-devel.cpp index 579e6e1236..284b53558e 100644 --- a/dali-toolkit/devel-api/controls/control-devel.cpp +++ b/dali-toolkit/devel-api/controls/control-devel.cpp @@ -121,11 +121,9 @@ void DoActionExtension(Control& control, Dali::Property::Index visualIndex, Dali controlDataImpl.DoActionExtension(visualIndex, actionId, attributes); } -void EnableCornerPropertiesOverridden(Control& control, Visual::Base& visual, bool enable) +void EnableCornerPropertiesOverridden(Internal::Control& control, Visual::Base& visual, bool enable) { - Internal::Control& controlInternal = Toolkit::Internal::GetImplementation(control); - Internal::Control::Impl& controlDataImpl = Internal::Control::Impl::Get(controlInternal); - controlDataImpl.EnableCornerPropertiesOverridden(visual, enable); + Internal::Control::Impl::Get(control).EnableCornerPropertiesOverridden(visual, enable); } void SetInputMethodContext(Internal::Control& control, InputMethodContext& inputMethodContext) diff --git a/dali-toolkit/devel-api/controls/control-devel.h b/dali-toolkit/devel-api/controls/control-devel.h index 3de84cab4b..d57d12db29 100644 --- a/dali-toolkit/devel-api/controls/control-devel.h +++ b/dali-toolkit/devel-api/controls/control-devel.h @@ -495,7 +495,7 @@ DALI_TOOLKIT_API void DoActionExtension(Control& control, Dali::Property::Index * @param[in] visual A registered visual. * @param[in] enable Whether to override corner properties of control to visual. */ -DALI_TOOLKIT_API void EnableCornerPropertiesOverridden(Control& control, Visual::Base& visual, bool enable); +DALI_TOOLKIT_API void EnableCornerPropertiesOverridden(Internal::Control& control, Visual::Base& visual, bool enable); /** * @brief Set input method context. diff --git a/dali-toolkit/internal/controls/web-view/web-view-impl.cpp b/dali-toolkit/internal/controls/web-view/web-view-impl.cpp index 243aaaf537..f1deec4b59 100644 --- a/dali-toolkit/internal/controls/web-view/web-view-impl.cpp +++ b/dali-toolkit/internal/controls/web-view/web-view-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Samsung Electronics Co., Ltd. + * Copyright (c) 2025 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. @@ -121,10 +121,10 @@ Rect CalculateDisplayArea(Dali::Actor self, DisplayAreaCalculateOption { bool positionUsesAnchorPoint = self.GetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT); Vector3 actorSize = (option == DisplayAreaCalculateOption::CURRENT_PROPERTY) ? self.GetCurrentProperty(Actor::Property::SIZE) * self.GetCurrentProperty(Actor::Property::SCALE) - : self.GetProperty(Actor::Property::SIZE) * self.GetProperty(Actor::Property::SCALE); - Vector3 anchorPointOffSet = actorSize * (positionUsesAnchorPoint ? self.GetCurrentProperty(Actor::Property::ANCHOR_POINT) : AnchorPoint::TOP_LEFT); - Vector2 screenPosition = (option == DisplayAreaCalculateOption::CURRENT_PROPERTY) ? self.GetProperty(Actor::Property::SCREEN_POSITION) - : Dali::DevelActor::CalculateScreenPosition(self); + : self.GetProperty(Actor::Property::SIZE) * self.GetProperty(Actor::Property::SCALE); + Vector3 anchorPointOffSet = actorSize * (positionUsesAnchorPoint ? self.GetCurrentProperty(Actor::Property::ANCHOR_POINT) : AnchorPoint::TOP_LEFT); + Vector2 screenPosition = (option == DisplayAreaCalculateOption::CURRENT_PROPERTY) ? self.GetProperty(Actor::Property::SCREEN_POSITION) + : Dali::DevelActor::CalculateScreenPosition(self); Dali::Rect displayArea; displayArea.x = screenPosition.x - anchorPointOffSet.x; @@ -148,9 +148,6 @@ const Property::Map DEFAULT_WEB_IMAGE_VISUAL_PROPERTIES{ {Dali::Toolkit::ImageVisual::Property::PIXEL_AREA, FULL_TEXTURE_RECT}, {Dali::Toolkit::ImageVisual::Property::WRAP_MODE_U, Dali::WrapMode::CLAMP_TO_EDGE}, {Dali::Toolkit::ImageVisual::Property::WRAP_MODE_V, Dali::WrapMode::CLAMP_TO_EDGE}, - {Dali::Toolkit::DevelVisual::Property::CORNER_RADIUS, Vector4::ZERO}, - {Dali::Toolkit::DevelVisual::Property::CORNER_SQUARENESS, Vector4::ZERO}, - {Dali::Toolkit::DevelVisual::Property::CORNER_RADIUS_POLICY, Dali::Toolkit::Visual::Transform::Policy::ABSOLUTE}, {Dali::Toolkit::Visual::Property::TRANSFORM, {{Dali::Toolkit::Visual::Transform::Property::SIZE, Vector2::ONE}}}, }; @@ -185,8 +182,7 @@ WebView::WebView(const std::string& locale, const std::string& timezoneId) mKeyEventsEnabled(true), mVisualChangeRequired(false), mScreenshotCapturedCallback{nullptr}, - mFrameRenderedCallback{nullptr}, - mVisualPropertyMap{EMPTY_VISUAL_PROPERTIES} + mFrameRenderedCallback{nullptr} { mWebEngine = Dali::WebEngine::New(); @@ -210,8 +206,7 @@ WebView::WebView(uint32_t argc, char** argv, int32_t type) mKeyEventsEnabled(true), mVisualChangeRequired(false), mScreenshotCapturedCallback{nullptr}, - mFrameRenderedCallback{nullptr}, - mVisualPropertyMap{EMPTY_VISUAL_PROPERTIES} + mFrameRenderedCallback{nullptr} { mWebEngine = Dali::WebEngine::New(type); @@ -316,10 +311,11 @@ void WebView::OnInitialize() mScaleUpdateNotification.NotifySignal().Connect(this, &WebView::OnDisplayAreaUpdated); // Create WebVisual for WebView - Toolkit::Visual::Base webVisual = Toolkit::VisualFactory::Get().CreateVisual(mVisualPropertyMap); + Toolkit::Visual::Base webVisual = Toolkit::VisualFactory::Get().CreateVisual(EMPTY_VISUAL_PROPERTIES); if(webVisual) { Dali::Toolkit::DevelControl::RegisterVisual(*this, Toolkit::WebView::Property::URL, webVisual); + Dali::Toolkit::DevelControl::EnableCornerPropertiesOverridden(*this, webVisual, true); } else { @@ -1053,29 +1049,8 @@ void WebView::OnFrameRendered() 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::Map newWebMap = DEFAULT_WEB_IMAGE_VISUAL_PROPERTIES; - Property::Value* cornerRadiusValue = webMap.Find(Dali::Toolkit::DevelVisual::Property::CORNER_RADIUS); - if(cornerRadiusValue) - { - newWebMap[Dali::Toolkit::DevelVisual::Property::CORNER_RADIUS] = cornerRadiusValue->Get(); - } - Property::Value* cornerSquarenessValue = webMap.Find(Dali::Toolkit::DevelVisual::Property::CORNER_SQUARENESS); - if(cornerSquarenessValue) - { - newWebMap[Dali::Toolkit::DevelVisual::Property::CORNER_SQUARENESS] = cornerSquarenessValue->Get(); - } - Property::Value* cornerRadiusValuePolicy = webMap.Find(Dali::Toolkit::DevelVisual::Property::CORNER_RADIUS_POLICY); - if(cornerRadiusValuePolicy) - { - newWebMap[Dali::Toolkit::DevelVisual::Property::CORNER_RADIUS_POLICY] = cornerRadiusValuePolicy->Get(); - } - // Reset flag mVisualChangeRequired = false; @@ -1088,14 +1063,12 @@ void WebView::OnFrameRendered() newWebMap[Toolkit::ImageVisual::Property::URL] = nativeImageUrl.GetUrl(); - // Store new visual property map now. - mVisualPropertyMap = std::move(newWebMap); - - mVisual = Toolkit::VisualFactory::Get().CreateVisual(mVisualPropertyMap); + mVisual = Toolkit::VisualFactory::Get().CreateVisual(newWebMap); if(mVisual) { DevelControl::RegisterVisual(*this, Toolkit::WebView::Property::URL, mVisual, DepthIndex::CONTENT); + DevelControl::EnableCornerPropertiesOverridden(*this, mVisual, true); EnableBlendMode(!mVideoHoleEnabled); } } @@ -1149,9 +1122,6 @@ void WebView::SetDisplayArea(const Dali::Rect& displayArea) const Vector4 pixelArea(0.0f, 0.0f, std::min(1.0f, textureRatio.x), std::min(1.0f, textureRatio.y)); const Vector2 transformSize(DALI_UNLIKELY(Dali::EqualsZero(textureRatio.x)) ? 1.0f : std::min(1.0f, 1.0f / textureRatio.x), DALI_UNLIKELY(Dali::EqualsZero(textureRatio.y)) ? 1.0f : std::min(1.0f, 1.0f / textureRatio.y)); - mVisualPropertyMap[Toolkit::ImageVisual::Property::PIXEL_AREA] = pixelArea; - mVisualPropertyMap[Toolkit::Visual::Property::TRANSFORM] = {{Dali::Toolkit::Visual::Transform::Property::SIZE, transformSize}}; - Toolkit::GetImplementation(mVisual).DoAction(Toolkit::DevelVisual::Action::UPDATE_PROPERTY, {{Toolkit::ImageVisual::Property::PIXEL_AREA, pixelArea}, {Toolkit::Visual::Property::TRANSFORM, {{Dali::Toolkit::Visual::Transform::Property::SIZE, transformSize}}}}); } diff --git a/dali-toolkit/internal/controls/web-view/web-view-impl.h b/dali-toolkit/internal/controls/web-view/web-view-impl.h index 64c343b899..72ce666429 100644 --- a/dali-toolkit/internal/controls/web-view/web-view-impl.h +++ b/dali-toolkit/internal/controls/web-view/web-view-impl.h @@ -2,7 +2,7 @@ #define DALI_TOOLKIT_INTERNAL_WEB_VIEW_H /* - * Copyright (c) 2024 Samsung Electronics Co., Ltd. + * Copyright (c) 2025 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. @@ -842,8 +842,6 @@ private: Dali::Toolkit::WebView::WebViewScreenshotCapturedCallback mScreenshotCapturedCallback; Dali::WebEnginePlugin::WebEngineFrameRenderedCallback mFrameRenderedCallback; - Dali::Property::Map mVisualPropertyMap; ///< ImageVisual property map - static std::unordered_map> mPluginWebViewMap; };