OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "content/browser/accessibility/one_shot_accessibility_tree_search.h" | 5 #include "content/browser/accessibility/one_shot_accessibility_tree_search.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "base/i18n/case_conversion.h" | 9 #include "base/i18n/case_conversion.h" |
10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 if (direction_ == FORWARDS) | 146 if (direction_ == FORWARDS) |
147 index++; | 147 index++; |
148 else | 148 else |
149 index--; | 149 index--; |
150 } | 150 } |
151 } | 151 } |
152 | 152 |
153 void OneShotAccessibilityTreeSearch::SearchByWalkingTree() { | 153 void OneShotAccessibilityTreeSearch::SearchByWalkingTree() { |
154 BrowserAccessibility* node = nullptr; | 154 BrowserAccessibility* node = nullptr; |
155 node = start_node_; | 155 node = start_node_; |
156 if (node != scope_node_) { | 156 if (node != scope_node_ || result_limit_ == 1) { |
157 if (direction_ == FORWARDS) | 157 if (direction_ == FORWARDS) |
158 node = tree_->NextInTreeOrder(start_node_); | 158 node = tree_->NextInTreeOrder(start_node_); |
159 else | 159 else |
160 node = tree_->PreviousInTreeOrder(start_node_); | 160 node = tree_->PreviousInTreeOrder(start_node_); |
161 } | 161 } |
162 | 162 |
163 BrowserAccessibility* stop_node = scope_node_->GetParent(); | 163 BrowserAccessibility* stop_node = scope_node_->GetParent(); |
164 while (node && | 164 while (node && |
165 node != stop_node && | 165 node != stop_node && |
166 (result_limit_ == UNLIMITED_RESULTS || | 166 (result_limit_ == UNLIMITED_RESULTS || |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
449 } | 449 } |
450 | 450 |
451 bool AccessibilityVisitedLinkPredicate( | 451 bool AccessibilityVisitedLinkPredicate( |
452 BrowserAccessibility* start, BrowserAccessibility* node) { | 452 BrowserAccessibility* start, BrowserAccessibility* node) { |
453 return ((node->GetRole() == ui::AX_ROLE_LINK || | 453 return ((node->GetRole() == ui::AX_ROLE_LINK || |
454 node->GetRole() == ui::AX_ROLE_IMAGE_MAP_LINK) && | 454 node->GetRole() == ui::AX_ROLE_IMAGE_MAP_LINK) && |
455 node->HasState(ui::AX_STATE_VISITED)); | 455 node->HasState(ui::AX_STATE_VISITED)); |
456 } | 456 } |
457 | 457 |
458 } // namespace content | 458 } // namespace content |
OLD | NEW |