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

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

Issue 1544673003: Refactor propagation of parsing errors for SVG attributes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 } 628 }
629 629
630 bool SVGElement::inUseShadowTree() const 630 bool SVGElement::inUseShadowTree() const
631 { 631 {
632 return correspondingUseElement(); 632 return correspondingUseElement();
633 } 633 }
634 634
635 void SVGElement::parseAttribute(const QualifiedName& name, const AtomicString& o ldValue, const AtomicString& value) 635 void SVGElement::parseAttribute(const QualifiedName& name, const AtomicString& o ldValue, const AtomicString& value)
636 { 636 {
637 if (SVGAnimatedPropertyBase* property = propertyFromAttribute(name)) { 637 if (SVGAnimatedPropertyBase* property = propertyFromAttribute(name)) {
638 SVGParsingError parseError = NoError; 638 SVGParsingError parseError = property->setBaseValueAsString(value);
639 property->setBaseValueAsString(value, parseError);
640 reportAttributeParsingError(parseError, name, value); 639 reportAttributeParsingError(parseError, name, value);
641 return; 640 return;
642 } 641 }
643 642
644 if (name == HTMLNames::classAttr) { 643 if (name == HTMLNames::classAttr) {
645 // SVG animation has currently requires special storage of values so we set 644 // SVG animation has currently requires special storage of values so we set
646 // the className here. svgAttributeChanged actually causes the resulting 645 // the className here. svgAttributeChanged actually causes the resulting
647 // style updates (instead of Element::parseAttribute). We don't 646 // style updates (instead of Element::parseAttribute). We don't
648 // tell Element about the change to avoid parsing the class list twice 647 // tell Element about the change to avoid parsing the class list twice
649 SVGParsingError parseError = NoError; 648 SVGParsingError parseError = m_className->setBaseValueAsString(value);
650 m_className->setBaseValueAsString(value, parseError);
651 reportAttributeParsingError(parseError, name, value); 649 reportAttributeParsingError(parseError, name, value);
652 } else if (name == tabindexAttr) { 650 } else if (name == tabindexAttr) {
653 Element::parseAttribute(name, oldValue, value); 651 Element::parseAttribute(name, oldValue, value);
654 } else { 652 } else {
655 // standard events 653 // standard events
656 const AtomicString& eventName = HTMLElement::eventNameForAttributeName(n ame); 654 const AtomicString& eventName = HTMLElement::eventNameForAttributeName(n ame);
657 if (!eventName.isNull()) 655 if (!eventName.isNull())
658 setAttributeEventListener(eventName, createAttributeEventListener(th is, name, value, eventParameterName())); 656 setAttributeEventListener(eventName, createAttributeEventListener(th is, name, value, eventParameterName()));
659 else 657 else
660 Element::parseAttribute(name, oldValue, value); 658 Element::parseAttribute(name, oldValue, value);
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after
1243 Element::trace(visitor); 1241 Element::trace(visitor);
1244 } 1242 }
1245 1243
1246 const AtomicString& SVGElement::eventParameterName() 1244 const AtomicString& SVGElement::eventParameterName()
1247 { 1245 {
1248 DEFINE_STATIC_LOCAL(const AtomicString, evtString, ("evt", AtomicString::Con structFromLiteral)); 1246 DEFINE_STATIC_LOCAL(const AtomicString, evtString, ("evt", AtomicString::Con structFromLiteral));
1249 return evtString; 1247 return evtString;
1250 } 1248 }
1251 1249
1252 } // namespace blink 1250 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698