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

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

Issue 20061003: Move isValid/isCurrentColor from Color to StyleColor (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 5 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2008 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2008 Rob Buis <buis@kde.org>
4 * Copyright (C) 2005, 2007 Eric Seidel <eric@webkit.org> 4 * Copyright (C) 2005, 2007 Eric Seidel <eric@webkit.org>
5 * Copyright (C) 2009 Google, Inc. 5 * Copyright (C) 2009 Google, Inc.
6 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> 6 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
7 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 7 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
8 * Copyright (C) 2009 Jeff Schiller <codedread@gmail.com> 8 * Copyright (C) 2009 Jeff Schiller <codedread@gmail.com>
9 * Copyright (C) 2011 Renata Hodovan <reni@webkit.org> 9 * Copyright (C) 2011 Renata Hodovan <reni@webkit.org>
10 * Copyright (C) 2011 University of Szeged 10 * Copyright (C) 2011 University of Szeged
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 bool RenderSVGShape::shapeDependentFillContains(const FloatPoint& point, const W indRule fillRule) const 111 bool RenderSVGShape::shapeDependentFillContains(const FloatPoint& point, const W indRule fillRule) const
112 { 112 {
113 return path().contains(point, fillRule); 113 return path().contains(point, fillRule);
114 } 114 }
115 115
116 bool RenderSVGShape::fillContains(const FloatPoint& point, bool requiresFill, co nst WindRule fillRule) 116 bool RenderSVGShape::fillContains(const FloatPoint& point, bool requiresFill, co nst WindRule fillRule)
117 { 117 {
118 if (!m_fillBoundingBox.contains(point)) 118 if (!m_fillBoundingBox.contains(point))
119 return false; 119 return false;
120 120
121 Color fallbackColor; 121 StyleColor fallbackColor;
122 if (requiresFill && !RenderSVGResource::fillPaintingResource(this, style(), fallbackColor)) 122 if (requiresFill && !RenderSVGResource::fillPaintingResource(this, style(), fallbackColor))
123 return false; 123 return false;
124 124
125 return shapeDependentFillContains(point, fillRule); 125 return shapeDependentFillContains(point, fillRule);
126 } 126 }
127 127
128 bool RenderSVGShape::strokeContains(const FloatPoint& point, bool requiresStroke ) 128 bool RenderSVGShape::strokeContains(const FloatPoint& point, bool requiresStroke )
129 { 129 {
130 if (!strokeBoundingBox().contains(point)) 130 if (!strokeBoundingBox().contains(point))
131 return false; 131 return false;
132 132
133 Color fallbackColor; 133 StyleColor fallbackColor;
134 if (requiresStroke && !RenderSVGResource::strokePaintingResource(this, style (), fallbackColor)) 134 if (requiresStroke && !RenderSVGResource::strokePaintingResource(this, style (), fallbackColor))
135 return false; 135 return false;
136 136
137 return shapeDependentStrokeContains(point); 137 return shapeDependentStrokeContains(point);
138 } 138 }
139 139
140 void RenderSVGShape::layout() 140 void RenderSVGShape::layout()
141 { 141 {
142 StackStats::LayoutCheckPoint layoutCheckPoint; 142 StackStats::LayoutCheckPoint layoutCheckPoint;
143 LayoutRepainter repainter(*this, SVGRenderSupport::checkForSVGRepaintDuringL ayout(this) && selfNeedsLayout()); 143 LayoutRepainter repainter(*this, SVGRenderSupport::checkForSVGRepaintDuringL ayout(this) && selfNeedsLayout());
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 208
209 SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject( this); 209 SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject( this);
210 if (!resources) 210 if (!resources)
211 return false; 211 return false;
212 212
213 return resources->markerStart() || resources->markerMid() || resources->mark erEnd(); 213 return resources->markerStart() || resources->markerMid() || resources->mark erEnd();
214 } 214 }
215 215
216 void RenderSVGShape::fillShape(RenderStyle* style, GraphicsContext* context) 216 void RenderSVGShape::fillShape(RenderStyle* style, GraphicsContext* context)
217 { 217 {
218 Color fallbackColor; 218 StyleColor fallbackColor;
219 if (RenderSVGResource* fillPaintingResource = RenderSVGResource::fillPaintin gResource(this, style, fallbackColor)) { 219 if (RenderSVGResource* fillPaintingResource = RenderSVGResource::fillPaintin gResource(this, style, fallbackColor)) {
220 if (fillPaintingResource->applyResource(this, style, context, ApplyToFil lMode)) 220 if (fillPaintingResource->applyResource(this, style, context, ApplyToFil lMode))
221 fillPaintingResource->postApplyResource(this, context, ApplyToFillMo de, 0, this); 221 fillPaintingResource->postApplyResource(this, context, ApplyToFillMo de, 0, this);
222 else if (fallbackColor.isValid()) { 222 else if (fallbackColor.isValid()) {
223 RenderSVGResourceSolidColor* fallbackResource = RenderSVGResource::s haredSolidPaintingResource(); 223 RenderSVGResourceSolidColor* fallbackResource = RenderSVGResource::s haredSolidPaintingResource();
224 fallbackResource->setColor(fallbackColor); 224 fallbackResource->setColor(fallbackColor.color());
225 if (fallbackResource->applyResource(this, style, context, ApplyToFil lMode)) 225 if (fallbackResource->applyResource(this, style, context, ApplyToFil lMode))
226 fallbackResource->postApplyResource(this, context, ApplyToFillMo de, 0, this); 226 fallbackResource->postApplyResource(this, context, ApplyToFillMo de, 0, this);
227 } 227 }
228 } 228 }
229 } 229 }
230 230
231 void RenderSVGShape::strokeShape(RenderStyle* style, GraphicsContext* context) 231 void RenderSVGShape::strokeShape(RenderStyle* style, GraphicsContext* context)
232 { 232 {
233 Color fallbackColor; 233 StyleColor fallbackColor;
234 if (RenderSVGResource* strokePaintingResource = RenderSVGResource::strokePai ntingResource(this, style, fallbackColor)) { 234 if (RenderSVGResource* strokePaintingResource = RenderSVGResource::strokePai ntingResource(this, style, fallbackColor)) {
235 if (strokePaintingResource->applyResource(this, style, context, ApplyToS trokeMode)) 235 if (strokePaintingResource->applyResource(this, style, context, ApplyToS trokeMode))
236 strokePaintingResource->postApplyResource(this, context, ApplyToStro keMode, 0, this); 236 strokePaintingResource->postApplyResource(this, context, ApplyToStro keMode, 0, this);
237 else if (fallbackColor.isValid()) { 237 else if (fallbackColor.isValid()) {
238 RenderSVGResourceSolidColor* fallbackResource = RenderSVGResource::s haredSolidPaintingResource(); 238 RenderSVGResourceSolidColor* fallbackResource = RenderSVGResource::s haredSolidPaintingResource();
239 fallbackResource->setColor(fallbackColor); 239 fallbackResource->setColor(fallbackColor.color());
240 if (fallbackResource->applyResource(this, style, context, ApplyToStr okeMode)) 240 if (fallbackResource->applyResource(this, style, context, ApplyToStr okeMode))
241 fallbackResource->postApplyResource(this, context, ApplyToStroke Mode, 0, this); 241 fallbackResource->postApplyResource(this, context, ApplyToStroke Mode, 0, this);
242 } 242 }
243 } 243 }
244 } 244 }
245 245
246 void RenderSVGShape::fillAndStrokeShape(GraphicsContext* context) 246 void RenderSVGShape::fillAndStrokeShape(GraphicsContext* context)
247 { 247 {
248 RenderStyle* style = this->style(); 248 RenderStyle* style = this->style();
249 249
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 return; 457 return;
458 458
459 ASSERT(m_path); 459 ASSERT(m_path);
460 460
461 SVGMarkerData markerData(m_markerPositions); 461 SVGMarkerData markerData(m_markerPositions);
462 m_path->apply(&markerData, SVGMarkerData::updateFromPathElement); 462 m_path->apply(&markerData, SVGMarkerData::updateFromPathElement);
463 markerData.pathIsDone(); 463 markerData.pathIsDone();
464 } 464 }
465 465
466 } 466 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698