| 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/api/LayoutViewItem.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/GeometryMapper.h" | 9 #include "platform/graphics/paint/GeometryMapper.h" |
| 10 #include "platform/graphics/paint/TransformPaintPropertyNode.h" | 10 #include "platform/graphics/paint/TransformPaintPropertyNode.h" |
| 11 #include "platform/testing/RuntimeEnabledFeaturesTestHelpers.h" |
| 11 #include "platform/testing/UnitTestHelpers.h" | 12 #include "platform/testing/UnitTestHelpers.h" |
| 12 #include "platform/text/TextStream.h" | 13 #include "platform/text/TextStream.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 14 #include "wtf/HashMap.h" | 15 #include "wtf/HashMap.h" |
| 15 #include "wtf/Vector.h" | 16 #include "wtf/Vector.h" |
| 16 | 17 |
| 17 namespace blink { | 18 namespace blink { |
| 18 | 19 |
| 20 typedef bool TestParamRootLayerScrolling; |
| 19 class PaintPropertyTreeBuilderTest | 21 class PaintPropertyTreeBuilderTest |
| 20 : public RenderingTest | 22 : public ::testing::WithParamInterface<TestParamRootLayerScrolling> |
| 21 , public ::testing::WithParamInterface<FrameSettingOverrideFunction> { | 23 , private ScopedSlimmingPaintV2ForTest |
| 24 , private ScopedRootLayerScrollingForTest |
| 25 , public RenderingTest { |
| 22 public: | 26 public: |
| 23 PaintPropertyTreeBuilderTest() | 27 PaintPropertyTreeBuilderTest() |
| 24 : RenderingTest(SingleChildFrameLoaderClient::create()) | 28 : ScopedSlimmingPaintV2ForTest(true) |
| 25 , m_originalSlimmingPaintV2Enabled(RuntimeEnabledFeatures::slimmingPaint
V2Enabled()) { } | 29 , ScopedRootLayerScrollingForTest(GetParam()) |
| 30 , RenderingTest(SingleChildFrameLoaderClient::create()) { } |
| 26 | 31 |
| 27 void loadTestData(const char* fileName) | 32 void loadTestData(const char* fileName) |
| 28 { | 33 { |
| 29 String fullPath = testing::blinkRootDir(); | 34 String fullPath = testing::blinkRootDir(); |
| 30 fullPath.append("/Source/core/paint/test_data/"); | 35 fullPath.append("/Source/core/paint/test_data/"); |
| 31 fullPath.append(fileName); | 36 fullPath.append(fileName); |
| 32 RefPtr<SharedBuffer> inputBuffer = testing::readFromFile(fullPath); | 37 RefPtr<SharedBuffer> inputBuffer = testing::readFromFile(fullPath); |
| 33 setBodyInnerHTML(String(inputBuffer->data(), inputBuffer->size())); | 38 setBodyInnerHTML(String(inputBuffer->data(), inputBuffer->size())); |
| 34 } | 39 } |
| 35 | 40 |
| 36 bool rootLayerScrolls() | |
| 37 { | |
| 38 return document().settings() && document().settings()->rootLayerScrolls(
); | |
| 39 } | |
| 40 | |
| 41 const TransformPaintPropertyNode* rootTransform() | 41 const TransformPaintPropertyNode* rootTransform() |
| 42 { | 42 { |
| 43 FrameView* frameView = document().view(); | 43 FrameView* frameView = document().view(); |
| 44 if (rootLayerScrolls()) | 44 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) |
| 45 return frameView->layoutView()->objectPaintProperties()->paintOffset
Translation(); | 45 return frameView->layoutView()->objectPaintProperties()->paintOffset
Translation(); |
| 46 return frameView->rootTransform(); | 46 return frameView->rootTransform(); |
| 47 } | 47 } |
| 48 | 48 |
| 49 const ClipPaintPropertyNode* rootClip() | 49 const ClipPaintPropertyNode* rootClip() |
| 50 { | 50 { |
| 51 if (rootLayerScrolls()) | 51 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) |
| 52 return document().view()->layoutView()->objectPaintProperties()->loc
alBorderBoxProperties()->propertyTreeState.clip.get(); | 52 return document().view()->layoutView()->objectPaintProperties()->loc
alBorderBoxProperties()->propertyTreeState.clip.get(); |
| 53 return document().view()->rootClip(); | 53 return document().view()->rootClip(); |
| 54 } | 54 } |
| 55 | 55 |
| 56 const TransformPaintPropertyNode* framePreTranslation() | 56 const TransformPaintPropertyNode* framePreTranslation() |
| 57 { | 57 { |
| 58 FrameView* frameView = document().view(); | 58 FrameView* frameView = document().view(); |
| 59 if (rootLayerScrolls()) | 59 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) |
| 60 return frameView->layoutView()->objectPaintProperties()->paintOffset
Translation(); | 60 return frameView->layoutView()->objectPaintProperties()->paintOffset
Translation(); |
| 61 return frameView->preTranslation(); | 61 return frameView->preTranslation(); |
| 62 } | 62 } |
| 63 | 63 |
| 64 const TransformPaintPropertyNode* frameScrollTranslation() | 64 const TransformPaintPropertyNode* frameScrollTranslation() |
| 65 { | 65 { |
| 66 FrameView* frameView = document().view(); | 66 FrameView* frameView = document().view(); |
| 67 if (rootLayerScrolls()) | 67 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) |
| 68 return frameView->layoutView()->objectPaintProperties()->scrollTrans
lation(); | 68 return frameView->layoutView()->objectPaintProperties()->scrollTrans
lation(); |
| 69 return frameView->scrollTranslation(); | 69 return frameView->scrollTranslation(); |
| 70 } | 70 } |
| 71 | 71 |
| 72 const ClipPaintPropertyNode* frameContentClip() | 72 const ClipPaintPropertyNode* frameContentClip() |
| 73 { | 73 { |
| 74 FrameView* frameView = document().view(); | 74 FrameView* frameView = document().view(); |
| 75 if (rootLayerScrolls()) | 75 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) |
| 76 return frameView->layoutView()->objectPaintProperties()->overflowCli
p(); | 76 return frameView->layoutView()->objectPaintProperties()->overflowCli
p(); |
| 77 return frameView->contentClip(); | 77 return frameView->contentClip(); |
| 78 } | 78 } |
| 79 | 79 |
| 80 FrameSettingOverrideFunction settingOverrider() const override { return GetP
aram(); } | |
| 81 | |
| 82 private: | 80 private: |
| 83 void SetUp() override | 81 void SetUp() override |
| 84 { | 82 { |
| 85 RuntimeEnabledFeatures::setSlimmingPaintV2Enabled(true); | |
| 86 Settings::setMockScrollbarsEnabled(true); | 83 Settings::setMockScrollbarsEnabled(true); |
| 87 | 84 |
| 88 RenderingTest::SetUp(); | 85 RenderingTest::SetUp(); |
| 89 enableCompositing(); | 86 enableCompositing(); |
| 90 } | 87 } |
| 91 | 88 |
| 92 void TearDown() override | 89 void TearDown() override |
| 93 { | 90 { |
| 94 RenderingTest::TearDown(); | 91 RenderingTest::TearDown(); |
| 95 | 92 |
| 96 Settings::setMockScrollbarsEnabled(false); | 93 Settings::setMockScrollbarsEnabled(false); |
| 97 RuntimeEnabledFeatures::setSlimmingPaintV2Enabled(m_originalSlimmingPain
tV2Enabled); | |
| 98 } | 94 } |
| 99 | |
| 100 bool m_originalSlimmingPaintV2Enabled; | |
| 101 }; | 95 }; |
| 102 | 96 |
| 103 #define CHECK_VISUAL_RECT(expected, sourceLayoutObject, ancestorLayoutObject, sl
opFactor) \ | 97 #define CHECK_VISUAL_RECT(expected, sourceLayoutObject, ancestorLayoutObject, sl
opFactor) \ |
| 104 do { \ | 98 do { \ |
| 105 GeometryMapper geometryMapper; \ | 99 GeometryMapper geometryMapper; \ |
| 106 LayoutRect source((sourceLayoutObject)->localOverflowRectForPaintInvalidatio
n()); \ | 100 LayoutRect source((sourceLayoutObject)->localOverflowRectForPaintInvalidatio
n()); \ |
| 107 source.moveBy((sourceLayoutObject)->objectPaintProperties()->localBorderBoxP
roperties()->paintOffset); \ | 101 source.moveBy((sourceLayoutObject)->objectPaintProperties()->localBorderBoxP
roperties()->paintOffset); \ |
| 108 bool success = false; \ | 102 bool success = false; \ |
| 109 FloatRect actual = geometryMapper.mapToVisualRectInDestinationSpace( \ | 103 FloatRect actual = geometryMapper.mapToVisualRectInDestinationSpace( \ |
| 110 FloatRect(source), \ | 104 FloatRect(source), \ |
| (...skipping 12 matching lines...) Expand all Loading... |
| 123 SCOPED_TRACE(String::format("Old path rect: %s, Actual: %s, Inflated act
ual: %s", slowPathRect.toString().ascii().data(), actual.toString().ascii().data
(), inflatedActual.toString().ascii().data())); \ | 117 SCOPED_TRACE(String::format("Old path rect: %s, Actual: %s, Inflated act
ual: %s", slowPathRect.toString().ascii().data(), actual.toString().ascii().data
(), inflatedActual.toString().ascii().data())); \ |
| 124 EXPECT_TRUE(slowPathRect.contains(LayoutRect(actual))); \ | 118 EXPECT_TRUE(slowPathRect.contains(LayoutRect(actual))); \ |
| 125 EXPECT_TRUE(inflatedActual.contains(slowPathRect)); \ | 119 EXPECT_TRUE(inflatedActual.contains(slowPathRect)); \ |
| 126 } else { \ | 120 } else { \ |
| 127 EXPECT_EQ(slowPathRect, LayoutRect(actual)); \ | 121 EXPECT_EQ(slowPathRect, LayoutRect(actual)); \ |
| 128 } \ | 122 } \ |
| 129 } while (0) | 123 } while (0) |
| 130 | 124 |
| 131 #define CHECK_EXACT_VISUAL_RECT(expected, sourceLayoutObject, ancestorLayoutObje
ct) CHECK_VISUAL_RECT(expected, sourceLayoutObject, ancestorLayoutObject, 0) | 125 #define CHECK_EXACT_VISUAL_RECT(expected, sourceLayoutObject, ancestorLayoutObje
ct) CHECK_VISUAL_RECT(expected, sourceLayoutObject, ancestorLayoutObject, 0) |
| 132 | 126 |
| 133 INSTANTIATE_TEST_CASE_P(All, PaintPropertyTreeBuilderTest, ::testing::Values(nul
lptr, &RootLayerScrollsFrameSettingOverride)); | 127 INSTANTIATE_TEST_CASE_P(All, PaintPropertyTreeBuilderTest, ::testing::Bool()); |
| 134 | 128 |
| 135 TEST_P(PaintPropertyTreeBuilderTest, FixedPosition) | 129 TEST_P(PaintPropertyTreeBuilderTest, FixedPosition) |
| 136 { | 130 { |
| 137 loadTestData("fixed-position.html"); | 131 loadTestData("fixed-position.html"); |
| 138 | 132 |
| 139 FrameView* frameView = document().view(); | 133 FrameView* frameView = document().view(); |
| 140 | 134 |
| 141 // target1 is a fixed-position element inside an absolute-position scrolling
element. | 135 // target1 is a fixed-position element inside an absolute-position scrolling
element. |
| 142 // It should be attached under the viewport to skip scrolling and offset of
the parent. | 136 // It should be attached under the viewport to skip scrolling and offset of
the parent. |
| 143 Element* target1 = document().getElementById("target1"); | 137 Element* target1 = document().getElementById("target1"); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 172 scroller->scrollTo(0, 100); | 166 scroller->scrollTo(0, 100); |
| 173 FrameView* frameView = document().view(); | 167 FrameView* frameView = document().view(); |
| 174 frameView->updateAllLifecyclePhases(); | 168 frameView->updateAllLifecyclePhases(); |
| 175 const ObjectPaintProperties* scrollerProperties = scroller->layoutObject()->
objectPaintProperties(); | 169 const ObjectPaintProperties* scrollerProperties = scroller->layoutObject()->
objectPaintProperties(); |
| 176 EXPECT_EQ(TransformationMatrix().translate(0, -100), scrollerProperties->scr
ollTranslation()->matrix()); | 170 EXPECT_EQ(TransformationMatrix().translate(0, -100), scrollerProperties->scr
ollTranslation()->matrix()); |
| 177 EXPECT_EQ(frameScrollTranslation(), scrollerProperties->scrollTranslation()-
>parent()); | 171 EXPECT_EQ(frameScrollTranslation(), scrollerProperties->scrollTranslation()-
>parent()); |
| 178 EXPECT_EQ(frameScrollTranslation(), scrollerProperties->overflowClip()->loca
lTransformSpace()); | 172 EXPECT_EQ(frameScrollTranslation(), scrollerProperties->overflowClip()->loca
lTransformSpace()); |
| 179 EXPECT_EQ(FloatRoundedRect(120, 340, 400, 300), scrollerProperties->overflow
Clip()->clipRect()); | 173 EXPECT_EQ(FloatRoundedRect(120, 340, 400, 300), scrollerProperties->overflow
Clip()->clipRect()); |
| 180 EXPECT_EQ(frameContentClip(), scrollerProperties->overflowClip()->parent()); | 174 EXPECT_EQ(frameContentClip(), scrollerProperties->overflowClip()->parent()); |
| 181 // http://crbug.com/638415 | 175 // http://crbug.com/638415 |
| 182 if (!rootLayerScrolls()) { | 176 if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { |
| 183 CHECK_EXACT_VISUAL_RECT(LayoutRect(120, 340, 400, 300), scroller->layout
Object(), frameView->layoutView()); | 177 CHECK_EXACT_VISUAL_RECT(LayoutRect(120, 340, 400, 300), scroller->layout
Object(), frameView->layoutView()); |
| 184 } | 178 } |
| 185 | 179 |
| 186 // The relative-positioned element should have accumulated box offset (exclu
de scrolling), | 180 // The relative-positioned element should have accumulated box offset (exclu
de scrolling), |
| 187 // and should be affected by ancestor scroll transforms. | 181 // and should be affected by ancestor scroll transforms. |
| 188 Element* relPos = document().getElementById("rel-pos"); | 182 Element* relPos = document().getElementById("rel-pos"); |
| 189 const ObjectPaintProperties* relPosProperties = relPos->layoutObject()->obje
ctPaintProperties(); | 183 const ObjectPaintProperties* relPosProperties = relPos->layoutObject()->obje
ctPaintProperties(); |
| 190 EXPECT_EQ(TransformationMatrix().translate(680, 1120), relPosProperties->pai
ntOffsetTranslation()->matrix()); | 184 EXPECT_EQ(TransformationMatrix().translate(680, 1120), relPosProperties->pai
ntOffsetTranslation()->matrix()); |
| 191 EXPECT_EQ(scrollerProperties->scrollTranslation(), relPosProperties->paintOf
fsetTranslation()->parent()); | 185 EXPECT_EQ(scrollerProperties->scrollTranslation(), relPosProperties->paintOf
fsetTranslation()->parent()); |
| 192 EXPECT_EQ(relPosProperties->transform(), relPosProperties->overflowClip()->l
ocalTransformSpace()); | 186 EXPECT_EQ(relPosProperties->transform(), relPosProperties->overflowClip()->l
ocalTransformSpace()); |
| 193 EXPECT_EQ(FloatRoundedRect(0, 0, 100, 200), relPosProperties->overflowClip()
->clipRect()); | 187 EXPECT_EQ(FloatRoundedRect(0, 0, 100, 200), relPosProperties->overflowClip()
->clipRect()); |
| 194 EXPECT_EQ(scrollerProperties->overflowClip(), relPosProperties->overflowClip
()->parent()); | 188 EXPECT_EQ(scrollerProperties->overflowClip(), relPosProperties->overflowClip
()->parent()); |
| 195 CHECK_EXACT_VISUAL_RECT(LayoutRect(), relPos->layoutObject(), frameView->lay
outView()); | 189 CHECK_EXACT_VISUAL_RECT(LayoutRect(), relPos->layoutObject(), frameView->lay
outView()); |
| 196 | 190 |
| 197 // The absolute-positioned element should not be affected by non-positioned
scroller at all. | 191 // The absolute-positioned element should not be affected by non-positioned
scroller at all. |
| 198 Element* absPos = document().getElementById("abs-pos"); | 192 Element* absPos = document().getElementById("abs-pos"); |
| 199 const ObjectPaintProperties* absPosProperties = absPos->layoutObject()->obje
ctPaintProperties(); | 193 const ObjectPaintProperties* absPosProperties = absPos->layoutObject()->obje
ctPaintProperties(); |
| 200 EXPECT_EQ(TransformationMatrix().translate(123, 456), absPosProperties->pain
tOffsetTranslation()->matrix()); | 194 EXPECT_EQ(TransformationMatrix().translate(123, 456), absPosProperties->pain
tOffsetTranslation()->matrix()); |
| 201 EXPECT_EQ(frameScrollTranslation(), absPosProperties->paintOffsetTranslation
()->parent()); | 195 EXPECT_EQ(frameScrollTranslation(), absPosProperties->paintOffsetTranslation
()->parent()); |
| 202 EXPECT_EQ(absPosProperties->transform(), absPosProperties->overflowClip()->l
ocalTransformSpace()); | 196 EXPECT_EQ(absPosProperties->transform(), absPosProperties->overflowClip()->l
ocalTransformSpace()); |
| 203 EXPECT_EQ(FloatRoundedRect(0, 0, 300, 400), absPosProperties->overflowClip()
->clipRect()); | 197 EXPECT_EQ(FloatRoundedRect(0, 0, 300, 400), absPosProperties->overflowClip()
->clipRect()); |
| 204 EXPECT_EQ(frameContentClip(), absPosProperties->overflowClip()->parent()); | 198 EXPECT_EQ(frameContentClip(), absPosProperties->overflowClip()->parent()); |
| 205 // http://crbug.com/638415 | 199 // http://crbug.com/638415 |
| 206 if (!rootLayerScrolls()) { | 200 if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { |
| 207 CHECK_EXACT_VISUAL_RECT(LayoutRect(123, 456, 300, 400), absPos->layoutOb
ject(), frameView->layoutView()); | 201 CHECK_EXACT_VISUAL_RECT(LayoutRect(123, 456, 300, 400), absPos->layoutOb
ject(), frameView->layoutView()); |
| 208 } | 202 } |
| 209 } | 203 } |
| 210 | 204 |
| 211 TEST_P(PaintPropertyTreeBuilderTest, FrameScrollingTraditional) | 205 TEST_P(PaintPropertyTreeBuilderTest, FrameScrollingTraditional) |
| 212 { | 206 { |
| 213 setBodyInnerHTML("<style> body { height: 10000px; } </style>"); | 207 setBodyInnerHTML("<style> body { height: 10000px; } </style>"); |
| 214 | 208 |
| 215 document().domWindow()->scrollTo(0, 100); | 209 document().domWindow()->scrollTo(0, 100); |
| 216 | 210 |
| 217 FrameView* frameView = document().view(); | 211 FrameView* frameView = document().view(); |
| 218 frameView->updateAllLifecyclePhases(); | 212 frameView->updateAllLifecyclePhases(); |
| 219 EXPECT_EQ(TransformationMatrix(), framePreTranslation()->matrix()); | 213 EXPECT_EQ(TransformationMatrix(), framePreTranslation()->matrix()); |
| 220 if (!rootLayerScrolls()) | 214 if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) |
| 221 EXPECT_EQ(rootTransform(), framePreTranslation()->parent()); | 215 EXPECT_EQ(rootTransform(), framePreTranslation()->parent()); |
| 222 EXPECT_EQ(nullptr, rootTransform()->parent()); | 216 EXPECT_EQ(nullptr, rootTransform()->parent()); |
| 223 EXPECT_EQ(TransformationMatrix().translate(0, -100), frameScrollTranslation(
)->matrix()); | 217 EXPECT_EQ(TransformationMatrix().translate(0, -100), frameScrollTranslation(
)->matrix()); |
| 224 EXPECT_EQ(framePreTranslation(), frameScrollTranslation()->parent()); | 218 EXPECT_EQ(framePreTranslation(), frameScrollTranslation()->parent()); |
| 225 EXPECT_EQ(framePreTranslation(), frameContentClip()->localTransformSpace()); | 219 EXPECT_EQ(framePreTranslation(), frameContentClip()->localTransformSpace()); |
| 226 EXPECT_EQ(FloatRoundedRect(0, 0, 800, 600), frameContentClip()->clipRect()); | 220 EXPECT_EQ(FloatRoundedRect(0, 0, 800, 600), frameContentClip()->clipRect()); |
| 227 EXPECT_EQ(rootClip(), frameContentClip()->parent()); | 221 EXPECT_EQ(rootClip(), frameContentClip()->parent()); |
| 228 if (!rootLayerScrolls()) | 222 if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) |
| 229 EXPECT_EQ(nullptr, rootClip()->parent()); | 223 EXPECT_EQ(nullptr, rootClip()->parent()); |
| 230 | 224 |
| 231 LayoutViewItem layoutViewItem = document().layoutViewItem(); | 225 LayoutViewItem layoutViewItem = document().layoutViewItem(); |
| 232 const ObjectPaintProperties* layoutViewProperties = layoutViewItem.objectPai
ntProperties(); | 226 const ObjectPaintProperties* layoutViewProperties = layoutViewItem.objectPai
ntProperties(); |
| 233 // http://crbug.com/638415 | 227 // http://crbug.com/638415 |
| 234 if (!rootLayerScrolls()) { | 228 if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { |
| 235 EXPECT_EQ(nullptr, layoutViewProperties->scrollTranslation()); | 229 EXPECT_EQ(nullptr, layoutViewProperties->scrollTranslation()); |
| 236 CHECK_EXACT_VISUAL_RECT(LayoutRect(8, 8, 784, 10000), document().body()-
>layoutObject(), frameView->layoutView()); | 230 CHECK_EXACT_VISUAL_RECT(LayoutRect(8, 8, 784, 10000), document().body()-
>layoutObject(), frameView->layoutView()); |
| 237 } | 231 } |
| 238 } | 232 } |
| 239 | 233 |
| 240 TEST_P(PaintPropertyTreeBuilderTest, Perspective) | 234 TEST_P(PaintPropertyTreeBuilderTest, Perspective) |
| 241 { | 235 { |
| 242 loadTestData("perspective.html"); | 236 loadTestData("perspective.html"); |
| 243 | 237 |
| 244 Element* perspective = document().getElementById("perspective"); | 238 Element* perspective = document().getElementById("perspective"); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 261 loadTestData("transform.html"); | 255 loadTestData("transform.html"); |
| 262 | 256 |
| 263 Element* transform = document().getElementById("transform"); | 257 Element* transform = document().getElementById("transform"); |
| 264 const ObjectPaintProperties* transformProperties = transform->layoutObject()
->objectPaintProperties(); | 258 const ObjectPaintProperties* transformProperties = transform->layoutObject()
->objectPaintProperties(); |
| 265 EXPECT_EQ(TransformationMatrix().translate3d(123, 456, 789), transformProper
ties->transform()->matrix()); | 259 EXPECT_EQ(TransformationMatrix().translate3d(123, 456, 789), transformProper
ties->transform()->matrix()); |
| 266 EXPECT_EQ(FloatPoint3D(200, 150, 0), transformProperties->transform()->origi
n()); | 260 EXPECT_EQ(FloatPoint3D(200, 150, 0), transformProperties->transform()->origi
n()); |
| 267 EXPECT_EQ(transformProperties->paintOffsetTranslation(), transformProperties
->transform()->parent()); | 261 EXPECT_EQ(transformProperties->paintOffsetTranslation(), transformProperties
->transform()->parent()); |
| 268 EXPECT_EQ(TransformationMatrix().translate(50, 100), transformProperties->pa
intOffsetTranslation()->matrix()); | 262 EXPECT_EQ(TransformationMatrix().translate(50, 100), transformProperties->pa
intOffsetTranslation()->matrix()); |
| 269 EXPECT_EQ(frameScrollTranslation(), transformProperties->paintOffsetTranslat
ion()->parent()); | 263 EXPECT_EQ(frameScrollTranslation(), transformProperties->paintOffsetTranslat
ion()->parent()); |
| 270 // http://crbug.com/638415 | 264 // http://crbug.com/638415 |
| 271 if (!rootLayerScrolls()) { | 265 if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { |
| 272 CHECK_EXACT_VISUAL_RECT(LayoutRect(173, 556, 400, 300), transform->layou
tObject(), document().view()->layoutView()); | 266 CHECK_EXACT_VISUAL_RECT(LayoutRect(173, 556, 400, 300), transform->layou
tObject(), document().view()->layoutView()); |
| 273 } | 267 } |
| 274 } | 268 } |
| 275 | 269 |
| 276 TEST_P(PaintPropertyTreeBuilderTest, RelativePositionInline) | 270 TEST_P(PaintPropertyTreeBuilderTest, RelativePositionInline) |
| 277 { | 271 { |
| 278 loadTestData("relative-position-inline.html"); | 272 loadTestData("relative-position-inline.html"); |
| 279 | 273 |
| 280 Element* inlineBlock = document().getElementById("inline-block"); | 274 Element* inlineBlock = document().getElementById("inline-block"); |
| 281 const ObjectPaintProperties* inlineBlockProperties = inlineBlock->layoutObje
ct()->objectPaintProperties(); | 275 const ObjectPaintProperties* inlineBlockProperties = inlineBlock->layoutObje
ct()->objectPaintProperties(); |
| (...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 741 "</div>"); | 735 "</div>"); |
| 742 Document& frameDocument = setupChildIframe("frame", | 736 Document& frameDocument = setupChildIframe("frame", |
| 743 "<style>body { margin: 0; }</style><div id='transform' style='transform:
translate3d(4px, 5px, 6px); width: 100px; height: 200px'></div>"); | 737 "<style>body { margin: 0; }</style><div id='transform' style='transform:
translate3d(4px, 5px, 6px); width: 100px; height: 200px'></div>"); |
| 744 FrameView* frameView = document().view(); | 738 FrameView* frameView = document().view(); |
| 745 frameView->updateAllLifecyclePhases(); | 739 frameView->updateAllLifecyclePhases(); |
| 746 | 740 |
| 747 LayoutObject* divWithTransform = document().getElementById("divWithTransform
")->layoutObject(); | 741 LayoutObject* divWithTransform = document().getElementById("divWithTransform
")->layoutObject(); |
| 748 const ObjectPaintProperties* divWithTransformProperties = divWithTransform->
objectPaintProperties(); | 742 const ObjectPaintProperties* divWithTransformProperties = divWithTransform->
objectPaintProperties(); |
| 749 EXPECT_EQ(TransformationMatrix().translate3d(1, 2, 3), divWithTransformPrope
rties->transform()->matrix()); | 743 EXPECT_EQ(TransformationMatrix().translate3d(1, 2, 3), divWithTransformPrope
rties->transform()->matrix()); |
| 750 // http://crbug.com/638415 | 744 // http://crbug.com/638415 |
| 751 if (!rootLayerScrolls()) { | 745 if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { |
| 752 CHECK_EXACT_VISUAL_RECT(LayoutRect(1, 2, 800, 164), divWithTransform, fr
ameView->layoutView()); | 746 CHECK_EXACT_VISUAL_RECT(LayoutRect(1, 2, 800, 164), divWithTransform, fr
ameView->layoutView()); |
| 753 } | 747 } |
| 754 | 748 |
| 755 LayoutObject* innerDivWithTransform = frameDocument.getElementById("transfor
m")->layoutObject(); | 749 LayoutObject* innerDivWithTransform = frameDocument.getElementById("transfor
m")->layoutObject(); |
| 756 const ObjectPaintProperties* innerDivWithTransformProperties = innerDivWithT
ransform->objectPaintProperties(); | 750 const ObjectPaintProperties* innerDivWithTransformProperties = innerDivWithT
ransform->objectPaintProperties(); |
| 757 auto* innerDivTransform = innerDivWithTransformProperties->transform(); | 751 auto* innerDivTransform = innerDivWithTransformProperties->transform(); |
| 758 EXPECT_EQ(TransformationMatrix().translate3d(4, 5, 6), innerDivTransform->ma
trix()); | 752 EXPECT_EQ(TransformationMatrix().translate3d(4, 5, 6), innerDivTransform->ma
trix()); |
| 759 CHECK_EXACT_VISUAL_RECT(LayoutRect(12, 14, 100, 145), innerDivWithTransform,
frameView->layoutView()); | 753 CHECK_EXACT_VISUAL_RECT(LayoutRect(12, 14, 100, 145), innerDivWithTransform,
frameView->layoutView()); |
| 760 | 754 |
| 761 // Ensure that the inner div's transform is correctly rooted in the root fra
me's transform tree. | 755 // Ensure that the inner div's transform is correctly rooted in the root fra
me's transform tree. |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 808 auto* iframeTransform = iframePreTranslation->parent(); | 802 auto* iframeTransform = iframePreTranslation->parent(); |
| 809 EXPECT_EQ(TransformationMatrix().translate3d(4, 5, 6), iframeTransform->matr
ix()); | 803 EXPECT_EQ(TransformationMatrix().translate3d(4, 5, 6), iframeTransform->matr
ix()); |
| 810 auto* iframePaintOffsetTranslation = iframeTransform->parent(); | 804 auto* iframePaintOffsetTranslation = iframeTransform->parent(); |
| 811 EXPECT_EQ(TransformationMatrix().translate3d(7, 7, 0), iframePaintOffsetTran
slation->matrix()); | 805 EXPECT_EQ(TransformationMatrix().translate3d(7, 7, 0), iframePaintOffsetTran
slation->matrix()); |
| 812 auto* divWithTransformTransform = iframePaintOffsetTranslation->parent(); | 806 auto* divWithTransformTransform = iframePaintOffsetTranslation->parent(); |
| 813 EXPECT_EQ(TransformationMatrix().translate3d(1, 2, 3), divWithTransformTrans
form->matrix()); | 807 EXPECT_EQ(TransformationMatrix().translate3d(1, 2, 3), divWithTransformTrans
form->matrix()); |
| 814 | 808 |
| 815 LayoutObject* divWithTransform = document().getElementById("divWithTransform
")->layoutObject(); | 809 LayoutObject* divWithTransform = document().getElementById("divWithTransform
")->layoutObject(); |
| 816 EXPECT_EQ(divWithTransformTransform, divWithTransform->objectPaintProperties
()->transform()); | 810 EXPECT_EQ(divWithTransformTransform, divWithTransform->objectPaintProperties
()->transform()); |
| 817 // http://crbug.com/638415 | 811 // http://crbug.com/638415 |
| 818 if (!rootLayerScrolls()) { | 812 if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { |
| 819 CHECK_EXACT_VISUAL_RECT(LayoutRect(1, 2, 800, 248), divWithTransform, fr
ameView->layoutView()); | 813 CHECK_EXACT_VISUAL_RECT(LayoutRect(1, 2, 800, 248), divWithTransform, fr
ameView->layoutView()); |
| 820 } | 814 } |
| 821 } | 815 } |
| 822 | 816 |
| 823 TEST_P(PaintPropertyTreeBuilderTest, TreeContextClipByNonStackingContext) | 817 TEST_P(PaintPropertyTreeBuilderTest, TreeContextClipByNonStackingContext) |
| 824 { | 818 { |
| 825 // This test verifies the tree builder correctly computes and records the pr
operty tree context | 819 // This test verifies the tree builder correctly computes and records the pr
operty tree context |
| 826 // for a (pseudo) stacking context that is scrolled by a containing block th
at is not one of | 820 // for a (pseudo) stacking context that is scrolled by a containing block th
at is not one of |
| 827 // the painting ancestors. | 821 // the painting ancestors. |
| 828 setBodyInnerHTML( | 822 setBodyInnerHTML( |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 861 ); | 855 ); |
| 862 | 856 |
| 863 LayoutObject& scroller = *document().getElementById("scroller")->layoutObjec
t(); | 857 LayoutObject& scroller = *document().getElementById("scroller")->layoutObjec
t(); |
| 864 const ObjectPaintProperties* scrollerProperties = scroller.objectPaintProper
ties(); | 858 const ObjectPaintProperties* scrollerProperties = scroller.objectPaintProper
ties(); |
| 865 LayoutObject& child = *document().getElementById("child")->layoutObject(); | 859 LayoutObject& child = *document().getElementById("child")->layoutObject(); |
| 866 const ObjectPaintProperties* childProperties = child.objectPaintProperties()
; | 860 const ObjectPaintProperties* childProperties = child.objectPaintProperties()
; |
| 867 | 861 |
| 868 EXPECT_EQ(frameContentClip(), childProperties->localBorderBoxProperties()->p
ropertyTreeState.clip); | 862 EXPECT_EQ(frameContentClip(), childProperties->localBorderBoxProperties()->p
ropertyTreeState.clip); |
| 869 EXPECT_EQ(frameScrollTranslation(), childProperties->localBorderBoxPropertie
s()->propertyTreeState.transform); | 863 EXPECT_EQ(frameScrollTranslation(), childProperties->localBorderBoxPropertie
s()->propertyTreeState.transform); |
| 870 EXPECT_EQ(scrollerProperties->effect(), childProperties->localBorderBoxPrope
rties()->propertyTreeState.effect); | 864 EXPECT_EQ(scrollerProperties->effect(), childProperties->localBorderBoxPrope
rties()->propertyTreeState.effect); |
| 871 if (!rootLayerScrolls()) { | 865 if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { |
| 872 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 800, 10000), &scroller, documen
t().view()->layoutView()); | 866 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 800, 10000), &scroller, documen
t().view()->layoutView()); |
| 873 } | 867 } |
| 874 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 100, 200), &child, document().view(
)->layoutView()); | 868 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 100, 200), &child, document().view(
)->layoutView()); |
| 875 } | 869 } |
| 876 | 870 |
| 877 TEST_P(PaintPropertyTreeBuilderTest, TableCellLayoutLocation) | 871 TEST_P(PaintPropertyTreeBuilderTest, TableCellLayoutLocation) |
| 878 { | 872 { |
| 879 // This test verifies that the border box space of a table cell is being cor
rectly computed. | 873 // This test verifies that the border box space of a table cell is being cor
rectly computed. |
| 880 // Table cells have weird location adjustment in our layout/paint implementa
tion. | 874 // Table cells have weird location adjustment in our layout/paint implementa
tion. |
| 881 setBodyInnerHTML( | 875 setBodyInnerHTML( |
| (...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1588 EXPECT_EQ(cProperties, c->layoutObject()->objectPaintProperties()); | 1582 EXPECT_EQ(cProperties, c->layoutObject()->objectPaintProperties()); |
| 1589 EXPECT_EQ(cTransformNode, cProperties->transform()); | 1583 EXPECT_EQ(cTransformNode, cProperties->transform()); |
| 1590 EXPECT_EQ(bTransformNode, cTransformNode->parent()); | 1584 EXPECT_EQ(bTransformNode, cTransformNode->parent()); |
| 1591 | 1585 |
| 1592 CHECK_EXACT_VISUAL_RECT(LayoutRect(33, 44, 50, 60), a->layoutObject(), frame
View->layoutView()); | 1586 CHECK_EXACT_VISUAL_RECT(LayoutRect(33, 44, 50, 60), a->layoutObject(), frame
View->layoutView()); |
| 1593 CHECK_EXACT_VISUAL_RECT(LayoutRect(37, 49, 50, 20), b->layoutObject(), frame
View->layoutView()); | 1587 CHECK_EXACT_VISUAL_RECT(LayoutRect(37, 49, 50, 20), b->layoutObject(), frame
View->layoutView()); |
| 1594 CHECK_EXACT_VISUAL_RECT(LayoutRect(114, 137, 10, 20), c->layoutObject(), fra
meView->layoutView()); | 1588 CHECK_EXACT_VISUAL_RECT(LayoutRect(114, 137, 10, 20), c->layoutObject(), fra
meView->layoutView()); |
| 1595 } | 1589 } |
| 1596 | 1590 |
| 1597 } // namespace blink | 1591 } // namespace blink |
| OLD | NEW |