| 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 RenderingTest::TearDown(); | 85 RenderingTest::TearDown(); |
| 86 | 86 |
| 87 Settings::setMockScrollbarsEnabled(false); | 87 Settings::setMockScrollbarsEnabled(false); |
| 88 } | 88 } |
| 89 }; | 89 }; |
| 90 | 90 |
| 91 #define CHECK_VISUAL_RECT(expected, sourceLayoutObject, ancestorLayoutObject, \ | 91 #define CHECK_VISUAL_RECT(expected, sourceLayoutObject, ancestorLayoutObject, \ |
| 92 slopFactor) \ | 92 slopFactor) \ |
| 93 do { \ | 93 do { \ |
| 94 GeometryMapper geometryMapper; \ | 94 GeometryMapper geometryMapper; \ |
| 95 LayoutRect source( \ | 95 LayoutRect source((sourceLayoutObject)->localVisualRect()); \ |
| 96 (sourceLayoutObject)->localOverflowRectForPaintInvalidation()); \ | |
| 97 source.moveBy((sourceLayoutObject) \ | 96 source.moveBy((sourceLayoutObject) \ |
| 98 ->paintProperties() \ | 97 ->paintProperties() \ |
| 99 ->localBorderBoxProperties() \ | 98 ->localBorderBoxProperties() \ |
| 100 ->paintOffset); \ | 99 ->paintOffset); \ |
| 101 bool success = false; \ | 100 bool success = false; \ |
| 102 auto contentsProperties = \ | 101 auto contentsProperties = \ |
| 103 (ancestorLayoutObject)->paintProperties()->contentsProperties(); \ | 102 (ancestorLayoutObject)->paintProperties()->contentsProperties(); \ |
| 104 LayoutRect actual = \ | 103 LayoutRect actual = \ |
| 105 LayoutRect(geometryMapper.mapToVisualRectInDestinationSpace( \ | 104 LayoutRect(geometryMapper.mapToVisualRectInDestinationSpace( \ |
| 106 FloatRect(source), (sourceLayoutObject) \ | 105 FloatRect(source), (sourceLayoutObject) \ |
| 107 ->paintProperties() \ | 106 ->paintProperties() \ |
| 108 ->localBorderBoxProperties() \ | 107 ->localBorderBoxProperties() \ |
| 109 ->propertyTreeState, \ | 108 ->propertyTreeState, \ |
| 110 contentsProperties.propertyTreeState, success)); \ | 109 contentsProperties.propertyTreeState, success)); \ |
| 111 ASSERT_TRUE(success); \ | 110 ASSERT_TRUE(success); \ |
| 112 actual.moveBy(-contentsProperties.paintOffset); \ | 111 actual.moveBy(-contentsProperties.paintOffset); \ |
| 113 EXPECT_EQ(expected, actual) \ | 112 EXPECT_EQ(expected, actual) \ |
| 114 << "GeometryMapper: expected: " << expected.toString() \ | 113 << "GeometryMapper: expected: " << expected.toString() \ |
| 115 << ", actual: " << actual.toString(); \ | 114 << ", actual: " << actual.toString(); \ |
| 116 \ | 115 \ |
| 117 if (slopFactor == LayoutUnit::max()) \ | 116 if (slopFactor == LayoutUnit::max()) \ |
| 118 break; \ | 117 break; \ |
| 119 LayoutRect slowPathRect = \ | 118 LayoutRect slowPathRect = (sourceLayoutObject)->localVisualRect(); \ |
| 120 (sourceLayoutObject)->localOverflowRectForPaintInvalidation(); \ | |
| 121 (sourceLayoutObject) \ | 119 (sourceLayoutObject) \ |
| 122 ->mapToVisualRectInAncestorSpace(ancestorLayoutObject, slowPathRect); \ | 120 ->mapToVisualRectInAncestorSpace(ancestorLayoutObject, slowPathRect); \ |
| 123 if (slopFactor) { \ | 121 if (slopFactor) { \ |
| 124 LayoutRect inflatedActual = LayoutRect(actual); \ | 122 LayoutRect inflatedActual = LayoutRect(actual); \ |
| 125 inflatedActual.inflate(slopFactor); \ | 123 inflatedActual.inflate(slopFactor); \ |
| 126 SCOPED_TRACE( \ | 124 SCOPED_TRACE( \ |
| 127 String::format("Old path rect: %s, Actual: %s, Inflated actual: %s", \ | 125 String::format("Old path rect: %s, Actual: %s, Inflated actual: %s", \ |
| 128 slowPathRect.toString().ascii().data(), \ | 126 slowPathRect.toString().ascii().data(), \ |
| 129 actual.toString().ascii().data(), \ | 127 actual.toString().ascii().data(), \ |
| 130 inflatedActual.toString().ascii().data())); \ | 128 inflatedActual.toString().ascii().data())); \ |
| (...skipping 2801 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2932 EXPECT_EQ(framePreTranslation(), | 2930 EXPECT_EQ(framePreTranslation(), |
| 2933 childProperties->paintOffsetTranslation()->parent()); | 2931 childProperties->paintOffsetTranslation()->parent()); |
| 2934 EXPECT_EQ(childProperties->paintOffsetTranslation(), | 2932 EXPECT_EQ(childProperties->paintOffsetTranslation(), |
| 2935 childPaintState.transform()); | 2933 childPaintState.transform()); |
| 2936 // This will change once we added clip expansion node. | 2934 // This will change once we added clip expansion node. |
| 2937 EXPECT_EQ(filterProperties->effect()->outputClip(), childPaintState.clip()); | 2935 EXPECT_EQ(filterProperties->effect()->outputClip(), childPaintState.clip()); |
| 2938 EXPECT_EQ(filterProperties->effect(), childPaintState.effect()); | 2936 EXPECT_EQ(filterProperties->effect(), childPaintState.effect()); |
| 2939 } | 2937 } |
| 2940 | 2938 |
| 2941 } // namespace blink | 2939 } // namespace blink |
| OLD | NEW |