Commit b3d5744c authored by Thanh Pham's avatar Thanh Pham Committed by Commit Bot

Element nodes disappear in UI DevTools when Chrome on Linux instance is

inspecting itself.

The hierarchical listing of window/widget/view elements belonging to
the browser instance will initially be shown. When attempting to
inspect some of these elements, the majority of the node tree will
disappear, event though the browser UI itself will remain unchanged.
The bug is caused by UI Element reorder calls when a mouse click event
happens.

Bug: 750206
Change-Id: If8b001575b82bf92a787fdb4676aeebf6b390f2b
Reviewed-on: https://chromium-review.googlesource.com/636400
Commit-Queue: Thanh Pham <thanhph@chromium.org>
Reviewed-by: default avatarSadrul Chowdhury <sadrul@chromium.org>
Cr-Commit-Position: refs/heads/master@{#501115}
parent a7fd9f07
...@@ -815,6 +815,13 @@ TEST_F(UIDevToolsTest, ViewRearranged) { ...@@ -815,6 +815,13 @@ TEST_F(UIDevToolsTest, ViewRearranged) {
child_view_node_1->getNodeId()); child_view_node_1->getNodeId());
ExpectChildNodeInserted(parent_view_node->getNodeId(), 0); ExpectChildNodeInserted(parent_view_node->getNodeId(), 0);
// Reorder child_view_1 to the same index 0 shouldn't perform reroder work, so
// we still expect 1 remove and 1 insert protocol notification messages.
parent_view->ReorderChildView(child_view_1, 0);
ExpectChildNodeRemoved(parent_view_node->getNodeId(),
child_view_node_1->getNodeId());
ExpectChildNodeInserted(parent_view_node->getNodeId(), 0);
target_view->AddChildView(child_view); target_view->AddChildView(child_view);
ExpectChildNodeRemoved(parent_view_node->getNodeId(), ExpectChildNodeRemoved(parent_view_node->getNodeId(),
child_view_node->getNodeId()); child_view_node->getNodeId());
......
...@@ -56,9 +56,12 @@ void UIElement::RemoveChild(UIElement* child) { ...@@ -56,9 +56,12 @@ void UIElement::RemoveChild(UIElement* child) {
} }
void UIElement::ReorderChild(UIElement* child, int new_index) { void UIElement::ReorderChild(UIElement* child, int new_index) {
// Remove |child| out of vector |children_|.
auto iter = std::find(children_.begin(), children_.end(), child); auto iter = std::find(children_.begin(), children_.end(), child);
DCHECK(iter != children_.end()); DCHECK(iter != children_.end());
// Don't re-order if the new position is the same as the old position.
if (std::distance(children_.begin(), iter) == new_index)
return;
children_.erase(iter); children_.erase(iter);
// Move child to new position |new_index| in vector |children_|. // Move child to new position |new_index| in vector |children_|.
......
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