From a02649375fde918d062c7f5ccdcc474d682e5578 Mon Sep 17 00:00:00 2001 From: lihao Date: Fri, 14 Jan 2022 09:31:54 +0800 Subject: [PATCH 1/2] fix 1.0 dialog panel inspector bugs Signed-off-by: lihao Change-Id: Idb03a15e6a3ddb6f6cc4b8f826b14acf8bcf246d --- adapter/preview/inspector/js_inspector_manager.cpp | 7 +++++++ frameworks/core/accessibility/accessibility_node.h | 8 ++++++++ frameworks/core/components/box/render_box.cpp | 7 ------- frameworks/core/components/dialog/dialog_component.cpp | 4 +--- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/adapter/preview/inspector/js_inspector_manager.cpp b/adapter/preview/inspector/js_inspector_manager.cpp index 85d845d43fb..09fd1e9a34c 100644 --- a/adapter/preview/inspector/js_inspector_manager.cpp +++ b/adapter/preview/inspector/js_inspector_manager.cpp @@ -96,6 +96,8 @@ const char INSPECTOR_STYLES[] = "$styles"; const char INSPECTOR_INNER_DEBUGLINE[] = "debugLine"; const char INSPECTOR_DEBUGLINE[] = "$debugLine"; +std::list specialComponentNameV1 = {"dialog", "panel"}; + } // namespace @@ -451,6 +453,11 @@ void JsInspectorManager::ClearContainer() std::string JsInspectorManager::UpdateNodeRectStrInfo(const RefPtr node) { + auto it = std::find(specialComponentNameV1.begin(), specialComponentNameV1.end(), node->GetTag()); + if (it != specialComponentNameV1.end()) { + node->UpdateRectWithChildRect(); + } + PositionInfo positionInfo = {0, 0, 0, 0}; if (node->GetTag() == DOM_NODE_TAG_SPAN) { positionInfo = { diff --git a/frameworks/core/accessibility/accessibility_node.h b/frameworks/core/accessibility/accessibility_node.h index e2a31ea07fd..8ae1d822ed1 100644 --- a/frameworks/core/accessibility/accessibility_node.h +++ b/frameworks/core/accessibility/accessibility_node.h @@ -750,6 +750,14 @@ public: } SetZIndex(index); } + + void UpdateRectWithChildRect() + { + if (children_.empty()) { + return; + } + SetRect(Children_.front()->GetRect()); + } #endif protected: diff --git a/frameworks/core/components/box/render_box.cpp b/frameworks/core/components/box/render_box.cpp index fb636c932e9..576fe25de45 100644 --- a/frameworks/core/components/box/render_box.cpp +++ b/frameworks/core/components/box/render_box.cpp @@ -536,13 +536,6 @@ void RenderBox::OnPaintFinish() node->SetHeight(size.Height()); node->SetLeft(globalOffset.GetX()); node->SetTop(globalOffset.GetY()); - if (node->GetTag() == "inspectDialog") { - auto parent = node->GetParentNode(); - parent->SetTop(node->GetTop()); - parent->SetLeft(node->GetLeft()); - parent->SetWidth(node->GetWidth()); - parent->SetHeight(node->GetHeight()); - } #endif } diff --git a/frameworks/core/components/dialog/dialog_component.cpp b/frameworks/core/components/dialog/dialog_component.cpp index 9e44a72853d..e24d257ed9b 100644 --- a/frameworks/core/components/dialog/dialog_component.cpp +++ b/frameworks/core/components/dialog/dialog_component.cpp @@ -546,9 +546,7 @@ RefPtr DialogComponent::GenerateComposed( accessibilityManager->CreateSpecializedNode(name, composedId, dialogTweenComposedId_); } else { dialogTweenComposedId_ = composedId; -#if defined(WINDOWS_PLATFORM) || defined(MAC_PLATFORM) - accessibilityManager->CreateSpecializedNode("inspectDialog", composedId, customDialogId_); -#else +#if !defined(WINDOWS_PLATFORM) && !defined(MAC_PLATFORM) accessibilityManager->CreateSpecializedNode(name, composedId, -1); #endif } From 0ac3a8149e9a48aa022713c886cdb91ece53bbc9 Mon Sep 17 00:00:00 2001 From: lihao Date: Fri, 14 Jan 2022 09:31:54 +0800 Subject: [PATCH 2/2] fix 1.0 dialog panel inspector bugs Signed-off-by: lihao Change-Id: Idb03a15e6a3ddb6f6cc4b8f826b14acf8bcf246d --- frameworks/core/accessibility/accessibility_node.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frameworks/core/accessibility/accessibility_node.h b/frameworks/core/accessibility/accessibility_node.h index 8ae1d822ed1..279ae07e613 100644 --- a/frameworks/core/accessibility/accessibility_node.h +++ b/frameworks/core/accessibility/accessibility_node.h @@ -756,7 +756,7 @@ public: if (children_.empty()) { return; } - SetRect(Children_.front()->GetRect()); + SetRect(children_.front()->GetRect()); } #endif