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

Side by Side Diff: Source/core/css/resolver/StyleBuilderConverter.cpp

Issue 23241010: Support subpixel values for text-shadow and box-shadow (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: missed a virtual test Created 7 years 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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * * Redistributions of source code must retain the above copyright 4 * * Redistributions of source code must retain the above copyright
5 * notice, this list of conditions and the following disclaimer. 5 * notice, this list of conditions and the following disclaimer.
6 * * Redistributions in binary form must reproduce the above 6 * * Redistributions in binary form must reproduce the above
7 * copyright notice, this list of conditions and the following disclaimer 7 * copyright notice, this list of conditions and the following disclaimer
8 * in the documentation and/or other materials provided with the 8 * in the documentation and/or other materials provided with the
9 * distribution. 9 * distribution.
10 * * Neither the name of Google Inc. nor the names of its 10 * * Neither the name of Google Inc. nor the names of its
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 if (value->isPrimitiveValue()) { 129 if (value->isPrimitiveValue()) {
130 ASSERT(toCSSPrimitiveValue(value)->getValueID() == CSSValueNone); 130 ASSERT(toCSSPrimitiveValue(value)->getValueID() == CSSValueNone);
131 return PassRefPtr<ShadowList>(); 131 return PassRefPtr<ShadowList>();
132 } 132 }
133 133
134 const CSSValueList* valueList = toCSSValueList(value); 134 const CSSValueList* valueList = toCSSValueList(value);
135 size_t shadowCount = valueList->length(); 135 size_t shadowCount = valueList->length();
136 ShadowDataVector shadows; 136 ShadowDataVector shadows;
137 for (size_t i = 0; i < shadowCount; ++i) { 137 for (size_t i = 0; i < shadowCount; ++i) {
138 const CSSShadowValue* item = toCSSShadowValue(valueList->item(i)); 138 const CSSShadowValue* item = toCSSShadowValue(valueList->item(i));
139 int x = item->x->computeLength<int>(state.cssToLengthConversionData()); 139 float x = item->x->computeLength<float>(state.cssToLengthConversionData( ));
140 int y = item->y->computeLength<int>(state.cssToLengthConversionData()); 140 float y = item->y->computeLength<float>(state.cssToLengthConversionData( ));
141 int blur = item->blur ? item->blur->computeLength<int>(state.cssToLength ConversionData()) : 0; 141 float blur = item->blur ? item->blur->computeLength<float>(state.cssToLe ngthConversionData()) : 0;
142 int spread = item->spread ? item->spread->computeLength<int>(state.cssTo LengthConversionData()) : 0; 142 float spread = item->spread ? item->spread->computeLength<float>(state.c ssToLengthConversionData()) : 0;
143 ShadowStyle shadowStyle = item->style && item->style->getValueID() == CS SValueInset ? Inset : Normal; 143 ShadowStyle shadowStyle = item->style && item->style->getValueID() == CS SValueInset ? Inset : Normal;
144 Color color; 144 Color color;
145 if (item->color) 145 if (item->color)
146 color = state.document().textLinkColors().colorFromPrimitiveValue(it em->color.get(), state.style()->color()); 146 color = state.document().textLinkColors().colorFromPrimitiveValue(it em->color.get(), state.style()->color());
147 else 147 else
148 color = state.style()->color(); 148 color = state.style()->color();
149 149
150 if (!color.isValid()) 150 if (!color.isValid())
151 color = Color::transparent; 151 color = Color::transparent;
152 shadows.append(ShadowData(IntPoint(x, y), blur, spread, shadowStyle, col or)); 152 shadows.append(ShadowData(FloatPoint(x, y), blur, spread, shadowStyle, c olor));
153 } 153 }
154 return ShadowList::adopt(shadows); 154 return ShadowList::adopt(shadows);
155 } 155 }
156 156
157 float StyleBuilderConverter::convertSpacing(StyleResolverState& state, CSSValue* value) 157 float StyleBuilderConverter::convertSpacing(StyleResolverState& state, CSSValue* value)
158 { 158 {
159 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); 159 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
160 if (primitiveValue->getValueID() == CSSValueNormal) 160 if (primitiveValue->getValueID() == CSSValueNormal)
161 return 0; 161 return 0;
162 if (state.useSVGZoomRules()) 162 if (state.useSVGZoomRules())
163 return primitiveValue->computeLength<float>(state.cssToLengthConversionD ata().copyWithAdjustedZoom(1)); 163 return primitiveValue->computeLength<float>(state.cssToLengthConversionD ata().copyWithAdjustedZoom(1));
164 return primitiveValue->computeLength<float>(state.cssToLengthConversionData( )); 164 return primitiveValue->computeLength<float>(state.cssToLengthConversionData( ));
165 } 165 }
166 166
167 SVGLength StyleBuilderConverter::convertSVGLength(StyleResolverState&, CSSValue* value) 167 SVGLength StyleBuilderConverter::convertSVGLength(StyleResolverState&, CSSValue* value)
168 { 168 {
169 return SVGLength::fromCSSPrimitiveValue(toCSSPrimitiveValue(value)); 169 return SVGLength::fromCSSPrimitiveValue(toCSSPrimitiveValue(value));
170 } 170 }
171 171
172 } // namespace WebCore 172 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698