OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2001 Peter Kelly (pmk@post.com) | 4 * (C) 2001 Peter Kelly (pmk@post.com) |
5 * (C) 2001 Dirk Mueller (mueller@kde.org) | 5 * (C) 2001 Dirk Mueller (mueller@kde.org) |
6 * (C) 2007 David Smith (catfish.man@gmail.com) | 6 * (C) 2007 David Smith (catfish.man@gmail.com) |
7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc.
All rights reserved. | 7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc.
All rights reserved. |
8 * (C) 2007 Eric Seidel (eric@webkit.org) | 8 * (C) 2007 Eric Seidel (eric@webkit.org) |
9 * | 9 * |
10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 } | 329 } |
330 | 330 |
331 PassRefPtr<Attr> Element::detachAttribute(size_t index) | 331 PassRefPtr<Attr> Element::detachAttribute(size_t index) |
332 { | 332 { |
333 ASSERT(elementData()); | 333 ASSERT(elementData()); |
334 const Attribute* attribute = elementData()->attributeItem(index); | 334 const Attribute* attribute = elementData()->attributeItem(index); |
335 RefPtr<Attr> attrNode = attrIfExists(attribute->name()); | 335 RefPtr<Attr> attrNode = attrIfExists(attribute->name()); |
336 if (attrNode) | 336 if (attrNode) |
337 detachAttrNodeAtIndex(attrNode.get(), index); | 337 detachAttrNodeAtIndex(attrNode.get(), index); |
338 else { | 338 else { |
339 attrNode = Attr::create(&document(), attribute->name(), attribute->value
()); | 339 attrNode = Attr::create(document(), attribute->name(), attribute->value(
)); |
340 removeAttributeInternal(index, NotInSynchronizationOfLazyAttribute); | 340 removeAttributeInternal(index, NotInSynchronizationOfLazyAttribute); |
341 } | 341 } |
342 return attrNode.release(); | 342 return attrNode.release(); |
343 } | 343 } |
344 | 344 |
345 void Element::detachAttrNodeAtIndex(Attr* attr, size_t index) | 345 void Element::detachAttrNodeAtIndex(Attr* attr, size_t index) |
346 { | 346 { |
347 ASSERT(attr); | 347 ASSERT(attr); |
348 ASSERT(elementData()); | 348 ASSERT(elementData()); |
349 | 349 |
(...skipping 1485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1835 } | 1835 } |
1836 | 1836 |
1837 synchronizeAllAttributes(); | 1837 synchronizeAllAttributes(); |
1838 UniqueElementData* elementData = ensureUniqueElementData(); | 1838 UniqueElementData* elementData = ensureUniqueElementData(); |
1839 | 1839 |
1840 size_t index = elementData->getAttributeItemIndex(attrNode->qualifiedName(),
shouldIgnoreAttributeCase(this)); | 1840 size_t index = elementData->getAttributeItemIndex(attrNode->qualifiedName(),
shouldIgnoreAttributeCase(this)); |
1841 if (index != notFound) { | 1841 if (index != notFound) { |
1842 if (oldAttrNode) | 1842 if (oldAttrNode) |
1843 detachAttrNodeFromElementWithValue(oldAttrNode.get(), elementData->a
ttributeItem(index)->value()); | 1843 detachAttrNodeFromElementWithValue(oldAttrNode.get(), elementData->a
ttributeItem(index)->value()); |
1844 else | 1844 else |
1845 oldAttrNode = Attr::create(&document(), attrNode->qualifiedName(), e
lementData->attributeItem(index)->value()); | 1845 oldAttrNode = Attr::create(document(), attrNode->qualifiedName(), el
ementData->attributeItem(index)->value()); |
1846 } | 1846 } |
1847 | 1847 |
1848 setAttributeInternal(index, attrNode->qualifiedName(), attrNode->value(), No
tInSynchronizationOfLazyAttribute); | 1848 setAttributeInternal(index, attrNode->qualifiedName(), attrNode->value(), No
tInSynchronizationOfLazyAttribute); |
1849 | 1849 |
1850 attrNode->attachToElement(this); | 1850 attrNode->attachToElement(this); |
1851 treeScope().adoptIfNeeded(attrNode); | 1851 treeScope().adoptIfNeeded(attrNode); |
1852 ensureAttrNodeListForElement(this)->append(attrNode); | 1852 ensureAttrNodeListForElement(this)->append(attrNode); |
1853 | 1853 |
1854 return oldAttrNode.release(); | 1854 return oldAttrNode.release(); |
1855 } | 1855 } |
(...skipping 1100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2956 if (AttrNodeList* attrNodeList = attrNodeListForElement(this)) | 2956 if (AttrNodeList* attrNodeList = attrNodeListForElement(this)) |
2957 return findAttrNodeInList(attrNodeList, name); | 2957 return findAttrNodeInList(attrNodeList, name); |
2958 return 0; | 2958 return 0; |
2959 } | 2959 } |
2960 | 2960 |
2961 PassRefPtr<Attr> Element::ensureAttr(const QualifiedName& name) | 2961 PassRefPtr<Attr> Element::ensureAttr(const QualifiedName& name) |
2962 { | 2962 { |
2963 AttrNodeList* attrNodeList = ensureAttrNodeListForElement(this); | 2963 AttrNodeList* attrNodeList = ensureAttrNodeListForElement(this); |
2964 RefPtr<Attr> attrNode = findAttrNodeInList(attrNodeList, name); | 2964 RefPtr<Attr> attrNode = findAttrNodeInList(attrNodeList, name); |
2965 if (!attrNode) { | 2965 if (!attrNode) { |
2966 attrNode = Attr::create(this, name); | 2966 attrNode = Attr::create(*this, name); |
2967 treeScope().adoptIfNeeded(attrNode.get()); | 2967 treeScope().adoptIfNeeded(attrNode.get()); |
2968 attrNodeList->append(attrNode); | 2968 attrNodeList->append(attrNode); |
2969 } | 2969 } |
2970 return attrNode.release(); | 2970 return attrNode.release(); |
2971 } | 2971 } |
2972 | 2972 |
2973 void Element::detachAttrNodeFromElementWithValue(Attr* attrNode, const AtomicStr
ing& value) | 2973 void Element::detachAttrNodeFromElementWithValue(Attr* attrNode, const AtomicStr
ing& value) |
2974 { | 2974 { |
2975 ASSERT(hasSyntheticAttrChildNodes()); | 2975 ASSERT(hasSyntheticAttrChildNodes()); |
2976 attrNode->detachFromElementWithValue(value); | 2976 attrNode->detachFromElementWithValue(value); |
(...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3638 return 0; | 3638 return 0; |
3639 } | 3639 } |
3640 | 3640 |
3641 Attribute* UniqueElementData::attributeItem(unsigned index) | 3641 Attribute* UniqueElementData::attributeItem(unsigned index) |
3642 { | 3642 { |
3643 ASSERT_WITH_SECURITY_IMPLICATION(index < length()); | 3643 ASSERT_WITH_SECURITY_IMPLICATION(index < length()); |
3644 return &m_attributeVector.at(index); | 3644 return &m_attributeVector.at(index); |
3645 } | 3645 } |
3646 | 3646 |
3647 } // namespace WebCore | 3647 } // namespace WebCore |
OLD | NEW |