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

Side by Side Diff: third_party/WebKit/Source/platform/geometry/TransformState.h

Issue 2727093002: Account for perspective and preserve-3d in mapToVisualRectInAncestorSpace (Closed)
Patch Set: none Created 3 years, 9 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
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintInvalidator.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2011 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * 12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY 13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */ 24 */
25 25
26 #ifndef TransformState_h 26 #ifndef TransformState_h
27 #define TransformState_h 27 #define TransformState_h
28 28
29 #include <memory>
29 #include "platform/geometry/FloatPoint.h" 30 #include "platform/geometry/FloatPoint.h"
30 #include "platform/geometry/FloatQuad.h" 31 #include "platform/geometry/FloatQuad.h"
31 #include "platform/geometry/IntSize.h" 32 #include "platform/geometry/IntSize.h"
33 #include "platform/geometry/LayoutPoint.h"
32 #include "platform/geometry/LayoutSize.h" 34 #include "platform/geometry/LayoutSize.h"
33 #include "platform/transforms/AffineTransform.h" 35 #include "platform/transforms/AffineTransform.h"
34 #include "platform/transforms/TransformationMatrix.h" 36 #include "platform/transforms/TransformationMatrix.h"
35 #include "wtf/Allocator.h" 37 #include "wtf/Allocator.h"
36 #include <memory>
37 38
38 namespace blink { 39 namespace blink {
39 40
40 class PLATFORM_EXPORT TransformState { 41 class PLATFORM_EXPORT TransformState {
41 STACK_ALLOCATED(); 42 STACK_ALLOCATED();
42 43
43 public: 44 public:
44 enum TransformDirection { 45 enum TransformDirection {
45 ApplyTransformDirection, 46 ApplyTransformDirection,
46 UnapplyInverseTransformDirection 47 UnapplyInverseTransformDirection
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 m_accumulatingTransform(true), 81 m_accumulatingTransform(true),
81 m_forceAccumulatingTransform(true), 82 m_forceAccumulatingTransform(true),
82 m_mapPoint(false), 83 m_mapPoint(false),
83 m_mapQuad(false), 84 m_mapQuad(false),
84 m_direction(mappingDirection) {} 85 m_direction(mappingDirection) {}
85 86
86 TransformState(const TransformState& other) { *this = other; } 87 TransformState(const TransformState& other) { *this = other; }
87 88
88 TransformState& operator=(const TransformState&); 89 TransformState& operator=(const TransformState&);
89 90
91 // Note: this overrides the quad and ignores any accumulatedOffset.
92 // If it's desired to include the offset, call flatten() first.
90 void setQuad(const FloatQuad& quad) { 93 void setQuad(const FloatQuad& quad) {
94 DCHECK(!m_accumulatingTransform);
91 // FIXME: this assumes that the quad being added is in the coordinate system 95 // FIXME: this assumes that the quad being added is in the coordinate system
92 // of the current state. This breaks if we're simultaneously mapping a 96 // of the current state. This breaks if we're simultaneously mapping a
93 // point. https://bugs.webkit.org/show_bug.cgi?id=106680 97 // point. https://bugs.webkit.org/show_bug.cgi?id=106680
94 ASSERT(!m_mapPoint); 98 ASSERT(!m_mapPoint);
95 m_accumulatedOffset = LayoutSize(); 99 m_accumulatedOffset = LayoutSize();
96 m_lastPlanarQuad = quad; 100 m_lastPlanarQuad = quad;
97 } 101 }
98 102
99 void move(LayoutUnit x, 103 void move(LayoutUnit x,
100 LayoutUnit y, 104 LayoutUnit y,
101 TransformAccumulation accumulate = FlattenTransform) { 105 TransformAccumulation accumulate = FlattenTransform) {
102 move(LayoutSize(x, y), accumulate); 106 move(LayoutSize(x, y), accumulate);
103 } 107 }
104 108
105 void move(const LayoutSize&, TransformAccumulation = FlattenTransform); 109 void move(const LayoutSize&, TransformAccumulation = FlattenTransform);
106 void move(const IntSize& size, 110 void move(const IntSize& size,
107 TransformAccumulation accumulate = FlattenTransform) { 111 TransformAccumulation accumulate = FlattenTransform) {
108 move(LayoutSize(size), accumulate); 112 move(LayoutSize(size), accumulate);
109 } 113 }
114 void moveBy(const LayoutPoint& point,
115 TransformAccumulation accumulate = FlattenTransform) {
116 move(LayoutSize(point.x(), point.y()), accumulate);
117 }
110 void applyTransform(const AffineTransform& transformFromContainer, 118 void applyTransform(const AffineTransform& transformFromContainer,
111 TransformAccumulation = FlattenTransform, 119 TransformAccumulation = FlattenTransform,
112 bool* wasClamped = 0); 120 bool* wasClamped = 0);
113 void applyTransform(const TransformationMatrix& transformFromContainer, 121 void applyTransform(const TransformationMatrix& transformFromContainer,
114 TransformAccumulation = FlattenTransform, 122 TransformAccumulation = FlattenTransform,
115 bool* wasClamped = 0); 123 bool* wasClamped = 0);
116 void flatten(bool* wasClamped = 0); 124 void flatten(bool* wasClamped = 0);
117 125
118 // Return the coords of the point or quad in the last flattened layer 126 // Return the coords of the point or quad in the last flattened layer
119 FloatPoint lastPlanarPoint() const { return m_lastPlanarPoint; } 127 FloatPoint lastPlanarPoint() const { return m_lastPlanarPoint; }
(...skipping 20 matching lines...) Expand all
140 LayoutSize m_accumulatedOffset; 148 LayoutSize m_accumulatedOffset;
141 bool m_accumulatingTransform; 149 bool m_accumulatingTransform;
142 bool m_forceAccumulatingTransform; 150 bool m_forceAccumulatingTransform;
143 bool m_mapPoint, m_mapQuad; 151 bool m_mapPoint, m_mapQuad;
144 TransformDirection m_direction; 152 TransformDirection m_direction;
145 }; 153 };
146 154
147 } // namespace blink 155 } // namespace blink
148 156
149 #endif // TransformState_h 157 #endif // TransformState_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintInvalidator.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698