From a323f6c51dbffba97ee8d28a30a25f194fa78ec2 Mon Sep 17 00:00:00 2001 From: openharmony_ci <120357966@qq.com> Date: Fri, 11 Aug 2023 06:17:35 +0000 Subject: [PATCH] =?UTF-8?q?=E5=9B=9E=E9=80=80=20'Pull=20Request=20!17485?= =?UTF-8?q?=20:=20=E3=80=90=E5=9F=BA=E7=A1=80=E8=83=BD=E5=8A=9B=E3=80=91Me?= =?UTF-8?q?nu=E6=94=AF=E6=8C=81=E8=AE=BE=E7=BD=AE=E5=9C=86=E8=A7=92&?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=BC=80=E5=8F=91=E8=80=85=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?menu=E5=AE=BD=E5=BA=A6'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../declarative_frontend/jsview/js_menu.cpp | 64 ------------------- .../declarative_frontend/jsview/js_menu.h | 5 -- .../jsview/models/menu_model_impl.cpp | 5 -- .../jsview/models/menu_model_impl.h | 5 -- .../core/components/select/select_theme.h | 48 -------------- .../menu_item/menu_item_layout_algorithm.cpp | 19 +----- .../pattern/menu/menu_layout_algorithm.cpp | 21 +----- .../pattern/menu/menu_layout_property.h | 6 -- .../components_ng/pattern/menu/menu_model.h | 5 -- .../pattern/menu/menu_model_ng.cpp | 29 --------- .../pattern/menu/menu_model_ng.h | 4 -- .../pattern/menu/menu_pattern.cpp | 55 +--------------- .../components_ng/pattern/menu/menu_pattern.h | 1 - .../components_ng/pattern/menu/menu_view.cpp | 6 +- 14 files changed, 10 insertions(+), 263 deletions(-) diff --git a/frameworks/bridge/declarative_frontend/jsview/js_menu.cpp b/frameworks/bridge/declarative_frontend/jsview/js_menu.cpp index 0d935990673..a89d9a2fe88 100644 --- a/frameworks/bridge/declarative_frontend/jsview/js_menu.cpp +++ b/frameworks/bridge/declarative_frontend/jsview/js_menu.cpp @@ -121,68 +121,6 @@ void JSMenu::FontColor(const JSCallbackInfo& info) MenuModel::GetInstance()->SetFontColor(color); } -void JSMenu::SetWidth(const JSCallbackInfo& info) -{ - if (info.Length() < 1) { - LOGE("The argv is wrong, it is supposed to have at least 1 argument"); - return; - } - CalcDimension width; - if (!ParseJsDimensionPx(info[0], width)) { - return; - } - - MenuModel::GetInstance()->SetWidth(width); -} - -void JSMenu::HandleDifferentRadius(const JSRef& args) -{ - std::optional radiusTopLeft; - std::optional radiusTopRight; - std::optional radiusBottomLeft; - std::optional radiusBottomRight; - if (args->IsObject()) { - JSRef object = JSRef::Cast(args); - CalcDimension topLeft; - if (ParseJsDimensionVp(object->GetProperty("topLeft"), topLeft)) { - radiusTopLeft = topLeft; - } - CalcDimension topRight; - if (ParseJsDimensionVp(object->GetProperty("topRight"), topRight)) { - radiusTopRight = topRight; - } - CalcDimension bottomLeft; - if (ParseJsDimensionVp(object->GetProperty("bottomLeft"), bottomLeft)) { - radiusBottomLeft = bottomLeft; - } - CalcDimension bottomRight; - if (ParseJsDimensionVp(object->GetProperty("bottomRight"), bottomRight)) { - radiusBottomRight = bottomRight; - } - if (!radiusTopLeft.has_value() && !radiusTopRight.has_value() && !radiusBottomLeft.has_value() && - !radiusBottomRight.has_value()) { - return; - } - MenuModel::GetInstance()->SetBorderRadius(radiusTopLeft, radiusTopRight, radiusBottomLeft, radiusBottomRight); - } -} - -void JSMenu::SetRadius(const JSCallbackInfo& info) -{ - if (info.Length() < 1) { - LOGE("The argv is wrong, it is supposed to have at least 1 argument"); - return; - } - CalcDimension radius; - ParseJsDimensionVp(info[0], radius); - - if (LessNotEqual(radius.Value(), 0.0)) { - return; - } - MenuModel::GetInstance()->SetBorderRadius(radius); - HandleDifferentRadius(info[0]); -} - void JSMenu::JSBind(BindingTarget globalObj) { JSClass::Declare("Menu"); @@ -191,8 +129,6 @@ void JSMenu::JSBind(BindingTarget globalObj) JSClass::StaticMethod("fontSize", &JSMenu::FontSize, opt); JSClass::StaticMethod("font", &JSMenu::Font, opt); JSClass::StaticMethod("fontColor", &JSMenu::FontColor, opt); - JSClass::StaticMethod("width", &JSMenu::SetWidth, opt); - JSClass::StaticMethod("radius", &JSMenu::SetRadius, opt); JSClass::StaticMethod("onAppear", &JSInteractableView::JsOnAppear); JSClass::StaticMethod("onDisAppear", &JSInteractableView::JsOnDisAppear); JSClass::StaticMethod("onTouch", &JSInteractableView::JsOnTouch); diff --git a/frameworks/bridge/declarative_frontend/jsview/js_menu.h b/frameworks/bridge/declarative_frontend/jsview/js_menu.h index 9af97d952c3..ae1b1b23c99 100644 --- a/frameworks/bridge/declarative_frontend/jsview/js_menu.h +++ b/frameworks/bridge/declarative_frontend/jsview/js_menu.h @@ -26,11 +26,6 @@ public: static void FontSize(const JSCallbackInfo& info); static void Font(const JSCallbackInfo& info); static void FontColor(const JSCallbackInfo& info); - static void SetWidth(const JSCallbackInfo& info); - static void SetRadius(const JSCallbackInfo& info); - -private: - static void HandleDifferentRadius(const JSRef& args); }; } // namespace OHOS::Ace::Framework #endif // FRAMEWORKS_BRIDGE_DECLARATIVE_FRONTEND_JS_VIEW_JS_MENU_H diff --git a/frameworks/bridge/declarative_frontend/jsview/models/menu_model_impl.cpp b/frameworks/bridge/declarative_frontend/jsview/models/menu_model_impl.cpp index 12120920c4a..1bffa8fec8c 100644 --- a/frameworks/bridge/declarative_frontend/jsview/models/menu_model_impl.cpp +++ b/frameworks/bridge/declarative_frontend/jsview/models/menu_model_impl.cpp @@ -22,9 +22,4 @@ void MenuModelImpl::SetFontWeight(FontWeight weight) {} void MenuModelImpl::SetFontStyle(Ace::FontStyle style) {} void MenuModelImpl::SetFontColor(const std::optional& color) {} void MenuModelImpl::SetFontFamily(const std::vector &families) {} -void MenuModelImpl::SetWidth(const Dimension& width) {} -void MenuModelImpl::SetBorderRadius(const Dimension& radius) {} -void MenuModelImpl::SetBorderRadius(const std::optional& radiusTopLeft, - const std::optional& radiusTopRight, const std::optional& radiusBottomLeft, - const std::optional& radiusBottomRight) {} } // namespace OHOS::Ace::Framework diff --git a/frameworks/bridge/declarative_frontend/jsview/models/menu_model_impl.h b/frameworks/bridge/declarative_frontend/jsview/models/menu_model_impl.h index 2f6d95e66be..55b3c209e30 100644 --- a/frameworks/bridge/declarative_frontend/jsview/models/menu_model_impl.h +++ b/frameworks/bridge/declarative_frontend/jsview/models/menu_model_impl.h @@ -26,11 +26,6 @@ public: void SetFontWeight(FontWeight weight) override; void SetFontStyle(Ace::FontStyle style) override; void SetFontColor(const std::optional& color) override; - void SetWidth(const Dimension& width) override; - void SetBorderRadius(const Dimension& radius) override; - void SetBorderRadius(const std::optional& radiusTopLeft, const std::optional& radiusTopRight, - const std::optional& radiusBottomLeft, - const std::optional& radiusBottomRight) override; void SetFontFamily(const std::vector &families) override; }; } // namespace OHOS::Ace::Framework diff --git a/frameworks/core/components/select/select_theme.h b/frameworks/core/components/select/select_theme.h index 9b57b81cae1..a0934cb4a9e 100644 --- a/frameworks/core/components/select/select_theme.h +++ b/frameworks/core/components/select/select_theme.h @@ -24,7 +24,6 @@ #include "core/components/theme/theme_constants.h" #include "core/components/theme/theme_constants_defines.h" #include "core/components_ng/property/calc_length.h" -#include "core/components_ng/property/border_property.h" namespace OHOS::Ace { @@ -35,8 +34,6 @@ constexpr double SELECT_OPTION_BOTTOM_LENGTH = 15.0; constexpr Dimension VERTICAL_INTERVAL = 14.4_vp; constexpr Dimension MENU_END_ICON_WIDTH = 12.0_vp; constexpr Dimension MENU_END_ICON_HEIGHT = 24.0_vp; -constexpr Dimension DEFAULT_MENU_WIDTH = 0.0_vp; -constexpr Dimension MIN_MENU_WIDTH = 64.0_vp; /** * SelectTheme defines color and styles of SelectComponent. SelectTheme should be build @@ -89,7 +86,6 @@ public: theme->titleTopPadding_ = Dimension(8.0, DimensionUnit::VP); theme->titleRightPadding_ = Dimension(8.0, DimensionUnit::VP); theme->titleBottomPadding_ = Dimension(16.0, DimensionUnit::VP); - theme->menuWidth_ = Dimension(0.0, DimensionUnit::VP); theme->titleStyle_.SetFontSize(themeConstants->GetDimension(THEME_OHOS_TEXT_SIZE_HEADLINE7)); std::vector families; families.emplace_back("sans-serif"); @@ -256,12 +252,8 @@ public: theme->selectedColorText_ = selectedColorText_; theme->lineColor_ = lineColor_; theme->optionTextStyle_ = optionTextStyle_; - theme->menuWidth_ = menuWidth_; - theme->ChangeBorderRadius_ = ChangeBorderRadius_; theme->selectBorderRadius_ = selectBorderRadius_; theme->menuBorderRadius_ = menuBorderRadius_; - theme->menuScrollTag_ = menuScrollTag_; - theme->menuScrollNodeId_ = menuScrollNodeId_; theme->innerBorderRadius_ = innerBorderRadius_; theme->menuFontSize_ = menuFontSize_; theme->menuTitleFontSize_ = menuTitleFontSize_; @@ -679,47 +671,11 @@ public: return menuBorderRadius_; } - const NG::BorderRadiusProperty& GetChangeBorderRadius() const - { - return ChangeBorderRadius_; - } - - void SetChangeBorderRadius(const NG::BorderRadiusProperty& radius) - { - ChangeBorderRadius_ = radius; - } - - void SetMenuScrollId(const std::string& tag, int32_t nodeId) - { - menuScrollTag_ = tag; - menuScrollNodeId_ = nodeId; - } - - const std::string& GetMenuScrollTag() const - { - return menuScrollTag_; - } - - int32_t GetMenuScrollNodeId() const - { - return menuScrollNodeId_; - } - const Dimension& GetInnerBorderRadius() const { return innerBorderRadius_; } - const Dimension& GetMenuWidth() const - { - return menuWidth_; - } - - void SetMenuWidth(const Dimension& width) - { - menuWidth_ = width; - } - const Dimension& GetMenuFontSize() const { return menuFontSize_; @@ -879,8 +835,6 @@ private: std::string fontFamily_; FontWeight fontWeight_ { FontWeight::NORMAL }; TextDecoration textDecoration_ { TextDecoration::NONE }; - std::string menuScrollTag_; - int32_t menuScrollNodeId_ = -1; std::size_t optionSize_ { 0 }; Dimension rrectSize_; @@ -904,8 +858,6 @@ private: Dimension selectBorderRadius_; Dimension menuBorderRadius_; - Dimension menuWidth_; - NG::BorderRadiusProperty ChangeBorderRadius_; Dimension innerBorderRadius_; Dimension menuFontSize_; Dimension menuTitleFontSize_; diff --git a/frameworks/core/components_ng/pattern/menu/menu_item/menu_item_layout_algorithm.cpp b/frameworks/core/components_ng/pattern/menu/menu_item/menu_item_layout_algorithm.cpp index 28f729d8009..5d3edf53981 100644 --- a/frameworks/core/components_ng/pattern/menu/menu_item/menu_item_layout_algorithm.cpp +++ b/frameworks/core/components_ng/pattern/menu/menu_item/menu_item_layout_algorithm.cpp @@ -61,22 +61,16 @@ void MenuItemLayoutAlgorithm::Measure(LayoutWrapper* layoutWrapper) auto leftRow = layoutWrapper->GetOrCreateChildByIndex(0); CHECK_NULL_VOID(leftRow); MeasureRow(leftRow, childConstraint); - float leftRowWidth = leftRow->GetGeometryNode()->GetContentSize().Width(); - float menuWidth = leftRow->GetGeometryNode()->GetMarginFrameSize().Width(); + float leftRowWidth = leftRow->GetGeometryNode()->GetMarginFrameSize().Width(); if (!layoutConstraint->selfIdealSize.Width().has_value()) { float contentWidth = leftRowWidth + rightRowWidth + padding.Width() + middleSpace; - if (leftRowWidth == menuWidth) { - layoutConstraint->selfIdealSize.SetWidth(std::max(minRowWidth, contentWidth)); - } else { - layoutConstraint->selfIdealSize.SetWidth(menuWidth); - } + layoutConstraint->selfIdealSize.SetWidth(std::max(minRowWidth, contentWidth)); props->UpdateLayoutConstraint(layoutConstraint.value()); } else if (layoutConstraint->selfIdealSize.Width().value() >= layoutConstraint->maxSize.Width()) { layoutConstraint->selfIdealSize.SetWidth(layoutConstraint->maxSize.Width()); props->UpdateLayoutConstraint(layoutConstraint.value()); } - BoxLayoutAlgorithm::PerformMeasureSelf(layoutWrapper); } @@ -142,13 +136,6 @@ void MenuItemLayoutAlgorithm::MeasureRow(const RefPtr& row, const roWHeight = std::max(roWHeight, childSize.Height()); } rowWidth -= iconContentPadding; - auto menuWidth = static_cast(theme->GetMenuWidth().ConvertToPx()); - if (GreatOrEqual(menuWidth, MIN_MENU_WIDTH.ConvertToPx())) { - menuWidth -= iconContentPadding; - row->GetGeometryNode()->SetFrameSize(SizeF(menuWidth, roWHeight)); - } else { - row->GetGeometryNode()->SetFrameSize(SizeF(rowWidth, roWHeight)); - } - row->GetGeometryNode()->SetContentSize(SizeF(rowWidth, roWHeight)); + row->GetGeometryNode()->SetFrameSize(SizeF(rowWidth, roWHeight)); } } // namespace OHOS::Ace::NG diff --git a/frameworks/core/components_ng/pattern/menu/menu_layout_algorithm.cpp b/frameworks/core/components_ng/pattern/menu/menu_layout_algorithm.cpp index 7203fafc459..f96dba9e78c 100644 --- a/frameworks/core/components_ng/pattern/menu/menu_layout_algorithm.cpp +++ b/frameworks/core/components_ng/pattern/menu/menu_layout_algorithm.cpp @@ -670,27 +670,9 @@ void MenuLayoutAlgorithm::UpdateConstraintWidth(LayoutWrapper* layoutWrapper, La } else { columnInfo->GetParent()->BuildColumnWidth(wrapperSize_.Width()); } - - auto pipeline = PipelineBase::GetCurrentContext(); - CHECK_NULL_VOID(pipeline); - auto theme = pipeline->GetTheme(); - CHECK_NULL_VOID(theme); - auto menuWidth = theme->GetMenuWidth().ConvertToPxWithSize(wrapperSize_.Width()); - if (LessNotEqual(MIN_MENU_WIDTH.ConvertToPx(), menuWidth)) { - if (LessNotEqual(menuWidth, wrapperSize_.Width())) { - theme->SetMenuWidth(Dimension(menuWidth, DimensionUnit::PX)); - constraint.maxSize.SetWidth(menuWidth); - constraint.minSize.SetWidth(MIN_MENU_WIDTH.ConvertToPx()); - return; - } else { - theme->SetMenuWidth(DEFAULT_MENU_WIDTH); - } - - } - + // set max width auto menuLayoutProperty = AceType::DynamicCast(layoutWrapper->GetLayoutProperty()); CHECK_NULL_VOID(menuLayoutProperty); - // set max width const auto& padding = menuLayoutProperty->CreatePaddingAndBorder(); auto maxHorizontalSpace = std::max(leftSpace_, rightSpace_) - 2.0f * padding.Width(); auto maxWidth = static_cast(columnInfo->GetWidth(GetMaxGridCounts(columnInfo))); @@ -707,7 +689,6 @@ void MenuLayoutAlgorithm::UpdateConstraintWidth(LayoutWrapper* layoutWrapper, La } else { minWidth = static_cast(columnInfo->GetWidth(MIN_GRID_COUNTS)); } - if (minWidth > constraint.maxSize.Width()) { minWidth = constraint.maxSize.Width(); } diff --git a/frameworks/core/components_ng/pattern/menu/menu_layout_property.h b/frameworks/core/components_ng/pattern/menu/menu_layout_property.h index 00f34ac61f4..543329bf635 100644 --- a/frameworks/core/components_ng/pattern/menu/menu_layout_property.h +++ b/frameworks/core/components_ng/pattern/menu/menu_layout_property.h @@ -61,8 +61,6 @@ public: value->propTitle_ = CloneTitle(); value->propMenuPlacement_ = CloneMenuPlacement(); value->propSelectMenuAlignOption_ = CloneSelectMenuAlignOption(); - value->propBorderRadius_ = CloneBorderRadius(); - value->propMenuWidth_ = CloneMenuWidth(); return value; } @@ -76,16 +74,12 @@ public: ResetTitle(); ResetMenuPlacement(); ResetSelectMenuAlignOption(); - ResetBorderRadius(); - ResetMenuWidth(); } // target frameNode that this menu belongs to ACE_DEFINE_PROPERTY_ITEM_WITHOUT_GROUP(MenuOffset, NG::OffsetF, PROPERTY_UPDATE_MEASURE); // target frameNode size, null for click show menu ACE_DEFINE_PROPERTY_ITEM_WITHOUT_GROUP(TargetSize, NG::SizeF, PROPERTY_UPDATE_MEASURE); - ACE_DEFINE_PROPERTY_ITEM_WITHOUT_GROUP(BorderRadius, NG::BorderRadiusProperty, PROPERTY_UPDATE_MEASURE); - ACE_DEFINE_PROPERTY_ITEM_WITHOUT_GROUP(MenuWidth, Dimension, PROPERTY_UPDATE_MEASURE); // offset to cursor ACE_DEFINE_PROPERTY_ITEM_WITHOUT_GROUP(PositionOffset, NG::OffsetF, PROPERTY_UPDATE_LAYOUT); diff --git a/frameworks/core/components_ng/pattern/menu/menu_model.h b/frameworks/core/components_ng/pattern/menu/menu_model.h index 181426a8f92..35ca1b3e363 100644 --- a/frameworks/core/components_ng/pattern/menu/menu_model.h +++ b/frameworks/core/components_ng/pattern/menu/menu_model.h @@ -30,11 +30,6 @@ public: virtual void SetFontStyle(Ace::FontStyle style); virtual void SetFontColor(const std::optional& color); virtual void SetFontFamily(const std::vector &families); - virtual void SetWidth(const Dimension& width); - virtual void SetBorderRadius(const Dimension& radius); - virtual void SetBorderRadius(const std::optional& radiusTopLeft, - const std::optional& radiusTopRight, const std::optional& radiusBottomLeft, - const std::optional& radiusBottomRight); private: static std::unique_ptr instance_; diff --git a/frameworks/core/components_ng/pattern/menu/menu_model_ng.cpp b/frameworks/core/components_ng/pattern/menu/menu_model_ng.cpp index 6d5d611a08f..28d94b562b7 100644 --- a/frameworks/core/components_ng/pattern/menu/menu_model_ng.cpp +++ b/frameworks/core/components_ng/pattern/menu/menu_model_ng.cpp @@ -58,35 +58,6 @@ void MenuModelNG::SetFontColor(const std::optional& color) } } -void MenuModelNG::SetBorderRadius(const Dimension& radius) -{ - NG::BorderRadiusProperty borderRadius; - borderRadius.radiusTopLeft = radius; - borderRadius.radiusTopRight = radius; - borderRadius.radiusBottomLeft = radius; - borderRadius.radiusBottomRight = radius; - borderRadius.multiValued = true; - ACE_UPDATE_LAYOUT_PROPERTY(MenuLayoutProperty, BorderRadius, borderRadius); -} - -void MenuModelNG::SetBorderRadius(const std::optional& radiusTopLeft, - const std::optional& radiusTopRight, const std::optional& radiusBottomLeft, - const std::optional& radiusBottomRight) -{ - NG::BorderRadiusProperty borderRadius; - borderRadius.radiusTopLeft = radiusTopLeft; - borderRadius.radiusTopRight = radiusTopRight; - borderRadius.radiusBottomLeft = radiusBottomLeft; - borderRadius.radiusBottomRight = radiusBottomRight; - borderRadius.multiValued = true; - ACE_UPDATE_LAYOUT_PROPERTY(MenuLayoutProperty, BorderRadius, borderRadius); -} - -void MenuModelNG::SetWidth(const Dimension& width) -{ - ACE_UPDATE_LAYOUT_PROPERTY(MenuLayoutProperty, MenuWidth, width); -} - void MenuModelNG::SetFontFamily(const std::vector &families) { ACE_UPDATE_LAYOUT_PROPERTY(MenuLayoutProperty, FontFamily, families); diff --git a/frameworks/core/components_ng/pattern/menu/menu_model_ng.h b/frameworks/core/components_ng/pattern/menu/menu_model_ng.h index 35c63a31b59..b37f6d2c19c 100644 --- a/frameworks/core/components_ng/pattern/menu/menu_model_ng.h +++ b/frameworks/core/components_ng/pattern/menu/menu_model_ng.h @@ -27,10 +27,6 @@ public: void SetFontStyle(Ace::FontStyle style) override; void SetFontColor(const std::optional& color) override; void SetFontFamily(const std::vector &families) override; - void SetWidth(const Dimension& width) override; - void SetBorderRadius(const Dimension& radius) override; - void SetBorderRadius(const std::optional& radiusTopLeft, const std::optional& radiusTopRight, - const std::optional& radiusBottomLeft, const std::optional& radiusBottomRight) override; }; } // namespace OHOS::Ace::NG #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_MENU_MENU_MODEL_NG_H diff --git a/frameworks/core/components_ng/pattern/menu/menu_pattern.cpp b/frameworks/core/components_ng/pattern/menu/menu_pattern.cpp index 70489a874d6..02d9e780b43 100644 --- a/frameworks/core/components_ng/pattern/menu/menu_pattern.cpp +++ b/frameworks/core/components_ng/pattern/menu/menu_pattern.cpp @@ -174,7 +174,6 @@ void InnerMenuPattern::OnModifyDone() Pattern::OnModifyDone(); auto host = GetHost(); CHECK_NULL_VOID(host); - SetMenuAttribute(host); UpdateMenuItemChildren(host); SetAccessibilityAction(); } @@ -264,31 +263,6 @@ void MenuPattern::RemoveParentHoverStyle() menuItemPattern->PlayBgColorAnimation(); } -void MenuPattern::SetMenuAttribute(RefPtr& host) -{ - auto layoutProperty = host->GetLayoutProperty(); - CHECK_NULL_VOID(layoutProperty); - auto pipeline = PipelineBase::GetCurrentContext(); - CHECK_NULL_VOID(pipeline); - auto theme = pipeline->GetTheme(); - CHECK_NULL_VOID(theme); - if (!layoutProperty->GetMenuWidth().has_value()) { - theme->SetMenuWidth(DEFAULT_MENU_WIDTH); - } else { - theme->SetMenuWidth(layoutProperty->GetMenuWidth().value()); - } - - BorderRadiusProperty borderRadius; - if (!layoutProperty->GetBorderRadius().has_value()) { - auto defaultRadius = theme->GetMenuBorderRadius(); - borderRadius.SetRadius(defaultRadius); - theme->SetChangeBorderRadius(borderRadius); - } else { - borderRadius = layoutProperty->GetBorderRadius().value(); - theme->SetChangeBorderRadius(borderRadius); - } -} - void MenuPattern::UpdateMenuItemChildren(RefPtr& host) { auto layoutProperty = GetLayoutProperty(); @@ -597,34 +571,7 @@ void MenuPattern::SetAccessibilityAction() bool MenuPattern::OnDirtyLayoutWrapperSwap(const RefPtr& dirty, const DirtySwapConfig& config) { - if (config.skipMeasure || dirty->SkipMeasureContent()) { - return false; - } - auto pipeline = PipelineBase::GetCurrentContext(); - CHECK_NULL_RETURN(pipeline, false); - auto theme = pipeline->GetTheme(); - CHECK_NULL_RETURN(theme, false); - auto scroll = FrameNode::GetFrameNode(theme->GetMenuScrollTag(), theme->GetMenuScrollNodeId()); - CHECK_NULL_RETURN(scroll, false); - auto renderScroll = scroll->GetRenderContext(); - CHECK_NULL_RETURN(renderScroll, false); - auto renderContext = dirty->GetHostNode()->GetRenderContext(); - CHECK_NULL_RETURN(renderContext, false); - - auto borderRadius = theme->GetChangeBorderRadius(); - auto TopRadius = borderRadius.radiusTopLeft.value() + borderRadius.radiusTopRight.value(); - auto bottomRadius = borderRadius.radiusBottomLeft.value() + borderRadius.radiusBottomRight.value(); - auto menuRadius = std::max(TopRadius.ConvertToVp(), bottomRadius.ConvertToVp()); - auto idealSize = dirty->GetGeometryNode()->GetMarginFrameSize(); - if (LessOrEqual(menuRadius, idealSize.Width())) { - renderContext->UpdateBorderRadius(borderRadius); - } else { - auto defaultRadius = theme->GetMenuBorderRadius(); - borderRadius.SetRadius(defaultRadius); - theme->SetChangeBorderRadius(borderRadius); - } - renderScroll->UpdateBorderRadius(borderRadius); - return true; + return false; } diff --git a/frameworks/core/components_ng/pattern/menu/menu_pattern.h b/frameworks/core/components_ng/pattern/menu/menu_pattern.h index 3a8cc569a83..e57f0f9751f 100644 --- a/frameworks/core/components_ng/pattern/menu/menu_pattern.h +++ b/frameworks/core/components_ng/pattern/menu/menu_pattern.h @@ -205,7 +205,6 @@ public: protected: void UpdateMenuItemChildren(RefPtr& host); - void SetMenuAttribute(RefPtr& host); void SetAccessibilityAction(); void SetType(MenuType value) { diff --git a/frameworks/core/components_ng/pattern/menu/menu_view.cpp b/frameworks/core/components_ng/pattern/menu/menu_view.cpp index f8da7e949d4..62f03dc8ba4 100644 --- a/frameworks/core/components_ng/pattern/menu/menu_view.cpp +++ b/frameworks/core/components_ng/pattern/menu/menu_view.cpp @@ -118,7 +118,11 @@ RefPtr CreateMenuScroll(const RefPtr& node) padding.left = padding.right = padding.top = padding.bottom = CalcLength(contentPadding); props->UpdatePadding(padding); node->MountToParent(scroll); - theme->SetMenuScrollId(scroll->GetTag(), scroll->GetId()); + auto renderContext = scroll->GetRenderContext(); + CHECK_NULL_RETURN(renderContext, nullptr); + BorderRadiusProperty borderRadius; + borderRadius.SetRadius(theme->GetMenuBorderRadius()); + renderContext->UpdateBorderRadius(borderRadius); return scroll; } -- Gitee