| 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 "core/paint/PaintPropertyTreePrinter.h" | 9 #include "core/paint/PaintPropertyTreePrinter.h" |
| 10 #include "platform/graphics/paint/GeometryMapper.h" | 10 #include "platform/graphics/paint/GeometryMapper.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 | 33 |
| 34 void loadTestData(const char* fileName) | 34 void loadTestData(const char* fileName) |
| 35 { | 35 { |
| 36 String fullPath = testing::blinkRootDir(); | 36 String fullPath = testing::blinkRootDir(); |
| 37 fullPath.append("/Source/core/paint/test_data/"); | 37 fullPath.append("/Source/core/paint/test_data/"); |
| 38 fullPath.append(fileName); | 38 fullPath.append(fileName); |
| 39 RefPtr<SharedBuffer> inputBuffer = testing::readFromFile(fullPath); | 39 RefPtr<SharedBuffer> inputBuffer = testing::readFromFile(fullPath); |
| 40 setBodyInnerHTML(String(inputBuffer->data(), inputBuffer->size())); | 40 setBodyInnerHTML(String(inputBuffer->data(), inputBuffer->size())); |
| 41 } | 41 } |
| 42 | 42 |
| 43 const TransformPaintPropertyNode* rootTransform() | |
| 44 { | |
| 45 FrameView* frameView = document().view(); | |
| 46 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) | |
| 47 return frameView->layoutView()->objectPaintProperties()->paintOffset
Translation(); | |
| 48 return frameView->rootTransform(); | |
| 49 } | |
| 50 | |
| 51 const ClipPaintPropertyNode* rootClip() | |
| 52 { | |
| 53 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) | |
| 54 return document().view()->layoutView()->objectPaintProperties()->loc
alBorderBoxProperties()->geometryPropertyTreeState.clip.get(); | |
| 55 return document().view()->rootClip(); | |
| 56 } | |
| 57 | |
| 58 const ScrollPaintPropertyNode* rootScroll() | |
| 59 { | |
| 60 FrameView* frameView = document().view(); | |
| 61 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) | |
| 62 return frameView->layoutView()->objectPaintProperties()->scroll(); | |
| 63 return frameView->rootScroll(); | |
| 64 } | |
| 65 | |
| 66 const TransformPaintPropertyNode* framePreTranslation() | 43 const TransformPaintPropertyNode* framePreTranslation() |
| 67 { | 44 { |
| 68 FrameView* frameView = document().view(); | 45 FrameView* frameView = document().view(); |
| 69 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) | 46 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) |
| 70 return frameView->layoutView()->objectPaintProperties()->paintOffset
Translation(); | 47 return frameView->layoutView()->objectPaintProperties()->paintOffset
Translation(); |
| 71 return frameView->preTranslation(); | 48 return frameView->preTranslation(); |
| 72 } | 49 } |
| 73 | 50 |
| 74 const TransformPaintPropertyNode* frameScrollTranslation() | 51 const TransformPaintPropertyNode* frameScrollTranslation() |
| 75 { | 52 { |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 Element* target1 = document().getElementById("target1"); | 140 Element* target1 = document().getElementById("target1"); |
| 164 const ObjectPaintProperties* target1Properties = target1->layoutObject()->ob
jectPaintProperties(); | 141 const ObjectPaintProperties* target1Properties = target1->layoutObject()->ob
jectPaintProperties(); |
| 165 EXPECT_EQ(TransformationMatrix().translate(200, 150), target1Properties->pai
ntOffsetTranslation()->matrix()); | 142 EXPECT_EQ(TransformationMatrix().translate(200, 150), target1Properties->pai
ntOffsetTranslation()->matrix()); |
| 166 EXPECT_EQ(framePreTranslation(), target1Properties->paintOffsetTranslation()
->parent()); | 143 EXPECT_EQ(framePreTranslation(), target1Properties->paintOffsetTranslation()
->parent()); |
| 167 EXPECT_EQ(target1Properties->paintOffsetTranslation(), target1Properties->ov
erflowClip()->localTransformSpace()); | 144 EXPECT_EQ(target1Properties->paintOffsetTranslation(), target1Properties->ov
erflowClip()->localTransformSpace()); |
| 168 EXPECT_EQ(FloatRoundedRect(0, 0, 100, 100), target1Properties->overflowClip(
)->clipRect()); | 145 EXPECT_EQ(FloatRoundedRect(0, 0, 100, 100), target1Properties->overflowClip(
)->clipRect()); |
| 169 // Likewise, it inherits clip from the viewport, skipping overflow clip of t
he scroller. | 146 // Likewise, it inherits clip from the viewport, skipping overflow clip of t
he scroller. |
| 170 EXPECT_EQ(frameContentClip(), target1Properties->overflowClip()->parent()); | 147 EXPECT_EQ(frameContentClip(), target1Properties->overflowClip()->parent()); |
| 171 // target1 should not have it's own scroll node and instead should inherit p
ositionedScroll's. | 148 // target1 should not have it's own scroll node and instead should inherit p
ositionedScroll's. |
| 172 const ObjectPaintProperties* positionedScrollProperties = positionedScroll->
layoutObject()->objectPaintProperties(); | 149 const ObjectPaintProperties* positionedScrollProperties = positionedScroll->
layoutObject()->objectPaintProperties(); |
| 173 EXPECT_EQ(rootScroll(), positionedScrollProperties->scroll()->parent()); | 150 EXPECT_EQ(nullptr, positionedScrollProperties->scroll()->parent()); |
| 174 EXPECT_EQ(TransformationMatrix().translate(0, -3), positionedScrollPropertie
s->scroll()->scrollOffsetTranslation()->matrix()); | 151 EXPECT_EQ(TransformationMatrix().translate(0, -3), positionedScrollPropertie
s->scroll()->scrollOffsetTranslation()->matrix()); |
| 175 EXPECT_EQ(nullptr, target1Properties->scroll()); | 152 EXPECT_EQ(nullptr, target1Properties->scroll()); |
| 176 | 153 |
| 177 CHECK_EXACT_VISUAL_RECT(LayoutRect(200, 150, 100, 100), target1->layoutObjec
t(), frameView->layoutView()); | 154 CHECK_EXACT_VISUAL_RECT(LayoutRect(200, 150, 100, 100), target1->layoutObjec
t(), frameView->layoutView()); |
| 178 | 155 |
| 179 // target2 is a fixed-position element inside a transformed scrolling elemen
t. | 156 // target2 is a fixed-position element inside a transformed scrolling elemen
t. |
| 180 // It should be attached under the scrolled box of the transformed element. | 157 // It should be attached under the scrolled box of the transformed element. |
| 181 Element* target2 = document().getElementById("target2"); | 158 Element* target2 = document().getElementById("target2"); |
| 182 const ObjectPaintProperties* target2Properties = target2->layoutObject()->ob
jectPaintProperties(); | 159 const ObjectPaintProperties* target2Properties = target2->layoutObject()->ob
jectPaintProperties(); |
| 183 Element* scroller = document().getElementById("transformedScroll"); | 160 Element* scroller = document().getElementById("transformedScroll"); |
| 184 const ObjectPaintProperties* scrollerProperties = scroller->layoutObject()->
objectPaintProperties(); | 161 const ObjectPaintProperties* scrollerProperties = scroller->layoutObject()->
objectPaintProperties(); |
| 185 EXPECT_EQ(TransformationMatrix().translate(200, 150), target2Properties->pai
ntOffsetTranslation()->matrix()); | 162 EXPECT_EQ(TransformationMatrix().translate(200, 150), target2Properties->pai
ntOffsetTranslation()->matrix()); |
| 186 EXPECT_EQ(scrollerProperties->scrollTranslation(), target2Properties->paintO
ffsetTranslation()->parent()); | 163 EXPECT_EQ(scrollerProperties->scrollTranslation(), target2Properties->paintO
ffsetTranslation()->parent()); |
| 187 EXPECT_EQ(target2Properties->paintOffsetTranslation(), target2Properties->ov
erflowClip()->localTransformSpace()); | 164 EXPECT_EQ(target2Properties->paintOffsetTranslation(), target2Properties->ov
erflowClip()->localTransformSpace()); |
| 188 EXPECT_EQ(FloatRoundedRect(0, 0, 100, 100), target2Properties->overflowClip(
)->clipRect()); | 165 EXPECT_EQ(FloatRoundedRect(0, 0, 100, 100), target2Properties->overflowClip(
)->clipRect()); |
| 189 EXPECT_EQ(scrollerProperties->overflowClip(), target2Properties->overflowCli
p()->parent()); | 166 EXPECT_EQ(scrollerProperties->overflowClip(), target2Properties->overflowCli
p()->parent()); |
| 190 // target2 should not have it's own scroll node and instead should inherit t
ransformedScroll's. | 167 // target2 should not have it's own scroll node and instead should inherit t
ransformedScroll's. |
| 191 const ObjectPaintProperties* transformedScrollProperties = transformedScroll
->layoutObject()->objectPaintProperties(); | 168 const ObjectPaintProperties* transformedScrollProperties = transformedScroll
->layoutObject()->objectPaintProperties(); |
| 192 EXPECT_EQ(rootScroll(), transformedScrollProperties->scroll()->parent()); | 169 EXPECT_EQ(nullptr, transformedScrollProperties->scroll()->parent()); |
| 193 EXPECT_EQ(TransformationMatrix().translate(0, -5), transformedScrollProperti
es->scroll()->scrollOffsetTranslation()->matrix()); | 170 EXPECT_EQ(TransformationMatrix().translate(0, -5), transformedScrollProperti
es->scroll()->scrollOffsetTranslation()->matrix()); |
| 194 EXPECT_EQ(nullptr, target2Properties->scroll()); | 171 EXPECT_EQ(nullptr, target2Properties->scroll()); |
| 195 | 172 |
| 196 CHECK_EXACT_VISUAL_RECT(LayoutRect(208, 153, 200, 100), target2->layoutObjec
t(), frameView->layoutView()); | 173 CHECK_EXACT_VISUAL_RECT(LayoutRect(208, 153, 200, 100), target2->layoutObjec
t(), frameView->layoutView()); |
| 197 } | 174 } |
| 198 | 175 |
| 199 TEST_P(PaintPropertyTreeBuilderTest, PositionAndScroll) | 176 TEST_P(PaintPropertyTreeBuilderTest, PositionAndScroll) |
| 200 { | 177 { |
| 201 loadTestData("position-and-scroll.html"); | 178 loadTestData("position-and-scroll.html"); |
| 202 | 179 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 TEST_P(PaintPropertyTreeBuilderTest, FrameScrollingTraditional) | 225 TEST_P(PaintPropertyTreeBuilderTest, FrameScrollingTraditional) |
| 249 { | 226 { |
| 250 setBodyInnerHTML("<style> body { height: 10000px; } </style>"); | 227 setBodyInnerHTML("<style> body { height: 10000px; } </style>"); |
| 251 | 228 |
| 252 document().domWindow()->scrollTo(0, 100); | 229 document().domWindow()->scrollTo(0, 100); |
| 253 | 230 |
| 254 FrameView* frameView = document().view(); | 231 FrameView* frameView = document().view(); |
| 255 frameView->updateAllLifecyclePhases(); | 232 frameView->updateAllLifecyclePhases(); |
| 256 EXPECT_EQ(TransformationMatrix(), framePreTranslation()->matrix()); | 233 EXPECT_EQ(TransformationMatrix(), framePreTranslation()->matrix()); |
| 257 if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) | 234 if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) |
| 258 EXPECT_EQ(rootTransform(), framePreTranslation()->parent()); | 235 EXPECT_EQ(nullptr, framePreTranslation()->parent()); |
| 259 EXPECT_EQ(nullptr, rootTransform()->parent()); | |
| 260 EXPECT_EQ(TransformationMatrix().translate(0, -100), frameScrollTranslation(
)->matrix()); | 236 EXPECT_EQ(TransformationMatrix().translate(0, -100), frameScrollTranslation(
)->matrix()); |
| 261 EXPECT_EQ(framePreTranslation(), frameScrollTranslation()->parent()); | 237 EXPECT_EQ(framePreTranslation(), frameScrollTranslation()->parent()); |
| 262 EXPECT_EQ(framePreTranslation(), frameContentClip()->localTransformSpace()); | 238 EXPECT_EQ(framePreTranslation(), frameContentClip()->localTransformSpace()); |
| 263 EXPECT_EQ(FloatRoundedRect(0, 0, 800, 600), frameContentClip()->clipRect()); | 239 EXPECT_EQ(FloatRoundedRect(0, 0, 800, 600), frameContentClip()->clipRect()); |
| 264 EXPECT_EQ(rootClip(), frameContentClip()->parent()); | 240 EXPECT_EQ(nullptr, frameContentClip()->parent()); |
| 265 if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) | |
| 266 EXPECT_EQ(nullptr, rootClip()->parent()); | |
| 267 | 241 |
| 268 LayoutViewItem layoutViewItem = document().layoutViewItem(); | 242 LayoutViewItem layoutViewItem = document().layoutViewItem(); |
| 269 const ObjectPaintProperties* layoutViewProperties = layoutViewItem.objectPai
ntProperties(); | 243 const ObjectPaintProperties* layoutViewProperties = layoutViewItem.objectPai
ntProperties(); |
| 270 // http://crbug.com/638415 | 244 // http://crbug.com/638415 |
| 271 if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { | 245 if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { |
| 272 EXPECT_EQ(nullptr, layoutViewProperties->scrollTranslation()); | 246 EXPECT_EQ(nullptr, layoutViewProperties->scrollTranslation()); |
| 273 CHECK_EXACT_VISUAL_RECT(LayoutRect(8, 8, 784, 10000), document().body()-
>layoutObject(), frameView->layoutView()); | 247 CHECK_EXACT_VISUAL_RECT(LayoutRect(8, 8, 784, 10000), document().body()-
>layoutObject(), frameView->layoutView()); |
| 274 } | 248 } |
| 275 } | 249 } |
| 276 | 250 |
| 277 TEST_P(PaintPropertyTreeBuilderTest, Perspective) | 251 TEST_P(PaintPropertyTreeBuilderTest, Perspective) |
| 278 { | 252 { |
| 279 loadTestData("perspective.html"); | 253 loadTestData("perspective.html"); |
| 280 | 254 |
| 281 Element* perspective = document().getElementById("perspective"); | 255 Element* perspective = document().getElementById("perspective"); |
| 282 const ObjectPaintProperties* perspectiveProperties = perspective->layoutObje
ct()->objectPaintProperties(); | 256 const ObjectPaintProperties* perspectiveProperties = perspective->layoutObje
ct()->objectPaintProperties(); |
| 283 EXPECT_EQ(TransformationMatrix().applyPerspective(100), perspectivePropertie
s->perspective()->matrix()); | 257 EXPECT_EQ(TransformationMatrix().applyPerspective(100), perspectivePropertie
s->perspective()->matrix()); |
| 284 // The perspective origin is the center of the border box plus accumulated p
aint offset. | 258 // The perspective origin is the center of the border box plus accumulated p
aint offset. |
| 285 EXPECT_EQ(FloatPoint3D(250, 250, 0), perspectiveProperties->perspective()->o
rigin()); | 259 EXPECT_EQ(FloatPoint3D(250, 250, 0), perspectiveProperties->perspective()->o
rigin()); |
| 286 EXPECT_EQ(frameScrollTranslation(), perspectiveProperties->perspective()->pa
rent()); | 260 EXPECT_EQ(framePreTranslation(), perspectiveProperties->perspective()->paren
t()); |
| 287 | 261 |
| 288 // Adding perspective doesn't clear paint offset. The paint offset will be p
assed down to children. | 262 // Adding perspective doesn't clear paint offset. The paint offset will be p
assed down to children. |
| 289 Element* inner = document().getElementById("inner"); | 263 Element* inner = document().getElementById("inner"); |
| 290 const ObjectPaintProperties* innerProperties = inner->layoutObject()->object
PaintProperties(); | 264 const ObjectPaintProperties* innerProperties = inner->layoutObject()->object
PaintProperties(); |
| 291 EXPECT_EQ(TransformationMatrix().translate(50, 100), innerProperties->paintO
ffsetTranslation()->matrix()); | 265 EXPECT_EQ(TransformationMatrix().translate(50, 100), innerProperties->paintO
ffsetTranslation()->matrix()); |
| 292 EXPECT_EQ(perspectiveProperties->perspective(), innerProperties->paintOffset
Translation()->parent()); | 266 EXPECT_EQ(perspectiveProperties->perspective(), innerProperties->paintOffset
Translation()->parent()); |
| 293 CHECK_EXACT_VISUAL_RECT(LayoutRect(50, 100, 100, 200), inner->layoutObject()
, document().view()->layoutView()); | 267 CHECK_EXACT_VISUAL_RECT(LayoutRect(50, 100, 100, 200), inner->layoutObject()
, document().view()->layoutView()); |
| 294 } | 268 } |
| 295 | 269 |
| 296 TEST_P(PaintPropertyTreeBuilderTest, Transform) | 270 TEST_P(PaintPropertyTreeBuilderTest, Transform) |
| (...skipping 13 matching lines...) Expand all Loading... |
| 310 } | 284 } |
| 311 } | 285 } |
| 312 | 286 |
| 313 TEST_P(PaintPropertyTreeBuilderTest, RelativePositionInline) | 287 TEST_P(PaintPropertyTreeBuilderTest, RelativePositionInline) |
| 314 { | 288 { |
| 315 loadTestData("relative-position-inline.html"); | 289 loadTestData("relative-position-inline.html"); |
| 316 | 290 |
| 317 Element* inlineBlock = document().getElementById("inline-block"); | 291 Element* inlineBlock = document().getElementById("inline-block"); |
| 318 const ObjectPaintProperties* inlineBlockProperties = inlineBlock->layoutObje
ct()->objectPaintProperties(); | 292 const ObjectPaintProperties* inlineBlockProperties = inlineBlock->layoutObje
ct()->objectPaintProperties(); |
| 319 EXPECT_EQ(TransformationMatrix().translate(135, 490), inlineBlockProperties-
>paintOffsetTranslation()->matrix()); | 293 EXPECT_EQ(TransformationMatrix().translate(135, 490), inlineBlockProperties-
>paintOffsetTranslation()->matrix()); |
| 320 EXPECT_EQ(frameScrollTranslation(), inlineBlockProperties->paintOffsetTransl
ation()->parent()); | 294 EXPECT_EQ(framePreTranslation(), inlineBlockProperties->paintOffsetTranslati
on()->parent()); |
| 321 CHECK_EXACT_VISUAL_RECT(LayoutRect(135, 490, 10, 20), inlineBlock->layoutObj
ect(), document().view()->layoutView()); | 295 CHECK_EXACT_VISUAL_RECT(LayoutRect(135, 490, 10, 20), inlineBlock->layoutObj
ect(), document().view()->layoutView()); |
| 322 } | 296 } |
| 323 | 297 |
| 324 TEST_P(PaintPropertyTreeBuilderTest, NestedOpacityEffect) | 298 TEST_P(PaintPropertyTreeBuilderTest, NestedOpacityEffect) |
| 325 { | 299 { |
| 326 setBodyInnerHTML( | 300 setBodyInnerHTML( |
| 327 "<div id='nodeWithoutOpacity' style='width: 100px; height: 200px'>" | 301 "<div id='nodeWithoutOpacity' style='width: 100px; height: 200px'>" |
| 328 " <div id='childWithOpacity' style='opacity: 0.5; width: 50px; height:
60px;'>" | 302 " <div id='childWithOpacity' style='opacity: 0.5; width: 50px; height:
60px;'>" |
| 329 " <div id='grandChildWithoutOpacity' style='width: 20px; height: 30px
'>" | 303 " <div id='grandChildWithoutOpacity' style='width: 20px; height: 30px
'>" |
| 330 " <div id='greatGrandChildWithOpacity' style='opacity: 0.2; width:
10px; height: 15px'/>" | 304 " <div id='greatGrandChildWithOpacity' style='opacity: 0.2; width:
10px; height: 15px'/>" |
| 331 " </div>" | 305 " </div>" |
| 332 " </div>" | 306 " </div>" |
| 333 "</div>"); | 307 "</div>"); |
| 334 | 308 |
| 335 LayoutObject* nodeWithoutOpacity = document().getElementById("nodeWithoutOpa
city")->layoutObject(); | 309 LayoutObject* nodeWithoutOpacity = document().getElementById("nodeWithoutOpa
city")->layoutObject(); |
| 336 const ObjectPaintProperties* nodeWithoutOpacityProperties = nodeWithoutOpaci
ty->objectPaintProperties(); | 310 const ObjectPaintProperties* nodeWithoutOpacityProperties = nodeWithoutOpaci
ty->objectPaintProperties(); |
| 337 EXPECT_NE(nullptr, nodeWithoutOpacityProperties); | 311 EXPECT_NE(nullptr, nodeWithoutOpacityProperties); |
| 338 CHECK_EXACT_VISUAL_RECT(LayoutRect(8, 8, 100, 200), nodeWithoutOpacity, docu
ment().view()->layoutView()); | 312 CHECK_EXACT_VISUAL_RECT(LayoutRect(8, 8, 100, 200), nodeWithoutOpacity, docu
ment().view()->layoutView()); |
| 339 | 313 |
| 340 LayoutObject* childWithOpacity = document().getElementById("childWithOpacity
")->layoutObject(); | 314 LayoutObject* childWithOpacity = document().getElementById("childWithOpacity
")->layoutObject(); |
| 341 const ObjectPaintProperties* childWithOpacityProperties = childWithOpacity->
objectPaintProperties(); | 315 const ObjectPaintProperties* childWithOpacityProperties = childWithOpacity->
objectPaintProperties(); |
| 342 EXPECT_EQ(0.5f, childWithOpacityProperties->effect()->opacity()); | 316 EXPECT_EQ(0.5f, childWithOpacityProperties->effect()->opacity()); |
| 343 // childWithOpacity is the root effect node. | 317 // childWithOpacity is the root effect node. |
| 344 EXPECT_NE(nullptr, childWithOpacityProperties->effect()->parent()); | 318 EXPECT_EQ(nullptr, childWithOpacityProperties->effect()->parent()); |
| 345 CHECK_EXACT_VISUAL_RECT(LayoutRect(8, 8, 50, 60), childWithOpacity, document
().view()->layoutView()); | 319 CHECK_EXACT_VISUAL_RECT(LayoutRect(8, 8, 50, 60), childWithOpacity, document
().view()->layoutView()); |
| 346 | 320 |
| 347 LayoutObject* grandChildWithoutOpacity = document().getElementById("grandChi
ldWithoutOpacity")->layoutObject(); | 321 LayoutObject* grandChildWithoutOpacity = document().getElementById("grandChi
ldWithoutOpacity")->layoutObject(); |
| 348 EXPECT_NE(nullptr, grandChildWithoutOpacity->objectPaintProperties()); | 322 EXPECT_NE(nullptr, grandChildWithoutOpacity->objectPaintProperties()); |
| 349 CHECK_EXACT_VISUAL_RECT(LayoutRect(8, 8, 20, 30), grandChildWithoutOpacity,
document().view()->layoutView()); | 323 CHECK_EXACT_VISUAL_RECT(LayoutRect(8, 8, 20, 30), grandChildWithoutOpacity,
document().view()->layoutView()); |
| 350 | 324 |
| 351 LayoutObject* greatGrandChildWithOpacity = document().getElementById("greatG
randChildWithOpacity")->layoutObject(); | 325 LayoutObject* greatGrandChildWithOpacity = document().getElementById("greatG
randChildWithOpacity")->layoutObject(); |
| 352 const ObjectPaintProperties* greatGrandChildWithOpacityProperties = greatGra
ndChildWithOpacity->objectPaintProperties(); | 326 const ObjectPaintProperties* greatGrandChildWithOpacityProperties = greatGra
ndChildWithOpacity->objectPaintProperties(); |
| 353 EXPECT_EQ(0.2f, greatGrandChildWithOpacityProperties->effect()->opacity()); | 327 EXPECT_EQ(0.2f, greatGrandChildWithOpacityProperties->effect()->opacity()); |
| 354 EXPECT_EQ(childWithOpacityProperties->effect(), greatGrandChildWithOpacityPr
operties->effect()->parent()); | 328 EXPECT_EQ(childWithOpacityProperties->effect(), greatGrandChildWithOpacityPr
operties->effect()->parent()); |
| 355 CHECK_EXACT_VISUAL_RECT(LayoutRect(8, 8, 10, 15), greatGrandChildWithOpacity
, document().view()->layoutView()); | 329 CHECK_EXACT_VISUAL_RECT(LayoutRect(8, 8, 10, 15), greatGrandChildWithOpacity
, document().view()->layoutView()); |
| 356 } | 330 } |
| 357 | 331 |
| 358 TEST_P(PaintPropertyTreeBuilderTest, TransformNodeDoesNotAffectEffectNodes) | 332 TEST_P(PaintPropertyTreeBuilderTest, TransformNodeDoesNotAffectEffectNodes) |
| 359 { | 333 { |
| 360 setBodyInnerHTML( | 334 setBodyInnerHTML( |
| 361 "<div id='nodeWithOpacity' style='opacity: 0.6' style='width: 100px; hei
ght: 200px'>" | 335 "<div id='nodeWithOpacity' style='opacity: 0.6' style='width: 100px; hei
ght: 200px'>" |
| 362 " <div id='childWithTransform' style='transform: translate3d(10px, 10px
, 0px); width: 50px; height: 60px;'>" | 336 " <div id='childWithTransform' style='transform: translate3d(10px, 10px
, 0px); width: 50px; height: 60px;'>" |
| 363 " <div id='grandChildWithOpacity' style='opacity: 0.4; width: 20px; h
eight: 30px'/>" | 337 " <div id='grandChildWithOpacity' style='opacity: 0.4; width: 20px; h
eight: 30px'/>" |
| 364 " </div>" | 338 " </div>" |
| 365 "</div>"); | 339 "</div>"); |
| 366 | 340 |
| 367 LayoutObject* nodeWithOpacity = document().getElementById("nodeWithOpacity")
->layoutObject(); | 341 LayoutObject* nodeWithOpacity = document().getElementById("nodeWithOpacity")
->layoutObject(); |
| 368 const ObjectPaintProperties* nodeWithOpacityProperties = nodeWithOpacity->ob
jectPaintProperties(); | 342 const ObjectPaintProperties* nodeWithOpacityProperties = nodeWithOpacity->ob
jectPaintProperties(); |
| 369 EXPECT_EQ(0.6f, nodeWithOpacityProperties->effect()->opacity()); | 343 EXPECT_EQ(0.6f, nodeWithOpacityProperties->effect()->opacity()); |
| 370 EXPECT_NE(nullptr, nodeWithOpacityProperties->effect()->parent()); | 344 EXPECT_EQ(nullptr, nodeWithOpacityProperties->effect()->parent()); |
| 371 EXPECT_EQ(nullptr, nodeWithOpacityProperties->transform()); | 345 EXPECT_EQ(nullptr, nodeWithOpacityProperties->transform()); |
| 372 CHECK_EXACT_VISUAL_RECT(LayoutRect(8, 8, 784, 60), nodeWithOpacity, document
().view()->layoutView()); | 346 CHECK_EXACT_VISUAL_RECT(LayoutRect(8, 8, 784, 60), nodeWithOpacity, document
().view()->layoutView()); |
| 373 | 347 |
| 374 LayoutObject* childWithTransform = document().getElementById("childWithTrans
form")->layoutObject(); | 348 LayoutObject* childWithTransform = document().getElementById("childWithTrans
form")->layoutObject(); |
| 375 const ObjectPaintProperties* childWithTransformProperties = childWithTransfo
rm->objectPaintProperties(); | 349 const ObjectPaintProperties* childWithTransformProperties = childWithTransfo
rm->objectPaintProperties(); |
| 376 EXPECT_EQ(nullptr, childWithTransformProperties->effect()); | 350 EXPECT_EQ(nullptr, childWithTransformProperties->effect()); |
| 377 EXPECT_EQ(TransformationMatrix().translate(10, 10), childWithTransformProper
ties->transform()->matrix()); | 351 EXPECT_EQ(TransformationMatrix().translate(10, 10), childWithTransformProper
ties->transform()->matrix()); |
| 378 CHECK_EXACT_VISUAL_RECT(LayoutRect(18, 18, 50, 60), childWithTransform, docu
ment().view()->layoutView()); | 352 CHECK_EXACT_VISUAL_RECT(LayoutRect(18, 18, 50, 60), childWithTransform, docu
ment().view()->layoutView()); |
| 379 | 353 |
| 380 LayoutObject* grandChildWithOpacity = document().getElementById("grandChildW
ithOpacity")->layoutObject(); | 354 LayoutObject* grandChildWithOpacity = document().getElementById("grandChildW
ithOpacity")->layoutObject(); |
| 381 const ObjectPaintProperties* grandChildWithOpacityProperties = grandChildWit
hOpacity->objectPaintProperties(); | 355 const ObjectPaintProperties* grandChildWithOpacityProperties = grandChildWit
hOpacity->objectPaintProperties(); |
| 382 EXPECT_EQ(0.4f, grandChildWithOpacityProperties->effect()->opacity()); | 356 EXPECT_EQ(0.4f, grandChildWithOpacityProperties->effect()->opacity()); |
| 383 EXPECT_EQ(nodeWithOpacityProperties->effect(), grandChildWithOpacityProperti
es->effect()->parent()); | 357 EXPECT_EQ(nodeWithOpacityProperties->effect(), grandChildWithOpacityProperti
es->effect()->parent()); |
| 384 EXPECT_EQ(nullptr, grandChildWithOpacityProperties->transform()); | 358 EXPECT_EQ(nullptr, grandChildWithOpacityProperties->transform()); |
| 385 CHECK_EXACT_VISUAL_RECT(LayoutRect(18, 18, 20, 30), grandChildWithOpacity, d
ocument().view()->layoutView()); | 359 CHECK_EXACT_VISUAL_RECT(LayoutRect(18, 18, 20, 30), grandChildWithOpacity, d
ocument().view()->layoutView()); |
| 386 } | 360 } |
| 387 | 361 |
| 388 TEST_P(PaintPropertyTreeBuilderTest, EffectNodesAcrossStackingContext) | 362 TEST_P(PaintPropertyTreeBuilderTest, EffectNodesAcrossStackingContext) |
| 389 { | 363 { |
| 390 setBodyInnerHTML( | 364 setBodyInnerHTML( |
| 391 "<div id='nodeWithOpacity' style='opacity: 0.6; width: 100px; height: 20
0px'>" | 365 "<div id='nodeWithOpacity' style='opacity: 0.6; width: 100px; height: 20
0px'>" |
| 392 " <div id='childWithStackingContext' style='position:absolute; width: 5
0px; height: 60px;'>" | 366 " <div id='childWithStackingContext' style='position:absolute; width: 5
0px; height: 60px;'>" |
| 393 " <div id='grandChildWithOpacity' style='opacity: 0.4; width: 20px; h
eight: 30px'/>" | 367 " <div id='grandChildWithOpacity' style='opacity: 0.4; width: 20px; h
eight: 30px'/>" |
| 394 " </div>" | 368 " </div>" |
| 395 "</div>"); | 369 "</div>"); |
| 396 | 370 |
| 397 LayoutObject* nodeWithOpacity = document().getElementById("nodeWithOpacity")
->layoutObject(); | 371 LayoutObject* nodeWithOpacity = document().getElementById("nodeWithOpacity")
->layoutObject(); |
| 398 const ObjectPaintProperties* nodeWithOpacityProperties = nodeWithOpacity->ob
jectPaintProperties(); | 372 const ObjectPaintProperties* nodeWithOpacityProperties = nodeWithOpacity->ob
jectPaintProperties(); |
| 399 EXPECT_EQ(0.6f, nodeWithOpacityProperties->effect()->opacity()); | 373 EXPECT_EQ(0.6f, nodeWithOpacityProperties->effect()->opacity()); |
| 400 EXPECT_NE(nullptr, nodeWithOpacityProperties->effect()->parent()); | 374 EXPECT_EQ(nullptr, nodeWithOpacityProperties->effect()->parent()); |
| 401 EXPECT_EQ(nullptr, nodeWithOpacityProperties->transform()); | 375 EXPECT_EQ(nullptr, nodeWithOpacityProperties->transform()); |
| 402 CHECK_EXACT_VISUAL_RECT(LayoutRect(8, 8, 100, 200), nodeWithOpacity, documen
t().view()->layoutView()); | 376 CHECK_EXACT_VISUAL_RECT(LayoutRect(8, 8, 100, 200), nodeWithOpacity, documen
t().view()->layoutView()); |
| 403 | 377 |
| 404 LayoutObject* childWithStackingContext = document().getElementById("childWit
hStackingContext")->layoutObject(); | 378 LayoutObject* childWithStackingContext = document().getElementById("childWit
hStackingContext")->layoutObject(); |
| 405 const ObjectPaintProperties* childWithStackingContextProperties = childWithS
tackingContext->objectPaintProperties(); | 379 const ObjectPaintProperties* childWithStackingContextProperties = childWithS
tackingContext->objectPaintProperties(); |
| 406 EXPECT_EQ(nullptr, childWithStackingContextProperties->effect()); | 380 EXPECT_EQ(nullptr, childWithStackingContextProperties->effect()); |
| 407 EXPECT_EQ(nullptr, childWithStackingContextProperties->transform()); | 381 EXPECT_EQ(nullptr, childWithStackingContextProperties->transform()); |
| 408 CHECK_EXACT_VISUAL_RECT(LayoutRect(8, 8, 50, 60), childWithStackingContext,
document().view()->layoutView()); | 382 CHECK_EXACT_VISUAL_RECT(LayoutRect(8, 8, 50, 60), childWithStackingContext,
document().view()->layoutView()); |
| 409 | 383 |
| 410 LayoutObject* grandChildWithOpacity = document().getElementById("grandChildW
ithOpacity")->layoutObject(); | 384 LayoutObject* grandChildWithOpacity = document().getElementById("grandChildW
ithOpacity")->layoutObject(); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 424 " <rect id='rectWithOpacity' opacity='0.4' />" | 398 " <rect id='rectWithOpacity' opacity='0.4' />" |
| 425 " <text id='textWithOpacity' opacity='0.2'>" | 399 " <text id='textWithOpacity' opacity='0.2'>" |
| 426 " <tspan id='tspanWithOpacity' opacity='0.1' />" | 400 " <tspan id='tspanWithOpacity' opacity='0.1' />" |
| 427 " </text>" | 401 " </text>" |
| 428 " </g>" | 402 " </g>" |
| 429 "</svg>"); | 403 "</svg>"); |
| 430 | 404 |
| 431 LayoutObject* groupWithOpacity = document().getElementById("groupWithOpacity
")->layoutObject(); | 405 LayoutObject* groupWithOpacity = document().getElementById("groupWithOpacity
")->layoutObject(); |
| 432 const ObjectPaintProperties* groupWithOpacityProperties = groupWithOpacity->
objectPaintProperties(); | 406 const ObjectPaintProperties* groupWithOpacityProperties = groupWithOpacity->
objectPaintProperties(); |
| 433 EXPECT_EQ(0.6f, groupWithOpacityProperties->effect()->opacity()); | 407 EXPECT_EQ(0.6f, groupWithOpacityProperties->effect()->opacity()); |
| 434 EXPECT_NE(nullptr, groupWithOpacityProperties->effect()->parent()); | 408 EXPECT_EQ(nullptr, groupWithOpacityProperties->effect()->parent()); |
| 435 | 409 |
| 436 LayoutObject& rectWithoutOpacity = *document().getElementById("rectWithoutOp
acity")->layoutObject(); | 410 LayoutObject& rectWithoutOpacity = *document().getElementById("rectWithoutOp
acity")->layoutObject(); |
| 437 const ObjectPaintProperties* rectWithoutOpacityProperties = rectWithoutOpaci
ty.objectPaintProperties(); | 411 const ObjectPaintProperties* rectWithoutOpacityProperties = rectWithoutOpaci
ty.objectPaintProperties(); |
| 438 EXPECT_EQ(nullptr, rectWithoutOpacityProperties); | 412 EXPECT_EQ(nullptr, rectWithoutOpacityProperties); |
| 439 | 413 |
| 440 LayoutObject& rectWithOpacity = *document().getElementById("rectWithOpacity"
)->layoutObject(); | 414 LayoutObject& rectWithOpacity = *document().getElementById("rectWithOpacity"
)->layoutObject(); |
| 441 const ObjectPaintProperties* rectWithOpacityProperties = rectWithOpacity.obj
ectPaintProperties(); | 415 const ObjectPaintProperties* rectWithOpacityProperties = rectWithOpacity.obj
ectPaintProperties(); |
| 442 EXPECT_EQ(0.4f, rectWithOpacityProperties->effect()->opacity()); | 416 EXPECT_EQ(0.4f, rectWithOpacityProperties->effect()->opacity()); |
| 443 EXPECT_EQ(groupWithOpacityProperties->effect(), rectWithOpacityProperties->e
ffect()->parent()); | 417 EXPECT_EQ(groupWithOpacityProperties->effect(), rectWithOpacityProperties->e
ffect()->parent()); |
| 444 | 418 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 460 setBodyInnerHTML( | 434 setBodyInnerHTML( |
| 461 "<div id='divWithOpacity' style='opacity: 0.2;'>" | 435 "<div id='divWithOpacity' style='opacity: 0.2;'>" |
| 462 " <svg id='svgRootWithOpacity' style='opacity: 0.3;'>" | 436 " <svg id='svgRootWithOpacity' style='opacity: 0.3;'>" |
| 463 " <rect id='rectWithOpacity' opacity='0.4' />" | 437 " <rect id='rectWithOpacity' opacity='0.4' />" |
| 464 " </svg>" | 438 " </svg>" |
| 465 "</div>"); | 439 "</div>"); |
| 466 | 440 |
| 467 LayoutObject& divWithOpacity = *document().getElementById("divWithOpacity")-
>layoutObject(); | 441 LayoutObject& divWithOpacity = *document().getElementById("divWithOpacity")-
>layoutObject(); |
| 468 const ObjectPaintProperties* divWithOpacityProperties = divWithOpacity.objec
tPaintProperties(); | 442 const ObjectPaintProperties* divWithOpacityProperties = divWithOpacity.objec
tPaintProperties(); |
| 469 EXPECT_EQ(0.2f, divWithOpacityProperties->effect()->opacity()); | 443 EXPECT_EQ(0.2f, divWithOpacityProperties->effect()->opacity()); |
| 470 EXPECT_NE(nullptr, divWithOpacityProperties->effect()->parent()); | 444 EXPECT_EQ(nullptr, divWithOpacityProperties->effect()->parent()); |
| 471 | 445 |
| 472 LayoutObject& svgRootWithOpacity = *document().getElementById("svgRootWithOp
acity")->layoutObject(); | 446 LayoutObject& svgRootWithOpacity = *document().getElementById("svgRootWithOp
acity")->layoutObject(); |
| 473 const ObjectPaintProperties* svgRootWithOpacityProperties = svgRootWithOpaci
ty.objectPaintProperties(); | 447 const ObjectPaintProperties* svgRootWithOpacityProperties = svgRootWithOpaci
ty.objectPaintProperties(); |
| 474 EXPECT_EQ(0.3f, svgRootWithOpacityProperties->effect()->opacity()); | 448 EXPECT_EQ(0.3f, svgRootWithOpacityProperties->effect()->opacity()); |
| 475 EXPECT_EQ(divWithOpacityProperties->effect(), svgRootWithOpacityProperties->
effect()->parent()); | 449 EXPECT_EQ(divWithOpacityProperties->effect(), svgRootWithOpacityProperties->
effect()->parent()); |
| 476 | 450 |
| 477 LayoutObject& rectWithOpacity = *document().getElementById("rectWithOpacity"
)->layoutObject(); | 451 LayoutObject& rectWithOpacity = *document().getElementById("rectWithOpacity"
)->layoutObject(); |
| 478 const ObjectPaintProperties* rectWithOpacityProperties = rectWithOpacity.obj
ectPaintProperties(); | 452 const ObjectPaintProperties* rectWithOpacityProperties = rectWithOpacity.obj
ectPaintProperties(); |
| 479 EXPECT_EQ(0.4f, rectWithOpacityProperties->effect()->opacity()); | 453 EXPECT_EQ(0.4f, rectWithOpacityProperties->effect()->opacity()); |
| 480 EXPECT_EQ(svgRootWithOpacityProperties->effect(), rectWithOpacityProperties-
>effect()->parent()); | 454 EXPECT_EQ(svgRootWithOpacityProperties->effect(), rectWithOpacityProperties-
>effect()->parent()); |
| 481 } | 455 } |
| 482 | 456 |
| 483 TEST_P(PaintPropertyTreeBuilderTest, EffectNodesAcrossSVGHTMLBoundary) | 457 TEST_P(PaintPropertyTreeBuilderTest, EffectNodesAcrossSVGHTMLBoundary) |
| 484 { | 458 { |
| 485 setBodyInnerHTML( | 459 setBodyInnerHTML( |
| 486 "<svg id='svgRootWithOpacity' style='opacity: 0.3;'>" | 460 "<svg id='svgRootWithOpacity' style='opacity: 0.3;'>" |
| 487 " <foreignObject id='foreignObjectWithOpacity' opacity='0.4'>" | 461 " <foreignObject id='foreignObjectWithOpacity' opacity='0.4'>" |
| 488 " <body>" | 462 " <body>" |
| 489 " <span id='spanWithOpacity' style='opacity: 0.5'/>" | 463 " <span id='spanWithOpacity' style='opacity: 0.5'/>" |
| 490 " </body>" | 464 " </body>" |
| 491 " </foreignObject>" | 465 " </foreignObject>" |
| 492 "</svg>"); | 466 "</svg>"); |
| 493 | 467 |
| 494 LayoutObject& svgRootWithOpacity = *document().getElementById("svgRootWithOp
acity")->layoutObject(); | 468 LayoutObject& svgRootWithOpacity = *document().getElementById("svgRootWithOp
acity")->layoutObject(); |
| 495 const ObjectPaintProperties* svgRootWithOpacityProperties = svgRootWithOpaci
ty.objectPaintProperties(); | 469 const ObjectPaintProperties* svgRootWithOpacityProperties = svgRootWithOpaci
ty.objectPaintProperties(); |
| 496 EXPECT_EQ(0.3f, svgRootWithOpacityProperties->effect()->opacity()); | 470 EXPECT_EQ(0.3f, svgRootWithOpacityProperties->effect()->opacity()); |
| 497 EXPECT_NE(nullptr, svgRootWithOpacityProperties->effect()->parent()); | 471 EXPECT_EQ(nullptr, svgRootWithOpacityProperties->effect()->parent()); |
| 498 | 472 |
| 499 LayoutObject& foreignObjectWithOpacity = *document().getElementById("foreign
ObjectWithOpacity")->layoutObject(); | 473 LayoutObject& foreignObjectWithOpacity = *document().getElementById("foreign
ObjectWithOpacity")->layoutObject(); |
| 500 const ObjectPaintProperties* foreignObjectWithOpacityProperties = foreignObj
ectWithOpacity.objectPaintProperties(); | 474 const ObjectPaintProperties* foreignObjectWithOpacityProperties = foreignObj
ectWithOpacity.objectPaintProperties(); |
| 501 EXPECT_EQ(0.4f, foreignObjectWithOpacityProperties->effect()->opacity()); | 475 EXPECT_EQ(0.4f, foreignObjectWithOpacityProperties->effect()->opacity()); |
| 502 EXPECT_EQ(svgRootWithOpacityProperties->effect(), foreignObjectWithOpacityPr
operties->effect()->parent()); | 476 EXPECT_EQ(svgRootWithOpacityProperties->effect(), foreignObjectWithOpacityPr
operties->effect()->parent()); |
| 503 | 477 |
| 504 LayoutObject& spanWithOpacity = *document().getElementById("spanWithOpacity"
)->layoutObject(); | 478 LayoutObject& spanWithOpacity = *document().getElementById("spanWithOpacity"
)->layoutObject(); |
| 505 const ObjectPaintProperties* spanWithOpacityProperties = spanWithOpacity.obj
ectPaintProperties(); | 479 const ObjectPaintProperties* spanWithOpacityProperties = spanWithOpacity.obj
ectPaintProperties(); |
| 506 EXPECT_EQ(0.5f, spanWithOpacityProperties->effect()->opacity()); | 480 EXPECT_EQ(0.5f, spanWithOpacityProperties->effect()->opacity()); |
| 507 EXPECT_EQ(foreignObjectWithOpacityProperties->effect(), spanWithOpacityPrope
rties->effect()->parent()); | 481 EXPECT_EQ(foreignObjectWithOpacityProperties->effect(), spanWithOpacityPrope
rties->effect()->parent()); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 529 "<svg id='svgRootWith3dTransform' width='100px' height='100px'>" | 503 "<svg id='svgRootWith3dTransform' width='100px' height='100px'>" |
| 530 " <rect id='rectWith2dTransform' width='100px' height='100px' />" | 504 " <rect id='rectWith2dTransform' width='100px' height='100px' />" |
| 531 "</svg>"); | 505 "</svg>"); |
| 532 | 506 |
| 533 LayoutObject& svgRootWith3dTransform = *document().getElementById("svgRootWi
th3dTransform")->layoutObject(); | 507 LayoutObject& svgRootWith3dTransform = *document().getElementById("svgRootWi
th3dTransform")->layoutObject(); |
| 534 const ObjectPaintProperties* svgRootWith3dTransformProperties = svgRootWith3
dTransform.objectPaintProperties(); | 508 const ObjectPaintProperties* svgRootWith3dTransformProperties = svgRootWith3
dTransform.objectPaintProperties(); |
| 535 EXPECT_EQ(TransformationMatrix().translate3d(1, 2, 3), svgRootWith3dTransfor
mProperties->transform()->matrix()); | 509 EXPECT_EQ(TransformationMatrix().translate3d(1, 2, 3), svgRootWith3dTransfor
mProperties->transform()->matrix()); |
| 536 EXPECT_EQ(FloatPoint3D(50, 50, 0), svgRootWith3dTransformProperties->transfo
rm()->origin()); | 510 EXPECT_EQ(FloatPoint3D(50, 50, 0), svgRootWith3dTransformProperties->transfo
rm()->origin()); |
| 537 EXPECT_EQ(svgRootWith3dTransformProperties->paintOffsetTranslation(), svgRoo
tWith3dTransformProperties->transform()->parent()); | 511 EXPECT_EQ(svgRootWith3dTransformProperties->paintOffsetTranslation(), svgRoo
tWith3dTransformProperties->transform()->parent()); |
| 538 EXPECT_EQ(TransformationMatrix().translate(70, 25), svgRootWith3dTransformPr
operties->paintOffsetTranslation()->matrix()); | 512 EXPECT_EQ(TransformationMatrix().translate(70, 25), svgRootWith3dTransformPr
operties->paintOffsetTranslation()->matrix()); |
| 539 EXPECT_EQ(frameScrollTranslation(), svgRootWith3dTransformProperties->paintO
ffsetTranslation()->parent()); | 513 EXPECT_EQ(framePreTranslation(), svgRootWith3dTransformProperties->paintOffs
etTranslation()->parent()); |
| 540 | 514 |
| 541 LayoutObject& rectWith2dTransform = *document().getElementById("rectWith2dTr
ansform")->layoutObject(); | 515 LayoutObject& rectWith2dTransform = *document().getElementById("rectWith2dTr
ansform")->layoutObject(); |
| 542 const ObjectPaintProperties* rectWith2dTransformProperties = rectWith2dTrans
form.objectPaintProperties(); | 516 const ObjectPaintProperties* rectWith2dTransformProperties = rectWith2dTrans
form.objectPaintProperties(); |
| 543 TransformationMatrix matrix; | 517 TransformationMatrix matrix; |
| 544 matrix.translate(100, 100); | 518 matrix.translate(100, 100); |
| 545 matrix.rotate(45); | 519 matrix.rotate(45); |
| 546 // SVG's transform origin is baked into the transform. | 520 // SVG's transform origin is baked into the transform. |
| 547 matrix.applyTransformOrigin(50, 25, 0); | 521 matrix.applyTransformOrigin(50, 25, 0); |
| 548 EXPECT_EQ(matrix, rectWith2dTransformProperties->transform()->matrix()); | 522 EXPECT_EQ(matrix, rectWith2dTransformProperties->transform()->matrix()); |
| 549 EXPECT_EQ(FloatPoint3D(0, 0, 0), rectWith2dTransformProperties->transform()-
>origin()); | 523 EXPECT_EQ(FloatPoint3D(0, 0, 0), rectWith2dTransformProperties->transform()-
>origin()); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 586 { | 560 { |
| 587 setBodyInnerHTML( | 561 setBodyInnerHTML( |
| 588 "<style>body { margin: 0px; } </style>" | 562 "<style>body { margin: 0px; } </style>" |
| 589 "<svg id='svg' style='margin-left: 50px; margin-top: 25px; width: 100px;
height: 100px;' />"); | 563 "<svg id='svg' style='margin-left: 50px; margin-top: 25px; width: 100px;
height: 100px;' />"); |
| 590 | 564 |
| 591 LayoutObject& svg = *document().getElementById("svg")->layoutObject(); | 565 LayoutObject& svg = *document().getElementById("svg")->layoutObject(); |
| 592 const ObjectPaintProperties* svgProperties = svg.objectPaintProperties(); | 566 const ObjectPaintProperties* svgProperties = svg.objectPaintProperties(); |
| 593 // Ensure that a paint offset transform is not unnecessarily emitted. | 567 // Ensure that a paint offset transform is not unnecessarily emitted. |
| 594 EXPECT_EQ(nullptr, svgProperties->paintOffsetTranslation()); | 568 EXPECT_EQ(nullptr, svgProperties->paintOffsetTranslation()); |
| 595 EXPECT_EQ(TransformationMatrix().translate(50, 25), svgProperties->svgLocalT
oBorderBoxTransform()->matrix()); | 569 EXPECT_EQ(TransformationMatrix().translate(50, 25), svgProperties->svgLocalT
oBorderBoxTransform()->matrix()); |
| 596 EXPECT_EQ(frameScrollTranslation(), svgProperties->svgLocalToBorderBoxTransf
orm()->parent()); | 570 EXPECT_EQ(framePreTranslation(), svgProperties->svgLocalToBorderBoxTransform
()->parent()); |
| 597 } | 571 } |
| 598 | 572 |
| 599 TEST_P(PaintPropertyTreeBuilderTest, SVGRootLocalToBorderBoxTransformNode) | 573 TEST_P(PaintPropertyTreeBuilderTest, SVGRootLocalToBorderBoxTransformNode) |
| 600 { | 574 { |
| 601 setBodyInnerHTML( | 575 setBodyInnerHTML( |
| 602 "<style>" | 576 "<style>" |
| 603 " body { margin: 0px; }" | 577 " body { margin: 0px; }" |
| 604 " svg { margin-left: 2px; margin-top: 3px; transform: translate(5px, 7p
x); border: 11px solid green; }" | 578 " svg { margin-left: 2px; margin-top: 3px; transform: translate(5px, 7p
x); border: 11px solid green; }" |
| 605 "</style>" | 579 "</style>" |
| 606 "<svg id='svg' width='100px' height='100px' viewBox='0 0 13 13'>" | 580 "<svg id='svg' width='100px' height='100px' viewBox='0 0 13 13'>" |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 711 " }" | 685 " }" |
| 712 " input {" | 686 " input {" |
| 713 " border-width: 5px;" | 687 " border-width: 5px;" |
| 714 " padding: 0;" | 688 " padding: 0;" |
| 715 " }" | 689 " }" |
| 716 "</style>" | 690 "</style>" |
| 717 "<input id='button' type='button' style='width:345px; height:123px' valu
e='some text'/>"); | 691 "<input id='button' type='button' style='width:345px; height:123px' valu
e='some text'/>"); |
| 718 | 692 |
| 719 LayoutObject& button = *document().getElementById("button")->layoutObject(); | 693 LayoutObject& button = *document().getElementById("button")->layoutObject(); |
| 720 const ObjectPaintProperties* buttonProperties = button.objectPaintProperties
(); | 694 const ObjectPaintProperties* buttonProperties = button.objectPaintProperties
(); |
| 721 EXPECT_EQ(frameScrollTranslation(), buttonProperties->overflowClip()->localT
ransformSpace()); | 695 EXPECT_EQ(framePreTranslation(), buttonProperties->overflowClip()->localTran
sformSpace()); |
| 722 EXPECT_EQ(FloatRoundedRect(5, 5, 335, 113), buttonProperties->overflowClip()
->clipRect()); | 696 EXPECT_EQ(FloatRoundedRect(5, 5, 335, 113), buttonProperties->overflowClip()
->clipRect()); |
| 723 EXPECT_EQ(frameContentClip(), buttonProperties->overflowClip()->parent()); | 697 EXPECT_EQ(frameContentClip(), buttonProperties->overflowClip()->parent()); |
| 724 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 345, 123), &button, document().view
()->layoutView()); | 698 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 345, 123), &button, document().view
()->layoutView()); |
| 725 } | 699 } |
| 726 | 700 |
| 727 TEST_P(PaintPropertyTreeBuilderTest, BorderRadiusClip) | 701 TEST_P(PaintPropertyTreeBuilderTest, BorderRadiusClip) |
| 728 { | 702 { |
| 729 setBodyInnerHTML( | 703 setBodyInnerHTML( |
| 730 "<style>" | 704 "<style>" |
| 731 " body {" | 705 " body {" |
| 732 " margin: 0px;" | 706 " margin: 0px;" |
| 733 " }" | 707 " }" |
| 734 " #div {" | 708 " #div {" |
| 735 " border-radius: 12px 34px 56px 78px;" | 709 " border-radius: 12px 34px 56px 78px;" |
| 736 " border-top: 45px solid;" | 710 " border-top: 45px solid;" |
| 737 " border-right: 50px solid;" | 711 " border-right: 50px solid;" |
| 738 " border-bottom: 55px solid;" | 712 " border-bottom: 55px solid;" |
| 739 " border-left: 60px solid;" | 713 " border-left: 60px solid;" |
| 740 " width: 500px;" | 714 " width: 500px;" |
| 741 " height: 400px;" | 715 " height: 400px;" |
| 742 " overflow: scroll;" | 716 " overflow: scroll;" |
| 743 " }" | 717 " }" |
| 744 "</style>" | 718 "</style>" |
| 745 "<div id='div'></div>"); | 719 "<div id='div'></div>"); |
| 746 | 720 |
| 747 LayoutObject& div = *document().getElementById("div")->layoutObject(); | 721 LayoutObject& div = *document().getElementById("div")->layoutObject(); |
| 748 const ObjectPaintProperties* divProperties = div.objectPaintProperties(); | 722 const ObjectPaintProperties* divProperties = div.objectPaintProperties(); |
| 749 EXPECT_EQ(frameScrollTranslation(), divProperties->overflowClip()->localTran
sformSpace()); | 723 EXPECT_EQ(framePreTranslation(), divProperties->overflowClip()->localTransfo
rmSpace()); |
| 750 // The overflow clip rect includes only the padding box. | 724 // The overflow clip rect includes only the padding box. |
| 751 // padding box = border box(500+60+50, 400+45+55) - border outset(60+50, 45+
55) - scrollbars(15, 15) | 725 // padding box = border box(500+60+50, 400+45+55) - border outset(60+50, 45+
55) - scrollbars(15, 15) |
| 752 EXPECT_EQ(FloatRoundedRect(60, 45, 500, 400), divProperties->overflowClip()-
>clipRect()); | 726 EXPECT_EQ(FloatRoundedRect(60, 45, 500, 400), divProperties->overflowClip()-
>clipRect()); |
| 753 const ClipPaintPropertyNode* borderRadiusClip = divProperties->overflowClip(
)->parent(); | 727 const ClipPaintPropertyNode* borderRadiusClip = divProperties->overflowClip(
)->parent(); |
| 754 EXPECT_EQ(frameScrollTranslation(), borderRadiusClip->localTransformSpace())
; | 728 EXPECT_EQ(framePreTranslation(), borderRadiusClip->localTransformSpace()); |
| 755 // The border radius clip is the area enclosed by inner border edge, includi
ng the scrollbars. | 729 // The border radius clip is the area enclosed by inner border edge, includi
ng the scrollbars. |
| 756 // As the border-radius is specified in outer radius, the inner radius is ca
lculated by: | 730 // As the border-radius is specified in outer radius, the inner radius is ca
lculated by: |
| 757 // inner radius = max(outer radius - border width, 0) | 731 // inner radius = max(outer radius - border width, 0) |
| 758 // In the case that two adjacent borders have different width, the inner rad
ius of the corner | 732 // In the case that two adjacent borders have different width, the inner rad
ius of the corner |
| 759 // may transition from one value to the other. i.e. being an ellipse. | 733 // may transition from one value to the other. i.e. being an ellipse. |
| 760 EXPECT_EQ( | 734 EXPECT_EQ( |
| 761 FloatRoundedRect( | 735 FloatRoundedRect( |
| 762 FloatRect(60, 45, 500, 400), // = border box(610, 500) - border outs
et(110, 100) | 736 FloatRect(60, 45, 500, 400), // = border box(610, 500) - border outs
et(110, 100) |
| 763 FloatSize(0, 0), // (top left) = max((12, 12) - (60, 45), (0,
0)) | 737 FloatSize(0, 0), // (top left) = max((12, 12) - (60, 45), (0,
0)) |
| 764 FloatSize(0, 0), // (top right) = max((34, 34) - (50, 45), (0,
0)) | 738 FloatSize(0, 0), // (top right) = max((34, 34) - (50, 45), (0,
0)) |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 871 ); | 845 ); |
| 872 FrameView* frameView = document().view(); | 846 FrameView* frameView = document().view(); |
| 873 | 847 |
| 874 LayoutObject* scroller = document().getElementById("scroller")->layoutObject
(); | 848 LayoutObject* scroller = document().getElementById("scroller")->layoutObject
(); |
| 875 const ObjectPaintProperties* scrollerProperties = scroller->objectPaintPrope
rties(); | 849 const ObjectPaintProperties* scrollerProperties = scroller->objectPaintPrope
rties(); |
| 876 LayoutObject* child = document().getElementById("child")->layoutObject(); | 850 LayoutObject* child = document().getElementById("child")->layoutObject(); |
| 877 const ObjectPaintProperties* childProperties = child->objectPaintProperties(
); | 851 const ObjectPaintProperties* childProperties = child->objectPaintProperties(
); |
| 878 | 852 |
| 879 EXPECT_EQ(scrollerProperties->overflowClip(), childProperties->localBorderBo
xProperties()->geometryPropertyTreeState.clip); | 853 EXPECT_EQ(scrollerProperties->overflowClip(), childProperties->localBorderBo
xProperties()->geometryPropertyTreeState.clip); |
| 880 EXPECT_EQ(scrollerProperties->scrollTranslation(), childProperties->localBor
derBoxProperties()->geometryPropertyTreeState.transform); | 854 EXPECT_EQ(scrollerProperties->scrollTranslation(), childProperties->localBor
derBoxProperties()->geometryPropertyTreeState.transform); |
| 881 EXPECT_NE(nullptr, childProperties->localBorderBoxProperties()->geometryProp
ertyTreeState.effect); | 855 EXPECT_EQ(nullptr, childProperties->localBorderBoxProperties()->geometryProp
ertyTreeState.effect); |
| 882 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 400, 300), scroller, frameView->lay
outView()); | 856 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 400, 300), scroller, frameView->lay
outView()); |
| 883 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 100, 200), child, frameView->layout
View()); | 857 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 100, 200), child, frameView->layout
View()); |
| 884 } | 858 } |
| 885 | 859 |
| 886 TEST_P(PaintPropertyTreeBuilderTest, TreeContextUnclipFromParentStackingContext) | 860 TEST_P(PaintPropertyTreeBuilderTest, TreeContextUnclipFromParentStackingContext) |
| 887 { | 861 { |
| 888 // This test verifies the tree builder correctly computes and records the pr
operty tree context | 862 // This test verifies the tree builder correctly computes and records the pr
operty tree context |
| 889 // for a (pseudo) stacking context that has a scrolling painting ancestor th
at is not its | 863 // for a (pseudo) stacking context that has a scrolling painting ancestor th
at is not its |
| 890 // containing block (thus should not be scrolled by it). | 864 // containing block (thus should not be scrolled by it). |
| 891 | 865 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 940 "<table>" | 914 "<table>" |
| 941 " <tr><td></td><td></td></tr>" | 915 " <tr><td></td><td></td></tr>" |
| 942 " <tr><td></td><td><div id='target'></div></td></tr>" | 916 " <tr><td></td><td><div id='target'></div></td></tr>" |
| 943 "</table>" | 917 "</table>" |
| 944 ); | 918 ); |
| 945 | 919 |
| 946 LayoutObject& target = *document().getElementById("target")->layoutObject(); | 920 LayoutObject& target = *document().getElementById("target")->layoutObject(); |
| 947 const ObjectPaintProperties* targetProperties = target.objectPaintProperties
(); | 921 const ObjectPaintProperties* targetProperties = target.objectPaintProperties
(); |
| 948 | 922 |
| 949 EXPECT_EQ(LayoutPoint(170, 170), targetProperties->localBorderBoxProperties(
)->paintOffset); | 923 EXPECT_EQ(LayoutPoint(170, 170), targetProperties->localBorderBoxProperties(
)->paintOffset); |
| 950 EXPECT_EQ(frameScrollTranslation(), targetProperties->localBorderBoxProperti
es()->geometryPropertyTreeState.transform); | 924 EXPECT_EQ(framePreTranslation(), targetProperties->localBorderBoxProperties(
)->geometryPropertyTreeState.transform); |
| 951 CHECK_EXACT_VISUAL_RECT(LayoutRect(170, 170, 100, 100), &target, document().
view()->layoutView()); | 925 CHECK_EXACT_VISUAL_RECT(LayoutRect(170, 170, 100, 100), &target, document().
view()->layoutView()); |
| 952 } | 926 } |
| 953 | 927 |
| 954 TEST_P(PaintPropertyTreeBuilderTest, CSSClipFixedPositionDescendant) | 928 TEST_P(PaintPropertyTreeBuilderTest, CSSClipFixedPositionDescendant) |
| 955 { | 929 { |
| 956 // This test verifies that clip tree hierarchy being generated correctly for
the hard case | 930 // This test verifies that clip tree hierarchy being generated correctly for
the hard case |
| 957 // such that a fixed position element getting clipped by an absolute positio
n CSS clip. | 931 // such that a fixed position element getting clipped by an absolute positio
n CSS clip. |
| 958 setBodyInnerHTML( | 932 setBodyInnerHTML( |
| 959 "<style>" | 933 "<style>" |
| 960 " #clip {" | 934 " #clip {" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 975 "</style>" | 949 "</style>" |
| 976 "<div id='clip'><div id='fixed'></div></div>" | 950 "<div id='clip'><div id='fixed'></div></div>" |
| 977 ); | 951 ); |
| 978 LayoutRect localClipRect(40, 10, 40, 60); | 952 LayoutRect localClipRect(40, 10, 40, 60); |
| 979 LayoutRect absoluteClipRect = localClipRect; | 953 LayoutRect absoluteClipRect = localClipRect; |
| 980 absoluteClipRect.move(123, 456); | 954 absoluteClipRect.move(123, 456); |
| 981 | 955 |
| 982 LayoutObject& clip = *document().getElementById("clip")->layoutObject(); | 956 LayoutObject& clip = *document().getElementById("clip")->layoutObject(); |
| 983 const ObjectPaintProperties* clipProperties = clip.objectPaintProperties(); | 957 const ObjectPaintProperties* clipProperties = clip.objectPaintProperties(); |
| 984 EXPECT_EQ(frameContentClip(), clipProperties->cssClip()->parent()); | 958 EXPECT_EQ(frameContentClip(), clipProperties->cssClip()->parent()); |
| 985 EXPECT_EQ(frameScrollTranslation(), clipProperties->cssClip()->localTransfor
mSpace()); | 959 EXPECT_EQ(framePreTranslation(), clipProperties->cssClip()->localTransformSp
ace()); |
| 986 EXPECT_EQ(FloatRoundedRect(FloatRect(absoluteClipRect)), clipProperties->css
Clip()->clipRect()); | 960 EXPECT_EQ(FloatRoundedRect(FloatRect(absoluteClipRect)), clipProperties->css
Clip()->clipRect()); |
| 987 CHECK_VISUAL_RECT(absoluteClipRect, &clip, document().view()->layoutView(), | 961 CHECK_VISUAL_RECT(absoluteClipRect, &clip, document().view()->layoutView(), |
| 988 // TODO(crbug.com/599939): mapToVisualRectInAncestorSpace() doesn't appl
y css clip on the object itself. | 962 // TODO(crbug.com/599939): mapToVisualRectInAncestorSpace() doesn't appl
y css clip on the object itself. |
| 989 LayoutUnit::max()); | 963 LayoutUnit::max()); |
| 990 | 964 |
| 991 LayoutObject* fixed = document().getElementById("fixed")->layoutObject(); | 965 LayoutObject* fixed = document().getElementById("fixed")->layoutObject(); |
| 992 const ObjectPaintProperties* fixedProperties = fixed->objectPaintProperties(
); | 966 const ObjectPaintProperties* fixedProperties = fixed->objectPaintProperties(
); |
| 993 EXPECT_EQ(clipProperties->cssClip(), fixedProperties->localBorderBoxProperti
es()->geometryPropertyTreeState.clip); | 967 EXPECT_EQ(clipProperties->cssClip(), fixedProperties->localBorderBoxProperti
es()->geometryPropertyTreeState.clip); |
| 994 EXPECT_EQ(framePreTranslation(), fixedProperties->localBorderBoxProperties()
->geometryPropertyTreeState.transform->parent()); | 968 EXPECT_EQ(framePreTranslation(), fixedProperties->localBorderBoxProperties()
->geometryPropertyTreeState.transform->parent()); |
| 995 EXPECT_EQ(TransformationMatrix().translate(654, 321), fixedProperties->local
BorderBoxProperties()->geometryPropertyTreeState.transform->matrix()); | 969 EXPECT_EQ(TransformationMatrix().translate(654, 321), fixedProperties->local
BorderBoxProperties()->geometryPropertyTreeState.transform->matrix()); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 1023 "</style>" | 997 "</style>" |
| 1024 "<div id='clip'><div id='absolute'></div></div>" | 998 "<div id='clip'><div id='absolute'></div></div>" |
| 1025 ); | 999 ); |
| 1026 LayoutRect localClipRect(40, 10, 40, 60); | 1000 LayoutRect localClipRect(40, 10, 40, 60); |
| 1027 LayoutRect absoluteClipRect = localClipRect; | 1001 LayoutRect absoluteClipRect = localClipRect; |
| 1028 absoluteClipRect.move(123, 456); | 1002 absoluteClipRect.move(123, 456); |
| 1029 | 1003 |
| 1030 LayoutObject* clip = document().getElementById("clip")->layoutObject(); | 1004 LayoutObject* clip = document().getElementById("clip")->layoutObject(); |
| 1031 const ObjectPaintProperties* clipProperties = clip->objectPaintProperties(); | 1005 const ObjectPaintProperties* clipProperties = clip->objectPaintProperties(); |
| 1032 EXPECT_EQ(frameContentClip(), clipProperties->cssClip()->parent()); | 1006 EXPECT_EQ(frameContentClip(), clipProperties->cssClip()->parent()); |
| 1033 EXPECT_EQ(frameScrollTranslation(), clipProperties->cssClip()->localTransfor
mSpace()); | 1007 EXPECT_EQ(framePreTranslation(), clipProperties->cssClip()->localTransformSp
ace()); |
| 1034 EXPECT_EQ(FloatRoundedRect(FloatRect(absoluteClipRect)), clipProperties->css
Clip()->clipRect()); | 1008 EXPECT_EQ(FloatRoundedRect(FloatRect(absoluteClipRect)), clipProperties->css
Clip()->clipRect()); |
| 1035 CHECK_VISUAL_RECT(absoluteClipRect, clip, document().view()->layoutView(), | 1009 CHECK_VISUAL_RECT(absoluteClipRect, clip, document().view()->layoutView(), |
| 1036 // TODO(crbug.com/599939): mapToVisualRectInAncestorSpace() doesn't appl
y css clip on the object itself. | 1010 // TODO(crbug.com/599939): mapToVisualRectInAncestorSpace() doesn't appl
y css clip on the object itself. |
| 1037 LayoutUnit::max()); | 1011 LayoutUnit::max()); |
| 1038 | 1012 |
| 1039 LayoutObject* absolute = document().getElementById("absolute")->layoutObject
(); | 1013 LayoutObject* absolute = document().getElementById("absolute")->layoutObject
(); |
| 1040 const ObjectPaintProperties* absPosProperties = absolute->objectPaintPropert
ies(); | 1014 const ObjectPaintProperties* absPosProperties = absolute->objectPaintPropert
ies(); |
| 1041 EXPECT_EQ(clipProperties->cssClip(), absPosProperties->localBorderBoxPropert
ies()->geometryPropertyTreeState.clip); | 1015 EXPECT_EQ(clipProperties->cssClip(), absPosProperties->localBorderBoxPropert
ies()->geometryPropertyTreeState.clip); |
| 1042 EXPECT_EQ(framePreTranslation(), absPosProperties->localBorderBoxProperties(
)->geometryPropertyTreeState.transform->parent()); | 1016 EXPECT_EQ(nullptr, absPosProperties->localBorderBoxProperties()->geometryPro
pertyTreeState.transform->parent()); |
| 1043 EXPECT_EQ(LayoutPoint(123, 456), absPosProperties->localBorderBoxProperties(
)->paintOffset); | 1017 EXPECT_EQ(LayoutPoint(123, 456), absPosProperties->localBorderBoxProperties(
)->paintOffset); |
| 1044 CHECK_VISUAL_RECT(LayoutRect(), absolute, document().view()->layoutView(), | 1018 CHECK_VISUAL_RECT(LayoutRect(), absolute, document().view()->layoutView(), |
| 1045 // TODO(crbug.com/599939): CSS clip of fixed-position descendants is bro
ken in mapToVisualRectInAncestorSpace(). | 1019 // TODO(crbug.com/599939): CSS clip of fixed-position descendants is bro
ken in mapToVisualRectInAncestorSpace(). |
| 1046 LayoutUnit::max()); | 1020 LayoutUnit::max()); |
| 1047 } | 1021 } |
| 1048 | 1022 |
| 1049 TEST_P(PaintPropertyTreeBuilderTest, CSSClipFixedPositionDescendantNonShared) | 1023 TEST_P(PaintPropertyTreeBuilderTest, CSSClipFixedPositionDescendantNonShared) |
| 1050 { | 1024 { |
| 1051 // This test is similar to CSSClipFixedPositionDescendant above, except that | 1025 // This test is similar to CSSClipFixedPositionDescendant above, except that |
| 1052 // now we have a parent overflow clip that should be escaped by the fixed de
scendant. | 1026 // now we have a parent overflow clip that should be escaped by the fixed de
scendant. |
| (...skipping 24 matching lines...) Expand all Loading... |
| 1077 "</style>" | 1051 "</style>" |
| 1078 "<div id='overflow'><div id='clip'><div id='fixed'></div></div></div>" | 1052 "<div id='overflow'><div id='clip'><div id='fixed'></div></div></div>" |
| 1079 ); | 1053 ); |
| 1080 LayoutRect localClipRect(40, 10, 40, 60); | 1054 LayoutRect localClipRect(40, 10, 40, 60); |
| 1081 LayoutRect absoluteClipRect = localClipRect; | 1055 LayoutRect absoluteClipRect = localClipRect; |
| 1082 absoluteClipRect.move(123, 456); | 1056 absoluteClipRect.move(123, 456); |
| 1083 | 1057 |
| 1084 LayoutObject& overflow = *document().getElementById("overflow")->layoutObjec
t(); | 1058 LayoutObject& overflow = *document().getElementById("overflow")->layoutObjec
t(); |
| 1085 const ObjectPaintProperties* overflowProperties = overflow.objectPaintProper
ties(); | 1059 const ObjectPaintProperties* overflowProperties = overflow.objectPaintProper
ties(); |
| 1086 EXPECT_EQ(frameContentClip(), overflowProperties->overflowClip()->parent()); | 1060 EXPECT_EQ(frameContentClip(), overflowProperties->overflowClip()->parent()); |
| 1087 EXPECT_EQ(frameScrollTranslation(), overflowProperties->scrollTranslation()-
>parent()); | 1061 EXPECT_EQ(framePreTranslation(), overflowProperties->scrollTranslation()->pa
rent()); |
| 1088 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 50, 50), &overflow, document().view
()->layoutView()); | 1062 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 50, 50), &overflow, document().view
()->layoutView()); |
| 1089 | 1063 |
| 1090 LayoutObject* clip = document().getElementById("clip")->layoutObject(); | 1064 LayoutObject* clip = document().getElementById("clip")->layoutObject(); |
| 1091 const ObjectPaintProperties* clipProperties = clip->objectPaintProperties(); | 1065 const ObjectPaintProperties* clipProperties = clip->objectPaintProperties(); |
| 1092 EXPECT_EQ(overflowProperties->overflowClip(), clipProperties->cssClip()->par
ent()); | 1066 EXPECT_EQ(overflowProperties->overflowClip(), clipProperties->cssClip()->par
ent()); |
| 1093 EXPECT_EQ(overflowProperties->scrollTranslation(), clipProperties->cssClip()
->localTransformSpace()); | 1067 EXPECT_EQ(overflowProperties->scrollTranslation(), clipProperties->cssClip()
->localTransformSpace()); |
| 1094 EXPECT_EQ(FloatRoundedRect(FloatRect(absoluteClipRect)), clipProperties->css
Clip()->clipRect()); | 1068 EXPECT_EQ(FloatRoundedRect(FloatRect(absoluteClipRect)), clipProperties->css
Clip()->clipRect()); |
| 1095 EXPECT_EQ(frameContentClip(), clipProperties->cssClipFixedPosition()->parent
()); | 1069 EXPECT_EQ(frameContentClip(), clipProperties->cssClipFixedPosition()->parent
()); |
| 1096 EXPECT_EQ(overflowProperties->scrollTranslation(), clipProperties->cssClipFi
xedPosition()->localTransformSpace()); | 1070 EXPECT_EQ(overflowProperties->scrollTranslation(), clipProperties->cssClipFi
xedPosition()->localTransformSpace()); |
| 1097 EXPECT_EQ(FloatRoundedRect(FloatRect(absoluteClipRect)), clipProperties->css
ClipFixedPosition()->clipRect()); | 1071 EXPECT_EQ(FloatRoundedRect(FloatRect(absoluteClipRect)), clipProperties->css
ClipFixedPosition()->clipRect()); |
| (...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1641 "<div id='clipper' style='overflow:hidden; width:400px; height:300px;'>" | 1615 "<div id='clipper' style='overflow:hidden; width:400px; height:300px;'>" |
| 1642 " <div id='child' style='position:relative; width:500px; height: 600px;
'></div>" | 1616 " <div id='child' style='position:relative; width:500px; height: 600px;
'></div>" |
| 1643 "</div>" | 1617 "</div>" |
| 1644 ); | 1618 ); |
| 1645 | 1619 |
| 1646 LayoutBoxModelObject* clipper = toLayoutBoxModelObject(document().getElement
ById("clipper")->layoutObject()); | 1620 LayoutBoxModelObject* clipper = toLayoutBoxModelObject(document().getElement
ById("clipper")->layoutObject()); |
| 1647 const ObjectPaintProperties* clipProperties = clipper->objectPaintProperties
(); | 1621 const ObjectPaintProperties* clipProperties = clipper->objectPaintProperties
(); |
| 1648 LayoutObject* child = document().getElementById("child")->layoutObject(); | 1622 LayoutObject* child = document().getElementById("child")->layoutObject(); |
| 1649 const ObjectPaintProperties* childProperties = child->objectPaintProperties(
); | 1623 const ObjectPaintProperties* childProperties = child->objectPaintProperties(
); |
| 1650 | 1624 |
| 1651 EXPECT_EQ(frameScrollTranslation(), clipProperties->localBorderBoxProperties
()->geometryPropertyTreeState.transform); | 1625 EXPECT_EQ(framePreTranslation(), clipProperties->localBorderBoxProperties()-
>geometryPropertyTreeState.transform); |
| 1652 EXPECT_EQ(frameContentClip(), clipProperties->localBorderBoxProperties()->ge
ometryPropertyTreeState.clip); | 1626 EXPECT_EQ(frameContentClip(), clipProperties->localBorderBoxProperties()->ge
ometryPropertyTreeState.clip); |
| 1653 | 1627 |
| 1654 GeometryPropertyTreeState contentsProperties; | 1628 GeometryPropertyTreeState contentsProperties; |
| 1655 clipProperties->getContentsProperties(contentsProperties); | 1629 clipProperties->getContentsProperties(contentsProperties); |
| 1656 EXPECT_EQ(frameScrollTranslation(), contentsProperties.transform); | 1630 EXPECT_EQ(framePreTranslation(), contentsProperties.transform); |
| 1657 EXPECT_EQ(clipProperties->overflowClip(), contentsProperties.clip); | 1631 EXPECT_EQ(clipProperties->overflowClip(), contentsProperties.clip); |
| 1658 | 1632 |
| 1659 EXPECT_EQ(frameScrollTranslation(), childProperties->localBorderBoxPropertie
s()->geometryPropertyTreeState.transform); | 1633 EXPECT_EQ(framePreTranslation(), childProperties->localBorderBoxProperties()
->geometryPropertyTreeState.transform); |
| 1660 EXPECT_EQ(clipProperties->overflowClip(), childProperties->localBorderBoxPro
perties()->geometryPropertyTreeState.clip); | 1634 EXPECT_EQ(clipProperties->overflowClip(), childProperties->localBorderBoxPro
perties()->geometryPropertyTreeState.clip); |
| 1661 | 1635 |
| 1662 EXPECT_NE(nullptr, childProperties->localBorderBoxProperties()->geometryProp
ertyTreeState.effect); | 1636 EXPECT_EQ(nullptr, childProperties->localBorderBoxProperties()->geometryProp
ertyTreeState.effect); |
| 1663 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 500, 600), child, clipper); | 1637 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 500, 600), child, clipper); |
| 1664 } | 1638 } |
| 1665 | 1639 |
| 1666 TEST_P(PaintPropertyTreeBuilderTest, OverflowScrollContentsProperties) | 1640 TEST_P(PaintPropertyTreeBuilderTest, OverflowScrollContentsProperties) |
| 1667 { | 1641 { |
| 1668 // This test verifies the tree builder correctly computes and records the pr
operty tree context | 1642 // This test verifies the tree builder correctly computes and records the pr
operty tree context |
| 1669 // for a (pseudo) stacking context that is scrolled by a containing block th
at is not one of | 1643 // for a (pseudo) stacking context that is scrolled by a containing block th
at is not one of |
| 1670 // the painting ancestors. | 1644 // the painting ancestors. |
| 1671 setBodyInnerHTML( | 1645 setBodyInnerHTML( |
| 1672 "<style>body { margin: 0; }</style>" | 1646 "<style>body { margin: 0; }</style>" |
| 1673 "<div id='clipper' style='overflow:scroll; width:400px; height:300px;'>" | 1647 "<div id='clipper' style='overflow:scroll; width:400px; height:300px;'>" |
| 1674 " <div id='child' style='position:relative; width:500px; height: 600px;
'></div>" | 1648 " <div id='child' style='position:relative; width:500px; height: 600px;
'></div>" |
| 1675 " <div style='width: 200px; height: 10000px'>" | 1649 " <div style='width: 200px; height: 10000px'>" |
| 1676 "</div>" | 1650 "</div>" |
| 1677 ); | 1651 ); |
| 1678 | 1652 |
| 1679 Element* clipperElement = document().getElementById("clipper"); | 1653 Element* clipperElement = document().getElementById("clipper"); |
| 1680 clipperElement->scrollTo(1, 2); | 1654 clipperElement->scrollTo(1, 2); |
| 1681 | 1655 |
| 1682 LayoutBoxModelObject* clipper = toLayoutBoxModelObject(clipperElement->layou
tObject()); | 1656 LayoutBoxModelObject* clipper = toLayoutBoxModelObject(clipperElement->layou
tObject()); |
| 1683 const ObjectPaintProperties* clipProperties = clipper->objectPaintProperties
(); | 1657 const ObjectPaintProperties* clipProperties = clipper->objectPaintProperties
(); |
| 1684 LayoutObject* child = document().getElementById("child")->layoutObject(); | 1658 LayoutObject* child = document().getElementById("child")->layoutObject(); |
| 1685 const ObjectPaintProperties* childProperties = child->objectPaintProperties(
); | 1659 const ObjectPaintProperties* childProperties = child->objectPaintProperties(
); |
| 1686 | 1660 |
| 1687 EXPECT_EQ(frameScrollTranslation(), clipProperties->localBorderBoxProperties
()->geometryPropertyTreeState.transform); | 1661 EXPECT_EQ(framePreTranslation(), clipProperties->localBorderBoxProperties()-
>geometryPropertyTreeState.transform); |
| 1688 EXPECT_EQ(frameContentClip(), clipProperties->localBorderBoxProperties()->ge
ometryPropertyTreeState.clip); | 1662 EXPECT_EQ(frameContentClip(), clipProperties->localBorderBoxProperties()->ge
ometryPropertyTreeState.clip); |
| 1689 | 1663 |
| 1690 GeometryPropertyTreeState contentsProperties; | 1664 GeometryPropertyTreeState contentsProperties; |
| 1691 clipProperties->getContentsProperties(contentsProperties); | 1665 clipProperties->getContentsProperties(contentsProperties); |
| 1692 EXPECT_EQ(clipProperties->scrollTranslation(), contentsProperties.transform)
; | 1666 EXPECT_EQ(clipProperties->scrollTranslation(), contentsProperties.transform)
; |
| 1693 EXPECT_EQ(clipProperties->overflowClip(), contentsProperties.clip); | 1667 EXPECT_EQ(clipProperties->overflowClip(), contentsProperties.clip); |
| 1694 | 1668 |
| 1695 EXPECT_EQ(clipProperties->scrollTranslation(), childProperties->localBorderB
oxProperties()->geometryPropertyTreeState.transform); | 1669 EXPECT_EQ(clipProperties->scrollTranslation(), childProperties->localBorderB
oxProperties()->geometryPropertyTreeState.transform); |
| 1696 EXPECT_EQ(clipProperties->overflowClip(), childProperties->localBorderBoxPro
perties()->geometryPropertyTreeState.clip); | 1670 EXPECT_EQ(clipProperties->overflowClip(), childProperties->localBorderBoxPro
perties()->geometryPropertyTreeState.clip); |
| 1697 | 1671 |
| 1698 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 500, 600), child, clipper); | 1672 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 500, 600), child, clipper); |
| 1699 } | 1673 } |
| 1700 | 1674 |
| 1701 TEST_P(PaintPropertyTreeBuilderTest, CssClipContentsProperties) | 1675 TEST_P(PaintPropertyTreeBuilderTest, CssClipContentsProperties) |
| 1702 { | 1676 { |
| 1703 // This test verifies the tree builder correctly computes and records the pr
operty tree context | 1677 // This test verifies the tree builder correctly computes and records the pr
operty tree context |
| 1704 // for a (pseudo) stacking context that is scrolled by a containing block th
at is not one of | 1678 // for a (pseudo) stacking context that is scrolled by a containing block th
at is not one of |
| 1705 // the painting ancestors. | 1679 // the painting ancestors. |
| 1706 setBodyInnerHTML( | 1680 setBodyInnerHTML( |
| 1707 "<style>body { margin: 0; }</style>" | 1681 "<style>body { margin: 0; }</style>" |
| 1708 "<div id='clipper' style='position: absolute; clip: rect(10px, 80px, 70p
x, 40px); width:400px; height:300px;'>" | 1682 "<div id='clipper' style='position: absolute; clip: rect(10px, 80px, 70p
x, 40px); width:400px; height:300px;'>" |
| 1709 " <div id='child' style='position:relative; width:500px; height: 600px;
'></div>" | 1683 " <div id='child' style='position:relative; width:500px; height: 600px;
'></div>" |
| 1710 "</div>" | 1684 "</div>" |
| 1711 ); | 1685 ); |
| 1712 | 1686 |
| 1713 LayoutBoxModelObject* clipper = toLayoutBoxModelObject(document().getElement
ById("clipper")->layoutObject()); | 1687 LayoutBoxModelObject* clipper = toLayoutBoxModelObject(document().getElement
ById("clipper")->layoutObject()); |
| 1714 const ObjectPaintProperties* clipProperties = clipper->objectPaintProperties
(); | 1688 const ObjectPaintProperties* clipProperties = clipper->objectPaintProperties
(); |
| 1715 LayoutObject* child = document().getElementById("child")->layoutObject(); | 1689 LayoutObject* child = document().getElementById("child")->layoutObject(); |
| 1716 | 1690 |
| 1717 EXPECT_EQ(frameScrollTranslation(), clipProperties->localBorderBoxProperties
()->geometryPropertyTreeState.transform); | 1691 EXPECT_EQ(framePreTranslation(), clipProperties->localBorderBoxProperties()-
>geometryPropertyTreeState.transform); |
| 1718 // CSS clip on an element causes it to clip itself, not just descendants. | 1692 // CSS clip on an element causes it to clip itself, not just descendants. |
| 1719 EXPECT_EQ(clipProperties->cssClip(), clipProperties->localBorderBoxPropertie
s()->geometryPropertyTreeState.clip); | 1693 EXPECT_EQ(clipProperties->cssClip(), clipProperties->localBorderBoxPropertie
s()->geometryPropertyTreeState.clip); |
| 1720 | 1694 |
| 1721 GeometryPropertyTreeState contentsProperties; | 1695 GeometryPropertyTreeState contentsProperties; |
| 1722 clipProperties->getContentsProperties(contentsProperties); | 1696 clipProperties->getContentsProperties(contentsProperties); |
| 1723 EXPECT_EQ(frameScrollTranslation(), contentsProperties.transform); | 1697 EXPECT_EQ(framePreTranslation(), contentsProperties.transform); |
| 1724 EXPECT_EQ(clipProperties->cssClip(), contentsProperties.clip); | 1698 EXPECT_EQ(clipProperties->cssClip(), contentsProperties.clip); |
| 1725 | 1699 |
| 1726 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 500, 600), child, clipper); | 1700 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 500, 600), child, clipper); |
| 1727 } | 1701 } |
| 1728 | 1702 |
| 1729 TEST_P(PaintPropertyTreeBuilderTest, SvgLocalToBorderBoxTransformContentsPropert
ies) | 1703 TEST_P(PaintPropertyTreeBuilderTest, SvgLocalToBorderBoxTransformContentsPropert
ies) |
| 1730 { | 1704 { |
| 1731 setBodyInnerHTML( | 1705 setBodyInnerHTML( |
| 1732 "<style>" | 1706 "<style>" |
| 1733 " body {" | 1707 " body {" |
| 1734 " margin: 0px;" | 1708 " margin: 0px;" |
| 1735 " }" | 1709 " }" |
| 1736 " svg {" | 1710 " svg {" |
| 1737 " position: absolute;" | 1711 " position: absolute;" |
| 1738 " }" | 1712 " }" |
| 1739 " rect {" | 1713 " rect {" |
| 1740 " transform: translate(100px, 100px);" | 1714 " transform: translate(100px, 100px);" |
| 1741 " }" | 1715 " }" |
| 1742 "</style>" | 1716 "</style>" |
| 1743 "<svg id='svgWithViewBox' width='100px' height='100px' viewBox='50 50 10
0 100'>" | 1717 "<svg id='svgWithViewBox' width='100px' height='100px' viewBox='50 50 10
0 100'>" |
| 1744 " <rect id='rect' width='100px' height='100px' />" | 1718 " <rect id='rect' width='100px' height='100px' />" |
| 1745 "</svg>"); | 1719 "</svg>"); |
| 1746 | 1720 |
| 1747 LayoutObject& svgWithViewBox = *document().getElementById("svgWithViewBox")-
>layoutObject(); | 1721 LayoutObject& svgWithViewBox = *document().getElementById("svgWithViewBox")-
>layoutObject(); |
| 1748 const ObjectPaintProperties* svgWithViewBoxProperties = svgWithViewBox.objec
tPaintProperties(); | 1722 const ObjectPaintProperties* svgWithViewBoxProperties = svgWithViewBox.objec
tPaintProperties(); |
| 1749 | 1723 |
| 1750 EXPECT_EQ(frameScrollTranslation(), svgWithViewBoxProperties->localBorderBox
Properties()->geometryPropertyTreeState.transform); | 1724 EXPECT_EQ(framePreTranslation(), svgWithViewBoxProperties->localBorderBoxPro
perties()->geometryPropertyTreeState.transform); |
| 1751 | 1725 |
| 1752 GeometryPropertyTreeState contentsProperties; | 1726 GeometryPropertyTreeState contentsProperties; |
| 1753 svgWithViewBoxProperties->getContentsProperties(contentsProperties); | 1727 svgWithViewBoxProperties->getContentsProperties(contentsProperties); |
| 1754 EXPECT_EQ(svgWithViewBoxProperties->svgLocalToBorderBoxTransform(), contents
Properties.transform); | 1728 EXPECT_EQ(svgWithViewBoxProperties->svgLocalToBorderBoxTransform(), contents
Properties.transform); |
| 1755 } | 1729 } |
| 1756 | 1730 |
| 1757 TEST_P(PaintPropertyTreeBuilderTest, OverflowHiddenScrollProperties) | 1731 TEST_P(PaintPropertyTreeBuilderTest, OverflowHiddenScrollProperties) |
| 1758 { | 1732 { |
| 1759 setBodyInnerHTML( | 1733 setBodyInnerHTML( |
| 1760 "<style>" | 1734 "<style>" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1774 " <div class='forceScroll'></div>" | 1748 " <div class='forceScroll'></div>" |
| 1775 "</div>"); | 1749 "</div>"); |
| 1776 | 1750 |
| 1777 Element* overflowHidden = document().getElementById("overflowHidden"); | 1751 Element* overflowHidden = document().getElementById("overflowHidden"); |
| 1778 overflowHidden->setScrollTop(37); | 1752 overflowHidden->setScrollTop(37); |
| 1779 | 1753 |
| 1780 document().view()->updateAllLifecyclePhases(); | 1754 document().view()->updateAllLifecyclePhases(); |
| 1781 | 1755 |
| 1782 const ObjectPaintProperties* overflowHiddenScrollProperties = overflowHidden
->layoutObject()->objectPaintProperties(); | 1756 const ObjectPaintProperties* overflowHiddenScrollProperties = overflowHidden
->layoutObject()->objectPaintProperties(); |
| 1783 // Because the frameView is does not scroll, overflowHidden's scroll should
be under the root. | 1757 // Because the frameView is does not scroll, overflowHidden's scroll should
be under the root. |
| 1784 EXPECT_EQ(rootScroll(), overflowHiddenScrollProperties->scroll()->parent()); | 1758 EXPECT_EQ(nullptr, overflowHiddenScrollProperties->scroll()->parent()); |
| 1785 EXPECT_EQ(TransformationMatrix().translate(0, -37), overflowHiddenScrollProp
erties->scroll()->scrollOffsetTranslation()->matrix()); | 1759 EXPECT_EQ(TransformationMatrix().translate(0, -37), overflowHiddenScrollProp
erties->scroll()->scrollOffsetTranslation()->matrix()); |
| 1786 // This should match the overflow's dimensions. | 1760 // This should match the overflow's dimensions. |
| 1787 EXPECT_EQ(IntSize(5, 3), overflowHiddenScrollProperties->scroll()->clip()); | 1761 EXPECT_EQ(IntSize(5, 3), overflowHiddenScrollProperties->scroll()->clip()); |
| 1788 // The scrolling content's bounds should include both the overflow's dimensi
ons (5x3) and the | 1762 // The scrolling content's bounds should include both the overflow's dimensi
ons (5x3) and the |
| 1789 // 0x79 "forceScroll" object. | 1763 // 0x79 "forceScroll" object. |
| 1790 EXPECT_EQ(IntSize(5, 79), overflowHiddenScrollProperties->scroll()->bounds()
); | 1764 EXPECT_EQ(IntSize(5, 79), overflowHiddenScrollProperties->scroll()->bounds()
); |
| 1791 // Although overflow: hidden is programmatically scrollable, it is not user
scrollable. | 1765 // Although overflow: hidden is programmatically scrollable, it is not user
scrollable. |
| 1792 EXPECT_FALSE(overflowHiddenScrollProperties->scroll()->userScrollableHorizon
tal()); | 1766 EXPECT_FALSE(overflowHiddenScrollProperties->scroll()->userScrollableHorizon
tal()); |
| 1793 EXPECT_FALSE(overflowHiddenScrollProperties->scroll()->userScrollableVertica
l()); | 1767 EXPECT_FALSE(overflowHiddenScrollProperties->scroll()->userScrollableVertica
l()); |
| 1794 } | 1768 } |
| (...skipping 27 matching lines...) Expand all Loading... |
| 1822 "</div>"); | 1796 "</div>"); |
| 1823 | 1797 |
| 1824 Element* overflowA = document().getElementById("overflowA"); | 1798 Element* overflowA = document().getElementById("overflowA"); |
| 1825 overflowA->setScrollTop(37); | 1799 overflowA->setScrollTop(37); |
| 1826 Element* overflowB = document().getElementById("overflowB"); | 1800 Element* overflowB = document().getElementById("overflowB"); |
| 1827 overflowB->setScrollTop(41); | 1801 overflowB->setScrollTop(41); |
| 1828 | 1802 |
| 1829 document().view()->updateAllLifecyclePhases(); | 1803 document().view()->updateAllLifecyclePhases(); |
| 1830 | 1804 |
| 1831 const ObjectPaintProperties* overflowAScrollProperties = overflowA->layoutOb
ject()->objectPaintProperties(); | 1805 const ObjectPaintProperties* overflowAScrollProperties = overflowA->layoutOb
ject()->objectPaintProperties(); |
| 1832 // Because the frameView is does not scroll, overflowA's scroll should be un
der the root. | 1806 // Because the frameView is does not scroll, overflowA's scroll should be a
root node. |
| 1833 EXPECT_EQ(rootScroll(), overflowAScrollProperties->scroll()->parent()); | 1807 EXPECT_EQ(nullptr, overflowAScrollProperties->scroll()->parent()); |
| 1834 EXPECT_EQ(TransformationMatrix().translate(0, -37), overflowAScrollPropertie
s->scroll()->scrollOffsetTranslation()->matrix()); | 1808 EXPECT_EQ(TransformationMatrix().translate(0, -37), overflowAScrollPropertie
s->scroll()->scrollOffsetTranslation()->matrix()); |
| 1835 EXPECT_EQ(IntSize(5, 3), overflowAScrollProperties->scroll()->clip()); | 1809 EXPECT_EQ(IntSize(5, 3), overflowAScrollProperties->scroll()->clip()); |
| 1836 // 107 is the forceScroll element plus the height of the overflow scroll chi
ld (overflowB). | 1810 // 107 is the forceScroll element plus the height of the overflow scroll chi
ld (overflowB). |
| 1837 EXPECT_EQ(IntSize(9, 107), overflowAScrollProperties->scroll()->bounds()); | 1811 EXPECT_EQ(IntSize(9, 107), overflowAScrollProperties->scroll()->bounds()); |
| 1838 EXPECT_TRUE(overflowAScrollProperties->scroll()->userScrollableHorizontal())
; | 1812 EXPECT_TRUE(overflowAScrollProperties->scroll()->userScrollableHorizontal())
; |
| 1839 EXPECT_TRUE(overflowAScrollProperties->scroll()->userScrollableVertical()); | 1813 EXPECT_TRUE(overflowAScrollProperties->scroll()->userScrollableVertical()); |
| 1840 | 1814 |
| 1841 const ObjectPaintProperties* overflowBScrollProperties = overflowB->layoutOb
ject()->objectPaintProperties(); | 1815 const ObjectPaintProperties* overflowBScrollProperties = overflowB->layoutOb
ject()->objectPaintProperties(); |
| 1842 // The overflow child's scroll node should be a child of the parent's (overf
lowA) scroll node. | 1816 // The overflow child's scroll node should be a child of the parent's (overf
lowA) scroll node. |
| 1843 EXPECT_EQ(overflowAScrollProperties->scroll(), overflowBScrollProperties->sc
roll()->parent()); | 1817 EXPECT_EQ(overflowAScrollProperties->scroll(), overflowBScrollProperties->sc
roll()->parent()); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1912 EXPECT_EQ(IntSize(5, 4000), overflowScrollProperties->scroll()->bounds()); | 1886 EXPECT_EQ(IntSize(5, 4000), overflowScrollProperties->scroll()->bounds()); |
| 1913 | 1887 |
| 1914 const ObjectPaintProperties* absposOverflowScrollProperties = absposOverflow
->layoutObject()->objectPaintProperties(); | 1888 const ObjectPaintProperties* absposOverflowScrollProperties = absposOverflow
->layoutObject()->objectPaintProperties(); |
| 1915 // The absolute position overflow scroll node is parented under the frame, n
ot the dom-order parent. | 1889 // The absolute position overflow scroll node is parented under the frame, n
ot the dom-order parent. |
| 1916 EXPECT_EQ(frameScroll(), absposOverflowScrollProperties->scroll()->parent())
; | 1890 EXPECT_EQ(frameScroll(), absposOverflowScrollProperties->scroll()->parent())
; |
| 1917 EXPECT_EQ(TransformationMatrix().translate(0, -41), absposOverflowScrollProp
erties->scroll()->scrollOffsetTranslation()->matrix()); | 1891 EXPECT_EQ(TransformationMatrix().translate(0, -41), absposOverflowScrollProp
erties->scroll()->scrollOffsetTranslation()->matrix()); |
| 1918 EXPECT_EQ(IntSize(9, 7), absposOverflowScrollProperties->scroll()->clip()); | 1892 EXPECT_EQ(IntSize(9, 7), absposOverflowScrollProperties->scroll()->clip()); |
| 1919 EXPECT_EQ(IntSize(9, 4000), absposOverflowScrollProperties->scroll()->bounds
()); | 1893 EXPECT_EQ(IntSize(9, 4000), absposOverflowScrollProperties->scroll()->bounds
()); |
| 1920 | 1894 |
| 1921 const ObjectPaintProperties* fixedOverflowScrollProperties = fixedOverflow->
layoutObject()->objectPaintProperties(); | 1895 const ObjectPaintProperties* fixedOverflowScrollProperties = fixedOverflow->
layoutObject()->objectPaintProperties(); |
| 1922 // The fixed position overflow scroll node is parented under the root, not t
he dom-order parent or frame's scroll. | 1896 // The fixed position overflow scroll node is a root node, not a child of th
e dom-order parent or the frame's scroll. |
| 1923 EXPECT_EQ(rootScroll(), fixedOverflowScrollProperties->scroll()->parent()); | 1897 EXPECT_EQ(nullptr, fixedOverflowScrollProperties->scroll()->parent()); |
| 1924 EXPECT_EQ(TransformationMatrix().translate(0, -43), fixedOverflowScrollPrope
rties->scroll()->scrollOffsetTranslation()->matrix()); | 1898 EXPECT_EQ(TransformationMatrix().translate(0, -43), fixedOverflowScrollPrope
rties->scroll()->scrollOffsetTranslation()->matrix()); |
| 1925 EXPECT_EQ(IntSize(13, 11), fixedOverflowScrollProperties->scroll()->clip()); | 1899 EXPECT_EQ(IntSize(13, 11), fixedOverflowScrollProperties->scroll()->clip()); |
| 1926 EXPECT_EQ(IntSize(13, 4000), fixedOverflowScrollProperties->scroll()->bounds
()); | 1900 EXPECT_EQ(IntSize(13, 4000), fixedOverflowScrollProperties->scroll()->bounds
()); |
| 1927 } | 1901 } |
| 1928 | 1902 |
| 1929 TEST_P(PaintPropertyTreeBuilderTest, NestedPositionedScrollProperties) | 1903 TEST_P(PaintPropertyTreeBuilderTest, NestedPositionedScrollProperties) |
| 1930 { | 1904 { |
| 1931 setBodyInnerHTML( | 1905 setBodyInnerHTML( |
| 1932 "<style>" | 1906 "<style>" |
| 1933 " * {" | 1907 " * {" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 1961 "</div>"); | 1935 "</div>"); |
| 1962 | 1936 |
| 1963 Element* overflowA = document().getElementById("overflowA"); | 1937 Element* overflowA = document().getElementById("overflowA"); |
| 1964 overflowA->setScrollTop(37); | 1938 overflowA->setScrollTop(37); |
| 1965 Element* overflowB = document().getElementById("overflowB"); | 1939 Element* overflowB = document().getElementById("overflowB"); |
| 1966 overflowB->setScrollTop(41); | 1940 overflowB->setScrollTop(41); |
| 1967 | 1941 |
| 1968 document().view()->updateAllLifecyclePhases(); | 1942 document().view()->updateAllLifecyclePhases(); |
| 1969 | 1943 |
| 1970 const ObjectPaintProperties* overflowAScrollProperties = overflowA->layoutOb
ject()->objectPaintProperties(); | 1944 const ObjectPaintProperties* overflowAScrollProperties = overflowA->layoutOb
ject()->objectPaintProperties(); |
| 1971 // Because the frameView is does not scroll, overflowA's scroll should be un
der the root. | 1945 // Because the frameView is does not scroll, overflowA's scroll should be a
root node. |
| 1972 EXPECT_EQ(rootScroll(), overflowAScrollProperties->scroll()->parent()); | 1946 EXPECT_EQ(nullptr, overflowAScrollProperties->scroll()->parent()); |
| 1973 EXPECT_EQ(TransformationMatrix().translate(0, -37), overflowAScrollPropertie
s->scroll()->scrollOffsetTranslation()->matrix()); | 1947 EXPECT_EQ(TransformationMatrix().translate(0, -37), overflowAScrollPropertie
s->scroll()->scrollOffsetTranslation()->matrix()); |
| 1974 EXPECT_EQ(IntSize(20, 20), overflowAScrollProperties->scroll()->clip()); | 1948 EXPECT_EQ(IntSize(20, 20), overflowAScrollProperties->scroll()->clip()); |
| 1975 // 100 is the forceScroll element's height because the overflow child does n
ot contribute to the height. | 1949 // 100 is the forceScroll element's height because the overflow child does n
ot contribute to the height. |
| 1976 EXPECT_EQ(IntSize(20, 100), overflowAScrollProperties->scroll()->bounds()); | 1950 EXPECT_EQ(IntSize(20, 100), overflowAScrollProperties->scroll()->bounds()); |
| 1977 EXPECT_TRUE(overflowAScrollProperties->scroll()->userScrollableHorizontal())
; | 1951 EXPECT_TRUE(overflowAScrollProperties->scroll()->userScrollableHorizontal())
; |
| 1978 EXPECT_TRUE(overflowAScrollProperties->scroll()->userScrollableVertical()); | 1952 EXPECT_TRUE(overflowAScrollProperties->scroll()->userScrollableVertical()); |
| 1979 | 1953 |
| 1980 const ObjectPaintProperties* overflowBScrollProperties = overflowB->layoutOb
ject()->objectPaintProperties(); | 1954 const ObjectPaintProperties* overflowBScrollProperties = overflowB->layoutOb
ject()->objectPaintProperties(); |
| 1981 // The overflow child's scroll node should be a child of the parent's (overf
lowA) scroll node. | 1955 // The overflow child's scroll node should be a child of the parent's (overf
lowA) scroll node. |
| 1982 EXPECT_EQ(overflowAScrollProperties->scroll(), overflowBScrollProperties->sc
roll()->parent()); | 1956 EXPECT_EQ(overflowAScrollProperties->scroll(), overflowBScrollProperties->sc
roll()->parent()); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 2003 { | 1977 { |
| 2004 setBodyInnerHTML( | 1978 setBodyInnerHTML( |
| 2005 "<svg id='svg' xmlns='http://www.w3.org/2000/svg' width='100px' height='
100px' style='overflow: visible'>" | 1979 "<svg id='svg' xmlns='http://www.w3.org/2000/svg' width='100px' height='
100px' style='overflow: visible'>" |
| 2006 " <rect width='200' height='200' fill='red' />" | 1980 " <rect width='200' height='200' fill='red' />" |
| 2007 "</svg>"); | 1981 "</svg>"); |
| 2008 | 1982 |
| 2009 EXPECT_FALSE(getLayoutObjectByElementId("svg")->objectPaintProperties()->ove
rflowClip()); | 1983 EXPECT_FALSE(getLayoutObjectByElementId("svg")->objectPaintProperties()->ove
rflowClip()); |
| 2010 } | 1984 } |
| 2011 | 1985 |
| 2012 } // namespace blink | 1986 } // namespace blink |
| OLD | NEW |