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

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

Issue 23819007: Have Node::document() return a reference instead of a pointer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on master Created 7 years, 3 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/SVGMPathElement.cpp ('k') | Source/core/svg/SVGPatternElement.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, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2006, 2007 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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 223
224 void SVGPathElement::parseAttribute(const QualifiedName& name, const AtomicStrin g& value) 224 void SVGPathElement::parseAttribute(const QualifiedName& name, const AtomicStrin g& value)
225 { 225 {
226 if (!isSupportedAttribute(name)) { 226 if (!isSupportedAttribute(name)) {
227 SVGGraphicsElement::parseAttribute(name, value); 227 SVGGraphicsElement::parseAttribute(name, value);
228 return; 228 return;
229 } 229 }
230 230
231 if (name == SVGNames::dAttr) { 231 if (name == SVGNames::dAttr) {
232 if (!buildSVGPathByteStreamFromString(value, m_pathByteStream.get(), Una lteredParsing)) 232 if (!buildSVGPathByteStreamFromString(value, m_pathByteStream.get(), Una lteredParsing))
233 document()->accessSVGExtensions()->reportError("Problem parsing d=\" " + value + "\""); 233 document().accessSVGExtensions()->reportError("Problem parsing d=\"" + value + "\"");
234 return; 234 return;
235 } 235 }
236 236
237 if (name == SVGNames::pathLengthAttr) { 237 if (name == SVGNames::pathLengthAttr) {
238 setPathLengthBaseValue(value.toFloat()); 238 setPathLengthBaseValue(value.toFloat());
239 if (pathLengthBaseValue() < 0) 239 if (pathLengthBaseValue() < 0)
240 document()->accessSVGExtensions()->reportError("A negative value for path attribute <pathLength> is not allowed"); 240 document().accessSVGExtensions()->reportError("A negative value for path attribute <pathLength> is not allowed");
241 return; 241 return;
242 } 242 }
243 243
244 if (SVGExternalResourcesRequired::parseAttribute(name, value)) 244 if (SVGExternalResourcesRequired::parseAttribute(name, value))
245 return; 245 return;
246 246
247 ASSERT_NOT_REACHED(); 247 ASSERT_NOT_REACHED();
248 } 248 }
249 249
250 void SVGPathElement::svgAttributeChanged(const QualifiedName& attrName) 250 void SVGPathElement::svgAttributeChanged(const QualifiedName& attrName)
(...skipping 21 matching lines...) Expand all
272 } 272 }
273 273
274 if (renderer) 274 if (renderer)
275 RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer); 275 RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer);
276 } 276 }
277 277
278 void SVGPathElement::invalidateMPathDependencies() 278 void SVGPathElement::invalidateMPathDependencies()
279 { 279 {
280 // <mpath> can only reference <path> but this dependency is not handled in 280 // <mpath> can only reference <path> but this dependency is not handled in
281 // markForLayoutAndParentResourceInvalidation so we update any mpath depende ncies manually. 281 // markForLayoutAndParentResourceInvalidation so we update any mpath depende ncies manually.
282 ASSERT(document()); 282 if (HashSet<SVGElement*>* dependencies = document().accessSVGExtensions()->s etOfElementsReferencingTarget(this)) {
283 if (HashSet<SVGElement*>* dependencies = document()->accessSVGExtensions()-> setOfElementsReferencingTarget(this)) {
284 HashSet<SVGElement*>::iterator end = dependencies->end(); 283 HashSet<SVGElement*>::iterator end = dependencies->end();
285 for (HashSet<SVGElement*>::iterator it = dependencies->begin(); it != en d; ++it) { 284 for (HashSet<SVGElement*>::iterator it = dependencies->begin(); it != en d; ++it) {
286 if ((*it)->hasTagName(SVGNames::mpathTag)) 285 if ((*it)->hasTagName(SVGNames::mpathTag))
287 toSVGMPathElement(*it)->targetPathChanged(); 286 toSVGMPathElement(*it)->targetPathChanged();
288 } 287 }
289 } 288 }
290 } 289 }
291 290
292 Node::InsertionNotificationRequest SVGPathElement::insertedInto(ContainerNode* r ootParent) 291 Node::InsertionNotificationRequest SVGPathElement::insertedInto(ContainerNode* r ootParent)
293 { 292 {
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 if (!renderer) 381 if (!renderer)
383 return; 382 return;
384 383
385 renderer->setNeedsShapeUpdate(); 384 renderer->setNeedsShapeUpdate();
386 RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer); 385 RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer);
387 } 386 }
388 387
389 FloatRect SVGPathElement::getBBox(StyleUpdateStrategy styleUpdateStrategy) 388 FloatRect SVGPathElement::getBBox(StyleUpdateStrategy styleUpdateStrategy)
390 { 389 {
391 if (styleUpdateStrategy == AllowStyleUpdate) 390 if (styleUpdateStrategy == AllowStyleUpdate)
392 this->document()->updateLayoutIgnorePendingStylesheets(); 391 this->document().updateLayoutIgnorePendingStylesheets();
393 392
394 RenderSVGPath* renderer = toRenderSVGPath(this->renderer()); 393 RenderSVGPath* renderer = toRenderSVGPath(this->renderer());
395 394
396 // FIXME: Eventually we should support getBBox for detached elements. 395 // FIXME: Eventually we should support getBBox for detached elements.
397 if (!renderer) 396 if (!renderer)
398 return FloatRect(); 397 return FloatRect();
399 398
400 return renderer->path().boundingRect(); 399 return renderer->path().boundingRect();
401 } 400 }
402 401
403 RenderObject* SVGPathElement::createRenderer(RenderStyle*) 402 RenderObject* SVGPathElement::createRenderer(RenderStyle*)
404 { 403 {
405 // By default, any subclass is expected to do path-based drawing 404 // By default, any subclass is expected to do path-based drawing
406 return new RenderSVGPath(this); 405 return new RenderSVGPath(this);
407 } 406 }
408 407
409 } 408 }
OLDNEW
« no previous file with comments | « Source/core/svg/SVGMPathElement.cpp ('k') | Source/core/svg/SVGPatternElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698