| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013, Google Inc. All rights reserved. | 2 * Copyright (C) 2013, Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 return true; | 94 return true; |
| 95 } | 95 } |
| 96 | 96 |
| 97 void AXInlineTextBox::TextCharacterOffsets(Vector<int>& offsets) const { | 97 void AXInlineTextBox::TextCharacterOffsets(Vector<int>& offsets) const { |
| 98 if (!inline_text_box_) | 98 if (!inline_text_box_) |
| 99 return; | 99 return; |
| 100 | 100 |
| 101 unsigned len = inline_text_box_->Len(); | 101 unsigned len = inline_text_box_->Len(); |
| 102 Vector<float> widths; | 102 Vector<float> widths; |
| 103 inline_text_box_->CharacterWidths(widths); | 103 inline_text_box_->CharacterWidths(widths); |
| 104 DCHECK(widths.size() == len); | 104 DCHECK_EQ(widths.size(), len); |
| 105 offsets.Resize(len); | 105 offsets.Resize(len); |
| 106 | 106 |
| 107 float width_so_far = 0; | 107 float width_so_far = 0; |
| 108 for (unsigned i = 0; i < len; i++) { | 108 for (unsigned i = 0; i < len; i++) { |
| 109 width_so_far += widths[i]; | 109 width_so_far += widths[i]; |
| 110 offsets[i] = roundf(width_so_far); | 110 offsets[i] = roundf(width_so_far); |
| 111 } | 111 } |
| 112 } | 112 } |
| 113 | 113 |
| 114 void AXInlineTextBox::GetWordBoundaries(Vector<AXRange>& words) const { | 114 void AXInlineTextBox::GetWordBoundaries(Vector<AXRange>& words) const { |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 if (previous_on_line) | 179 if (previous_on_line) |
| 180 return ax_object_cache_->GetOrCreate(previous_on_line.Get()); | 180 return ax_object_cache_->GetOrCreate(previous_on_line.Get()); |
| 181 | 181 |
| 182 if (!inline_text_box_->IsFirst()) | 182 if (!inline_text_box_->IsFirst()) |
| 183 return 0; | 183 return 0; |
| 184 | 184 |
| 185 return ParentObject()->PreviousOnLine(); | 185 return ParentObject()->PreviousOnLine(); |
| 186 } | 186 } |
| 187 | 187 |
| 188 } // namespace blink | 188 } // namespace blink |
| OLD | NEW |