1 /*
2  * Copyright (c) 2023-2024 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include "core/components_ng/pattern/container_modal/enhance/container_modal_pattern_enhance.h"
17 
18 #include "base/memory/referenced.h"
19 #include "base/log/event_report.h"
20 #include "base/subwindow/subwindow.h"
21 #include "base/subwindow/subwindow_manager.h"
22 #include "base/utils/utils.h"
23 #include "core/common/container.h"
24 #include "core/components/common/layout/constants.h"
25 #include "core/components_ng/pattern/container_modal/container_modal_pattern.h"
26 #include "core/components_ng/pattern/container_modal/container_modal_theme.h"
27 #include "core/components_ng/pattern/container_modal/enhance/container_modal_view_enhance.h"
28 #include "core/components_ng/pattern/image/image_layout_property.h"
29 #include "core/components_ng/pattern/text/text_layout_property.h"
30 
31 namespace OHOS::Ace::NG {
32 namespace {
33 constexpr int32_t MAX_RECOVER_BUTTON_INDEX = 0;
34 constexpr int32_t MINIMIZE_BUTTON_INDEX = 1;
35 constexpr int32_t CLOSE_BUTTON_INDEX = 2;
36 constexpr int32_t TITLE_POPUP_DURATION = 400;
37 const int32_t DOUBLE_CLICK_TO_RECOVER = 2;
38 const int32_t DOUBLE_CLICK_TO_MAXIMIZE = 1;
39 
GetNotMovingWindowManager(WeakPtr<FrameNode> & weak)40 RefPtr<WindowManager> GetNotMovingWindowManager(WeakPtr<FrameNode>& weak)
41 {
42     auto node = weak.Upgrade();
43     CHECK_NULL_RETURN(node, nullptr);
44     auto pipeline = node->GetContextRefPtr();
45     CHECK_NULL_RETURN(pipeline, nullptr);
46     const auto& windowManager = pipeline->GetWindowManager();
47     CHECK_NULL_RETURN(windowManager, nullptr);
48     return windowManager;
49 }
50 } // namespace
51 
ShowTitle(bool isShow,bool hasDeco,bool needUpdate)52 void ContainerModalPatternEnhance::ShowTitle(bool isShow, bool hasDeco, bool needUpdate)
53 {
54     auto containerNode = GetHost();
55     CHECK_NULL_VOID(containerNode);
56     auto customTitleRow = GetCustomTitleRow();
57     CHECK_NULL_VOID(customTitleRow);
58     auto floatingTitleRow = GetFloatingTitleRow();
59     CHECK_NULL_VOID(floatingTitleRow);
60     bool isFocus_ = GetIsFocus();
61     if (needUpdate) {
62         LOGI("title is need update, isFocus_: %{public}d", isFocus_);
63         ChangeCustomTitle(isFocus_);
64         ChangeControlButtons(isFocus_);
65         return;
66     }
67     auto pipelineContext = PipelineContext::GetCurrentContext();
68     CHECK_NULL_VOID(pipelineContext);
69     auto theme = pipelineContext->GetTheme<ContainerModalTheme>();
70     auto stackNode = GetStackNode();
71     CHECK_NULL_VOID(stackNode);
72     auto windowManager = pipelineContext->GetWindowManager();
73     CHECK_NULL_VOID(windowManager);
74     windowMode_ = windowManager->GetWindowMode();
75     isShow = isShow && hasDeco;
76     // set container window show state to RS
77     pipelineContext->SetContainerWindow(isShow);
78     // update container modal padding and border
79     auto layoutProperty = containerNode->GetLayoutProperty();
80     CHECK_NULL_VOID(layoutProperty);
81     layoutProperty->UpdateAlignment(Alignment::TOP_LEFT);
82     bool isFloatingWindow = windowManager->GetWindowMode() == WindowMode::WINDOW_MODE_FLOATING;
83     BorderWidthProperty borderWidth;
84     borderWidth.SetBorderWidth((isFloatingWindow && isShow) ? CONTAINER_BORDER_WIDTH : 0.0_vp);
85     layoutProperty->UpdateBorderWidth(borderWidth);
86     auto renderContext = containerNode->GetRenderContext();
87     CHECK_NULL_VOID(renderContext);
88     renderContext->UpdateBackgroundColor(theme->GetBackGroundColor(isFocus_));
89     // only floating window show border
90     BorderRadiusProperty borderRadius;
91     borderRadius.SetRadius((isFloatingWindow && isShow) ? CONTAINER_OUTER_RADIUS : 0.0_vp);
92     renderContext->UpdateBorderRadius(borderRadius);
93     BorderColorProperty borderColor;
94     borderColor.SetColor((isFloatingWindow && isShow) ? CONTAINER_BORDER_COLOR : Color::TRANSPARENT);
95     renderContext->UpdateBorderColor(borderColor);
96 
97     // update stack content border
98     auto stackLayoutProperty = stackNode->GetLayoutProperty();
99     CHECK_NULL_VOID(stackLayoutProperty);
100     stackLayoutProperty->UpdateLayoutWeight(1.0f);
101     auto stackRenderContext = stackNode->GetRenderContext();
102     CHECK_NULL_VOID(stackRenderContext);
103     BorderRadiusProperty stageBorderRadius;
104     stageBorderRadius.SetRadius((isFloatingWindow && isShow) ? GetStackNodeRadius() : 0.0_vp);
105     stackRenderContext->UpdateBorderRadius(stageBorderRadius);
106     stackRenderContext->SetClipToBounds(true);
107     auto customTitleLayoutProperty = customTitleRow->GetLayoutProperty();
108     CHECK_NULL_VOID(customTitleLayoutProperty);
109     customTitleLayoutProperty->UpdateVisibility(
110         (isShow && customTitleSettedShow_) ? VisibleType::VISIBLE : VisibleType::GONE);
111 
112     auto floatingLayoutProperty = floatingTitleRow->GetLayoutProperty();
113     CHECK_NULL_VOID(floatingLayoutProperty);
114     floatingLayoutProperty->UpdateVisibility(VisibleType::GONE);
115     auto controlButtonsNode = GetControlButtonRow();
116     CHECK_NULL_VOID(controlButtonsNode);
117     auto controlButtonsLayoutProperty = controlButtonsNode->GetLayoutProperty();
118     CHECK_NULL_VOID(controlButtonsLayoutProperty);
119     ChangeFloatingTitle(isFocus_);
120     ChangeControlButtons(isFocus_);
121     auto controlButtonsContext = controlButtonsNode->GetRenderContext();
122     CHECK_NULL_VOID(controlButtonsContext);
123     controlButtonsContext->OnTransformTranslateUpdate({ 0.0f, 0.0f, 0.0f });
124     controlButtonsLayoutProperty->UpdateVisibility(isShow ? VisibleType::VISIBLE : VisibleType::GONE);
125     SetControlButtonVisibleBeforeAnim(isShow ? VisibleType::VISIBLE : VisibleType::GONE);
126     auto gestureRow = GetGestureRow();
127     CHECK_NULL_VOID(gestureRow);
128     if (enableContainerModalGesture_) {
129         AddPanEvent(customTitleRow);
130         AddPanEvent(gestureRow);
131     }
132     UpdateGestureRowVisible();
133     InitColumnTouchTestFunc();
134     controlButtonsNode->SetHitTestMode(HitTestMode::HTMTRANSPARENT_SELF);
135     auto stack = GetStackNode();
136     CHECK_NULL_VOID(stack);
137     stack->UpdateInspectorId(CONTAINER_MODAL_STACK_ID);
138 }
139 
GetTitleItemByIndex(const RefPtr<FrameNode> & controlButtonsNode,int32_t originIndex)140 RefPtr<UINode> ContainerModalPatternEnhance::GetTitleItemByIndex(
141     const RefPtr<FrameNode>& controlButtonsNode, int32_t originIndex)
142 {
143     return controlButtonsNode->GetChildAtIndex(originIndex);
144 }
145 
OnWindowFocused()146 void ContainerModalPatternEnhance::OnWindowFocused()
147 {
148     ContainerModalPattern::OnWindowFocused();
149     ContainerModalPattern::SetIsHoveredMenu(false);
150 }
151 
OnWindowUnfocused()152 void ContainerModalPatternEnhance::OnWindowUnfocused()
153 {
154     if (SubwindowManager::GetInstance()->GetCurrentWindow() &&
155         SubwindowManager::GetInstance()->GetCurrentWindow()->GetShown()) {
156         SetIsFocus(false);
157         ContainerModalPattern::SetIsHoveredMenu(true);
158         return;
159     }
160     ContainerModalPattern::OnWindowUnfocused();
161     ContainerModalPattern::SetIsHoveredMenu(false);
162 }
163 
OnWindowForceUnfocused()164 void ContainerModalPatternEnhance::OnWindowForceUnfocused()
165 {
166     if (!GetIsFocus()) {
167         ContainerModalPattern::SetIsHoveredMenu(false);
168         ContainerModalPattern::OnWindowUnfocused();
169     }
170 }
171 
ChangeCustomTitle(bool isFocus)172 void ContainerModalPatternEnhance::ChangeCustomTitle(bool isFocus)
173 {
174     // update custom title label
175     auto customTitleNode = GetCustomTitleNode();
176     CHECK_NULL_VOID(customTitleNode);
177     isFocus ? customTitleNode->FireOnWindowFocusedCallback() : customTitleNode->FireOnWindowUnfocusedCallback();
178 }
179 
ChangeControlButtons(bool isFocus)180 void ContainerModalPatternEnhance::ChangeControlButtons(bool isFocus)
181 {
182     auto controlButtonsNode = GetControlButtonRow();
183     CHECK_NULL_VOID(controlButtonsNode);
184 
185     // update maximize button
186     auto maximizeButton =
187         AceType::DynamicCast<FrameNode>(GetTitleItemByIndex(controlButtonsNode, MAX_RECOVER_BUTTON_INDEX));
188     auto pipeline = PipelineContext::GetCurrentContext();
189     CHECK_NULL_VOID(pipeline);
190     auto windowManager = pipeline->GetWindowManager();
191     MaximizeMode mode = windowManager->GetCurrentWindowMaximizeMode();
192     InternalResource::ResourceId maxId =
193         (mode == MaximizeMode::MODE_AVOID_SYSTEM_BAR || windowMode_ == WindowMode::WINDOW_MODE_FULLSCREEN ||
194             windowMode_ == WindowMode::WINDOW_MODE_SPLIT_PRIMARY ||
195             windowMode_ == WindowMode::WINDOW_MODE_SPLIT_SECONDARY)
196             ? InternalResource::ResourceId::IC_WINDOW_RESTORES
197             : InternalResource::ResourceId::IC_WINDOW_MAX;
198     ChangeTitleButtonIcon(maximizeButton, maxId, isFocus, false);
199 
200     // update minimize button
201     auto minimizeButton =
202         AceType::DynamicCast<FrameNode>(GetTitleItemByIndex(controlButtonsNode, MINIMIZE_BUTTON_INDEX));
203     ChangeTitleButtonIcon(minimizeButton, InternalResource::ResourceId::IC_WINDOW_MIN, isFocus, false);
204 
205     // update close button
206     auto closeButton = AceType::DynamicCast<FrameNode>(GetTitleItemByIndex(controlButtonsNode, CLOSE_BUTTON_INDEX));
207     ChangeTitleButtonIcon(closeButton, InternalResource::ResourceId::IC_WINDOW_CLOSE, isFocus, true);
208 }
209 
ChangeFloatingTitle(bool isFocus)210 void ContainerModalPatternEnhance::ChangeFloatingTitle(bool isFocus)
211 {
212     auto pipeline = PipelineContext::GetCurrentContext();
213     CHECK_NULL_VOID(pipeline);
214     auto windowManager = pipeline->GetWindowManager();
215     CHECK_NULL_VOID(windowManager);
216 
217     if (windowManager->GetWindowMode() != WindowMode::WINDOW_MODE_FLOATING &&
218         windowManager->GetWindowMode() != WindowMode::WINDOW_MODE_FULLSCREEN) {
219         windowManager->SetCurrentWindowMaximizeMode(MaximizeMode::MODE_RECOVER);
220     }
221 
222     auto floatingTitleRow = GetFloatingTitleRow();
223     CHECK_NULL_VOID(floatingTitleRow);
224     auto floatingContext = floatingTitleRow->GetRenderContext();
225     CHECK_NULL_VOID(floatingContext);
226     auto pipelineContext = PipelineContext::GetCurrentContext();
227     CHECK_NULL_VOID(pipelineContext);
228     auto theme = pipelineContext->GetTheme<ContainerModalTheme>();
229     floatingContext->UpdateBackgroundColor(theme->GetBackGroundColor(isFocus));
230     // update floating custom title label
231     auto customFloatingTitleNode = GetFloatingTitleNode();
232     CHECK_NULL_VOID(customFloatingTitleNode);
233     isFocus ? customFloatingTitleNode->FireOnWindowFocusedCallback()
234             : customFloatingTitleNode->FireOnWindowUnfocusedCallback();
235 }
236 
ChangeTitleButtonIcon(const RefPtr<FrameNode> & buttonNode,InternalResource::ResourceId icon,bool isFocus,bool isCloseBtn)237 void ContainerModalPatternEnhance::ChangeTitleButtonIcon(
238     const RefPtr<FrameNode>& buttonNode, InternalResource::ResourceId icon, bool isFocus, bool isCloseBtn)
239 {
240     ContainerModalPattern::ChangeTitleButtonIcon(buttonNode, icon, isFocus, isCloseBtn);
241 }
242 
SetContainerButtonHide(bool hideSplit,bool hideMaximize,bool hideMinimize,bool hideClose)243 void ContainerModalPatternEnhance::SetContainerButtonHide(bool hideSplit, bool hideMaximize, bool hideMinimize,
244     bool hideClose)
245 {
246     auto controlButtonsNode = GetControlButtonRow();
247     CHECK_NULL_VOID(controlButtonsNode);
248     ContainerModalViewEnhance::SetEnableSplit(!hideSplit);
249 
250     auto maximizeBtn =
251         AceType::DynamicCast<FrameNode>(GetTitleItemByIndex(controlButtonsNode, MAX_RECOVER_BUTTON_INDEX));
252     CHECK_NULL_VOID(maximizeBtn);
253     maximizeBtn->GetLayoutProperty()->UpdateVisibility(hideMaximize ? VisibleType::GONE : VisibleType::VISIBLE);
254     maximizeBtn->MarkDirtyNode();
255 
256     auto minimizeBtn =
257         AceType::DynamicCast<FrameNode>(GetTitleItemByIndex(controlButtonsNode, MINIMIZE_BUTTON_INDEX));
258     CHECK_NULL_VOID(minimizeBtn);
259     minimizeBtn->GetLayoutProperty()->UpdateVisibility(hideMinimize ? VisibleType::GONE : VisibleType::VISIBLE);
260     minimizeBtn->MarkDirtyNode();
261 
262     auto closeBtn = AceType::DynamicCast<FrameNode>(GetTitleItemByIndex(controlButtonsNode, CLOSE_BUTTON_INDEX));
263         CHECK_NULL_VOID(closeBtn);
264         closeBtn->GetLayoutProperty()->UpdateVisibility(hideClose ? VisibleType::GONE : VisibleType::VISIBLE);
265         closeBtn->MarkDirtyNode();
266     InitTitleRowLayoutProperty(GetCustomTitleRow());
267 }
268 
UpdateTitleInTargetPos(bool isShow,int32_t height)269 void ContainerModalPatternEnhance::UpdateTitleInTargetPos(bool isShow, int32_t height)
270 {
271     auto floatingTitleNode = GetFloatingTitleRow();
272     CHECK_NULL_VOID(floatingTitleNode);
273     auto floatingLayoutProperty = floatingTitleNode->GetLayoutProperty();
274     CHECK_NULL_VOID(floatingLayoutProperty);
275     auto floatingContext = floatingTitleNode->GetRenderContext();
276     CHECK_NULL_VOID(floatingContext);
277 
278     auto controlButtonsNode = GetControlButtonRow();
279     CHECK_NULL_VOID(controlButtonsNode);
280     auto controlButtonsLayoutProperty = controlButtonsNode->GetLayoutProperty();
281     CHECK_NULL_VOID(controlButtonsLayoutProperty);
282     auto buttonsContext = controlButtonsNode->GetRenderContext();
283     CHECK_NULL_VOID(buttonsContext);
284 
285     auto titlePopupDistance = titleHeight_.ConvertToPx();
286     auto cubicBezierCurve = AceType::MakeRefPtr<CubicCurve>(0.00, 0.00, 0.20, 1.00);
287     AnimationOption option;
288     option.SetDuration(TITLE_POPUP_DURATION);
289     option.SetCurve(cubicBezierCurve);
290 
291     if (isShow && CanShowFloatingTitle()) {
292         floatingContext->OnTransformTranslateUpdate({ 0.0f, height - static_cast<float>(titlePopupDistance), 0.0f });
293         floatingLayoutProperty->UpdateVisibility(floatingTitleSettedShow_ ? VisibleType::VISIBLE : VisibleType::GONE);
294         AnimationUtils::Animate(option, [floatingContext, height]() {
295             auto rect = floatingContext->GetPaintRectWithoutTransform();
296             floatingContext->OnTransformTranslateUpdate({ 0.0f, static_cast<float>(height - rect.GetY()), 0.0f });
297         });
298         buttonsContext->OnTransformTranslateUpdate({ 0.0f, height - static_cast<float>(titlePopupDistance), 0.0f });
299         SetControlButtonVisibleBeforeAnim(controlButtonsLayoutProperty->GetVisibilityValue());
300         controlButtonsLayoutProperty->UpdateVisibility(VisibleType::VISIBLE);
301         AnimationUtils::Animate(option, [buttonsContext, titlePopupDistance, height]() {
302             auto rect = buttonsContext->GetPaintRectWithoutTransform();
303             buttonsContext->OnTransformTranslateUpdate({ 0.0f, static_cast<float>(height -
304                 (titlePopupDistance - CONTAINER_TITLE_HEIGHT.ConvertToPx())/2 - rect.GetY()), 0.0f });
305         });
306     }
307 
308     if (!isShow && CanHideFloatingTitle()) {
309         auto beforeVisible = GetControlButtonVisibleBeforeAnim();
310         AnimationUtils::Animate(
311             option,
312             [floatingContext, buttonsContext, titlePopupDistance, beforeVisible]() {
313                 floatingContext->OnTransformTranslateUpdate({ 0.0f, static_cast<float>(-titlePopupDistance), 0.0f });
314                 buttonsContext->OnTransformTranslateUpdate({ 0.0f,
315                     beforeVisible == VisibleType::VISIBLE ? 0.0f : static_cast<float>(-titlePopupDistance), 0.0f });
316             },
317             [floatingLayoutProperty, controlButtonsLayoutProperty, beforeVisible, weak = WeakClaim(this)]() {
318                 auto containerModal = weak.Upgrade();
319                 CHECK_NULL_VOID(containerModal);
320                 floatingLayoutProperty->UpdateVisibility(VisibleType::GONE);
321                 controlButtonsLayoutProperty->UpdateVisibility(containerModal->GetControlButtonVisibleBeforeAnim());
322             });
323     }
324 }
325 
ClearTapGestureEvent(RefPtr<FrameNode> & containerTitleRow)326 void ContainerModalPatternEnhance::ClearTapGestureEvent(RefPtr<FrameNode>& containerTitleRow)
327 {
328     auto eventHub = containerTitleRow->GetOrCreateGestureEventHub();
329     CHECK_NULL_VOID(eventHub);
330     eventHub->ClearGesture();
331     eventHub->OnModifyDone();
332 }
333 
SetTapGestureEvent(RefPtr<FrameNode> & containerTitleRow)334 void ContainerModalPatternEnhance::SetTapGestureEvent(RefPtr<FrameNode>& containerTitleRow)
335 {
336     auto eventHub = containerTitleRow->GetOrCreateGestureEventHub();
337     CHECK_NULL_VOID(eventHub);
338     auto tapGesture = AceType::MakeRefPtr<NG::TapGesture>(2, 1);
339     CHECK_NULL_VOID(tapGesture);
340     WeakPtr<FrameNode> weakNode = frameNode_;
341     tapGesture->SetOnActionId([weakNode](GestureEvent& info) mutable {
342         TAG_LOGI(AceLogTag::ACE_APPBAR, "container window double click.");
343         auto containerNode = weakNode.Upgrade();
344         CHECK_NULL_VOID(containerNode);
345         auto windowManager = GetNotMovingWindowManager(weakNode);
346         CHECK_NULL_VOID(windowManager);
347         auto windowMode = windowManager->GetWindowMode();
348         auto maximizeMode = windowManager->GetCurrentWindowMaximizeMode();
349         if (maximizeMode == MaximizeMode::MODE_AVOID_SYSTEM_BAR || windowMode == WindowMode::WINDOW_MODE_FULLSCREEN ||
350             windowMode == WindowMode::WINDOW_MODE_SPLIT_PRIMARY ||
351             windowMode == WindowMode::WINDOW_MODE_SPLIT_SECONDARY) {
352             EventReport::ReportDoubleClickTitle(DOUBLE_CLICK_TO_RECOVER);
353             windowManager->WindowRecover();
354         } else if (windowMode == WindowMode::WINDOW_MODE_FLOATING) {
355             EventReport::ReportDoubleClickTitle(DOUBLE_CLICK_TO_MAXIMIZE);
356             windowManager->WindowMaximize(true);
357         }
358         containerNode->OnWindowFocused();
359     });
360     eventHub->AddGesture(tapGesture);
361     eventHub->OnModifyDone();
362 }
363 
EnablePanEventOnNode(RefPtr<FrameNode> & node,bool isEnable,const std::string & rowName)364 void ContainerModalPatternEnhance::EnablePanEventOnNode(
365     RefPtr<FrameNode>& node, bool isEnable, const std::string& rowName)
366 {
367     if (!node) {
368         TAG_LOGI(AceLogTag::ACE_APPBAR, "%{public}s is not exist when set pan event", rowName.c_str());
369         return;
370     }
371 
372     if (isEnable) {
373         AddPanEvent(node);
374     } else {
375         RemovePanEvent(node);
376     }
377 }
378 
EnableTapGestureOnNode(RefPtr<FrameNode> & node,bool isEnable,const std::string & rowName)379 void ContainerModalPatternEnhance::EnableTapGestureOnNode(
380     RefPtr<FrameNode>& node, bool isEnable, const std::string& rowName)
381 {
382     if (!node) {
383         TAG_LOGI(AceLogTag::ACE_APPBAR, "%{public}s is not exist when set tap gesture", rowName.c_str());
384         return;
385     }
386 
387     if (isEnable) {
388         SetTapGestureEvent(node);
389     } else {
390         ClearTapGestureEvent(node);
391     }
392 }
393 
EnableContainerModalGesture(bool isEnable)394 void ContainerModalPatternEnhance::EnableContainerModalGesture(bool isEnable)
395 {
396     TAG_LOGI(AceLogTag::ACE_APPBAR, "set event on container modal is %{public}d", isEnable);
397 
398     enableContainerModalGesture_ = isEnable;
399 
400     auto floatingTitleRow = GetFloatingTitleRow();
401     auto customTitleRow = GetCustomTitleRow();
402     auto gestureRow = GetGestureRow();
403     EnableTapGestureOnNode(floatingTitleRow, isEnable, "floating title row");
404     EnablePanEventOnNode(customTitleRow, isEnable, "custom title row");
405     EnableTapGestureOnNode(customTitleRow, isEnable, "custom title row");
406     EnablePanEventOnNode(gestureRow, isEnable, "gesture row");
407     EnableTapGestureOnNode(gestureRow, isEnable, "gesture row");
408 }
409 
GetFloatingTitleVisible()410 bool ContainerModalPatternEnhance::GetFloatingTitleVisible()
411 {
412     auto floatingTitleRow = GetFloatingTitleRow();
413     CHECK_NULL_RETURN(floatingTitleRow, false);
414     auto floatingTitleRowProp = floatingTitleRow->GetLayoutProperty();
415     CHECK_NULL_RETURN(floatingTitleRowProp, false);
416     return (floatingTitleRowProp->GetVisibilityValue() == VisibleType::VISIBLE);
417 }
418 
GetCustomTitleVisible()419 bool ContainerModalPatternEnhance::GetCustomTitleVisible()
420 {
421     auto customTitleRow = GetCustomTitleRow();
422     CHECK_NULL_RETURN(customTitleRow, false);
423     auto customTitleRowProp = customTitleRow->GetLayoutProperty();
424     CHECK_NULL_RETURN(customTitleRowProp, false);
425     return (customTitleRowProp->GetVisibilityValue() == VisibleType::VISIBLE);
426 }
427 
GetControlButtonVisible()428 bool ContainerModalPatternEnhance::GetControlButtonVisible()
429 {
430     auto controlButtonRow = GetControlButtonRow();
431     CHECK_NULL_RETURN(controlButtonRow, false);
432     auto controlButtonRowProp = controlButtonRow->GetLayoutProperty();
433     CHECK_NULL_RETURN(controlButtonRowProp, false);
434     return (controlButtonRowProp->GetVisibilityValue() == VisibleType::VISIBLE);
435 }
436 } // namespace OHOS::Ace::NG
437