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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 bool isExpansionOpportunity = Character::treatAsSpace(charData.character) ||
(m_textRun.getTextJustify() == TextJustifyDistribute); | 92 bool isExpansionOpportunity = Character::treatAsSpace(charData.character) ||
(m_textRun.getTextJustify() == TextJustifyDistribute); |
93 if (isExpansionOpportunity || (m_textRun.getTextJustify() == TextJustifyAuto
&& Character::isCJKIdeographOrSymbol(charData.character))) { | 93 if (isExpansionOpportunity || (m_textRun.getTextJustify() == TextJustifyAuto
&& Character::isCJKIdeographOrSymbol(charData.character))) { |
94 // Distribute the run's total expansion evenly over all expansion opport
unities in the run. | 94 // Distribute the run's total expansion evenly over all expansion opport
unities in the run. |
95 if (m_expansion) { | 95 if (m_expansion) { |
96 if (!isExpansionOpportunity && !m_isAfterExpansion) { | 96 if (!isExpansionOpportunity && !m_isAfterExpansion) { |
97 // Take the expansion opportunity before this ideograph. | 97 // Take the expansion opportunity before this ideograph. |
98 m_expansion -= m_expansionPerOpportunity; | 98 m_expansion -= m_expansionPerOpportunity; |
99 m_runWidthSoFar += m_expansionPerOpportunity; | 99 m_runWidthSoFar += m_expansionPerOpportunity; |
100 } | 100 } |
101 if (m_textRun.allowsTrailingExpansion() | 101 if (m_textRun.allowsTrailingExpansion() |
102 || (m_textRun.ltr() && charData.characterOffset + charData.clust
erLength < static_cast<size_t>(m_textRun.length())) | 102 || (m_textRun.ltr() && charData.characterOffset + charData.clust
erLength < m_textRun.length()) |
103 || (m_textRun.rtl() && charData.characterOffset)) { | 103 || (m_textRun.rtl() && charData.characterOffset)) { |
104 m_expansion -= m_expansionPerOpportunity; | 104 m_expansion -= m_expansionPerOpportunity; |
105 width += m_expansionPerOpportunity; | 105 width += m_expansionPerOpportunity; |
106 m_isAfterExpansion = true; | 106 m_isAfterExpansion = true; |
107 } | 107 } |
108 } else { | 108 } else { |
109 m_isAfterExpansion = false; | 109 m_isAfterExpansion = false; |
110 } | 110 } |
111 | 111 |
112 // Account for word spacing. | 112 // Account for word spacing. |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 float initialWidth = m_runWidthSoFar; | 218 float initialWidth = m_runWidthSoFar; |
219 | 219 |
220 if (!advance(m_currentCharacter + 1)) | 220 if (!advance(m_currentCharacter + 1)) |
221 return false; | 221 return false; |
222 | 222 |
223 width = m_runWidthSoFar - initialWidth; | 223 width = m_runWidthSoFar - initialWidth; |
224 return true; | 224 return true; |
225 } | 225 } |
226 | 226 |
227 } // namespace blink | 227 } // namespace blink |
OLD | NEW |