| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 | 58 |
| 59 // Perform SVG text layout phase two (see SVGTextLayoutEngine for details). | 59 // Perform SVG text layout phase two (see SVGTextLayoutEngine for details). |
| 60 SVGTextLayoutEngine characterLayout(layoutAttributes); | 60 SVGTextLayoutEngine characterLayout(layoutAttributes); |
| 61 layoutCharactersInTextBoxes(this, characterLayout); | 61 layoutCharactersInTextBoxes(this, characterLayout); |
| 62 | 62 |
| 63 // Perform SVG text layout phase three (see SVGTextChunkBuilder for details)
. | 63 // Perform SVG text layout phase three (see SVGTextChunkBuilder for details)
. |
| 64 characterLayout.finishLayout(); | 64 characterLayout.finishLayout(); |
| 65 | 65 |
| 66 // Perform SVG text layout phase four | 66 // Perform SVG text layout phase four |
| 67 // Position & resize all SVGInlineText/FlowBoxes in the inline box tree, res
ize the root box as well as the LayoutSVGText parent block. | 67 // Position & resize all SVGInlineText/FlowBoxes in the inline box tree, res
ize the root box as well as the LayoutSVGText parent block. |
| 68 FloatRectWillBeLayoutRect childRect; | 68 LayoutRect childRect; |
| 69 layoutChildBoxes(this, &childRect); | 69 layoutChildBoxes(this, &childRect); |
| 70 layoutRootBox(childRect); | 70 layoutRootBox(childRect); |
| 71 } | 71 } |
| 72 | 72 |
| 73 void SVGRootInlineBox::layoutCharactersInTextBoxes(InlineFlowBox* start, SVGText
LayoutEngine& characterLayout) | 73 void SVGRootInlineBox::layoutCharactersInTextBoxes(InlineFlowBox* start, SVGText
LayoutEngine& characterLayout) |
| 74 { | 74 { |
| 75 for (InlineBox* child = start->firstChild(); child; child = child->nextOnLin
e()) { | 75 for (InlineBox* child = start->firstChild(); child; child = child->nextOnLin
e()) { |
| 76 if (child->isSVGInlineTextBox()) { | 76 if (child->isSVGInlineTextBox()) { |
| 77 ASSERT(child->layoutObject().isSVGInlineText()); | 77 ASSERT(child->layoutObject().isSVGInlineText()); |
| 78 characterLayout.layoutInlineTextBox(toSVGInlineTextBox(child)); | 78 characterLayout.layoutInlineTextBox(toSVGInlineTextBox(child)); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 94 } | 94 } |
| 95 | 95 |
| 96 layoutCharactersInTextBoxes(flowBox, characterLayout); | 96 layoutCharactersInTextBoxes(flowBox, characterLayout); |
| 97 | 97 |
| 98 if (isTextPath) | 98 if (isTextPath) |
| 99 characterLayout.endTextPathLayout(); | 99 characterLayout.endTextPathLayout(); |
| 100 } | 100 } |
| 101 } | 101 } |
| 102 } | 102 } |
| 103 | 103 |
| 104 void SVGRootInlineBox::layoutChildBoxes(InlineFlowBox* start, FloatRectWillBeLay
outRect* childRect) | 104 void SVGRootInlineBox::layoutChildBoxes(InlineFlowBox* start, LayoutRect* childR
ect) |
| 105 { | 105 { |
| 106 for (InlineBox* child = start->firstChild(); child; child = child->nextOnLin
e()) { | 106 for (InlineBox* child = start->firstChild(); child; child = child->nextOnLin
e()) { |
| 107 FloatRectWillBeLayoutRect boxRect; | 107 LayoutRect boxRect; |
| 108 if (child->isSVGInlineTextBox()) { | 108 if (child->isSVGInlineTextBox()) { |
| 109 ASSERT(child->layoutObject().isSVGInlineText()); | 109 ASSERT(child->layoutObject().isSVGInlineText()); |
| 110 | 110 |
| 111 SVGInlineTextBox* textBox = toSVGInlineTextBox(child); | 111 SVGInlineTextBox* textBox = toSVGInlineTextBox(child); |
| 112 boxRect = textBox->calculateBoundaries(); | 112 boxRect = textBox->calculateBoundaries(); |
| 113 textBox->setX(boxRect.x()); | 113 textBox->setX(boxRect.x()); |
| 114 textBox->setY(boxRect.y()); | 114 textBox->setY(boxRect.y()); |
| 115 textBox->setLogicalWidth(boxRect.width()); | 115 textBox->setLogicalWidth(boxRect.width()); |
| 116 textBox->setLogicalHeight(boxRect.height()); | 116 textBox->setLogicalHeight(boxRect.height()); |
| 117 } else { | 117 } else { |
| 118 // Skip generated content. | 118 // Skip generated content. |
| 119 if (!child->layoutObject().node()) | 119 if (!child->layoutObject().node()) |
| 120 continue; | 120 continue; |
| 121 | 121 |
| 122 SVGInlineFlowBox* flowBox = toSVGInlineFlowBox(child); | 122 SVGInlineFlowBox* flowBox = toSVGInlineFlowBox(child); |
| 123 layoutChildBoxes(flowBox); | 123 layoutChildBoxes(flowBox); |
| 124 | 124 |
| 125 boxRect = flowBox->calculateBoundaries(); | 125 boxRect = flowBox->calculateBoundaries(); |
| 126 flowBox->setX(boxRect.x()); | 126 flowBox->setX(boxRect.x()); |
| 127 flowBox->setY(boxRect.y()); | 127 flowBox->setY(boxRect.y()); |
| 128 flowBox->setLogicalWidth(boxRect.width()); | 128 flowBox->setLogicalWidth(boxRect.width()); |
| 129 flowBox->setLogicalHeight(boxRect.height()); | 129 flowBox->setLogicalHeight(boxRect.height()); |
| 130 } | 130 } |
| 131 if (childRect) | 131 if (childRect) |
| 132 childRect->unite(boxRect); | 132 childRect->unite(boxRect); |
| 133 } | 133 } |
| 134 } | 134 } |
| 135 | 135 |
| 136 void SVGRootInlineBox::layoutRootBox(const FloatRectWillBeLayoutRect& childRect) | 136 void SVGRootInlineBox::layoutRootBox(const LayoutRect& childRect) |
| 137 { | 137 { |
| 138 LayoutBlockFlow& parentBlock = block(); | 138 LayoutBlockFlow& parentBlock = block(); |
| 139 | 139 |
| 140 // Finally, assign the root block position, now that all content is laid out
. | 140 // Finally, assign the root block position, now that all content is laid out
. |
| 141 // FIXME: the call to enclosingLayoutRect() below is temporary and should be
removed once | 141 // FIXME: the call to enclosingLayoutRect() below is temporary and should be
removed once |
| 142 // the transition to LayoutUnit-based types is complete (crbug.com/321237) | 142 // the transition to LayoutUnit-based types is complete (crbug.com/321237) |
| 143 LayoutRect boundingRect = childRect.enclosingLayoutRect(); | 143 LayoutRect boundingRect = enclosingLayoutRect(childRect); |
| 144 parentBlock.setLocation(boundingRect.location()); | 144 parentBlock.setLocation(boundingRect.location()); |
| 145 parentBlock.setSize(boundingRect.size()); | 145 parentBlock.setSize(boundingRect.size()); |
| 146 | 146 |
| 147 // Position all children relative to the parent block. | 147 // Position all children relative to the parent block. |
| 148 for (InlineBox* child = firstChild(); child; child = child->nextOnLine()) { | 148 for (InlineBox* child = firstChild(); child; child = child->nextOnLine()) { |
| 149 // Skip generated content. | 149 // Skip generated content. |
| 150 if (!child->layoutObject().node()) | 150 if (!child->layoutObject().node()) |
| 151 continue; | 151 continue; |
| 152 child->adjustPosition(-childRect.x(), -childRect.y()); | 152 child->adjustPosition(-childRect.x(), -childRect.y()); |
| 153 } | 153 } |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 } | 258 } |
| 259 } | 259 } |
| 260 | 260 |
| 261 void SVGRootInlineBox::reorderValueLists(Vector<SVGTextLayoutAttributes*>& attri
butes) | 261 void SVGRootInlineBox::reorderValueLists(Vector<SVGTextLayoutAttributes*>& attri
butes) |
| 262 { | 262 { |
| 263 Vector<InlineBox*> leafBoxesInLogicalOrder; | 263 Vector<InlineBox*> leafBoxesInLogicalOrder; |
| 264 collectLeafBoxesInLogicalOrder(leafBoxesInLogicalOrder, reverseInlineBoxRang
eAndValueListsIfNeeded, &attributes); | 264 collectLeafBoxesInLogicalOrder(leafBoxesInLogicalOrder, reverseInlineBoxRang
eAndValueListsIfNeeded, &attributes); |
| 265 } | 265 } |
| 266 | 266 |
| 267 } // namespace blink | 267 } // namespace blink |
| OLD | NEW |