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

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

Issue 189913012: Merge SVGColor into SVGPaint (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix system color test Created 6 years, 9 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
« no previous file with comments | « Source/core/css/parser/CSSPropertyParser.cpp ('k') | Source/core/svg/SVGAnimatedColor.cpp » ('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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 3 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
4 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) 4 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com)
5 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) 5 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com)
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved.
7 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 7 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
8 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> 8 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org>
9 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 9 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
10 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. 10 * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 #include "core/frame/LocalFrame.h" 70 #include "core/frame/LocalFrame.h"
71 #include "core/frame/Settings.h" 71 #include "core/frame/Settings.h"
72 #include "core/rendering/style/CounterContent.h" 72 #include "core/rendering/style/CounterContent.h"
73 #include "core/rendering/style/CursorList.h" 73 #include "core/rendering/style/CursorList.h"
74 #include "core/rendering/style/QuotesData.h" 74 #include "core/rendering/style/QuotesData.h"
75 #include "core/rendering/style/RenderStyle.h" 75 #include "core/rendering/style/RenderStyle.h"
76 #include "core/rendering/style/RenderStyleConstants.h" 76 #include "core/rendering/style/RenderStyleConstants.h"
77 #include "core/rendering/style/SVGRenderStyle.h" 77 #include "core/rendering/style/SVGRenderStyle.h"
78 #include "core/rendering/style/SVGRenderStyleDefs.h" 78 #include "core/rendering/style/SVGRenderStyleDefs.h"
79 #include "core/rendering/style/StyleGeneratedImage.h" 79 #include "core/rendering/style/StyleGeneratedImage.h"
80 #include "core/svg/SVGColor.h"
81 #include "core/svg/SVGPaint.h" 80 #include "core/svg/SVGPaint.h"
82 #include "platform/fonts/FontDescription.h" 81 #include "platform/fonts/FontDescription.h"
83 #include "wtf/MathExtras.h" 82 #include "wtf/MathExtras.h"
84 #include "wtf/StdLibExtras.h" 83 #include "wtf/StdLibExtras.h"
85 #include "wtf/Vector.h" 84 #include "wtf/Vector.h"
86 85
87 namespace WebCore { 86 namespace WebCore {
88 87
89 static Length clipConvertToLength(StyleResolverState& state, CSSPrimitiveValue* value) 88 static Length clipConvertToLength(StyleResolverState& state, CSSPrimitiveValue* value)
90 { 89 {
(...skipping 976 matching lines...) Expand 10 before | Expand all | Expand 10 after
1067 return true; 1066 return true;
1068 } 1067 }
1069 if (angle > 135.0f && angle <= 225.0f) { 1068 if (angle > 135.0f && angle <= 225.0f) {
1070 orientation = GO_180DEG; 1069 orientation = GO_180DEG;
1071 return true; 1070 return true;
1072 } 1071 }
1073 orientation = GO_270DEG; 1072 orientation = GO_270DEG;
1074 return true; 1073 return true;
1075 } 1074 }
1076 1075
1077 static Color colorFromSVGColorCSSValue(SVGColor* svgColor, const Color& fgColor) 1076 static Color colorFromSVGPaintCSSValue(SVGPaint* svgPaint, const Color& fgColor)
1078 { 1077 {
1079 Color color; 1078 Color color;
1080 if (svgColor->colorType() == SVGColor::SVG_COLORTYPE_CURRENTCOLOR) 1079 if (svgPaint->paintType() == SVGPaint::SVG_PAINTTYPE_CURRENTCOLOR
1080 || svgPaint->paintType() == SVGPaint::SVG_PAINTTYPE_URI_CURRENTCOLOR)
1081 color = fgColor; 1081 color = fgColor;
1082 else 1082 else
1083 color = svgColor->color(); 1083 color = svgPaint->color();
1084 return color; 1084 return color;
1085 } 1085 }
1086 1086
1087 static EPaintOrder paintOrderFlattened(CSSValue* cssPaintOrder) 1087 static EPaintOrder paintOrderFlattened(CSSValue* cssPaintOrder)
1088 { 1088 {
1089 if (cssPaintOrder->isValueList()) { 1089 if (cssPaintOrder->isValueList()) {
1090 int paintOrder = 0; 1090 int paintOrder = 0;
1091 CSSValueListInspector iter(cssPaintOrder); 1091 CSSValueListInspector iter(cssPaintOrder);
1092 for (size_t i = 0; i < iter.length(); i++) { 1092 for (size_t i = 0; i < iter.length(); i++) {
1093 CSSPrimitiveValue* value = toCSSPrimitiveValue(iter.item(i)); 1093 CSSPrimitiveValue* value = toCSSPrimitiveValue(iter.item(i));
(...skipping 976 matching lines...) Expand 10 before | Expand all | Expand 10 after
2070 const SVGRenderStyle* svgParentStyle = state.parentStyle()->svgStyle (); 2070 const SVGRenderStyle* svgParentStyle = state.parentStyle()->svgStyle ();
2071 svgStyle->setFillPaint(svgParentStyle->fillPaintType(), svgParentSty le->fillPaintColor(), svgParentStyle->fillPaintUri(), state.applyPropertyToRegul arStyle(), state.applyPropertyToVisitedLinkStyle()); 2071 svgStyle->setFillPaint(svgParentStyle->fillPaintType(), svgParentSty le->fillPaintColor(), svgParentStyle->fillPaintUri(), state.applyPropertyToRegul arStyle(), state.applyPropertyToVisitedLinkStyle());
2072 return; 2072 return;
2073 } 2073 }
2074 if (isInitial) { 2074 if (isInitial) {
2075 svgStyle->setFillPaint(SVGRenderStyle::initialFillPaintType(), SVGRe nderStyle::initialFillPaintColor(), SVGRenderStyle::initialFillPaintUri(), state .applyPropertyToRegularStyle(), state.applyPropertyToVisitedLinkStyle()); 2075 svgStyle->setFillPaint(SVGRenderStyle::initialFillPaintType(), SVGRe nderStyle::initialFillPaintColor(), SVGRenderStyle::initialFillPaintUri(), state .applyPropertyToRegularStyle(), state.applyPropertyToVisitedLinkStyle());
2076 return; 2076 return;
2077 } 2077 }
2078 if (value->isSVGPaint()) { 2078 if (value->isSVGPaint()) {
2079 SVGPaint* svgPaint = toSVGPaint(value); 2079 SVGPaint* svgPaint = toSVGPaint(value);
2080 svgStyle->setFillPaint(svgPaint->paintType(), colorFromSVGColorCSSVa lue(svgPaint, state.style()->color()), svgPaint->uri(), state.applyPropertyToReg ularStyle(), state.applyPropertyToVisitedLinkStyle()); 2080 svgStyle->setFillPaint(svgPaint->paintType(), colorFromSVGPaintCSSVa lue(svgPaint, state.style()->color()), svgPaint->uri(), state.applyPropertyToReg ularStyle(), state.applyPropertyToVisitedLinkStyle());
2081 } 2081 }
2082 break; 2082 break;
2083 } 2083 }
2084 case CSSPropertyStroke: 2084 case CSSPropertyStroke:
2085 { 2085 {
2086 SVGRenderStyle* svgStyle = state.style()->accessSVGStyle(); 2086 SVGRenderStyle* svgStyle = state.style()->accessSVGStyle();
2087 if (isInherit) { 2087 if (isInherit) {
2088 const SVGRenderStyle* svgParentStyle = state.parentStyle()->svgStyle (); 2088 const SVGRenderStyle* svgParentStyle = state.parentStyle()->svgStyle ();
2089 svgStyle->setStrokePaint(svgParentStyle->strokePaintType(), svgParen tStyle->strokePaintColor(), svgParentStyle->strokePaintUri(), state.applyPropert yToRegularStyle(), state.applyPropertyToVisitedLinkStyle()); 2089 svgStyle->setStrokePaint(svgParentStyle->strokePaintType(), svgParen tStyle->strokePaintColor(), svgParentStyle->strokePaintUri(), state.applyPropert yToRegularStyle(), state.applyPropertyToVisitedLinkStyle());
2090 return; 2090 return;
2091 } 2091 }
2092 if (isInitial) { 2092 if (isInitial) {
2093 svgStyle->setStrokePaint(SVGRenderStyle::initialStrokePaintType(), S VGRenderStyle::initialStrokePaintColor(), SVGRenderStyle::initialStrokePaintUri( ), state.applyPropertyToRegularStyle(), state.applyPropertyToVisitedLinkStyle()) ; 2093 svgStyle->setStrokePaint(SVGRenderStyle::initialStrokePaintType(), S VGRenderStyle::initialStrokePaintColor(), SVGRenderStyle::initialStrokePaintUri( ), state.applyPropertyToRegularStyle(), state.applyPropertyToVisitedLinkStyle()) ;
2094 return; 2094 return;
2095 } 2095 }
2096 if (value->isSVGPaint()) { 2096 if (value->isSVGPaint()) {
2097 SVGPaint* svgPaint = toSVGPaint(value); 2097 SVGPaint* svgPaint = toSVGPaint(value);
2098 svgStyle->setStrokePaint(svgPaint->paintType(), colorFromSVGColorCSS Value(svgPaint, state.style()->color()), svgPaint->uri(), state.applyPropertyToR egularStyle(), state.applyPropertyToVisitedLinkStyle()); 2098 svgStyle->setStrokePaint(svgPaint->paintType(), colorFromSVGPaintCSS Value(svgPaint, state.style()->color()), svgPaint->uri(), state.applyPropertyToR egularStyle(), state.applyPropertyToVisitedLinkStyle());
2099 } 2099 }
2100 break; 2100 break;
2101 } 2101 }
2102 case CSSPropertyStrokeDasharray: 2102 case CSSPropertyStrokeDasharray:
2103 { 2103 {
2104 HANDLE_SVG_INHERIT_AND_INITIAL(strokeDashArray, StrokeDashArray) 2104 HANDLE_SVG_INHERIT_AND_INITIAL(strokeDashArray, StrokeDashArray)
2105 if (!value->isValueList()) { 2105 if (!value->isValueList()) {
2106 state.style()->accessSVGStyle()->setStrokeDashArray(SVGRenderStyle:: initialStrokeDashArray()); 2106 state.style()->accessSVGStyle()->setStrokeDashArray(SVGRenderStyle:: initialStrokeDashArray());
2107 break; 2107 break;
2108 } 2108 }
(...skipping 10 matching lines...) Expand all
2119 CSSPrimitiveValue* dash = toCSSPrimitiveValue(dashes->itemWithoutBou ndsCheck(i)); 2119 CSSPrimitiveValue* dash = toCSSPrimitiveValue(dashes->itemWithoutBou ndsCheck(i));
2120 array->append(SVGLength::fromCSSPrimitiveValue(dash)); 2120 array->append(SVGLength::fromCSSPrimitiveValue(dash));
2121 } 2121 }
2122 2122
2123 state.style()->accessSVGStyle()->setStrokeDashArray(array.release()); 2123 state.style()->accessSVGStyle()->setStrokeDashArray(array.release());
2124 break; 2124 break;
2125 } 2125 }
2126 case CSSPropertyStopColor: 2126 case CSSPropertyStopColor:
2127 { 2127 {
2128 HANDLE_SVG_INHERIT_AND_INITIAL(stopColor, StopColor); 2128 HANDLE_SVG_INHERIT_AND_INITIAL(stopColor, StopColor);
2129 if (value->isSVGColor()) 2129 if (primitiveValue->isRGBColor())
2130 state.style()->accessSVGStyle()->setStopColor(colorFromSVGColorCSSVa lue(toSVGColor(value), state.style()->color())); 2130 state.style()->accessSVGStyle()->setStopColor(primitiveValue->getRGB A32Value());
2131 else if (primitiveValue->getValueID() == CSSValueCurrentcolor)
2132 state.style()->accessSVGStyle()->setStopColor(state.style()->color() );
2131 break; 2133 break;
2132 } 2134 }
2133 case CSSPropertyLightingColor: 2135 case CSSPropertyLightingColor:
2134 { 2136 {
2135 HANDLE_SVG_INHERIT_AND_INITIAL(lightingColor, LightingColor); 2137 HANDLE_SVG_INHERIT_AND_INITIAL(lightingColor, LightingColor);
2136 if (value->isSVGColor()) 2138 if (primitiveValue->isRGBColor())
2137 state.style()->accessSVGStyle()->setLightingColor(colorFromSVGColorC SSValue(toSVGColor(value), state.style()->color())); 2139 state.style()->accessSVGStyle()->setLightingColor(primitiveValue->ge tRGBA32Value());
2140 else if (primitiveValue->getValueID() == CSSValueCurrentcolor)
2141 state.style()->accessSVGStyle()->setLightingColor(state.style()->col or());
2138 break; 2142 break;
2139 } 2143 }
2140 case CSSPropertyFloodColor: 2144 case CSSPropertyFloodColor:
2141 { 2145 {
2142 HANDLE_SVG_INHERIT_AND_INITIAL(floodColor, FloodColor); 2146 HANDLE_SVG_INHERIT_AND_INITIAL(floodColor, FloodColor);
2143 if (value->isSVGColor()) 2147 if (primitiveValue->isRGBColor())
2144 state.style()->accessSVGStyle()->setFloodColor(colorFromSVGColorCSSV alue(toSVGColor(value), state.style()->color())); 2148 state.style()->accessSVGStyle()->setFloodColor(primitiveValue->getRG BA32Value());
2149 else if (primitiveValue->getValueID() == CSSValueCurrentcolor)
2150 state.style()->accessSVGStyle()->setFloodColor(state.style()->color( ));
2145 break; 2151 break;
2146 } 2152 }
2147 case CSSPropertyGlyphOrientationHorizontal: 2153 case CSSPropertyGlyphOrientationHorizontal:
2148 { 2154 {
2149 HANDLE_SVG_INHERIT_AND_INITIAL(glyphOrientationHorizontal, GlyphOrientat ionHorizontal) 2155 HANDLE_SVG_INHERIT_AND_INITIAL(glyphOrientationHorizontal, GlyphOrientat ionHorizontal)
2150 EGlyphOrientation orientation; 2156 EGlyphOrientation orientation;
2151 if (degreeToGlyphOrientation(primitiveValue, orientation)) 2157 if (degreeToGlyphOrientation(primitiveValue, orientation))
2152 state.style()->accessSVGStyle()->setGlyphOrientationHorizontal(orien tation); 2158 state.style()->accessSVGStyle()->setGlyphOrientationHorizontal(orien tation);
2153 break; 2159 break;
2154 } 2160 }
(...skipping 16 matching lines...) Expand all
2171 break; 2177 break;
2172 } 2178 }
2173 case CSSPropertyEnableBackground: 2179 case CSSPropertyEnableBackground:
2174 // Silently ignoring this property for now 2180 // Silently ignoring this property for now
2175 // http://bugs.webkit.org/show_bug.cgi?id=6022 2181 // http://bugs.webkit.org/show_bug.cgi?id=6022
2176 break; 2182 break;
2177 } 2183 }
2178 } 2184 }
2179 2185
2180 } // namespace WebCore 2186 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/css/parser/CSSPropertyParser.cpp ('k') | Source/core/svg/SVGAnimatedColor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698