Commit d7eb78dc authored by Robert Liao's avatar Robert Liao Committed by Commit Bot

Remove View::GetAncestorWithClassName

Upward ancestor traversal by class name is not a common pattern used in
Views clients.

BUG=

Change-Id: If0aefc9084836526225441a4d8f15131b7c1f3fd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1881888
Auto-Submit: Robert Liao <robliao@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Commit-Queue: Robert Liao <robliao@chromium.org>
Cr-Commit-Position: refs/heads/master@{#709974}
parent 3b2b88c5
......@@ -713,19 +713,6 @@ void View::SetLayoutManager(std::nullptr_t) {
// Attributes ------------------------------------------------------------------
const View* View::GetAncestorWithClassName(const std::string& name) const {
for (const View* view = this; view; view = view->parent_) {
if (!strcmp(view->GetClassName(), name.c_str()))
return view;
}
return nullptr;
}
View* View::GetAncestorWithClassName(const std::string& name) {
return const_cast<View*>(const_cast<const View*>(this)->
GetAncestorWithClassName(name));
}
const View* View::GetViewByID(int id) const {
if (id == id_)
return const_cast<View*>(this);
......
......@@ -734,11 +734,6 @@ class VIEWS_EXPORT View : public ui::LayerDelegate,
// Attributes ----------------------------------------------------------------
// Returns the first ancestor, starting at this, whose class name is |name|.
// Returns null if no ancestor has the class name |name|.
const View* GetAncestorWithClassName(const std::string& name) const;
View* GetAncestorWithClassName(const std::string& name);
// Recursively descends the view tree starting at this view, and returns
// the first child that it encounters that has the given ID.
// Returns NULL if no matching child view is found.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment