OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/dom/Element.h" | 5 #include "core/dom/Element.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include "core/dom/ClientRect.h" | 8 #include "core/dom/ClientRect.h" |
9 #include "core/dom/Document.h" | 9 #include "core/dom/Document.h" |
10 #include "core/editing/EditingTestBase.h" | 10 #include "core/editing/EditingTestBase.h" |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 EXPECT_TRUE(inner_sticky->StyleRef().SubtreeIsSticky()); | 204 EXPECT_TRUE(inner_sticky->StyleRef().SubtreeIsSticky()); |
205 EXPECT_TRUE(great_grandchild->StyleRef().SubtreeIsSticky()); | 205 EXPECT_TRUE(great_grandchild->StyleRef().SubtreeIsSticky()); |
206 | 206 |
207 // This forces 'child' to fork it's StyleRareInheritedData, so that we can | 207 // This forces 'child' to fork it's StyleRareInheritedData, so that we can |
208 // ensure that the sticky subtree update behavior survives forking. | 208 // ensure that the sticky subtree update behavior survives forking. |
209 document.getElementById("child")->SetInlineStyleProperty( | 209 document.getElementById("child")->SetInlineStyleProperty( |
210 CSSPropertyWebkitRubyPosition, CSSValueAfter); | 210 CSSPropertyWebkitRubyPosition, CSSValueAfter); |
211 document.View()->UpdateAllLifecyclePhases(); | 211 document.View()->UpdateAllLifecyclePhases(); |
212 EXPECT_EQ(DocumentLifecycle::kPaintClean, document.Lifecycle().GetState()); | 212 EXPECT_EQ(DocumentLifecycle::kPaintClean, document.Lifecycle().GetState()); |
213 | 213 |
214 EXPECT_EQ(kRubyPositionBefore, outer_sticky->StyleRef().GetRubyPosition()); | 214 EXPECT_EQ(RubyPosition::kBefore, outer_sticky->StyleRef().GetRubyPosition()); |
215 EXPECT_EQ(kRubyPositionAfter, child->StyleRef().GetRubyPosition()); | 215 EXPECT_EQ(RubyPosition::kAfter, child->StyleRef().GetRubyPosition()); |
216 EXPECT_EQ(kRubyPositionAfter, grandchild->StyleRef().GetRubyPosition()); | 216 EXPECT_EQ(RubyPosition::kAfter, grandchild->StyleRef().GetRubyPosition()); |
217 EXPECT_EQ(kRubyPositionAfter, inner_sticky->StyleRef().GetRubyPosition()); | 217 EXPECT_EQ(RubyPosition::kAfter, inner_sticky->StyleRef().GetRubyPosition()); |
218 EXPECT_EQ(kRubyPositionAfter, great_grandchild->StyleRef().GetRubyPosition()); | 218 EXPECT_EQ(RubyPosition::kAfter, |
| 219 great_grandchild->StyleRef().GetRubyPosition()); |
219 | 220 |
220 // Setting -webkit-ruby value shouldn't have affected the sticky subtree bit. | 221 // Setting -webkit-ruby value shouldn't have affected the sticky subtree bit. |
221 EXPECT_TRUE(outer_sticky->StyleRef().SubtreeIsSticky()); | 222 EXPECT_TRUE(outer_sticky->StyleRef().SubtreeIsSticky()); |
222 EXPECT_TRUE(child->StyleRef().SubtreeIsSticky()); | 223 EXPECT_TRUE(child->StyleRef().SubtreeIsSticky()); |
223 EXPECT_TRUE(grandchild->StyleRef().SubtreeIsSticky()); | 224 EXPECT_TRUE(grandchild->StyleRef().SubtreeIsSticky()); |
224 EXPECT_TRUE(inner_sticky->StyleRef().SubtreeIsSticky()); | 225 EXPECT_TRUE(inner_sticky->StyleRef().SubtreeIsSticky()); |
225 EXPECT_TRUE(great_grandchild->StyleRef().SubtreeIsSticky()); | 226 EXPECT_TRUE(great_grandchild->StyleRef().SubtreeIsSticky()); |
226 | 227 |
227 // Now switch 'outerSticky' back to being non-sticky - all descendents between | 228 // Now switch 'outerSticky' back to being non-sticky - all descendents between |
228 // it and the 'innerSticky' should be updated, and the 'innerSticky' should | 229 // it and the 'innerSticky' should be updated, and the 'innerSticky' should |
229 // fork it's StyleRareInheritedData to maintain the sticky subtree bit. | 230 // fork it's StyleRareInheritedData to maintain the sticky subtree bit. |
230 document.getElementById("outerSticky") | 231 document.getElementById("outerSticky") |
231 ->SetInlineStyleProperty(CSSPropertyPosition, CSSValueStatic); | 232 ->SetInlineStyleProperty(CSSPropertyPosition, CSSValueStatic); |
232 document.View()->UpdateAllLifecyclePhases(); | 233 document.View()->UpdateAllLifecyclePhases(); |
233 EXPECT_EQ(DocumentLifecycle::kPaintClean, document.Lifecycle().GetState()); | 234 EXPECT_EQ(DocumentLifecycle::kPaintClean, document.Lifecycle().GetState()); |
234 | 235 |
235 EXPECT_FALSE(outer_sticky->StyleRef().SubtreeIsSticky()); | 236 EXPECT_FALSE(outer_sticky->StyleRef().SubtreeIsSticky()); |
236 EXPECT_FALSE(child->StyleRef().SubtreeIsSticky()); | 237 EXPECT_FALSE(child->StyleRef().SubtreeIsSticky()); |
237 EXPECT_FALSE(grandchild->StyleRef().SubtreeIsSticky()); | 238 EXPECT_FALSE(grandchild->StyleRef().SubtreeIsSticky()); |
238 EXPECT_TRUE(inner_sticky->StyleRef().SubtreeIsSticky()); | 239 EXPECT_TRUE(inner_sticky->StyleRef().SubtreeIsSticky()); |
239 EXPECT_TRUE(great_grandchild->StyleRef().SubtreeIsSticky()); | 240 EXPECT_TRUE(great_grandchild->StyleRef().SubtreeIsSticky()); |
240 } | 241 } |
241 | 242 |
242 } // namespace blink | 243 } // namespace blink |
OLD | NEW |