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

Side by Side Diff: Source/core/rendering/svg/RenderSVGResourceGradient.cpp

Issue 622653003: Gradients should restrict possible content (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Patch for landing Created 6 years, 2 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
« no previous file with comments | « Source/core/rendering/svg/RenderSVGResourceGradient.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> 3 * Copyright (C) 2008 Eric Seidel <eric@webkit.org>
4 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org> 4 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org>
5 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 5 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 updateGraphicsContext(context, style, *object, resourceMode); 119 updateGraphicsContext(context, style, *object, resourceMode);
120 return true; 120 return true;
121 } 121 }
122 122
123 void RenderSVGResourceGradient::postApplyResource(GraphicsContext* context) 123 void RenderSVGResourceGradient::postApplyResource(GraphicsContext* context)
124 { 124 {
125 ASSERT(context); 125 ASSERT(context);
126 context->restore(); 126 context->restore();
127 } 127 }
128 128
129 bool RenderSVGResourceGradient::isChildAllowed(RenderObject* child, RenderStyle* ) const
130 {
131 if (child->isSVGGradientStop())
132 return true;
133
134 if (!child->isSVGResourceContainer())
135 return false;
136
137 RenderSVGResourceContainer* resource = toRenderSVGResourceContainer(child);
138 return resource->resourceType() == PatternResourceType
139 || resource->resourceType() == LinearGradientResourceType
140 || resource->resourceType() == RadialGradientResourceType;
141 }
142
129 void RenderSVGResourceGradient::addStops(GradientData* gradientData, const Vecto r<Gradient::ColorStop>& stops) const 143 void RenderSVGResourceGradient::addStops(GradientData* gradientData, const Vecto r<Gradient::ColorStop>& stops) const
130 { 144 {
131 ASSERT(gradientData->gradient); 145 ASSERT(gradientData->gradient);
132 146
133 const Vector<Gradient::ColorStop>::const_iterator end = stops.end(); 147 const Vector<Gradient::ColorStop>::const_iterator end = stops.end();
134 for (Vector<Gradient::ColorStop>::const_iterator it = stops.begin(); it != e nd; ++it) 148 for (Vector<Gradient::ColorStop>::const_iterator it = stops.begin(); it != e nd; ++it)
135 gradientData->gradient->addColorStop(*it); 149 gradientData->gradient->addColorStop(*it);
136 } 150 }
137 151
138 GradientSpreadMethod RenderSVGResourceGradient::platformSpreadMethodFromSVGType( SVGSpreadMethodType method) const 152 GradientSpreadMethod RenderSVGResourceGradient::platformSpreadMethodFromSVGType( SVGSpreadMethodType method) const
139 { 153 {
140 switch (method) { 154 switch (method) {
141 case SVGSpreadMethodUnknown: 155 case SVGSpreadMethodUnknown:
142 case SVGSpreadMethodPad: 156 case SVGSpreadMethodPad:
143 return SpreadMethodPad; 157 return SpreadMethodPad;
144 case SVGSpreadMethodReflect: 158 case SVGSpreadMethodReflect:
145 return SpreadMethodReflect; 159 return SpreadMethodReflect;
146 case SVGSpreadMethodRepeat: 160 case SVGSpreadMethodRepeat:
147 return SpreadMethodRepeat; 161 return SpreadMethodRepeat;
148 } 162 }
149 163
150 ASSERT_NOT_REACHED(); 164 ASSERT_NOT_REACHED();
151 return SpreadMethodPad; 165 return SpreadMethodPad;
152 } 166 }
153 167
154 } 168 }
OLDNEW
« no previous file with comments | « Source/core/rendering/svg/RenderSVGResourceGradient.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698