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

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

Issue 180723006: Have ElementData::attributeItem() return a reference (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 years, 9 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/WebElement.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 821 matching lines...) Expand 10 before | Expand all | Expand 10 after
832 } 832 }
833 833
834 if (elemStack.isEmpty()) 834 if (elemStack.isEmpty())
835 return; 835 return;
836 836
837 for (; !elemStack.isEmpty(); elemStack.removeLast()) { 837 for (; !elemStack.isEmpty(); elemStack.removeLast()) {
838 Element* element = elemStack.last(); 838 Element* element = elemStack.last();
839 if (element->hasAttributes()) { 839 if (element->hasAttributes()) {
840 unsigned attributeCount = element->attributeCount(); 840 unsigned attributeCount = element->attributeCount();
841 for (unsigned i = 0; i < attributeCount; ++i) { 841 for (unsigned i = 0; i < attributeCount; ++i) {
842 const Attribute* attribute = element->attributeItem(i); 842 const Attribute& attribute = element->attributeItem(i);
843 if (attribute->localName() == xmlnsAtom) 843 if (attribute.localName() == xmlnsAtom)
844 m_defaultNamespaceURI = attribute->value(); 844 m_defaultNamespaceURI = attribute.value();
845 else if (attribute->prefix() == xmlnsAtom) 845 else if (attribute.prefix() == xmlnsAtom)
846 m_prefixToNamespaceMap.set(attribute->localName(), attribute ->value()); 846 m_prefixToNamespaceMap.set(attribute.localName(), attribute. value());
847 } 847 }
848 } 848 }
849 } 849 }
850 850
851 // If the parent element is not in document tree, there may be no xmlns attr ibute; just default to the parent's namespace. 851 // If the parent element is not in document tree, there may be no xmlns attr ibute; just default to the parent's namespace.
852 if (m_defaultNamespaceURI.isNull() && !parentElement->inDocument()) 852 if (m_defaultNamespaceURI.isNull() && !parentElement->inDocument())
853 m_defaultNamespaceURI = parentElement->namespaceURI(); 853 m_defaultNamespaceURI = parentElement->namespaceURI();
854 } 854 }
855 855
856 XMLParserContext::~XMLParserContext() 856 XMLParserContext::~XMLParserContext()
(...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after
1634 sax.initialized = XML_SAX2_MAGIC; 1634 sax.initialized = XML_SAX2_MAGIC;
1635 RefPtr<XMLParserContext> parser = XMLParserContext::createStringParser(&sax, &state); 1635 RefPtr<XMLParserContext> parser = XMLParserContext::createStringParser(&sax, &state);
1636 String parseString = "<?xml version=\"1.0\"?><attrs " + string + " />"; 1636 String parseString = "<?xml version=\"1.0\"?><attrs " + string + " />";
1637 parseChunk(parser->context(), parseString); 1637 parseChunk(parser->context(), parseString);
1638 finishParsing(parser->context()); 1638 finishParsing(parser->context());
1639 attrsOK = state.gotAttributes; 1639 attrsOK = state.gotAttributes;
1640 return state.attributes; 1640 return state.attributes;
1641 } 1641 }
1642 1642
1643 } // namespace WebCore 1643 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/xml/XPathStep.cpp ('k') | Source/web/WebElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698