| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 | 71 |
| 72 void PaintPropertyTreeBuilderTest::TearDown() { | 72 void PaintPropertyTreeBuilderTest::TearDown() { |
| 73 RenderingTest::TearDown(); | 73 RenderingTest::TearDown(); |
| 74 | 74 |
| 75 Settings::setMockScrollbarsEnabled(false); | 75 Settings::setMockScrollbarsEnabled(false); |
| 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 GeometryMapper geometryMapper; \ | 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 LayoutRect actual = LayoutRect( \ |
| 87 geometryMapper \ | 87 geometryMapper \ |
| 88 .sourceToDestinationVisualRect(FloatRect(source), \ | 88 ->sourceToDestinationVisualRect(FloatRect(source), \ |
| 89 *(sourceLayoutObject) \ | 89 *(sourceLayoutObject) \ |
| 90 ->paintProperties() \ | 90 ->paintProperties() \ |
| 91 ->localBorderBoxProperties(), \ | 91 ->localBorderBoxProperties(), \ |
| 92 contentsProperties) \ | 92 contentsProperties) \ |
| 93 .rect()); \ | 93 .rect()); \ |
| 94 actual.moveBy(-(ancestorLayoutObject)->paintOffset()); \ | 94 actual.moveBy(-(ancestorLayoutObject)->paintOffset()); \ |
| 95 EXPECT_EQ(expected, actual) \ | 95 EXPECT_EQ(expected, actual) \ |
| 96 << "GeometryMapper: expected: " << expected.toString() \ | 96 << "GeometryMapper: expected: " << expected.toString() \ |
| 97 << ", actual: " << actual.toString(); \ | 97 << ", actual: " << actual.toString(); \ |
| 98 \ | 98 \ |
| 99 if (slopFactor == LayoutUnit::max()) \ | 99 if (slopFactor == LayoutUnit::max()) \ |
| 100 break; \ | 100 break; \ |
| 101 LayoutRect slowPathRect = (sourceLayoutObject)->localVisualRect(); \ | 101 LayoutRect slowPathRect = (sourceLayoutObject)->localVisualRect(); \ |
| 102 (sourceLayoutObject) \ | 102 (sourceLayoutObject) \ |
| (...skipping 3065 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3168 "<div id='target' style='overflow: auto; width: 100px; height: 100px'>" | 3168 "<div id='target' style='overflow: auto; width: 100px; height: 100px'>" |
| 3169 " <div style='width: 200px; height: 200px'></div>" | 3169 " <div style='width: 200px; height: 200px'></div>" |
| 3170 "</div>"); | 3170 "</div>"); |
| 3171 | 3171 |
| 3172 const ObjectPaintProperties* properties = paintPropertiesForElement("target"); | 3172 const ObjectPaintProperties* properties = paintPropertiesForElement("target"); |
| 3173 EXPECT_NE(CompositorElementId(), | 3173 EXPECT_NE(CompositorElementId(), |
| 3174 properties->scrollTranslation()->compositorElementId()); | 3174 properties->scrollTranslation()->compositorElementId()); |
| 3175 } | 3175 } |
| 3176 | 3176 |
| 3177 } // namespace blink | 3177 } // namespace blink |
| OLD | NEW |