| 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/paint/PaintPropertyTreeBuilderTest.h" | 5 #include "core/paint/PaintPropertyTreeBuilderTest.h" |
| 6 | 6 |
| 7 #include "core/html/HTMLIFrameElement.h" | 7 #include "core/html/HTMLIFrameElement.h" |
| 8 #include "core/layout/LayoutTreeAsText.h" | 8 #include "core/layout/LayoutTreeAsText.h" |
| 9 #include "core/paint/ObjectPaintProperties.h" | 9 #include "core/paint/ObjectPaintProperties.h" |
| 10 #include "core/paint/PaintPropertyTreePrinter.h" | 10 #include "core/paint/PaintPropertyTreePrinter.h" |
| (...skipping 3311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3322 | 3322 |
| 3323 Element* mask = document().getElementById("mask"); | 3323 Element* mask = document().getElementById("mask"); |
| 3324 mask->setAttribute(HTMLNames::styleAttr, "height: 200px"); | 3324 mask->setAttribute(HTMLNames::styleAttr, "height: 200px"); |
| 3325 document().view()->updateAllLifecyclePhases(); | 3325 document().view()->updateAllLifecyclePhases(); |
| 3326 | 3326 |
| 3327 ASSERT_EQ(properties, paintPropertiesForElement("mask")); | 3327 ASSERT_EQ(properties, paintPropertiesForElement("mask")); |
| 3328 ASSERT_EQ(maskClip, properties->maskClip()); | 3328 ASSERT_EQ(maskClip, properties->maskClip()); |
| 3329 EXPECT_EQ(FloatRoundedRect(8, 8, 100, 200), maskClip->clipRect()); | 3329 EXPECT_EQ(FloatRoundedRect(8, 8, 100, 200), maskClip->clipRect()); |
| 3330 } | 3330 } |
| 3331 | 3331 |
| 3332 TEST_P(PaintPropertyTreeBuilderTest, SVGResource) { |
| 3333 setBodyInnerHTML( |
| 3334 "<svg id='svg' xmlns='http://www.w3.org/2000/svg' >" |
| 3335 " <g transform='scale(1000)'>" |
| 3336 " <marker id='markerMiddle' markerWidth='2' markerHeight='2' refX='5' " |
| 3337 " refY='5' markerUnits='strokeWidth'>" |
| 3338 " <g id='transformInsideMarker' transform='scale(4)'>" |
| 3339 " <circle cx='5' cy='5' r='7' fill='green'/>" |
| 3340 " </g>" |
| 3341 " </marker>" |
| 3342 " </g>" |
| 3343 " <g id='transformOutsidePath' transform='scale(2)'>" |
| 3344 " <path d='M 130 135 L 180 135 L 180 185' " |
| 3345 " marker-mid='url(#markerMiddle)' fill='none' stroke-width='8px' " |
| 3346 " stroke='black'/>" |
| 3347 " </g>" |
| 3348 "</svg>"); |
| 3349 |
| 3350 const ObjectPaintProperties* transformInsideMarkerProperties = |
| 3351 paintPropertiesForElement("transformInsideMarker"); |
| 3352 const ObjectPaintProperties* transformOutsidePathProperties = |
| 3353 paintPropertiesForElement("transformOutsidePath"); |
| 3354 const ObjectPaintProperties* svgProperties = paintPropertiesForElement("svg"); |
| 3355 |
| 3356 // The <marker> object resets to a new paint property tree, so the |
| 3357 // transform within it should have the root as parent. |
| 3358 EXPECT_EQ(TransformPaintPropertyNode::root(), |
| 3359 transformInsideMarkerProperties->transform()->parent()); |
| 3360 |
| 3361 // Whereas this is not true of the transform above the path. |
| 3362 EXPECT_EQ(svgProperties->svgLocalToBorderBoxTransform(), |
| 3363 transformOutsidePathProperties->transform()->parent()); |
| 3364 } |
| 3365 |
| 3366 TEST_P(PaintPropertyTreeBuilderTest, SVGHiddenResource) { |
| 3367 setBodyInnerHTML( |
| 3368 "<svg id='svg' xmlns='http://www.w3.org/2000/svg' >" |
| 3369 " <g transform='scale(1000)'>" |
| 3370 " <symbol id='symbol'>" |
| 3371 " <g id='transformInsideSymbol' transform='scale(4)'>" |
| 3372 " <circle cx='5' cy='5' r='7' fill='green'/>" |
| 3373 " </g>" |
| 3374 " </symbol>" |
| 3375 " </g>" |
| 3376 " <g id='transformOutsideUse' transform='scale(2)'>" |
| 3377 " <use x='25' y='25' width='400' height='400' xlink:href='#symbol'/>" |
| 3378 " </g>" |
| 3379 "</svg>"); |
| 3380 |
| 3381 const ObjectPaintProperties* transformInsideSymbolProperties = |
| 3382 paintPropertiesForElement("transformInsideSymbol"); |
| 3383 const ObjectPaintProperties* transformOutsideUseProperties = |
| 3384 paintPropertiesForElement("transformOutsideUse"); |
| 3385 const ObjectPaintProperties* svgProperties = paintPropertiesForElement("svg"); |
| 3386 |
| 3387 // The <marker> object resets to a new paint property tree, so the |
| 3388 // transform within it should have the root as parent. |
| 3389 EXPECT_EQ(TransformPaintPropertyNode::root(), |
| 3390 transformInsideSymbolProperties->transform()->parent()); |
| 3391 |
| 3392 // Whereas this is not true of the transform above the path. |
| 3393 EXPECT_EQ(svgProperties->svgLocalToBorderBoxTransform(), |
| 3394 transformOutsideUseProperties->transform()->parent()); |
| 3395 } |
| 3396 |
| 3332 } // namespace blink | 3397 } // namespace blink |
| OLD | NEW |