From 50332b7cbcdc7b323d6693aac7970b6884a5b716 Mon Sep 17 00:00:00 2001 From: fengjituo111 Date: Thu, 8 Aug 2024 10:34:45 +0000 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E8=81=94=E7=B3=BB=E4=BA=BA?= =?UTF-8?q?=E9=94=AE=E7=9B=98=E6=94=B6=E8=B5=B7crash=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: fengjituo111 Change-Id: I8d6e1c87e3b383a690f7ae308150f107c27aff02 --- .../components_ng/manager/safe_area/safe_area_manager.cpp | 2 +- .../components_ng/manager/safe_area/safe_area_manager.h | 2 +- frameworks/core/pipeline/pipeline_base.cpp | 3 +-- frameworks/core/pipeline/pipeline_base.h | 4 ++-- frameworks/core/pipeline_ng/pipeline_context.cpp | 6 +++--- frameworks/core/pipeline_ng/pipeline_context.h | 4 ++-- test/mock/core/pipeline/mock_pipeline_context.cpp | 4 ++-- 7 files changed, 12 insertions(+), 13 deletions(-) diff --git a/frameworks/core/components_ng/manager/safe_area/safe_area_manager.cpp b/frameworks/core/components_ng/manager/safe_area/safe_area_manager.cpp index 0a883125d45..2ae93bcf36e 100644 --- a/frameworks/core/components_ng/manager/safe_area/safe_area_manager.cpp +++ b/frameworks/core/components_ng/manager/safe_area/safe_area_manager.cpp @@ -70,7 +70,7 @@ bool SafeAreaManager::UpdateNavArea(const SafeAreaInsets& safeArea) return true; } -bool SafeAreaManager::UpdateKeyboardSafeArea(uint32_t keyboardHeight, std::optional rootHeight) +bool SafeAreaManager::UpdateKeyboardSafeArea(float keyboardHeight, std::optional rootHeight) { uint32_t bottom; if (systemSafeArea_.bottom_.IsValid()) { diff --git a/frameworks/core/components_ng/manager/safe_area/safe_area_manager.h b/frameworks/core/components_ng/manager/safe_area/safe_area_manager.h index 4eebc5e9885..5400ec6ddc3 100644 --- a/frameworks/core/components_ng/manager/safe_area/safe_area_manager.h +++ b/frameworks/core/components_ng/manager/safe_area/safe_area_manager.h @@ -97,7 +97,7 @@ public: * @param keyboardHeight The height of the keyboard in pixels. * @return true if the safe area was modified, false otherwise. */ - bool UpdateKeyboardSafeArea(uint32_t keyboardHeight, std::optional rootHeight = std::nullopt); + bool UpdateKeyboardSafeArea(float keyboardHeight, std::optional rootHeight = std::nullopt); /** * @brief Retrieves the inset of the safe area caused by the keyboard. diff --git a/frameworks/core/pipeline/pipeline_base.cpp b/frameworks/core/pipeline/pipeline_base.cpp index adb970077d3..33535f432d7 100644 --- a/frameworks/core/pipeline/pipeline_base.cpp +++ b/frameworks/core/pipeline/pipeline_base.cpp @@ -751,7 +751,7 @@ void PipelineBase::OnVirtualKeyboardAreaChange(Rect keyboardArea, double positio const std::shared_ptr& rsTransaction, bool forceChange) { auto currentContainer = Container::Current(); - auto keyboardHeight = static_cast(keyboardArea.Height()); + float keyboardHeight = keyboardArea.Height(); if (currentContainer && !currentContainer->IsSubContainer()) { auto subwindow = SubwindowManager::GetInstance()->GetSubwindow(currentContainer->GetInstanceId()); if (subwindow && subwindow->GetShown() && subwindow->IsFocused() && !CheckNeedAvoidInSubWindow()) { @@ -762,7 +762,6 @@ void PipelineBase::OnVirtualKeyboardAreaChange(Rect keyboardArea, double positio } } if (NotifyVirtualKeyBoard(rootWidth_, rootHeight_, keyboardHeight)) { - CheckAndUpdateKeyboardInset(keyboardHeight); return; } OnVirtualKeyboardHeightChange(keyboardHeight, positionY, height, rsTransaction, forceChange); diff --git a/frameworks/core/pipeline/pipeline_base.h b/frameworks/core/pipeline/pipeline_base.h index 9017d7d1718..3b05f7aa5fe 100644 --- a/frameworks/core/pipeline/pipeline_base.h +++ b/frameworks/core/pipeline/pipeline_base.h @@ -356,7 +356,7 @@ public: virtual void GetBoundingRectData(int32_t nodeId, Rect& rect) {} - virtual void CheckAndUpdateKeyboardInset(uint32_t keyboardHeight) {} + virtual void CheckAndUpdateKeyboardInset(float keyboardHeight) {} virtual RefPtr GetAccessibilityManager() const; @@ -1347,7 +1347,7 @@ protected: const std::shared_ptr& rsTransaction = nullptr, const float safeHeight = 0.0f, const bool supportAvoidance = false, bool forceChange = false) {} - virtual void OnVirtualKeyboardHeightChange(uint32_t keyboardHeight, double positionY, double height, + virtual void OnVirtualKeyboardHeightChange(float keyboardHeight, double positionY, double height, const std::shared_ptr& rsTransaction = nullptr, bool forceChange = false) {} diff --git a/frameworks/core/pipeline_ng/pipeline_context.cpp b/frameworks/core/pipeline_ng/pipeline_context.cpp index 208d1dbc2b2..cde5a93ed82 100644 --- a/frameworks/core/pipeline_ng/pipeline_context.cpp +++ b/frameworks/core/pipeline_ng/pipeline_context.cpp @@ -1457,7 +1457,7 @@ void PipelineContext::UpdateNavSafeArea(const SafeAreaInsets& navSafeArea) } } -void PipelineContext::CheckAndUpdateKeyboardInset(uint32_t keyboardHeight) +void PipelineContext::CheckAndUpdateKeyboardInset(float keyboardHeight) { safeAreaManager_->UpdateKeyboardSafeArea(keyboardHeight); } @@ -1749,7 +1749,7 @@ void PipelineContext::OriginalAvoidanceLogic( DoKeyboardAvoidAnimate(keyboardAnimationConfig_, keyboardHeight, func); } -void PipelineContext::OnVirtualKeyboardHeightChange(uint32_t keyboardHeight, double positionY, double height, +void PipelineContext::OnVirtualKeyboardHeightChange(float keyboardHeight, double positionY, double height, const std::shared_ptr& rsTransaction, bool forceChange) { CHECK_RUN_ON(UI); @@ -1845,7 +1845,7 @@ void PipelineContext::OnVirtualKeyboardHeightChange(uint32_t keyboardHeight, dou } TAG_LOGI(AceLogTag::ACE_KEYBOARD, - "keyboardHeight: %{public}d, positionY: %{public}f, textHeight: %{public}f, " + "keyboardHeight: %{public}f, positionY: %{public}f, textHeight: %{public}f, " "rootSize.Height() %{public}f final calculate keyboard offset is %{public}f", keyboardHeight, positionY, height, rootSize.Height(), context->safeAreaManager_->GetKeyboardOffset()); context->SyncSafeArea(SafeAreaSyncType::SYNC_TYPE_KEYBOARD); diff --git a/frameworks/core/pipeline_ng/pipeline_context.h b/frameworks/core/pipeline_ng/pipeline_context.h index 2c45a8ee383..385670f0004 100644 --- a/frameworks/core/pipeline_ng/pipeline_context.h +++ b/frameworks/core/pipeline_ng/pipeline_context.h @@ -303,7 +303,7 @@ public: bool CheckNeedAvoidInSubWindow() override; - void CheckAndUpdateKeyboardInset(uint32_t keyboardHeight) override; + void CheckAndUpdateKeyboardInset(float keyboardHeight) override; void UpdateSizeChangeReason( WindowSizeChangeReason type, const std::shared_ptr& rsTransaction = nullptr); @@ -866,7 +866,7 @@ protected: void OnVirtualKeyboardHeightChange(float keyboardHeight, const std::shared_ptr& rsTransaction = nullptr, const float safeHeight = 0.0f, const bool supportAvoidance = false, bool forceChange = false) override; - void OnVirtualKeyboardHeightChange(uint32_t keyboardHeight, double positionY, double height, + void OnVirtualKeyboardHeightChange(float keyboardHeight, double positionY, double height, const std::shared_ptr& rsTransaction = nullptr, bool forceChange = false) override; void SetIsLayouting(bool layouting) diff --git a/test/mock/core/pipeline/mock_pipeline_context.cpp b/test/mock/core/pipeline/mock_pipeline_context.cpp index eeb5bb14f1d..7543ffab6c9 100644 --- a/test/mock/core/pipeline/mock_pipeline_context.cpp +++ b/test/mock/core/pipeline/mock_pipeline_context.cpp @@ -325,7 +325,7 @@ void PipelineContext::OnVirtualKeyboardHeightChange(float keyboardHeight, const bool supportAvoidance, bool forceChange) {} -void PipelineContext::OnVirtualKeyboardHeightChange(uint32_t keyboardHeight, double positionY, double height, +void PipelineContext::OnVirtualKeyboardHeightChange(float keyboardHeight, double positionY, double height, const std::shared_ptr& rsTransaction, bool forceChange) {} @@ -643,7 +643,7 @@ void PipelineContext::ResetDragging() {} void PipelineContext::UpdateOriginAvoidArea(const Rosen::AvoidArea& avoidArea, uint32_t type) {} -void PipelineContext::CheckAndUpdateKeyboardInset(uint32_t keyboardHeight) {} +void PipelineContext::CheckAndUpdateKeyboardInset(float keyboardHeight) {} bool PipelineContext::PrintVsyncInfoIfNeed() const {