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

Side by Side Diff: sky/engine/core/dom/Element.cpp

Issue 691893002: Add support for Element#getAttributes (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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) 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 1308 matching lines...) Expand 10 before | Expand all | Expand 10 after
1319 size_t index = elementData()->attributes().findIndex(localName); 1319 size_t index = elementData()->attributes().findIndex(localName);
1320 if (index == kNotFound) { 1320 if (index == kNotFound) {
1321 if (UNLIKELY(localName == HTMLNames::styleAttr) && elementData()->m_styl eAttributeIsDirty && isStyledElement()) 1321 if (UNLIKELY(localName == HTMLNames::styleAttr) && elementData()->m_styl eAttributeIsDirty && isStyledElement())
1322 removeAllInlineStyleProperties(); 1322 removeAllInlineStyleProperties();
1323 return; 1323 return;
1324 } 1324 }
1325 1325
1326 removeAttributeInternal(index, NotInSynchronizationOfLazyAttribute); 1326 removeAttributeInternal(index, NotInSynchronizationOfLazyAttribute);
1327 } 1327 }
1328 1328
1329 Vector<RefPtr<Attr>> Element::getAttributes()
1330 {
1331 if (!elementData())
1332 return Vector<RefPtr<Attr>>();
1333 synchronizeAllAttributes();
1334 Vector<RefPtr<Attr>> attributes;
1335 for (const Attribute& attribute : elementData()->attributes())
1336 attributes.append(ensureAttr(attribute.name()));
1337 return attributes;
1338 }
1339
1329 PassRefPtr<Attr> Element::getAttributeNode(const AtomicString& localName) 1340 PassRefPtr<Attr> Element::getAttributeNode(const AtomicString& localName)
1330 { 1341 {
1331 if (!elementData()) 1342 if (!elementData())
1332 return nullptr; 1343 return nullptr;
1333 synchronizeAttribute(localName); 1344 synchronizeAttribute(localName);
1334 const Attribute* attribute = elementData()->attributes().find(localName); 1345 const Attribute* attribute = elementData()->attributes().find(localName);
1335 if (!attribute) 1346 if (!attribute)
1336 return nullptr; 1347 return nullptr;
1337 return ensureAttr(attribute->name()); 1348 return ensureAttr(attribute->name());
1338 } 1349 }
(...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after
2092 { 2103 {
2093 #if ENABLE(OILPAN) 2104 #if ENABLE(OILPAN)
2094 if (hasRareData()) 2105 if (hasRareData())
2095 visitor->trace(elementRareData()); 2106 visitor->trace(elementRareData());
2096 visitor->trace(m_elementData); 2107 visitor->trace(m_elementData);
2097 #endif 2108 #endif
2098 ContainerNode::trace(visitor); 2109 ContainerNode::trace(visitor);
2099 } 2110 }
2100 2111
2101 } // namespace blink 2112 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698