| 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/LayoutTestHelper.h" | 5 #include "core/layout/LayoutTestHelper.h" |
| 6 #include "core/layout/LayoutTreeAsText.h" | 6 #include "core/layout/LayoutTreeAsText.h" |
| 7 #include "core/layout/LayoutView.h" | 7 #include "core/layout/api/LayoutViewItem.h" |
| 8 #include "core/paint/ObjectPaintProperties.h" | 8 #include "core/paint/ObjectPaintProperties.h" |
| 9 #include "platform/graphics/paint/TransformPaintPropertyNode.h" | 9 #include "platform/graphics/paint/TransformPaintPropertyNode.h" |
| 10 #include "platform/testing/UnitTestHelpers.h" | 10 #include "platform/testing/UnitTestHelpers.h" |
| 11 #include "platform/text/TextStream.h" | 11 #include "platform/text/TextStream.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 13 #include "wtf/HashMap.h" | 13 #include "wtf/HashMap.h" |
| 14 #include "wtf/Vector.h" | 14 #include "wtf/Vector.h" |
| 15 | 15 |
| 16 namespace blink { | 16 namespace blink { |
| 17 | 17 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 FrameView* frameView = document().view(); | 125 FrameView* frameView = document().view(); |
| 126 frameView->updateAllLifecyclePhases(); | 126 frameView->updateAllLifecyclePhases(); |
| 127 EXPECT_EQ(TransformationMatrix(), frameView->preTranslation()->matrix()); | 127 EXPECT_EQ(TransformationMatrix(), frameView->preTranslation()->matrix()); |
| 128 EXPECT_EQ(nullptr, frameView->preTranslation()->parent()); | 128 EXPECT_EQ(nullptr, frameView->preTranslation()->parent()); |
| 129 EXPECT_EQ(TransformationMatrix().translate(0, -100), frameView->scrollTransl
ation()->matrix()); | 129 EXPECT_EQ(TransformationMatrix().translate(0, -100), frameView->scrollTransl
ation()->matrix()); |
| 130 EXPECT_EQ(frameView->preTranslation(), frameView->scrollTranslation()->paren
t()); | 130 EXPECT_EQ(frameView->preTranslation(), frameView->scrollTranslation()->paren
t()); |
| 131 EXPECT_EQ(frameView->preTranslation(), frameView->contentClip()->localTransf
ormSpace()); | 131 EXPECT_EQ(frameView->preTranslation(), frameView->contentClip()->localTransf
ormSpace()); |
| 132 EXPECT_EQ(FloatRoundedRect(0, 0, 800, 600), frameView->contentClip()->clipRe
ct()); | 132 EXPECT_EQ(FloatRoundedRect(0, 0, 800, 600), frameView->contentClip()->clipRe
ct()); |
| 133 EXPECT_EQ(nullptr, frameView->contentClip()->parent()); | 133 EXPECT_EQ(nullptr, frameView->contentClip()->parent()); |
| 134 | 134 |
| 135 LayoutView* layoutView = document().layoutView(); | 135 LayoutViewItem layoutViewItem = document().layoutViewItem(); |
| 136 ObjectPaintProperties* layoutViewProperties = layoutView->objectPaintPropert
ies(); | 136 ObjectPaintProperties* layoutViewProperties = layoutViewItem.objectPaintProp
erties(); |
| 137 EXPECT_EQ(nullptr, layoutViewProperties->scrollTranslation()); | 137 EXPECT_EQ(nullptr, layoutViewProperties->scrollTranslation()); |
| 138 } | 138 } |
| 139 | 139 |
| 140 // TODO(trchen): Settings::rootLayerScrolls cannot be switched after main frame
being created. | 140 // TODO(trchen): Settings::rootLayerScrolls cannot be switched after main frame
being created. |
| 141 // Need to set it during test setup. Besides that, the test still won't work bec
ause | 141 // Need to set it during test setup. Besides that, the test still won't work bec
ause |
| 142 // root layer scrolling mode is not compatible with SPv2 at this moment. | 142 // root layer scrolling mode is not compatible with SPv2 at this moment. |
| 143 // (Duplicate display item ID for FrameView and LayoutView.) | 143 // (Duplicate display item ID for FrameView and LayoutView.) |
| 144 TEST_F(PaintPropertyTreeBuilderTest, DISABLED_FrameScrollingRootLayerScrolls) | 144 TEST_F(PaintPropertyTreeBuilderTest, DISABLED_FrameScrollingRootLayerScrolls) |
| 145 { | 145 { |
| 146 document().settings()->setRootLayerScrolls(true); | 146 document().settings()->setRootLayerScrolls(true); |
| 147 | 147 |
| 148 setBodyInnerHTML("<style> body { height: 10000px; } </style>"); | 148 setBodyInnerHTML("<style> body { height: 10000px; } </style>"); |
| 149 | 149 |
| 150 document().domWindow()->scrollTo(0, 100); | 150 document().domWindow()->scrollTo(0, 100); |
| 151 | 151 |
| 152 FrameView* frameView = document().view(); | 152 FrameView* frameView = document().view(); |
| 153 frameView->updateAllLifecyclePhases(); | 153 frameView->updateAllLifecyclePhases(); |
| 154 EXPECT_EQ(TransformationMatrix(), frameView->preTranslation()->matrix()); | 154 EXPECT_EQ(TransformationMatrix(), frameView->preTranslation()->matrix()); |
| 155 EXPECT_EQ(nullptr, frameView->preTranslation()->parent()); | 155 EXPECT_EQ(nullptr, frameView->preTranslation()->parent()); |
| 156 EXPECT_EQ(TransformationMatrix(), frameView->scrollTranslation()->matrix()); | 156 EXPECT_EQ(TransformationMatrix(), frameView->scrollTranslation()->matrix()); |
| 157 EXPECT_EQ(frameView->preTranslation(), frameView->scrollTranslation()->paren
t()); | 157 EXPECT_EQ(frameView->preTranslation(), frameView->scrollTranslation()->paren
t()); |
| 158 | 158 |
| 159 LayoutView* layoutView = document().layoutView(); | 159 LayoutViewItem layoutViewItem = document().layoutViewItem(); |
| 160 ObjectPaintProperties* layoutViewProperties = layoutView->objectPaintPropert
ies(); | 160 ObjectPaintProperties* layoutViewProperties = layoutViewItem.objectPaintProp
erties(); |
| 161 EXPECT_EQ(TransformationMatrix().translate(0, -100), layoutViewProperties->s
crollTranslation()->matrix()); | 161 EXPECT_EQ(TransformationMatrix().translate(0, -100), layoutViewProperties->s
crollTranslation()->matrix()); |
| 162 EXPECT_EQ(frameView->scrollTranslation(), layoutViewProperties->scrollTransl
ation()->parent()); | 162 EXPECT_EQ(frameView->scrollTranslation(), layoutViewProperties->scrollTransl
ation()->parent()); |
| 163 } | 163 } |
| 164 | 164 |
| 165 TEST_F(PaintPropertyTreeBuilderTest, Perspective) | 165 TEST_F(PaintPropertyTreeBuilderTest, Perspective) |
| 166 { | 166 { |
| 167 loadTestData("perspective.html"); | 167 loadTestData("perspective.html"); |
| 168 | 168 |
| 169 Element* perspective = document().getElementById("perspective"); | 169 Element* perspective = document().getElementById("perspective"); |
| 170 ObjectPaintProperties* perspectiveProperties = perspective->layoutObject()->
objectPaintProperties(); | 170 ObjectPaintProperties* perspectiveProperties = perspective->layoutObject()->
objectPaintProperties(); |
| (...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 912 " <div id='spanner' style='column-span: all; opacity: 0.5; width: 100
px; height: 100px;'></div>" | 912 " <div id='spanner' style='column-span: all; opacity: 0.5; width: 100
px; height: 100px;'></div>" |
| 913 " </div>" | 913 " </div>" |
| 914 "</div>" | 914 "</div>" |
| 915 ); | 915 ); |
| 916 | 916 |
| 917 LayoutObject& spanner = *getLayoutObjectByElementId("spanner"); | 917 LayoutObject& spanner = *getLayoutObjectByElementId("spanner"); |
| 918 EXPECT_EQ(LayoutPoint(55, 44), spanner.objectPaintProperties()->localBorderB
oxProperties()->paintOffset); | 918 EXPECT_EQ(LayoutPoint(55, 44), spanner.objectPaintProperties()->localBorderB
oxProperties()->paintOffset); |
| 919 } | 919 } |
| 920 | 920 |
| 921 } // namespace blink | 921 } // namespace blink |
| OLD | NEW |