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. | 8 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. |
9 * (http://www.torchmobile.com/) | 9 * (http://www.torchmobile.com/) |
10 * | 10 * |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 if (m_currentNodeStack.size() > maxXMLTreeDepth) | 302 if (m_currentNodeStack.size() > maxXMLTreeDepth) |
303 handleError(XMLErrors::ErrorTypeFatal, "Excessive node nesting.", | 303 handleError(XMLErrors::ErrorTypeFatal, "Excessive node nesting.", |
304 textPosition()); | 304 textPosition()); |
305 } | 305 } |
306 | 306 |
307 void XMLDocumentParser::popCurrentNode() { | 307 void XMLDocumentParser::popCurrentNode() { |
308 if (!m_currentNode) | 308 if (!m_currentNode) |
309 return; | 309 return; |
310 DCHECK(m_currentNodeStack.size()); | 310 DCHECK(m_currentNodeStack.size()); |
311 m_currentNode = m_currentNodeStack.last(); | 311 m_currentNode = m_currentNodeStack.last(); |
312 m_currentNodeStack.removeLast(); | 312 m_currentNodeStack.pop_back(); |
313 } | 313 } |
314 | 314 |
315 void XMLDocumentParser::clearCurrentNodeStack() { | 315 void XMLDocumentParser::clearCurrentNodeStack() { |
316 m_currentNode = nullptr; | 316 m_currentNode = nullptr; |
317 m_leafTextNode = nullptr; | 317 m_leafTextNode = nullptr; |
318 | 318 |
319 if (m_currentNodeStack.size()) { // Aborted parsing. | 319 if (m_currentNodeStack.size()) { // Aborted parsing. |
320 m_currentNodeStack.clear(); | 320 m_currentNodeStack.clear(); |
321 } | 321 } |
322 } | 322 } |
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
810 | 810 |
811 Element* grandParentElement = parentElement->parentElement(); | 811 Element* grandParentElement = parentElement->parentElement(); |
812 if (!grandParentElement) | 812 if (!grandParentElement) |
813 break; | 813 break; |
814 parentElement = grandParentElement; | 814 parentElement = grandParentElement; |
815 } | 815 } |
816 | 816 |
817 if (elemStack.isEmpty()) | 817 if (elemStack.isEmpty()) |
818 return; | 818 return; |
819 | 819 |
820 for (; !elemStack.isEmpty(); elemStack.removeLast()) { | 820 for (; !elemStack.isEmpty(); elemStack.pop_back()) { |
821 Element* element = elemStack.last(); | 821 Element* element = elemStack.last(); |
822 AttributeCollection attributes = element->attributes(); | 822 AttributeCollection attributes = element->attributes(); |
823 for (auto& attribute : attributes) { | 823 for (auto& attribute : attributes) { |
824 if (attribute.localName() == xmlnsAtom) | 824 if (attribute.localName() == xmlnsAtom) |
825 m_defaultNamespaceURI = attribute.value(); | 825 m_defaultNamespaceURI = attribute.value(); |
826 else if (attribute.prefix() == xmlnsAtom) | 826 else if (attribute.prefix() == xmlnsAtom) |
827 m_prefixToNamespaceMap.set(attribute.localName(), attribute.value()); | 827 m_prefixToNamespaceMap.set(attribute.localName(), attribute.value()); |
828 } | 828 } |
829 } | 829 } |
830 | 830 |
(...skipping 876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1707 RefPtr<XMLParserContext> parser = | 1707 RefPtr<XMLParserContext> parser = |
1708 XMLParserContext::createStringParser(&sax, &state); | 1708 XMLParserContext::createStringParser(&sax, &state); |
1709 String parseString = "<?xml version=\"1.0\"?><attrs " + string + " />"; | 1709 String parseString = "<?xml version=\"1.0\"?><attrs " + string + " />"; |
1710 parseChunk(parser->context(), parseString); | 1710 parseChunk(parser->context(), parseString); |
1711 finishParsing(parser->context()); | 1711 finishParsing(parser->context()); |
1712 attrsOK = state.gotAttributes; | 1712 attrsOK = state.gotAttributes; |
1713 return state.attributes; | 1713 return state.attributes; |
1714 } | 1714 } |
1715 | 1715 |
1716 } // namespace blink | 1716 } // namespace blink |
OLD | NEW |