OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz> | 2 * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz> |
3 * Copyright (C) 2006 Apple Computer Inc. | 3 * Copyright (C) 2006 Apple Computer Inc. |
4 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> | 4 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> |
5 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 5 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
6 * Copyright (C) 2011 Torch Mobile (Beijing) CO. Ltd. All rights reserved. | 6 * Copyright (C) 2011 Torch Mobile (Beijing) CO. Ltd. All rights reserved. |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 | 210 |
211 return closestLeaf ? closestLeaf : lastLeaf; | 211 return closestLeaf ? closestLeaf : lastLeaf; |
212 } | 212 } |
213 | 213 |
214 static inline void swapItemsInLayoutAttributes(SVGTextLayoutAttributes* firstAtt
ributes, SVGTextLayoutAttributes* lastAttributes, unsigned firstPosition, unsign
ed lastPosition) | 214 static inline void swapItemsInLayoutAttributes(SVGTextLayoutAttributes* firstAtt
ributes, SVGTextLayoutAttributes* lastAttributes, unsigned firstPosition, unsign
ed lastPosition) |
215 { | 215 { |
216 SVGCharacterDataMap::iterator itFirst = firstAttributes->characterDataMap().
find(firstPosition + 1); | 216 SVGCharacterDataMap::iterator itFirst = firstAttributes->characterDataMap().
find(firstPosition + 1); |
217 SVGCharacterDataMap::iterator itLast = lastAttributes->characterDataMap().fi
nd(lastPosition + 1); | 217 SVGCharacterDataMap::iterator itLast = lastAttributes->characterDataMap().fi
nd(lastPosition + 1); |
218 bool firstPresent = itFirst != firstAttributes->characterDataMap().end(); | 218 bool firstPresent = itFirst != firstAttributes->characterDataMap().end(); |
219 bool lastPresent = itLast != lastAttributes->characterDataMap().end(); | 219 bool lastPresent = itLast != lastAttributes->characterDataMap().end(); |
220 if (!firstPresent && !lastPresent) | 220 // We only want to perform the swap if both inline boxes are absolutely |
| 221 // positioned. |
| 222 if (!firstPresent || !lastPresent) |
221 return; | 223 return; |
222 | 224 std::swap(itFirst->value, itLast->value); |
223 if (firstPresent && lastPresent) { | |
224 std::swap(itFirst->value, itLast->value); | |
225 return; | |
226 } | |
227 | |
228 if (firstPresent && !lastPresent) { | |
229 lastAttributes->characterDataMap().set(lastPosition + 1, itFirst->value)
; | |
230 return; | |
231 } | |
232 | |
233 // !firstPresent && lastPresent | |
234 firstAttributes->characterDataMap().set(firstPosition + 1, itLast->value); | |
235 } | 225 } |
236 | 226 |
237 static inline void findFirstAndLastAttributesInVector(Vector<SVGTextLayoutAttrib
utes*>& attributes, RenderSVGInlineText* firstContext, RenderSVGInlineText* last
Context, | 227 static inline void findFirstAndLastAttributesInVector(Vector<SVGTextLayoutAttrib
utes*>& attributes, RenderSVGInlineText* firstContext, RenderSVGInlineText* last
Context, |
238 SVGTextLayoutAttributes*&
first, SVGTextLayoutAttributes*& last) | 228 SVGTextLayoutAttributes*&
first, SVGTextLayoutAttributes*& last) |
239 { | 229 { |
240 first = 0; | 230 first = 0; |
241 last = 0; | 231 last = 0; |
242 | 232 |
243 unsigned attributesSize = attributes.size(); | 233 unsigned attributesSize = attributes.size(); |
244 for (unsigned i = 0; i < attributesSize; ++i) { | 234 for (unsigned i = 0; i < attributesSize; ++i) { |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 } | 285 } |
296 } | 286 } |
297 | 287 |
298 void SVGRootInlineBox::reorderValueLists(Vector<SVGTextLayoutAttributes*>& attri
butes) | 288 void SVGRootInlineBox::reorderValueLists(Vector<SVGTextLayoutAttributes*>& attri
butes) |
299 { | 289 { |
300 Vector<InlineBox*> leafBoxesInLogicalOrder; | 290 Vector<InlineBox*> leafBoxesInLogicalOrder; |
301 collectLeafBoxesInLogicalOrder(leafBoxesInLogicalOrder, reverseInlineBoxRang
eAndValueListsIfNeeded, &attributes); | 291 collectLeafBoxesInLogicalOrder(leafBoxesInLogicalOrder, reverseInlineBoxRang
eAndValueListsIfNeeded, &attributes); |
302 } | 292 } |
303 | 293 |
304 } // namespace WebCore | 294 } // namespace WebCore |
OLD | NEW |