From: Shinwoo Kim Date: Wed, 26 May 2021 05:11:14 +0000 (+0900) Subject: [AT-SPI] enhance SHOWING state decision logic X-Git-Tag: dali_2.0.39~7^2 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=22e4cff18fd079527c93d76f1d4f784b25731e12;hp=19a2b7b2c24a6b90750973de0a184f42338194b6 [AT-SPI] enhance SHOWING state decision logic To define SHOWING state, using CULLED and VISIBLE property is not enough. If a child is clipped out by its parent, then CULLED property is not TRUE. We need to use similar logic as EFL does. ./src/lib/elementary/efl_ui_widget.c > _elm_widget_onscreen_is is used for calculating SHOWING state using parents geometry information. So this patch set is using parents extent information for SHOWING state. Change-Id: I5eecf93c66ce199bd0ca88f3ad3ff471c1ff79a5 --- diff --git a/automated-tests/src/dali-toolkit-internal/utc-Dali-Accessibility-Accessible.cpp b/automated-tests/src/dali-toolkit-internal/utc-Dali-Accessibility-Accessible.cpp index 9b103e8..423893a 100644 --- a/automated-tests/src/dali-toolkit-internal/utc-Dali-Accessibility-Accessible.cpp +++ b/automated-tests/src/dali-toolkit-internal/utc-Dali-Accessibility-Accessible.cpp @@ -64,3 +64,69 @@ int utcDaliAccessibilityCheckLabelText(void) END_TEST; } + +int UtcDaliAccessibilityCheckShowingState(void) +{ + ToolkitTestApplication application; + + auto parentButton = Toolkit::PushButton::New(); + parentButton.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX); + parentButton.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT); + parentButton.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + parentButton.SetProperty(Actor::Property::POSITION, Dali::Vector2(0.0f, 0.0f)); + parentButton.SetProperty(Actor::Property::SIZE, Dali::Vector2(200.0f, 200.0f)); + application.GetScene().Add( parentButton ); + + // Toatally inside of parent + auto buttonA = Toolkit::PushButton::New(); + buttonA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT); + buttonA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + buttonA.SetProperty(Actor::Property::POSITION, Dali::Vector2(0.0f, 0.0f)); + buttonA.SetProperty(Actor::Property::SIZE, Dali::Vector2(100.0f, 100.0f)); + parentButton.Add(buttonA); + + // Toatally outside of parent + auto buttonB = Toolkit::PushButton::New(); + buttonB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT); + buttonB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + buttonB.SetProperty(Actor::Property::POSITION, Dali::Vector2(300.0f, 300.0f)); + buttonB.SetProperty(Actor::Property::SIZE, Dali::Vector2(100.0f, 100.0f)); + parentButton.Add(buttonB); + + // Partially inside of parent + auto buttonC = Toolkit::PushButton::New(); + buttonC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT); + buttonC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + buttonC.SetProperty(Actor::Property::POSITION, Dali::Vector2(100.0f,100.0f)); + buttonC.SetProperty(Actor::Property::SIZE, Dali::Vector2(200.0f, 200.0f)); + parentButton.Add(buttonC); + + application.SendNotification(); + application.Render(16); + + auto q = Dali::Accessibility::Accessible::Get(buttonA); + DALI_TEST_CHECK(q); + auto states = q->GetStates(); + DALI_TEST_EQUALS((int) states[Dali::Accessibility::State::SHOWING], (int) true, TEST_LOCATION); + + q = Dali::Accessibility::Accessible::Get(buttonB); + DALI_TEST_CHECK(q); + states = q->GetStates(); + DALI_TEST_EQUALS((int) states[Dali::Accessibility::State::SHOWING], (int) false, TEST_LOCATION); + + q = Dali::Accessibility::Accessible::Get(buttonC); + DALI_TEST_CHECK(q); + states = q->GetStates(); + DALI_TEST_EQUALS((int) states[Dali::Accessibility::State::SHOWING], (int) true, TEST_LOCATION); + + // Make SHOWING object invisible + buttonC.SetProperty(Actor::Property::VISIBLE, false); + + application.SendNotification(); + application.Render(16); + + states = q->GetStates(); + DALI_TEST_EQUALS((int) states[Dali::Accessibility::State::SHOWING], (int) false, TEST_LOCATION); + + END_TEST; +} \ No newline at end of file diff --git a/automated-tests/src/dali-toolkit-internal/utc-Dali-Accessibility-Controls-BridgeUp.cpp b/automated-tests/src/dali-toolkit-internal/utc-Dali-Accessibility-Controls-BridgeUp.cpp index 5720b4e..567ba61 100644 --- a/automated-tests/src/dali-toolkit-internal/utc-Dali-Accessibility-Controls-BridgeUp.cpp +++ b/automated-tests/src/dali-toolkit-internal/utc-Dali-Accessibility-Controls-BridgeUp.cpp @@ -1060,24 +1060,25 @@ int UtcDaliAccessibilityCheckHighlight(void) // Make precondition two children exist in parent area PushButton parentButton = PushButton::New(); + parentButton.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX); parentButton.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT); parentButton.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); - parentButton.SetProperty( Dali::Actor::Property::POSITION, Dali::Vector2(0.0f, 0.0f) ); - parentButton.SetProperty( Dali::Actor::Property::SIZE, Dali::Vector2(100.0f, 200.0f) ); + parentButton.SetProperty(Actor::Property::POSITION, Dali::Vector2(0.0f, 0.0f)); + parentButton.SetProperty(Actor::Property::SIZE, Dali::Vector2(100.0f, 200.0f)); application.GetScene().Add( parentButton ); PushButton buttonA = PushButton::New(); buttonA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT); buttonA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); - buttonA.SetProperty( Dali::Actor::Property::POSITION, Dali::Vector2(0.0f, 0.0f) ); - buttonA.SetProperty( Dali::Actor::Property::SIZE, Dali::Vector2(100.0f, 100.0f) ); + buttonA.SetProperty(Actor::Property::POSITION, Dali::Vector2(0.0f, 0.0f)); + buttonA.SetProperty(Actor::Property::SIZE, Dali::Vector2(100.0f, 100.0f)); parentButton.Add(buttonA); PushButton buttonB = PushButton::New(); buttonB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT); buttonB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); - buttonB.SetProperty( Dali::Actor::Property::POSITION, Dali::Vector2(0.0f, 100.0f) ); - buttonB.SetProperty( Dali::Actor::Property::SIZE, Dali::Vector2(100.0f, 100.0f) ); + buttonB.SetProperty(Actor::Property::POSITION, Dali::Vector2(0.0f, 100.0f)); + buttonB.SetProperty(Actor::Property::SIZE, Dali::Vector2(100.0f, 100.0f)); parentButton.Add(buttonB); Wait(application); @@ -1088,9 +1089,9 @@ int UtcDaliAccessibilityCheckHighlight(void) Wait(application); // Move first child (A) out of parent area through the parent's area top edge - single move outed event expected for A object and OUTGOING_TOP_LEFT direction - buttonA.SetProperty( Dali::Actor::Property::POSITION, Dali::Vector2(0.0f, -200.0f) ); + buttonA.SetProperty(Actor::Property::POSITION, Dali::Vector2(0.0f, -200.0f)); Wait(application); - // Need one more seding notificaiton to get correct updated position + // Need one more notificaiton to get correct updated position application.SendNotification(); DALI_TEST_EQUALS( true, Dali::Accessibility::TestGetMoveOutedCalled(), TEST_LOCATION ); @@ -1100,7 +1101,7 @@ int UtcDaliAccessibilityCheckHighlight(void) // Move first child (A) outside of parent area (both start and end position are outside of parent area) - no move outed event expected for A object buttonA.SetProperty( Dali::Actor::Property::POSITION, Dali::Vector2(0.0f, -300.0f) ); Wait(application); - // Need one more seding notificaiton to get correct updated position + // Need one more notificaiton to get correct updated position application.SendNotification(); DALI_TEST_EQUALS( false, Dali::Accessibility::TestGetMoveOutedCalled(), TEST_LOCATION ); @@ -1117,7 +1118,7 @@ int UtcDaliAccessibilityCheckHighlight(void) // B: (0,100) --> (0, 50) buttonB.SetProperty( Dali::Actor::Property::POSITION, Dali::Vector2(0.0f, 50.0f) ); Wait(application); - // Need one more seding notificaiton to get correct updated position + // Need one more notificaiton to get correct updated position application.SendNotification(); DALI_TEST_EQUALS( false, Dali::Accessibility::TestGetMoveOutedCalled(), TEST_LOCATION ); @@ -1125,9 +1126,9 @@ int UtcDaliAccessibilityCheckHighlight(void) Dali::Accessibility::TestResetMoveOutedCalled(); // Move second child (B) out of parent area through the parent's area right edge - single move outed event expected for B object and OUTGOING_BOTTOM_RIGHT direction - buttonB.SetProperty( Dali::Actor::Property::POSITION, Dali::Vector2(300.0f, 100.0f) ); + buttonB.SetProperty(Actor::Property::POSITION, Dali::Vector2(300.0f, 100.0f)); Wait(application); - // Need one more seding notificaiton to get correct updated position + // Need one more notificaiton to get correct updated position application.SendNotification(); DALI_TEST_EQUALS( true, Dali::Accessibility::TestGetMoveOutedCalled(), TEST_LOCATION ); diff --git a/dali-toolkit/devel-api/controls/accessible-impl.cpp b/dali-toolkit/devel-api/controls/accessible-impl.cpp index 774a280..ba1e0ed 100644 --- a/dali-toolkit/devel-api/controls/accessible-impl.cpp +++ b/dali-toolkit/devel-api/controls/accessible-impl.cpp @@ -199,6 +199,37 @@ std::string AccessibleImpl::GetLocalizedRoleName() return GetLocaleText(GetRoleName()); } +bool AccessibleImpl::IsShowing() +{ + Dali::Actor self = Self(); + if(self.GetProperty(Dali::DevelActor::Property::CULLED).Get() || !self.GetCurrentProperty(Actor::Property::VISIBLE)) + { + return false; + } + + auto* child = this; + auto* parent = dynamic_cast(child->GetParent()); + if(!parent) + { + return true; + } + + auto childExtent = child->GetExtents(Dali::Accessibility::CoordinateType::WINDOW); + while(parent) + { + auto control = Dali::Toolkit::Control::DownCast(parent->Self()); + auto clipMode = control.GetProperty(Actor::Property::CLIPPING_MODE).Get(); + auto parentExtent = parent->GetExtents(Dali::Accessibility::CoordinateType::WINDOW); + if ((clipMode != ClippingMode::DISABLED) && !parentExtent.Intersects(childExtent)) + { + return false; + } + parent = dynamic_cast(parent->GetParent()); + } + + return true; +} + Dali::Accessibility::States AccessibleImpl::CalculateStates() { Dali::Actor self = Self(); @@ -224,8 +255,7 @@ Dali::Accessibility::States AccessibleImpl::CalculateStates() { state[Dali::Accessibility::State::MODAL] = true; } - state[Dali::Accessibility::State::SHOWING] = !self.GetProperty(Dali::DevelActor::Property::CULLED).Get() && self.GetCurrentProperty(Actor::Property::VISIBLE); - + state[Dali::Accessibility::State::SHOWING] = IsShowing(); state[Dali::Accessibility::State::DEFUNCT] = !self.GetProperty(Dali::DevelActor::Property::CONNECTED_TO_SCENE).Get(); return state; } diff --git a/dali-toolkit/devel-api/controls/accessible-impl.h b/dali-toolkit/devel-api/controls/accessible-impl.h index c8c1361..aa5084a 100644 --- a/dali-toolkit/devel-api/controls/accessible-impl.h +++ b/dali-toolkit/devel-api/controls/accessible-impl.h @@ -76,6 +76,12 @@ protected: */ void UnregisterPositionPropertyNotification(); + /** + * @brief Check if the actor is showing + * @return True if the actor is showing + */ + bool IsShowing(); + public: AccessibleImpl(Dali::Actor self, Dali::Accessibility::Role role, bool modal = false);