OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) |
3 * Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010 Apple Inc. | 3 * Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010 Apple Inc. |
4 * All right reserved. | 4 * All right reserved. |
5 * Copyright (C) 2010 Google Inc. All rights reserved. | 5 * Copyright (C) 2010 Google Inc. All rights reserved. |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 | 139 |
140 inline bool operator!=(const InlineIterator& it1, const InlineIterator& it2) { | 140 inline bool operator!=(const InlineIterator& it1, const InlineIterator& it2) { |
141 return it1.offset() != it2.offset() || | 141 return it1.offset() != it2.offset() || |
142 it1.getLineLayoutItem() != it2.getLineLayoutItem(); | 142 it1.getLineLayoutItem() != it2.getLineLayoutItem(); |
143 } | 143 } |
144 | 144 |
145 static inline WTF::Unicode::CharDirection embedCharFromDirection( | 145 static inline WTF::Unicode::CharDirection embedCharFromDirection( |
146 TextDirection dir, | 146 TextDirection dir, |
147 EUnicodeBidi unicodeBidi) { | 147 EUnicodeBidi unicodeBidi) { |
148 using namespace WTF::Unicode; | 148 using namespace WTF::Unicode; |
149 if (unicodeBidi == Embed) { | 149 if (unicodeBidi == EUnicodeBidi::kEmbed) { |
150 return dir == TextDirection::kRtl ? RightToLeftEmbedding | 150 return dir == TextDirection::kRtl ? RightToLeftEmbedding |
151 : LeftToRightEmbedding; | 151 : LeftToRightEmbedding; |
152 } | 152 } |
153 return dir == TextDirection::kRtl ? RightToLeftOverride : LeftToRightOverride; | 153 return dir == TextDirection::kRtl ? RightToLeftOverride : LeftToRightOverride; |
154 } | 154 } |
155 | 155 |
156 static inline bool treatAsIsolated(const ComputedStyle& style) { | 156 static inline bool treatAsIsolated(const ComputedStyle& style) { |
157 return isIsolated(style.unicodeBidi()) && | 157 return isIsolated(style.unicodeBidi()) && |
158 style.rtlOrdering() == EOrder::Logical; | 158 style.rtlOrdering() == EOrder::Logical; |
159 } | 159 } |
160 | 160 |
161 template <class Observer> | 161 template <class Observer> |
162 static inline void notifyObserverEnteredObject(Observer* observer, | 162 static inline void notifyObserverEnteredObject(Observer* observer, |
163 LineLayoutItem object) { | 163 LineLayoutItem object) { |
164 if (!observer || !object || !object.isLayoutInline()) | 164 if (!observer || !object || !object.isLayoutInline()) |
165 return; | 165 return; |
166 | 166 |
167 const ComputedStyle& style = object.styleRef(); | 167 const ComputedStyle& style = object.styleRef(); |
168 EUnicodeBidi unicodeBidi = style.unicodeBidi(); | 168 EUnicodeBidi unicodeBidi = style.unicodeBidi(); |
169 if (unicodeBidi == UBNormal) { | 169 if (unicodeBidi == EUnicodeBidi::kNormal) { |
170 // http://dev.w3.org/csswg/css3-writing-modes/#unicode-bidi | 170 // http://dev.w3.org/csswg/css3-writing-modes/#unicode-bidi |
171 // "The element does not open an additional level of embedding with respect | 171 // "The element does not open an additional level of embedding with respect |
172 // to the bidirectional algorithm." | 172 // to the bidirectional algorithm." |
173 // Thus we ignore any possible dir= attribute on the span. | 173 // Thus we ignore any possible dir= attribute on the span. |
174 return; | 174 return; |
175 } | 175 } |
176 if (treatAsIsolated(style)) { | 176 if (treatAsIsolated(style)) { |
177 // Make sure that explicit embeddings are committed before we enter the | 177 // Make sure that explicit embeddings are committed before we enter the |
178 // isolated content. | 178 // isolated content. |
179 observer->commitExplicitEmbedding(observer->runs()); | 179 observer->commitExplicitEmbedding(observer->runs()); |
180 observer->enterIsolate(); | 180 observer->enterIsolate(); |
181 // Embedding/Override characters implied by dir= will be handled when | 181 // Embedding/Override characters implied by dir= will be handled when |
182 // we process the isolated span, not when laying out the "parent" run. | 182 // we process the isolated span, not when laying out the "parent" run. |
183 return; | 183 return; |
184 } | 184 } |
185 | 185 |
186 if (!observer->inIsolate()) | 186 if (!observer->inIsolate()) |
187 observer->embed(embedCharFromDirection(style.direction(), unicodeBidi), | 187 observer->embed(embedCharFromDirection(style.direction(), unicodeBidi), |
188 FromStyleOrDOM); | 188 FromStyleOrDOM); |
189 } | 189 } |
190 | 190 |
191 template <class Observer> | 191 template <class Observer> |
192 static inline void notifyObserverWillExitObject(Observer* observer, | 192 static inline void notifyObserverWillExitObject(Observer* observer, |
193 LineLayoutItem object) { | 193 LineLayoutItem object) { |
194 if (!observer || !object || !object.isLayoutInline()) | 194 if (!observer || !object || !object.isLayoutInline()) |
195 return; | 195 return; |
196 | 196 |
197 EUnicodeBidi unicodeBidi = object.style()->unicodeBidi(); | 197 EUnicodeBidi unicodeBidi = object.style()->unicodeBidi(); |
198 if (unicodeBidi == UBNormal) | 198 if (unicodeBidi == EUnicodeBidi::kNormal) |
199 return; // Nothing to do for unicode-bidi: normal | 199 return; // Nothing to do for unicode-bidi: normal |
200 if (treatAsIsolated(object.styleRef())) { | 200 if (treatAsIsolated(object.styleRef())) { |
201 observer->exitIsolate(); | 201 observer->exitIsolate(); |
202 return; | 202 return; |
203 } | 203 } |
204 | 204 |
205 // Otherwise we pop any embed/override character we added when we opened this | 205 // Otherwise we pop any embed/override character we added when we opened this |
206 // tag. | 206 // tag. |
207 if (!observer->inIsolate()) | 207 if (!observer->inIsolate()) |
208 observer->embed(WTF::Unicode::PopDirectionalFormat, FromStyleOrDOM); | 208 observer->embed(WTF::Unicode::PopDirectionalFormat, FromStyleOrDOM); |
(...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
895 m_sor = m_eor; | 895 m_sor = m_eor; |
896 } | 896 } |
897 | 897 |
898 m_direction = WTF::Unicode::OtherNeutral; | 898 m_direction = WTF::Unicode::OtherNeutral; |
899 m_status.eor = WTF::Unicode::OtherNeutral; | 899 m_status.eor = WTF::Unicode::OtherNeutral; |
900 } | 900 } |
901 | 901 |
902 } // namespace blink | 902 } // namespace blink |
903 | 903 |
904 #endif // InlineIterator_h | 904 #endif // InlineIterator_h |
OLD | NEW |