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

Side by Side Diff: Source/core/xml/parser/XMLDocumentParser.cpp

Issue 337753005: Make iterator for Element's attributes more lightweight (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Proper rebase Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/xml/XPathStep.cpp ('k') | Source/web/WebPageSerializerImpl.cpp » ('j') | 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) 2000 Peter Kelly (pmk@post.com) 2 * Copyright (C) 2000 Peter Kelly (pmk@post.com)
3 * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved. 3 * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved.
4 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) 4 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org)
5 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) 5 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org)
6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
7 * Copyright (C) 2008 Holger Hans Peter Freyther 7 * Copyright (C) 2008 Holger Hans Peter Freyther
8 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 8 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
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 789 matching lines...) Expand 10 before | Expand all | Expand 10 after
800 break; 800 break;
801 parentElement = toElement(n); 801 parentElement = toElement(n);
802 } 802 }
803 803
804 if (elemStack.isEmpty()) 804 if (elemStack.isEmpty())
805 return; 805 return;
806 806
807 for (; !elemStack.isEmpty(); elemStack.removeLast()) { 807 for (; !elemStack.isEmpty(); elemStack.removeLast()) {
808 Element* element = elemStack.last(); 808 Element* element = elemStack.last();
809 if (element->hasAttributes()) { 809 if (element->hasAttributes()) {
810 AttributeIteratorAccessor attributes = element->attributesIterator() ; 810 AttributeCollection attributes = element->attributes();
811 AttributeConstIterator end = attributes.end(); 811 AttributeCollection::const_iterator end = attributes.end();
812 for (AttributeConstIterator it = attributes.begin(); it != end; ++it ) { 812 for (AttributeCollection::const_iterator it = attributes.begin(); it != end; ++it) {
813 if (it->localName() == xmlnsAtom) 813 if (it->localName() == xmlnsAtom)
814 m_defaultNamespaceURI = it->value(); 814 m_defaultNamespaceURI = it->value();
815 else if (it->prefix() == xmlnsAtom) 815 else if (it->prefix() == xmlnsAtom)
816 m_prefixToNamespaceMap.set(it->localName(), it->value()); 816 m_prefixToNamespaceMap.set(it->localName(), it->value());
817 } 817 }
818 } 818 }
819 } 819 }
820 820
821 // If the parent element is not in document tree, there may be no xmlns attr ibute; just default to the parent's namespace. 821 // If the parent element is not in document tree, there may be no xmlns attr ibute; just default to the parent's namespace.
822 if (m_defaultNamespaceURI.isNull() && !parentElement->inDocument()) 822 if (m_defaultNamespaceURI.isNull() && !parentElement->inDocument())
(...skipping 793 matching lines...) Expand 10 before | Expand all | Expand 10 after
1616 sax.initialized = XML_SAX2_MAGIC; 1616 sax.initialized = XML_SAX2_MAGIC;
1617 RefPtr<XMLParserContext> parser = XMLParserContext::createStringParser(&sax, &state); 1617 RefPtr<XMLParserContext> parser = XMLParserContext::createStringParser(&sax, &state);
1618 String parseString = "<?xml version=\"1.0\"?><attrs " + string + " />"; 1618 String parseString = "<?xml version=\"1.0\"?><attrs " + string + " />";
1619 parseChunk(parser->context(), parseString); 1619 parseChunk(parser->context(), parseString);
1620 finishParsing(parser->context()); 1620 finishParsing(parser->context());
1621 attrsOK = state.gotAttributes; 1621 attrsOK = state.gotAttributes;
1622 return state.attributes; 1622 return state.attributes;
1623 } 1623 }
1624 1624
1625 } // namespace WebCore 1625 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/xml/XPathStep.cpp ('k') | Source/web/WebPageSerializerImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698