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

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

Issue 781673002: Use C++11 range-based loop for core/xml and core/loader (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: remove unnecessary curly brackets Created 5 years, 11 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
« no previous file with comments | « Source/core/xml/XSLTProcessorLibxslt.cpp ('k') | no next file » | 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, 2014 Apple Inc. All rights reserved. 3 * Copyright (C) 2005, 2006, 2008, 2014 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 804 matching lines...) Expand 10 before | Expand all | Expand 10 after
815 break; 815 break;
816 parentElement = grandParentElement; 816 parentElement = grandParentElement;
817 } 817 }
818 818
819 if (elemStack.isEmpty()) 819 if (elemStack.isEmpty())
820 return; 820 return;
821 821
822 for (; !elemStack.isEmpty(); elemStack.removeLast()) { 822 for (; !elemStack.isEmpty(); elemStack.removeLast()) {
823 Element* element = elemStack.last(); 823 Element* element = elemStack.last();
824 AttributeCollection attributes = element->attributes(); 824 AttributeCollection attributes = element->attributes();
825 AttributeCollection::iterator end = attributes.end(); 825 for (auto& attribute : attributes) {
826 for (AttributeCollection::iterator it = attributes.begin(); it != end; + +it) { 826 if (attribute.localName() == xmlnsAtom)
827 if (it->localName() == xmlnsAtom) 827 m_defaultNamespaceURI = attribute.value();
828 m_defaultNamespaceURI = it->value(); 828 else if (attribute.prefix() == xmlnsAtom)
829 else if (it->prefix() == xmlnsAtom) 829 m_prefixToNamespaceMap.set(attribute.localName(), attribute.valu e());
830 m_prefixToNamespaceMap.set(it->localName(), it->value());
831 } 830 }
832 } 831 }
833 832
834 // If the parent element is not in document tree, there may be no xmlns attr ibute; just default to the parent's namespace. 833 // If the parent element is not in document tree, there may be no xmlns attr ibute; just default to the parent's namespace.
835 if (m_defaultNamespaceURI.isNull() && !parentElement->inDocument()) 834 if (m_defaultNamespaceURI.isNull() && !parentElement->inDocument())
836 m_defaultNamespaceURI = parentElement->namespaceURI(); 835 m_defaultNamespaceURI = parentElement->namespaceURI();
837 } 836 }
838 837
839 XMLParserContext::~XMLParserContext() 838 XMLParserContext::~XMLParserContext()
840 { 839 {
(...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after
1640 sax.initialized = XML_SAX2_MAGIC; 1639 sax.initialized = XML_SAX2_MAGIC;
1641 RefPtr<XMLParserContext> parser = XMLParserContext::createStringParser(&sax, &state); 1640 RefPtr<XMLParserContext> parser = XMLParserContext::createStringParser(&sax, &state);
1642 String parseString = "<?xml version=\"1.0\"?><attrs " + string + " />"; 1641 String parseString = "<?xml version=\"1.0\"?><attrs " + string + " />";
1643 parseChunk(parser->context(), parseString); 1642 parseChunk(parser->context(), parseString);
1644 finishParsing(parser->context()); 1643 finishParsing(parser->context());
1645 attrsOK = state.gotAttributes; 1644 attrsOK = state.gotAttributes;
1646 return state.attributes; 1645 return state.attributes;
1647 } 1646 }
1648 1647
1649 } // namespace blink 1648 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/xml/XSLTProcessorLibxslt.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698