| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/browser_accessibility.h" | 5 #include "content/browser/accessibility/browser_accessibility.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 const std::vector<int32>& character_offsets = child->GetIntListAttribute( | 255 const std::vector<int32>& character_offsets = child->GetIntListAttribute( |
| 256 ui::AX_ATTR_CHARACTER_OFFSETS); | 256 ui::AX_ATTR_CHARACTER_OFFSETS); |
| 257 int start_pixel_offset = | 257 int start_pixel_offset = |
| 258 local_start > 0 ? character_offsets[local_start - 1] : 0; | 258 local_start > 0 ? character_offsets[local_start - 1] : 0; |
| 259 int end_pixel_offset = | 259 int end_pixel_offset = |
| 260 local_end > 0 ? character_offsets[local_end - 1] : 0; | 260 local_end > 0 ? character_offsets[local_end - 1] : 0; |
| 261 | 261 |
| 262 gfx::Rect child_overlap_rect; | 262 gfx::Rect child_overlap_rect; |
| 263 switch (text_direction) { | 263 switch (text_direction) { |
| 264 case ui::AX_TEXT_DIRECTION_NONE: | 264 case ui::AX_TEXT_DIRECTION_NONE: |
| 265 case ui::AX_TEXT_DIRECTION_LR: { | 265 case ui::AX_TEXT_DIRECTION_LTR: { |
| 266 int left = child_rect.x() + start_pixel_offset; | 266 int left = child_rect.x() + start_pixel_offset; |
| 267 int right = child_rect.x() + end_pixel_offset; | 267 int right = child_rect.x() + end_pixel_offset; |
| 268 child_overlap_rect = gfx::Rect(left, child_rect.y(), | 268 child_overlap_rect = gfx::Rect(left, child_rect.y(), |
| 269 right - left, child_rect.height()); | 269 right - left, child_rect.height()); |
| 270 break; | 270 break; |
| 271 } | 271 } |
| 272 case ui::AX_TEXT_DIRECTION_RL: { | 272 case ui::AX_TEXT_DIRECTION_RTL: { |
| 273 int right = child_rect.right() - start_pixel_offset; | 273 int right = child_rect.right() - start_pixel_offset; |
| 274 int left = child_rect.right() - end_pixel_offset; | 274 int left = child_rect.right() - end_pixel_offset; |
| 275 child_overlap_rect = gfx::Rect(left, child_rect.y(), | 275 child_overlap_rect = gfx::Rect(left, child_rect.y(), |
| 276 right - left, child_rect.height()); | 276 right - left, child_rect.height()); |
| 277 break; | 277 break; |
| 278 } | 278 } |
| 279 case ui::AX_TEXT_DIRECTION_TB: { | 279 case ui::AX_TEXT_DIRECTION_TTB: { |
| 280 int top = child_rect.y() + start_pixel_offset; | 280 int top = child_rect.y() + start_pixel_offset; |
| 281 int bottom = child_rect.y() + end_pixel_offset; | 281 int bottom = child_rect.y() + end_pixel_offset; |
| 282 child_overlap_rect = gfx::Rect(child_rect.x(), top, | 282 child_overlap_rect = gfx::Rect(child_rect.x(), top, |
| 283 child_rect.width(), bottom - top); | 283 child_rect.width(), bottom - top); |
| 284 break; | 284 break; |
| 285 } | 285 } |
| 286 case ui::AX_TEXT_DIRECTION_BT: { | 286 case ui::AX_TEXT_DIRECTION_BTT: { |
| 287 int bottom = child_rect.bottom() - start_pixel_offset; | 287 int bottom = child_rect.bottom() - start_pixel_offset; |
| 288 int top = child_rect.bottom() - end_pixel_offset; | 288 int top = child_rect.bottom() - end_pixel_offset; |
| 289 child_overlap_rect = gfx::Rect(child_rect.x(), top, | 289 child_overlap_rect = gfx::Rect(child_rect.x(), top, |
| 290 child_rect.width(), bottom - top); | 290 child_rect.width(), bottom - top); |
| 291 break; | 291 break; |
| 292 } | 292 } |
| 293 default: | 293 default: |
| 294 NOTREACHED(); | 294 NOTREACHED(); |
| 295 } | 295 } |
| 296 | 296 |
| (...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 819 } | 819 } |
| 820 need_to_offset_web_area = true; | 820 need_to_offset_web_area = true; |
| 821 } | 821 } |
| 822 parent = parent->GetParentForBoundsCalculation(); | 822 parent = parent->GetParentForBoundsCalculation(); |
| 823 } | 823 } |
| 824 | 824 |
| 825 return bounds; | 825 return bounds; |
| 826 } | 826 } |
| 827 | 827 |
| 828 } // namespace content | 828 } // namespace content |
| OLD | NEW |