| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/PaintPropertyTreePrinter.h" | 5 #include "core/paint/PaintPropertyTreePrinter.h" |
| 6 | 6 |
| 7 #include "core/layout/LayoutObject.h" | 7 #include "core/layout/LayoutObject.h" |
| 8 #include "core/layout/LayoutTestHelper.h" | 8 #include "core/layout/LayoutTestHelper.h" |
| 9 #include "platform/testing/RuntimeEnabledFeaturesTestHelpers.h" | 9 #include "platform/testing/RuntimeEnabledFeaturesTestHelpers.h" |
| 10 #include "testing/gmock/include/gmock/gmock-matchers.h" | 10 #include "testing/gmock/include/gmock/gmock-matchers.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 } | 77 } |
| 78 | 78 |
| 79 TEST_P(PaintPropertyTreePrinterTest, SimpleTransformTreePath) { | 79 TEST_P(PaintPropertyTreePrinterTest, SimpleTransformTreePath) { |
| 80 setBodyInnerHTML( | 80 setBodyInnerHTML( |
| 81 "<div id='transform' style='transform: translate3d(10px, 10px, " | 81 "<div id='transform' style='transform: translate3d(10px, 10px, " |
| 82 "0px);'></div>"); | 82 "0px);'></div>"); |
| 83 LayoutObject* transformedObject = | 83 LayoutObject* transformedObject = |
| 84 document().getElementById("transform")->layoutObject(); | 84 document().getElementById("transform")->layoutObject(); |
| 85 const auto* transformedObjectProperties = | 85 const auto* transformedObjectProperties = |
| 86 transformedObject->paintProperties(); | 86 transformedObject->paintProperties(); |
| 87 String transformPathAsString = | 87 String transformPathAsString = transformPaintPropertyPathAsString( |
| 88 transformedObjectProperties->transform()->toTreeString(); | 88 transformedObjectProperties->transform()); |
| 89 EXPECT_THAT(transformPathAsString.ascii().data(), | 89 EXPECT_THAT(transformPathAsString.ascii().data(), |
| 90 testing::MatchesRegex("root .* transform.*" | 90 testing::MatchesRegex("root .* transform.*" |
| 91 " .* transform.*" | 91 " .* transform.*" |
| 92 " .* transform.*" | 92 " .* transform.*" |
| 93 " .* transform.*")); | 93 " .* transform.*")); |
| 94 } | 94 } |
| 95 | 95 |
| 96 TEST_P(PaintPropertyTreePrinterTest, SimpleClipTreePath) { | 96 TEST_P(PaintPropertyTreePrinterTest, SimpleClipTreePath) { |
| 97 setBodyInnerHTML( | 97 setBodyInnerHTML( |
| 98 "<div id='clip' style='position: absolute; clip: rect(10px, 80px, 70px, " | 98 "<div id='clip' style='position: absolute; clip: rect(10px, 80px, 70px, " |
| 99 "40px);'></div>"); | 99 "40px);'></div>"); |
| 100 LayoutObject* clippedObject = | 100 LayoutObject* clippedObject = |
| 101 document().getElementById("clip")->layoutObject(); | 101 document().getElementById("clip")->layoutObject(); |
| 102 const auto* clippedObjectProperties = clippedObject->paintProperties(); | 102 const auto* clippedObjectProperties = clippedObject->paintProperties(); |
| 103 String clipPathAsString = clippedObjectProperties->cssClip()->toTreeString(); | 103 String clipPathAsString = |
| 104 clipPaintPropertyPathAsString(clippedObjectProperties->cssClip()); |
| 104 EXPECT_THAT(clipPathAsString.ascii().data(), | 105 EXPECT_THAT(clipPathAsString.ascii().data(), |
| 105 testing::MatchesRegex("root .* rect.*" | 106 testing::MatchesRegex("root .* rect.*" |
| 106 " .* rect.*" | 107 " .* rect.*" |
| 107 " .* rect.*")); | 108 " .* rect.*")); |
| 108 } | 109 } |
| 109 | 110 |
| 110 TEST_P(PaintPropertyTreePrinterTest, SimpleEffectTreePath) { | 111 TEST_P(PaintPropertyTreePrinterTest, SimpleEffectTreePath) { |
| 111 setBodyInnerHTML("<div id='effect' style='opacity: 0.9;'></div>"); | 112 setBodyInnerHTML("<div id='effect' style='opacity: 0.9;'></div>"); |
| 112 LayoutObject* effectObject = | 113 LayoutObject* effectObject = |
| 113 document().getElementById("effect")->layoutObject(); | 114 document().getElementById("effect")->layoutObject(); |
| 114 const auto* effectObjectProperties = effectObject->paintProperties(); | 115 const auto* effectObjectProperties = effectObject->paintProperties(); |
| 115 String effectPathAsString = effectObjectProperties->effect()->toTreeString(); | 116 String effectPathAsString = |
| 117 effectPaintPropertyPathAsString(effectObjectProperties->effect()); |
| 116 EXPECT_THAT(effectPathAsString.ascii().data(), | 118 EXPECT_THAT(effectPathAsString.ascii().data(), |
| 117 testing::MatchesRegex("root .* opacity.*" | 119 testing::MatchesRegex("root .* opacity.*" |
| 118 " .* opacity.*")); | 120 " .* opacity.*")); |
| 119 } | 121 } |
| 120 | 122 |
| 121 TEST_P(PaintPropertyTreePrinterTest, SimpleScrollTreePath) { | 123 TEST_P(PaintPropertyTreePrinterTest, SimpleScrollTreePath) { |
| 122 setBodyInnerHTML( | 124 setBodyInnerHTML( |
| 123 "<div id='scroll' style='overflow: scroll; height: 100px;'>" | 125 "<div id='scroll' style='overflow: scroll; height: 100px;'>" |
| 124 " <div id='forceScroll' style='height: 4000px;'></div>" | 126 " <div id='forceScroll' style='height: 4000px;'></div>" |
| 125 "</div>"); | 127 "</div>"); |
| 126 LayoutObject* scrollObject = | 128 LayoutObject* scrollObject = |
| 127 document().getElementById("scroll")->layoutObject(); | 129 document().getElementById("scroll")->layoutObject(); |
| 128 const auto* scrollObjectProperties = scrollObject->paintProperties(); | 130 const auto* scrollObjectProperties = scrollObject->paintProperties(); |
| 129 String scrollPathAsString = scrollObjectProperties->scroll()->toTreeString(); | 131 String scrollPathAsString = |
| 132 scrollPaintPropertyPathAsString(scrollObjectProperties->scroll()); |
| 130 EXPECT_THAT(scrollPathAsString.ascii().data(), | 133 EXPECT_THAT(scrollPathAsString.ascii().data(), |
| 131 testing::MatchesRegex("root .* scroll.*" | 134 testing::MatchesRegex("root .* scroll.*" |
| 132 " .* scroll.*")); | 135 " .* scroll.*")); |
| 133 } | 136 } |
| 134 | 137 |
| 135 } // namespace blink | 138 } // namespace blink |
| 136 | 139 |
| 137 #endif | 140 #endif |
| OLD | NEW |