From 995c630c37bc2be1da9c8fc5e171340ffa9bc2d6 Mon Sep 17 00:00:00 2001 From: luoying_ace_admin Date: Thu, 31 Mar 2022 16:19:14 +0800 Subject: [PATCH 1/2] fix bug of Button Signed-off-by: luoying_ace_admin --- frameworks/bridge/declarative_frontend/jsview/js_button.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/frameworks/bridge/declarative_frontend/jsview/js_button.cpp b/frameworks/bridge/declarative_frontend/jsview/js_button.cpp index 293e6f68..c4ff9dce 100755 --- a/frameworks/bridge/declarative_frontend/jsview/js_button.cpp +++ b/frameworks/bridge/declarative_frontend/jsview/js_button.cpp @@ -253,6 +253,7 @@ void JSButton::SetDefaultAttributes(const RefPtr& buttonCompone buttonComponent->SetHeight(buttonTheme->GetHeight()); buttonComponent->SetBackgroundColor(buttonTheme->GetBgColor()); buttonComponent->SetClickedColor(buttonComponent->GetBackgroundColor().BlendColor(buttonTheme->GetClickedColor())); + buttonComponent->SetHoverColor(buttonTheme->GetHoverColor()); } void JSButton::SetTypeAndStateEffect(const JSRef& obj, const RefPtr& buttonComponent) From 382f13385aad02aa95e232739a9c64852ba0907d Mon Sep 17 00:00:00 2001 From: luoying_ace_admin Date: Fri, 1 Apr 2022 14:16:40 +0800 Subject: [PATCH 2/2] fix ut failure of Switch Signed-off-by: luoying_ace_admin --- frameworks/bridge/common/dom/dom_switch.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/frameworks/bridge/common/dom/dom_switch.cpp b/frameworks/bridge/common/dom/dom_switch.cpp index 0046af83..db518ee9 100644 --- a/frameworks/bridge/common/dom/dom_switch.cpp +++ b/frameworks/bridge/common/dom/dom_switch.cpp @@ -164,16 +164,6 @@ void DOMSwitch::PrepareSpecializedComponent() backDecoration->SetBorderRadius(Radius(BOX_HOVER_RADIUS)); boxComponent_->SetBackDecoration(backDecoration); } - RefPtr theme = GetTheme(); - if (switchChild_->GetShowText()) { - return; - } - if (boxComponent_->GetHeightDimension().Value() < 0.0 && theme) { - boxComponent_->SetHeight(theme->GetHeight().Value(), theme->GetHeight().Unit()); - } - if (boxComponent_->GetWidthDimension().Value() < 0.0 && theme) { - boxComponent_->SetWidth(theme->GetWidth().Value(), theme->GetWidth().Unit()); - } } if (HasCheckedPseudo()) { PrepareCheckedListener(); @@ -186,6 +176,16 @@ void DOMSwitch::PrepareSpecializedComponent() if (!textOff_.empty()) { switchChild_->SetTextOff(textOff_); } + RefPtr theme = GetTheme(); + if (switchChild_->GetShowText()) { + return; + } + if (boxComponent_->GetHeightDimension().Value() < 0.0 && theme) { + boxComponent_->SetHeight(theme->GetHeight().Value(), theme->GetHeight().Unit()); + } + if (boxComponent_->GetWidthDimension().Value() < 0.0 && theme) { + boxComponent_->SetWidth(theme->GetWidth().Value(), theme->GetWidth().Unit()); + } #ifndef WEARABLE_PRODUCT if (declaration_) { auto& multimodalAttr =