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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 { | 43 { |
44 for (InlineBox* child = firstChild(); child; child = child->nextOnLine()) | 44 for (InlineBox* child = firstChild(); child; child = child->nextOnLine()) |
45 child->markDirty(); | 45 child->markDirty(); |
46 RootInlineBox::markDirty(); | 46 RootInlineBox::markDirty(); |
47 } | 47 } |
48 | 48 |
49 void SVGRootInlineBox::computePerCharacterLayoutInformation() | 49 void SVGRootInlineBox::computePerCharacterLayoutInformation() |
50 { | 50 { |
51 LayoutSVGText& textRoot = toLayoutSVGText(*LineLayoutAPIShim::layoutObjectFr
om(block())); | 51 LayoutSVGText& textRoot = toLayoutSVGText(*LineLayoutAPIShim::layoutObjectFr
om(block())); |
52 | 52 |
53 Vector<SVGTextLayoutAttributes*>& layoutAttributes = textRoot.layoutAttribut
es(); | 53 const Vector<LayoutSVGInlineText*>& descendantTextNodes = textRoot.descendan
tTextNodes(); |
54 if (layoutAttributes.isEmpty()) | 54 if (descendantTextNodes.isEmpty()) |
55 return; | 55 return; |
56 | 56 |
57 if (textRoot.needsReordering()) | 57 if (textRoot.needsReordering()) |
58 reorderValueLists(); | 58 reorderValueLists(); |
59 | 59 |
60 // Perform SVG text layout phase two (see SVGTextLayoutEngine for details). | 60 // Perform SVG text layout phase two (see SVGTextLayoutEngine for details). |
61 SVGTextLayoutEngine characterLayout(layoutAttributes); | 61 SVGTextLayoutEngine characterLayout(descendantTextNodes); |
62 characterLayout.layoutCharactersInTextBoxes(this); | 62 characterLayout.layoutCharactersInTextBoxes(this); |
63 | 63 |
64 // Perform SVG text layout phase three (see SVGTextChunkBuilder for details)
. | 64 // Perform SVG text layout phase three (see SVGTextChunkBuilder for details)
. |
65 characterLayout.finishLayout(); | 65 characterLayout.finishLayout(); |
66 | 66 |
67 // Perform SVG text layout phase four | 67 // Perform SVG text layout phase four |
68 // Position & resize all SVGInlineText/FlowBoxes in the inline box tree, res
ize the root box as well as the LayoutSVGText parent block. | 68 // Position & resize all SVGInlineText/FlowBoxes in the inline box tree, res
ize the root box as well as the LayoutSVGText parent block. |
69 LayoutRect childRect; | 69 LayoutRect childRect; |
70 layoutChildBoxes(this, &childRect); | 70 layoutChildBoxes(this, &childRect); |
71 layoutRootBox(childRect); | 71 layoutRootBox(childRect); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 if (point.x() < leaf->left() + leaf->logicalWidth()) | 149 if (point.x() < leaf->left() + leaf->logicalWidth()) |
150 return leaf; | 150 return leaf; |
151 } | 151 } |
152 | 152 |
153 return closestLeaf ? closestLeaf : lastLeaf; | 153 return closestLeaf ? closestLeaf : lastLeaf; |
154 } | 154 } |
155 | 155 |
156 static inline void swapPositioningValuesInTextBoxes(SVGInlineTextBox* firstTextB
ox, SVGInlineTextBox* lastTextBox) | 156 static inline void swapPositioningValuesInTextBoxes(SVGInlineTextBox* firstTextB
ox, SVGInlineTextBox* lastTextBox) |
157 { | 157 { |
158 LineLayoutSVGInlineText firstTextNode = LineLayoutSVGInlineText(firstTextBox
->getLineLayoutItem()); | 158 LineLayoutSVGInlineText firstTextNode = LineLayoutSVGInlineText(firstTextBox
->getLineLayoutItem()); |
159 SVGCharacterDataMap& firstCharacterDataMap = firstTextNode.layoutAttributes(
).characterDataMap(); | 159 SVGCharacterDataMap& firstCharacterDataMap = firstTextNode.characterDataMap(
); |
160 SVGCharacterDataMap::iterator itFirst = firstCharacterDataMap.find(firstText
Box->start() + 1); | 160 SVGCharacterDataMap::iterator itFirst = firstCharacterDataMap.find(firstText
Box->start() + 1); |
161 if (itFirst == firstCharacterDataMap.end()) | 161 if (itFirst == firstCharacterDataMap.end()) |
162 return; | 162 return; |
163 LineLayoutSVGInlineText lastTextNode = LineLayoutSVGInlineText(lastTextBox->
getLineLayoutItem()); | 163 LineLayoutSVGInlineText lastTextNode = LineLayoutSVGInlineText(lastTextBox->
getLineLayoutItem()); |
164 SVGCharacterDataMap& lastCharacterDataMap = lastTextNode.layoutAttributes().
characterDataMap(); | 164 SVGCharacterDataMap& lastCharacterDataMap = lastTextNode.characterDataMap(); |
165 SVGCharacterDataMap::iterator itLast = lastCharacterDataMap.find(lastTextBox
->start() + 1); | 165 SVGCharacterDataMap::iterator itLast = lastCharacterDataMap.find(lastTextBox
->start() + 1); |
166 if (itLast == lastCharacterDataMap.end()) | 166 if (itLast == lastCharacterDataMap.end()) |
167 return; | 167 return; |
168 // We only want to perform the swap if both inline boxes are absolutely | 168 // We only want to perform the swap if both inline boxes are absolutely |
169 // positioned. | 169 // positioned. |
170 std::swap(itFirst->value, itLast->value); | 170 std::swap(itFirst->value, itLast->value); |
171 } | 171 } |
172 | 172 |
173 static inline void reverseInlineBoxRangeAndValueListsIfNeeded(Vector<InlineBox*>
::iterator first, Vector<InlineBox*>::iterator last) | 173 static inline void reverseInlineBoxRangeAndValueListsIfNeeded(Vector<InlineBox*>
::iterator first, Vector<InlineBox*>::iterator last) |
174 { | 174 { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 if (!leaf->isSVGInlineTextBox()) | 207 if (!leaf->isSVGInlineTextBox()) |
208 continue; | 208 continue; |
209 if (leaf->nodeAtPoint(result, locationInContainer, accumulatedOffset, li
neTop, lineBottom)) | 209 if (leaf->nodeAtPoint(result, locationInContainer, accumulatedOffset, li
neTop, lineBottom)) |
210 return true; | 210 return true; |
211 } | 211 } |
212 | 212 |
213 return false; | 213 return false; |
214 } | 214 } |
215 | 215 |
216 } // namespace blink | 216 } // namespace blink |
OLD | NEW |