| 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 State m_to; | 92 State m_to; |
| 93 }; | 93 }; |
| 94 | 94 |
| 95 DocumentLifecycle(); | 95 DocumentLifecycle(); |
| 96 ~DocumentLifecycle(); | 96 ~DocumentLifecycle(); |
| 97 | 97 |
| 98 bool isActive() const { return m_state > Inactive && m_state < Stopping; } | 98 bool isActive() const { return m_state > Inactive && m_state < Stopping; } |
| 99 State state() const { return m_state; } | 99 State state() const { return m_state; } |
| 100 | 100 |
| 101 bool stateAllowsTreeMutations() const; | 101 bool stateAllowsTreeMutations() const; |
| 102 bool stateAllowsRenderTreeMutations() const; |
| 102 | 103 |
| 103 void advanceTo(State); | 104 void advanceTo(State); |
| 104 void ensureStateAtMost(State); | 105 void ensureStateAtMost(State); |
| 105 | 106 |
| 106 private: | 107 private: |
| 107 #if !ASSERT_DISABLED | 108 #if !ASSERT_DISABLED |
| 108 bool canAdvanceTo(State) const; | 109 bool canAdvanceTo(State) const; |
| 109 bool canRewindTo(State) const; | 110 bool canRewindTo(State) const; |
| 110 #endif | 111 #endif |
| 111 | 112 |
| 112 State m_state; | 113 State m_state; |
| 113 }; | 114 }; |
| 114 | 115 |
| 115 inline bool DocumentLifecycle::stateAllowsTreeMutations() const | 116 inline bool DocumentLifecycle::stateAllowsTreeMutations() const |
| 116 { | 117 { |
| 117 // FIXME: We should not allow mutations in InPreLayout or AfterPerformLayout
either, | 118 // FIXME: We should not allow mutations in InPreLayout or AfterPerformLayout
either, |
| 118 // but we need to fix MediaList listeners and plugins first. | 119 // but we need to fix MediaList listeners and plugins first. |
| 119 return m_state != InStyleRecalc | 120 return m_state != InStyleRecalc |
| 120 && m_state != InPerformLayout | 121 && m_state != InPerformLayout |
| 121 && m_state != InCompositingUpdate; | 122 && m_state != InCompositingUpdate; |
| 122 } | 123 } |
| 123 | 124 |
| 125 inline bool DocumentLifecycle::stateAllowsRenderTreeMutations() const |
| 126 { |
| 127 return m_state == InStyleRecalc; |
| 128 } |
| 129 |
| 124 } | 130 } |
| 125 | 131 |
| 126 #endif | 132 #endif |
| OLD | NEW |