| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/ScrollAnchor.h" | 5 #include "core/layout/ScrollAnchor.h" |
| 6 | 6 |
| 7 #include "core/dom/ClientRect.h" | 7 #include "core/dom/ClientRect.h" |
| 8 #include "core/frame/VisualViewport.h" | 8 #include "core/frame/VisualViewport.h" |
| 9 #include "core/layout/LayoutBox.h" | 9 #include "core/layout/LayoutBox.h" |
| 10 #include "core/layout/LayoutTestHelper.h" | 10 #include "core/layout/LayoutTestHelper.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 // TODO(skobes): Use SimTest instead of RenderingTest and move into | 35 // TODO(skobes): Use SimTest instead of RenderingTest and move into |
| 36 // Source/web? | 36 // Source/web? |
| 37 document().view()->updateAllLifecyclePhases(); | 37 document().view()->updateAllLifecyclePhases(); |
| 38 } | 38 } |
| 39 | 39 |
| 40 ScrollableArea* layoutViewport() { | 40 ScrollableArea* layoutViewport() { |
| 41 return document().view()->layoutViewportScrollableArea(); | 41 return document().view()->layoutViewportScrollableArea(); |
| 42 } | 42 } |
| 43 | 43 |
| 44 VisualViewport& visualViewport() { | 44 VisualViewport& visualViewport() { |
| 45 return document().view()->page()->frameHost().visualViewport(); | 45 return document().view()->page()->visualViewport(); |
| 46 } | 46 } |
| 47 | 47 |
| 48 ScrollableArea* scrollerForElement(Element* element) { | 48 ScrollableArea* scrollerForElement(Element* element) { |
| 49 return toLayoutBox(element->layoutObject())->getScrollableArea(); | 49 return toLayoutBox(element->layoutObject())->getScrollableArea(); |
| 50 } | 50 } |
| 51 | 51 |
| 52 ScrollAnchor& scrollAnchor(ScrollableArea* scroller) { | 52 ScrollAnchor& scrollAnchor(ScrollableArea* scroller) { |
| 53 ASSERT(scroller->isFrameView() || scroller->isPaintLayerScrollableArea()); | 53 ASSERT(scroller->isFrameView() || scroller->isPaintLayerScrollableArea()); |
| 54 return *(scroller->scrollAnchor()); | 54 return *(scroller->scrollAnchor()); |
| 55 } | 55 } |
| (...skipping 1083 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1139 | 1139 |
| 1140 scrollLayoutViewport(ScrollOffset(-50, 0)); | 1140 scrollLayoutViewport(ScrollOffset(-50, 0)); |
| 1141 | 1141 |
| 1142 a->setAttribute(HTMLNames::styleAttr, "width: 200px"); | 1142 a->setAttribute(HTMLNames::styleAttr, "width: 200px"); |
| 1143 b->setAttribute(HTMLNames::styleAttr, "height: 150px"); | 1143 b->setAttribute(HTMLNames::styleAttr, "height: 150px"); |
| 1144 update(); | 1144 update(); |
| 1145 EXPECT_EQ(ScrollOffset(-100, 150), viewport->getScrollOffset()); | 1145 EXPECT_EQ(ScrollOffset(-100, 150), viewport->getScrollOffset()); |
| 1146 EXPECT_EQ(c->layoutObject(), scrollAnchor(viewport).anchorObject()); | 1146 EXPECT_EQ(c->layoutObject(), scrollAnchor(viewport).anchorObject()); |
| 1147 } | 1147 } |
| 1148 } | 1148 } |
| OLD | NEW |