| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/platform/ax_platform_node_base.h" | 5 #include "ui/accessibility/platform/ax_platform_node_base.h" |
| 6 | 6 |
| 7 #include "base/strings/string_number_conversions.h" |
| 7 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 8 #include "ui/accessibility/ax_action_data.h" | 9 #include "ui/accessibility/ax_action_data.h" |
| 9 #include "ui/accessibility/ax_node_data.h" | 10 #include "ui/accessibility/ax_node_data.h" |
| 10 #include "ui/accessibility/ax_role_properties.h" | 11 #include "ui/accessibility/ax_role_properties.h" |
| 11 #include "ui/accessibility/platform/ax_platform_node_delegate.h" | 12 #include "ui/accessibility/platform/ax_platform_node_delegate.h" |
| 12 #include "ui/gfx/geometry/rect_conversions.h" | 13 #include "ui/gfx/geometry/rect_conversions.h" |
| 13 | 14 |
| 14 namespace ui { | 15 namespace ui { |
| 15 | 16 |
| 16 void AXPlatformNodeBase::Init(AXPlatformNodeDelegate* delegate) { | 17 void AXPlatformNodeBase::Init(AXPlatformNodeDelegate* delegate) { |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 case ui::AX_ROLE_SPIN_BUTTON: | 331 case ui::AX_ROLE_SPIN_BUTTON: |
| 331 case ui::AX_ROLE_SCROLL_BAR: | 332 case ui::AX_ROLE_SCROLL_BAR: |
| 332 return true; | 333 return true; |
| 333 case ui::AX_ROLE_SPLITTER: | 334 case ui::AX_ROLE_SPLITTER: |
| 334 return GetData().HasState(ui::AX_STATE_FOCUSABLE); | 335 return GetData().HasState(ui::AX_STATE_FOCUSABLE); |
| 335 default: | 336 default: |
| 336 return false; | 337 return false; |
| 337 } | 338 } |
| 338 } | 339 } |
| 339 | 340 |
| 341 base::string16 AXPlatformNodeBase::GetRangeValueText() { |
| 342 float fval; |
| 343 base::string16 value = GetString16Attribute(ui::AX_ATTR_VALUE); |
| 344 |
| 345 if (value.empty() && GetFloatAttribute(ui::AX_ATTR_VALUE_FOR_RANGE, &fval)) { |
| 346 value = base::UTF8ToUTF16(base::DoubleToString(fval)); |
| 347 } |
| 348 return value; |
| 349 } |
| 350 |
| 340 AXPlatformNodeBase* AXPlatformNodeBase::GetTable() const { | 351 AXPlatformNodeBase* AXPlatformNodeBase::GetTable() const { |
| 341 if (!delegate_) | 352 if (!delegate_) |
| 342 return nullptr; | 353 return nullptr; |
| 343 AXPlatformNodeBase* table = const_cast<AXPlatformNodeBase*>(this); | 354 AXPlatformNodeBase* table = const_cast<AXPlatformNodeBase*>(this); |
| 344 while (table && !ui::IsTableLikeRole(table->GetData().role)) { | 355 while (table && !ui::IsTableLikeRole(table->GetData().role)) { |
| 345 gfx::NativeViewAccessible parent_accessible = table->GetParent(); | 356 gfx::NativeViewAccessible parent_accessible = table->GetParent(); |
| 346 AXPlatformNodeBase* parent = FromNativeViewAccessible(parent_accessible); | 357 AXPlatformNodeBase* parent = FromNativeViewAccessible(parent_accessible); |
| 347 | 358 |
| 348 table = parent; | 359 table = parent; |
| 349 } | 360 } |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 454 if (!ui::IsCellOrTableHeaderRole(GetData().role)) | 465 if (!ui::IsCellOrTableHeaderRole(GetData().role)) |
| 455 return 0; | 466 return 0; |
| 456 | 467 |
| 457 int row_span; | 468 int row_span; |
| 458 if (GetIntAttribute(ui::AX_ATTR_TABLE_CELL_ROW_SPAN, &row_span)) | 469 if (GetIntAttribute(ui::AX_ATTR_TABLE_CELL_ROW_SPAN, &row_span)) |
| 459 return row_span; | 470 return row_span; |
| 460 return 1; | 471 return 1; |
| 461 } | 472 } |
| 462 | 473 |
| 463 } // namespace ui | 474 } // namespace ui |
| OLD | NEW |