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/paint/SVGClipPainter.h" | 5 #include "core/paint/SVGClipPainter.h" |
6 | 6 |
7 #include "core/dom/ElementTraversal.h" | 7 #include "core/dom/ElementTraversal.h" |
8 #include "core/layout/svg/LayoutSVGResourceClipper.h" | 8 #include "core/layout/svg/LayoutSVGResourceClipper.h" |
9 #include "core/layout/svg/SVGLayoutSupport.h" | 9 #include "core/layout/svg/SVGLayoutSupport.h" |
10 #include "core/layout/svg/SVGResources.h" | 10 #include "core/layout/svg/SVGResources.h" |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 const FloatRect& targetVisualRect, | 128 const FloatRect& targetVisualRect, |
129 const AffineTransform& localTransform, | 129 const AffineTransform& localTransform, |
130 const FloatPoint& layerPositionOffset) { | 130 const FloatPoint& layerPositionOffset) { |
131 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible( | 131 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible( |
132 context, layoutObject, DisplayItem::kSVGClip)) | 132 context, layoutObject, DisplayItem::kSVGClip)) |
133 return true; | 133 return true; |
134 | 134 |
135 PaintRecordBuilder maskBuilder(targetVisualRect, nullptr, &context); | 135 PaintRecordBuilder maskBuilder(targetVisualRect, nullptr, &context); |
136 GraphicsContext& maskContext = maskBuilder.context(); | 136 GraphicsContext& maskContext = maskBuilder.context(); |
137 { | 137 { |
138 TransformRecorder recorder(maskContext, layoutObject, localTransform); | 138 TransformRecorder recorder( |
| 139 maskContext, localTransform, layoutObject.visualRect(), |
| 140 layoutObject.debugName(), |
| 141 layoutObject.paintedOutputOfObjectHasNoEffectRegardlessOfSize()); |
139 | 142 |
140 // Apply any clip-path clipping this clipPath (nested shape/clipPath.) | 143 // Apply any clip-path clipping this clipPath (nested shape/clipPath.) |
141 Optional<ClipPathClipper> nestedClipPathClipper; | 144 Optional<ClipPathClipper> nestedClipPathClipper; |
142 if (ClipPathOperation* clipPathOperation = m_clip.styleRef().clipPath()) | 145 if (ClipPathOperation* clipPathOperation = m_clip.styleRef().clipPath()) |
143 nestedClipPathClipper.emplace(maskContext, *clipPathOperation, m_clip, | 146 nestedClipPathClipper.emplace(maskContext, *clipPathOperation, m_clip, |
144 targetBoundingBox, layerPositionOffset); | 147 targetBoundingBox, layerPositionOffset); |
145 | 148 |
146 { | 149 { |
147 AffineTransform contentTransform; | 150 AffineTransform contentTransform; |
148 if (m_clip.clipPathUnits() == | 151 if (m_clip.clipPathUnits() == |
149 SVGUnitTypes::kSvgUnitTypeObjectboundingbox) { | 152 SVGUnitTypes::kSvgUnitTypeObjectboundingbox) { |
150 contentTransform.translate(targetBoundingBox.x(), | 153 contentTransform.translate(targetBoundingBox.x(), |
151 targetBoundingBox.y()); | 154 targetBoundingBox.y()); |
152 contentTransform.scaleNonUniform(targetBoundingBox.width(), | 155 contentTransform.scaleNonUniform(targetBoundingBox.width(), |
153 targetBoundingBox.height()); | 156 targetBoundingBox.height()); |
154 } | 157 } |
155 SubtreeContentTransformScope contentTransformScope(contentTransform); | 158 SubtreeContentTransformScope contentTransformScope(contentTransform); |
156 | 159 |
157 TransformRecorder contentTransformRecorder(maskContext, layoutObject, | 160 TransformRecorder contentTransformRecorder( |
158 contentTransform); | 161 maskContext, contentTransform, layoutObject.visualRect(), |
| 162 layoutObject.debugName(), |
| 163 layoutObject.paintedOutputOfObjectHasNoEffectRegardlessOfSize()); |
159 maskContext.getPaintController().createAndAppend<DrawingDisplayItem>( | 164 maskContext.getPaintController().createAndAppend<DrawingDisplayItem>( |
160 layoutObject, DisplayItem::kSVGClip, m_clip.createPaintRecord()); | 165 layoutObject, DisplayItem::kSVGClip, m_clip.createPaintRecord()); |
161 } | 166 } |
162 } | 167 } |
163 | 168 |
164 LayoutObjectDrawingRecorder drawingRecorder( | 169 LayoutObjectDrawingRecorder drawingRecorder( |
165 context, layoutObject, DisplayItem::kSVGClip, targetVisualRect); | 170 context, layoutObject, DisplayItem::kSVGClip, targetVisualRect); |
166 sk_sp<PaintRecord> maskPaintRecord = maskBuilder.endRecording(); | 171 sk_sp<PaintRecord> maskPaintRecord = maskBuilder.endRecording(); |
167 context.drawRecord(maskPaintRecord.get()); | 172 context.drawRecord(maskPaintRecord.get()); |
168 return true; | 173 return true; |
169 } | 174 } |
170 | 175 |
171 } // namespace blink | 176 } // namespace blink |
OLD | NEW |