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

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

Issue 798963002: Only populate line number in case parsing synchronously. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years 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
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 1489 matching lines...) Expand 10 before | Expand all | Expand 10 after
1500 if (source.isEmpty()) 1500 if (source.isEmpty())
1501 return 0; 1501 return 0;
1502 // Parse in a single chunk into an xmlDocPtr 1502 // Parse in a single chunk into an xmlDocPtr
1503 // FIXME: Hook up error handlers so that a failure to parse the main 1503 // FIXME: Hook up error handlers so that a failure to parse the main
1504 // document results in good error messages. 1504 // document results in good error messages.
1505 XMLDocumentParserScope scope(fetcher, errorFunc, 0); 1505 XMLDocumentParserScope scope(fetcher, errorFunc, 0);
1506 XMLParserInput input(source); 1506 XMLParserInput input(source);
1507 return xmlReadMemory(input.data(), input.size(), url.latin1().data(), input. encoding(), XSLT_PARSE_OPTIONS); 1507 return xmlReadMemory(input.data(), input.size(), url.latin1().data(), input. encoding(), XSLT_PARSE_OPTIONS);
1508 } 1508 }
1509 1509
1510 bool XMLDocumentParser::hasLineNumber() const
1511 {
1512 return true;
rmcilroy 2014/12/12 14:18:31 maybe return isParsing()?
pfeldman 2014/12/12 17:21:06 Done, all necessary checks are in ScriptableDocume
1513 }
1514
1510 OrdinalNumber XMLDocumentParser::lineNumber() const 1515 OrdinalNumber XMLDocumentParser::lineNumber() const
1511 { 1516 {
1512 return OrdinalNumber::fromOneBasedInt(context() ? context()->input->line : 1 ); 1517 return OrdinalNumber::fromOneBasedInt(context() ? context()->input->line : 1 );
1513 } 1518 }
1514 1519
1515 OrdinalNumber XMLDocumentParser::columnNumber() const 1520 OrdinalNumber XMLDocumentParser::columnNumber() const
1516 { 1521 {
1517 return OrdinalNumber::fromOneBasedInt(context() ? context()->input->col : 1) ; 1522 return OrdinalNumber::fromOneBasedInt(context() ? context()->input->col : 1) ;
1518 } 1523 }
1519 1524
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
1640 sax.initialized = XML_SAX2_MAGIC; 1645 sax.initialized = XML_SAX2_MAGIC;
1641 RefPtr<XMLParserContext> parser = XMLParserContext::createStringParser(&sax, &state); 1646 RefPtr<XMLParserContext> parser = XMLParserContext::createStringParser(&sax, &state);
1642 String parseString = "<?xml version=\"1.0\"?><attrs " + string + " />"; 1647 String parseString = "<?xml version=\"1.0\"?><attrs " + string + " />";
1643 parseChunk(parser->context(), parseString); 1648 parseChunk(parser->context(), parseString);
1644 finishParsing(parser->context()); 1649 finishParsing(parser->context());
1645 attrsOK = state.gotAttributes; 1650 attrsOK = state.gotAttributes;
1646 return state.attributes; 1651 return state.attributes;
1647 } 1652 }
1648 1653
1649 } // namespace blink 1654 } // namespace blink
OLDNEW
« Source/core/html/parser/HTMLDocumentParser.cpp ('K') | « Source/core/xml/parser/XMLDocumentParser.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698