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

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 and review feedback 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 1079 matching lines...) Expand 10 before | Expand all | Expand 10 after
1199 } 1199 }
1200 1200
1201 static PassRefPtrWillBeRawPtr<CSSValue> adjustSVGPaintForCurrentColor(SVGPaintTy pe paintType, const String& url, const Color& color, const Color& currentColor) 1201 static PassRefPtrWillBeRawPtr<CSSValue> adjustSVGPaintForCurrentColor(SVGPaintTy pe paintType, const String& url, const Color& color, const Color& currentColor)
1202 { 1202 {
1203 if (paintType >= SVG_PAINTTYPE_URI_NONE) { 1203 if (paintType >= SVG_PAINTTYPE_URI_NONE) {
1204 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createSpaceSepar ated(); 1204 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createSpaceSepar ated();
1205 values->append(CSSURIValue::create(url)); 1205 values->append(CSSURIValue::create(url));
1206 if (paintType == SVG_PAINTTYPE_URI_NONE) 1206 if (paintType == SVG_PAINTTYPE_URI_NONE)
1207 values->append(CSSPrimitiveValue::create(CSSValueNone)); 1207 values->append(CSSPrimitiveValue::create(CSSValueNone));
1208 else if (paintType == SVG_PAINTTYPE_URI_CURRENTCOLOR) 1208 else if (paintType == SVG_PAINTTYPE_URI_CURRENTCOLOR)
1209 values->append(CSSPrimitiveValue::createColor(currentColor.rgb())); 1209 values->append(CSSColorValue::create(currentColor.rgb()));
1210 else if (paintType == SVG_PAINTTYPE_URI_RGBCOLOR) 1210 else if (paintType == SVG_PAINTTYPE_URI_RGBCOLOR)
1211 values->append(CSSPrimitiveValue::createColor(color.rgb())); 1211 values->append(CSSColorValue::create(color.rgb()));
1212 return values.release(); 1212 return values.release();
1213 } 1213 }
1214 if (paintType == SVG_PAINTTYPE_NONE) 1214 if (paintType == SVG_PAINTTYPE_NONE)
1215 return CSSPrimitiveValue::create(CSSValueNone); 1215 return CSSPrimitiveValue::create(CSSValueNone);
1216 if (paintType == SVG_PAINTTYPE_CURRENTCOLOR) 1216 if (paintType == SVG_PAINTTYPE_CURRENTCOLOR)
1217 return CSSPrimitiveValue::createColor(currentColor.rgb()); 1217 return CSSColorValue::create(currentColor.rgb());
1218 1218
1219 return CSSPrimitiveValue::createColor(color.rgb()); 1219 return CSSColorValue::create(color.rgb());
1220 } 1220 }
1221 1221
1222 static inline String serializeAsFragmentIdentifier(const AtomicString& resource) 1222 static inline String serializeAsFragmentIdentifier(const AtomicString& resource)
1223 { 1223 {
1224 return "#" + resource; 1224 return "#" + resource;
1225 } 1225 }
1226 1226
1227 PassRefPtrWillBeRawPtr<CSSValue> ComputedStyleCSSValueMapping::valueForShadowDat a(const ShadowData& shadow, const ComputedStyle& style, bool useSpread) 1227 PassRefPtrWillBeRawPtr<CSSValue> ComputedStyleCSSValueMapping::valueForShadowDat a(const ShadowData& shadow, const ComputedStyle& style, bool useSpread)
1228 { 1228 {
1229 RefPtrWillBeRawPtr<CSSPrimitiveValue> x = zoomAdjustedPixelValue(shadow.x(), style); 1229 RefPtrWillBeRawPtr<CSSPrimitiveValue> x = zoomAdjustedPixelValue(shadow.x(), style);
1230 RefPtrWillBeRawPtr<CSSPrimitiveValue> y = zoomAdjustedPixelValue(shadow.y(), style); 1230 RefPtrWillBeRawPtr<CSSPrimitiveValue> y = zoomAdjustedPixelValue(shadow.y(), style);
1231 RefPtrWillBeRawPtr<CSSPrimitiveValue> blur = zoomAdjustedPixelValue(shadow.b lur(), style); 1231 RefPtrWillBeRawPtr<CSSPrimitiveValue> blur = zoomAdjustedPixelValue(shadow.b lur(), style);
1232 RefPtrWillBeRawPtr<CSSPrimitiveValue> spread = useSpread ? zoomAdjustedPixel Value(shadow.spread(), style) : PassRefPtrWillBeRawPtr<CSSPrimitiveValue>(nullpt r); 1232 RefPtrWillBeRawPtr<CSSPrimitiveValue> spread = useSpread ? zoomAdjustedPixel Value(shadow.spread(), style) : PassRefPtrWillBeRawPtr<CSSPrimitiveValue>(nullpt r);
1233 RefPtrWillBeRawPtr<CSSPrimitiveValue> shadowStyle = shadow.style() == Normal ? PassRefPtrWillBeRawPtr<CSSPrimitiveValue>(nullptr) : cssValuePool().createIde ntifierValue(CSSValueInset); 1233 RefPtrWillBeRawPtr<CSSPrimitiveValue> shadowStyle = shadow.style() == Normal ? PassRefPtrWillBeRawPtr<CSSPrimitiveValue>(nullptr) : cssValuePool().createIde ntifierValue(CSSValueInset);
1234 RefPtrWillBeRawPtr<CSSPrimitiveValue> color = currentColorOrValidColor(style , shadow.color()); 1234 RefPtrWillBeRawPtr<CSSValue> color = currentColorOrValidColor(style, shadow. color());
1235 return CSSShadowValue::create(x.release(), y.release(), blur.release(), spre ad.release(), shadowStyle.release(), color.release()); 1235 return CSSShadowValue::create(x.release(), y.release(), blur.release(), spre ad.release(), shadowStyle.release(), color.release());
1236 } 1236 }
1237 1237
1238 PassRefPtrWillBeRawPtr<CSSValue> ComputedStyleCSSValueMapping::valueForShadowLis t(const ShadowList* shadowList, const ComputedStyle& style, bool useSpread) 1238 PassRefPtrWillBeRawPtr<CSSValue> ComputedStyleCSSValueMapping::valueForShadowLis t(const ShadowList* shadowList, const ComputedStyle& style, bool useSpread)
1239 { 1239 {
1240 if (!shadowList) 1240 if (!shadowList)
1241 return cssValuePool().createIdentifierValue(CSSValueNone); 1241 return cssValuePool().createIdentifierValue(CSSValueNone);
1242 1242
1243 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated() ; 1243 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated() ;
1244 size_t shadowCount = shadowList->shadows().size(); 1244 size_t shadowCount = shadowList->shadows().size();
(...skipping 1468 matching lines...) Expand 10 before | Expand all | Expand 10 after
2713 case CSSPropertyAll: 2713 case CSSPropertyAll:
2714 return nullptr; 2714 return nullptr;
2715 default: 2715 default:
2716 break; 2716 break;
2717 } 2717 }
2718 ASSERT_NOT_REACHED(); 2718 ASSERT_NOT_REACHED();
2719 return nullptr; 2719 return nullptr;
2720 } 2720 }
2721 2721
2722 } 2722 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698