| 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 | 69 |
| 70 Settings::setMockScrollbarsEnabled(false); | 70 Settings::setMockScrollbarsEnabled(false); |
| 71 } | 71 } |
| 72 | 72 |
| 73 #define CHECK_VISUAL_RECT(expected, sourceLayoutObject, ancestorLayoutObject, \ | 73 #define CHECK_VISUAL_RECT(expected, sourceLayoutObject, ancestorLayoutObject, \ |
| 74 slopFactor) \ | 74 slopFactor) \ |
| 75 do { \ | 75 do { \ |
| 76 GeometryMapper geometryMapper; \ | 76 GeometryMapper geometryMapper; \ |
| 77 LayoutRect source((sourceLayoutObject)->localVisualRect()); \ | 77 LayoutRect source((sourceLayoutObject)->localVisualRect()); \ |
| 78 source.moveBy((sourceLayoutObject)->paintOffset()); \ | 78 source.moveBy((sourceLayoutObject)->paintOffset()); \ |
| 79 bool success = false; \ | |
| 80 const auto& contentsProperties = \ | 79 const auto& contentsProperties = \ |
| 81 *(ancestorLayoutObject)->paintProperties()->contentsProperties(); \ | 80 *(ancestorLayoutObject)->paintProperties()->contentsProperties(); \ |
| 82 LayoutRect actual = \ | 81 LayoutRect actual = \ |
| 83 LayoutRect(geometryMapper.sourceToDestinationVisualRect( \ | 82 LayoutRect(geometryMapper.sourceToDestinationVisualRect( \ |
| 84 FloatRect(source), *(sourceLayoutObject) \ | 83 FloatRect(source), *(sourceLayoutObject) \ |
| 85 ->paintProperties() \ | 84 ->paintProperties() \ |
| 86 ->localBorderBoxProperties(), \ | 85 ->localBorderBoxProperties(), \ |
| 87 contentsProperties, success)); \ | 86 contentsProperties)); \ |
| 88 ASSERT_TRUE(success); \ | |
| 89 actual.moveBy(-(ancestorLayoutObject)->paintOffset()); \ | 87 actual.moveBy(-(ancestorLayoutObject)->paintOffset()); \ |
| 90 EXPECT_EQ(expected, actual) \ | 88 EXPECT_EQ(expected, actual) \ |
| 91 << "GeometryMapper: expected: " << expected.toString() \ | 89 << "GeometryMapper: expected: " << expected.toString() \ |
| 92 << ", actual: " << actual.toString(); \ | 90 << ", actual: " << actual.toString(); \ |
| 93 \ | 91 \ |
| 94 if (slopFactor == LayoutUnit::max()) \ | 92 if (slopFactor == LayoutUnit::max()) \ |
| 95 break; \ | 93 break; \ |
| 96 LayoutRect slowPathRect = (sourceLayoutObject)->localVisualRect(); \ | 94 LayoutRect slowPathRect = (sourceLayoutObject)->localVisualRect(); \ |
| 97 (sourceLayoutObject) \ | 95 (sourceLayoutObject) \ |
| 98 ->mapToVisualRectInAncestorSpace(ancestorLayoutObject, slowPathRect); \ | 96 ->mapToVisualRectInAncestorSpace(ancestorLayoutObject, slowPathRect); \ |
| (...skipping 3044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3143 | 3141 |
| 3144 LayoutObject* target = getLayoutObjectByElementId("target"); | 3142 LayoutObject* target = getLayoutObjectByElementId("target"); |
| 3145 const auto* localBorderBoxProperties = | 3143 const auto* localBorderBoxProperties = |
| 3146 target->paintProperties()->localBorderBoxProperties(); | 3144 target->paintProperties()->localBorderBoxProperties(); |
| 3147 ASSERT_TRUE(localBorderBoxProperties); | 3145 ASSERT_TRUE(localBorderBoxProperties); |
| 3148 EXPECT_EQ(LayoutPoint(66, 55), target->paintOffset()); | 3146 EXPECT_EQ(LayoutPoint(66, 55), target->paintOffset()); |
| 3149 EXPECT_EQ(effect, localBorderBoxProperties->effect()); | 3147 EXPECT_EQ(effect, localBorderBoxProperties->effect()); |
| 3150 } | 3148 } |
| 3151 | 3149 |
| 3152 } // namespace blink | 3150 } // namespace blink |
| OLD | NEW |