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

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

Issue 22482004: Add support for the object-fit CSS property. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase for landing 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 1203 matching lines...) Expand 10 before | Expand all | Expand 10 after
2328 break; 2360 break;
2329 } 2361 }
2330 case CSSPropertyGlyphOrientationHorizontal: 2362 case CSSPropertyGlyphOrientationHorizontal:
2331 { 2363 {
2332 HANDLE_SVG_INHERIT_AND_INITIAL(glyphOrientationHorizontal, GlyphOrientat ionHorizontal) 2364 HANDLE_SVG_INHERIT_AND_INITIAL(glyphOrientationHorizontal, GlyphOrientat ionHorizontal)
2333 EGlyphOrientation orientation; 2365 EGlyphOrientation orientation;
2334 if (degreeToGlyphOrientation(primitiveValue, orientation)) 2366 if (degreeToGlyphOrientation(primitiveValue, orientation))
2335 state.style()->accessSVGStyle()->setGlyphOrientationHorizontal(orien tation); 2367 state.style()->accessSVGStyle()->setGlyphOrientationHorizontal(orien tation);
2336 break; 2368 break;
2337 } 2369 }
2370 case CSSPropertyPaintOrder: {
2371 HANDLE_SVG_INHERIT_AND_INITIAL(paintOrder, PaintOrder)
2372 if (value->isValueList())
2373 state.style()->accessSVGStyle()->setPaintOrder(paintOrderFlattened(v alue));
2374 break;
2375 }
2338 case CSSPropertyGlyphOrientationVertical: 2376 case CSSPropertyGlyphOrientationVertical:
2339 { 2377 {
2340 HANDLE_SVG_INHERIT_AND_INITIAL(glyphOrientationVertical, GlyphOrientatio nVertical) 2378 HANDLE_SVG_INHERIT_AND_INITIAL(glyphOrientationVertical, GlyphOrientatio nVertical)
2341 if (primitiveValue->getValueID() == CSSValueAuto) { 2379 if (primitiveValue->getValueID() == CSSValueAuto) {
2342 state.style()->accessSVGStyle()->setGlyphOrientationVertical(GO_AUTO ); 2380 state.style()->accessSVGStyle()->setGlyphOrientationVertical(GO_AUTO );
2343 break; 2381 break;
2344 } 2382 }
2345 EGlyphOrientation orientation; 2383 EGlyphOrientation orientation;
2346 if (degreeToGlyphOrientation(primitiveValue, orientation)) 2384 if (degreeToGlyphOrientation(primitiveValue, orientation))
2347 state.style()->accessSVGStyle()->setGlyphOrientationVertical(orienta tion); 2385 state.style()->accessSVGStyle()->setGlyphOrientationVertical(orienta tion);
2348 break; 2386 break;
2349 } 2387 }
2350 case CSSPropertyEnableBackground: 2388 case CSSPropertyEnableBackground:
2351 // Silently ignoring this property for now 2389 // Silently ignoring this property for now
2352 // http://bugs.webkit.org/show_bug.cgi?id=6022 2390 // http://bugs.webkit.org/show_bug.cgi?id=6022
2353 break; 2391 break;
2354 } 2392 }
2355 } 2393 }
2356 2394
2357 } // namespace WebCore 2395 } // 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