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

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

Issue 2745713002: WIP: Modified AXPosition to work with objects with both embedded object characters and text. (Closed)
Patch Set: Created 3 years, 9 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 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/strings/string16.h" 9 #include "base/strings/string16.h"
10 #include "ui/accessibility/ax_enums.h"
10 #include "ui/gfx/transform.h" 11 #include "ui/gfx/transform.h"
11 12
12 namespace ui { 13 namespace ui {
13 14
14 AXNode::AXNode(AXNode* parent, int32_t id, int32_t index_in_parent) 15 AXNode::AXNode(AXNode* parent, int32_t id, int32_t index_in_parent)
15 : index_in_parent_(index_in_parent), parent_(parent) { 16 : index_in_parent_(index_in_parent), parent_(parent) {
16 data_.id = id; 17 data_.id = id;
17 } 18 }
18 19
19 AXNode::~AXNode() { 20 AXNode::~AXNode() {
20 } 21 }
21 22
23 bool AXNode::IsTextNode() const {
24 return data().role == AX_ROLE_STATIC_TEXT ||
25 data().role == AX_ROLE_LINE_BREAK ||
26 data().role == AX_ROLE_INLINE_TEXT_BOX;
27 }
28
22 void AXNode::SetData(const AXNodeData& src) { 29 void AXNode::SetData(const AXNodeData& src) {
23 data_ = src; 30 data_ = src;
24 } 31 }
25 32
26 void AXNode::SetLocation(int offset_container_id, 33 void AXNode::SetLocation(int offset_container_id,
27 const gfx::RectF& location, 34 const gfx::RectF& location,
28 gfx::Transform* transform) { 35 gfx::Transform* transform) {
29 data_.offset_container_id = offset_container_id; 36 data_.offset_container_id = offset_container_id;
30 data_.location = location; 37 data_.location = location;
31 if (transform) 38 if (transform)
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 if (line_offsets->empty() || line_offsets->back() != *start_offset) 92 if (line_offsets->empty() || line_offsets->back() != *start_offset)
86 line_offsets->push_back(*start_offset); 93 line_offsets->push_back(*start_offset);
87 } 94 }
88 95
89 base::string16 text = child->data().GetString16Attribute(ui::AX_ATTR_NAME); 96 base::string16 text = child->data().GetString16Attribute(ui::AX_ATTR_NAME);
90 *start_offset += static_cast<int>(text.length()); 97 *start_offset += static_cast<int>(text.length());
91 } 98 }
92 } 99 }
93 100
94 } // namespace ui 101 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698