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

Side by Side Diff: Source/core/dom/CustomElementUpgradeCandidateMap.cpp

Issue 23009004: Process Custom Elements in post-order. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Patch for landing. Created 7 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/dom/CustomElementUpgradeCandidateMap.h ('k') | Source/core/dom/Element.cpp » ('j') | 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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 { 71 {
72 UpgradeCandidateMap::iterator candidate = m_upgradeCandidates.find(element); 72 UpgradeCandidateMap::iterator candidate = m_upgradeCandidates.find(element);
73 ASSERT(candidate != m_upgradeCandidates.end()); 73 ASSERT(candidate != m_upgradeCandidates.end());
74 74
75 UnresolvedDefinitionMap::iterator elements = m_unresolvedDefinitions.find(ca ndidate->value); 75 UnresolvedDefinitionMap::iterator elements = m_unresolvedDefinitions.find(ca ndidate->value);
76 ASSERT(elements != m_unresolvedDefinitions.end()); 76 ASSERT(elements != m_unresolvedDefinitions.end());
77 elements->value.remove(element); 77 elements->value.remove(element);
78 m_upgradeCandidates.remove(candidate); 78 m_upgradeCandidates.remove(candidate);
79 } 79 }
80 80
81 void CustomElementUpgradeCandidateMap::elementDidFinishParsingChildren(Element* element)
82 {
83 // An upgrade candidate finished parsing; reorder so that eventual
84 // upgrade order matches finished-parsing order.
85 moveToEnd(element);
86 }
87
88 void CustomElementUpgradeCandidateMap::moveToEnd(Element* element)
89 {
90 UpgradeCandidateMap::iterator candidate = m_upgradeCandidates.find(element);
91 ASSERT(candidate != m_upgradeCandidates.end());
92
93 UnresolvedDefinitionMap::iterator elements = m_unresolvedDefinitions.find(ca ndidate->value);
94 ASSERT(elements != m_unresolvedDefinitions.end());
95 elements->value.appendOrMoveToLast(element);
96 }
97
81 ListHashSet<Element*> CustomElementUpgradeCandidateMap::takeUpgradeCandidatesFor (const CustomElementDescriptor& descriptor) 98 ListHashSet<Element*> CustomElementUpgradeCandidateMap::takeUpgradeCandidatesFor (const CustomElementDescriptor& descriptor)
82 { 99 {
83 const ListHashSet<Element*>& candidates = m_unresolvedDefinitions.take(descr iptor); 100 const ListHashSet<Element*>& candidates = m_unresolvedDefinitions.take(descr iptor);
84 101
85 for (ElementSet::const_iterator candidate = candidates.begin(); candidate != candidates.end(); ++candidate) { 102 for (ElementSet::const_iterator candidate = candidates.begin(); candidate != candidates.end(); ++candidate) {
86 unobserve(*candidate); 103 unobserve(*candidate);
87 m_upgradeCandidates.remove(*candidate); 104 m_upgradeCandidates.remove(*candidate);
88 } 105 }
89 106
90 return candidates; 107 return candidates;
91 } 108 }
92 109
93 } 110 }
OLDNEW
« no previous file with comments | « Source/core/dom/CustomElementUpgradeCandidateMap.h ('k') | Source/core/dom/Element.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698