mirror of
https://gitee.com/openharmony/arkui_ace_engine
synced 2024-11-27 01:03:08 +00:00
bugfix
Signed-off-by: luoying_ace_admin <luoying19@huawei.com> Change-Id: Ie68ae87223e40cb51abd9cda975b5aec419927a1
This commit is contained in:
parent
8699ca7261
commit
412e5e5beb
@ -713,6 +713,12 @@ public:
|
||||
void FireUIExtensionEventCallback(uint32_t eventId);
|
||||
void FireAccessibilityEventCallback(uint32_t eventId, int64_t parameter);
|
||||
|
||||
bool IsFloatingWindow() const override
|
||||
{
|
||||
CHECK_NULL_RETURN(uiWindow_, false);
|
||||
return uiWindow_->GetMode() == Rosen::WindowMode::WINDOW_MODE_FLOATING;
|
||||
}
|
||||
|
||||
private:
|
||||
virtual bool MaybeRelease() override;
|
||||
void InitializeFrontend();
|
||||
|
@ -414,6 +414,24 @@ NG::RectF SubwindowOhos::GetRect()
|
||||
return windowRect_;
|
||||
}
|
||||
|
||||
void SubwindowOhos::ResizeDialogSubwindow()
|
||||
{
|
||||
auto defaultDisplay = Rosen::DisplayManager::GetInstance().GetDefaultDisplay();
|
||||
CHECK_NULL_VOID(defaultDisplay);
|
||||
if (!(NearEqual(defaultDisplay->GetWidth(), window_->GetRect().width_) &&
|
||||
NearEqual(defaultDisplay->GetHeight(), window_->GetRect().height_))) {
|
||||
auto container = Container::Current();
|
||||
CHECK_NULL_VOID(container);
|
||||
auto taskExecutor = container->GetTaskExecutor();
|
||||
CHECK_NULL_VOID(taskExecutor);
|
||||
taskExecutor->PostTask(
|
||||
[this]() {
|
||||
ResizeWindow();
|
||||
},
|
||||
TaskExecutor::TaskType::UI, "ArkUIResizeDialogSubwindow");
|
||||
}
|
||||
}
|
||||
|
||||
void SubwindowOhos::ShowPopup(const RefPtr<Component>& newComponent, bool disableTouchEvent)
|
||||
{
|
||||
TAG_LOGD(AceLogTag::ACE_SUB_WINDOW, "show popup enter");
|
||||
|
@ -159,6 +159,8 @@ public:
|
||||
bool IsToastSubWindow() override;
|
||||
void DestroyWindow() override;
|
||||
|
||||
void ResizeDialogSubwindow() override;
|
||||
|
||||
private:
|
||||
RefPtr<StackElement> GetStack();
|
||||
void AddMenu(const RefPtr<Component>& newComponent);
|
||||
|
@ -186,6 +186,8 @@ public:
|
||||
virtual bool Close() = 0;
|
||||
virtual bool IsToastSubWindow() = 0;
|
||||
virtual void DestroyWindow() = 0;
|
||||
virtual void ResizeDialogSubwindow() = 0;
|
||||
|
||||
private:
|
||||
int32_t subwindowId_ = 0;
|
||||
int32_t uiExtensionHostWindowId_ = 0;
|
||||
|
@ -617,6 +617,12 @@ public:
|
||||
{
|
||||
return Rect();
|
||||
}
|
||||
|
||||
virtual bool IsFloatingWindow() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
protected:
|
||||
bool IsFontFileExistInPath(const std::string& path);
|
||||
std::string GetFontFamilyName(std::string path);
|
||||
|
@ -86,6 +86,8 @@ void DialogLayoutAlgorithm::Measure(LayoutWrapper* layoutWrapper)
|
||||
dialogPattern->UpdateDeviceOrientation(SystemProperties::GetDeviceOrientation());
|
||||
}
|
||||
UpdateSafeArea();
|
||||
isShowInFloatingWindow_ = dialogPattern->IsShowInFloatingWindow();
|
||||
ResizeDialogSubwindow(expandDisplay_, isShowInSubWindow_, isShowInFloatingWindow_);
|
||||
const auto& layoutConstraint = dialogProp->GetLayoutConstraint();
|
||||
const auto& parentIdealSize = layoutConstraint->parentIdealSize;
|
||||
OptionalSizeF realSize;
|
||||
@ -126,6 +128,18 @@ void DialogLayoutAlgorithm::Measure(LayoutWrapper* layoutWrapper)
|
||||
}
|
||||
}
|
||||
|
||||
void DialogLayoutAlgorithm::ResizeDialogSubwindow(
|
||||
bool expandDisplay, bool isShowInSubWindow, bool isShowInFloatingWindow)
|
||||
{
|
||||
if (expandDisplay && isShowInSubWindow && isShowInFloatingWindow) {
|
||||
auto currentId = Container::CurrentId();
|
||||
auto subWindow = SubwindowManager::GetInstance()->GetSubwindow(currentId >= MIN_SUBCONTAINER_ID ?
|
||||
SubwindowManager::GetInstance()->GetParentContainerId(currentId) : currentId);
|
||||
CHECK_NULL_VOID(subWindow);
|
||||
subWindow->ResizeDialogSubwindow();
|
||||
}
|
||||
}
|
||||
|
||||
void DialogLayoutAlgorithm::UpdateChildMaxSizeHeight(SizeT<float>& maxSize)
|
||||
{
|
||||
if (!isHoverMode_) {
|
||||
|
@ -96,6 +96,8 @@ private:
|
||||
void UpdateChildMaxSizeHeight(SizeT<float>& maxSize);
|
||||
void ParseSubwindowId(const RefPtr<DialogLayoutProperty>& dialogProp);
|
||||
|
||||
void ResizeDialogSubwindow(bool expandDisplay, bool isShowInSubWindow, bool isShowInFloatingWindow);
|
||||
|
||||
RectF touchRegion_;
|
||||
OffsetF topLeftPoint_;
|
||||
bool customSize_ = false;
|
||||
@ -126,6 +128,8 @@ private:
|
||||
|
||||
KeyboardAvoidMode keyboardAvoidMode_ = KeyboardAvoidMode::DEFAULT;
|
||||
|
||||
bool isShowInFloatingWindow_ = false;
|
||||
|
||||
ACE_DISALLOW_COPY_AND_MOVE(DialogLayoutAlgorithm);
|
||||
};
|
||||
} // namespace OHOS::Ace::NG
|
||||
|
@ -1815,6 +1815,25 @@ bool DialogPattern::IsShowInFreeMultiWindow()
|
||||
return container->IsFreeMultiWindow();
|
||||
}
|
||||
|
||||
bool DialogPattern::IsShowInFloatingWindow()
|
||||
{
|
||||
auto currentId = Container::CurrentId();
|
||||
auto container = Container::Current();
|
||||
if (!container) {
|
||||
TAG_LOGW(AceLogTag::ACE_DIALOG, "container is null");
|
||||
return false;
|
||||
}
|
||||
if (container->IsSubContainer()) {
|
||||
currentId = SubwindowManager::GetInstance()->GetParentContainerId(currentId);
|
||||
container = AceEngine::Get().GetContainer(currentId);
|
||||
if (!container) {
|
||||
TAG_LOGW(AceLogTag::ACE_DIALOG, "parent container is null");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return container->IsFloatingWindow();
|
||||
}
|
||||
|
||||
void DialogPattern::DumpSimplifyInfo(std::unique_ptr<JsonValue>& json)
|
||||
{
|
||||
json->Put("Type", DialogTypeUtils::ConvertDialogTypeToString(dialogProperties_.type).c_str());
|
||||
|
@ -311,6 +311,7 @@ public:
|
||||
}
|
||||
|
||||
bool IsShowInFreeMultiWindow();
|
||||
bool IsShowInFloatingWindow();
|
||||
|
||||
private:
|
||||
bool AvoidKeyboard() const override
|
||||
|
@ -99,6 +99,7 @@ public:
|
||||
MOCK_METHOD1(SetRect, void(const NG::RectF& rect));
|
||||
MOCK_METHOD0(IsToastSubWindow, bool());
|
||||
MOCK_METHOD0(DestroyWindow, void());
|
||||
MOCK_METHOD0(ResizeDialogSubwindow, void());
|
||||
};
|
||||
} // namespace OHOS::Ace
|
||||
#endif // FOUNDATION_ACE_TEST_MOCK_BASE_MOCK_SUBWINDOW_H
|
||||
|
Loading…
Reference in New Issue
Block a user