| 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/LayoutTestHelper.h" | 5 #include "core/layout/LayoutTestHelper.h" |
| 6 #include "core/layout/LayoutView.h" | 6 #include "core/layout/LayoutView.h" |
| 7 #include "core/layout/PaintInvalidationState.h" | 7 #include "core/layout/PaintInvalidationState.h" |
| 8 #include "core/paint/PaintLayer.h" | 8 #include "core/paint/PaintLayer.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 10 |
| 11 namespace blink { | 11 namespace blink { |
| 12 | 12 |
| 13 class VisualRectMappingTest : public RenderingTest { | 13 class VisualRectMappingTest : public RenderingTest { |
| 14 public: | 14 public: |
| 15 VisualRectMappingTest() | 15 VisualRectMappingTest() |
| 16 : RenderingTest(SingleChildFrameLoaderClient::create()) {} | 16 : RenderingTest(SingleChildFrameLoaderClient::create()) {} |
| 17 | 17 |
| 18 protected: | 18 protected: |
| 19 LayoutView& layoutView() const { return *document().layoutView(); } | 19 LayoutView& layoutView() const { return *document().layoutView(); } |
| 20 | 20 |
| 21 void checkPaintInvalidationStateRectMapping( | 21 void checkPaintInvalidationStateRectMapping( |
| 22 const LayoutRect& expectedRect, | 22 const LayoutRect& expectedRect, |
| 23 const LayoutRect& rect, | 23 const LayoutRect& rect, |
| 24 const LayoutObject& object, | 24 const LayoutObject& object, |
| 25 const LayoutView& layoutView, | 25 const LayoutView& layoutView, |
| 26 const LayoutObject& paintInvalidationContainer) { | 26 const LayoutObject& paintInvalidationContainer) { |
| 27 Vector<const LayoutObject*> ancestors; | 27 Vector<const LayoutObject*> ancestors; |
| 28 for (const LayoutObject* ancestor = &object; ancestor != layoutView; | 28 for (const LayoutObject* ancestor = &object; ancestor != layoutView; |
| 29 ancestor = ancestor->paintInvalidationParent()) | 29 ancestor = ancestor->slowPaintInvalidationParentForTesting()) |
| 30 ancestors.append(ancestor); | 30 ancestors.append(ancestor); |
| 31 | 31 |
| 32 Vector<Optional<PaintInvalidationState>> paintInvalidationStates( | 32 Vector<Optional<PaintInvalidationState>> paintInvalidationStates( |
| 33 ancestors.size() + 1); | 33 ancestors.size() + 1); |
| 34 Vector<const LayoutObject*> pendingDelayedPaintInvalidations; | 34 Vector<const LayoutObject*> pendingDelayedPaintInvalidations; |
| 35 paintInvalidationStates[0].emplace(layoutView, | 35 paintInvalidationStates[0].emplace(layoutView, |
| 36 pendingDelayedPaintInvalidations); | 36 pendingDelayedPaintInvalidations); |
| 37 if (layoutView != object) | 37 if (layoutView != object) |
| 38 paintInvalidationStates[0]->updateForChildren(PaintInvalidationFull); | 38 paintInvalidationStates[0]->updateForChildren(PaintInvalidationFull); |
| 39 for (size_t i = 1; i < paintInvalidationStates.size(); ++i) { | 39 for (size_t i = 1; i < paintInvalidationStates.size(); ++i) { |
| (...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 691 LayoutRect targetVisualRect = target->localVisualRect(); | 691 LayoutRect targetVisualRect = target->localVisualRect(); |
| 692 EXPECT_EQ(LayoutRect(0, 0, 400, 400), targetVisualRect); | 692 EXPECT_EQ(LayoutRect(0, 0, 400, 400), targetVisualRect); |
| 693 LayoutRect rect = targetVisualRect; | 693 LayoutRect rect = targetVisualRect; |
| 694 EXPECT_TRUE(target->mapToVisualRectInAncestorSpace(&layoutView(), rect)); | 694 EXPECT_TRUE(target->mapToVisualRectInAncestorSpace(&layoutView(), rect)); |
| 695 EXPECT_EQ(LayoutRect(0, 0, 200, 200), rect); | 695 EXPECT_EQ(LayoutRect(0, 0, 200, 200), rect); |
| 696 checkPaintInvalidationStateRectMapping(rect, targetVisualRect, *target, | 696 checkPaintInvalidationStateRectMapping(rect, targetVisualRect, *target, |
| 697 layoutView(), layoutView()); | 697 layoutView(), layoutView()); |
| 698 } | 698 } |
| 699 | 699 |
| 700 } // namespace blink | 700 } // namespace blink |
| OLD | NEW |