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

Side by Side Diff: Source/core/layout/svg/SVGTextLayoutEngine.cpp

Issue 1150383003: Don't iterate past the end of the metrics list (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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/LayoutSVGInlineText.h ('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) Research In Motion Limited 2010-2012. All rights reserved. 2 * Copyright (C) Research In Motion Limited 2010-2012. All rights reserved.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 350
351 bool didStartTextFragment = false; 351 bool didStartTextFragment = false;
352 bool applySpacingToNextCharacter = false; 352 bool applySpacingToNextCharacter = false;
353 353
354 float lastAngle = 0; 354 float lastAngle = 0;
355 float baselineShift = baselineLayout.calculateBaselineShift(style); 355 float baselineShift = baselineLayout.calculateBaselineShift(style);
356 baselineShift -= baselineLayout.calculateAlignmentBaselineShift(m_isVertical Text, &text); 356 baselineShift -= baselineLayout.calculateAlignmentBaselineShift(m_isVertical Text, &text);
357 357
358 // Main layout algorithm. 358 // Main layout algorithm.
359 const unsigned boxEndOffset = textBox->start() + textBox->len(); 359 const unsigned boxEndOffset = textBox->start() + textBox->len();
360 while (m_visualMetricsIterator.characterOffset() < boxEndOffset) { 360 while (!m_visualMetricsIterator.isAtEnd() && m_visualMetricsIterator.charact erOffset() < boxEndOffset) {
361 const SVGTextMetrics& visualMetrics = m_visualMetricsIterator.metrics(); 361 const SVGTextMetrics& visualMetrics = m_visualMetricsIterator.metrics();
362 if (visualMetrics.isEmpty()) { 362 if (visualMetrics.isEmpty()) {
363 m_visualMetricsIterator.next(); 363 m_visualMetricsIterator.next();
364 continue; 364 continue;
365 } 365 }
366 366
367 SVGTextLayoutAttributes* logicalAttributes = 0; 367 SVGTextLayoutAttributes* logicalAttributes = 0;
368 if (!currentLogicalCharacterAttributes(logicalAttributes)) 368 if (!currentLogicalCharacterAttributes(logicalAttributes))
369 break; 369 break;
370 370
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 } 536 }
537 537
538 if (!didStartTextFragment) 538 if (!didStartTextFragment)
539 return; 539 return;
540 540
541 // Close last open fragment, if needed. 541 // Close last open fragment, if needed.
542 recordTextFragment(textBox); 542 recordTextFragment(textBox);
543 } 543 }
544 544
545 } 545 }
OLDNEW
« no previous file with comments | « Source/core/layout/svg/LayoutSVGInlineText.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698