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

Side by Side Diff: Source/core/css/SVGCSSComputedStyleDeclaration.cpp

Issue 57643004: Pass RenderStyle / RenderObject by reference in more places (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase on master Created 7 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
« no previous file with comments | « Source/core/css/CSSValuePool.cpp ('k') | Source/core/css/resolver/StyleResolver.h » ('j') | 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) 2007 Eric Seidel <eric@webkit.org> 2 Copyright (C) 2007 Eric Seidel <eric@webkit.org>
3 Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 3 Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
4 4
5 This library is free software; you can redistribute it and/or 5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public 6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either 7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version. 8 version 2 of the License, or (at your option) any later version.
9 9
10 This library is distributed in the hope that it will be useful, 10 This library is distributed in the hope that it will be useful,
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 case PT_NONE: 73 case PT_NONE:
74 default: 74 default:
75 ASSERT_NOT_REACHED(); 75 ASSERT_NOT_REACHED();
76 break; 76 break;
77 } 77 }
78 } while (paintorder >>= kPaintOrderBitwidth); 78 } while (paintorder >>= kPaintOrderBitwidth);
79 79
80 return list.release(); 80 return list.release();
81 } 81 }
82 82
83 PassRefPtr<SVGPaint> CSSComputedStyleDeclaration::adjustSVGPaintForCurrentColor( PassRefPtr<SVGPaint> newPaint, RenderStyle* style) const 83 PassRefPtr<SVGPaint> CSSComputedStyleDeclaration::adjustSVGPaintForCurrentColor( PassRefPtr<SVGPaint> newPaint, RenderStyle& style) const
84 { 84 {
85 RefPtr<SVGPaint> paint = newPaint; 85 RefPtr<SVGPaint> paint = newPaint;
86 if (paint->paintType() == SVGPaint::SVG_PAINTTYPE_CURRENTCOLOR || paint->pai ntType() == SVGPaint::SVG_PAINTTYPE_URI_CURRENTCOLOR) 86 if (paint->paintType() == SVGPaint::SVG_PAINTTYPE_CURRENTCOLOR || paint->pai ntType() == SVGPaint::SVG_PAINTTYPE_URI_CURRENTCOLOR)
87 paint->setColor(style->color()); 87 paint->setColor(style.color());
88 return paint.release(); 88 return paint.release();
89 } 89 }
90 90
91 PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getSVGPropertyCSSValue(CSSProp ertyID propertyID, EUpdateLayout updateLayout) const 91 PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getSVGPropertyCSSValue(CSSProp ertyID propertyID, EUpdateLayout updateLayout) const
92 { 92 {
93 Node* node = m_node.get(); 93 Node* node = m_node.get();
94 if (!node) 94 if (!node)
95 return 0; 95 return 0;
96 96
97 // Make sure our layout is up to date before we allow a query on these attri butes. 97 // Make sure our layout is up to date before we allow a query on these attri butes.
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 return CSSPrimitiveValue::createIdentifier(CSSValueNone); 147 return CSSPrimitiveValue::createIdentifier(CSSValueNone);
148 case CSSPropertyMask: 148 case CSSPropertyMask:
149 if (!svgStyle->maskerResource().isEmpty()) 149 if (!svgStyle->maskerResource().isEmpty())
150 return CSSPrimitiveValue::create(svgStyle->maskerResource(), CSS PrimitiveValue::CSS_URI); 150 return CSSPrimitiveValue::create(svgStyle->maskerResource(), CSS PrimitiveValue::CSS_URI);
151 return CSSPrimitiveValue::createIdentifier(CSSValueNone); 151 return CSSPrimitiveValue::createIdentifier(CSSValueNone);
152 case CSSPropertyFilter: 152 case CSSPropertyFilter:
153 if (!svgStyle->filterResource().isEmpty()) 153 if (!svgStyle->filterResource().isEmpty())
154 return CSSPrimitiveValue::create(svgStyle->filterResource(), CSS PrimitiveValue::CSS_URI); 154 return CSSPrimitiveValue::create(svgStyle->filterResource(), CSS PrimitiveValue::CSS_URI);
155 return CSSPrimitiveValue::createIdentifier(CSSValueNone); 155 return CSSPrimitiveValue::createIdentifier(CSSValueNone);
156 case CSSPropertyFloodColor: 156 case CSSPropertyFloodColor:
157 return currentColorOrValidColor(style, svgStyle->floodColor()); 157 return currentColorOrValidColor(*style, svgStyle->floodColor());
158 case CSSPropertyLightingColor: 158 case CSSPropertyLightingColor:
159 return currentColorOrValidColor(style, svgStyle->lightingColor()); 159 return currentColorOrValidColor(*style, svgStyle->lightingColor());
160 case CSSPropertyStopColor: 160 case CSSPropertyStopColor:
161 return currentColorOrValidColor(style, svgStyle->stopColor()); 161 return currentColorOrValidColor(*style, svgStyle->stopColor());
162 case CSSPropertyFill: 162 case CSSPropertyFill:
163 return adjustSVGPaintForCurrentColor(SVGPaint::create(svgStyle->fill PaintType(), svgStyle->fillPaintUri(), svgStyle->fillPaintColor()), style); 163 return adjustSVGPaintForCurrentColor(SVGPaint::create(svgStyle->fill PaintType(), svgStyle->fillPaintUri(), svgStyle->fillPaintColor()), *style);
164 case CSSPropertyKerning: 164 case CSSPropertyKerning:
165 return SVGLength::toCSSPrimitiveValue(svgStyle->kerning()); 165 return SVGLength::toCSSPrimitiveValue(svgStyle->kerning());
166 case CSSPropertyMarkerEnd: 166 case CSSPropertyMarkerEnd:
167 if (!svgStyle->markerEndResource().isEmpty()) 167 if (!svgStyle->markerEndResource().isEmpty())
168 return CSSPrimitiveValue::create(svgStyle->markerEndResource(), CSSPrimitiveValue::CSS_URI); 168 return CSSPrimitiveValue::create(svgStyle->markerEndResource(), CSSPrimitiveValue::CSS_URI);
169 return CSSPrimitiveValue::createIdentifier(CSSValueNone); 169 return CSSPrimitiveValue::createIdentifier(CSSValueNone);
170 case CSSPropertyMarkerMid: 170 case CSSPropertyMarkerMid:
171 if (!svgStyle->markerMidResource().isEmpty()) 171 if (!svgStyle->markerMidResource().isEmpty())
172 return CSSPrimitiveValue::create(svgStyle->markerMidResource(), CSSPrimitiveValue::CSS_URI); 172 return CSSPrimitiveValue::create(svgStyle->markerMidResource(), CSSPrimitiveValue::CSS_URI);
173 return CSSPrimitiveValue::createIdentifier(CSSValueNone); 173 return CSSPrimitiveValue::createIdentifier(CSSValueNone);
174 case CSSPropertyMarkerStart: 174 case CSSPropertyMarkerStart:
175 if (!svgStyle->markerStartResource().isEmpty()) 175 if (!svgStyle->markerStartResource().isEmpty())
176 return CSSPrimitiveValue::create(svgStyle->markerStartResource() , CSSPrimitiveValue::CSS_URI); 176 return CSSPrimitiveValue::create(svgStyle->markerStartResource() , CSSPrimitiveValue::CSS_URI);
177 return CSSPrimitiveValue::createIdentifier(CSSValueNone); 177 return CSSPrimitiveValue::createIdentifier(CSSValueNone);
178 case CSSPropertyStroke: 178 case CSSPropertyStroke:
179 return adjustSVGPaintForCurrentColor(SVGPaint::create(svgStyle->stro kePaintType(), svgStyle->strokePaintUri(), svgStyle->strokePaintColor()), style) ; 179 return adjustSVGPaintForCurrentColor(SVGPaint::create(svgStyle->stro kePaintType(), svgStyle->strokePaintUri(), svgStyle->strokePaintColor()), *style );
180 case CSSPropertyStrokeDasharray: 180 case CSSPropertyStrokeDasharray:
181 return strokeDashArrayToCSSValueList(svgStyle->strokeDashArray()); 181 return strokeDashArrayToCSSValueList(svgStyle->strokeDashArray());
182 case CSSPropertyStrokeDashoffset: 182 case CSSPropertyStrokeDashoffset:
183 return SVGLength::toCSSPrimitiveValue(svgStyle->strokeDashOffset()); 183 return SVGLength::toCSSPrimitiveValue(svgStyle->strokeDashOffset());
184 case CSSPropertyStrokeWidth: 184 case CSSPropertyStrokeWidth:
185 return SVGLength::toCSSPrimitiveValue(svgStyle->strokeWidth()); 185 return SVGLength::toCSSPrimitiveValue(svgStyle->strokeWidth());
186 case CSSPropertyBaselineShift: { 186 case CSSPropertyBaselineShift: {
187 switch (svgStyle->baselineShift()) { 187 switch (svgStyle->baselineShift()) {
188 case BS_BASELINE: 188 case BS_BASELINE:
189 return CSSPrimitiveValue::createIdentifier(CSSValueBaseline) ; 189 return CSSPrimitiveValue::createIdentifier(CSSValueBaseline) ;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 default: 224 default:
225 // If you crash here, it's because you added a css property and are not handling it 225 // If you crash here, it's because you added a css property and are not handling it
226 // in either this switch statement or the one in CSSComputedStyleDelcara tion::getPropertyCSSValue 226 // in either this switch statement or the one in CSSComputedStyleDelcara tion::getPropertyCSSValue
227 ASSERT_WITH_MESSAGE(0, "unimplemented propertyID: %d", propertyID); 227 ASSERT_WITH_MESSAGE(0, "unimplemented propertyID: %d", propertyID);
228 } 228 }
229 LOG_ERROR("unimplemented propertyID: %d", propertyID); 229 LOG_ERROR("unimplemented propertyID: %d", propertyID);
230 return 0; 230 return 0;
231 } 231 }
232 232
233 } 233 }
OLDNEW
« no previous file with comments | « Source/core/css/CSSValuePool.cpp ('k') | Source/core/css/resolver/StyleResolver.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698