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

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

Issue 977113003: Rename renderer() to layoutObject(). (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 9 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/svg/SVGStopElement.cpp ('k') | Source/core/svg/SVGTextPathElement.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) 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 DEFINE_TRACE(SVGTextContentElement) 85 DEFINE_TRACE(SVGTextContentElement)
86 { 86 {
87 visitor->trace(m_textLength); 87 visitor->trace(m_textLength);
88 visitor->trace(m_lengthAdjust); 88 visitor->trace(m_lengthAdjust);
89 SVGGraphicsElement::trace(visitor); 89 SVGGraphicsElement::trace(visitor);
90 } 90 }
91 91
92 unsigned SVGTextContentElement::getNumberOfChars() 92 unsigned SVGTextContentElement::getNumberOfChars()
93 { 93 {
94 document().updateLayoutIgnorePendingStylesheets(); 94 document().updateLayoutIgnorePendingStylesheets();
95 return SVGTextQuery(renderer()).numberOfCharacters(); 95 return SVGTextQuery(layoutObject()).numberOfCharacters();
96 } 96 }
97 97
98 float SVGTextContentElement::getComputedTextLength() 98 float SVGTextContentElement::getComputedTextLength()
99 { 99 {
100 document().updateLayoutIgnorePendingStylesheets(); 100 document().updateLayoutIgnorePendingStylesheets();
101 return SVGTextQuery(renderer()).textLength(); 101 return SVGTextQuery(layoutObject()).textLength();
102 } 102 }
103 103
104 float SVGTextContentElement::getSubStringLength(unsigned charnum, unsigned nchar s, ExceptionState& exceptionState) 104 float SVGTextContentElement::getSubStringLength(unsigned charnum, unsigned nchar s, ExceptionState& exceptionState)
105 { 105 {
106 document().updateLayoutIgnorePendingStylesheets(); 106 document().updateLayoutIgnorePendingStylesheets();
107 107
108 unsigned numberOfChars = getNumberOfChars(); 108 unsigned numberOfChars = getNumberOfChars();
109 if (charnum >= numberOfChars) { 109 if (charnum >= numberOfChars) {
110 exceptionState.throwDOMException(IndexSizeError, ExceptionMessages::inde xExceedsMaximumBound("charnum", charnum, getNumberOfChars())); 110 exceptionState.throwDOMException(IndexSizeError, ExceptionMessages::inde xExceedsMaximumBound("charnum", charnum, getNumberOfChars()));
111 return 0.0f; 111 return 0.0f;
112 } 112 }
113 113
114 if (nchars > numberOfChars - charnum) 114 if (nchars > numberOfChars - charnum)
115 nchars = numberOfChars - charnum; 115 nchars = numberOfChars - charnum;
116 116
117 return SVGTextQuery(renderer()).subStringLength(charnum, nchars); 117 return SVGTextQuery(layoutObject()).subStringLength(charnum, nchars);
118 } 118 }
119 119
120 PassRefPtrWillBeRawPtr<SVGPointTearOff> SVGTextContentElement::getStartPositionO fChar(unsigned charnum, ExceptionState& exceptionState) 120 PassRefPtrWillBeRawPtr<SVGPointTearOff> SVGTextContentElement::getStartPositionO fChar(unsigned charnum, ExceptionState& exceptionState)
121 { 121 {
122 document().updateLayoutIgnorePendingStylesheets(); 122 document().updateLayoutIgnorePendingStylesheets();
123 123
124 if (charnum > getNumberOfChars()) { 124 if (charnum > getNumberOfChars()) {
125 exceptionState.throwDOMException(IndexSizeError, ExceptionMessages::inde xExceedsMaximumBound("charnum", charnum, getNumberOfChars())); 125 exceptionState.throwDOMException(IndexSizeError, ExceptionMessages::inde xExceedsMaximumBound("charnum", charnum, getNumberOfChars()));
126 return nullptr; 126 return nullptr;
127 } 127 }
128 128
129 FloatPoint point = SVGTextQuery(renderer()).startPositionOfCharacter(charnum ); 129 FloatPoint point = SVGTextQuery(layoutObject()).startPositionOfCharacter(cha rnum);
130 return SVGPointTearOff::create(SVGPoint::create(point), 0, PropertyIsNotAnim Val); 130 return SVGPointTearOff::create(SVGPoint::create(point), 0, PropertyIsNotAnim Val);
131 } 131 }
132 132
133 PassRefPtrWillBeRawPtr<SVGPointTearOff> SVGTextContentElement::getEndPositionOfC har(unsigned charnum, ExceptionState& exceptionState) 133 PassRefPtrWillBeRawPtr<SVGPointTearOff> SVGTextContentElement::getEndPositionOfC har(unsigned charnum, ExceptionState& exceptionState)
134 { 134 {
135 document().updateLayoutIgnorePendingStylesheets(); 135 document().updateLayoutIgnorePendingStylesheets();
136 136
137 if (charnum > getNumberOfChars()) { 137 if (charnum > getNumberOfChars()) {
138 exceptionState.throwDOMException(IndexSizeError, ExceptionMessages::inde xExceedsMaximumBound("charnum", charnum, getNumberOfChars())); 138 exceptionState.throwDOMException(IndexSizeError, ExceptionMessages::inde xExceedsMaximumBound("charnum", charnum, getNumberOfChars()));
139 return nullptr; 139 return nullptr;
140 } 140 }
141 141
142 FloatPoint point = SVGTextQuery(renderer()).endPositionOfCharacter(charnum); 142 FloatPoint point = SVGTextQuery(layoutObject()).endPositionOfCharacter(charn um);
143 return SVGPointTearOff::create(SVGPoint::create(point), 0, PropertyIsNotAnim Val); 143 return SVGPointTearOff::create(SVGPoint::create(point), 0, PropertyIsNotAnim Val);
144 } 144 }
145 145
146 PassRefPtrWillBeRawPtr<SVGRectTearOff> SVGTextContentElement::getExtentOfChar(un signed charnum, ExceptionState& exceptionState) 146 PassRefPtrWillBeRawPtr<SVGRectTearOff> SVGTextContentElement::getExtentOfChar(un signed charnum, ExceptionState& exceptionState)
147 { 147 {
148 document().updateLayoutIgnorePendingStylesheets(); 148 document().updateLayoutIgnorePendingStylesheets();
149 149
150 if (charnum > getNumberOfChars()) { 150 if (charnum > getNumberOfChars()) {
151 exceptionState.throwDOMException(IndexSizeError, ExceptionMessages::inde xExceedsMaximumBound("charnum", charnum, getNumberOfChars())); 151 exceptionState.throwDOMException(IndexSizeError, ExceptionMessages::inde xExceedsMaximumBound("charnum", charnum, getNumberOfChars()));
152 return nullptr; 152 return nullptr;
153 } 153 }
154 154
155 FloatRect rect = SVGTextQuery(renderer()).extentOfCharacter(charnum); 155 FloatRect rect = SVGTextQuery(layoutObject()).extentOfCharacter(charnum);
156 return SVGRectTearOff::create(SVGRect::create(rect), 0, PropertyIsNotAnimVal ); 156 return SVGRectTearOff::create(SVGRect::create(rect), 0, PropertyIsNotAnimVal );
157 } 157 }
158 158
159 float SVGTextContentElement::getRotationOfChar(unsigned charnum, ExceptionState& exceptionState) 159 float SVGTextContentElement::getRotationOfChar(unsigned charnum, ExceptionState& exceptionState)
160 { 160 {
161 document().updateLayoutIgnorePendingStylesheets(); 161 document().updateLayoutIgnorePendingStylesheets();
162 162
163 if (charnum > getNumberOfChars()) { 163 if (charnum > getNumberOfChars()) {
164 exceptionState.throwDOMException(IndexSizeError, ExceptionMessages::inde xExceedsMaximumBound("charnum", charnum, getNumberOfChars())); 164 exceptionState.throwDOMException(IndexSizeError, ExceptionMessages::inde xExceedsMaximumBound("charnum", charnum, getNumberOfChars()));
165 return 0.0f; 165 return 0.0f;
166 } 166 }
167 167
168 return SVGTextQuery(renderer()).rotationOfCharacter(charnum); 168 return SVGTextQuery(layoutObject()).rotationOfCharacter(charnum);
169 } 169 }
170 170
171 int SVGTextContentElement::getCharNumAtPosition(PassRefPtrWillBeRawPtr<SVGPointT earOff> point, ExceptionState& exceptionState) 171 int SVGTextContentElement::getCharNumAtPosition(PassRefPtrWillBeRawPtr<SVGPointT earOff> point, ExceptionState& exceptionState)
172 { 172 {
173 document().updateLayoutIgnorePendingStylesheets(); 173 document().updateLayoutIgnorePendingStylesheets();
174 return SVGTextQuery(renderer()).characterNumberAtPosition(point->target()->v alue()); 174 return SVGTextQuery(layoutObject()).characterNumberAtPosition(point->target( )->value());
175 } 175 }
176 176
177 void SVGTextContentElement::selectSubString(unsigned charnum, unsigned nchars, E xceptionState& exceptionState) 177 void SVGTextContentElement::selectSubString(unsigned charnum, unsigned nchars, E xceptionState& exceptionState)
178 { 178 {
179 unsigned numberOfChars = getNumberOfChars(); 179 unsigned numberOfChars = getNumberOfChars();
180 if (charnum >= numberOfChars) { 180 if (charnum >= numberOfChars) {
181 exceptionState.throwDOMException(IndexSizeError, ExceptionMessages::inde xExceedsMaximumBound("charnum", charnum, getNumberOfChars())); 181 exceptionState.throwDOMException(IndexSizeError, ExceptionMessages::inde xExceedsMaximumBound("charnum", charnum, getNumberOfChars()));
182 return; 182 return;
183 } 183 }
184 184
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 if (!isSupportedAttribute(attrName)) { 245 if (!isSupportedAttribute(attrName)) {
246 SVGGraphicsElement::svgAttributeChanged(attrName); 246 SVGGraphicsElement::svgAttributeChanged(attrName);
247 return; 247 return;
248 } 248 }
249 249
250 if (attrName == SVGNames::textLengthAttr) 250 if (attrName == SVGNames::textLengthAttr)
251 m_textLengthIsSpecifiedByUser = true; 251 m_textLengthIsSpecifiedByUser = true;
252 252
253 SVGElement::InvalidationGuard invalidationGuard(this); 253 SVGElement::InvalidationGuard invalidationGuard(this);
254 254
255 if (LayoutObject* renderer = this->renderer()) 255 if (LayoutObject* renderer = this->layoutObject())
256 markForLayoutAndParentResourceInvalidation(renderer); 256 markForLayoutAndParentResourceInvalidation(renderer);
257 } 257 }
258 258
259 bool SVGTextContentElement::selfHasRelativeLengths() const 259 bool SVGTextContentElement::selfHasRelativeLengths() const
260 { 260 {
261 // Any element of the <text> subtree is advertized as using relative lengths . 261 // Any element of the <text> subtree is advertized as using relative lengths .
262 // On any window size change, we have to relayout the text subtree, as the 262 // On any window size change, we have to relayout the text subtree, as the
263 // effective 'on-screen' font size may change. 263 // effective 'on-screen' font size may change.
264 return true; 264 return true;
265 } 265 }
266 266
267 SVGTextContentElement* SVGTextContentElement::elementFromRenderer(LayoutObject* renderer) 267 SVGTextContentElement* SVGTextContentElement::elementFromRenderer(LayoutObject* renderer)
268 { 268 {
269 if (!renderer) 269 if (!renderer)
270 return 0; 270 return 0;
271 271
272 if (!renderer->isSVGText() && !renderer->isSVGInline()) 272 if (!renderer->isSVGText() && !renderer->isSVGInline())
273 return 0; 273 return 0;
274 274
275 SVGElement* element = toSVGElement(renderer->node()); 275 SVGElement* element = toSVGElement(renderer->node());
276 ASSERT(element); 276 ASSERT(element);
277 return isSVGTextContentElement(*element) ? toSVGTextContentElement(element) : 0; 277 return isSVGTextContentElement(*element) ? toSVGTextContentElement(element) : 0;
278 } 278 }
279 279
280 } 280 }
OLDNEW
« no previous file with comments | « Source/core/svg/SVGStopElement.cpp ('k') | Source/core/svg/SVGTextPathElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698