| 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 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 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 XMLErrors::ErrorType m_type; | 292 XMLErrors::ErrorType m_type; |
| 293 xmlChar* m_message; | 293 xmlChar* m_message; |
| 294 OrdinalNumber m_lineNumber; | 294 OrdinalNumber m_lineNumber; |
| 295 OrdinalNumber m_columnNumber; | 295 OrdinalNumber m_columnNumber; |
| 296 }; | 296 }; |
| 297 | 297 |
| 298 void XMLDocumentParser::pushCurrentNode(ContainerNode* n) | 298 void XMLDocumentParser::pushCurrentNode(ContainerNode* n) |
| 299 { | 299 { |
| 300 ASSERT(n); | 300 ASSERT(n); |
| 301 ASSERT(m_currentNode); | 301 ASSERT(m_currentNode); |
| 302 #if !ENABLE(OILPAN) |
| 302 if (n != document()) | 303 if (n != document()) |
| 303 n->ref(); | 304 n->ref(); |
| 305 #endif |
| 304 m_currentNodeStack.append(m_currentNode); | 306 m_currentNodeStack.append(m_currentNode); |
| 305 m_currentNode = n; | 307 m_currentNode = n; |
| 306 if (m_currentNodeStack.size() > maxXMLTreeDepth) | 308 if (m_currentNodeStack.size() > maxXMLTreeDepth) |
| 307 handleError(XMLErrors::fatal, "Excessive node nesting.", textPosition())
; | 309 handleError(XMLErrors::fatal, "Excessive node nesting.", textPosition())
; |
| 308 } | 310 } |
| 309 | 311 |
| 310 void XMLDocumentParser::popCurrentNode() | 312 void XMLDocumentParser::popCurrentNode() |
| 311 { | 313 { |
| 312 if (!m_currentNode) | 314 if (!m_currentNode) |
| 313 return; | 315 return; |
| 314 ASSERT(m_currentNodeStack.size()); | 316 ASSERT(m_currentNodeStack.size()); |
| 315 | 317 #if !ENABLE(OILPAN) |
| 316 if (m_currentNode != document()) | 318 if (m_currentNode != document()) |
| 317 m_currentNode->deref(); | 319 m_currentNode->deref(); |
| 318 | 320 #endif |
| 319 m_currentNode = m_currentNodeStack.last(); | 321 m_currentNode = m_currentNodeStack.last(); |
| 320 m_currentNodeStack.removeLast(); | 322 m_currentNodeStack.removeLast(); |
| 321 } | 323 } |
| 322 | 324 |
| 323 void XMLDocumentParser::clearCurrentNodeStack() | 325 void XMLDocumentParser::clearCurrentNodeStack() |
| 324 { | 326 { |
| 327 #if !ENABLE(OILPAN) |
| 325 if (m_currentNode && m_currentNode != document()) | 328 if (m_currentNode && m_currentNode != document()) |
| 326 m_currentNode->deref(); | 329 m_currentNode->deref(); |
| 330 #endif |
| 327 m_currentNode = nullptr; | 331 m_currentNode = nullptr; |
| 328 m_leafTextNode = nullptr; | 332 m_leafTextNode = nullptr; |
| 329 | 333 |
| 330 if (m_currentNodeStack.size()) { // Aborted parsing. | 334 if (m_currentNodeStack.size()) { // Aborted parsing. |
| 335 #if !ENABLE(OILPAN) |
| 331 for (size_t i = m_currentNodeStack.size() - 1; i != 0; --i) | 336 for (size_t i = m_currentNodeStack.size() - 1; i != 0; --i) |
| 332 m_currentNodeStack[i]->deref(); | 337 m_currentNodeStack[i]->deref(); |
| 333 if (m_currentNodeStack[0] && m_currentNodeStack[0] != document()) | 338 if (m_currentNodeStack[0] && m_currentNodeStack[0] != document()) |
| 334 m_currentNodeStack[0]->deref(); | 339 m_currentNodeStack[0]->deref(); |
| 340 #endif |
| 335 m_currentNodeStack.clear(); | 341 m_currentNodeStack.clear(); |
| 336 } | 342 } |
| 337 } | 343 } |
| 338 | 344 |
| 339 void XMLDocumentParser::insert(const SegmentedString&) | 345 void XMLDocumentParser::insert(const SegmentedString&) |
| 340 { | 346 { |
| 341 ASSERT_NOT_REACHED(); | 347 ASSERT_NOT_REACHED(); |
| 342 } | 348 } |
| 343 | 349 |
| 344 void XMLDocumentParser::append(PassRefPtr<StringImpl> inputSource) | 350 void XMLDocumentParser::append(PassRefPtr<StringImpl> inputSource) |
| (...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 775 , m_sawFirstElement(false) | 781 , m_sawFirstElement(false) |
| 776 , m_isXHTMLDocument(false) | 782 , m_isXHTMLDocument(false) |
| 777 , m_parserPaused(false) | 783 , m_parserPaused(false) |
| 778 , m_requestingScript(false) | 784 , m_requestingScript(false) |
| 779 , m_finishCalled(false) | 785 , m_finishCalled(false) |
| 780 , m_xmlErrors(&fragment->document()) | 786 , m_xmlErrors(&fragment->document()) |
| 781 , m_pendingScript(0) | 787 , m_pendingScript(0) |
| 782 , m_scriptStartPosition(TextPosition::belowRangePosition()) | 788 , m_scriptStartPosition(TextPosition::belowRangePosition()) |
| 783 , m_parsingFragment(true) | 789 , m_parsingFragment(true) |
| 784 { | 790 { |
| 791 #if !ENABLE(OILPAN) |
| 785 fragment->ref(); | 792 fragment->ref(); |
| 793 #endif |
| 786 | 794 |
| 787 // Add namespaces based on the parent node | 795 // Add namespaces based on the parent node |
| 788 Vector<Element*> elemStack; | 796 WillBeHeapVector<RawPtrWillBeMember<Element> > elemStack; |
| 789 while (parentElement) { | 797 while (parentElement) { |
| 790 elemStack.append(parentElement); | 798 elemStack.append(parentElement); |
| 791 | 799 |
| 792 ContainerNode* n = parentElement->parentNode(); | 800 ContainerNode* n = parentElement->parentNode(); |
| 793 if (!n || !n->isElementNode()) | 801 if (!n || !n->isElementNode()) |
| 794 break; | 802 break; |
| 795 parentElement = toElement(n); | 803 parentElement = toElement(n); |
| 796 } | 804 } |
| 797 | 805 |
| 798 if (elemStack.isEmpty()) | 806 if (elemStack.isEmpty()) |
| (...skipping 811 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1610 sax.initialized = XML_SAX2_MAGIC; | 1618 sax.initialized = XML_SAX2_MAGIC; |
| 1611 RefPtr<XMLParserContext> parser = XMLParserContext::createStringParser(&sax,
&state); | 1619 RefPtr<XMLParserContext> parser = XMLParserContext::createStringParser(&sax,
&state); |
| 1612 String parseString = "<?xml version=\"1.0\"?><attrs " + string + " />"; | 1620 String parseString = "<?xml version=\"1.0\"?><attrs " + string + " />"; |
| 1613 parseChunk(parser->context(), parseString); | 1621 parseChunk(parser->context(), parseString); |
| 1614 finishParsing(parser->context()); | 1622 finishParsing(parser->context()); |
| 1615 attrsOK = state.gotAttributes; | 1623 attrsOK = state.gotAttributes; |
| 1616 return state.attributes; | 1624 return state.attributes; |
| 1617 } | 1625 } |
| 1618 | 1626 |
| 1619 } // namespace WebCore | 1627 } // namespace WebCore |
| OLD | NEW |