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

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

Issue 2645383002: Move 'id'-related invalidation to SVGElement::attributeChanged (Closed)
Patch Set: Created 3 years, 11 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 | « no previous file | no next file » | 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 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann
3 * <zimmermann@kde.org> 3 * <zimmermann@kde.org>
4 * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org> 4 * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
5 * Copyright (C) 2008 Apple Inc. All rights reserved. 5 * Copyright (C) 2008 Apple Inc. All rights reserved.
6 * Copyright (C) 2008 Alp Toker <alp@atoker.com> 6 * Copyright (C) 2008 Alp Toker <alp@atoker.com>
7 * Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> 7 * Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au>
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 900 matching lines...) Expand 10 before | Expand all | Expand 10 after
911 return; 911 return;
912 912
913 toSVGElement(parent)->sendSVGLoadEventToSelfAndAncestorChainIfPossible(); 913 toSVGElement(parent)->sendSVGLoadEventToSelfAndAncestorChainIfPossible();
914 } 914 }
915 915
916 void SVGElement::attributeChanged(const AttributeModificationParams& params) { 916 void SVGElement::attributeChanged(const AttributeModificationParams& params) {
917 Element::attributeChanged( 917 Element::attributeChanged(
918 AttributeModificationParams(params.name, params.oldValue, params.newValue, 918 AttributeModificationParams(params.name, params.oldValue, params.newValue,
919 AttributeModificationReason::kDirectly)); 919 AttributeModificationReason::kDirectly));
920 920
921 if (params.name == HTMLNames::idAttr) 921 if (params.name == HTMLNames::idAttr) {
922 rebuildAllIncomingReferences(); 922 rebuildAllIncomingReferences();
923 923
924 LayoutObject* object = layoutObject();
925 // Notify resources about id changes, this is important as we cache
926 // resources by id in SVGDocumentExtensions
927 if (object && object->isSVGResourceContainer())
928 toLayoutSVGResourceContainer(object)->idChanged();
929 if (isConnected())
930 buildPendingResourcesIfNeeded();
931 invalidateInstances();
932 return;
933 }
934
924 // Changes to the style attribute are processed lazily (see 935 // Changes to the style attribute are processed lazily (see
925 // Element::getAttribute() and related methods), so we don't want changes to 936 // Element::getAttribute() and related methods), so we don't want changes to
926 // the style attribute to result in extra work here. 937 // the style attribute to result in extra work here.
927 if (params.name == HTMLNames::styleAttr) 938 if (params.name == HTMLNames::styleAttr)
928 return; 939 return;
929 940
930 svgAttributeBaseValChanged(params.name); 941 svgAttributeBaseValChanged(params.name);
931 } 942 }
932 943
933 void SVGElement::svgAttributeChanged(const QualifiedName& attrName) { 944 void SVGElement::svgAttributeChanged(const QualifiedName& attrName) {
934 CSSPropertyID propId = SVGElement::cssPropertyIdForSVGAttributeName(attrName); 945 CSSPropertyID propId = SVGElement::cssPropertyIdForSVGAttributeName(attrName);
935 if (propId > 0) { 946 if (propId > 0) {
936 invalidateInstances(); 947 invalidateInstances();
937 return; 948 return;
938 } 949 }
939 950
940 if (attrName == HTMLNames::classAttr) { 951 if (attrName == HTMLNames::classAttr) {
941 classAttributeChanged(AtomicString(m_className->currentValue()->value())); 952 classAttributeChanged(AtomicString(m_className->currentValue()->value()));
942 invalidateInstances(); 953 invalidateInstances();
943 return; 954 return;
944 } 955 }
945
946 if (attrName == HTMLNames::idAttr) {
947 LayoutObject* object = layoutObject();
948 // Notify resources about id changes, this is important as we cache
949 // resources by id in SVGDocumentExtensions
950 if (object && object->isSVGResourceContainer())
951 toLayoutSVGResourceContainer(object)->idChanged();
952 if (isConnected())
953 buildPendingResourcesIfNeeded();
954 invalidateInstances();
955 return;
956 }
957 } 956 }
958 957
959 void SVGElement::svgAttributeBaseValChanged(const QualifiedName& attribute) { 958 void SVGElement::svgAttributeBaseValChanged(const QualifiedName& attribute) {
960 svgAttributeChanged(attribute); 959 svgAttributeChanged(attribute);
961 960
962 if (!hasSVGRareData() || svgRareData()->webAnimatedAttributes().isEmpty()) 961 if (!hasSVGRareData() || svgRareData()->webAnimatedAttributes().isEmpty())
963 return; 962 return;
964 963
965 // TODO(alancutter): Only mark attributes as dirty if their animation depends 964 // TODO(alancutter): Only mark attributes as dirty if their animation depends
966 // on the underlying value. 965 // on the underlying value.
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
1284 visitor->trace(m_className); 1283 visitor->trace(m_className);
1285 Element::trace(visitor); 1284 Element::trace(visitor);
1286 } 1285 }
1287 1286
1288 const AtomicString& SVGElement::eventParameterName() { 1287 const AtomicString& SVGElement::eventParameterName() {
1289 DEFINE_STATIC_LOCAL(const AtomicString, evtString, ("evt")); 1288 DEFINE_STATIC_LOCAL(const AtomicString, evtString, ("evt"));
1290 return evtString; 1289 return evtString;
1291 } 1290 }
1292 1291
1293 } // namespace blink 1292 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698