MenuItemView has some static size variables that are accessible through static getters: for example MenuItemView::label_start_ and views::MenuItemView::label_start(). These are not initialized until MenuItemView::UpdateMenuPartSizes() is called, which is called upon a MenuRunner::RunMenuAt(). Consequently, these methods return invalid data before a menu is run.
Aside from the bug of allowing uninitialized data to be read, this also prevents code from getting this information before menu run time, which is an obstacle to declarative layout.
Related: https://crbug.com/913998
MenuItemView has some static size variables that are accessible through static getters: for example MenuItemView::label_start_ and views::MenuItemView::label_start(). These are not initialized until MenuItemView::UpdateMenuPartSizes() is called, which is called upon a MenuRunner::RunMenuAt(). Consequently, these methods return invalid data before a menu is run.
Aside from the bug of allowing uninitialized data to be read, this also prevents code from getting this information before menu run time, which is an obstacle to declarative layout.
Related: Issue 913998
Comment 1 by collinbaker@chromium.org
, Jan 3