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

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

Issue 2912663002: Clean up creation of "detached" SVG* data type objects (Closed)
Patch Set: Created 3 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
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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 131
132 if (charnum >= getNumberOfChars()) { 132 if (charnum >= getNumberOfChars()) {
133 exception_state.ThrowDOMException( 133 exception_state.ThrowDOMException(
134 kIndexSizeError, ExceptionMessages::IndexExceedsMaximumBound( 134 kIndexSizeError, ExceptionMessages::IndexExceedsMaximumBound(
135 "charnum", charnum, getNumberOfChars())); 135 "charnum", charnum, getNumberOfChars()));
136 return nullptr; 136 return nullptr;
137 } 137 }
138 138
139 FloatPoint point = 139 FloatPoint point =
140 SVGTextQuery(GetLayoutObject()).StartPositionOfCharacter(charnum); 140 SVGTextQuery(GetLayoutObject()).StartPositionOfCharacter(charnum);
141 return SVGPointTearOff::Create(SVGPoint::Create(point), 0, 141 return SVGPointTearOff::CreateDetached(point);
142 kPropertyIsNotAnimVal);
143 } 142 }
144 143
145 SVGPointTearOff* SVGTextContentElement::getEndPositionOfChar( 144 SVGPointTearOff* SVGTextContentElement::getEndPositionOfChar(
146 unsigned charnum, 145 unsigned charnum,
147 ExceptionState& exception_state) { 146 ExceptionState& exception_state) {
148 GetDocument().UpdateStyleAndLayoutIgnorePendingStylesheets(); 147 GetDocument().UpdateStyleAndLayoutIgnorePendingStylesheets();
149 148
150 if (charnum >= getNumberOfChars()) { 149 if (charnum >= getNumberOfChars()) {
151 exception_state.ThrowDOMException( 150 exception_state.ThrowDOMException(
152 kIndexSizeError, ExceptionMessages::IndexExceedsMaximumBound( 151 kIndexSizeError, ExceptionMessages::IndexExceedsMaximumBound(
153 "charnum", charnum, getNumberOfChars())); 152 "charnum", charnum, getNumberOfChars()));
154 return nullptr; 153 return nullptr;
155 } 154 }
156 155
157 FloatPoint point = 156 FloatPoint point =
158 SVGTextQuery(GetLayoutObject()).EndPositionOfCharacter(charnum); 157 SVGTextQuery(GetLayoutObject()).EndPositionOfCharacter(charnum);
159 return SVGPointTearOff::Create(SVGPoint::Create(point), 0, 158 return SVGPointTearOff::CreateDetached(point);
160 kPropertyIsNotAnimVal);
161 } 159 }
162 160
163 SVGRectTearOff* SVGTextContentElement::getExtentOfChar( 161 SVGRectTearOff* SVGTextContentElement::getExtentOfChar(
164 unsigned charnum, 162 unsigned charnum,
165 ExceptionState& exception_state) { 163 ExceptionState& exception_state) {
166 GetDocument().UpdateStyleAndLayoutIgnorePendingStylesheets(); 164 GetDocument().UpdateStyleAndLayoutIgnorePendingStylesheets();
167 165
168 if (charnum >= getNumberOfChars()) { 166 if (charnum >= getNumberOfChars()) {
169 exception_state.ThrowDOMException( 167 exception_state.ThrowDOMException(
170 kIndexSizeError, ExceptionMessages::IndexExceedsMaximumBound( 168 kIndexSizeError, ExceptionMessages::IndexExceedsMaximumBound(
171 "charnum", charnum, getNumberOfChars())); 169 "charnum", charnum, getNumberOfChars()));
172 return nullptr; 170 return nullptr;
173 } 171 }
174 172
175 FloatRect rect = SVGTextQuery(GetLayoutObject()).ExtentOfCharacter(charnum); 173 FloatRect rect = SVGTextQuery(GetLayoutObject()).ExtentOfCharacter(charnum);
176 return SVGRectTearOff::Create(SVGRect::Create(rect), 0, 174 return SVGRectTearOff::CreateDetached(rect);
177 kPropertyIsNotAnimVal);
178 } 175 }
179 176
180 float SVGTextContentElement::getRotationOfChar( 177 float SVGTextContentElement::getRotationOfChar(
181 unsigned charnum, 178 unsigned charnum,
182 ExceptionState& exception_state) { 179 ExceptionState& exception_state) {
183 GetDocument().UpdateStyleAndLayoutIgnorePendingStylesheets(); 180 GetDocument().UpdateStyleAndLayoutIgnorePendingStylesheets();
184 181
185 if (charnum >= getNumberOfChars()) { 182 if (charnum >= getNumberOfChars()) {
186 exception_state.ThrowDOMException( 183 exception_state.ThrowDOMException(
187 kIndexSizeError, ExceptionMessages::IndexExceedsMaximumBound( 184 kIndexSizeError, ExceptionMessages::IndexExceedsMaximumBound(
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 (!line_layout_item.IsSVGText() && !line_layout_item.IsSVGInline())) 296 (!line_layout_item.IsSVGText() && !line_layout_item.IsSVGInline()))
300 return nullptr; 297 return nullptr;
301 298
302 SVGElement* element = ToSVGElement(line_layout_item.GetNode()); 299 SVGElement* element = ToSVGElement(line_layout_item.GetNode());
303 DCHECK(element); 300 DCHECK(element);
304 return IsSVGTextContentElement(*element) ? ToSVGTextContentElement(element) 301 return IsSVGTextContentElement(*element) ? ToSVGTextContentElement(element)
305 : 0; 302 : 0;
306 } 303 }
307 304
308 } // namespace blink 305 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698