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/html/HTMLElement.h" | 7 #include "core/html/HTMLElement.h" |
8 #include "core/layout/ImageQualityController.h" | 8 #include "core/layout/ImageQualityController.h" |
9 #include "core/layout/LayoutTestHelper.h" | 9 #include "core/layout/LayoutTestHelper.h" |
10 #include "core/page/scrolling/StickyPositionScrollingConstraints.h" | 10 #include "core/page/scrolling/StickyPositionScrollingConstraints.h" |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 | 242 |
243 const StickyPositionScrollingConstraints& constraints = | 243 const StickyPositionScrollingConstraints& constraints = |
244 scrollableArea->stickyConstraintsMap().get(sticky->layer()); | 244 scrollableArea->stickyConstraintsMap().get(sticky->layer()); |
245 ASSERT_EQ(IntRect(15, 115, 170, 370), | 245 ASSERT_EQ(IntRect(15, 115, 170, 370), |
246 enclosingIntRect( | 246 enclosingIntRect( |
247 getScrollContainerRelativeContainingBlockRect(constraints))); | 247 getScrollContainerRelativeContainingBlockRect(constraints))); |
248 ASSERT_EQ( | 248 ASSERT_EQ( |
249 IntRect(15, 165, 100, 100), | 249 IntRect(15, 165, 100, 100), |
250 enclosingIntRect(getScrollContainerRelativeStickyBoxRect(constraints))); | 250 enclosingIntRect(getScrollContainerRelativeStickyBoxRect(constraints))); |
251 } | 251 } |
| 252 |
| 253 TEST_F(LayoutBoxModelObjectTest, StickyPositionTableContainers) { |
| 254 setBodyInnerHTML( |
| 255 "<style> td, th { height: 50px; width: 50px; } " |
| 256 "#sticky { position: sticky; left: 0; will-change: transform; }" |
| 257 "table {border: none; }" |
| 258 "#scroller { overflow: auto; }" |
| 259 "</style>" |
| 260 "<div id='scroller'>" |
| 261 "<table cellspacing='0' cellpadding='0'>" |
| 262 " <thead><tr><td></td></tr></thead>" |
| 263 " <tr><td id='sticky'></td></tr>" |
| 264 "</table></div>"); |
| 265 LayoutBoxModelObject* scroller = |
| 266 toLayoutBoxModelObject(getLayoutObjectByElementId("scroller")); |
| 267 PaintLayerScrollableArea* scrollableArea = scroller->getScrollableArea(); |
| 268 LayoutBoxModelObject* sticky = |
| 269 toLayoutBoxModelObject(getLayoutObjectByElementId("sticky")); |
| 270 sticky->updateStickyPositionConstraints(); |
| 271 const StickyPositionScrollingConstraints& constraints = |
| 272 scrollableArea->stickyConstraintsMap().get(sticky->layer()); |
| 273 ASSERT_EQ(IntRect(0, 0, 50, 100), |
| 274 enclosingIntRect( |
| 275 getScrollContainerRelativeContainingBlockRect(constraints))); |
| 276 ASSERT_EQ( |
| 277 IntRect(0, 50, 50, 50), |
| 278 enclosingIntRect(getScrollContainerRelativeStickyBoxRect(constraints))); |
| 279 } |
| 280 |
252 } // namespace blink | 281 } // namespace blink |
OLD | NEW |