OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "core/frame/DeprecatedScheduleStyleRecalcDuringLayout.h" | 5 #include "core/frame/DeprecatedScheduleStyleRecalcDuringLayout.h" |
6 | 6 |
7 #include "wtf/Assertions.h" | 7 #include "platform/wtf/Assertions.h" |
8 | 8 |
9 namespace blink { | 9 namespace blink { |
10 | 10 |
11 DeprecatedScheduleStyleRecalcDuringLayout:: | 11 DeprecatedScheduleStyleRecalcDuringLayout:: |
12 DeprecatedScheduleStyleRecalcDuringLayout(DocumentLifecycle& lifecycle) | 12 DeprecatedScheduleStyleRecalcDuringLayout(DocumentLifecycle& lifecycle) |
13 : lifecycle_(lifecycle), | 13 : lifecycle_(lifecycle), |
14 deprecated_transition_(DocumentLifecycle::kInPerformLayout, | 14 deprecated_transition_(DocumentLifecycle::kInPerformLayout, |
15 DocumentLifecycle::kVisualUpdatePending), | 15 DocumentLifecycle::kVisualUpdatePending), |
16 was_in_perform_layout_(lifecycle.GetState() == | 16 was_in_perform_layout_(lifecycle.GetState() == |
17 DocumentLifecycle::kInPerformLayout) {} | 17 DocumentLifecycle::kInPerformLayout) {} |
18 | 18 |
19 DeprecatedScheduleStyleRecalcDuringLayout:: | 19 DeprecatedScheduleStyleRecalcDuringLayout:: |
20 ~DeprecatedScheduleStyleRecalcDuringLayout() { | 20 ~DeprecatedScheduleStyleRecalcDuringLayout() { |
21 // This block of code is intended to restore the state machine to the | 21 // This block of code is intended to restore the state machine to the |
22 // proper state. The style recalc will still have been schedule, however. | 22 // proper state. The style recalc will still have been schedule, however. |
23 if (was_in_perform_layout_ && | 23 if (was_in_perform_layout_ && |
24 lifecycle_.GetState() != DocumentLifecycle::kInPerformLayout) { | 24 lifecycle_.GetState() != DocumentLifecycle::kInPerformLayout) { |
25 ASSERT(lifecycle_.GetState() == DocumentLifecycle::kVisualUpdatePending); | 25 ASSERT(lifecycle_.GetState() == DocumentLifecycle::kVisualUpdatePending); |
26 lifecycle_.AdvanceTo(DocumentLifecycle::kInPerformLayout); | 26 lifecycle_.AdvanceTo(DocumentLifecycle::kInPerformLayout); |
27 } | 27 } |
28 } | 28 } |
29 | 29 |
30 } // namespace blink | 30 } // namespace blink |
OLD | NEW |