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

Side by Side Diff: Source/core/svg/SVGTextContentElement.cpp

Issue 22798002: Make SVGTextContentElement methods behave consistently with Firefox and IE (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix nits Created 7 years, 4 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) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Rob Buis <buis@kde.org>
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 float SVGTextContentElement::getSubStringLength(unsigned charnum, unsigned nchar s, ExceptionState& es) 116 float SVGTextContentElement::getSubStringLength(unsigned charnum, unsigned nchar s, ExceptionState& es)
117 { 117 {
118 document()->updateLayoutIgnorePendingStylesheets(); 118 document()->updateLayoutIgnorePendingStylesheets();
119 119
120 unsigned numberOfChars = getNumberOfChars(); 120 unsigned numberOfChars = getNumberOfChars();
121 if (charnum >= numberOfChars) { 121 if (charnum >= numberOfChars) {
122 es.throwDOMException(IndexSizeError); 122 es.throwDOMException(IndexSizeError);
123 return 0.0f; 123 return 0.0f;
124 } 124 }
125 125
126 if (nchars > numberOfChars - charnum)
127 nchars = numberOfChars - charnum;
128
126 return SVGTextQuery(renderer()).subStringLength(charnum, nchars); 129 return SVGTextQuery(renderer()).subStringLength(charnum, nchars);
127 } 130 }
128 131
129 SVGPoint SVGTextContentElement::getStartPositionOfChar(unsigned charnum, Excepti onState& es) 132 SVGPoint SVGTextContentElement::getStartPositionOfChar(unsigned charnum, Excepti onState& es)
130 { 133 {
131 document()->updateLayoutIgnorePendingStylesheets(); 134 document()->updateLayoutIgnorePendingStylesheets();
132 135
133 if (charnum > getNumberOfChars()) { 136 if (charnum > getNumberOfChars()) {
134 es.throwDOMException(IndexSizeError); 137 es.throwDOMException(IndexSizeError);
135 return FloatPoint(); 138 return FloatPoint();
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 SVGElement* element = toSVGElement(renderer->node()); 302 SVGElement* element = toSVGElement(renderer->node());
300 ASSERT(element); 303 ASSERT(element);
301 304
302 if (!element->isTextContent()) 305 if (!element->isTextContent())
303 return 0; 306 return 0;
304 307
305 return toSVGTextContentElement(element); 308 return toSVGTextContentElement(element);
306 } 309 }
307 310
308 } 311 }
OLDNEW
« no previous file with comments | « LayoutTests/svg/text/svgtextcontentelement-methods-parameters-expected.txt ('k') | Source/core/svg/SVGTextContentElement.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698