fix tabbar

Signed-off-by: wzztoone <wangzezhen@huawei.com>
Change-Id: Icc4f4cee0206752356b8422e9cb41da0f2e52061
This commit is contained in:
wzztoone
2022-04-13 16:33:48 +08:00
parent 11eb5ebda2
commit 64db4316fa
3 changed files with 16 additions and 0 deletions
@@ -1438,6 +1438,10 @@ void DOMNode::UpdateBoxComponent()
UpdateBoxBorder(borderStyle.border);
}
auto& backDecoration = declaration_->GetBackDecoration();
if (!declaration_->HasBackGroundColor() && boxComponent_->GetBackDecoration() &&
boxComponent_->HasBackgroundColor()) {
backDecoration->SetBackgroundColor(boxComponent_->GetBackDecoration()->GetBackgroundColor());
}
auto& backgroundStyle =
static_cast<CommonBackgroundStyle&>(declaration_->GetStyle(StyleTag::COMMON_BACKGROUND_STYLE));
if (backgroundStyle.IsValid() && backgroundStyle.gradient.IsValid()) {
@@ -38,6 +38,7 @@ void DOMTabBar::InitializeStyle()
}
if (boxComponent_) {
boxComponent_->SetColor(theme->GetBackgroundColor());
boxComponent_->SetHasBackgroundColor(true);
}
auto paddingDimension = theme->GetPadding();
padding_ = Edge(paddingDimension.Value(), 0.0, paddingDimension.Value(), 0.0, paddingDimension.Unit());
@@ -324,6 +324,16 @@ public:
onLongPressId_ = onLongPressId;
}
bool HasBackgroundColor() const
{
return hasBackgroundColor_;
}
void SetHasBackgroundColor(bool hasBackgroundColor)
{
hasBackgroundColor_ = hasBackgroundColor;
}
private:
RefPtr<Decoration> backDecoration_;
RefPtr<Decoration> frontDecoration_;
@@ -352,6 +362,7 @@ private:
TextDirection inspectorDirection_ { TextDirection::LTR };
RefPtr<StateAttributes<BoxStateAttribute>> stateAttributeList_ = nullptr;
EventMarker remoteMessageId_;
bool hasBackgroundColor_;
};
} // namespace OHOS::Ace