Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(160)

Side by Side Diff: third_party/WebKit/Source/core/layout/VisualRectMappingTest.cpp

Issue 2793993003: Make GeometryMapper fully static (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
10 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
11 12
12 namespace blink { 13 namespace blink {
13 14
14 class VisualRectMappingTest : public RenderingTest { 15 class VisualRectMappingTest : public RenderingTest {
15 public: 16 public:
16 VisualRectMappingTest() 17 VisualRectMappingTest()
17 : RenderingTest(SingleChildLocalFrameClient::create()) {} 18 : RenderingTest(SingleChildLocalFrameClient::create()) {}
18 19
19 protected: 20 protected:
(...skipping 16 matching lines...) Expand all
36 const LayoutRect& expectedVisualRect, 37 const LayoutRect& expectedVisualRect,
37 bool adjustForBacking = false) { 38 bool adjustForBacking = false) {
38 LayoutRect slowMapRect = localRect; 39 LayoutRect slowMapRect = localRect;
39 object.mapToVisualRectInAncestorSpace(&ancestor, slowMapRect); 40 object.mapToVisualRectInAncestorSpace(&ancestor, slowMapRect);
40 if (slowMapRect.isEmpty() && object.visualRect().isEmpty()) 41 if (slowMapRect.isEmpty() && object.visualRect().isEmpty())
41 return; 42 return;
42 43
43 FloatRect geometryMapperRect(localRect); 44 FloatRect geometryMapperRect(localRect);
44 if (object.paintProperties() || object.localBorderBoxProperties()) { 45 if (object.paintProperties() || object.localBorderBoxProperties()) {
45 geometryMapperRect.moveBy(FloatPoint(object.paintOffset())); 46 geometryMapperRect.moveBy(FloatPoint(object.paintOffset()));
46 document().view()->geometryMapper().sourceToDestinationVisualRect( 47 GeometryMapper::sourceToDestinationVisualRect(
47 *object.localBorderBoxProperties(), *ancestor.contentsProperties(), 48 *object.localBorderBoxProperties(), *ancestor.contentsProperties(),
48 geometryMapperRect); 49 geometryMapperRect);
49 geometryMapperRect.moveBy(-FloatPoint(ancestor.paintOffset())); 50 geometryMapperRect.moveBy(-FloatPoint(ancestor.paintOffset()));
50 } 51 }
51 52
52 // The following condition can be false if paintInvalidationContainer is 53 // The following condition can be false if paintInvalidationContainer is
53 // a LayoutView and compositing is not enabled. 54 // a LayoutView and compositing is not enabled.
54 if (adjustForBacking && ancestor.isPaintInvalidationContainer()) { 55 if (adjustForBacking && ancestor.isPaintInvalidationContainer()) {
55 PaintLayer::mapRectInPaintInvalidationContainerToBacking(ancestor, 56 PaintLayer::mapRectInPaintInvalidationContainerToBacking(ancestor,
56 slowMapRect); 57 slowMapRect);
(...skipping 766 matching lines...) Expand 10 before | Expand all | Expand 10 after
823 // getTransformfromContainter includes transform and perspective matrix 824 // getTransformfromContainter includes transform and perspective matrix
824 // of the container. 825 // of the container.
825 target->getTransformFromContainer(container, LayoutSize(), targetMatrix); 826 target->getTransformFromContainer(container, LayoutSize(), targetMatrix);
826 matrix *= targetMatrix; 827 matrix *= targetMatrix;
827 LayoutRect output(matrix.mapRect(FloatRect(originalRect))); 828 LayoutRect output(matrix.mapRect(FloatRect(originalRect)));
828 829
829 checkVisualRect(*target, *target->view(), originalRect, output); 830 checkVisualRect(*target, *target->view(), originalRect, output);
830 } 831 }
831 832
832 } // namespace blink 833 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698