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

Side by Side Diff: Source/core/layout/svg/LayoutSVGInlineText.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
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) 2008 Rob Buis <buis@kde.org> 5 * Copyright (C) 2008 Rob Buis <buis@kde.org>
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2010. 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 return LayoutRect(); 114 return LayoutRect();
115 115
116 InlineTextBox* textBox = toInlineTextBox(box); 116 InlineTextBox* textBox = toInlineTextBox(box);
117 if (static_cast<unsigned>(caretOffset) < textBox->start() || static_cast<uns igned>(caretOffset) > textBox->start() + textBox->len()) 117 if (static_cast<unsigned>(caretOffset) < textBox->start() || static_cast<uns igned>(caretOffset) > textBox->start() + textBox->len())
118 return LayoutRect(); 118 return LayoutRect();
119 119
120 // Use the edge of the selection rect to determine the caret rect. 120 // Use the edge of the selection rect to determine the caret rect.
121 if (static_cast<unsigned>(caretOffset) < textBox->start() + textBox->len()) { 121 if (static_cast<unsigned>(caretOffset) < textBox->start() + textBox->len()) {
122 LayoutRect rect = textBox->localSelectionRect(caretOffset, caretOffset + 1); 122 LayoutRect rect = textBox->localSelectionRect(caretOffset, caretOffset + 1);
123 LayoutUnit x = box->isLeftToRightDirection() ? rect.x() : rect.maxX(); 123 LayoutUnit x = box->isLeftToRightDirection() ? rect.x() : rect.maxX();
124 return LayoutRect(x, rect.y(), caretWidth, rect.height()); 124 return LayoutRect(x, rect.y(), caretWidth(), rect.height());
125 } 125 }
126 126
127 LayoutRect rect = textBox->localSelectionRect(caretOffset - 1, caretOffset); 127 LayoutRect rect = textBox->localSelectionRect(caretOffset - 1, caretOffset);
128 LayoutUnit x = box->isLeftToRightDirection() ? rect.maxX() : rect.x(); 128 LayoutUnit x = box->isLeftToRightDirection() ? rect.maxX() : rect.x();
129 return LayoutRect(x, rect.y(), caretWidth, rect.height()); 129 return LayoutRect(x, rect.y(), caretWidth(), rect.height());
130 } 130 }
131 131
132 FloatRect LayoutSVGInlineText::floatLinesBoundingBox() const 132 FloatRect LayoutSVGInlineText::floatLinesBoundingBox() const
133 { 133 {
134 FloatRect boundingBox; 134 FloatRect boundingBox;
135 for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) 135 for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox())
136 boundingBox.unite(box->calculateBoundaries().toFloatRect()); 136 boundingBox.unite(FloatRect(box->calculateBoundaries()));
137 return boundingBox; 137 return boundingBox;
138 } 138 }
139 139
140 IntRect LayoutSVGInlineText::linesBoundingBox() const 140 IntRect LayoutSVGInlineText::linesBoundingBox() const
141 { 141 {
142 return enclosingIntRect(floatLinesBoundingBox()); 142 return enclosingIntRect(floatLinesBoundingBox());
143 } 143 }
144 144
145 bool LayoutSVGInlineText::characterStartsNewTextChunk(int position) const 145 bool LayoutSVGInlineText::characterStartsNewTextChunk(int position) const
146 { 146 {
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 255
256 PassRefPtr<StringImpl> LayoutSVGInlineText::originalText() const 256 PassRefPtr<StringImpl> LayoutSVGInlineText::originalText() const
257 { 257 {
258 RefPtr<StringImpl> result = LayoutText::originalText(); 258 RefPtr<StringImpl> result = LayoutText::originalText();
259 if (!result) 259 if (!result)
260 return nullptr; 260 return nullptr;
261 return applySVGWhitespaceRules(result, style() && style()->whiteSpace() == P RE); 261 return applySVGWhitespaceRules(result, style() && style()->whiteSpace() == P RE);
262 } 262 }
263 263
264 } 264 }
OLDNEW
« no previous file with comments | « Source/core/layout/svg/LayoutSVGInline.cpp ('k') | Source/core/layout/svg/SVGLayoutTreeAsText.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698