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

Side by Side Diff: sky/engine/core/html/parser/HTMLElementStack.cpp

Issue 788113002: Simplify HTMLStyleElement. (Closed) Base URL: git@github.com:domokit/mojo.git@master
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
« no previous file with comments | « sky/engine/core/html/parser/HTMLElementStack.h ('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) 2010 Google, Inc. All Rights Reserved. 2 * Copyright (C) 2010 Google, Inc. All Rights Reserved.
3 * Copyright (C) 2011 Apple Inc. All rights reserved. 3 * Copyright (C) 2011 Apple Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 } 50 }
51 51
52 HTMLElementStack::~HTMLElementStack() 52 HTMLElementStack::~HTMLElementStack()
53 { 53 {
54 } 54 }
55 55
56 void HTMLElementStack::popAll() 56 void HTMLElementStack::popAll()
57 { 57 {
58 m_rootNode = nullptr; 58 m_rootNode = nullptr;
59 m_stackDepth = 0; 59 m_stackDepth = 0;
60 while (m_top) { 60 while (m_top)
61 Node& node = *topNode();
62 if (node.isElementNode())
63 toElement(node).finishParsingChildren();
64 m_top = m_top->releaseNext(); 61 m_top = m_top->releaseNext();
65 }
66 } 62 }
67 63
68 void HTMLElementStack::pop() 64 void HTMLElementStack::pop()
69 { 65 {
70 popCommon(); 66 popCommon();
71 } 67 }
72 68
73 void HTMLElementStack::popUntil(Element* element) 69 void HTMLElementStack::popUntil(Element* element)
74 { 70 {
75 while (top() != element) 71 while (top() != element)
(...skipping 29 matching lines...) Expand all
105 void HTMLElementStack::pushCommon(PassRefPtr<ContainerNode> node) 101 void HTMLElementStack::pushCommon(PassRefPtr<ContainerNode> node)
106 { 102 {
107 ASSERT(m_rootNode); 103 ASSERT(m_rootNode);
108 104
109 m_stackDepth++; 105 m_stackDepth++;
110 m_top = adoptPtr(new ElementRecord(node, m_top.release())); 106 m_top = adoptPtr(new ElementRecord(node, m_top.release()));
111 } 107 }
112 108
113 void HTMLElementStack::popCommon() 109 void HTMLElementStack::popCommon()
114 { 110 {
115 top()->finishParsingChildren();
116 m_top = m_top->releaseNext(); 111 m_top = m_top->releaseNext();
117 m_stackDepth--; 112 m_stackDepth--;
118 } 113 }
119 114
120 void HTMLElementStack::removeNonTopCommon(Element* element)
121 {
122 ASSERT(top() != element);
123 for (ElementRecord* pos = m_top.get(); pos; pos = pos->next()) {
124 if (pos->next()->element() == element) {
125 // FIXME: Is it OK to call finishParsingChildren()
126 // when the children aren't actually finished?
127 element->finishParsingChildren();
128 pos->setNext(pos->next()->releaseNext());
129 m_stackDepth--;
130 return;
131 }
132 }
133 ASSERT_NOT_REACHED();
134 }
135
136 #ifndef NDEBUG 115 #ifndef NDEBUG
137 116
138 void HTMLElementStack::show() 117 void HTMLElementStack::show()
139 { 118 {
140 for (ElementRecord* record = m_top.get(); record; record = record->next()) 119 for (ElementRecord* record = m_top.get(); record; record = record->next())
141 record->element()->showNode(); 120 record->element()->showNode();
142 } 121 }
143 122
144 #endif 123 #endif
145 124
146 } 125 }
OLDNEW
« no previous file with comments | « sky/engine/core/html/parser/HTMLElementStack.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698