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

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

Issue 177613003: Consistently cache ElementData::length() before loops (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix test failure Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/xml/XPathStep.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 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 819 matching lines...) Expand 10 before | Expand all | Expand 10 after
830 break; 830 break;
831 parentElement = toElement(n); 831 parentElement = toElement(n);
832 } 832 }
833 833
834 if (elemStack.isEmpty()) 834 if (elemStack.isEmpty())
835 return; 835 return;
836 836
837 for (; !elemStack.isEmpty(); elemStack.removeLast()) { 837 for (; !elemStack.isEmpty(); elemStack.removeLast()) {
838 Element* element = elemStack.last(); 838 Element* element = elemStack.last();
839 if (element->hasAttributes()) { 839 if (element->hasAttributes()) {
840 for (unsigned i = 0; i < element->attributeCount(); i++) { 840 unsigned attributeCount = element->attributeCount();
841 for (unsigned i = 0; i < attributeCount; ++i) {
841 const Attribute* attribute = element->attributeItem(i); 842 const Attribute* attribute = element->attributeItem(i);
842 if (attribute->localName() == xmlnsAtom) 843 if (attribute->localName() == xmlnsAtom)
843 m_defaultNamespaceURI = attribute->value(); 844 m_defaultNamespaceURI = attribute->value();
844 else if (attribute->prefix() == xmlnsAtom) 845 else if (attribute->prefix() == xmlnsAtom)
845 m_prefixToNamespaceMap.set(attribute->localName(), attribute ->value()); 846 m_prefixToNamespaceMap.set(attribute->localName(), attribute ->value());
846 } 847 }
847 } 848 }
848 } 849 }
849 850
850 // If the parent element is not in document tree, there may be no xmlns attr ibute; just default to the parent's namespace. 851 // If the parent element is not in document tree, there may be no xmlns attr ibute; just default to the parent's namespace.
(...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after
1633 sax.initialized = XML_SAX2_MAGIC; 1634 sax.initialized = XML_SAX2_MAGIC;
1634 RefPtr<XMLParserContext> parser = XMLParserContext::createStringParser(&sax, &state); 1635 RefPtr<XMLParserContext> parser = XMLParserContext::createStringParser(&sax, &state);
1635 String parseString = "<?xml version=\"1.0\"?><attrs " + string + " />"; 1636 String parseString = "<?xml version=\"1.0\"?><attrs " + string + " />";
1636 parseChunk(parser->context(), parseString); 1637 parseChunk(parser->context(), parseString);
1637 finishParsing(parser->context()); 1638 finishParsing(parser->context());
1638 attrsOK = state.gotAttributes; 1639 attrsOK = state.gotAttributes;
1639 return state.attributes; 1640 return state.attributes;
1640 } 1641 }
1641 1642
1642 } // namespace WebCore 1643 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/xml/XPathStep.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698