| 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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 if (state == InPerformLayout) | 120 if (state == InPerformLayout) |
| 121 return true; | 121 return true; |
| 122 // We can redundant arrive in the layout clean state. This situation | 122 // We can redundant arrive in the layout clean state. This situation |
| 123 // can happen when we call layout recursively and we unwind the stack. | 123 // can happen when we call layout recursively and we unwind the stack. |
| 124 if (state == LayoutClean) | 124 if (state == LayoutClean) |
| 125 return true; | 125 return true; |
| 126 if (state == StyleClean) | 126 if (state == StyleClean) |
| 127 return true; | 127 return true; |
| 128 return false; | 128 return false; |
| 129 } | 129 } |
| 130 if (m_state == CompositingClean) { | |
| 131 if (state == InStyleRecalc) | |
| 132 return true; | |
| 133 if (state == InCompositingUpdate) | |
| 134 return true; | |
| 135 if (state == InPaintInvalidation) | |
| 136 return true; | |
| 137 return false; | |
| 138 } | |
| 139 if (m_state == InPaintInvalidation) { | 130 if (m_state == InPaintInvalidation) { |
| 140 if (state == PaintInvalidationClean) | 131 if (state == PaintInvalidationClean) |
| 141 return true; | 132 return true; |
| 142 return false; | 133 return false; |
| 143 } | 134 } |
| 144 if (m_state == PaintInvalidationClean) { | 135 if (m_state == PaintInvalidationClean) { |
| 145 if (state == InStyleRecalc) | 136 if (state == InStyleRecalc) |
| 146 return true; | 137 return true; |
| 147 if (state == InPreLayout) | 138 if (state == InPreLayout) |
| 148 return true; | 139 return true; |
| 149 if (state == InCompositingUpdate) | |
| 150 return true; | |
| 151 return false; | 140 return false; |
| 152 } | 141 } |
| 153 return false; | 142 return false; |
| 154 } | 143 } |
| 155 | 144 |
| 156 bool DocumentLifecycle::canRewindTo(State state) const | 145 bool DocumentLifecycle::canRewindTo(State state) const |
| 157 { | 146 { |
| 158 // This transition is bogus, but we've whitelisted it anyway. | 147 // This transition is bogus, but we've whitelisted it anyway. |
| 159 if (s_deprecatedTransitionStack && m_state == s_deprecatedTransitionStack->f
rom() && state == s_deprecatedTransitionStack->to()) | 148 if (s_deprecatedTransitionStack && m_state == s_deprecatedTransitionStack->f
rom() && state == s_deprecatedTransitionStack->to()) |
| 160 return true; | 149 return true; |
| 161 return m_state == StyleClean || m_state == AfterPerformLayout || m_state ==
LayoutClean || m_state == CompositingClean || m_state == PaintInvalidationClean; | 150 return m_state == StyleClean || m_state == AfterPerformLayout || m_state ==
LayoutClean || m_state == PaintInvalidationClean; |
| 162 } | 151 } |
| 163 | 152 |
| 164 #endif | 153 #endif |
| 165 | 154 |
| 166 void DocumentLifecycle::advanceTo(State state) | 155 void DocumentLifecycle::advanceTo(State state) |
| 167 { | 156 { |
| 168 ASSERT(canAdvanceTo(state)); | 157 ASSERT(canAdvanceTo(state)); |
| 169 m_state = state; | 158 m_state = state; |
| 170 } | 159 } |
| 171 | 160 |
| 172 void DocumentLifecycle::ensureStateAtMost(State state) | 161 void DocumentLifecycle::ensureStateAtMost(State state) |
| 173 { | 162 { |
| 174 ASSERT(state == VisualUpdatePending || state == StyleClean || state == Layou
tClean); | 163 ASSERT(state == VisualUpdatePending || state == StyleClean || state == Layou
tClean); |
| 175 if (m_state <= state) | 164 if (m_state <= state) |
| 176 return; | 165 return; |
| 177 ASSERT(canRewindTo(state)); | 166 ASSERT(canRewindTo(state)); |
| 178 m_state = state; | 167 m_state = state; |
| 179 } | 168 } |
| 180 | 169 |
| 181 } | 170 } |
| OLD | NEW |