Chromium Code Reviews| 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 93 return true; | 93 return true; |
| 94 } | 94 } |
| 95 | 95 |
| 96 void AXInlineTextBox::textCharacterOffsets(Vector<int>& offsets) const { | 96 void AXInlineTextBox::textCharacterOffsets(Vector<int>& offsets) const { |
| 97 if (!m_inlineTextBox) | 97 if (!m_inlineTextBox) |
| 98 return; | 98 return; |
| 99 | 99 |
| 100 unsigned len = m_inlineTextBox->len(); | 100 unsigned len = m_inlineTextBox->len(); |
| 101 Vector<float> widths; | 101 Vector<float> widths; |
| 102 m_inlineTextBox->characterWidths(widths); | 102 m_inlineTextBox->characterWidths(widths); |
| 103 ASSERT(widths.size() == len); | 103 DCHECK(widths.size() == len); |
|
tkent
2017/04/09 23:21:22
Use DCHECK_EQ
| |
| 104 offsets.resize(len); | 104 offsets.resize(len); |
| 105 | 105 |
| 106 float widthSoFar = 0; | 106 float widthSoFar = 0; |
| 107 for (unsigned i = 0; i < len; i++) { | 107 for (unsigned i = 0; i < len; i++) { |
| 108 widthSoFar += widths[i]; | 108 widthSoFar += widths[i]; |
| 109 offsets[i] = roundf(widthSoFar); | 109 offsets[i] = roundf(widthSoFar); |
| 110 } | 110 } |
| 111 } | 111 } |
| 112 | 112 |
| 113 void AXInlineTextBox::wordBoundaries(Vector<AXRange>& words) const { | 113 void AXInlineTextBox::wordBoundaries(Vector<AXRange>& words) const { |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 125 String AXInlineTextBox::name(AXNameFrom& nameFrom, | 125 String AXInlineTextBox::name(AXNameFrom& nameFrom, |
| 126 AXObject::AXObjectVector* nameObjects) const { | 126 AXObject::AXObjectVector* nameObjects) const { |
| 127 if (!m_inlineTextBox) | 127 if (!m_inlineTextBox) |
| 128 return String(); | 128 return String(); |
| 129 | 129 |
| 130 nameFrom = AXNameFromContents; | 130 nameFrom = AXNameFromContents; |
| 131 return m_inlineTextBox->text(); | 131 return m_inlineTextBox->text(); |
| 132 } | 132 } |
| 133 | 133 |
| 134 AXObject* AXInlineTextBox::computeParent() const { | 134 AXObject* AXInlineTextBox::computeParent() const { |
| 135 ASSERT(!isDetached()); | 135 DCHECK(!isDetached()); |
| 136 if (!m_inlineTextBox || !m_axObjectCache) | 136 if (!m_inlineTextBox || !m_axObjectCache) |
| 137 return 0; | 137 return 0; |
| 138 | 138 |
| 139 LineLayoutText lineLayoutText = m_inlineTextBox->getLineLayoutItem(); | 139 LineLayoutText lineLayoutText = m_inlineTextBox->getLineLayoutItem(); |
| 140 return m_axObjectCache->getOrCreate( | 140 return m_axObjectCache->getOrCreate( |
| 141 LineLayoutAPIShim::layoutObjectFrom(lineLayoutText)); | 141 LineLayoutAPIShim::layoutObjectFrom(lineLayoutText)); |
| 142 } | 142 } |
| 143 | 143 |
| 144 // In addition to LTR and RTL direction, edit fields also support | 144 // In addition to LTR and RTL direction, edit fields also support |
| 145 // top to bottom and bottom to top via the CSS writing-mode property. | 145 // top to bottom and bottom to top via the CSS writing-mode property. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 178 if (previousOnLine) | 178 if (previousOnLine) |
| 179 return m_axObjectCache->getOrCreate(previousOnLine.get()); | 179 return m_axObjectCache->getOrCreate(previousOnLine.get()); |
| 180 | 180 |
| 181 if (!m_inlineTextBox->isFirst()) | 181 if (!m_inlineTextBox->isFirst()) |
| 182 return 0; | 182 return 0; |
| 183 | 183 |
| 184 return parentObject()->previousOnLine(); | 184 return parentObject()->previousOnLine(); |
| 185 } | 185 } |
| 186 | 186 |
| 187 } // namespace blink | 187 } // namespace blink |
| OLD | NEW |