Make sure Emit* is only enabled for ActorAccessible 17/315717/1
authorYoungsun Suh <youngsun.suh@samsung.com>
Wed, 4 Dec 2024 08:04:08 +0000 (17:04 +0900)
committerYoungsun Suh <youngsun.suh@samsung.com>
Wed, 4 Dec 2024 08:04:08 +0000 (17:04 +0900)
Change-Id: Iaef1ef45f8cdc840cbc98c64d53084cf217e1d3e

dali-toolkit/devel-api/controls/control-devel.cpp
dali-toolkit/internal/controls/buttons/check-box-button-impl.cpp
dali-toolkit/internal/controls/buttons/push-button-impl.cpp
dali-toolkit/internal/controls/buttons/radio-button-impl.cpp
dali-toolkit/internal/controls/buttons/toggle-button-impl.cpp
dali-toolkit/public-api/controls/control-impl.cpp

index a89c4c9fb87c84ef31101f42fea087d315e2184c..f5516bb3aff1ce4b8e122f393318c93b6c5b07ed 100644 (file)
@@ -338,7 +338,7 @@ void EmitAccessibilityStateChanged(Dali::Actor actor, Accessibility::State state
 
   if(bridge->IsUp())
   {
-    auto accessible = Accessibility::Accessible::Get(actor);
+    auto accessible = dynamic_cast<Accessibility::ActorAccessible*>(Accessibility::Accessible::Get(actor));
     if(DALI_LIKELY(accessible))
     {
       accessible->EmitStateChanged(state, newValue, 0);
index a7783716b9da4de476e9dac3b88d7466b488b726..7b8f28c2cc0da2cd9112d64994427c41d3773700 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -101,7 +101,7 @@ void CheckBoxButton::OnStateChange(State newState)
   // TODO: replace it with OnPropertySet hook once Button::Property::SELECTED will be consistently used
   if(newState == SELECTED_STATE || newState == UNSELECTED_STATE)
   {
-    auto accessible = GetAccessibleObject();
+    auto accessible = std::dynamic_pointer_cast<Dali::Accessibility::ActorAccessible>(GetAccessibleObject());
     if(DALI_LIKELY(accessible) && accessible->IsHighlighted())
     {
       accessible->EmitStateChanged(Dali::Accessibility::State::CHECKED, newState == SELECTED_STATE ? 1 : 0, 0);
index 4e26fad394486a6453e1dcfafd05d68e8b0d42ba..8ffb459ec6efd55c80ddf2edca322c9c3d0e5c66 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -209,7 +209,7 @@ void PushButton::OnStateChange(State newState)
   // TODO: replace it with OnPropertySet hook once Button::Property::SELECTED will be consistently used
   if(newState == SELECTED_STATE || newState == UNSELECTED_STATE)
   {
-    auto accessible = GetAccessibleObject();
+    auto accessible = std::dynamic_pointer_cast<Dali::Accessibility::ActorAccessible>(GetAccessibleObject());
     if(DALI_LIKELY(accessible) && accessible->IsHighlighted())
     {
       accessible->EmitStateChanged(Dali::Accessibility::State::PRESSED, newState == SELECTED_STATE ? 1 : 0, 0);
index 3241ea07b5b725e6e35895007a5f5a1b4ed7dc74..93b6086bd19b01dd7236b3dd217c98e1e1f80a38 100644 (file)
@@ -109,7 +109,7 @@ void RadioButton::OnStateChange(State newState)
   // TODO: replace it with OnPropertySet hook once Button::Property::SELECTED will be consistently used
   if(newState == SELECTED_STATE || newState == UNSELECTED_STATE)
   {
-    auto accessible = GetAccessibleObject();
+    auto accessible = std::dynamic_pointer_cast<Dali::Accessibility::ActorAccessible>(GetAccessibleObject());
     if(DALI_LIKELY(accessible) && accessible->IsHighlighted())
     {
       accessible->EmitStateChanged(Dali::Accessibility::State::CHECKED, newState == SELECTED_STATE ? 1 : 0, 0);
index d292b0ec2f4797e02c5b9587ccc665321ccbae58..7cf7351d2878d834275de604f781db530cf47ad5 100644 (file)
@@ -414,7 +414,7 @@ void ToggleButton::OnStateChange(State newState)
   // TODO: replace it with OnPropertySet hook once Button::Property::SELECTED will be consistently used
   if(newState == SELECTED_STATE || newState == UNSELECTED_STATE)
   {
-    auto accessible = GetAccessibleObject();
+    auto accessible = std::dynamic_pointer_cast<Dali::Accessibility::ActorAccessible>(GetAccessibleObject());
     if(DALI_LIKELY(accessible) && accessible->IsHighlighted())
     {
       accessible->EmitStateChanged(Dali::Accessibility::State::CHECKED, mCurrentToggleIndex ? 1 : 0, 0);
index 940711fc03e2adb011f7f8f9e47e13fceddfb9ec..db04318050ea9d6649817bd5873c44be3bb5bc26 100644 (file)
@@ -546,7 +546,7 @@ void Control::EmitKeyInputFocusSignal(bool focusGained)
     if(DALI_LIKELY(accessible))
     {
       accessible->EmitFocused(focusGained);
-      auto parent = accessible->GetParent();
+      auto parent = dynamic_cast<Dali::Accessibility::ActorAccessible*>(accessible->GetParent());
       if(parent && !accessible->GetStates()[Dali::Accessibility::State::MANAGES_DESCENDANTS])
       {
         parent->EmitActiveDescendantChanged(accessible.get());