| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/accessibility/ax_node.h" | 5 #include "ui/accessibility/ax_node.h" |
| 6 | 6 |
| 7 namespace ui { | 7 namespace ui { |
| 8 | 8 |
| 9 AXNode::AXNode(AXNode* parent, int32_t id, int32_t index_in_parent) | 9 AXNode::AXNode(AXNode* parent, int32_t id, int32_t index_in_parent) |
| 10 : index_in_parent_(index_in_parent), parent_(parent) { | 10 : index_in_parent_(index_in_parent), parent_(parent) { |
| 11 data_.id = id; | 11 data_.id = id; |
| 12 } | 12 } |
| 13 | 13 |
| 14 AXNode::~AXNode() { | 14 AXNode::~AXNode() { |
| 15 } | 15 } |
| 16 | 16 |
| 17 void AXNode::SetData(const AXNodeData& src) { | 17 void AXNode::SetData(const AXNodeData& src) { |
| 18 data_ = src; | 18 data_ = src; |
| 19 } | 19 } |
| 20 | 20 |
| 21 void AXNode::SetLocation(const gfx::Rect& new_location) { | 21 void AXNode::SetLocation(const gfx::RectF& new_location) { |
| 22 data_.location = new_location; | 22 data_.location = new_location; |
| 23 } | 23 } |
| 24 | 24 |
| 25 void AXNode::SetIndexInParent(int index_in_parent) { | 25 void AXNode::SetIndexInParent(int index_in_parent) { |
| 26 index_in_parent_ = index_in_parent; | 26 index_in_parent_ = index_in_parent; |
| 27 } | 27 } |
| 28 | 28 |
| 29 void AXNode::SwapChildren(std::vector<AXNode*>& children) { | 29 void AXNode::SwapChildren(std::vector<AXNode*>& children) { |
| 30 children.swap(children_); | 30 children.swap(children_); |
| 31 } | 31 } |
| 32 | 32 |
| 33 void AXNode::Destroy() { | 33 void AXNode::Destroy() { |
| 34 delete this; | 34 delete this; |
| 35 } | 35 } |
| 36 | 36 |
| 37 bool AXNode::IsDescendantOf(AXNode* ancestor) { | 37 bool AXNode::IsDescendantOf(AXNode* ancestor) { |
| 38 if (this == ancestor) | 38 if (this == ancestor) |
| 39 return true; | 39 return true; |
| 40 else if (parent()) | 40 else if (parent()) |
| 41 return parent()->IsDescendantOf(ancestor); | 41 return parent()->IsDescendantOf(ancestor); |
| 42 | 42 |
| 43 return false; | 43 return false; |
| 44 } | 44 } |
| 45 | 45 |
| 46 } // namespace ui | 46 } // namespace ui |
| OLD | NEW |