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

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

Issue 1681553002: Add support for 'href' (w/o XLink NS) for various SVG elements (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase; update comment Created 4 years, 10 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, 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
11 * version 2 of the License, or (at your option) any later version. 11 * version 2 of the License, or (at your option) any later version.
12 * 12 *
13 * This library is distributed in the hope that it will be useful, 13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details. 16 * Library General Public License for more details.
17 * 17 *
18 * You should have received a copy of the GNU Library General Public License 18 * You should have received a copy of the GNU Library General Public License
19 * along with this library; see the file COPYING.LIB. If not, write to 19 * along with this library; see the file COPYING.LIB. If not, write to
20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301, USA. 21 * Boston, MA 02110-1301, USA.
22 */ 22 */
23 23
24 #include "core/svg/SVGElement.h" 24 #include "core/svg/SVGElement.h"
25 25
26 #include "bindings/core/v8/ScriptEventListener.h" 26 #include "bindings/core/v8/ScriptEventListener.h"
27 #include "core/HTMLNames.h" 27 #include "core/HTMLNames.h"
28 #include "core/SVGNames.h" 28 #include "core/SVGNames.h"
29 #include "core/XLinkNames.h"
30 #include "core/XMLNames.h" 29 #include "core/XMLNames.h"
31 #include "core/animation/AnimationStack.h" 30 #include "core/animation/AnimationStack.h"
32 #include "core/animation/DocumentAnimations.h" 31 #include "core/animation/DocumentAnimations.h"
33 #include "core/animation/ElementAnimations.h" 32 #include "core/animation/ElementAnimations.h"
34 #include "core/animation/InterpolationEnvironment.h" 33 #include "core/animation/InterpolationEnvironment.h"
35 #include "core/animation/InvalidatableInterpolation.h" 34 #include "core/animation/InvalidatableInterpolation.h"
36 #include "core/css/CSSCursorImageValue.h" 35 #include "core/css/CSSCursorImageValue.h"
37 #include "core/css/resolver/StyleResolver.h" 36 #include "core/css/resolver/StyleResolver.h"
38 #include "core/dom/Document.h" 37 #include "core/dom/Document.h"
39 #include "core/dom/ElementTraversal.h" 38 #include "core/dom/ElementTraversal.h"
(...skipping 998 matching lines...) Expand 10 before | Expand all | Expand 10 after
1038 1037
1039 #if ENABLE(ASSERT) 1038 #if ENABLE(ASSERT)
1040 bool SVGElement::isAnimatableAttribute(const QualifiedName& name) const 1039 bool SVGElement::isAnimatableAttribute(const QualifiedName& name) const
1041 { 1040 {
1042 // This static is atomically initialized to dodge a warning about 1041 // This static is atomically initialized to dodge a warning about
1043 // a race when dumping debug data for a layer. 1042 // a race when dumping debug data for a layer.
1044 DEFINE_THREAD_SAFE_STATIC_LOCAL(HashSet<QualifiedName>, animatableAttributes , new HashSet<QualifiedName>()); 1043 DEFINE_THREAD_SAFE_STATIC_LOCAL(HashSet<QualifiedName>, animatableAttributes , new HashSet<QualifiedName>());
1045 1044
1046 if (animatableAttributes.isEmpty()) { 1045 if (animatableAttributes.isEmpty()) {
1047 const QualifiedName* const animatableAttrs[] = { 1046 const QualifiedName* const animatableAttrs[] = {
1048 &XLinkNames::hrefAttr,
1049 &SVGNames::amplitudeAttr, 1047 &SVGNames::amplitudeAttr,
1050 &SVGNames::azimuthAttr, 1048 &SVGNames::azimuthAttr,
1051 &SVGNames::baseFrequencyAttr, 1049 &SVGNames::baseFrequencyAttr,
1052 &SVGNames::biasAttr, 1050 &SVGNames::biasAttr,
1053 &SVGNames::clipPathUnitsAttr, 1051 &SVGNames::clipPathUnitsAttr,
1054 &SVGNames::cxAttr, 1052 &SVGNames::cxAttr,
1055 &SVGNames::cyAttr, 1053 &SVGNames::cyAttr,
1056 &SVGNames::diffuseConstantAttr, 1054 &SVGNames::diffuseConstantAttr,
1057 &SVGNames::divisorAttr, 1055 &SVGNames::divisorAttr,
1058 &SVGNames::dxAttr, 1056 &SVGNames::dxAttr,
1059 &SVGNames::dyAttr, 1057 &SVGNames::dyAttr,
1060 &SVGNames::edgeModeAttr, 1058 &SVGNames::edgeModeAttr,
1061 &SVGNames::elevationAttr, 1059 &SVGNames::elevationAttr,
1062 &SVGNames::exponentAttr, 1060 &SVGNames::exponentAttr,
1063 &SVGNames::filterUnitsAttr, 1061 &SVGNames::filterUnitsAttr,
1064 &SVGNames::fxAttr, 1062 &SVGNames::fxAttr,
1065 &SVGNames::fyAttr, 1063 &SVGNames::fyAttr,
1066 &SVGNames::gradientTransformAttr, 1064 &SVGNames::gradientTransformAttr,
1067 &SVGNames::gradientUnitsAttr, 1065 &SVGNames::gradientUnitsAttr,
1068 &SVGNames::heightAttr, 1066 &SVGNames::heightAttr,
1067 &SVGNames::hrefAttr,
1069 &SVGNames::in2Attr, 1068 &SVGNames::in2Attr,
1070 &SVGNames::inAttr, 1069 &SVGNames::inAttr,
1071 &SVGNames::interceptAttr, 1070 &SVGNames::interceptAttr,
1072 &SVGNames::k1Attr, 1071 &SVGNames::k1Attr,
1073 &SVGNames::k2Attr, 1072 &SVGNames::k2Attr,
1074 &SVGNames::k3Attr, 1073 &SVGNames::k3Attr,
1075 &SVGNames::k4Attr, 1074 &SVGNames::k4Attr,
1076 &SVGNames::kernelMatrixAttr, 1075 &SVGNames::kernelMatrixAttr,
1077 &SVGNames::kernelUnitLengthAttr, 1076 &SVGNames::kernelUnitLengthAttr,
1078 &SVGNames::lengthAdjustAttr, 1077 &SVGNames::lengthAdjustAttr,
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
1171 const SVGElementSet& incomingReferences = svgRareData()->incomingReferences( ); 1170 const SVGElementSet& incomingReferences = svgRareData()->incomingReferences( );
1172 1171
1173 // Iterate on a snapshot as |incomingReferences| may be altered inside loop. 1172 // Iterate on a snapshot as |incomingReferences| may be altered inside loop.
1174 WillBeHeapVector<RawPtrWillBeMember<SVGElement>> incomingReferencesSnapshot; 1173 WillBeHeapVector<RawPtrWillBeMember<SVGElement>> incomingReferencesSnapshot;
1175 copyToVector(incomingReferences, incomingReferencesSnapshot); 1174 copyToVector(incomingReferences, incomingReferencesSnapshot);
1176 1175
1177 // Force rebuilding the |sourceElement| so it knows about this change. 1176 // Force rebuilding the |sourceElement| so it knows about this change.
1178 for (SVGElement* sourceElement : incomingReferencesSnapshot) { 1177 for (SVGElement* sourceElement : incomingReferencesSnapshot) {
1179 // Before rebuilding |sourceElement| ensure it was not removed from unde r us. 1178 // Before rebuilding |sourceElement| ensure it was not removed from unde r us.
1180 if (incomingReferences.contains(sourceElement)) 1179 if (incomingReferences.contains(sourceElement))
1181 sourceElement->svgAttributeChanged(XLinkNames::hrefAttr); 1180 sourceElement->svgAttributeChanged(SVGNames::hrefAttr);
1182 } 1181 }
1183 } 1182 }
1184 1183
1185 void SVGElement::removeAllIncomingReferences() 1184 void SVGElement::removeAllIncomingReferences()
1186 { 1185 {
1187 if (!hasSVGRareData()) 1186 if (!hasSVGRareData())
1188 return; 1187 return;
1189 1188
1190 SVGElementSet& incomingReferences = svgRareData()->incomingReferences(); 1189 SVGElementSet& incomingReferences = svgRareData()->incomingReferences();
1191 for (SVGElement* sourceElement: incomingReferences) { 1190 for (SVGElement* sourceElement: incomingReferences) {
(...skipping 27 matching lines...) Expand all
1219 Element::trace(visitor); 1218 Element::trace(visitor);
1220 } 1219 }
1221 1220
1222 const AtomicString& SVGElement::eventParameterName() 1221 const AtomicString& SVGElement::eventParameterName()
1223 { 1222 {
1224 DEFINE_STATIC_LOCAL(const AtomicString, evtString, ("evt", AtomicString::Con structFromLiteral)); 1223 DEFINE_STATIC_LOCAL(const AtomicString, evtString, ("evt", AtomicString::Con structFromLiteral));
1225 return evtString; 1224 return evtString;
1226 } 1225 }
1227 1226
1228 } // namespace blink 1227 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGAttributeNames.in ('k') | third_party/WebKit/Source/core/svg/SVGURIReference.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698