| 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/layout/LayoutBoxModelObject.h" | 5 #include "core/layout/LayoutBoxModelObject.h" |
| 6 | 6 |
| 7 #include "core/dom/DOMTokenList.h" | 7 #include "core/dom/DOMTokenList.h" |
| 8 #include "core/dom/DocumentLifecycle.h" | 8 #include "core/dom/DocumentLifecycle.h" |
| 9 #include "core/html/HTMLElement.h" | 9 #include "core/html/HTMLElement.h" |
| 10 #include "core/layout/ImageQualityController.h" | 10 #include "core/layout/ImageQualityController.h" |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 ToLayoutBoxModelObject(GetLayoutObjectByElementId("sticky")); | 305 ToLayoutBoxModelObject(GetLayoutObjectByElementId("sticky")); |
| 306 LayoutBoxModelObject* target = | 306 LayoutBoxModelObject* target = |
| 307 ToLayoutBoxModelObject(GetLayoutObjectByElementId("target")); | 307 ToLayoutBoxModelObject(GetLayoutObjectByElementId("target")); |
| 308 EXPECT_TRUE( | 308 EXPECT_TRUE( |
| 309 scrollable_area->GetStickyConstraintsMap().Contains(sticky->Layer())); | 309 scrollable_area->GetStickyConstraintsMap().Contains(sticky->Layer())); |
| 310 EXPECT_EQ(25.f, | 310 EXPECT_EQ(25.f, |
| 311 GetScrollContainerRelativeStickyBoxRect( | 311 GetScrollContainerRelativeStickyBoxRect( |
| 312 scrollable_area->GetStickyConstraintsMap().at(sticky->Layer())) | 312 scrollable_area->GetStickyConstraintsMap().at(sticky->Layer())) |
| 313 .Location() | 313 .Location() |
| 314 .X()); | 314 .X()); |
| 315 ToHTMLElement(target->GetNode()) | 315 ToHTMLElement(target->GetNode())->classList().Add("hide"); |
| 316 ->classList() | |
| 317 .add("hide", ASSERT_NO_EXCEPTION); | |
| 318 GetDocument().View()->UpdateLifecycleToLayoutClean(); | 316 GetDocument().View()->UpdateLifecycleToLayoutClean(); |
| 319 // Layout should invalidate the sticky constraints of the sticky element and | 317 // Layout should invalidate the sticky constraints of the sticky element and |
| 320 // mark it as needing a compositing inputs update. | 318 // mark it as needing a compositing inputs update. |
| 321 EXPECT_FALSE( | 319 EXPECT_FALSE( |
| 322 scrollable_area->GetStickyConstraintsMap().Contains(sticky->Layer())); | 320 scrollable_area->GetStickyConstraintsMap().Contains(sticky->Layer())); |
| 323 EXPECT_TRUE(sticky->Layer()->NeedsCompositingInputsUpdate()); | 321 EXPECT_TRUE(sticky->Layer()->NeedsCompositingInputsUpdate()); |
| 324 | 322 |
| 325 // After updating compositing inputs we should have the updated position. | 323 // After updating compositing inputs we should have the updated position. |
| 326 GetDocument().View()->UpdateAllLifecyclePhases(); | 324 GetDocument().View()->UpdateAllLifecyclePhases(); |
| 327 EXPECT_EQ(50.f, | 325 EXPECT_EQ(50.f, |
| (...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 924 | 922 |
| 925 // TODO(smcgruer): Until http://crbug.com/686164 is fixed, we need to update | 923 // TODO(smcgruer): Until http://crbug.com/686164 is fixed, we need to update |
| 926 // the constraints here before calculations will be correct. | 924 // the constraints here before calculations will be correct. |
| 927 inner_sticky->UpdateStickyPositionConstraints(); | 925 inner_sticky->UpdateStickyPositionConstraints(); |
| 928 | 926 |
| 929 EXPECT_EQ(LayoutSize(0, 100), outer_sticky->StickyPositionOffset()); | 927 EXPECT_EQ(LayoutSize(0, 100), outer_sticky->StickyPositionOffset()); |
| 930 EXPECT_EQ(LayoutSize(0, 25), inner_sticky->StickyPositionOffset()); | 928 EXPECT_EQ(LayoutSize(0, 25), inner_sticky->StickyPositionOffset()); |
| 931 } | 929 } |
| 932 | 930 |
| 933 } // namespace blink | 931 } // namespace blink |
| OLD | NEW |