Clean up focused UI menu code and opt out a common dynamic_cast

Initially I null checked this in testing and debugging, and since
then this code has just lowered performance, ugh.
This commit is contained in:
Liru Færs
2019-09-07 13:32:30 -04:00
parent 46f57756e7
commit 497012f98e
2 changed files with 26 additions and 21 deletions

View File

@@ -386,9 +386,15 @@ const std::string& LLTextEditor::getMenuSegmentUrl() const
static LLTextEditor* get_focused_text_editor()
{
auto* list = dynamic_cast<LLTextEditor*>(gFocusMgr.getKeyboardFocus());
llassert(list); // This listener only applies to lists
return list;
auto* te =
#ifdef SHOW_ASSERT
dynamic_cast<LLTextEditor*>
#else
static_cast<LLTextEditor*>
#endif
(gFocusMgr.getKeyboardFocus());
llassert(te); // This listener only applies to text editors
return te;
}
class ContextText : public LLMemberListener<LLView>