From de97efd814eb1c3fb9b9a94aa3e353e8ad175d97 Mon Sep 17 00:00:00 2001 From: Hosang Kim Date: Mon, 7 Mar 2022 23:26:49 +0900 Subject: [PATCH] libaurum: add updateXPath Change-Id: I61a2f9b89e2d50a8936ba17f67605f82824a93b4 --- libaurum/inc/Accessibility/AccessibleNode.h | 8 +++++++- libaurum/inc/Impl/Accessibility/AtspiAccessibleNode.h | 7 ++++++- libaurum/inc/Impl/Accessibility/MockAccessibleNode.h | 7 ++++++- libaurum/inc/UiObject.h | 7 +++++++ libaurum/src/Impl/Accessibility/AtspiAccessibleNode.cc | 14 +++++++++++++- libaurum/src/Impl/Accessibility/MockAccessibleNode.cc | 6 +++++- libaurum/src/UiObject.cc | 5 +++++ 7 files changed, 49 insertions(+), 5 deletions(-) diff --git a/libaurum/inc/Accessibility/AccessibleNode.h b/libaurum/inc/Accessibility/AccessibleNode.h index d37377e..0c47a2e 100644 --- a/libaurum/inc/Accessibility/AccessibleNode.h +++ b/libaurum/inc/Accessibility/AccessibleNode.h @@ -324,6 +324,11 @@ public: virtual void updateExtents() = 0; /** + * @copydoc UiObject::updateXPath() + */ + virtual void updateXPath() = 0; + + /** * @copydoc UiObject::setFocus() */ virtual bool setFocus() = 0; @@ -333,7 +338,7 @@ public: * * @since_tizen 6.5 */ - virtual void refresh() = 0; + virtual void refresh(bool updateAll = true) = 0; /** * @brief Gets available atspi action name. @@ -423,6 +428,7 @@ protected: std::string mAutomationId; std::string mType; std::string mStyle; + std::string mXPath; Rect mScreenBoundingBox; Rect mWindowBoundingBox; int mSupportingIfaces; diff --git a/libaurum/inc/Impl/Accessibility/AtspiAccessibleNode.h b/libaurum/inc/Impl/Accessibility/AtspiAccessibleNode.h index 7fb03ff..dd187f9 100644 --- a/libaurum/inc/Impl/Accessibility/AtspiAccessibleNode.h +++ b/libaurum/inc/Impl/Accessibility/AtspiAccessibleNode.h @@ -117,6 +117,11 @@ public: void updateExtents() override; /** + * @copydoc UiObject::updateXPath() + */ + void updateXPath() override; + + /** * @copydoc UiObject::setFocus() */ bool setFocus() override; @@ -124,7 +129,7 @@ public: /** * @copydoc AccessibleNode::refresh() */ - void refresh() override; + void refresh(bool updateAll = true) override; /** * @copydoc AccessibleNode::getActions() diff --git a/libaurum/inc/Impl/Accessibility/MockAccessibleNode.h b/libaurum/inc/Impl/Accessibility/MockAccessibleNode.h index d2d8e5e..1a2852f 100644 --- a/libaurum/inc/Impl/Accessibility/MockAccessibleNode.h +++ b/libaurum/inc/Impl/Accessibility/MockAccessibleNode.h @@ -116,6 +116,11 @@ public: * @since_tizen 6.5 */ void updateExtents() override; + /** + * @brief TBD + * @since_tizen 6.5 + */ + void updateXPath() override; /** * @brief TBD @@ -127,7 +132,7 @@ public: * @brief TBD * @since_tizen 6.5 */ - void refresh() override; + void refresh(bool updateAll = true) override; /** * @brief TBD diff --git a/libaurum/inc/UiObject.h b/libaurum/inc/UiObject.h index 6d8d623..ea84cad 100644 --- a/libaurum/inc/UiObject.h +++ b/libaurum/inc/UiObject.h @@ -481,6 +481,13 @@ public: void updateExtents() const; /** + * @brief Updates object's XPath information. + * + * @since_tizen 7.0 + */ + void updateXPath() const; + + /** * @brief Sets focus to object. * * @since_tizen 7.0 diff --git a/libaurum/src/Impl/Accessibility/AtspiAccessibleNode.cc b/libaurum/src/Impl/Accessibility/AtspiAccessibleNode.cc index fdf9c99..3cb67ea 100644 --- a/libaurum/src/Impl/Accessibility/AtspiAccessibleNode.cc +++ b/libaurum/src/Impl/Accessibility/AtspiAccessibleNode.cc @@ -230,6 +230,16 @@ void AtspiAccessibleNode::updateExtents() } } +void AtspiAccessibleNode::updateXPath() +{ + auto XMLDocMap = AccessibleWatcher::getInstance()->getXMLDocMap(); + if (XMLDocMap.count(mPkg) == 0) return; + + auto XMLDoc = XMLDocMap[mPkg]; + + mXPath = XMLDoc->getXPath(mId); +} + bool AtspiAccessibleNode::setFocus() { AtspiComponent *component = AtspiWrapper::Atspi_accessible_get_component_iface(mNode); @@ -242,7 +252,7 @@ bool AtspiAccessibleNode::setFocus() return false; } -void AtspiAccessibleNode::refresh() +void AtspiAccessibleNode::refresh(bool updateAll) { AtspiWrapper::Atspi_accessible_clear_cache(mNode); @@ -327,6 +337,8 @@ void AtspiAccessibleNode::refresh() g_free(windowExtent); } g_object_unref(component); + + if (updateAll) updateXPath(); } } else { setFeatureProperty(ATSPI_STATE_INVALID); diff --git a/libaurum/src/Impl/Accessibility/MockAccessibleNode.cc b/libaurum/src/Impl/Accessibility/MockAccessibleNode.cc index 75a46e1..cd78ffa 100644 --- a/libaurum/src/Impl/Accessibility/MockAccessibleNode.cc +++ b/libaurum/src/Impl/Accessibility/MockAccessibleNode.cc @@ -109,12 +109,16 @@ void MockAccessibleNode::updateExtents() { } +void MockAccessibleNode::updateXPath() +{ +} + bool MockAccessibleNode::setFocus() { return false; } -void MockAccessibleNode::refresh() +void MockAccessibleNode::refresh(bool updateAll) { } diff --git a/libaurum/src/UiObject.cc b/libaurum/src/UiObject.cc index 042171a..6e25fa7 100644 --- a/libaurum/src/UiObject.cc +++ b/libaurum/src/UiObject.cc @@ -304,6 +304,11 @@ void UiObject::updateExtents() const mNode->updateExtents(); } +void UiObject::updateXPath() const +{ + mNode->updateXPath(); +} + bool UiObject::setFocus() const { return mNode->setFocus(); -- 2.7.4