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

Side by Side Diff: third_party/WebKit/Source/core/paint/ClipPathClipper.cpp

Issue 2484153003: Use an SVGElementProxy in ReferenceClipPathOperation (Closed)
Patch Set: Rebase Created 4 years, 1 month 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 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/layout/svg/LayoutSVGResourceClipper.h" 7 #include "core/layout/svg/LayoutSVGResourceClipper.h"
8 #include "core/layout/svg/SVGResources.h" 8 #include "core/layout/svg/SVGResources.h"
9 #include "core/layout/svg/SVGResourcesCache.h" 9 #include "core/layout/svg/SVGResourcesCache.h"
10 #include "core/paint/SVGClipPainter.h" 10 #include "core/paint/SVGClipPainter.h"
(...skipping 10 matching lines...) Expand all
21 if (layoutObject.isSVG() && !layoutObject.isSVGRoot()) { 21 if (layoutObject.isSVG() && !layoutObject.isSVGRoot()) {
22 // The reference will have been resolved in 22 // The reference will have been resolved in
23 // SVGResources::buildResources, so we can just use the LayoutObject's 23 // SVGResources::buildResources, so we can just use the LayoutObject's
24 // SVGResources. 24 // SVGResources.
25 SVGResources* resources = 25 SVGResources* resources =
26 SVGResourcesCache::cachedResourcesForLayoutObject(&layoutObject); 26 SVGResourcesCache::cachedResourcesForLayoutObject(&layoutObject);
27 return resources ? resources->clipper() : nullptr; 27 return resources ? resources->clipper() : nullptr;
28 } 28 }
29 // TODO(fs): It doesn't work with forward or external SVG references 29 // TODO(fs): It doesn't work with forward or external SVG references
30 // (https://bugs.webkit.org/show_bug.cgi?id=90405) 30 // (https://bugs.webkit.org/show_bug.cgi?id=90405)
31 Element* element = layoutObject.document().getElementById( 31 Node* targetNode = layoutObject.node();
32 referenceClipPathOperation.fragment()); 32 if (!targetNode)
33 return nullptr;
34 SVGElement* element = referenceClipPathOperation.elementProxy().findElement(
35 targetNode->treeScope());
33 if (!isSVGClipPathElement(element) || !element->layoutObject()) 36 if (!isSVGClipPathElement(element) || !element->layoutObject())
34 return nullptr; 37 return nullptr;
35 return toLayoutSVGResourceClipper( 38 return toLayoutSVGResourceClipper(
36 toLayoutSVGResourceContainer(element->layoutObject())); 39 toLayoutSVGResourceContainer(element->layoutObject()));
37 } 40 }
38 41
39 } // namespace 42 } // namespace
40 43
41 ClipPathClipper::ClipPathClipper(GraphicsContext& context, 44 ClipPathClipper::ClipPathClipper(GraphicsContext& context,
42 ClipPathOperation& clipPathOperation, 45 ClipPathOperation& clipPathOperation,
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 } 81 }
79 } 82 }
80 83
81 ClipPathClipper::~ClipPathClipper() { 84 ClipPathClipper::~ClipPathClipper() {
82 if (m_resourceClipper) 85 if (m_resourceClipper)
83 SVGClipPainter(*m_resourceClipper) 86 SVGClipPainter(*m_resourceClipper)
84 .finishEffect(m_layoutObject, m_context, m_clipperState); 87 .finishEffect(m_layoutObject, m_context, m_clipperState);
85 } 88 }
86 89
87 } // namespace blink 90 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698