diff --git a/adapter/ohos/entrance/ace_container.cpp b/adapter/ohos/entrance/ace_container.cpp index dc0b1d890bd..26787d33048 100644 --- a/adapter/ohos/entrance/ace_container.cpp +++ b/adapter/ohos/entrance/ace_container.cpp @@ -1149,7 +1149,8 @@ bool AceContainer::UpdatePopupUIExtension(const RefPtr& node) auto uiContentImpl = reinterpret_cast(uiContent); CHECK_NULL_RETURN(uiContentImpl, false); auto viewDataWrap = ViewDataWrap::CreateViewDataWrap(); - uiContentImpl->DumpViewData(node, viewDataWrap); + auto autoFillContainerNode = node->GetFirstAutoFillContainerNode(); + uiContentImpl->DumpViewData(autoFillContainerNode, viewDataWrap, true); auto viewDataWrapOhos = AceType::DynamicCast(viewDataWrap); CHECK_NULL_RETURN(viewDataWrapOhos, false); auto viewData = viewDataWrapOhos->GetViewData(); @@ -1170,7 +1171,8 @@ bool AceContainer::RequestAutoFill(const RefPtr& node, AceAutoFil CHECK_NULL_RETURN(uiContentImpl, false); auto viewDataWrap = ViewDataWrap::CreateViewDataWrap(); CHECK_NULL_RETURN(viewDataWrap, false); - uiContentImpl->DumpViewData(node, viewDataWrap); + auto autoFillContainerNode = node->GetFirstAutoFillContainerNode(); + uiContentImpl->DumpViewData(autoFillContainerNode, viewDataWrap, true); auto callback = std::make_shared(pipelineContext, node, autoFillType); auto viewDataWrapOhos = AceType::DynamicCast(viewDataWrap); diff --git a/adapter/ohos/entrance/ui_content_impl.cpp b/adapter/ohos/entrance/ui_content_impl.cpp index 1c7ca7e1f7d..e82348b49d5 100644 --- a/adapter/ohos/entrance/ui_content_impl.cpp +++ b/adapter/ohos/entrance/ui_content_impl.cpp @@ -2580,7 +2580,8 @@ bool UIContentImpl::DumpViewData(AbilityBase::ViewData& viewData, AbilityBase::A return ret; } -bool UIContentImpl::DumpViewData(const RefPtr& node, RefPtr viewDataWrap) +bool UIContentImpl::DumpViewData(const RefPtr& node, RefPtr viewDataWrap, + bool skipSubAutoFillContainer) { CHECK_NULL_RETURN(viewDataWrap, false); auto context = context_.lock(); @@ -2608,7 +2609,7 @@ bool UIContentImpl::DumpViewData(const RefPtr& node, RefPtr(container->GetPipelineContext()); CHECK_NULL_RETURN(pipelineContext, false); - return pipelineContext->DumpPageViewData(node, viewDataWrap); + return pipelineContext->DumpPageViewData(node, viewDataWrap, skipSubAutoFillContainer); } void UIContentImpl::SearchElementInfoByAccessibilityId( diff --git a/adapter/ohos/entrance/ui_content_impl.h b/adapter/ohos/entrance/ui_content_impl.h index 6da8365670d..23e003bbfac 100644 --- a/adapter/ohos/entrance/ui_content_impl.h +++ b/adapter/ohos/entrance/ui_content_impl.h @@ -215,7 +215,8 @@ public: AbilityBase::AutoFillType ViewDataToType(const AbilityBase::ViewData& viewData); bool DumpViewData(AbilityBase::ViewData& viewData, AbilityBase::AutoFillType& type) override; bool CheckNeedAutoSave() override; - bool DumpViewData(const RefPtr& node, RefPtr viewDataWrap); + bool DumpViewData(const RefPtr& node, RefPtr viewDataWrap, + bool skipSubAutoFillContainer = false); void SearchElementInfoByAccessibilityId( int64_t elementId, int32_t mode, diff --git a/frameworks/core/common/autofill/auto_fill_trigger_state_holder.h b/frameworks/core/common/autofill/auto_fill_trigger_state_holder.h new file mode 100644 index 00000000000..c0ced38d0f4 --- /dev/null +++ b/frameworks/core/common/autofill/auto_fill_trigger_state_holder.h @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef FOUNDATION_ACE_FRAMEWORKS_CORE_COMMON_AUTO_FILL_TRIGGER_STATE_HOLDER_H +#define FOUNDATION_ACE_FRAMEWORKS_CORE_COMMON_AUTO_FILL_TRIGGER_STATE_HOLDER_H + +#include "base/memory/ace_type.h" + +namespace OHOS::Ace { +class AutoFillTriggerStateHolder : public virtual AceType { + DECLARE_ACE_TYPE(AutoFillTriggerStateHolder, AceType); + +public: + AutoFillTriggerStateHolder() = default; + ~AutoFillTriggerStateHolder() override = default; + + void SetAutoFillPasswordTriggered(bool value) + { + autoFillPasswordTriggered_ = value; + } + + bool IsAutoFillPasswordTriggered() const + { + return autoFillPasswordTriggered_; + } + + void SetAutoFillNewPasswordTriggered(bool value) + { + autoFillNewPasswordTriggered_ = value; + } + + bool IsAutoFillNewPasswordTriggered() const + { + return autoFillNewPasswordTriggered_; + } +private: + bool autoFillPasswordTriggered_ = false; + bool autoFillNewPasswordTriggered_ = false; +}; +} // namespace OHOS::Ace +#endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMMON_AUTO_FILL_TRIGGER_STATE_HOLDER_H diff --git a/frameworks/core/components_ng/base/frame_node.cpp b/frameworks/core/components_ng/base/frame_node.cpp index ed2d003ee4e..10640efb90f 100644 --- a/frameworks/core/components_ng/base/frame_node.cpp +++ b/frameworks/core/components_ng/base/frame_node.cpp @@ -1659,6 +1659,18 @@ RefPtr FrameNode::GetPageNode() return AceType::DynamicCast(parent); } +RefPtr FrameNode::GetFirstAutoFillContainerNode() +{ + if (IsAutoFillContainerNode()) { + return Claim(this); + } + auto parent = GetParent(); + while (parent && !parent->IsAutoFillContainerNode()) { + parent = parent->GetParent(); + } + return AceType::DynamicCast(parent); +} + void FrameNode::NotifyFillRequestSuccess(RefPtr nodeWrap, AceAutoFillType autoFillType) { if (pattern_) { diff --git a/frameworks/core/components_ng/base/frame_node.h b/frameworks/core/components_ng/base/frame_node.h index 1092b2b5528..6492251bc2d 100644 --- a/frameworks/core/components_ng/base/frame_node.h +++ b/frameworks/core/components_ng/base/frame_node.h @@ -774,6 +774,7 @@ public: OffsetF GetOffsetInScreen(); RefPtr GetPixelMap(); RefPtr GetPageNode(); + RefPtr GetFirstAutoFillContainerNode(); RefPtr GetNodeContainer(); RefPtr GetContentModifier(); diff --git a/frameworks/core/components_ng/base/ui_node.cpp b/frameworks/core/components_ng/base/ui_node.cpp index 915ecd9dfde..66eec1aea4e 100644 --- a/frameworks/core/components_ng/base/ui_node.cpp +++ b/frameworks/core/components_ng/base/ui_node.cpp @@ -574,11 +574,22 @@ void UINode::OnAttachToMainTree(bool) } } -void UINode::DumpViewDataPageNodes(RefPtr viewDataWrap) +bool UINode::IsAutoFillContainerNode() +{ + return tag_ == V2::PAGE_ETS_TAG || tag_ == V2::NAVDESTINATION_VIEW_ETS_TAG; +} + +void UINode::DumpViewDataPageNodes(RefPtr viewDataWrap, bool skipSubAutoFillContainer) { DumpViewDataPageNode(viewDataWrap); for (const auto& item : GetChildren()) { - item->DumpViewDataPageNodes(viewDataWrap); + if (!item) { + continue; + } + if (skipSubAutoFillContainer && item->IsAutoFillContainerNode()) { + continue; + } + item->DumpViewDataPageNodes(viewDataWrap, skipSubAutoFillContainer); } } diff --git a/frameworks/core/components_ng/base/ui_node.h b/frameworks/core/components_ng/base/ui_node.h index c5b08c9f156..e600e2e4af3 100644 --- a/frameworks/core/components_ng/base/ui_node.h +++ b/frameworks/core/components_ng/base/ui_node.h @@ -164,7 +164,8 @@ public: // the corresponding LayoutWrapper tree node at this time like add self wrapper to wrapper tree. virtual void AdjustLayoutWrapperTree(const RefPtr& parent, bool forceMeasure, bool forceLayout); - void DumpViewDataPageNodes(RefPtr viewDataWrap); + bool IsAutoFillContainerNode(); + void DumpViewDataPageNodes(RefPtr viewDataWrap, bool skipSubAutoFillContainer = false); bool NeedRequestAutoSave(); // DFX info. void DumpTree(int32_t depth); diff --git a/frameworks/core/components_ng/pattern/navigation/navigation_pattern.cpp b/frameworks/core/components_ng/pattern/navigation/navigation_pattern.cpp index c06bf97f5e2..4d234b3a8a7 100644 --- a/frameworks/core/components_ng/pattern/navigation/navigation_pattern.cpp +++ b/frameworks/core/components_ng/pattern/navigation/navigation_pattern.cpp @@ -1750,6 +1750,11 @@ void NavigationPattern::StartTransition(const RefPtr& p // fire onWillHide auto hostNode = AceType::DynamicCast(GetHost()); CHECK_NULL_VOID(hostNode); + if (!isPopPage && !preDestination && navigationMode_ == NavigationMode::STACK) { + // NavBar will be covered in STACK mode + auto navBarNode = AceType::DynamicCast(hostNode->GetNavBarNode()); + ProcessAutoSave(navBarNode); + } if (isPopPage || (preDestination && hostNode->GetLastStandardIndex() > preDestination->GetIndex())) { NotifyDestinationLifecycle(preDestination, NavDestinationLifecycle::ON_WILL_HIDE, true); } @@ -1779,6 +1784,17 @@ void NavigationPattern::StartTransition(const RefPtr& p }); } +void NavigationPattern::ProcessAutoSave(const RefPtr& node) +{ + CHECK_NULL_VOID(node); + if (!node->NeedRequestAutoSave()) { + return; + } + auto container = Container::Current(); + CHECK_NULL_VOID(container); + container->RequestAutoSave(node); +} + void NavigationPattern::NotifyDestinationLifecycle(const RefPtr& uiNode, NavDestinationLifecycle lifecycle, bool isNavigationChanged) { diff --git a/frameworks/core/components_ng/pattern/navigation/navigation_pattern.h b/frameworks/core/components_ng/pattern/navigation/navigation_pattern.h index cd4fca78b23..bbb92b1798c 100644 --- a/frameworks/core/components_ng/pattern/navigation/navigation_pattern.h +++ b/frameworks/core/components_ng/pattern/navigation/navigation_pattern.h @@ -411,6 +411,7 @@ private: void StartTransition(const RefPtr& preDestination, const RefPtr& topDestination, bool isAnimated, bool isPopPage, bool isNeedVisible = false); + void ProcessAutoSave(const RefPtr& node); void PerformanceEventReport(int32_t nodeCount, int32_t depth, const std::string& navDestinationName); void FireShowAndHideLifecycle(const RefPtr& preDestination, diff --git a/frameworks/core/components_ng/pattern/navrouter/navdestination_event_hub.cpp b/frameworks/core/components_ng/pattern/navrouter/navdestination_event_hub.cpp index a1e2d713456..3dc66ade250 100644 --- a/frameworks/core/components_ng/pattern/navrouter/navdestination_event_hub.cpp +++ b/frameworks/core/components_ng/pattern/navrouter/navdestination_event_hub.cpp @@ -14,6 +14,7 @@ */ #include "frameworks/core/components_ng/pattern/navrouter/navdestination_event_hub.h" +#include "core/common/container.h" #include "frameworks/core/components_ng/pattern/navrouter/navdestination_group_node.h" #include "frameworks/core/components_ng/pattern/navrouter/navdestination_pattern.h" namespace OHOS::Ace::NG { @@ -38,4 +39,16 @@ void NavDestinationEventHub::FireOnDisappear() pattern->SetCustomNode(nullptr); }); } + +void NavDestinationEventHub::FireAutoSave() +{ + auto node = GetFrameNode(); + CHECK_NULL_VOID(node); + if (!node->NeedRequestAutoSave()) { + return; + } + auto container = Container::Current(); + CHECK_NULL_VOID(container); + container->RequestAutoSave(node); +} } \ No newline at end of file diff --git a/frameworks/core/components_ng/pattern/navrouter/navdestination_event_hub.h b/frameworks/core/components_ng/pattern/navrouter/navdestination_event_hub.h index a3a58ef1d0c..3a0fba4bcd5 100644 --- a/frameworks/core/components_ng/pattern/navrouter/navdestination_event_hub.h +++ b/frameworks/core/components_ng/pattern/navrouter/navdestination_event_hub.h @@ -231,6 +231,8 @@ public: if (onWillHide_) { onWillHide_(); } + + FireAutoSave(); } void SetOnWillDisAppear(std::function& willDisAppear) @@ -256,6 +258,8 @@ private: return node->GetPattern(); } + void FireAutoSave(); + OnStateChangeEvent onStateChangeEvent_; std::function onShownEvent_; std::function onHiddenEvent_; diff --git a/frameworks/core/components_ng/pattern/navrouter/navdestination_pattern.h b/frameworks/core/components_ng/pattern/navrouter/navdestination_pattern.h index 6c6275854ef..27fc39efbfc 100644 --- a/frameworks/core/components_ng/pattern/navrouter/navdestination_pattern.h +++ b/frameworks/core/components_ng/pattern/navrouter/navdestination_pattern.h @@ -18,6 +18,7 @@ #include "base/memory/referenced.h" #include "base/utils/utils.h" +#include "core/common/autofill/auto_fill_trigger_state_holder.h" #include "core/components_ng/base/ui_node.h" #include "core/components_ng/pattern/navigation/navigation_event_hub.h" #include "core/components_ng/pattern/navigation/navigation_stack.h" @@ -32,8 +33,8 @@ namespace OHOS::Ace::NG { -class NavDestinationPattern : public Pattern, public FocusView { - DECLARE_ACE_TYPE(NavDestinationPattern, Pattern, FocusView); +class NavDestinationPattern : public Pattern, public FocusView, public AutoFillTriggerStateHolder { + DECLARE_ACE_TYPE(NavDestinationPattern, Pattern, FocusView, AutoFillTriggerStateHolder); public: explicit NavDestinationPattern(const RefPtr& shallowBuilder); diff --git a/frameworks/core/components_ng/pattern/stage/page_pattern.h b/frameworks/core/components_ng/pattern/stage/page_pattern.h index 0c21ab12a20..ea41d15d920 100644 --- a/frameworks/core/components_ng/pattern/stage/page_pattern.h +++ b/frameworks/core/components_ng/pattern/stage/page_pattern.h @@ -22,6 +22,7 @@ #include "base/utils/noncopyable.h" #include "core/animation/animator_info.h" #include "core/animation/page_transition_common.h" +#include "core/common/autofill/auto_fill_trigger_state_holder.h" #include "core/components_ng/pattern/stage/content_root_pattern.h" #include "core/components_ng/pattern/stage/page_event_hub.h" #include "core/components_ng/pattern/stage/page_info.h" @@ -44,8 +45,8 @@ enum class RouterPageState { }; // PagePattern is the base class for page root render node. -class ACE_EXPORT PagePattern : public ContentRootPattern, public FocusView { - DECLARE_ACE_TYPE(PagePattern, ContentRootPattern, FocusView); +class ACE_EXPORT PagePattern : public ContentRootPattern, public FocusView, public AutoFillTriggerStateHolder { + DECLARE_ACE_TYPE(PagePattern, ContentRootPattern, FocusView, AutoFillTriggerStateHolder); public: explicit PagePattern(const RefPtr& pageInfo) : pageInfo_(pageInfo) {} @@ -161,26 +162,6 @@ public: isRenderDone_ = true; } - void SetAutoFillPasswordTriggered(bool value) - { - autoFillPasswordTriggered_ = value; - } - - bool IsAutoFillPasswordTriggered() const - { - return autoFillPasswordTriggered_; - } - - void SetAutoFillNewPasswordTriggered(bool value) - { - autoFillNewPasswordTriggered_ = value; - } - - bool IsAutoFillNewPasswordTriggered() const - { - return autoFillNewPasswordTriggered_; - } - void SetDynamicPageSizeCallback(DynamicPageSizeCallback&& dynamicPageSizeCallback) { dynamicPageSizeCallback_ = std::move(dynamicPageSizeCallback); @@ -247,8 +228,6 @@ private: bool isFirstLoad_ = true; bool isPageInTransition_ = false; bool isRenderDone_ = false; - bool autoFillPasswordTriggered_ = false; - bool autoFillNewPasswordTriggered_ = false; SharedTransitionMap sharedTransitionMap_; JSAnimatorMap jsAnimatorMap_; diff --git a/frameworks/core/components_ng/pattern/text_field/text_field_pattern.cpp b/frameworks/core/components_ng/pattern/text_field/text_field_pattern.cpp index 33f97224343..df46b454e0d 100644 --- a/frameworks/core/components_ng/pattern/text_field/text_field_pattern.cpp +++ b/frameworks/core/components_ng/pattern/text_field/text_field_pattern.cpp @@ -49,6 +49,7 @@ #include "core/components_ng/base/inspector_filter.h" #include "core/components_ng/event/focus_hub.h" #include "core/components_ng/image_provider/image_loading_context.h" +#include "core/components_ng/pattern/navrouter/navdestination_pattern.h" #include "core/components_ng/pattern/overlay/modal_style.h" #include "core/components_ng/pattern/search/search_event_hub.h" #include "core/components_ng/pattern/search/search_pattern.h" @@ -1948,26 +1949,47 @@ bool TextFieldPattern::IsAutoFillPasswordType(const AceAutoFillType& autoFillTyp autoFillType == AceAutoFillType::ACE_NEW_PASSWORD); } -bool TextFieldPattern::CheckAutoFillType(const AceAutoFillType& aceAutoFillAllType) +bool TextFieldPattern::CheckAutoFillType(const AceAutoFillType& autoFillType) +{ + if (autoFillType == AceAutoFillType::ACE_UNSPECIFIED) { + TAG_LOGE(AceLogTag::ACE_AUTO_FILL, "CheckAutoFillType :autoFillType is ACE_UNSPECIFIED."); + return false; + } else if (IsAutoFillPasswordType(autoFillType)) { + return GetAutoFillTriggeredStateByType(autoFillType); + } + return true; +} + +bool TextFieldPattern::GetAutoFillTriggeredStateByType(const AceAutoFillType& autoFillType) { auto host = GetHost(); CHECK_NULL_RETURN(host, false); - auto pageNode = host->GetPageNode(); - CHECK_NULL_RETURN(pageNode, false); - auto pagePattern = pageNode->GetPattern(); - CHECK_NULL_RETURN(pagePattern, false); - auto layoutProperty = GetLayoutProperty(); - CHECK_NULL_RETURN(layoutProperty, false); - if (aceAutoFillAllType == AceAutoFillType::ACE_UNSPECIFIED) { - TAG_LOGE(AceLogTag::ACE_AUTO_FILL, "CheckAutoFillType :aceAutoFillAllType is ACE_UNSPECIFIED."); - return false; - } else if (aceAutoFillAllType == AceAutoFillType::ACE_USER_NAME || - aceAutoFillAllType == AceAutoFillType::ACE_PASSWORD) { - return !pagePattern->IsAutoFillPasswordTriggered(); - } else if (aceAutoFillAllType == AceAutoFillType::ACE_NEW_PASSWORD) { - return !pagePattern->IsAutoFillNewPasswordTriggered(); + auto autoFillContainerNode = host->GetFirstAutoFillContainerNode(); + CHECK_NULL_RETURN(autoFillContainerNode, false); + auto stateHolder = autoFillContainerNode->GetPattern(); + CHECK_NULL_RETURN(stateHolder, false); + if (autoFillType == AceAutoFillType::ACE_USER_NAME || autoFillType == AceAutoFillType::ACE_PASSWORD) { + return !stateHolder->IsAutoFillPasswordTriggered(); + } + if (autoFillType == AceAutoFillType::ACE_NEW_PASSWORD) { + return !stateHolder->IsAutoFillNewPasswordTriggered(); + } + return false; +} + +void TextFieldPattern::SetAutoFillTriggeredStateByType(const AceAutoFillType& autoFillType) +{ + auto host = GetHost(); + CHECK_NULL_VOID(host); + auto autoFillContainerNode = host->GetFirstAutoFillContainerNode(); + CHECK_NULL_VOID(autoFillContainerNode); + auto stateHolder = autoFillContainerNode->GetPattern(); + CHECK_NULL_VOID(stateHolder); + if (autoFillType == AceAutoFillType::ACE_USER_NAME || autoFillType == AceAutoFillType::ACE_PASSWORD) { + stateHolder->SetAutoFillPasswordTriggered(true); + } else if (autoFillType == AceAutoFillType::ACE_NEW_PASSWORD) { + stateHolder->SetAutoFillNewPasswordTriggered(true); } - return true; } AceAutoFillType TextFieldPattern::GetAutoFillType() @@ -2009,22 +2031,12 @@ bool TextFieldPattern::ProcessAutoFill(bool& isPopup) } auto host = GetHost(); CHECK_NULL_RETURN(host, false); - auto pageNode = host->GetPageNode(); - CHECK_NULL_RETURN(pageNode, false); - auto pagePattern = pageNode->GetPattern(); - CHECK_NULL_RETURN(pagePattern, false); - auto layoutProperty = GetLayoutProperty(); - CHECK_NULL_RETURN(layoutProperty, false); auto autoFillType = GetAutoFillType(); auto container = Container::Current(); CHECK_NULL_RETURN(container, false); - if (autoFillType == AceAutoFillType::ACE_USER_NAME || autoFillType == AceAutoFillType::ACE_PASSWORD) { - pagePattern->SetAutoFillPasswordTriggered(true); - } else if (autoFillType == AceAutoFillType::ACE_NEW_PASSWORD) { - pagePattern->SetAutoFillNewPasswordTriggered(true); - } + SetAutoFillTriggeredStateByType(autoFillType); SetFillRequestFinish(false); - return (container->RequestAutoFill(host, autoFillType, isPopup)); + return container->RequestAutoFill(host, autoFillType, isPopup); } void TextFieldPattern::HandleDoubleClickEvent(GestureEvent& info) diff --git a/frameworks/core/components_ng/pattern/text_field/text_field_pattern.h b/frameworks/core/components_ng/pattern/text_field/text_field_pattern.h index 9f34a1c3cb5..fe0238f781a 100644 --- a/frameworks/core/components_ng/pattern/text_field/text_field_pattern.h +++ b/frameworks/core/components_ng/pattern/text_field/text_field_pattern.h @@ -29,6 +29,7 @@ #include "base/memory/referenced.h" #include "base/mousestyle/mouse_style.h" #include "base/view_data/view_data_wrap.h" +#include "core/common/autofill/auto_fill_trigger_state_holder.h" #include "core/common/clipboard/clipboard.h" #include "core/common/ime/text_edit_controller.h" #include "core/common/ime/text_input_action.h" @@ -1291,7 +1292,9 @@ private: void InitDragDropEventWithOutDragStart(); void UpdateBlurReason(); AceAutoFillType TextContentTypeToAceAutoFillType(const TextContentType& type); - bool CheckAutoFillType(const AceAutoFillType& aceAutoFillAllType); + bool CheckAutoFillType(const AceAutoFillType& autoFillType); + bool GetAutoFillTriggeredStateByType(const AceAutoFillType& autoFillType); + void SetAutoFillTriggeredStateByType(const AceAutoFillType& autoFillType); AceAutoFillType GetAutoFillType(); bool IsAutoFillPasswordType(const AceAutoFillType& autoFillType); void DoProcessAutoFill(); diff --git a/frameworks/core/pipeline_ng/pipeline_context.cpp b/frameworks/core/pipeline_ng/pipeline_context.cpp index aad795f0fbf..b07ecef4d9f 100644 --- a/frameworks/core/pipeline_ng/pipeline_context.cpp +++ b/frameworks/core/pipeline_ng/pipeline_context.cpp @@ -2114,19 +2114,24 @@ void PipelineContext::RegisterDumpInfoListener(const std::function& node, RefPtr viewDataWrap) +bool PipelineContext::DumpPageViewData(const RefPtr& node, RefPtr viewDataWrap, + bool skipSubAutoFillContainer) { CHECK_NULL_RETURN(viewDataWrap, false); RefPtr pageNode = nullptr; + RefPtr dumpNode = nullptr; if (node == nullptr) { if (stageManager_) { pageNode = stageManager_->GetLastPage(); + dumpNode = pageNode; } } else { pageNode = node->GetPageNode(); + dumpNode = node; } CHECK_NULL_RETURN(pageNode, false); - pageNode->DumpViewDataPageNodes(viewDataWrap); + CHECK_NULL_RETURN(dumpNode, false); + dumpNode->DumpViewDataPageNodes(viewDataWrap, skipSubAutoFillContainer); auto pagePattern = pageNode->GetPattern(); CHECK_NULL_RETURN(pagePattern, false); auto pageInfo = pagePattern->GetPageInfo(); diff --git a/frameworks/core/pipeline_ng/pipeline_context.h b/frameworks/core/pipeline_ng/pipeline_context.h index 524d6e51680..1375e64a0a4 100644 --- a/frameworks/core/pipeline_ng/pipeline_context.h +++ b/frameworks/core/pipeline_ng/pipeline_context.h @@ -539,7 +539,8 @@ public: void RegisterDumpInfoListener(const std::function&)>& callback); void DumpJsInfo(const std::vector& params) const; - bool DumpPageViewData(const RefPtr& node, RefPtr viewDataWrap); + bool DumpPageViewData(const RefPtr& node, RefPtr viewDataWrap, + bool skipSubAutoFillContainer = false); bool CheckNeedAutoSave(); bool CheckPageFocus(); bool CheckOverlayFocus();