| 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 // This test verifies the clip node generated for mask's implicit clip |
| 3334 // is correctly invalidated when a box resizes. |
| 3335 setBodyInnerHTML( |
| 3336 "<svg id='svg' xmlns='http://www.w3.org/2000/svg' >" |
| 3337 " <g transform='scale(1000)'>" |
| 3338 " <marker id='markerMiddle' markerWidth='2' markerHeight='2' refX='5' " |
| 3339 "refY='5' markerUnits='strokeWidth'>" |
| 3340 " <g id='transformInsideMarker' transform='scale(4)'>" |
| 3341 " <circle cx='5' cy='5' r='7' fill='green'/>" |
| 3342 " </g>" |
| 3343 " </marker>" |
| 3344 " </g>" |
| 3345 " <g id='transformOutsidePath' transform='scale(2)'>" |
| 3346 " <path d='M 130 135 L 180 135 L 180 185' " |
| 3347 "marker-mid='url(#markerMiddle)' fill='none' stroke-width='8px' " |
| 3348 "stroke='black'/>" |
| 3349 " </g>" |
| 3350 "</svg>"); |
| 3351 |
| 3352 const ObjectPaintProperties* transformInsideMarkerProperties = |
| 3353 paintPropertiesForElement("transformInsideMarker"); |
| 3354 const ObjectPaintProperties* transformOutsidePathProperties = |
| 3355 paintPropertiesForElement("transformOutsidePath"); |
| 3356 const ObjectPaintProperties* svgProperties = paintPropertiesForElement("svg"); |
| 3357 |
| 3358 // The <marker> object resets to a new paint property tree, so the |
| 3359 // transform within it should have the root as parent. |
| 3360 EXPECT_EQ(TransformPaintPropertyNode::root(), |
| 3361 transformInsideMarkerProperties->transform()->parent()); |
| 3362 |
| 3363 // Whereas this is not true of the transform above the path. |
| 3364 EXPECT_EQ(svgProperties->svgLocalToBorderBoxTransform(), |
| 3365 transformOutsidePathProperties->transform()->parent()); |
| 3366 } |
| 3367 |
| 3332 } // namespace blink | 3368 } // namespace blink |
| OLD | NEW |