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

Side by Side Diff: third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp

Issue 1376573004: Split out Color from CSSPrimitiveValue (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@split_property
Patch Set: Rebase Created 5 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004 Zack Rusin <zack@kde.org> 2 * Copyright (C) 2004 Zack Rusin <zack@kde.org>
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
4 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 4 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> 5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com>
6 * Copyright (C) 2011 Sencha, Inc. All rights reserved. 6 * Copyright (C) 2011 Sencha, Inc. All rights reserved.
7 * Copyright (C) 2015 Google Inc. All rights reserved. 7 * Copyright (C) 2015 Google Inc. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public 10 * modify it under the terms of the GNU Lesser General Public
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 } 99 }
100 positionList->append(zoomAdjustedPixelValueForLength(layer.xPosition(), styl e)); 100 positionList->append(zoomAdjustedPixelValueForLength(layer.xPosition(), styl e));
101 if (layer.isBackgroundYOriginSet()) { 101 if (layer.isBackgroundYOriginSet()) {
102 ASSERT(propertyID == CSSPropertyBackgroundPosition || propertyID == CSSP ropertyWebkitMaskPosition); 102 ASSERT(propertyID == CSSPropertyBackgroundPosition || propertyID == CSSP ropertyWebkitMaskPosition);
103 positionList->append(cssValuePool().createValue(layer.backgroundYOrigin( ))); 103 positionList->append(cssValuePool().createValue(layer.backgroundYOrigin( )));
104 } 104 }
105 positionList->append(zoomAdjustedPixelValueForLength(layer.yPosition(), styl e)); 105 positionList->append(zoomAdjustedPixelValueForLength(layer.yPosition(), styl e));
106 return positionList.release(); 106 return positionList.release();
107 } 107 }
108 108
109 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> ComputedStyleCSSValueMapping::currentC olorOrValidColor(const ComputedStyle& style, const StyleColor& color) 109 PassRefPtrWillBeRawPtr<CSSValue> ComputedStyleCSSValueMapping::currentColorOrVal idColor(const ComputedStyle& style, const StyleColor& color)
110 { 110 {
111 // This function does NOT look at visited information, so that computed styl e doesn't expose that. 111 // This function does NOT look at visited information, so that computed styl e doesn't expose that.
112 return cssValuePool().createColorValue(color.resolve(style.color()).rgb()); 112 return cssValuePool().createColorValue(color.resolve(style.color()).rgb());
113 } 113 }
114 114
115 static PassRefPtrWillBeRawPtr<CSSValue> valueForFillSize(const FillSize& fillSiz e, const ComputedStyle& style) 115 static PassRefPtrWillBeRawPtr<CSSValue> valueForFillSize(const FillSize& fillSiz e, const ComputedStyle& style)
116 { 116 {
117 if (fillSize.type == Contain) 117 if (fillSize.type == Contain)
118 return cssValuePool().createIdentifierValue(CSSValueContain); 118 return cssValuePool().createIdentifierValue(CSSValueContain);
119 119
(...skipping 1074 matching lines...) Expand 10 before | Expand all | Expand 10 after
1194 } 1194 }
1195 1195
1196 static PassRefPtrWillBeRawPtr<CSSValue> adjustSVGPaintForCurrentColor(SVGPaintTy pe paintType, const String& url, const Color& color, const Color& currentColor) 1196 static PassRefPtrWillBeRawPtr<CSSValue> adjustSVGPaintForCurrentColor(SVGPaintTy pe paintType, const String& url, const Color& color, const Color& currentColor)
1197 { 1197 {
1198 if (paintType >= SVG_PAINTTYPE_URI_NONE) { 1198 if (paintType >= SVG_PAINTTYPE_URI_NONE) {
1199 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createSpaceSepar ated(); 1199 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createSpaceSepar ated();
1200 values->append(CSSURIValue::create(url)); 1200 values->append(CSSURIValue::create(url));
1201 if (paintType == SVG_PAINTTYPE_URI_NONE) 1201 if (paintType == SVG_PAINTTYPE_URI_NONE)
1202 values->append(CSSPrimitiveValue::create(CSSValueNone)); 1202 values->append(CSSPrimitiveValue::create(CSSValueNone));
1203 else if (paintType == SVG_PAINTTYPE_URI_CURRENTCOLOR) 1203 else if (paintType == SVG_PAINTTYPE_URI_CURRENTCOLOR)
1204 values->append(CSSPrimitiveValue::createColor(currentColor.rgb())); 1204 values->append(CSSColorValue::create(currentColor.rgb()));
1205 else if (paintType == SVG_PAINTTYPE_URI_RGBCOLOR) 1205 else if (paintType == SVG_PAINTTYPE_URI_RGBCOLOR)
1206 values->append(CSSPrimitiveValue::createColor(color.rgb())); 1206 values->append(CSSColorValue::create(color.rgb()));
1207 return values.release(); 1207 return values.release();
1208 } 1208 }
1209 if (paintType == SVG_PAINTTYPE_NONE) 1209 if (paintType == SVG_PAINTTYPE_NONE)
1210 return CSSPrimitiveValue::create(CSSValueNone); 1210 return CSSPrimitiveValue::create(CSSValueNone);
1211 if (paintType == SVG_PAINTTYPE_CURRENTCOLOR) 1211 if (paintType == SVG_PAINTTYPE_CURRENTCOLOR)
1212 return CSSPrimitiveValue::createColor(currentColor.rgb()); 1212 return CSSColorValue::create(currentColor.rgb());
1213 1213
1214 return CSSPrimitiveValue::createColor(color.rgb()); 1214 return CSSColorValue::create(color.rgb());
1215 } 1215 }
1216 1216
1217 static inline String serializeAsFragmentIdentifier(const AtomicString& resource) 1217 static inline String serializeAsFragmentIdentifier(const AtomicString& resource)
1218 { 1218 {
1219 return "#" + resource; 1219 return "#" + resource;
1220 } 1220 }
1221 1221
1222 PassRefPtrWillBeRawPtr<CSSValue> ComputedStyleCSSValueMapping::valueForShadowDat a(const ShadowData& shadow, const ComputedStyle& style, bool useSpread) 1222 PassRefPtrWillBeRawPtr<CSSValue> ComputedStyleCSSValueMapping::valueForShadowDat a(const ShadowData& shadow, const ComputedStyle& style, bool useSpread)
1223 { 1223 {
1224 RefPtrWillBeRawPtr<CSSPrimitiveValue> x = zoomAdjustedPixelValue(shadow.x(), style); 1224 RefPtrWillBeRawPtr<CSSPrimitiveValue> x = zoomAdjustedPixelValue(shadow.x(), style);
1225 RefPtrWillBeRawPtr<CSSPrimitiveValue> y = zoomAdjustedPixelValue(shadow.y(), style); 1225 RefPtrWillBeRawPtr<CSSPrimitiveValue> y = zoomAdjustedPixelValue(shadow.y(), style);
1226 RefPtrWillBeRawPtr<CSSPrimitiveValue> blur = zoomAdjustedPixelValue(shadow.b lur(), style); 1226 RefPtrWillBeRawPtr<CSSPrimitiveValue> blur = zoomAdjustedPixelValue(shadow.b lur(), style);
1227 RefPtrWillBeRawPtr<CSSPrimitiveValue> spread = useSpread ? zoomAdjustedPixel Value(shadow.spread(), style) : PassRefPtrWillBeRawPtr<CSSPrimitiveValue>(nullpt r); 1227 RefPtrWillBeRawPtr<CSSPrimitiveValue> spread = useSpread ? zoomAdjustedPixel Value(shadow.spread(), style) : PassRefPtrWillBeRawPtr<CSSPrimitiveValue>(nullpt r);
1228 RefPtrWillBeRawPtr<CSSPrimitiveValue> shadowStyle = shadow.style() == Normal ? PassRefPtrWillBeRawPtr<CSSPrimitiveValue>(nullptr) : cssValuePool().createIde ntifierValue(CSSValueInset); 1228 RefPtrWillBeRawPtr<CSSPrimitiveValue> shadowStyle = shadow.style() == Normal ? PassRefPtrWillBeRawPtr<CSSPrimitiveValue>(nullptr) : cssValuePool().createIde ntifierValue(CSSValueInset);
1229 RefPtrWillBeRawPtr<CSSPrimitiveValue> color = currentColorOrValidColor(style , shadow.color()); 1229 RefPtrWillBeRawPtr<CSSValue> color = currentColorOrValidColor(style, shadow. color());
1230 return CSSShadowValue::create(x.release(), y.release(), blur.release(), spre ad.release(), shadowStyle.release(), color.release()); 1230 return CSSShadowValue::create(x.release(), y.release(), blur.release(), spre ad.release(), shadowStyle.release(), color.release());
1231 } 1231 }
1232 1232
1233 PassRefPtrWillBeRawPtr<CSSValue> ComputedStyleCSSValueMapping::valueForShadowLis t(const ShadowList* shadowList, const ComputedStyle& style, bool useSpread) 1233 PassRefPtrWillBeRawPtr<CSSValue> ComputedStyleCSSValueMapping::valueForShadowLis t(const ShadowList* shadowList, const ComputedStyle& style, bool useSpread)
1234 { 1234 {
1235 if (!shadowList) 1235 if (!shadowList)
1236 return cssValuePool().createIdentifierValue(CSSValueNone); 1236 return cssValuePool().createIdentifierValue(CSSValueNone);
1237 1237
1238 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated() ; 1238 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated() ;
1239 size_t shadowCount = shadowList->shadows().size(); 1239 size_t shadowCount = shadowList->shadows().size();
(...skipping 1463 matching lines...) Expand 10 before | Expand all | Expand 10 after
2703 case CSSPropertyAll: 2703 case CSSPropertyAll:
2704 return nullptr; 2704 return nullptr;
2705 default: 2705 default:
2706 break; 2706 break;
2707 } 2707 }
2708 ASSERT_NOT_REACHED(); 2708 ASSERT_NOT_REACHED();
2709 return nullptr; 2709 return nullptr;
2710 } 2710 }
2711 2711
2712 } 2712 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698