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