mirror of
https://gitee.com/openharmony/arkui_ace_engine
synced 2024-11-26 16:52:10 +00:00
!48499 popUp&toast 修改context获取方式,由PipelineContext::GetCurrentContext改为GetContext
Merge pull request !48499 from 林昊/toast_241114
This commit is contained in:
commit
a595cfc28e
@ -142,8 +142,7 @@ void BubblePattern::OnAttachToFrameNode()
|
||||
|
||||
void BubblePattern::OnDetachFromFrameNode(FrameNode* frameNode)
|
||||
{
|
||||
CHECK_NULL_VOID(frameNode);
|
||||
auto pipeline = frameNode->GetContextRefPtr();
|
||||
auto pipeline = PipelineContext::GetCurrentContextSafelyWithCheck();
|
||||
CHECK_NULL_VOID(pipeline);
|
||||
pipeline->RemoveWindowSizeChangeCallback(frameNode->GetId());
|
||||
pipeline->RemoveWindowStateChangedCallback(frameNode->GetId());
|
||||
|
@ -219,9 +219,7 @@ Dimension ToastPattern::GetOffsetX(const RefPtr<LayoutWrapper>& layoutWrapper)
|
||||
|
||||
Dimension ToastPattern::GetOffsetY(const RefPtr<LayoutWrapper>& layoutWrapper)
|
||||
{
|
||||
auto host = GetHost();
|
||||
CHECK_NULL_RETURN(host, Dimension(0.0));
|
||||
auto context = IsDefaultToast() ? host->GetContextRefPtr() : GetMainPipelineContext();
|
||||
auto context = GetToastContext();
|
||||
CHECK_NULL_RETURN(context, Dimension(0.0));
|
||||
auto text = layoutWrapper->GetOrCreateChildByIndex(0);
|
||||
CHECK_NULL_RETURN(text, Dimension(0.0));
|
||||
@ -446,10 +444,10 @@ void ToastPattern::OnAttachToFrameNode()
|
||||
|
||||
void ToastPattern::OnDetachFromFrameNode(FrameNode* node)
|
||||
{
|
||||
CHECK_NULL_VOID(node);
|
||||
auto containerId = Container::CurrentId();
|
||||
auto parentContainerId = SubwindowManager::GetInstance()->GetParentContainerId(containerId);
|
||||
auto pipeline = parentContainerId < 0 ? node->GetContextRefPtr() : PipelineContext::GetMainPipelineContext();
|
||||
auto current_context = PipelineContext::GetCurrentContextSafelyWithCheck();
|
||||
auto pipeline = parentContainerId < 0 ? current_context : PipelineContext::GetMainPipelineContext();
|
||||
CHECK_NULL_VOID(pipeline);
|
||||
if (HasFoldDisplayModeChangedCallbackId()) {
|
||||
pipeline->UnRegisterFoldDisplayModeChangedCallback(foldDisplayModeChangedCallbackId_.value_or(-1));
|
||||
@ -664,4 +662,11 @@ NG::SizeF ToastPattern::GetSystemTopMostSubwindowSize() const
|
||||
}
|
||||
return windowSize;
|
||||
}
|
||||
RefPtr<PipelineContext> ToastPattern::GetToastContext()
|
||||
{
|
||||
auto host = GetHost();
|
||||
CHECK_NULL_RETURN(host, nullptr);
|
||||
auto context = IsDefaultToast() ? host->GetContextRefPtr() : GetMainPipelineContext();
|
||||
return context;
|
||||
}
|
||||
} // namespace OHOS::Ace::NG
|
||||
|
@ -147,6 +147,7 @@ public:
|
||||
|
||||
void InitUIExtensionHostWindowRect();
|
||||
|
||||
RefPtr<PipelineContext> GetToastContext();
|
||||
private:
|
||||
void BeforeCreateLayoutWrapper() override;
|
||||
void UpdateToastSize(const RefPtr<FrameNode>& toast);
|
||||
|
Loading…
Reference in New Issue
Block a user