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

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

Issue 1127773003: This CL clean up patch in SVGElements. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 7 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
« no previous file with comments | « Source/core/svg/SVGElement.h ('k') | Source/core/svg/SVGElementRareData.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, 2007, 2008 Nikolas Zimmermann <zimmermann@kde .org> 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde .org>
3 * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
4 * Copyright (C) 2008 Apple Inc. All rights reserved. 4 * Copyright (C) 2008 Apple Inc. All rights reserved.
5 * Copyright (C) 2008 Alp Toker <alp@atoker.com> 5 * Copyright (C) 2008 Alp Toker <alp@atoker.com>
6 * Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> 6 * Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au>
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 SVGSVGElement* SVGElement::ownerSVGElement() const 435 SVGSVGElement* SVGElement::ownerSVGElement() const
436 { 436 {
437 ContainerNode* n = parentOrShadowHostNode(); 437 ContainerNode* n = parentOrShadowHostNode();
438 while (n) { 438 while (n) {
439 if (isSVGSVGElement(*n)) 439 if (isSVGSVGElement(*n))
440 return toSVGSVGElement(n); 440 return toSVGSVGElement(n);
441 441
442 n = n->parentOrShadowHostNode(); 442 n = n->parentOrShadowHostNode();
443 } 443 }
444 444
445 return 0; 445 return nullptr;
446 } 446 }
447 447
448 SVGElement* SVGElement::viewportElement() const 448 SVGElement* SVGElement::viewportElement() const
449 { 449 {
450 // This function needs shadow tree support - as LayoutSVGContainer uses this function 450 // This function needs shadow tree support - as LayoutSVGContainer uses this function
451 // to determine the "overflow" property. <use> on <symbol> wouldn't work oth erwhise. 451 // to determine the "overflow" property. <use> on <symbol> wouldn't work oth erwhise.
452 ContainerNode* n = parentOrShadowHostNode(); 452 ContainerNode* n = parentOrShadowHostNode();
453 while (n) { 453 while (n) {
454 if (isSVGSVGElement(*n) || isSVGImageElement(*n) || isSVGSymbolElement(* n)) 454 if (isSVGSVGElement(*n) || isSVGImageElement(*n) || isSVGSymbolElement(* n))
455 return toSVGElement(n); 455 return toSVGElement(n);
456 456
457 n = n->parentOrShadowHostNode(); 457 n = n->parentOrShadowHostNode();
458 } 458 }
459 459
460 return 0; 460 return nullptr;
461 } 461 }
462 462
463 SVGDocumentExtensions& SVGElement::accessDocumentSVGExtensions() 463 SVGDocumentExtensions& SVGElement::accessDocumentSVGExtensions()
464 { 464 {
465 // This function is provided for use by SVGAnimatedProperty to avoid 465 // This function is provided for use by SVGAnimatedProperty to avoid
466 // global inclusion of core/dom/Document.h in SVG code. 466 // global inclusion of core/dom/Document.h in SVG code.
467 return document().accessSVGExtensions(); 467 return document().accessSVGExtensions();
468 } 468 }
469 469
470 void SVGElement::mapInstanceToElement(SVGElement* instance) 470 void SVGElement::mapInstanceToElement(SVGElement* instance)
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 ASSERT(!hasSVGRareData() || !svgRareData()->correspondingElement() || contai ningShadowRoot()); 556 ASSERT(!hasSVGRareData() || !svgRareData()->correspondingElement() || contai ningShadowRoot());
557 return hasSVGRareData() ? svgRareData()->correspondingElement() : 0; 557 return hasSVGRareData() ? svgRareData()->correspondingElement() : 0;
558 } 558 }
559 559
560 SVGUseElement* SVGElement::correspondingUseElement() const 560 SVGUseElement* SVGElement::correspondingUseElement() const
561 { 561 {
562 if (ShadowRoot* root = containingShadowRoot()) { 562 if (ShadowRoot* root = containingShadowRoot()) {
563 if (isSVGUseElement(root->host()) && (root->type() == ShadowRoot::UserAg entShadowRoot)) 563 if (isSVGUseElement(root->host()) && (root->type() == ShadowRoot::UserAg entShadowRoot))
564 return toSVGUseElement(root->host()); 564 return toSVGUseElement(root->host());
565 } 565 }
566 return 0; 566 return nullptr;
567 } 567 }
568 568
569 void SVGElement::setCorrespondingElement(SVGElement* correspondingElement) 569 void SVGElement::setCorrespondingElement(SVGElement* correspondingElement)
570 { 570 {
571 ensureSVGRareData()->setCorrespondingElement(correspondingElement); 571 ensureSVGRareData()->setCorrespondingElement(correspondingElement);
572 } 572 }
573 573
574 bool SVGElement::inUseShadowTree() const 574 bool SVGElement::inUseShadowTree() const
575 { 575 {
576 return correspondingUseElement(); 576 return correspondingUseElement();
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
836 } 836 }
837 837
838 void SVGElement::svgLoadEventTimerFired(Timer<SVGElement>*) 838 void SVGElement::svgLoadEventTimerFired(Timer<SVGElement>*)
839 { 839 {
840 sendSVGLoadEventIfPossible(); 840 sendSVGLoadEventIfPossible();
841 } 841 }
842 842
843 Timer<SVGElement>* SVGElement::svgLoadEventTimer() 843 Timer<SVGElement>* SVGElement::svgLoadEventTimer()
844 { 844 {
845 ASSERT_NOT_REACHED(); 845 ASSERT_NOT_REACHED();
846 return 0; 846 return nullptr;
847 } 847 }
848 848
849 void SVGElement::attributeChanged(const QualifiedName& name, const AtomicString& newValue, AttributeModificationReason) 849 void SVGElement::attributeChanged(const QualifiedName& name, const AtomicString& newValue, AttributeModificationReason)
850 { 850 {
851 Element::attributeChanged(name, newValue); 851 Element::attributeChanged(name, newValue);
852 852
853 if (isIdAttributeName(name)) 853 if (isIdAttributeName(name))
854 rebuildAllIncomingReferences(); 854 rebuildAllIncomingReferences();
855 855
856 // Changes to the style attribute are processed lazily (see Element::getAttr ibute() and related methods), 856 // Changes to the style attribute are processed lazily (see Element::getAttr ibute() and related methods),
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
917 style = layoutObject->style(); 917 style = layoutObject->style();
918 } 918 }
919 919
920 return document().ensureStyleResolver().styleForElement(correspondingElement (), style, DisallowStyleSharing); 920 return document().ensureStyleResolver().styleForElement(correspondingElement (), style, DisallowStyleSharing);
921 } 921 }
922 922
923 MutableStylePropertySet* SVGElement::animatedSMILStyleProperties() const 923 MutableStylePropertySet* SVGElement::animatedSMILStyleProperties() const
924 { 924 {
925 if (hasSVGRareData()) 925 if (hasSVGRareData())
926 return svgRareData()->animatedSMILStyleProperties(); 926 return svgRareData()->animatedSMILStyleProperties();
927 return 0; 927 return nullptr;
928 } 928 }
929 929
930 MutableStylePropertySet* SVGElement::ensureAnimatedSMILStyleProperties() 930 MutableStylePropertySet* SVGElement::ensureAnimatedSMILStyleProperties()
931 { 931 {
932 return ensureSVGRareData()->ensureAnimatedSMILStyleProperties(); 932 return ensureSVGRareData()->ensureAnimatedSMILStyleProperties();
933 } 933 }
934 934
935 void SVGElement::setUseOverrideComputedStyle(bool value) 935 void SVGElement::setUseOverrideComputedStyle(bool value)
936 { 936 {
937 if (hasSVGRareData()) 937 if (hasSVGRareData())
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
1109 if (name == classAttr) 1109 if (name == classAttr)
1110 return true; 1110 return true;
1111 1111
1112 return animatableAttributes.contains(name); 1112 return animatableAttributes.contains(name);
1113 } 1113 }
1114 #endif 1114 #endif
1115 1115
1116 SVGElementSet* SVGElement::setOfIncomingReferences() const 1116 SVGElementSet* SVGElement::setOfIncomingReferences() const
1117 { 1117 {
1118 if (!hasSVGRareData()) 1118 if (!hasSVGRareData())
1119 return 0; 1119 return nullptr;
1120 return &svgRareData()->incomingReferences(); 1120 return &svgRareData()->incomingReferences();
1121 } 1121 }
1122 1122
1123 void SVGElement::addReferenceTo(SVGElement* targetElement) 1123 void SVGElement::addReferenceTo(SVGElement* targetElement)
1124 { 1124 {
1125 ASSERT(targetElement); 1125 ASSERT(targetElement);
1126 1126
1127 ensureSVGRareData()->outgoingReferences().add(targetElement); 1127 ensureSVGRareData()->outgoingReferences().add(targetElement);
1128 targetElement->ensureSVGRareData()->incomingReferences().add(this); 1128 targetElement->ensureSVGRareData()->incomingReferences().add(this);
1129 } 1129 }
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1184 Element::trace(visitor); 1184 Element::trace(visitor);
1185 } 1185 }
1186 1186
1187 const AtomicString& SVGElement::eventParameterName() 1187 const AtomicString& SVGElement::eventParameterName()
1188 { 1188 {
1189 DEFINE_STATIC_LOCAL(const AtomicString, evtString, ("evt", AtomicString::Con structFromLiteral)); 1189 DEFINE_STATIC_LOCAL(const AtomicString, evtString, ("evt", AtomicString::Con structFromLiteral));
1190 return evtString; 1190 return evtString;
1191 } 1191 }
1192 1192
1193 } // namespace blink 1193 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/svg/SVGElement.h ('k') | Source/core/svg/SVGElementRareData.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698