From: Bowon Ryu Date: Mon, 9 Aug 2021 04:38:35 +0000 (+0000) Subject: Merge "Add TextSelect()" into devel/master X-Git-Tag: dali_2.0.39~2 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=b65eaebffecede94f9c089f40448a499ab516f0c;hp=699c8c5f00b8ea4bba12b4e6e6f91b022cb261b4 Merge "Add TextSelect()" into devel/master --- diff --git a/automated-tests/src/dali-toolkit-internal/dali-toolkit-test-utils/accessibility-test-utils.cpp b/automated-tests/src/dali-toolkit-internal/dali-toolkit-test-utils/accessibility-test-utils.cpp index 6d61f56..a9d9f03 100644 --- a/automated-tests/src/dali-toolkit-internal/dali-toolkit-test-utils/accessibility-test-utils.cpp +++ b/automated-tests/src/dali-toolkit-internal/dali-toolkit-test-utils/accessibility-test-utils.cpp @@ -204,10 +204,10 @@ namespace Dali { return std::move(std::get<0>(chs)); } - std::tuple< int32_t, int32_t, int32_t, int32_t > TestGetExtents(const Address &adr) + std::tuple< int32_t, int32_t, int32_t, int32_t > TestGetExtents(const Address &adr, Dali::Accessibility::CoordinateType coordinateType) { auto wr = static_cast(DBusWrapper::Installed()); - auto chs = wr->fromTestCall< std::tuple< int32_t, int32_t, int32_t, int32_t > >(adr.GetPath(), "org.a11y.atspi.Component", "GetExtents", std::tuple(0)); + auto chs = wr->fromTestCall< std::tuple< int32_t, int32_t, int32_t, int32_t > >(adr.GetPath(), "org.a11y.atspi.Component", "GetExtents", std::make_tuple(static_cast(coordinateType))); return std::move(std::get<0>(chs)); } diff --git a/automated-tests/src/dali-toolkit-internal/dali-toolkit-test-utils/accessibility-test-utils.h b/automated-tests/src/dali-toolkit-internal/dali-toolkit-test-utils/accessibility-test-utils.h index 4966ff2..6c172fd 100644 --- a/automated-tests/src/dali-toolkit-internal/dali-toolkit-test-utils/accessibility-test-utils.h +++ b/automated-tests/src/dali-toolkit-internal/dali-toolkit-test-utils/accessibility-test-utils.h @@ -24,7 +24,7 @@ namespace Dali { bool TestGrabFocus(const Address &adr); bool TestGrabHighlight(const Address &adr); bool TestClearHighlight(const Address &adr); - std::tuple< int32_t, int32_t, int32_t, int32_t > TestGetExtents(const Address &adr); + std::tuple< int32_t, int32_t, int32_t, int32_t > TestGetExtents(const Address &adr, Dali::Accessibility::CoordinateType coordinateType ); int TestGetMdiZOrder(const Address &adr); double TestGetAlpha(const Address &adr); void printTree(const Address &root, size_t depth = 0); 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..0b1ec0e 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 @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include @@ -694,17 +695,102 @@ int UtcDaliAccessibilityGrabFocus(void) END_TEST; } -int UtcDaliAccessibilityGetExtents(void) +int UtcDaliAccessibilityGetExtentsScreenAndWindowPositionMatch(void) { ToolkitTestApplication application; + tet_infoline( "UtcDaliAccessibilityGetExtentsScreenAndWindowPositionMatch" ); Dali::Accessibility::TestEnableSC( true ); auto control = Control::New(); Stage::GetCurrent().GetRootLayer().Add( control ); - control.SetProperty(Actor::Property::POSITION, Vector3(10, 10, 100)); - control.SetProperty(Actor::Property::SIZE, Vector2(10, 10)); + auto window = Dali::DevelWindow::Get( control ); + DALI_TEST_CHECK( window ); + + //window.SetPosition({0,0}); + DevelWindow::SetPositionSize( window, PositionSize( 0,0,480, 240 ) ); + + control.SetProperty( Actor::Property::POSITION, Vector3( 10, 10, 100 ) ); + control.SetProperty( Actor::Property::SIZE, Vector2( 10, 10 ) ); + + application.SendNotification(); + application.Render( 1 ); + + auto a = Dali::Accessibility::Accessible::Get( control ); + auto a_component = dynamic_cast( a ); + + auto extents = a_component->GetExtents( Dali::Accessibility::CoordinateType::SCREEN ); + DALI_TEST_EQUALS( extents.x, 5.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( extents.y, 5.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( extents.height, 10.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( extents.width, 10.0f, TEST_LOCATION ); + + auto bridge_extents = TestGetExtents( a_component -> GetAddress(), Dali::Accessibility::CoordinateType::SCREEN ); + DALI_TEST_EQUALS( std::get< 0 >( bridge_extents ), 5, TEST_LOCATION ); + DALI_TEST_EQUALS( std::get< 1 >( bridge_extents ), 5, TEST_LOCATION ); + DALI_TEST_EQUALS( std::get< 2 >( bridge_extents ), 10, TEST_LOCATION ); + DALI_TEST_EQUALS( std::get< 3 >( bridge_extents ), 10, TEST_LOCATION ); + + extents = a_component->GetExtents( Dali::Accessibility::CoordinateType::WINDOW ); + DALI_TEST_EQUALS( extents.x, 5.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( extents.y, 5.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( extents.height, 10.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( extents.width, 10.0f, TEST_LOCATION ); + + bridge_extents = TestGetExtents( a_component -> GetAddress(), Dali::Accessibility::CoordinateType::WINDOW ); + DALI_TEST_EQUALS( std::get< 0 >( bridge_extents ), 5, TEST_LOCATION ); + DALI_TEST_EQUALS( std::get< 1 >( bridge_extents ), 5, TEST_LOCATION ); + DALI_TEST_EQUALS( std::get< 2 >( bridge_extents ), 10, TEST_LOCATION ); + DALI_TEST_EQUALS( std::get< 3 >( bridge_extents ), 10, TEST_LOCATION ); + + control.SetProperty( Dali::DevelActor::Property::POSITION_USES_ANCHOR_POINT, false ); + application.SendNotification(); + application.Render( 1 ); + + extents = a_component->GetExtents( Dali::Accessibility::CoordinateType::SCREEN ); + DALI_TEST_EQUALS( extents.x, 10.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( extents.y, 10.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( extents.height, 10.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( extents.width, 10.0f, TEST_LOCATION ); + + bridge_extents = TestGetExtents( a_component -> GetAddress(), Dali::Accessibility::CoordinateType::SCREEN ); + DALI_TEST_EQUALS( std::get< 0 >( bridge_extents ), 10, TEST_LOCATION ); + DALI_TEST_EQUALS( std::get< 1 >( bridge_extents ), 10, TEST_LOCATION ); + DALI_TEST_EQUALS( std::get< 2 >( bridge_extents ), 10, TEST_LOCATION ); + DALI_TEST_EQUALS( std::get< 3 >( bridge_extents ), 10, TEST_LOCATION ); + + extents = a_component->GetExtents( Dali::Accessibility::CoordinateType::WINDOW ); + DALI_TEST_EQUALS( extents.x, 10.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( extents.y, 10.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( extents.height, 10.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( extents.width, 10.0f, TEST_LOCATION ); + + bridge_extents = TestGetExtents( a_component -> GetAddress(), Dali::Accessibility::CoordinateType::WINDOW ); + DALI_TEST_EQUALS( std::get< 0 >( bridge_extents ), 10, TEST_LOCATION ); + DALI_TEST_EQUALS( std::get< 1 >( bridge_extents ), 10, TEST_LOCATION ); + DALI_TEST_EQUALS( std::get< 2 >( bridge_extents ), 10, TEST_LOCATION ); + DALI_TEST_EQUALS( std::get< 3 >( bridge_extents ), 10, TEST_LOCATION ); + + Dali::Accessibility::TestEnableSC( false ); + + END_TEST; +} + +int UtcDaliAccessibilityGetExtentsScreenAndWindowPositionDoNotMatch(void) +{ + ToolkitTestApplication application; + + Dali::Accessibility::TestEnableSC( true ); + + auto control = Control::New(); + Stage::GetCurrent().GetRootLayer().Add( control ); + auto window = Dali::DevelWindow::Get( control ); + //window.SetPosition({33,33}); + DevelWindow::SetPositionSize( window, PositionSize( 33,33,480, 240 ) ); + + control.SetProperty( Actor::Property::POSITION, Vector3( 10, 10, 100 ) ); + control.SetProperty( Actor::Property::SIZE, Vector2( 10, 10 ) ); application.SendNotification(); application.Render( 1 ); @@ -712,13 +798,25 @@ int UtcDaliAccessibilityGetExtents(void) auto a = Dali::Accessibility::Accessible::Get( control ); auto a_component = dynamic_cast( a ); - auto extents = a_component->GetExtents(Dali::Accessibility::CoordinateType::SCREEN); + auto extents = a_component->GetExtents( Dali::Accessibility::CoordinateType::SCREEN ); + DALI_TEST_EQUALS( extents.x, 38.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( extents.y, 38.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( extents.height, 10.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( extents.width, 10.0f, TEST_LOCATION ); + + auto bridge_extents = TestGetExtents( a_component -> GetAddress(), Dali::Accessibility::CoordinateType::SCREEN ); + DALI_TEST_EQUALS( std::get< 0 >( bridge_extents ), 38, TEST_LOCATION ); + DALI_TEST_EQUALS( std::get< 1 >( bridge_extents ), 38, TEST_LOCATION ); + DALI_TEST_EQUALS( std::get< 2 >( bridge_extents ), 10, TEST_LOCATION ); + DALI_TEST_EQUALS( std::get< 3 >( bridge_extents ), 10, TEST_LOCATION ); + + extents = a_component->GetExtents( Dali::Accessibility::CoordinateType::WINDOW ); DALI_TEST_EQUALS( extents.x, 5.0f, TEST_LOCATION ); DALI_TEST_EQUALS( extents.y, 5.0f, TEST_LOCATION ); DALI_TEST_EQUALS( extents.height, 10.0f, TEST_LOCATION ); DALI_TEST_EQUALS( extents.width, 10.0f, TEST_LOCATION ); - auto bridge_extents = TestGetExtents( a_component -> GetAddress() ); + bridge_extents = TestGetExtents( a_component -> GetAddress(), Dali::Accessibility::CoordinateType::WINDOW ); DALI_TEST_EQUALS( std::get< 0 >( bridge_extents ), 5, TEST_LOCATION ); DALI_TEST_EQUALS( std::get< 1 >( bridge_extents ), 5, TEST_LOCATION ); DALI_TEST_EQUALS( std::get< 2 >( bridge_extents ), 10, TEST_LOCATION ); @@ -728,13 +826,25 @@ int UtcDaliAccessibilityGetExtents(void) application.SendNotification(); application.Render( 1 ); - extents = a_component->GetExtents(Dali::Accessibility::CoordinateType::SCREEN); + extents = a_component->GetExtents( Dali::Accessibility::CoordinateType::SCREEN ); + DALI_TEST_EQUALS( extents.x, 43.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( extents.y, 43.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( extents.height, 10.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( extents.width, 10.0f, TEST_LOCATION ); + + bridge_extents = TestGetExtents( a_component -> GetAddress(), Dali::Accessibility::CoordinateType::SCREEN ); + DALI_TEST_EQUALS( std::get< 0 >( bridge_extents ), 43, TEST_LOCATION ); + DALI_TEST_EQUALS( std::get< 1 >( bridge_extents ), 43, TEST_LOCATION ); + DALI_TEST_EQUALS( std::get< 2 >( bridge_extents ), 10, TEST_LOCATION ); + DALI_TEST_EQUALS( std::get< 3 >( bridge_extents ), 10, TEST_LOCATION ); + + extents = a_component->GetExtents( Dali::Accessibility::CoordinateType::WINDOW ); DALI_TEST_EQUALS( extents.x, 10.0f, TEST_LOCATION ); DALI_TEST_EQUALS( extents.y, 10.0f, TEST_LOCATION ); DALI_TEST_EQUALS( extents.height, 10.0f, TEST_LOCATION ); DALI_TEST_EQUALS( extents.width, 10.0f, TEST_LOCATION ); - bridge_extents = TestGetExtents( a_component -> GetAddress() ); + bridge_extents = TestGetExtents( a_component -> GetAddress(), Dali::Accessibility::CoordinateType::WINDOW ); DALI_TEST_EQUALS( std::get< 0 >( bridge_extents ), 10, TEST_LOCATION ); DALI_TEST_EQUALS( std::get< 1 >( bridge_extents ), 10, TEST_LOCATION ); DALI_TEST_EQUALS( std::get< 2 >( bridge_extents ), 10, TEST_LOCATION ); @@ -1060,24 +1170,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 +1199,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 +1211,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 +1228,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 +1236,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..9f1c78e 100644 --- a/dali-toolkit/devel-api/controls/accessible-impl.cpp +++ b/dali-toolkit/devel-api/controls/accessible-impl.cpp @@ -24,6 +24,7 @@ #endif #include +#include // INTERNAL INCLUDES #include @@ -199,6 +200,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 +256,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; } @@ -278,7 +309,16 @@ Dali::Rect<> AccessibleImpl::GetExtents(Dali::Accessibility::CoordinateType type Vector3 anchorPointOffSet = size * (positionUsesAnchorPoint ? self.GetCurrentProperty(Actor::Property::ANCHOR_POINT) : AnchorPoint::TOP_LEFT); Vector2 position = Vector2((screenPosition.x - anchorPointOffSet.x), (screenPosition.y - anchorPointOffSet.y)); - return {position.x, position.y, size.x, size.y}; + if(type == Dali::Accessibility::CoordinateType::WINDOW) + { + return {position.x, position.y, size.x, size.y}; + } + else // Dali::Accessibility::CoordinateType::SCREEN + { + auto window = Dali::DevelWindow::Get(self); + auto windowPosition = window.GetPosition(); + return {position.x + windowPosition.GetX(), position.y + windowPosition.GetY(), size.x, size.y}; + } } int16_t AccessibleImpl::GetMdiZOrder() 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); diff --git a/dali-toolkit/devel-api/focus-manager/focus-finder.cpp b/dali-toolkit/devel-api/focus-manager/focus-finder.cpp index 952c261..a7324b8 100644 --- a/dali-toolkit/devel-api/focus-manager/focus-finder.cpp +++ b/dali-toolkit/devel-api/focus-manager/focus-finder.cpp @@ -37,6 +37,8 @@ namespace FocusFinder { namespace { +static constexpr float FULLY_TRANSPARENT(0.01f); ///< Alpha values must rise above this, before an object is considered to be visible. + static int MajorAxisDistanceRaw(Dali::Toolkit::Control::KeyboardFocus::Direction direction, Dali::Rect source, Dali::Rect dest) { switch(direction) @@ -127,17 +129,15 @@ static int MinorAxisDistance(Dali::Toolkit::Control::KeyboardFocus::Direction di case Dali::Toolkit::Control::KeyboardFocus::RIGHT: { // the distance between the center verticals - return std::abs( - (((source.top + source.bottom) * 0.5f) - - (((dest.top + dest.bottom) * 0.5f)))); + return std::abs((source.top + (source.bottom - source.top) * 0.5f) - + (dest.top + (dest.bottom - dest.top) * 0.5f)); } case Dali::Toolkit::Control::KeyboardFocus::UP: case Dali::Toolkit::Control::KeyboardFocus::DOWN: { // the distance between the center horizontals - return std::abs( - (((source.left + source.right) * 0.5f) - - (((dest.left + dest.right) * 0.5f)))); + return std::abs((source.left + (source.right - source.left) * 0.5f) - + (dest.left + (dest.right - dest.left) * 0.5f)); } default: { @@ -188,19 +188,19 @@ static bool IsCandidate(Dali::Rect srcRect, Dali::Rect destRect, D { case Dali::Toolkit::Control::KeyboardFocus::LEFT: { - return (srcRect.right > destRect.right || srcRect.left >= destRect.right) && srcRect.left > destRect.left; + return (srcRect.right > destRect.right || srcRect.left >= destRect.right); } case Dali::Toolkit::Control::KeyboardFocus::RIGHT: { - return (srcRect.left < destRect.left || srcRect.right <= destRect.left) && srcRect.right < destRect.right; + return (srcRect.left < destRect.left || srcRect.right <= destRect.left); } case Dali::Toolkit::Control::KeyboardFocus::UP: { - return (srcRect.bottom > destRect.bottom || srcRect.top >= destRect.bottom) && srcRect.top > destRect.top; + return (srcRect.bottom > destRect.bottom || srcRect.top >= destRect.bottom); } case Dali::Toolkit::Control::KeyboardFocus::DOWN: { - return (srcRect.top < destRect.top || srcRect.bottom <= destRect.top) && srcRect.bottom < destRect.bottom; + return (srcRect.top < destRect.top || srcRect.bottom <= destRect.top); } default: { @@ -340,6 +340,14 @@ bool IsBetterCandidate(Toolkit::Control::KeyboardFocus::Direction direction, Rec MinorAxisDistance(direction, focusedRect, bestCandidateRect))); } +bool IsFocusable(Actor& actor) +{ + return (actor.GetProperty(Actor::Property::KEYBOARD_FOCUSABLE) && + actor.GetProperty(Actor::Property::VISIBLE) && + actor.GetProperty(Actor::Property::SENSITIVE) && + actor.GetProperty(Actor::Property::WORLD_COLOR).a > FULLY_TRANSPARENT); +} + Actor FindNextFocus(Actor& actor, Actor& focusedActor, Rect& focusedRect, Rect& bestCandidateRect, Toolkit::Control::KeyboardFocus::Direction direction) { Actor nearestActor; @@ -350,7 +358,7 @@ Actor FindNextFocus(Actor& actor, Actor& focusedActor, Rect& focusedRect, for(auto i = 0u; i < childCount; ++i) { Dali::Actor child = actor.GetChildAt(i); - if(child && child != focusedActor && child.GetProperty(Actor::Property::KEYBOARD_FOCUSABLE)) + if(child && child != focusedActor && IsFocusable(child)) { Rect candidateRect = DevelActor::CalculateScreenExtents(child); diff --git a/dali-toolkit/public-api/dali-toolkit-version.cpp b/dali-toolkit/public-api/dali-toolkit-version.cpp index b805a2c..d46521e 100644 --- a/dali-toolkit/public-api/dali-toolkit-version.cpp +++ b/dali-toolkit/public-api/dali-toolkit-version.cpp @@ -29,7 +29,7 @@ namespace Toolkit { const unsigned int TOOLKIT_MAJOR_VERSION = 2; const unsigned int TOOLKIT_MINOR_VERSION = 0; -const unsigned int TOOLKIT_MICRO_VERSION = 37; +const unsigned int TOOLKIT_MICRO_VERSION = 38; const char* const TOOLKIT_BUILD_DATE = __DATE__ " " __TIME__; #ifdef DEBUG_ENABLED diff --git a/packaging/dali-toolkit.spec b/packaging/dali-toolkit.spec index 632815e..7fe7263 100644 --- a/packaging/dali-toolkit.spec +++ b/packaging/dali-toolkit.spec @@ -1,6 +1,6 @@ Name: dali2-toolkit Summary: Dali 3D engine Toolkit -Version: 2.0.37 +Version: 2.0.38 Release: 1 Group: System/Libraries License: Apache-2.0 and BSD-3-Clause and MIT @@ -100,12 +100,6 @@ Requires: %{dali2_scene_loader} = %{version}-%{release} %description -n %{dali2_scene_loader}-devel Development components for dali-scene-loader. -############################## -# Preparation -############################## -%prep -%setup -q - %define dali_data_rw_dir %TZ_SYS_SHARE/dali/ %define dali_data_ro_dir %TZ_SYS_RO_SHARE/dali/ @@ -116,6 +110,16 @@ Development components for dali-scene-loader. %define dali_xml_file_dir %TZ_SYS_RO_PACKAGES +############################## +# Preparation +############################## +%prep +%setup -q + +############################## +# Build +############################## +%build # PO { cd %{_builddir}/dali2-toolkit-%{version}/dali-toolkit/po @@ -126,10 +130,6 @@ do done } &> /dev/null -############################## -# Build -############################## -%build PREFIX="/usr" CXXFLAGS+=" -Wall -g -Os -fPIC -fvisibility-inlines-hidden -fdata-sections -ffunction-sections " LDFLAGS+=" -Wl,--rpath=$PREFIX/lib -Wl,--as-needed -Wl,--gc-sections -Wl,-Bsymbolic-functions "