Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 26 matching lines...) Expand all Loading... | |
| 37 addToPropertyMap(m_x); | 37 addToPropertyMap(m_x); |
| 38 addToPropertyMap(m_y); | 38 addToPropertyMap(m_y); |
| 39 } | 39 } |
| 40 | 40 |
| 41 DEFINE_NODE_FACTORY(SVGCursorElement) | 41 DEFINE_NODE_FACTORY(SVGCursorElement) |
| 42 | 42 |
| 43 SVGCursorElement::~SVGCursorElement() | 43 SVGCursorElement::~SVGCursorElement() |
| 44 { | 44 { |
| 45 // The below teardown is all handled by weak pointer processing in oilpan. | 45 // The below teardown is all handled by weak pointer processing in oilpan. |
| 46 #if !ENABLE(OILPAN) | 46 #if !ENABLE(OILPAN) |
| 47 HashSet<RawPtr<SVGElement> >::iterator end = m_clients.end(); | 47 for (const auto& client : m_clients) |
|
fs
2014/10/15 09:06:45
It looks a bit dodgy with 'const' here, but I gues
kouhei (in TOK)
2014/10/15 10:02:00
Changed to auto&.
| |
| 48 for (HashSet<RawPtr<SVGElement> >::iterator it = m_clients.begin(); it != en d; ++it) | 48 client->cursorElementRemoved(); |
| 49 (*it)->cursorElementRemoved(); | |
| 50 #endif | 49 #endif |
| 51 } | 50 } |
| 52 | 51 |
| 53 bool SVGCursorElement::isSupportedAttribute(const QualifiedName& attrName) | 52 bool SVGCursorElement::isSupportedAttribute(const QualifiedName& attrName) |
| 54 { | 53 { |
| 55 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); | 54 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); |
| 56 if (supportedAttributes.isEmpty()) { | 55 if (supportedAttributes.isEmpty()) { |
| 57 SVGTests::addSupportedAttributes(supportedAttributes); | 56 SVGTests::addSupportedAttributes(supportedAttributes); |
| 58 SVGURIReference::addSupportedAttributes(supportedAttributes); | 57 SVGURIReference::addSupportedAttributes(supportedAttributes); |
| 59 supportedAttributes.add(SVGNames::xAttr); | 58 supportedAttributes.add(SVGNames::xAttr); |
| 60 supportedAttributes.add(SVGNames::yAttr); | 59 supportedAttributes.add(SVGNames::yAttr); |
| 61 } | 60 } |
| 62 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | 61 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); |
| 63 } | 62 } |
| 64 | 63 |
| 65 void SVGCursorElement::parseAttribute(const QualifiedName& name, const AtomicStr ing& value) | 64 void SVGCursorElement::parseAttribute(const QualifiedName& name, const AtomicStr ing& value) |
| 66 { | 65 { |
| 67 SVGParsingError parseError = NoError; | 66 parseAttributeNew(name, value); |
| 68 | |
| 69 if (!isSupportedAttribute(name)) { | |
| 70 SVGElement::parseAttribute(name, value); | |
| 71 } else if (name == SVGNames::xAttr) { | |
| 72 m_x->setBaseValueAsString(value, parseError); | |
| 73 } else if (name == SVGNames::yAttr) { | |
| 74 m_y->setBaseValueAsString(value, parseError); | |
| 75 } else if (SVGURIReference::parseAttribute(name, value, parseError)) { | |
| 76 } else if (SVGTests::parseAttribute(name, value)) { | |
| 77 } else { | |
| 78 ASSERT_NOT_REACHED(); | |
| 79 } | |
| 80 | |
| 81 reportAttributeParsingError(parseError, name, value); | |
| 82 } | 67 } |
| 83 | 68 |
| 84 void SVGCursorElement::addClient(SVGElement* element) | 69 void SVGCursorElement::addClient(SVGElement* element) |
| 85 { | 70 { |
| 86 m_clients.add(element); | 71 m_clients.add(element); |
| 87 element->setCursorElement(this); | 72 element->setCursorElement(this); |
| 88 } | 73 } |
| 89 | 74 |
| 90 #if !ENABLE(OILPAN) | 75 #if !ENABLE(OILPAN) |
| 91 void SVGCursorElement::removeClient(SVGElement* element) | 76 void SVGCursorElement::removeClient(SVGElement* element) |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 106 void SVGCursorElement::svgAttributeChanged(const QualifiedName& attrName) | 91 void SVGCursorElement::svgAttributeChanged(const QualifiedName& attrName) |
| 107 { | 92 { |
| 108 if (!isSupportedAttribute(attrName)) { | 93 if (!isSupportedAttribute(attrName)) { |
| 109 SVGElement::svgAttributeChanged(attrName); | 94 SVGElement::svgAttributeChanged(attrName); |
| 110 return; | 95 return; |
| 111 } | 96 } |
| 112 | 97 |
| 113 SVGElement::InvalidationGuard invalidationGuard(this); | 98 SVGElement::InvalidationGuard invalidationGuard(this); |
| 114 | 99 |
| 115 // Any change of a cursor specific attribute triggers this recalc. | 100 // Any change of a cursor specific attribute triggers this recalc. |
| 116 WillBeHeapHashSet<RawPtrWillBeWeakMember<SVGElement> >::const_iterator it = m_clients.begin(); | 101 for (const auto& client : m_clients) |
| 117 WillBeHeapHashSet<RawPtrWillBeWeakMember<SVGElement> >::const_iterator end = m_clients.end(); | 102 client->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTrac ing::create(StyleChangeReason::SVGCursor)); |
| 118 | |
| 119 for (; it != end; ++it) | |
| 120 (*it)->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTraci ng::create(StyleChangeReason::SVGCursor)); | |
| 121 } | 103 } |
| 122 | 104 |
| 123 void SVGCursorElement::trace(Visitor* visitor) | 105 void SVGCursorElement::trace(Visitor* visitor) |
| 124 { | 106 { |
| 125 #if ENABLE(OILPAN) | 107 #if ENABLE(OILPAN) |
| 126 visitor->trace(m_clients); | 108 visitor->trace(m_clients); |
| 127 #endif | 109 #endif |
| 128 SVGElement::trace(visitor); | 110 SVGElement::trace(visitor); |
| 129 } | 111 } |
| 130 | 112 |
| 131 } // namespace blink | 113 } // namespace blink |
| OLD | NEW |