X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Fbuttons%2Ftoggle-button-impl.cpp;h=1479e35fb164fcff8758a7306160cbb41ec55a15;hb=HEAD;hp=ef562029f781d94af01dd0fb29799d08dbdc5784;hpb=263ae2a3d79784a3ebc4a1d6b5db8bf6bb407468;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/controls/buttons/toggle-button-impl.cpp b/dali-toolkit/internal/controls/buttons/toggle-button-impl.cpp index ef56202..5dd9b87 100644 --- a/dali-toolkit/internal/controls/buttons/toggle-button-impl.cpp +++ b/dali-toolkit/internal/controls/buttons/toggle-button-impl.cpp @@ -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. @@ -144,11 +144,22 @@ void ToggleButton::SetProperty(BaseObject* object, Property::Index propertyIndex std::vector tips; size_t tipsCount = tipArray->Count(); tips.resize(tipsCount); + + bool valid = true; for(size_t i = 0; i != tipsCount; ++i) { - tipArray->GetElementAt(i).Get(tips[i]); + if(DALI_UNLIKELY(!tipArray->GetElementAt(i).Get(tips[i]))) + { + // Given array is invalid. Fast out. + valid = false; + break; + } + } + + if(DALI_LIKELY(valid)) + { + toggleButtonImpl.SetToggleTooltips(tips); } - toggleButtonImpl.SetToggleTooltips(tips); } break; } @@ -314,7 +325,7 @@ void ToggleButton::PrepareVisual(Property::Index index, Toolkit::Visual::Base& v DevelControl::UnregisterVisual(*this, index); } - DevelControl::RegisterVisual(*this, index, visual, enabled); + DevelControl::RegisterVisual(*this, index, visual, enabled, DepthIndex::CONTENT); } void ToggleButton::RelayoutVisual(Property::Index index, const Vector2& size) @@ -401,10 +412,10 @@ Property::Index ToggleButton::ToggleButtonAccessible::GetDescriptionPropertyInde void ToggleButton::OnStateChange(State newState) { // TODO: replace it with OnPropertySet hook once Button::Property::SELECTED will be consistently used - if((Self() == Dali::Accessibility::Accessible::GetCurrentlyHighlightedActor()) && (newState == SELECTED_STATE || newState == UNSELECTED_STATE)) + if(newState == SELECTED_STATE || newState == UNSELECTED_STATE) { auto* accessible = GetAccessibleObject(); - if(DALI_LIKELY(accessible)) + if(DALI_LIKELY(accessible) && accessible->IsHighlighted()) { accessible->EmitStateChanged(Dali::Accessibility::State::CHECKED, mCurrentToggleIndex ? 1 : 0, 0); accessible->Emit(Dali::Accessibility::ObjectPropertyChangeEvent::DESCRIPTION);