mirror of
https://gitee.com/openharmony/arkui_ace_engine
synced 2024-10-07 08:24:11 +00:00
!19319 【Revert】【popup】拆分UpdatePopupNode、修复动效缺失、支持键盘走焦
Merge pull request !19319 from 冯纪拓/popup_destroy
This commit is contained in:
commit
866cee1039
@ -262,7 +262,7 @@ void SubwindowOhos::ShowPopupNG(int32_t targetId, const NG::PopupInfo& popupInfo
|
||||
ShowWindow(false);
|
||||
ResizeWindow();
|
||||
ContainerScope scope(childContainerId_);
|
||||
overlayManager->ShowPopup(targetId, popupInfo);
|
||||
overlayManager->UpdatePopupNode(targetId, popupInfo);
|
||||
}
|
||||
|
||||
void SubwindowOhos::HidePopupNG(int32_t targetId)
|
||||
@ -279,6 +279,12 @@ void SubwindowOhos::HidePopupNG(int32_t targetId)
|
||||
ContainerScope scope(childContainerId_);
|
||||
overlayManager->HidePopup(targetId == -1 ? popupTargetId_ : targetId, popupInfo);
|
||||
context->FlushPipelineImmediately();
|
||||
HideWindow();
|
||||
#ifdef ENABLE_DRAG_FRAMEWORK
|
||||
HideEventColumn();
|
||||
HidePixelMap();
|
||||
HideFilter();
|
||||
#endif // ENABLE_DRAG_FRAMEWORK
|
||||
}
|
||||
|
||||
void SubwindowOhos::GetPopupInfoNG(int32_t targetId, NG::PopupInfo& popupInfo)
|
||||
|
@ -1153,8 +1153,17 @@ void ViewAbstract::BindPopup(
|
||||
if (isShow) {
|
||||
LOGI("Popup now show in subwindow.");
|
||||
SubwindowManager::GetInstance()->ShowPopupNG(targetId, popupInfo);
|
||||
if (popupPattern) {
|
||||
popupPattern->SetContainerId(Container::CurrentId());
|
||||
popupPattern->StartEnteringAnimation(nullptr);
|
||||
}
|
||||
} else {
|
||||
SubwindowManager::GetInstance()->HidePopupNG(targetId);
|
||||
if (popupPattern) {
|
||||
popupPattern->StartExitingAnimation([targetId]() {
|
||||
LOGI("Popup now hide in subwindow.");
|
||||
SubwindowManager::GetInstance()->HidePopupNG(targetId);
|
||||
});
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -1170,9 +1179,20 @@ void ViewAbstract::BindPopup(
|
||||
}
|
||||
if (isShow) {
|
||||
LOGI("begin to update popup node.");
|
||||
overlayManager->ShowPopup(targetId, popupInfo);
|
||||
overlayManager->UpdatePopupNode(targetId, popupInfo);
|
||||
if (popupPattern) {
|
||||
popupPattern->StartEnteringAnimation(nullptr);
|
||||
}
|
||||
} else {
|
||||
overlayManager->HidePopup(targetId, popupInfo);
|
||||
if (popupPattern) {
|
||||
popupPattern->StartExitingAnimation(
|
||||
[targetId, popupInfo, weakOverlayManger = AceType::WeakClaim(AceType::RawPtr(overlayManager))]() {
|
||||
auto overlay = weakOverlayManger.Upgrade();
|
||||
CHECK_NULL_VOID(overlay);
|
||||
LOGI("begin to update popup node.");
|
||||
overlay->UpdatePopupNode(targetId, popupInfo);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -335,11 +335,16 @@ void BubblePattern::PopBubble()
|
||||
auto layoutProp = host->GetLayoutProperty<BubbleLayoutProperty>();
|
||||
CHECK_NULL_VOID(layoutProp);
|
||||
auto showInSubWindow = layoutProp->GetShowInSubWindow().value_or(false);
|
||||
if (showInSubWindow) {
|
||||
SubwindowManager::GetInstance()->HidePopupNG(targetNodeId_);
|
||||
} else {
|
||||
overlayManager->HidePopup(targetNodeId_, popupInfo);
|
||||
}
|
||||
StartExitingAnimation([showInSubWindow, targetId = targetNodeId_, popupInfo,
|
||||
weakOverlayManger = AceType::WeakClaim(AceType::RawPtr(overlayManager))]() {
|
||||
if (showInSubWindow) {
|
||||
SubwindowManager::GetInstance()->HidePopupNG(targetId);
|
||||
} else {
|
||||
auto overlay = weakOverlayManger.Upgrade();
|
||||
CHECK_NULL_VOID(overlay);
|
||||
overlay->UpdatePopupNode(targetId, popupInfo);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
RefPtr<PopupTheme> BubblePattern::GetPopupTheme()
|
||||
@ -441,6 +446,10 @@ void BubblePattern::StartAlphaEnteringAnimation(std::function<void()> finish)
|
||||
|
||||
void BubblePattern::StartExitingAnimation(std::function<void()> finish)
|
||||
{
|
||||
if (!IsOnShow()) {
|
||||
return;
|
||||
}
|
||||
|
||||
StartOffsetExitingAnimation();
|
||||
StartAlphaExitingAnimation(finish);
|
||||
}
|
||||
|
@ -117,11 +117,6 @@ public:
|
||||
transitionStatus_ = transitionStatus;
|
||||
}
|
||||
|
||||
TransitionStatus GetTransitionStatus()
|
||||
{
|
||||
return transitionStatus_;
|
||||
}
|
||||
|
||||
void SetSkipHotArea(bool skip)
|
||||
{
|
||||
skipHotArea_ = skip;
|
||||
|
@ -95,19 +95,6 @@ void UpdateTextProperties(const RefPtr<PopupParam>& param, const RefPtr<TextLayo
|
||||
}
|
||||
} // namespace
|
||||
|
||||
void SetHitTestMode(RefPtr<FrameNode>& popupNode, bool isBlockEvent)
|
||||
{
|
||||
auto hub = popupNode->GetEventHub<BubbleEventHub>();
|
||||
if (hub) {
|
||||
auto ges = hub->GetOrCreateGestureEventHub();
|
||||
if (!isBlockEvent) {
|
||||
ges->SetHitTestMode(HitTestMode::HTMTRANSPARENT_SELF);
|
||||
} else {
|
||||
ges->SetHitTestMode(HitTestMode::HTMDEFAULT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RefPtr<FrameNode> BubbleView::CreateBubbleNode(
|
||||
const std::string& targetTag, int32_t targetId, const RefPtr<PopupParam>& param)
|
||||
{
|
||||
@ -134,7 +121,6 @@ RefPtr<FrameNode> BubbleView::CreateBubbleNode(
|
||||
popupProp->UpdateShowInSubWindow(param->IsShowInSubWindow());
|
||||
popupProp->UpdatePositionOffset(OffsetF(param->GetTargetOffset().GetX(), param->GetTargetOffset().GetY()));
|
||||
popupProp->UpdateBlockEvent(param->IsBlockEvent());
|
||||
SetHitTestMode(popupNode, param->IsBlockEvent());
|
||||
if (param->GetTargetSpace().has_value()) {
|
||||
popupProp->UpdateTargetSpace(param->GetTargetSpace().value());
|
||||
}
|
||||
@ -210,7 +196,6 @@ RefPtr<FrameNode> BubbleView::CreateCustomBubbleNode(
|
||||
layoutProps->UpdatePlacement(param->GetPlacement());
|
||||
layoutProps->UpdateShowInSubWindow(param->IsShowInSubWindow());
|
||||
layoutProps->UpdateBlockEvent(param->IsBlockEvent());
|
||||
SetHitTestMode(popupNode, param->IsBlockEvent());
|
||||
auto displayWindowOffset = GetDisplayWindowRectOffset();
|
||||
layoutProps->UpdateDisplayWindowOffset(displayWindowOffset);
|
||||
layoutProps->UpdatePositionOffset(OffsetF(param->GetTargetOffset().GetX(), param->GetTargetOffset().GetY()));
|
||||
@ -229,7 +214,6 @@ RefPtr<FrameNode> BubbleView::CreateCustomBubbleNode(
|
||||
if (param->IsBackgroundColorSetted()) {
|
||||
popupPaintProps->UpdateBackgroundColor(param->GetBackgroundColor());
|
||||
}
|
||||
|
||||
auto columnNode = FrameNode::CreateFrameNode(V2::COLUMN_ETS_TAG, ElementRegister::GetInstance()->MakeUniqueId(),
|
||||
AceType::MakeRefPtr<LinearLayoutPattern>(true));
|
||||
customNode->MountToParent(columnNode);
|
||||
@ -300,7 +284,6 @@ void BubbleView::UpdateCommonParam(int32_t popupId, const RefPtr<PopupParam>& pa
|
||||
}
|
||||
popupLayoutProp->UpdateShowInSubWindow(param->IsShowInSubWindow());
|
||||
popupLayoutProp->UpdateBlockEvent(param->IsBlockEvent());
|
||||
SetHitTestMode(popupNode, param->IsBlockEvent());
|
||||
popupLayoutProp->UpdatePositionOffset(OffsetF(param->GetTargetOffset().GetX(), param->GetTargetOffset().GetY()));
|
||||
if (param->IsMaskColorSetted()) {
|
||||
popupPaintProp->UpdateMaskColor(param->GetMaskColor());
|
||||
@ -314,8 +297,6 @@ RefPtr<FrameNode> BubbleView::CreateMessage(const std::string& message, bool IsU
|
||||
{
|
||||
auto textId = ElementRegister::GetInstance()->MakeUniqueId();
|
||||
auto textNode = FrameNode::CreateFrameNode(V2::TEXT_ETS_TAG, textId, AceType::MakeRefPtr<TextPattern>());
|
||||
// The buttons in popupNode can not get focus, if the textNode in the button is not focusable
|
||||
textNode->GetOrCreateFocusHub()->SetFocusable(true);
|
||||
auto layoutProperty = textNode->GetLayoutProperty<TextLayoutProperty>();
|
||||
layoutProperty->UpdateContent(message);
|
||||
auto popupTheme = GetPopupTheme();
|
||||
@ -457,7 +438,7 @@ RefPtr<FrameNode> BubbleView::CreateButton(
|
||||
popupInfo.markNeedUpdate = true;
|
||||
popupInfo.popupId = -1;
|
||||
popupInfo.markNeedUpdate = isShow;
|
||||
overlayManager->HidePopup(targetId, popupInfo);
|
||||
overlayManager->UpdatePopupNode(targetId, popupInfo);
|
||||
};
|
||||
if (buttonParam.action) {
|
||||
buttonEventHub->AddClickEvent(buttonParam.action);
|
||||
|
@ -511,130 +511,54 @@ void OverlayManager::PopToast(int32_t toastId)
|
||||
pipeline->SendEventToAccessibility(event);
|
||||
}
|
||||
|
||||
void OverlayManager::ShowPopup(int32_t targetId, const PopupInfo& popupInfo)
|
||||
void OverlayManager::UpdatePopupNode(int32_t targetId, const PopupInfo& popupInfo)
|
||||
{
|
||||
LOGI("Show Popup, target id = %{public}d", targetId);
|
||||
popupMap_[targetId] = popupInfo;
|
||||
if (!popupInfo.markNeedUpdate) {
|
||||
return;
|
||||
}
|
||||
popupMap_[targetId].markNeedUpdate = false;
|
||||
auto popupNode = popupInfo.popupNode;
|
||||
CHECK_NULL_VOID(popupNode);
|
||||
auto layoutProp = popupNode->GetLayoutProperty<BubbleLayoutProperty>();
|
||||
CHECK_NULL_VOID(layoutProp);
|
||||
auto paintProperty = popupNode->GetPaintProperty<BubbleRenderProperty>();
|
||||
CHECK_NULL_VOID(paintProperty);
|
||||
auto isTypeWithOption = paintProperty->GetPrimaryButtonShow().value_or(false);
|
||||
|
||||
auto rootNode = rootNodeWeak_.Upgrade();
|
||||
auto container = Container::Current();
|
||||
if (container && container->IsScenceBoardWindow()) {
|
||||
rootNode = FindWindowScene(popupInfo.target.Upgrade());
|
||||
}
|
||||
CHECK_NULL_VOID(rootNode);
|
||||
CHECK_NULL_VOID_NOLOG(popupInfo.markNeedUpdate);
|
||||
CHECK_NULL_VOID_NOLOG(popupInfo.popupNode);
|
||||
|
||||
const auto& rootChildren = rootNode->GetChildren();
|
||||
auto iter = std::find(rootChildren.rbegin(), rootChildren.rend(), popupNode);
|
||||
if (iter != rootChildren.rend()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// attach popupNode before entering animation
|
||||
LOGI("popup begin push, target id = %{public}d", targetId);
|
||||
popupNode->GetEventHub<BubbleEventHub>()->FireChangeEvent(true);
|
||||
popupNode->MountToParent(rootNode);
|
||||
rootNode->MarkDirtyNode(PROPERTY_UPDATE_MEASURE_SELF);
|
||||
popupMap_[targetId].isCurrentOnShow = true;
|
||||
|
||||
auto popupPattern = popupNode->GetPattern<BubblePattern>();
|
||||
CHECK_NULL_VOID(popupPattern);
|
||||
if (isTypeWithOption) {
|
||||
BlurLowerNode(popupNode);
|
||||
auto onFinish = [popupNodeWk = WeakPtr<FrameNode>(popupNode), weak = WeakClaim(this)]() {
|
||||
auto overlayManager = weak.Upgrade();
|
||||
auto popupNode = popupNodeWk.Upgrade();
|
||||
CHECK_NULL_VOID(overlayManager && popupNode);
|
||||
overlayManager->FocusOverlayNode(popupNode);
|
||||
};
|
||||
popupPattern->StartEnteringAnimation(onFinish);
|
||||
} else {
|
||||
popupPattern->StartEnteringAnimation(nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
void OverlayManager::HidePopup(int32_t targetId, const PopupInfo& popupInfo)
|
||||
{
|
||||
LOGI("Hide Popup, target id = %{public}d", targetId);
|
||||
popupMap_[targetId] = popupInfo;
|
||||
if (!popupInfo.markNeedUpdate) {
|
||||
return;
|
||||
}
|
||||
popupMap_[targetId].markNeedUpdate = false;
|
||||
auto popupNode = popupInfo.popupNode;
|
||||
CHECK_NULL_VOID(popupNode);
|
||||
auto layoutProp = popupNode->GetLayoutProperty<BubbleLayoutProperty>();
|
||||
auto isShowInSubWindow = layoutProp->GetShowInSubWindow().value_or(false);
|
||||
CHECK_NULL_VOID(layoutProp);
|
||||
auto paintProperty = popupNode->GetPaintProperty<BubbleRenderProperty>();
|
||||
CHECK_NULL_VOID(paintProperty);
|
||||
auto isTypeWithOption = paintProperty->GetPrimaryButtonShow().value_or(false);
|
||||
|
||||
auto rootNode = rootNodeWeak_.Upgrade();
|
||||
auto container = Container::Current();
|
||||
if (container && container->IsScenceBoardWindow()) {
|
||||
rootNode = FindWindowScene(popupInfo.target.Upgrade());
|
||||
}
|
||||
CHECK_NULL_VOID(rootNode);
|
||||
|
||||
const auto& rootChildren = rootNode->GetChildren();
|
||||
auto iter = std::find(rootChildren.rbegin(), rootChildren.rend(), popupNode);
|
||||
if (iter == rootChildren.rend()) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto popupPattern = popupNode->GetPattern<BubblePattern>();
|
||||
CHECK_NULL_VOID(popupPattern);
|
||||
if (popupPattern->GetTransitionStatus() == TransitionStatus::EXITING) {
|
||||
return;
|
||||
}
|
||||
popupPattern->SetTransitionStatus(TransitionStatus::EXITING);
|
||||
if (isTypeWithOption) {
|
||||
ResetLowerNodeFocusable(popupNode);
|
||||
}
|
||||
// detach popupNode after exiting animation
|
||||
popupMap_[targetId].isCurrentOnShow = false;
|
||||
popupPattern->StartExitingAnimation(
|
||||
[isShowInSubWindow, isTypeWithOption, popupNodeWk = WeakPtr<FrameNode>(popupNode),
|
||||
rootNodeWk = WeakPtr<UINode>(rootNode), weak = WeakClaim(this)]() {
|
||||
LOGI("popup begin pop");
|
||||
auto rootNode = rootNodeWk.Upgrade();
|
||||
auto popupNode = popupNodeWk.Upgrade();
|
||||
auto overlayManager = weak.Upgrade();
|
||||
CHECK_NULL_VOID(rootNode && popupNode && overlayManager);
|
||||
|
||||
auto popupPattern = popupNode->GetPattern<BubblePattern>();
|
||||
CHECK_NULL_VOID(popupPattern);
|
||||
popupPattern->SetSkipHotArea(true);
|
||||
popupNode->GetEventHub<BubbleEventHub>()->FireChangeEvent(false);
|
||||
rootNode->RemoveChild(popupNode);
|
||||
rootNode->MarkDirtyNode(PROPERTY_UPDATE_MEASURE_SELF);
|
||||
if (isTypeWithOption) {
|
||||
overlayManager->BlurOverlayNode(popupNode);
|
||||
}
|
||||
if (isShowInSubWindow) {
|
||||
auto subwindow = SubwindowManager::GetInstance();
|
||||
CHECK_NULL_VOID(subwindow);
|
||||
subwindow->HideSubWindowNG();
|
||||
}
|
||||
});
|
||||
popupNode->OnAccessibilityEvent(
|
||||
AccessibilityEventType::CHANGE, WindowsContentChangeTypes::CONTENT_CHANGE_TYPE_SUBTREE);
|
||||
auto rootChildren = rootNode->GetChildren();
|
||||
auto iter = std::find(rootChildren.begin(), rootChildren.end(), popupInfo.popupNode);
|
||||
if (iter != rootChildren.end()) {
|
||||
// Pop popup
|
||||
CHECK_NULL_VOID_NOLOG(popupInfo.isCurrentOnShow);
|
||||
LOGI("OverlayManager: Popup begin pop");
|
||||
popupInfo.popupNode->GetEventHub<BubbleEventHub>()->FireChangeEvent(false);
|
||||
rootNode->RemoveChild(popupMap_[targetId].popupNode);
|
||||
AccessibilityEvent event;
|
||||
event.type = AccessibilityEventType::CHANGE;
|
||||
event.windowContentChangeTypes = WindowsContentChangeTypes::CONTENT_CHANGE_TYPE_SUBTREE;
|
||||
auto pipeline = PipelineContext::GetCurrentContext();
|
||||
CHECK_NULL_VOID(pipeline);
|
||||
pipeline->SendEventToAccessibility(event);
|
||||
#ifdef ENABLE_DRAG_FRAMEWORK
|
||||
RemoveEventColumn();
|
||||
RemovePixelMapAnimation(false, 0, 0);
|
||||
RemoveFilter();
|
||||
RemoveEventColumn();
|
||||
RemovePixelMapAnimation(false, 0, 0);
|
||||
RemoveFilter();
|
||||
#endif // ENABLE_DRAG_FRAMEWORK
|
||||
} else {
|
||||
// Push popup
|
||||
CHECK_NULL_VOID_NOLOG(!popupInfo.isCurrentOnShow);
|
||||
LOGI("OverlayManager: Popup begin push");
|
||||
popupInfo.popupNode->GetEventHub<BubbleEventHub>()->FireChangeEvent(true);
|
||||
auto hub = popupInfo.popupNode->GetEventHub<BubbleEventHub>();
|
||||
if (!popupInfo.isBlockEvent && hub) {
|
||||
auto ges = hub->GetOrCreateGestureEventHub();
|
||||
if (ges) {
|
||||
ges->SetHitTestMode(HitTestMode::HTMTRANSPARENT_SELF);
|
||||
}
|
||||
}
|
||||
popupMap_[targetId].popupNode->MountToParent(rootNode);
|
||||
}
|
||||
popupMap_[targetId].isCurrentOnShow = !popupInfo.isCurrentOnShow;
|
||||
rootNode->MarkDirtyNode(PROPERTY_UPDATE_MEASURE_SELF);
|
||||
}
|
||||
|
||||
void OverlayManager::ShowIndexerPopup(int32_t targetId, RefPtr<FrameNode>& customNode)
|
||||
@ -680,6 +604,30 @@ void OverlayManager::RemoveIndexerPopup()
|
||||
rootNode->MarkDirtyNode(PROPERTY_UPDATE_BY_CHILD_REQUEST);
|
||||
}
|
||||
|
||||
void OverlayManager::HidePopup(int32_t targetId, const PopupInfo& popupInfo)
|
||||
{
|
||||
LOGI("OverlayManager:: Hide Popup");
|
||||
popupMap_[targetId] = popupInfo;
|
||||
CHECK_NULL_VOID_NOLOG(popupInfo.markNeedUpdate);
|
||||
popupMap_[targetId].markNeedUpdate = false;
|
||||
CHECK_NULL_VOID_NOLOG(popupInfo.popupNode);
|
||||
popupInfo.popupNode->GetEventHub<BubbleEventHub>()->FireChangeEvent(false);
|
||||
CHECK_NULL_VOID_NOLOG(popupInfo.isCurrentOnShow);
|
||||
popupMap_[targetId].isCurrentOnShow = !popupInfo.isCurrentOnShow;
|
||||
auto pattern = popupInfo.popupNode->GetPattern<BubblePattern>();
|
||||
CHECK_NULL_VOID(pattern);
|
||||
pattern->SetSkipHotArea(true);
|
||||
|
||||
auto rootNode = rootNodeWeak_.Upgrade();
|
||||
CHECK_NULL_VOID(rootNode);
|
||||
auto rootChildren = rootNode->GetChildren();
|
||||
auto iter = std::find(rootChildren.begin(), rootChildren.end(), popupInfo.popupNode);
|
||||
if (iter != rootChildren.end()) {
|
||||
rootNode->RemoveChild(popupMap_[targetId].popupNode);
|
||||
rootNode->MarkDirtyNode(PROPERTY_UPDATE_MEASURE_SELF);
|
||||
}
|
||||
}
|
||||
|
||||
void OverlayManager::HideCustomPopups()
|
||||
{
|
||||
if (popupMap_.empty()) {
|
||||
@ -707,7 +655,11 @@ void OverlayManager::HideCustomPopups()
|
||||
if (showInSubWindow) {
|
||||
SubwindowManager::GetInstance()->HidePopupNG(targetNodeId);
|
||||
} else {
|
||||
HidePopup(targetNodeId, popupInfo);
|
||||
UpdatePopupNode(targetNodeId, popupInfo);
|
||||
CHECK_NULL_VOID(popupInfo.popupNode);
|
||||
auto pattern = popupInfo.popupNode->GetPattern<BubblePattern>();
|
||||
CHECK_NULL_VOID(pattern);
|
||||
pattern->SetTransitionStatus(TransitionStatus::INVISIABLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -715,6 +667,7 @@ void OverlayManager::HideCustomPopups()
|
||||
|
||||
void OverlayManager::HideAllPopups()
|
||||
{
|
||||
LOGD("OverlayManager::HideAllPopups");
|
||||
if (popupMap_.empty()) {
|
||||
LOGD("OverlayManager: popupMap is empty");
|
||||
return;
|
||||
@ -1088,18 +1041,23 @@ bool OverlayManager::RemoveDialog(const RefPtr<FrameNode>& overlay, bool isBackP
|
||||
|
||||
bool OverlayManager::RemoveBubble(const RefPtr<FrameNode>& overlay)
|
||||
{
|
||||
auto bubbleEventHub = overlay->GetEventHub<BubbleEventHub>();
|
||||
CHECK_NULL_RETURN(bubbleEventHub, false);
|
||||
bubbleEventHub->FireChangeEvent(false);
|
||||
auto rootNode = overlay->GetParent();
|
||||
CHECK_NULL_RETURN(rootNode, false);
|
||||
for (const auto& popup : popupMap_) {
|
||||
auto targetId = popup.first;
|
||||
auto popupInfo = popup.second;
|
||||
if (overlay == popupInfo.popupNode) {
|
||||
popupInfo.markNeedUpdate = true;
|
||||
HidePopup(targetId, popupInfo);
|
||||
popupMap_.erase(targetId);
|
||||
rootNode->RemoveChild(overlay);
|
||||
rootNode->MarkDirtyNode(PROPERTY_UPDATE_BY_CHILD_REQUEST);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool OverlayManager::RemoveMenu(const RefPtr<FrameNode>& overlay)
|
||||
{
|
||||
auto menuWrapperPattern = overlay->GetPattern<MenuWrapperPattern>();
|
||||
|
@ -71,8 +71,8 @@ public:
|
||||
void ShowIndexerPopup(int32_t targetId, RefPtr<FrameNode>& customNode);
|
||||
void RemoveIndexerPopupById(int32_t targetId);
|
||||
void RemoveIndexerPopup();
|
||||
void UpdatePopupNode(int32_t targetId, const PopupInfo& popupInfo);
|
||||
void HidePopup(int32_t targetId, const PopupInfo& popupInfo);
|
||||
void ShowPopup(int32_t targetId, const PopupInfo& popupInfo);
|
||||
void ErasePopup(int32_t targetId);
|
||||
void HideAllPopups();
|
||||
void HideCustomPopups();
|
||||
|
@ -116,7 +116,7 @@ void OverlayManagerTestNg::CreateSheetStyle(SheetStyle& sheetStyle)
|
||||
}
|
||||
/**
|
||||
* @tc.name: PopupTest001
|
||||
* @tc.desc: Test OverlayManager::ShowPopup.
|
||||
* @tc.desc: Test OverlayManager::UpdatePopupNode.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(OverlayManagerTestNg, PopupTest001, TestSize.Level1)
|
||||
@ -138,14 +138,14 @@ HWTEST_F(OverlayManagerTestNg, PopupTest001, TestSize.Level1)
|
||||
popupInfo.isCurrentOnShow = true;
|
||||
|
||||
/**
|
||||
* @tc.steps: step2. create overlayManager and call HidePopup.
|
||||
* @tc.steps: step2. create overlayManager and call UpdatePopupNode.
|
||||
* @tc.expected: popupMap's data is updated successfully
|
||||
*/
|
||||
auto rootNode = FrameNode::CreateFrameNode(V2::ROOT_ETS_TAG, 1, AceType::MakeRefPtr<RootPattern>());
|
||||
popupNode->MountToParent(rootNode);
|
||||
rootNode->MarkDirtyNode();
|
||||
auto overlayManager = AceType::MakeRefPtr<OverlayManager>(rootNode);
|
||||
overlayManager->HidePopup(targetId, popupInfo);
|
||||
overlayManager->UpdatePopupNode(targetId, popupInfo);
|
||||
EXPECT_FALSE(overlayManager->popupMap_[targetId].isCurrentOnShow);
|
||||
|
||||
/**
|
||||
@ -592,16 +592,16 @@ HWTEST_F(OverlayManagerTestNg, PopupTest002, TestSize.Level1)
|
||||
popups.emplace_back(popupInfo);
|
||||
}
|
||||
/**
|
||||
* @tc.steps: step2. create overlayManager and call ShowPopup.
|
||||
* @tc.steps: step2. create overlayManager and call UpdatePopupNode.
|
||||
* @tc.expected: Push popup successfully
|
||||
*/
|
||||
auto rootNode = FrameNode::CreateFrameNode(V2::ROOT_ETS_TAG, 1, AceType::MakeRefPtr<RootPattern>());
|
||||
auto overlayManager = AceType::MakeRefPtr<OverlayManager>(rootNode);
|
||||
auto targetId1 = targetNodes[0]->GetId();
|
||||
auto targetId2 = targetNodes[1]->GetId();
|
||||
overlayManager->ShowPopup(targetId1, popups[0]);
|
||||
overlayManager->UpdatePopupNode(targetId1, popups[0]);
|
||||
EXPECT_TRUE(overlayManager->popupMap_[targetId1].isCurrentOnShow);
|
||||
overlayManager->ShowPopup(targetId2, popups[1]);
|
||||
overlayManager->UpdatePopupNode(targetId2, popups[1]);
|
||||
EXPECT_TRUE(overlayManager->popupMap_[targetId2].isCurrentOnShow);
|
||||
/**
|
||||
* @tc.steps: step3. call HideCustomPopups when childCount is 2
|
||||
@ -614,8 +614,8 @@ HWTEST_F(OverlayManagerTestNg, PopupTest002, TestSize.Level1)
|
||||
* @tc.steps: step4. call RemoveOverlay when childCount is 2
|
||||
* @tc.expected: remove one popupNode at a time
|
||||
*/
|
||||
overlayManager->HidePopup(targetId1, popups[0]);
|
||||
overlayManager->HidePopup(targetId2, popups[1]);
|
||||
overlayManager->UpdatePopupNode(targetId1, popups[0]);
|
||||
overlayManager->UpdatePopupNode(targetId2, popups[1]);
|
||||
EXPECT_TRUE(overlayManager->RemoveOverlay(false));
|
||||
EXPECT_FALSE(overlayManager->popupMap_.empty());
|
||||
overlayManager->ErasePopup(targetId1);
|
||||
@ -828,7 +828,7 @@ HWTEST_F(OverlayManagerTestNg, PopupTest004, TestSize.Level1)
|
||||
*/
|
||||
auto rootNode = FrameNode::CreateFrameNode(V2::ROOT_ETS_TAG, 1, AceType::MakeRefPtr<RootPattern>());
|
||||
auto overlayManager = AceType::MakeRefPtr<OverlayManager>(rootNode);
|
||||
overlayManager->ShowPopup(targetId, popupInfo);
|
||||
overlayManager->UpdatePopupNode(targetId, popupInfo);
|
||||
overlayManager->HideAllPopups();
|
||||
EXPECT_FALSE(overlayManager->popupMap_[targetId].markNeedUpdate);
|
||||
EXPECT_EQ(rootNode->GetChildren().size(), 1);
|
||||
@ -837,7 +837,7 @@ HWTEST_F(OverlayManagerTestNg, PopupTest004, TestSize.Level1)
|
||||
* @tc.expected: popupMap's data is updated successfully
|
||||
*/
|
||||
layoutProp->UpdateShowInSubWindow(true);
|
||||
overlayManager->ShowPopup(targetId, popupInfo);
|
||||
overlayManager->UpdatePopupNode(targetId, popupInfo);
|
||||
overlayManager->HideAllPopups();
|
||||
EXPECT_FALSE(overlayManager->popupMap_[targetId].markNeedUpdate);
|
||||
|
||||
@ -898,7 +898,7 @@ HWTEST_F(OverlayManagerTestNg, RemoveOverlayTest001, TestSize.Level1)
|
||||
*/
|
||||
auto rootNode = FrameNode::CreateFrameNode(V2::ROOT_ETS_TAG, 1, AceType::MakeRefPtr<RootPattern>());
|
||||
auto overlayManager = AceType::MakeRefPtr<OverlayManager>(rootNode);
|
||||
overlayManager->HidePopup(targetId, popupInfo);
|
||||
overlayManager->UpdatePopupNode(targetId, popupInfo);
|
||||
EXPECT_FALSE(overlayManager->popupMap_[targetId].markNeedUpdate);
|
||||
auto res = overlayManager->RemoveOverlay(false);
|
||||
EXPECT_FALSE(res);
|
||||
|
@ -1076,7 +1076,7 @@ HWTEST_F(ViewAbstractTestNg, ViewAbstractTest025, TestSize.Level1)
|
||||
PopupInfo info = overlayManager->GetPopupInfo(targetNode->GetId());
|
||||
info.isCurrentOnShow = true;
|
||||
info.popupId = 1;
|
||||
overlayManager->ShowPopup(targetNode->GetId(), info);
|
||||
overlayManager->UpdatePopupNode(targetNode->GetId(), info);
|
||||
|
||||
/**
|
||||
* @tc.steps: step3. Call BindPopup many times.
|
||||
|
@ -26,7 +26,7 @@ void OverlayManager::ShowToast(
|
||||
|
||||
void OverlayManager::PopToast(int32_t toastId) {}
|
||||
|
||||
void OverlayManager::ShowPopup(int32_t targetId, const PopupInfo& popupInfo) {}
|
||||
void OverlayManager::UpdatePopupNode(int32_t targetId, const PopupInfo& popupInfo) {}
|
||||
|
||||
void OverlayManager::HidePopup(int32_t targetId, const PopupInfo& popupInfo) {}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user