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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 } | 76 } |
77 | 77 |
78 #define CHECK_VISUAL_RECT(expected, sourceLayoutObject, ancestorLayoutObject, \ | 78 #define CHECK_VISUAL_RECT(expected, sourceLayoutObject, ancestorLayoutObject, \ |
79 slopFactor) \ | 79 slopFactor) \ |
80 do { \ | 80 do { \ |
81 std::unique_ptr<GeometryMapper> geometryMapper = GeometryMapper::create(); \ | 81 std::unique_ptr<GeometryMapper> geometryMapper = GeometryMapper::create(); \ |
82 LayoutRect source((sourceLayoutObject)->localVisualRect()); \ | 82 LayoutRect source((sourceLayoutObject)->localVisualRect()); \ |
83 source.moveBy((sourceLayoutObject)->paintOffset()); \ | 83 source.moveBy((sourceLayoutObject)->paintOffset()); \ |
84 const auto& contentsProperties = \ | 84 const auto& contentsProperties = \ |
85 *(ancestorLayoutObject)->paintProperties()->contentsProperties(); \ | 85 *(ancestorLayoutObject)->paintProperties()->contentsProperties(); \ |
86 FloatRect actualFloatRect(source); \ | 86 LayoutRect actual = LayoutRect( \ |
87 geometryMapper->sourceToDestinationVisualRect( \ | 87 geometryMapper \ |
88 *(sourceLayoutObject)->paintProperties()->localBorderBoxProperties(), \ | 88 ->sourceToDestinationVisualRect(FloatRect(source), \ |
89 contentsProperties, actualFloatRect); \ | 89 *(sourceLayoutObject) \ |
90 LayoutRect actual(actualFloatRect); \ | 90 ->paintProperties() \ |
| 91 ->localBorderBoxProperties(), \ |
| 92 contentsProperties) \ |
| 93 .rect()); \ |
91 actual.moveBy(-(ancestorLayoutObject)->paintOffset()); \ | 94 actual.moveBy(-(ancestorLayoutObject)->paintOffset()); \ |
92 EXPECT_EQ(expected, actual) \ | 95 EXPECT_EQ(expected, actual) \ |
93 << "GeometryMapper: expected: " << expected.toString() \ | 96 << "GeometryMapper: expected: " << expected.toString() \ |
94 << ", actual: " << actual.toString(); \ | 97 << ", actual: " << actual.toString(); \ |
95 \ | 98 \ |
96 if (slopFactor == LayoutUnit::max()) \ | 99 if (slopFactor == LayoutUnit::max()) \ |
97 break; \ | 100 break; \ |
98 LayoutRect slowPathRect = (sourceLayoutObject)->localVisualRect(); \ | 101 LayoutRect slowPathRect = (sourceLayoutObject)->localVisualRect(); \ |
99 (sourceLayoutObject) \ | 102 (sourceLayoutObject) \ |
100 ->mapToVisualRectInAncestorSpace(ancestorLayoutObject, slowPathRect); \ | 103 ->mapToVisualRectInAncestorSpace(ancestorLayoutObject, slowPathRect); \ |
(...skipping 3223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3324 Element* mask = document().getElementById("mask"); | 3327 Element* mask = document().getElementById("mask"); |
3325 mask->setAttribute(HTMLNames::styleAttr, "height: 200px"); | 3328 mask->setAttribute(HTMLNames::styleAttr, "height: 200px"); |
3326 document().view()->updateAllLifecyclePhases(); | 3329 document().view()->updateAllLifecyclePhases(); |
3327 | 3330 |
3328 ASSERT_EQ(properties, paintPropertiesForElement("mask")); | 3331 ASSERT_EQ(properties, paintPropertiesForElement("mask")); |
3329 ASSERT_EQ(maskClip, properties->maskClip()); | 3332 ASSERT_EQ(maskClip, properties->maskClip()); |
3330 EXPECT_EQ(FloatRoundedRect(8, 8, 100, 200), maskClip->clipRect()); | 3333 EXPECT_EQ(FloatRoundedRect(8, 8, 100, 200), maskClip->clipRect()); |
3331 } | 3334 } |
3332 | 3335 |
3333 } // namespace blink | 3336 } // namespace blink |
OLD | NEW |