| 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 "core/paint/PaintPropertyTreePrinter.h" | 9 #include "core/paint/PaintPropertyTreePrinter.h" |
| 10 #include "platform/graphics/paint/GeometryMapper.h" | |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| 12 | 11 |
| 13 namespace blink { | 12 namespace blink { |
| 14 | 13 |
| 15 class VisualRectMappingTest : public RenderingTest { | 14 class VisualRectMappingTest : public RenderingTest { |
| 16 public: | 15 public: |
| 17 VisualRectMappingTest() | 16 VisualRectMappingTest() |
| 18 : RenderingTest(SingleChildLocalFrameClient::create()) {} | 17 : RenderingTest(SingleChildLocalFrameClient::create()) {} |
| 19 | 18 |
| 20 protected: | 19 protected: |
| (...skipping 16 matching lines...) Expand all Loading... |
| 37 const LayoutRect& expectedVisualRect, | 36 const LayoutRect& expectedVisualRect, |
| 38 bool adjustForBacking = false) { | 37 bool adjustForBacking = false) { |
| 39 LayoutRect slowMapRect = localRect; | 38 LayoutRect slowMapRect = localRect; |
| 40 object.mapToVisualRectInAncestorSpace(&ancestor, slowMapRect); | 39 object.mapToVisualRectInAncestorSpace(&ancestor, slowMapRect); |
| 41 if (slowMapRect.isEmpty() && object.visualRect().isEmpty()) | 40 if (slowMapRect.isEmpty() && object.visualRect().isEmpty()) |
| 42 return; | 41 return; |
| 43 | 42 |
| 44 FloatRect geometryMapperRect(localRect); | 43 FloatRect geometryMapperRect(localRect); |
| 45 if (object.paintProperties() || object.localBorderBoxProperties()) { | 44 if (object.paintProperties() || object.localBorderBoxProperties()) { |
| 46 geometryMapperRect.moveBy(FloatPoint(object.paintOffset())); | 45 geometryMapperRect.moveBy(FloatPoint(object.paintOffset())); |
| 47 GeometryMapper::sourceToDestinationVisualRect( | 46 document().view()->geometryMapper().sourceToDestinationVisualRect( |
| 48 *object.localBorderBoxProperties(), *ancestor.contentsProperties(), | 47 *object.localBorderBoxProperties(), *ancestor.contentsProperties(), |
| 49 geometryMapperRect); | 48 geometryMapperRect); |
| 50 geometryMapperRect.moveBy(-FloatPoint(ancestor.paintOffset())); | 49 geometryMapperRect.moveBy(-FloatPoint(ancestor.paintOffset())); |
| 51 } | 50 } |
| 52 | 51 |
| 53 // The following condition can be false if paintInvalidationContainer is | 52 // The following condition can be false if paintInvalidationContainer is |
| 54 // a LayoutView and compositing is not enabled. | 53 // a LayoutView and compositing is not enabled. |
| 55 if (adjustForBacking && ancestor.isPaintInvalidationContainer()) { | 54 if (adjustForBacking && ancestor.isPaintInvalidationContainer()) { |
| 56 PaintLayer::mapRectInPaintInvalidationContainerToBacking(ancestor, | 55 PaintLayer::mapRectInPaintInvalidationContainerToBacking(ancestor, |
| 57 slowMapRect); | 56 slowMapRect); |
| (...skipping 766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 824 // getTransformfromContainter includes transform and perspective matrix | 823 // getTransformfromContainter includes transform and perspective matrix |
| 825 // of the container. | 824 // of the container. |
| 826 target->getTransformFromContainer(container, LayoutSize(), targetMatrix); | 825 target->getTransformFromContainer(container, LayoutSize(), targetMatrix); |
| 827 matrix *= targetMatrix; | 826 matrix *= targetMatrix; |
| 828 LayoutRect output(matrix.mapRect(FloatRect(originalRect))); | 827 LayoutRect output(matrix.mapRect(FloatRect(originalRect))); |
| 829 | 828 |
| 830 checkVisualRect(*target, *target->view(), originalRect, output); | 829 checkVisualRect(*target, *target->view(), originalRect, output); |
| 831 } | 830 } |
| 832 | 831 |
| 833 } // namespace blink | 832 } // namespace blink |
| OLD | NEW |