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

Side by Side Diff: Source/core/rendering/svg/SVGRootInlineBox.cpp

Issue 19337002: Introduce toSVGInlineFlowBox() and use it (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebased Created 7 years, 5 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
« no previous file with comments | « Source/core/rendering/svg/SVGInlineFlowBox.cpp ('k') | no next file » | 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 43
44 bool isPrinting = renderer()->document()->printing(); 44 bool isPrinting = renderer()->document()->printing();
45 bool hasSelection = !isPrinting && selectionState() != RenderObject::Selecti onNone; 45 bool hasSelection = !isPrinting && selectionState() != RenderObject::Selecti onNone;
46 46
47 PaintInfo childPaintInfo(paintInfo); 47 PaintInfo childPaintInfo(paintInfo);
48 if (hasSelection) { 48 if (hasSelection) {
49 for (InlineBox* child = firstChild(); child; child = child->nextOnLine() ) { 49 for (InlineBox* child = firstChild(); child; child = child->nextOnLine() ) {
50 if (child->isSVGInlineTextBox()) 50 if (child->isSVGInlineTextBox())
51 toSVGInlineTextBox(child)->paintSelectionBackground(childPaintIn fo); 51 toSVGInlineTextBox(child)->paintSelectionBackground(childPaintIn fo);
52 else if (child->isSVGInlineFlowBox()) 52 else if (child->isSVGInlineFlowBox())
53 static_cast<SVGInlineFlowBox*>(child)->paintSelectionBackground( childPaintInfo); 53 toSVGInlineFlowBox(child)->paintSelectionBackground(childPaintIn fo);
54 } 54 }
55 } 55 }
56 56
57 SVGRenderingContext renderingContext(boxRenderer, paintInfo, SVGRenderingCon text::SaveGraphicsContext); 57 SVGRenderingContext renderingContext(boxRenderer, paintInfo, SVGRenderingCon text::SaveGraphicsContext);
58 if (renderingContext.isRenderingPrepared()) { 58 if (renderingContext.isRenderingPrepared()) {
59 for (InlineBox* child = firstChild(); child; child = child->nextOnLine() ) { 59 for (InlineBox* child = firstChild(); child; child = child->nextOnLine() ) {
60 if (child->isSVGInlineTextBox()) 60 if (child->isSVGInlineTextBox())
61 SVGInlineFlowBox::computeTextMatchMarkerRectForRenderer(toRender SVGInlineText(toSVGInlineTextBox(child)->textRenderer())); 61 SVGInlineFlowBox::computeTextMatchMarkerRectForRenderer(toRender SVGInlineText(toSVGInlineTextBox(child)->textRenderer()));
62 62
63 child->paint(paintInfo, LayoutPoint(), 0, 0); 63 child->paint(paintInfo, LayoutPoint(), 0, 0);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 if (child->isSVGInlineTextBox()) { 105 if (child->isSVGInlineTextBox()) {
106 ASSERT(child->renderer()); 106 ASSERT(child->renderer());
107 ASSERT(child->renderer()->isSVGInlineText()); 107 ASSERT(child->renderer()->isSVGInlineText());
108 characterLayout.layoutInlineTextBox(toSVGInlineTextBox(child)); 108 characterLayout.layoutInlineTextBox(toSVGInlineTextBox(child));
109 } else { 109 } else {
110 // Skip generated content. 110 // Skip generated content.
111 Node* node = child->renderer()->node(); 111 Node* node = child->renderer()->node();
112 if (!node) 112 if (!node)
113 continue; 113 continue;
114 114
115 ASSERT_WITH_SECURITY_IMPLICATION(child->isInlineFlowBox()); 115 SVGInlineFlowBox* flowBox = toSVGInlineFlowBox(child);
116
117 SVGInlineFlowBox* flowBox = static_cast<SVGInlineFlowBox*>(child);
118 bool isTextPath = node->hasTagName(SVGNames::textPathTag); 116 bool isTextPath = node->hasTagName(SVGNames::textPathTag);
119 if (isTextPath) { 117 if (isTextPath) {
120 // Build text chunks for all <textPath> children, using the line layout algorithm. 118 // Build text chunks for all <textPath> children, using the line layout algorithm.
121 // This is needeed as text-anchor is just an additional startOff set for text paths. 119 // This is needeed as text-anchor is just an additional startOff set for text paths.
122 SVGTextLayoutEngine lineLayout(characterLayout.layoutAttributes( )); 120 SVGTextLayoutEngine lineLayout(characterLayout.layoutAttributes( ));
123 layoutCharactersInTextBoxes(flowBox, lineLayout); 121 layoutCharactersInTextBoxes(flowBox, lineLayout);
124 122
125 characterLayout.beginTextPathLayout(child->renderer(), lineLayou t); 123 characterLayout.beginTextPathLayout(child->renderer(), lineLayou t);
126 } 124 }
127 125
(...skipping 17 matching lines...) Expand all
145 boxRect = textBox->calculateBoundaries(); 143 boxRect = textBox->calculateBoundaries();
146 textBox->setX(boxRect.x()); 144 textBox->setX(boxRect.x());
147 textBox->setY(boxRect.y()); 145 textBox->setY(boxRect.y());
148 textBox->setLogicalWidth(boxRect.width()); 146 textBox->setLogicalWidth(boxRect.width());
149 textBox->setLogicalHeight(boxRect.height()); 147 textBox->setLogicalHeight(boxRect.height());
150 } else { 148 } else {
151 // Skip generated content. 149 // Skip generated content.
152 if (!child->renderer()->node()) 150 if (!child->renderer()->node())
153 continue; 151 continue;
154 152
155 ASSERT_WITH_SECURITY_IMPLICATION(child->isInlineFlowBox()); 153 SVGInlineFlowBox* flowBox = toSVGInlineFlowBox(child);
156
157 SVGInlineFlowBox* flowBox = static_cast<SVGInlineFlowBox*>(child);
158 layoutChildBoxes(flowBox); 154 layoutChildBoxes(flowBox);
159 155
160 boxRect = flowBox->calculateBoundaries(); 156 boxRect = flowBox->calculateBoundaries();
161 flowBox->setX(boxRect.x()); 157 flowBox->setX(boxRect.x());
162 flowBox->setY(boxRect.y()); 158 flowBox->setY(boxRect.y());
163 flowBox->setLogicalWidth(boxRect.width()); 159 flowBox->setLogicalWidth(boxRect.width());
164 flowBox->setLogicalHeight(boxRect.height()); 160 flowBox->setLogicalHeight(boxRect.height());
165 } 161 }
166 if (childRect) 162 if (childRect)
167 childRect->unite(boxRect); 163 childRect->unite(boxRect);
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 } 299 }
304 } 300 }
305 301
306 void SVGRootInlineBox::reorderValueLists(Vector<SVGTextLayoutAttributes*>& attri butes) 302 void SVGRootInlineBox::reorderValueLists(Vector<SVGTextLayoutAttributes*>& attri butes)
307 { 303 {
308 Vector<InlineBox*> leafBoxesInLogicalOrder; 304 Vector<InlineBox*> leafBoxesInLogicalOrder;
309 collectLeafBoxesInLogicalOrder(leafBoxesInLogicalOrder, reverseInlineBoxRang eAndValueListsIfNeeded, &attributes); 305 collectLeafBoxesInLogicalOrder(leafBoxesInLogicalOrder, reverseInlineBoxRang eAndValueListsIfNeeded, &attributes);
310 } 306 }
311 307
312 } // namespace WebCore 308 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/svg/SVGInlineFlowBox.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698