}
}
+bool Accessible::IsHighlighted() const
+{
+ Dali::Actor self = GetInternalActor();
+
+ return self && self == GetCurrentlyHighlightedActor();
+}
+
Dali::Actor Accessible::GetHighlightActor()
{
return IsUp() ? Bridge::GetCurrentBridge()->mData->mHighlightActor : Dali::Actor{};
return false;
}
- auto self = Self();
- if(self != GetCurrentlyHighlightedActor())
+ if(!IsHighlighted())
{
return false;
}
SetCurrentlyHighlightedActor({});
- auto window = Dali::DevelWindow::Get(self);
+ auto window = Dali::DevelWindow::Get(Self());
Dali::Internal::Adaptor::Window& windowImpl = Dali::GetImplementation(window);
windowImpl.EmitAccessibilityHighlightSignal(false);
virtual bool IsProxy() const;
/**
+ * @brief Checks if this is highlighted
+ *
+ * @return True if highlighted, false otherwise
+ */
+ bool IsHighlighted() const;
+
+ /**
* @brief Gets unique address on accessibility bus.
*
* @return The Address class containing address
*
* @return The internal Actor
*/
- virtual Dali::Actor GetInternalActor() = 0;
+ virtual Dali::Actor GetInternalActor() const = 0;
/**
* @brief Sets whether to listen for post render callback.
return inserted || updated;
}
-bool RoleTriggersContextRebuilding(Role role)
+bool IsModalRole(Role role)
{
- return role == Role::POPUP_MENU || role == Role::PANEL || role == Role::DIALOG || role == Role::PAGE_TAB || role == Role::WINDOW;
+ return role == Role::POPUP_MENU || role == Role::PANEL || role == Role::DIALOG || role == Role::PAGE_TAB;
}
-// Allowing duplicate showing event for some roles as it used to rebuild context after switching default label in Accessibility V1.
-bool ShouldForceEmit(Accessible* accessible, State state)
+bool IsWindowRole(Role role)
{
- return state == State::SHOWING && RoleTriggersContextRebuilding(accessible->GetRole());
+ return role == Role::WINDOW || role == Role::FRAME || role == Role::INPUT_METHOD_WINDOW;
+}
+
+bool ShouldEmitVisible(Accessible* accessible)
+{
+ Role role = accessible->GetRole();
+ return IsWindowRole(role);
+}
+
+bool ShouldEmitShowing(Accessible* accessible, bool showing)
+{
+ Role role = accessible->GetRole();
+ return IsWindowRole(role) || IsModalRole(role) || (showing && role == Role::NOTIFICATION) ||
+ (!showing && accessible->IsHighlighted()) || accessible->GetStates()[State::MODAL];
}
} // namespace
{
if(auto bridgeData = GetBridgeData())
{
- if(UpdateLastEmitted(mLastEmittedState, state, newValue) || ShouldForceEmit(this, state))
+ bool shouldEmit{false};
+
+ switch(state)
+ {
+ case State::SHOWING:
+ {
+ shouldEmit = ShouldEmitShowing(this, static_cast<bool>(newValue));
+ break;
+ }
+ case State::VISIBLE:
+ {
+ shouldEmit = ShouldEmitVisible(this);
+ break;
+ }
+ default:
+ {
+ shouldEmit = UpdateLastEmitted(mLastEmittedState, state, newValue);
+ break;
+ }
+ }
+
+ if(shouldEmit)
{
bridgeData->mBridge->EmitStateChanged(shared_from_this(), state, newValue, reserved);
}