| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/ClipPathClipper.h" | 5 #include "core/paint/ClipPathClipper.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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 | 61 |
| 62 ClipPathClipper::ClipPathClipper(GraphicsContext& context, | 62 ClipPathClipper::ClipPathClipper(GraphicsContext& context, |
| 63 ClipPathOperation& clipPathOperation, | 63 ClipPathOperation& clipPathOperation, |
| 64 const LayoutObject& layoutObject, | 64 const LayoutObject& layoutObject, |
| 65 const FloatRect& referenceBox, | 65 const FloatRect& referenceBox, |
| 66 const FloatPoint& origin) | 66 const FloatPoint& origin) |
| 67 : m_resourceClipper(nullptr), | 67 : m_resourceClipper(nullptr), |
| 68 m_clipperState(ClipperState::NotApplied), | 68 m_clipperState(ClipperState::NotApplied), |
| 69 m_layoutObject(layoutObject), | 69 m_layoutObject(layoutObject), |
| 70 m_context(context) { | 70 m_context(context) { |
| 71 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) |
| 72 return; |
| 71 if (clipPathOperation.type() == ClipPathOperation::SHAPE) { | 73 if (clipPathOperation.type() == ClipPathOperation::SHAPE) { |
| 72 ShapeClipPathOperation& shape = toShapeClipPathOperation(clipPathOperation); | 74 ShapeClipPathOperation& shape = toShapeClipPathOperation(clipPathOperation); |
| 73 if (!shape.isValid()) | 75 if (!shape.isValid()) |
| 74 return; | 76 return; |
| 75 m_clipPathRecorder.emplace(context, layoutObject, shape.path(referenceBox)); | 77 m_clipPathRecorder.emplace(context, layoutObject, shape.path(referenceBox)); |
| 76 m_clipperState = ClipperState::AppliedPath; | 78 m_clipperState = ClipperState::AppliedPath; |
| 77 } else { | 79 } else { |
| 78 DCHECK_EQ(clipPathOperation.type(), ClipPathOperation::REFERENCE); | 80 DCHECK_EQ(clipPathOperation.type(), ClipPathOperation::REFERENCE); |
| 79 m_resourceClipper = resolveElementReference( | 81 m_resourceClipper = resolveElementReference( |
| 80 layoutObject, toReferenceClipPathOperation(clipPathOperation)); | 82 layoutObject, toReferenceClipPathOperation(clipPathOperation)); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 95 } | 97 } |
| 96 if (!prepareEffect(referenceBox, clipPathBounds, originTranslation)) { | 98 if (!prepareEffect(referenceBox, clipPathBounds, originTranslation)) { |
| 97 // Indicate there is no cleanup to do. | 99 // Indicate there is no cleanup to do. |
| 98 m_resourceClipper = nullptr; | 100 m_resourceClipper = nullptr; |
| 99 return; | 101 return; |
| 100 } | 102 } |
| 101 } | 103 } |
| 102 } | 104 } |
| 103 | 105 |
| 104 ClipPathClipper::~ClipPathClipper() { | 106 ClipPathClipper::~ClipPathClipper() { |
| 107 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) |
| 108 return; |
| 105 if (m_resourceClipper) | 109 if (m_resourceClipper) |
| 106 finishEffect(); | 110 finishEffect(); |
| 107 } | 111 } |
| 108 | 112 |
| 109 bool ClipPathClipper::prepareEffect(const FloatRect& targetBoundingBox, | 113 bool ClipPathClipper::prepareEffect(const FloatRect& targetBoundingBox, |
| 110 const FloatRect& visualRect, | 114 const FloatRect& visualRect, |
| 111 const FloatPoint& layerPositionOffset) { | 115 const FloatPoint& layerPositionOffset) { |
| 112 DCHECK_EQ(m_clipperState, ClipperState::NotApplied); | 116 DCHECK_EQ(m_clipperState, ClipperState::NotApplied); |
| 113 SECURITY_DCHECK(!m_resourceClipper->needsLayout()); | 117 SECURITY_DCHECK(!m_resourceClipper->needsLayout()); |
| 114 | 118 |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 // Transfer clip mask -> bg (SrcOver) | 234 // Transfer clip mask -> bg (SrcOver) |
| 231 m_maskClipRecorder.reset(); | 235 m_maskClipRecorder.reset(); |
| 232 break; | 236 break; |
| 233 case ClipperState::NotApplied: | 237 case ClipperState::NotApplied: |
| 234 NOTREACHED(); | 238 NOTREACHED(); |
| 235 break; | 239 break; |
| 236 } | 240 } |
| 237 } | 241 } |
| 238 | 242 |
| 239 } // namespace blink | 243 } // namespace blink |
| OLD | NEW |