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

Side by Side Diff: third_party/WebKit/Source/core/layout/svg/line/SVGInlineTextBox.cpp

Issue 2391693004: Reformat comments in core/layout/svg/line (Closed)
Patch Set: Rebase w/HEAD Created 4 years, 2 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 | « no previous file | third_party/WebKit/Source/core/layout/svg/line/SVGRootInlineBox.cpp » ('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) 2007 Rob Buis <buis@kde.org> 2 * Copyright (C) 2007 Rob Buis <buis@kde.org>
3 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> 3 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org>
4 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 4 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
11 * This library is distributed in the hope that it will be useful, 11 * This library is distributed in the hope that it will be useful,
(...skipping 28 matching lines...) Expand all
40 "SVGInlineTextBox has an unexpected size"); 40 "SVGInlineTextBox has an unexpected size");
41 41
42 SVGInlineTextBox::SVGInlineTextBox(LineLayoutItem item, 42 SVGInlineTextBox::SVGInlineTextBox(LineLayoutItem item,
43 int start, 43 int start,
44 unsigned short length) 44 unsigned short length)
45 : InlineTextBox(item, start, length), m_startsNewTextChunk(false) {} 45 : InlineTextBox(item, start, length), m_startsNewTextChunk(false) {}
46 46
47 void SVGInlineTextBox::dirtyLineBoxes() { 47 void SVGInlineTextBox::dirtyLineBoxes() {
48 InlineTextBox::dirtyLineBoxes(); 48 InlineTextBox::dirtyLineBoxes();
49 49
50 // Clear the now stale text fragments 50 // Clear the now stale text fragments.
51 clearTextFragments(); 51 clearTextFragments();
52 52
53 // And clear any following text fragments as the text on which they 53 // And clear any following text fragments as the text on which they depend may
54 // depend may now no longer exist, or glyph positions may be wrong 54 // now no longer exist, or glyph positions may be wrong.
55 InlineTextBox* nextBox = nextTextBox(); 55 InlineTextBox* nextBox = nextTextBox();
56 if (nextBox) 56 if (nextBox)
57 nextBox->dirtyLineBoxes(); 57 nextBox->dirtyLineBoxes();
58 } 58 }
59 59
60 int SVGInlineTextBox::offsetForPosition(LayoutUnit, bool) const { 60 int SVGInlineTextBox::offsetForPosition(LayoutUnit, bool) const {
61 // SVG doesn't use the standard offset <-> position selection system, as it's not suitable for SVGs complex needs. 61 // SVG doesn't use the standard offset <-> position selection system, as it's
62 // vertical text selection, inline boxes spanning multiple lines (contrary to HTML, etc.) 62 // not suitable for SVGs complex needs. Vertical text selection, inline boxes
63 // spanning multiple lines (contrary to HTML, etc.)
63 ASSERT_NOT_REACHED(); 64 ASSERT_NOT_REACHED();
64 return 0; 65 return 0;
65 } 66 }
66 67
67 int SVGInlineTextBox::offsetForPositionInFragment( 68 int SVGInlineTextBox::offsetForPositionInFragment(
68 const SVGTextFragment& fragment, 69 const SVGTextFragment& fragment,
69 LayoutUnit position, 70 LayoutUnit position,
70 bool includePartialGlyphs) const { 71 bool includePartialGlyphs) const {
71 LineLayoutSVGInlineText lineLayoutItem = 72 LineLayoutSVGInlineText lineLayoutItem =
72 LineLayoutSVGInlineText(this->getLineLayoutItem()); 73 LineLayoutSVGInlineText(this->getLineLayoutItem());
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 run.setText(text.characters8() + fragment.characterOffset, 192 run.setText(text.characters8() + fragment.characterOffset,
192 fragment.length); 193 fragment.length);
193 else 194 else
194 run.setText(text.characters16() + fragment.characterOffset, 195 run.setText(text.characters16() + fragment.characterOffset,
195 fragment.length); 196 fragment.length);
196 } 197 }
197 198
198 // We handle letter & word spacing ourselves. 199 // We handle letter & word spacing ourselves.
199 run.disableSpacing(); 200 run.disableSpacing();
200 201
201 // Propagate the maximum length of the characters buffer to the TextRun, even when we're only processing a substring. 202 // Propagate the maximum length of the characters buffer to the TextRun, even
203 // when we're only processing a substring.
202 run.setCharactersLength(text.textLength() - fragment.characterOffset); 204 run.setCharactersLength(text.textLength() - fragment.characterOffset);
203 ASSERT(run.charactersLength() >= run.length()); 205 ASSERT(run.charactersLength() >= run.length());
204 return run; 206 return run;
205 } 207 }
206 208
207 bool SVGInlineTextBox::mapStartEndPositionsIntoFragmentCoordinates( 209 bool SVGInlineTextBox::mapStartEndPositionsIntoFragmentCoordinates(
208 const SVGTextFragment& fragment, 210 const SVGTextFragment& fragment,
209 int& startPosition, 211 int& startPosition,
210 int& endPosition) const { 212 int& endPosition) const {
211 int fragmentOffsetInBox = 213 int fragmentOffsetInBox =
212 static_cast<int>(fragment.characterOffset) - start(); 214 static_cast<int>(fragment.characterOffset) - start();
213 215
214 // Compute positions relative to the fragment. 216 // Compute positions relative to the fragment.
215 startPosition -= fragmentOffsetInBox; 217 startPosition -= fragmentOffsetInBox;
216 endPosition -= fragmentOffsetInBox; 218 endPosition -= fragmentOffsetInBox;
217 219
218 // Intersect with the fragment range. 220 // Intersect with the fragment range.
219 startPosition = std::max(startPosition, 0); 221 startPosition = std::max(startPosition, 0);
220 endPosition = std::min(endPosition, static_cast<int>(fragment.length)); 222 endPosition = std::min(endPosition, static_cast<int>(fragment.length));
221 223
222 return startPosition < endPosition; 224 return startPosition < endPosition;
223 } 225 }
224 226
225 void SVGInlineTextBox::paintDocumentMarker(GraphicsContext&, 227 void SVGInlineTextBox::paintDocumentMarker(GraphicsContext&,
226 const LayoutPoint&, 228 const LayoutPoint&,
227 DocumentMarker*, 229 DocumentMarker*,
228 const ComputedStyle&, 230 const ComputedStyle&,
229 const Font&, 231 const Font&,
230 bool) const { 232 bool) const {
231 // SVG does not have support for generic document markers (e.g., spellchecking , etc). 233 // SVG does not have support for generic document markers (e.g.,
234 // spellchecking, etc).
232 } 235 }
233 236
234 void SVGInlineTextBox::paintTextMatchMarkerForeground( 237 void SVGInlineTextBox::paintTextMatchMarkerForeground(
235 const PaintInfo& paintInfo, 238 const PaintInfo& paintInfo,
236 const LayoutPoint& point, 239 const LayoutPoint& point,
237 DocumentMarker* marker, 240 DocumentMarker* marker,
238 const ComputedStyle& style, 241 const ComputedStyle& style,
239 const Font& font) const { 242 const Font& font) const {
240 SVGInlineTextBoxPainter(*this).paintTextMatchMarkerForeground( 243 SVGInlineTextBoxPainter(*this).paintTextMatchMarkerForeground(
241 paintInfo, point, marker, style, font); 244 paintInfo, point, marker, style, font);
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 return true; 314 return true;
312 } 315 }
313 } 316 }
314 } 317 }
315 } 318 }
316 } 319 }
317 return false; 320 return false;
318 } 321 }
319 322
320 } // namespace blink 323 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/svg/line/SVGRootInlineBox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698