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

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

Issue 482903002: Get rid of loops looking for the first Element ancestor (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix nits Created 6 years, 4 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/rendering/TextAutosizer.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, 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 783 matching lines...) Expand 10 before | Expand all | Expand 10 after
794 { 794 {
795 #if !ENABLE(OILPAN) 795 #if !ENABLE(OILPAN)
796 fragment->ref(); 796 fragment->ref();
797 #endif 797 #endif
798 798
799 // Add namespaces based on the parent node 799 // Add namespaces based on the parent node
800 WillBeHeapVector<RawPtrWillBeMember<Element> > elemStack; 800 WillBeHeapVector<RawPtrWillBeMember<Element> > elemStack;
801 while (parentElement) { 801 while (parentElement) {
802 elemStack.append(parentElement); 802 elemStack.append(parentElement);
803 803
804 ContainerNode* n = parentElement->parentNode(); 804 Element* grandParentElement = parentElement->parentElement();
805 if (!n || !n->isElementNode()) 805 if (!grandParentElement)
806 break; 806 break;
807 parentElement = toElement(n); 807 parentElement = grandParentElement;
808 } 808 }
809 809
810 if (elemStack.isEmpty()) 810 if (elemStack.isEmpty())
811 return; 811 return;
812 812
813 for (; !elemStack.isEmpty(); elemStack.removeLast()) { 813 for (; !elemStack.isEmpty(); elemStack.removeLast()) {
814 Element* element = elemStack.last(); 814 Element* element = elemStack.last();
815 AttributeCollection attributes = element->attributes(); 815 AttributeCollection attributes = element->attributes();
816 AttributeCollection::iterator end = attributes.end(); 816 AttributeCollection::iterator end = attributes.end();
817 for (AttributeCollection::iterator it = attributes.begin(); it != end; + +it) { 817 for (AttributeCollection::iterator it = attributes.begin(); it != end; + +it) {
(...skipping 810 matching lines...) Expand 10 before | Expand all | Expand 10 after
1628 sax.initialized = XML_SAX2_MAGIC; 1628 sax.initialized = XML_SAX2_MAGIC;
1629 RefPtr<XMLParserContext> parser = XMLParserContext::createStringParser(&sax, &state); 1629 RefPtr<XMLParserContext> parser = XMLParserContext::createStringParser(&sax, &state);
1630 String parseString = "<?xml version=\"1.0\"?><attrs " + string + " />"; 1630 String parseString = "<?xml version=\"1.0\"?><attrs " + string + " />";
1631 parseChunk(parser->context(), parseString); 1631 parseChunk(parser->context(), parseString);
1632 finishParsing(parser->context()); 1632 finishParsing(parser->context());
1633 attrsOK = state.gotAttributes; 1633 attrsOK = state.gotAttributes;
1634 return state.attributes; 1634 return state.attributes;
1635 } 1635 }
1636 1636
1637 } // namespace blink 1637 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/rendering/TextAutosizer.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698