Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(349)

Side by Side Diff: ui/accessibility/ax_node.cc

Issue 2217363002: Use relative bounding boxes throughout Chrome accessibility (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #include "ui/gfx/transform.h"
6 7
7 namespace ui { 8 namespace ui {
8 9
9 AXNode::AXNode(AXNode* parent, int32_t id, int32_t index_in_parent) 10 AXNode::AXNode(AXNode* parent, int32_t id, int32_t index_in_parent)
10 : index_in_parent_(index_in_parent), parent_(parent) { 11 : index_in_parent_(index_in_parent), parent_(parent) {
11 data_.id = id; 12 data_.id = id;
12 } 13 }
13 14
14 AXNode::~AXNode() { 15 AXNode::~AXNode() {
15 } 16 }
16 17
17 void AXNode::SetData(const AXNodeData& src) { 18 void AXNode::SetData(const AXNodeData& src) {
18 data_ = src; 19 data_ = src;
19 } 20 }
20 21
21 void AXNode::SetLocation(const gfx::RectF& new_location) { 22 void AXNode::SetLocation(int offset_container_id,
22 data_.location = new_location; 23 const gfx::RectF& location,
24 gfx::Transform* transform) {
25 data_.offset_container_id = offset_container_id;
26 data_.location = location;
27 if (transform)
aboxhall 2016/08/12 16:05:10 Should this reset .transform to nullptr otherwise?
dmazzoni 2016/08/15 05:31:11 Yes! Good catch. Fixed similar bug in AXNodeData,
28 data_.transform.reset(new gfx::Transform(*transform));
23 } 29 }
24 30
25 void AXNode::SetIndexInParent(int index_in_parent) { 31 void AXNode::SetIndexInParent(int index_in_parent) {
26 index_in_parent_ = index_in_parent; 32 index_in_parent_ = index_in_parent;
27 } 33 }
28 34
29 void AXNode::SwapChildren(std::vector<AXNode*>& children) { 35 void AXNode::SwapChildren(std::vector<AXNode*>& children) {
30 children.swap(children_); 36 children.swap(children_);
31 } 37 }
32 38
33 void AXNode::Destroy() { 39 void AXNode::Destroy() {
34 delete this; 40 delete this;
35 } 41 }
36 42
37 bool AXNode::IsDescendantOf(AXNode* ancestor) { 43 bool AXNode::IsDescendantOf(AXNode* ancestor) {
38 if (this == ancestor) 44 if (this == ancestor)
39 return true; 45 return true;
40 else if (parent()) 46 else if (parent())
41 return parent()->IsDescendantOf(ancestor); 47 return parent()->IsDescendantOf(ancestor);
42 48
43 return false; 49 return false;
44 } 50 }
45 51
46 } // namespace ui 52 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698