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

Side by Side Diff: Source/core/svg/SVGClipPathElement.cpp

Issue 423823004: Add support for SVG Clip paths in HTML (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Changed LayoutTests and Aligned with review comments Created 6 years, 4 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Rob Buis <buis@kde.org>
4 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. 4 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 19 matching lines...) Expand all
30 inline SVGClipPathElement::SVGClipPathElement(Document& document) 30 inline SVGClipPathElement::SVGClipPathElement(Document& document)
31 : SVGGraphicsElement(SVGNames::clipPathTag, document) 31 : SVGGraphicsElement(SVGNames::clipPathTag, document)
32 , m_clipPathUnits(SVGAnimatedEnumeration<SVGUnitTypes::SVGUnitType>::create( this, SVGNames::clipPathUnitsAttr, SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE)) 32 , m_clipPathUnits(SVGAnimatedEnumeration<SVGUnitTypes::SVGUnitType>::create( this, SVGNames::clipPathUnitsAttr, SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE))
33 { 33 {
34 ScriptWrappable::init(this); 34 ScriptWrappable::init(this);
35 addToPropertyMap(m_clipPathUnits); 35 addToPropertyMap(m_clipPathUnits);
36 } 36 }
37 37
38 DEFINE_NODE_FACTORY(SVGClipPathElement) 38 DEFINE_NODE_FACTORY(SVGClipPathElement)
39 39
40 void SVGClipPathElement::trace(Visitor* visitor)
41 {
42 #if ENABLE(OILPAN)
43 visitor->trace(m_clientsToAdd);
44 #endif
45 SVGGraphicsElement::trace(visitor);
46 }
47
40 bool SVGClipPathElement::isSupportedAttribute(const QualifiedName& attrName) 48 bool SVGClipPathElement::isSupportedAttribute(const QualifiedName& attrName)
41 { 49 {
42 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); 50 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ());
43 if (supportedAttributes.isEmpty()) 51 if (supportedAttributes.isEmpty())
44 supportedAttributes.add(SVGNames::clipPathUnitsAttr); 52 supportedAttributes.add(SVGNames::clipPathUnitsAttr);
45 53
46 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); 54 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName);
47 } 55 }
48 56
49 void SVGClipPathElement::parseAttribute(const QualifiedName& name, const AtomicS tring& value) 57 void SVGClipPathElement::parseAttribute(const QualifiedName& name, const AtomicS tring& value)
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 91
84 if (change.byParser) 92 if (change.byParser)
85 return; 93 return;
86 94
87 if (RenderObject* object = renderer()) 95 if (RenderObject* object = renderer())
88 object->setNeedsLayoutAndFullPaintInvalidation(); 96 object->setNeedsLayoutAndFullPaintInvalidation();
89 } 97 }
90 98
91 RenderObject* SVGClipPathElement::createRenderer(RenderStyle*) 99 RenderObject* SVGClipPathElement::createRenderer(RenderStyle*)
92 { 100 {
93 return new RenderSVGResourceClipper(this); 101 RenderSVGResourceClipper* renderer = new RenderSVGResourceClipper(this);
102
103 WillBeHeapHashSet<RefPtrWillBeMember<Node> >::iterator layerEnd = m_clientsT oAdd.end();
104 for (WillBeHeapHashSet<RefPtrWillBeMember<Node> >::iterator it = m_clientsTo Add.begin(); it != layerEnd; ++it)
105 renderer->addClientRenderLayer(it->get());
106 m_clientsToAdd.clear();
107
108 return renderer;
109 }
110
111 void SVGClipPathElement::addClient(Node* client)
112 {
113 ASSERT(client);
114 m_clientsToAdd.add(client);
115 }
116
117 void SVGClipPathElement::removeClient(Node* client)
118 {
119 ASSERT(client);
120 m_clientsToAdd.remove(client);
94 } 121 }
95 122
96 } 123 }
OLDNEW
« Source/core/rendering/RenderLayerClipPathInfo.cpp ('K') | « Source/core/svg/SVGClipPathElement.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698