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

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

Issue 14907011: Support 'paint-order' from SVG2. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebased Created 7 years, 4 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/SVGCSSValueKeywords.in ('k') | Source/core/page/RuntimeCSSEnabled.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 1094 matching lines...) Expand 10 before | Expand all | Expand 10 after
1105 static Color colorFromSVGColorCSSValue(SVGColor* svgColor, const StyleColor& fgC olor) 1105 static Color colorFromSVGColorCSSValue(SVGColor* svgColor, const StyleColor& fgC olor)
1106 { 1106 {
1107 Color color; 1107 Color color;
1108 if (svgColor->colorType() == SVGColor::SVG_COLORTYPE_CURRENTCOLOR) 1108 if (svgColor->colorType() == SVGColor::SVG_COLORTYPE_CURRENTCOLOR)
1109 color = fgColor.color(); 1109 color = fgColor.color();
1110 else 1110 else
1111 color = svgColor->color(); 1111 color = svgColor->color();
1112 return color; 1112 return color;
1113 } 1113 }
1114 1114
1115 static EPaintOrder paintOrderFlattened(CSSValue* cssPaintOrder)
1116 {
1117 if (cssPaintOrder->isValueList()) {
1118 int paintOrder = 0;
1119 CSSValueListInspector iter(cssPaintOrder);
1120 for (size_t i = 0; i < iter.length(); i++) {
1121 CSSPrimitiveValue* value = static_cast<CSSPrimitiveValue*>(iter.item (i));
1122
1123 EPaintOrderType paintOrderType = PT_NONE;
1124 switch (value->getValueID()) {
1125 case CSSValueFill:
1126 paintOrderType = PT_FILL;
1127 break;
1128 case CSSValueStroke:
1129 paintOrderType = PT_STROKE;
1130 break;
1131 case CSSValueMarkers:
1132 paintOrderType = PT_MARKERS;
1133 break;
1134 default:
1135 ASSERT_NOT_REACHED();
1136 break;
1137 }
1138
1139 paintOrder |= (paintOrderType << kPaintOrderBitwidth*i);
1140 }
1141 return (EPaintOrder)paintOrder;
1142 }
1143
1144 return PO_NORMAL;
1145 }
1146
1115 static bool numberToFloat(const CSSPrimitiveValue* primitiveValue, float& out) 1147 static bool numberToFloat(const CSSPrimitiveValue* primitiveValue, float& out)
1116 { 1148 {
1117 if (!primitiveValue) 1149 if (!primitiveValue)
1118 return false; 1150 return false;
1119 if (primitiveValue->primitiveType() != CSSPrimitiveValue::CSS_NUMBER) 1151 if (primitiveValue->primitiveType() != CSSPrimitiveValue::CSS_NUMBER)
1120 return false; 1152 return false;
1121 out = primitiveValue->getFloatValue(); 1153 out = primitiveValue->getFloatValue();
1122 return true; 1154 return true;
1123 } 1155 }
1124 1156
(...skipping 1204 matching lines...) Expand 10 before | Expand all | Expand 10 after
2329 break; 2361 break;
2330 } 2362 }
2331 case CSSPropertyGlyphOrientationHorizontal: 2363 case CSSPropertyGlyphOrientationHorizontal:
2332 { 2364 {
2333 HANDLE_SVG_INHERIT_AND_INITIAL(glyphOrientationHorizontal, GlyphOrientat ionHorizontal) 2365 HANDLE_SVG_INHERIT_AND_INITIAL(glyphOrientationHorizontal, GlyphOrientat ionHorizontal)
2334 EGlyphOrientation orientation; 2366 EGlyphOrientation orientation;
2335 if (degreeToGlyphOrientation(primitiveValue, orientation)) 2367 if (degreeToGlyphOrientation(primitiveValue, orientation))
2336 state.style()->accessSVGStyle()->setGlyphOrientationHorizontal(orien tation); 2368 state.style()->accessSVGStyle()->setGlyphOrientationHorizontal(orien tation);
2337 break; 2369 break;
2338 } 2370 }
2371 case CSSPropertyPaintOrder: {
2372 HANDLE_SVG_INHERIT_AND_INITIAL(paintOrder, PaintOrder)
2373 if (value->isValueList())
2374 state.style()->accessSVGStyle()->setPaintOrder(paintOrderFlattened(v alue));
2375 break;
2376 }
2339 case CSSPropertyGlyphOrientationVertical: 2377 case CSSPropertyGlyphOrientationVertical:
2340 { 2378 {
2341 HANDLE_SVG_INHERIT_AND_INITIAL(glyphOrientationVertical, GlyphOrientatio nVertical) 2379 HANDLE_SVG_INHERIT_AND_INITIAL(glyphOrientationVertical, GlyphOrientatio nVertical)
2342 if (primitiveValue->getValueID() == CSSValueAuto) { 2380 if (primitiveValue->getValueID() == CSSValueAuto) {
2343 state.style()->accessSVGStyle()->setGlyphOrientationVertical(GO_AUTO ); 2381 state.style()->accessSVGStyle()->setGlyphOrientationVertical(GO_AUTO );
2344 break; 2382 break;
2345 } 2383 }
2346 EGlyphOrientation orientation; 2384 EGlyphOrientation orientation;
2347 if (degreeToGlyphOrientation(primitiveValue, orientation)) 2385 if (degreeToGlyphOrientation(primitiveValue, orientation))
2348 state.style()->accessSVGStyle()->setGlyphOrientationVertical(orienta tion); 2386 state.style()->accessSVGStyle()->setGlyphOrientationVertical(orienta tion);
2349 break; 2387 break;
2350 } 2388 }
2351 case CSSPropertyEnableBackground: 2389 case CSSPropertyEnableBackground:
2352 // Silently ignoring this property for now 2390 // Silently ignoring this property for now
2353 // http://bugs.webkit.org/show_bug.cgi?id=6022 2391 // http://bugs.webkit.org/show_bug.cgi?id=6022
2354 break; 2392 break;
2355 } 2393 }
2356 } 2394 }
2357 2395
2358 } // namespace WebCore 2396 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/css/SVGCSSValueKeywords.in ('k') | Source/core/page/RuntimeCSSEnabled.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698