| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2003, 2006, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv
ed. | 2 * Copyright (C) 2003, 2006, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv
ed. |
| 3 * Copyright (C) 2008 Holger Hans Peter Freyther | 3 * Copyright (C) 2008 Holger Hans Peter Freyther |
| 4 * Copyright (C) 2014 Google Inc. All rights reserved. | 4 * Copyright (C) 2014 Google Inc. All rights reserved. |
| 5 * | 5 * |
| 6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
| 7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
| 8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
| 9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
| 10 * | 10 * |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 width += m_expansionPerOpportunity; | 106 width += m_expansionPerOpportunity; |
| 107 m_isAfterExpansion = true; | 107 m_isAfterExpansion = true; |
| 108 } | 108 } |
| 109 } else { | 109 } else { |
| 110 m_isAfterExpansion = false; | 110 m_isAfterExpansion = false; |
| 111 } | 111 } |
| 112 | 112 |
| 113 // Account for word spacing. | 113 // Account for word spacing. |
| 114 // We apply additional space between "words" by adding width to the spac
e character. | 114 // We apply additional space between "words" by adding width to the spac
e character. |
| 115 if (isExpansionOpportunity && (charData.character != characterTabulation
|| !m_run.allowTabs()) | 115 if (isExpansionOpportunity && (charData.character != characterTabulation
|| !m_run.allowTabs()) |
| 116 && (charData.characterOffset || charData.character == noBreakSpace) | 116 && (charData.characterOffset || charData.character == characterNoBre
akSpace) |
| 117 && m_font->fontDescription().wordSpacing()) { | 117 && m_font->fontDescription().wordSpacing()) { |
| 118 width += m_font->fontDescription().wordSpacing(); | 118 width += m_font->fontDescription().wordSpacing(); |
| 119 } | 119 } |
| 120 } else { | 120 } else { |
| 121 m_isAfterExpansion = false; | 121 m_isAfterExpansion = false; |
| 122 } | 122 } |
| 123 | 123 |
| 124 return width; | 124 return width; |
| 125 } | 125 } |
| 126 | 126 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 138 while (textIterator.consume(charData.character)) { | 138 while (textIterator.consume(charData.character)) { |
| 139 charData.characterOffset = textIterator.offset(); | 139 charData.characterOffset = textIterator.offset(); |
| 140 charData.clusterLength = textIterator.glyphLength(); | 140 charData.clusterLength = textIterator.glyphLength(); |
| 141 GlyphData glyphData = glyphDataForCharacter(charData, normalizeSpace); | 141 GlyphData glyphData = glyphDataForCharacter(charData, normalizeSpace); |
| 142 | 142 |
| 143 // Some fonts do not have a glyph for zero-width-space, | 143 // Some fonts do not have a glyph for zero-width-space, |
| 144 // in that case use the space character and override the width. | 144 // in that case use the space character and override the width. |
| 145 float width; | 145 float width; |
| 146 bool spaceUsedAsZeroWidthSpace = false; | 146 bool spaceUsedAsZeroWidthSpace = false; |
| 147 if (!glyphData.glyph && Character::treatAsZeroWidthSpace(charData.charac
ter)) { | 147 if (!glyphData.glyph && Character::treatAsZeroWidthSpace(charData.charac
ter)) { |
| 148 charData.character = space; | 148 charData.character = characterSpace; |
| 149 glyphData = glyphDataForCharacter(charData); | 149 glyphData = glyphDataForCharacter(charData); |
| 150 width = 0; | 150 width = 0; |
| 151 spaceUsedAsZeroWidthSpace = true; | 151 spaceUsedAsZeroWidthSpace = true; |
| 152 } else { | 152 } else { |
| 153 width = characterWidth(charData.character, glyphData); | 153 width = characterWidth(charData.character, glyphData); |
| 154 } | 154 } |
| 155 | 155 |
| 156 Glyph glyph = glyphData.glyph; | 156 Glyph glyph = glyphData.glyph; |
| 157 const SimpleFontData* fontData = glyphData.fontData; | 157 const SimpleFontData* fontData = glyphData.fontData; |
| 158 ASSERT(fontData); | 158 ASSERT(fontData); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 float initialWidth = m_runWidthSoFar; | 219 float initialWidth = m_runWidthSoFar; |
| 220 | 220 |
| 221 if (!advance(m_currentCharacter + 1)) | 221 if (!advance(m_currentCharacter + 1)) |
| 222 return false; | 222 return false; |
| 223 | 223 |
| 224 width = m_runWidthSoFar - initialWidth; | 224 width = m_runWidthSoFar - initialWidth; |
| 225 return true; | 225 return true; |
| 226 } | 226 } |
| 227 | 227 |
| 228 } // namespace blink | 228 } // namespace blink |
| OLD | NEW |