| 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" |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 | 175 |
| 176 skipInfo = LayoutObject::AncestorSkipInfo(container); | 176 skipInfo = LayoutObject::AncestorSkipInfo(container); |
| 177 EXPECT_EQ(container, floating->container(&skipInfo)); | 177 EXPECT_EQ(container, floating->container(&skipInfo)); |
| 178 EXPECT_FALSE(skipInfo.ancestorSkipped()); | 178 EXPECT_FALSE(skipInfo.ancestorSkipped()); |
| 179 } | 179 } |
| 180 | 180 |
| 181 TEST_F(LayoutObjectTest, MutableForPaintingClearPaintFlags) { | 181 TEST_F(LayoutObjectTest, MutableForPaintingClearPaintFlags) { |
| 182 LayoutObject* object = document().body()->layoutObject(); | 182 LayoutObject* object = document().body()->layoutObject(); |
| 183 object->setShouldDoFullPaintInvalidation(); | 183 object->setShouldDoFullPaintInvalidation(); |
| 184 EXPECT_TRUE(object->shouldDoFullPaintInvalidation()); | 184 EXPECT_TRUE(object->shouldDoFullPaintInvalidation()); |
| 185 EXPECT_TRUE(object->needsPaintOffsetAndVisualRectUpdate()); | 185 object->m_bitfields.setChildShouldCheckForPaintInvalidation(true); |
| 186 EXPECT_TRUE(object->m_bitfields.childShouldCheckForPaintInvalidation()); |
| 186 object->setMayNeedPaintInvalidation(); | 187 object->setMayNeedPaintInvalidation(); |
| 187 EXPECT_TRUE(object->mayNeedPaintInvalidation()); | 188 EXPECT_TRUE(object->mayNeedPaintInvalidation()); |
| 188 object->setMayNeedPaintInvalidationSubtree(); | 189 object->setMayNeedPaintInvalidationSubtree(); |
| 189 EXPECT_TRUE(object->mayNeedPaintInvalidationSubtree()); | 190 EXPECT_TRUE(object->mayNeedPaintInvalidationSubtree()); |
| 190 object->setMayNeedPaintInvalidationAnimatedBackgroundImage(); | 191 object->setMayNeedPaintInvalidationAnimatedBackgroundImage(); |
| 191 EXPECT_TRUE(object->mayNeedPaintInvalidationAnimatedBackgroundImage()); | 192 EXPECT_TRUE(object->mayNeedPaintInvalidationAnimatedBackgroundImage()); |
| 192 object->setShouldInvalidateSelection(); | 193 object->setShouldInvalidateSelection(); |
| 193 EXPECT_TRUE(object->shouldInvalidateSelection()); | 194 EXPECT_TRUE(object->shouldInvalidateSelection()); |
| 194 object->setBackgroundChangedSinceLastPaintInvalidation(); | 195 object->setBackgroundChangedSinceLastPaintInvalidation(); |
| 195 EXPECT_TRUE(object->backgroundChangedSinceLastPaintInvalidation()); | 196 EXPECT_TRUE(object->backgroundChangedSinceLastPaintInvalidation()); |
| 196 object->setNeedsPaintPropertyUpdate(); | 197 object->setNeedsPaintPropertyUpdate(); |
| 197 EXPECT_TRUE(object->needsPaintPropertyUpdate()); | 198 EXPECT_TRUE(object->needsPaintPropertyUpdate()); |
| 198 object->m_bitfields.setDescendantNeedsPaintPropertyUpdate(true); | 199 object->m_bitfields.setDescendantNeedsPaintPropertyUpdate(true); |
| 199 EXPECT_TRUE(object->descendantNeedsPaintPropertyUpdate()); | 200 EXPECT_TRUE(object->descendantNeedsPaintPropertyUpdate()); |
| 200 | 201 |
| 201 ScopedSlimmingPaintV2ForTest enableSPv2(true); | 202 ScopedSlimmingPaintV2ForTest enableSPv2(true); |
| 202 document().lifecycle().advanceTo(DocumentLifecycle::InPrePaint); | 203 document().lifecycle().advanceTo(DocumentLifecycle::InPrePaint); |
| 203 object->getMutableForPainting().clearPaintFlags(); | 204 object->getMutableForPainting().clearPaintFlags(); |
| 204 | 205 |
| 205 EXPECT_FALSE(object->shouldDoFullPaintInvalidation()); | 206 EXPECT_FALSE(object->shouldDoFullPaintInvalidation()); |
| 207 EXPECT_FALSE(object->m_bitfields.childShouldCheckForPaintInvalidation()); |
| 206 EXPECT_FALSE(object->mayNeedPaintInvalidation()); | 208 EXPECT_FALSE(object->mayNeedPaintInvalidation()); |
| 207 EXPECT_FALSE(object->mayNeedPaintInvalidationSubtree()); | 209 EXPECT_FALSE(object->mayNeedPaintInvalidationSubtree()); |
| 208 EXPECT_FALSE(object->mayNeedPaintInvalidationAnimatedBackgroundImage()); | 210 EXPECT_FALSE(object->mayNeedPaintInvalidationAnimatedBackgroundImage()); |
| 209 EXPECT_FALSE(object->shouldInvalidateSelection()); | 211 EXPECT_FALSE(object->shouldInvalidateSelection()); |
| 210 EXPECT_FALSE(object->backgroundChangedSinceLastPaintInvalidation()); | 212 EXPECT_FALSE(object->backgroundChangedSinceLastPaintInvalidation()); |
| 211 EXPECT_FALSE(object->needsPaintPropertyUpdate()); | 213 EXPECT_FALSE(object->needsPaintPropertyUpdate()); |
| 212 EXPECT_FALSE(object->descendantNeedsPaintPropertyUpdate()); | 214 EXPECT_FALSE(object->descendantNeedsPaintPropertyUpdate()); |
| 213 } | 215 } |
| 214 | 216 |
| 215 TEST_F(LayoutObjectTest, NeedsPaintOffsetAndVisualRectUpdate) { | |
| 216 LayoutObject* object = document().body()->layoutObject(); | |
| 217 LayoutObject* parent = object->parent(); | |
| 218 | |
| 219 object->setShouldDoFullPaintInvalidation(); | |
| 220 EXPECT_TRUE(object->shouldDoFullPaintInvalidation()); | |
| 221 EXPECT_TRUE(object->needsPaintOffsetAndVisualRectUpdate()); | |
| 222 EXPECT_TRUE(parent->mayNeedPaintInvalidation()); | |
| 223 EXPECT_TRUE(parent->needsPaintOffsetAndVisualRectUpdate()); | |
| 224 object->clearPaintInvalidationFlags(); | |
| 225 EXPECT_FALSE(object->shouldDoFullPaintInvalidation()); | |
| 226 EXPECT_FALSE(object->needsPaintOffsetAndVisualRectUpdate()); | |
| 227 parent->clearPaintInvalidationFlags(); | |
| 228 EXPECT_FALSE(parent->mayNeedPaintInvalidation()); | |
| 229 EXPECT_FALSE(parent->needsPaintOffsetAndVisualRectUpdate()); | |
| 230 | |
| 231 object->setMayNeedPaintInvalidation(); | |
| 232 EXPECT_TRUE(object->mayNeedPaintInvalidation()); | |
| 233 EXPECT_TRUE(object->needsPaintOffsetAndVisualRectUpdate()); | |
| 234 EXPECT_TRUE(parent->mayNeedPaintInvalidation()); | |
| 235 EXPECT_TRUE(parent->needsPaintOffsetAndVisualRectUpdate()); | |
| 236 object->clearPaintInvalidationFlags(); | |
| 237 EXPECT_FALSE(object->mayNeedPaintInvalidation()); | |
| 238 EXPECT_FALSE(object->needsPaintOffsetAndVisualRectUpdate()); | |
| 239 parent->clearPaintInvalidationFlags(); | |
| 240 EXPECT_FALSE(parent->mayNeedPaintInvalidation()); | |
| 241 EXPECT_FALSE(parent->needsPaintOffsetAndVisualRectUpdate()); | |
| 242 | |
| 243 object->setShouldDoFullPaintInvalidationWithoutGeometryChange(); | |
| 244 EXPECT_TRUE(object->shouldDoFullPaintInvalidation()); | |
| 245 EXPECT_FALSE(object->needsPaintOffsetAndVisualRectUpdate()); | |
| 246 EXPECT_TRUE(parent->mayNeedPaintInvalidation()); | |
| 247 EXPECT_FALSE(parent->needsPaintOffsetAndVisualRectUpdate()); | |
| 248 object->setMayNeedPaintInvalidation(); | |
| 249 EXPECT_TRUE(object->needsPaintOffsetAndVisualRectUpdate()); | |
| 250 EXPECT_TRUE(parent->needsPaintOffsetAndVisualRectUpdate()); | |
| 251 object->clearPaintInvalidationFlags(); | |
| 252 EXPECT_FALSE(object->mayNeedPaintInvalidation()); | |
| 253 EXPECT_FALSE(object->needsPaintOffsetAndVisualRectUpdate()); | |
| 254 parent->clearPaintInvalidationFlags(); | |
| 255 EXPECT_FALSE(parent->mayNeedPaintInvalidation()); | |
| 256 EXPECT_FALSE(parent->needsPaintOffsetAndVisualRectUpdate()); | |
| 257 | |
| 258 object->setMayNeedPaintInvalidationWithoutGeometryChange(); | |
| 259 EXPECT_TRUE(object->mayNeedPaintInvalidation()); | |
| 260 EXPECT_FALSE(object->needsPaintOffsetAndVisualRectUpdate()); | |
| 261 EXPECT_TRUE(parent->mayNeedPaintInvalidation()); | |
| 262 EXPECT_FALSE(parent->needsPaintOffsetAndVisualRectUpdate()); | |
| 263 object->setMayNeedPaintInvalidation(); | |
| 264 EXPECT_TRUE(object->needsPaintOffsetAndVisualRectUpdate()); | |
| 265 EXPECT_TRUE(parent->needsPaintOffsetAndVisualRectUpdate()); | |
| 266 object->clearPaintInvalidationFlags(); | |
| 267 EXPECT_FALSE(object->mayNeedPaintInvalidation()); | |
| 268 EXPECT_FALSE(object->needsPaintOffsetAndVisualRectUpdate()); | |
| 269 parent->clearPaintInvalidationFlags(); | |
| 270 EXPECT_FALSE(parent->mayNeedPaintInvalidation()); | |
| 271 EXPECT_FALSE(parent->needsPaintOffsetAndVisualRectUpdate()); | |
| 272 } | |
| 273 | |
| 274 } // namespace blink | 217 } // namespace blink |
| OLD | NEW |