Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1368)

Side by Side Diff: Source/core/layout/svg/line/SVGRootInlineBox.cpp

Issue 1043643002: Switch line layout to LayoutUnit. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: More TestExpectations tweaks Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/layout/svg/line/SVGRootInlineBox.h ('k') | Source/core/paint/EllipsisBoxPainter.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 characterLayout.layoutCharactersInTextBoxes(this); 61 characterLayout.layoutCharactersInTextBoxes(this);
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::layoutChildBoxes(InlineFlowBox* start, FloatRectWillBeLay outRect* childRect) 73 void SVGRootInlineBox::layoutChildBoxes(InlineFlowBox* start, LayoutRect* childR ect)
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 FloatRectWillBeLayoutRect boxRect; 76 LayoutRect boxRect;
77 if (child->isSVGInlineTextBox()) { 77 if (child->isSVGInlineTextBox()) {
78 ASSERT(child->layoutObject().isSVGInlineText()); 78 ASSERT(child->layoutObject().isSVGInlineText());
79 79
80 SVGInlineTextBox* textBox = toSVGInlineTextBox(child); 80 SVGInlineTextBox* textBox = toSVGInlineTextBox(child);
81 boxRect = textBox->calculateBoundaries(); 81 boxRect = textBox->calculateBoundaries();
82 textBox->setX(boxRect.x()); 82 textBox->setX(boxRect.x());
83 textBox->setY(boxRect.y()); 83 textBox->setY(boxRect.y());
84 textBox->setLogicalWidth(boxRect.width()); 84 textBox->setLogicalWidth(boxRect.width());
85 textBox->setLogicalHeight(boxRect.height()); 85 textBox->setLogicalHeight(boxRect.height());
86 } else { 86 } else {
87 // Skip generated content. 87 // Skip generated content.
88 if (!child->layoutObject().node()) 88 if (!child->layoutObject().node())
89 continue; 89 continue;
90 90
91 SVGInlineFlowBox* flowBox = toSVGInlineFlowBox(child); 91 SVGInlineFlowBox* flowBox = toSVGInlineFlowBox(child);
92 layoutChildBoxes(flowBox); 92 layoutChildBoxes(flowBox);
93 93
94 boxRect = flowBox->calculateBoundaries(); 94 boxRect = flowBox->calculateBoundaries();
95 flowBox->setX(boxRect.x()); 95 flowBox->setX(boxRect.x());
96 flowBox->setY(boxRect.y()); 96 flowBox->setY(boxRect.y());
97 flowBox->setLogicalWidth(boxRect.width()); 97 flowBox->setLogicalWidth(boxRect.width());
98 flowBox->setLogicalHeight(boxRect.height()); 98 flowBox->setLogicalHeight(boxRect.height());
99 } 99 }
100 if (childRect) 100 if (childRect)
101 childRect->unite(boxRect); 101 childRect->unite(boxRect);
102 } 102 }
103 } 103 }
104 104
105 void SVGRootInlineBox::layoutRootBox(const FloatRectWillBeLayoutRect& childRect) 105 void SVGRootInlineBox::layoutRootBox(const LayoutRect& childRect)
106 { 106 {
107 LayoutBlockFlow& parentBlock = block(); 107 LayoutBlockFlow& parentBlock = block();
108 108
109 // Finally, assign the root block position, now that all content is laid out . 109 // Finally, assign the root block position, now that all content is laid out .
110 // FIXME: the call to enclosingLayoutRect() below is temporary and should be removed once 110 // FIXME: the call to enclosingLayoutRect() below is temporary and should be removed once
111 // the transition to LayoutUnit-based types is complete (crbug.com/321237) 111 // the transition to LayoutUnit-based types is complete (crbug.com/321237)
112 LayoutRect boundingRect = childRect.enclosingLayoutRect(); 112 LayoutRect boundingRect = enclosingLayoutRect(childRect);
113 parentBlock.setLocation(boundingRect.location()); 113 parentBlock.setLocation(boundingRect.location());
114 parentBlock.setSize(boundingRect.size()); 114 parentBlock.setSize(boundingRect.size());
115 115
116 // Position all children relative to the parent block. 116 // Position all children relative to the parent block.
117 for (InlineBox* child = firstChild(); child; child = child->nextOnLine()) { 117 for (InlineBox* child = firstChild(); child; child = child->nextOnLine()) {
118 // Skip generated content. 118 // Skip generated content.
119 if (!child->layoutObject().node()) 119 if (!child->layoutObject().node())
120 continue; 120 continue;
121 child->adjustPosition(-childRect.x(), -childRect.y()); 121 child->adjustPosition(-childRect.x(), -childRect.y());
122 } 122 }
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 } 227 }
228 } 228 }
229 229
230 void SVGRootInlineBox::reorderValueLists(Vector<SVGTextLayoutAttributes*>& attri butes) 230 void SVGRootInlineBox::reorderValueLists(Vector<SVGTextLayoutAttributes*>& attri butes)
231 { 231 {
232 Vector<InlineBox*> leafBoxesInLogicalOrder; 232 Vector<InlineBox*> leafBoxesInLogicalOrder;
233 collectLeafBoxesInLogicalOrder(leafBoxesInLogicalOrder, reverseInlineBoxRang eAndValueListsIfNeeded, &attributes); 233 collectLeafBoxesInLogicalOrder(leafBoxesInLogicalOrder, reverseInlineBoxRang eAndValueListsIfNeeded, &attributes);
234 } 234 }
235 235
236 } // namespace blink 236 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/layout/svg/line/SVGRootInlineBox.h ('k') | Source/core/paint/EllipsisBoxPainter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698