| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |