OLD | NEW |
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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 DocumentLifecycle& m_documentLifecycle; | 115 DocumentLifecycle& m_documentLifecycle; |
116 }; | 116 }; |
117 | 117 |
118 DocumentLifecycle(); | 118 DocumentLifecycle(); |
119 ~DocumentLifecycle(); | 119 ~DocumentLifecycle(); |
120 | 120 |
121 bool isActive() const { return m_state > Inactive && m_state < Stopping; } | 121 bool isActive() const { return m_state > Inactive && m_state < Stopping; } |
122 State state() const { return m_state; } | 122 State state() const { return m_state; } |
123 | 123 |
124 bool stateAllowsTreeMutations() const; | 124 bool stateAllowsTreeMutations() const; |
125 bool stateAllowsRenderTreeMutations() const; | 125 bool stateAllowsLayoutTreeMutations() const; |
126 bool stateAllowsDetach() const; | 126 bool stateAllowsDetach() const; |
127 bool stateAllowsLayoutInvalidation() const; | 127 bool stateAllowsLayoutInvalidation() const; |
128 | 128 |
129 void advanceTo(State); | 129 void advanceTo(State); |
130 void ensureStateAtMost(State); | 130 void ensureStateAtMost(State); |
131 | 131 |
132 void incrementDetachCount() { m_detachCount++; } | 132 void incrementDetachCount() { m_detachCount++; } |
133 void decrementDetachCount() | 133 void decrementDetachCount() |
134 { | 134 { |
135 ASSERT(m_detachCount > 0); | 135 ASSERT(m_detachCount > 0); |
(...skipping 12 matching lines...) Expand all Loading... |
148 | 148 |
149 inline bool DocumentLifecycle::stateAllowsTreeMutations() const | 149 inline bool DocumentLifecycle::stateAllowsTreeMutations() const |
150 { | 150 { |
151 // FIXME: We should not allow mutations in InPreLayout or AfterPerformLayout
either, | 151 // FIXME: We should not allow mutations in InPreLayout or AfterPerformLayout
either, |
152 // but we need to fix MediaList listeners and plugins first. | 152 // but we need to fix MediaList listeners and plugins first. |
153 return m_state != InStyleRecalc | 153 return m_state != InStyleRecalc |
154 && m_state != InPerformLayout | 154 && m_state != InPerformLayout |
155 && m_state != InCompositingUpdate; | 155 && m_state != InCompositingUpdate; |
156 } | 156 } |
157 | 157 |
158 inline bool DocumentLifecycle::stateAllowsRenderTreeMutations() const | 158 inline bool DocumentLifecycle::stateAllowsLayoutTreeMutations() const |
159 { | 159 { |
160 return m_detachCount || m_state == InStyleRecalc; | 160 return m_detachCount || m_state == InStyleRecalc; |
161 } | 161 } |
162 | 162 |
163 inline bool DocumentLifecycle::stateAllowsDetach() const | 163 inline bool DocumentLifecycle::stateAllowsDetach() const |
164 { | 164 { |
165 return m_state == VisualUpdatePending | 165 return m_state == VisualUpdatePending |
166 || m_state == InStyleRecalc | 166 || m_state == InStyleRecalc |
167 || m_state == StyleClean | 167 || m_state == StyleClean |
168 || m_state == InPreLayout | 168 || m_state == InPreLayout |
169 || m_state == LayoutClean | 169 || m_state == LayoutClean |
170 || m_state == CompositingClean | 170 || m_state == CompositingClean |
171 || m_state == PaintInvalidationClean | 171 || m_state == PaintInvalidationClean |
172 || m_state == Stopping; | 172 || m_state == Stopping; |
173 } | 173 } |
174 | 174 |
175 inline bool DocumentLifecycle::stateAllowsLayoutInvalidation() const | 175 inline bool DocumentLifecycle::stateAllowsLayoutInvalidation() const |
176 { | 176 { |
177 return m_state != InPerformLayout | 177 return m_state != InPerformLayout |
178 && m_state != InCompositingUpdate | 178 && m_state != InCompositingUpdate |
179 && m_state != InPaintInvalidation; | 179 && m_state != InPaintInvalidation; |
180 } | 180 } |
181 | 181 |
182 } // namespace blink | 182 } // namespace blink |
183 | 183 |
184 #endif | 184 #endif |
OLD | NEW |