| 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/SVGResources.h" | 9 #include "core/layout/svg/SVGResources.h" |
| 10 #include "core/layout/svg/SVGResourcesCache.h" | 10 #include "core/layout/svg/SVGResourcesCache.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 namespace { | 21 namespace { |
| 22 | 22 |
| 23 class SVGClipExpansionCycleHelper { | 23 class SVGClipExpansionCycleHelper { |
| 24 public: | 24 public: |
| 25 SVGClipExpansionCycleHelper(LayoutSVGResourceClipper& clip) : m_clip(clip) {
clip.beginClipExpansion(); } | 25 SVGClipExpansionCycleHelper(LayoutSVGResourceClipper& clip) : m_clip(clip) {
clip.beginClipExpansion(); } |
| 26 ~SVGClipExpansionCycleHelper() { m_clip.endClipExpansion(); } | 26 ~SVGClipExpansionCycleHelper() { m_clip.endClipExpansion(); } |
| 27 private: | 27 private: |
| 28 LayoutSVGResourceClipper& m_clip; | 28 LayoutSVGResourceClipper& m_clip; |
| 29 }; | 29 }; |
| 30 | 30 |
| 31 } | 31 } // namespace |
| 32 | 32 |
| 33 bool SVGClipPainter::prepareEffect(const LayoutObject& target, const FloatRect&
targetBoundingBox, | 33 bool SVGClipPainter::prepareEffect(const LayoutObject& target, const FloatRect&
targetBoundingBox, |
| 34 const FloatRect& paintInvalidationRect, GraphicsContext& context, ClipperSta
te& clipperState) | 34 const FloatRect& paintInvalidationRect, GraphicsContext& context, ClipperSta
te& clipperState) |
| 35 { | 35 { |
| 36 ASSERT(clipperState == ClipperNotApplied); | 36 ASSERT(clipperState == ClipperNotApplied); |
| 37 ASSERT_WITH_SECURITY_IMPLICATION(!m_clip.needsLayout()); | 37 ASSERT_WITH_SECURITY_IMPLICATION(!m_clip.needsLayout()); |
| 38 | 38 |
| 39 m_clip.clearInvalidationMask(); | 39 m_clip.clearInvalidationMask(); |
| 40 | 40 |
| 41 if (paintInvalidationRect.isEmpty() || m_clip.hasCycle()) | 41 if (paintInvalidationRect.isEmpty() || m_clip.hasCycle()) |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(context, layoutO
bject, DisplayItem::SVGClip, LayoutPoint())) | 117 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(context, layoutO
bject, DisplayItem::SVGClip, LayoutPoint())) |
| 118 return; | 118 return; |
| 119 | 119 |
| 120 LayoutObjectDrawingRecorder drawingRecorder(context, layoutObject, DisplayIt
em::SVGClip, targetPaintInvalidationRect, LayoutPoint()); | 120 LayoutObjectDrawingRecorder drawingRecorder(context, layoutObject, DisplayIt
em::SVGClip, targetPaintInvalidationRect, LayoutPoint()); |
| 121 context.save(); | 121 context.save(); |
| 122 context.concatCTM(contentTransformation); | 122 context.concatCTM(contentTransformation); |
| 123 context.drawPicture(clipContentPicture.get()); | 123 context.drawPicture(clipContentPicture.get()); |
| 124 context.restore(); | 124 context.restore(); |
| 125 } | 125 } |
| 126 | 126 |
| 127 } | 127 } // namespace blink |
| OLD | NEW |