| 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/LayoutObject.h" | 5 #include "core/layout/LayoutObject.h" |
| 6 | 6 |
| 7 #include "core/frame/FrameView.h" | 7 #include "core/frame/FrameView.h" |
| 8 #include "core/layout/LayoutTestHelper.h" | 8 #include "core/layout/LayoutTestHelper.h" |
| 9 #include "core/layout/LayoutView.h" | 9 #include "core/layout/LayoutView.h" |
| 10 #include "platform/json/JSONValues.h" | 10 #include "platform/json/JSONValues.h" |
| 11 #include "platform/testing/RuntimeEnabledFeaturesTestHelpers.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 12 | 13 |
| 13 namespace blink { | 14 namespace blink { |
| 14 | 15 |
| 15 class LayoutObjectTest : public RenderingTest { | 16 class LayoutObjectTest : public RenderingTest { |
| 16 public: | 17 public: |
| 17 LayoutObjectTest() : RenderingTest(EmptyFrameLoaderClient::create()) {} | 18 LayoutObjectTest() : RenderingTest(EmptyFrameLoaderClient::create()) {} |
| 18 }; | 19 }; |
| 19 | 20 |
| 20 TEST_F(LayoutObjectTest, LayoutDecoratedNameCalledWithPositionedObject) { | 21 TEST_F(LayoutObjectTest, LayoutDecoratedNameCalledWithPositionedObject) { |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 "hidden'></div>" | 118 "hidden'></div>" |
| 118 " </div>" | 119 " </div>" |
| 119 "</div>"); | 120 "</div>"); |
| 120 | 121 |
| 121 LayoutObject* overflowClipObject = | 122 LayoutObject* overflowClipObject = |
| 122 getLayoutObjectByElementId("overflow-clip-layer"); | 123 getLayoutObjectByElementId("overflow-clip-layer"); |
| 123 LayoutBlock* columns = toLayoutBlock(getLayoutObjectByElementId("columns")); | 124 LayoutBlock* columns = toLayoutBlock(getLayoutObjectByElementId("columns")); |
| 124 EXPECT_EQ(columns->layer(), overflowClipObject->paintingLayer()); | 125 EXPECT_EQ(columns->layer(), overflowClipObject->paintingLayer()); |
| 125 } | 126 } |
| 126 | 127 |
| 127 namespace { | |
| 128 | |
| 129 class ScopedSPv2 { | |
| 130 public: | |
| 131 ScopedSPv2() { RuntimeEnabledFeatures::setSlimmingPaintV2Enabled(true); } | |
| 132 ~ScopedSPv2() { m_featuresBackup.restore(); } | |
| 133 | |
| 134 private: | |
| 135 RuntimeEnabledFeatures::Backup m_featuresBackup; | |
| 136 }; | |
| 137 | |
| 138 } // namespace | |
| 139 | |
| 140 TEST_F(LayoutObjectTest, MutableForPaintingClearPaintFlags) { | 128 TEST_F(LayoutObjectTest, MutableForPaintingClearPaintFlags) { |
| 141 LayoutObject* object = document().body()->layoutObject(); | 129 LayoutObject* object = document().body()->layoutObject(); |
| 142 object->setShouldDoFullPaintInvalidation(); | 130 object->setShouldDoFullPaintInvalidation(); |
| 143 EXPECT_TRUE(object->shouldDoFullPaintInvalidation()); | 131 EXPECT_TRUE(object->shouldDoFullPaintInvalidation()); |
| 144 object->m_bitfields.setChildShouldCheckForPaintInvalidation(true); | 132 object->m_bitfields.setChildShouldCheckForPaintInvalidation(true); |
| 145 EXPECT_TRUE(object->m_bitfields.childShouldCheckForPaintInvalidation()); | 133 EXPECT_TRUE(object->m_bitfields.childShouldCheckForPaintInvalidation()); |
| 146 object->setMayNeedPaintInvalidation(); | 134 object->setMayNeedPaintInvalidation(); |
| 147 EXPECT_TRUE(object->mayNeedPaintInvalidation()); | 135 EXPECT_TRUE(object->mayNeedPaintInvalidation()); |
| 148 object->setMayNeedPaintInvalidationSubtree(); | 136 object->setMayNeedPaintInvalidationSubtree(); |
| 149 EXPECT_TRUE(object->mayNeedPaintInvalidationSubtree()); | 137 EXPECT_TRUE(object->mayNeedPaintInvalidationSubtree()); |
| 150 object->setMayNeedPaintInvalidationAnimatedBackgroundImage(); | 138 object->setMayNeedPaintInvalidationAnimatedBackgroundImage(); |
| 151 EXPECT_TRUE(object->mayNeedPaintInvalidationAnimatedBackgroundImage()); | 139 EXPECT_TRUE(object->mayNeedPaintInvalidationAnimatedBackgroundImage()); |
| 152 object->setShouldInvalidateSelection(); | 140 object->setShouldInvalidateSelection(); |
| 153 EXPECT_TRUE(object->shouldInvalidateSelection()); | 141 EXPECT_TRUE(object->shouldInvalidateSelection()); |
| 154 object->setBackgroundChangedSinceLastPaintInvalidation(); | 142 object->setBackgroundChangedSinceLastPaintInvalidation(); |
| 155 EXPECT_TRUE(object->backgroundChangedSinceLastPaintInvalidation()); | 143 EXPECT_TRUE(object->backgroundChangedSinceLastPaintInvalidation()); |
| 156 object->setNeedsPaintPropertyUpdate(); | 144 object->setNeedsPaintPropertyUpdate(); |
| 157 EXPECT_TRUE(object->needsPaintPropertyUpdate()); | 145 EXPECT_TRUE(object->needsPaintPropertyUpdate()); |
| 158 object->m_bitfields.setDescendantNeedsPaintPropertyUpdate(true); | 146 object->m_bitfields.setDescendantNeedsPaintPropertyUpdate(true); |
| 159 EXPECT_TRUE(object->descendantNeedsPaintPropertyUpdate()); | 147 EXPECT_TRUE(object->descendantNeedsPaintPropertyUpdate()); |
| 160 | 148 |
| 161 ScopedSPv2 enableSPv2; | 149 ScopedSlimmingPaintV2ForTest enableSPv2(true); |
| 162 document().lifecycle().advanceTo(DocumentLifecycle::InPrePaint); | 150 document().lifecycle().advanceTo(DocumentLifecycle::InPrePaint); |
| 163 object->getMutableForPainting().clearPaintFlags(); | 151 object->getMutableForPainting().clearPaintFlags(); |
| 164 | 152 |
| 165 EXPECT_FALSE(object->shouldDoFullPaintInvalidation()); | 153 EXPECT_FALSE(object->shouldDoFullPaintInvalidation()); |
| 166 EXPECT_FALSE(object->m_bitfields.childShouldCheckForPaintInvalidation()); | 154 EXPECT_FALSE(object->m_bitfields.childShouldCheckForPaintInvalidation()); |
| 167 EXPECT_FALSE(object->mayNeedPaintInvalidation()); | 155 EXPECT_FALSE(object->mayNeedPaintInvalidation()); |
| 168 EXPECT_FALSE(object->mayNeedPaintInvalidationSubtree()); | 156 EXPECT_FALSE(object->mayNeedPaintInvalidationSubtree()); |
| 169 EXPECT_FALSE(object->mayNeedPaintInvalidationAnimatedBackgroundImage()); | 157 EXPECT_FALSE(object->mayNeedPaintInvalidationAnimatedBackgroundImage()); |
| 170 EXPECT_FALSE(object->shouldInvalidateSelection()); | 158 EXPECT_FALSE(object->shouldInvalidateSelection()); |
| 171 EXPECT_FALSE(object->backgroundChangedSinceLastPaintInvalidation()); | 159 EXPECT_FALSE(object->backgroundChangedSinceLastPaintInvalidation()); |
| 172 EXPECT_FALSE(object->needsPaintPropertyUpdate()); | 160 EXPECT_FALSE(object->needsPaintPropertyUpdate()); |
| 173 EXPECT_FALSE(object->descendantNeedsPaintPropertyUpdate()); | 161 EXPECT_FALSE(object->descendantNeedsPaintPropertyUpdate()); |
| 174 } | 162 } |
| 175 | 163 |
| 176 } // namespace blink | 164 } // namespace blink |
| OLD | NEW |