From a045aa5eca22fde13bcdea3ccebec9db6d0760fa Mon Sep 17 00:00:00 2001 From: youbing54 Date: Wed, 18 Sep 2024 16:29:32 +0800 Subject: [PATCH] =?UTF-8?q?IssueNo:=20https://gitee.com/openharmony/arkui?= =?UTF-8?q?=5Face=5Fengine=5Flite/issues/IARW3A=20describe:=20InputButtonC?= =?UTF-8?q?omponent::ApplyPrivateStyle=E8=B6=85=E5=A4=A7=E5=87=BD=E6=95=B0?= =?UTF-8?q?=E6=95=B4=E6=94=B9=20Feature=20or=20Bugfix:=20Bugfix=20Binary?= =?UTF-8?q?=20Source:Yes=20Signed-off-by:=20youbing54?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/input_button_component.cpp | 79 +++++++------------ 1 file changed, 27 insertions(+), 52 deletions(-) diff --git a/frameworks/src/core/components/input_button_component.cpp b/frameworks/src/core/components/input_button_component.cpp index 81d8b4b8..44b18fd4 100644 --- a/frameworks/src/core/components/input_button_component.cpp +++ b/frameworks/src/core/components/input_button_component.cpp @@ -70,75 +70,50 @@ bool InputButtonComponent::SetPrivateAttribute(uint16_t attrKeyId, jerry_value_t bool InputButtonComponent::ApplyPrivateStyle(const AppStyleItem *style) { - bool result = true; uint16_t styleKey = GetStylePropNameId(style); switch (styleKey) { case K_FONT_SIZE: - result = SetFontSize(style); - break; + return SetFontSize(style); case K_FONT_FAMILY: - if (IsStyleValueTypeString(style)) { - // the style would be freed after this method - result = CopyFontFamily(fontFamily_, GetStyleStrValue(style)); + if (IsStyleValueTypeString(style)) { // the style would be freed after this method + return CopyFontFamily(fontFamily_, GetStyleStrValue(style)); } else { - result = false; + return false; } - break; case K_TEXT_ALIGN: - result = SetTextAlign(style); - break; + return SetTextAlign(style); case K_COLOR: - result = SetColor(*style); - break; + return SetColor(*style); case K_BACKGROUND_COLOR: - result = SetBackgroundColor(*style); - break; + return SetBackgroundColor(*style); case K_BACKGROUND_IMAGE: - result = HandleBackgroundImg(*style, pressedBackGroundImg_, normalBackGroundImg_); - break; - case K_PADDING: - // fall through - case K_PADDING_BOTTOM: - // fall through - case K_PADDING_LEFT: - // fall through - case K_PADDING_RIGHT: - // fall through - case K_PADDING_TOP: - // fall through - case K_BORDER_BOTTOM_WIDTH: - // fall through - case K_BORDER_LEFT_WIDTH: - // fall through - case K_BORDER_RIGHT_WIDTH: - // fall through - case K_BORDER_TOP_WIDTH: - // fall through - case K_BORDER_WIDTH: - // fall through - case K_BORDER_BOTTOM_COLOR: - // fall through - case K_BORDER_LEFT_COLOR: - // fall through - case K_BORDER_RIGHT_COLOR: - // fall through - case K_BORDER_TOP_COLOR: - // fall through - case K_BORDER_COLOR: - // fall through - case K_BORDER_RADIUS: { + return HandleBackgroundImg(*style, pressedBackGroundImg_, normalBackGroundImg_); + case K_PADDING: //fall through + case K_PADDING_BOTTOM: //fall through + case K_PADDING_LEFT: //fall through + case K_PADDING_RIGHT: //fall through + case K_PADDING_TOP: //fall through + case K_BORDER_BOTTOM_WIDTH: //fall through + case K_BORDER_LEFT_WIDTH: //fall through + case K_BORDER_RIGHT_WIDTH: //fall through + case K_BORDER_TOP_WIDTH: //fall through + case K_BORDER_WIDTH: //fall through + case K_BORDER_BOTTOM_COLOR: //fall through + case K_BORDER_LEFT_COLOR: //fall through + case K_BORDER_RIGHT_COLOR: //fall through + case K_BORDER_TOP_COLOR: //fall through + case K_BORDER_COLOR: //fall through + case K_BORDER_RADIUS: { //fall through button_.SetStateForStyle(UIButton::ButtonState::PRESSED); bool pressResult = ApplyCommonStyle(button_, style); button_.SetStateForStyle(UIButton::ButtonState::RELEASED); bool releaseResult = ApplyCommonStyle(button_, style); - result = pressResult && releaseResult; - break; + return pressResult && releaseResult; } default: - result = false; - break; + return false; } - return result; + return false; } bool InputButtonComponent::SetBackgroundColor(const AppStyleItem &style) -- Gitee