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

Side by Side Diff: Source/core/css/SVGCSSComputedStyleDeclaration.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/CSSValueKeywords.in ('k') | Source/core/css/SVGCSSParser.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) 2007 Eric Seidel <eric@webkit.org> 2 Copyright (C) 2007 Eric Seidel <eric@webkit.org>
3 Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 3 Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
4 4
5 This library is free software; you can redistribute it and/or 5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public 6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either 7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version. 8 version 2 of the License, or (at your option) any later version.
9 9
10 This library is distributed in the hope that it will be useful, 10 This library is distributed in the hope that it will be useful,
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 return CSSPrimitiveValue::createIdentifier(CSSValueNone); 52 return CSSPrimitiveValue::createIdentifier(CSSValueNone);
53 53
54 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); 54 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
55 const Vector<SVGLength>::const_iterator end = dashes.end(); 55 const Vector<SVGLength>::const_iterator end = dashes.end();
56 for (Vector<SVGLength>::const_iterator it = dashes.begin(); it != end; ++it) 56 for (Vector<SVGLength>::const_iterator it = dashes.begin(); it != end; ++it)
57 list->append(SVGLength::toCSSPrimitiveValue(*it)); 57 list->append(SVGLength::toCSSPrimitiveValue(*it));
58 58
59 return list.release(); 59 return list.release();
60 } 60 }
61 61
62 static PassRefPtr<CSSValue> paintOrderToCSSValueList(EPaintOrder paintorder)
63 {
64 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
65 do {
66 EPaintOrderType paintOrderType = (EPaintOrderType)(paintorder & ((1 << k PaintOrderBitwidth) - 1));
67 switch (paintOrderType) {
68 case PT_FILL:
69 case PT_STROKE:
70 case PT_MARKERS:
71 list->append(CSSPrimitiveValue::create(paintOrderType));
72 break;
73 case PT_NONE:
74 default:
75 ASSERT_NOT_REACHED();
76 break;
77 }
78 } while (paintorder >>= kPaintOrderBitwidth);
79
80 return list.release();
81 }
82
62 PassRefPtr<SVGPaint> CSSComputedStyleDeclaration::adjustSVGPaintForCurrentColor( PassRefPtr<SVGPaint> newPaint, RenderStyle* style) const 83 PassRefPtr<SVGPaint> CSSComputedStyleDeclaration::adjustSVGPaintForCurrentColor( PassRefPtr<SVGPaint> newPaint, RenderStyle* style) const
63 { 84 {
64 RefPtr<SVGPaint> paint = newPaint; 85 RefPtr<SVGPaint> paint = newPaint;
65 if (paint->paintType() == SVGPaint::SVG_PAINTTYPE_CURRENTCOLOR || paint->pai ntType() == SVGPaint::SVG_PAINTTYPE_URI_CURRENTCOLOR) { 86 if (paint->paintType() == SVGPaint::SVG_PAINTTYPE_CURRENTCOLOR || paint->pai ntType() == SVGPaint::SVG_PAINTTYPE_URI_CURRENTCOLOR) {
66 // SVG handles currentColor itself, style->color() is guaranteed not to be currentColor. 87 // SVG handles currentColor itself, style->color() is guaranteed not to be currentColor.
67 ASSERT(!style->color().isCurrentColor()); 88 ASSERT(!style->color().isCurrentColor());
68 paint->setColor(style->color().color()); 89 paint->setColor(style->color().color());
69 } 90 }
70 return paint.release(); 91 return paint.release();
71 } 92 }
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 return glyphOrientationToCSSPrimitiveValue(svgStyle->glyphOrientatio nHorizontal()); 206 return glyphOrientationToCSSPrimitiveValue(svgStyle->glyphOrientatio nHorizontal());
186 case CSSPropertyGlyphOrientationVertical: { 207 case CSSPropertyGlyphOrientationVertical: {
187 if (RefPtr<CSSPrimitiveValue> value = glyphOrientationToCSSPrimitive Value(svgStyle->glyphOrientationVertical())) 208 if (RefPtr<CSSPrimitiveValue> value = glyphOrientationToCSSPrimitive Value(svgStyle->glyphOrientationVertical()))
188 return value.release(); 209 return value.release();
189 210
190 if (svgStyle->glyphOrientationVertical() == GO_AUTO) 211 if (svgStyle->glyphOrientationVertical() == GO_AUTO)
191 return CSSPrimitiveValue::createIdentifier(CSSValueAuto); 212 return CSSPrimitiveValue::createIdentifier(CSSValueAuto);
192 213
193 return 0; 214 return 0;
194 } 215 }
216 case CSSPropertyPaintOrder:
217 return paintOrderToCSSValueList(svgStyle->paintOrder());
195 case CSSPropertyVectorEffect: 218 case CSSPropertyVectorEffect:
196 return CSSPrimitiveValue::create(svgStyle->vectorEffect()); 219 return CSSPrimitiveValue::create(svgStyle->vectorEffect());
197 case CSSPropertyMaskType: 220 case CSSPropertyMaskType:
198 return CSSPrimitiveValue::create(svgStyle->maskType()); 221 return CSSPrimitiveValue::create(svgStyle->maskType());
199 case CSSPropertyMarker: 222 case CSSPropertyMarker:
200 case CSSPropertyEnableBackground: 223 case CSSPropertyEnableBackground:
201 case CSSPropertyColorProfile: 224 case CSSPropertyColorProfile:
202 // the above properties are not yet implemented in the engine 225 // the above properties are not yet implemented in the engine
203 break; 226 break;
204 default: 227 default:
205 // If you crash here, it's because you added a css property and are not handling it 228 // If you crash here, it's because you added a css property and are not handling it
206 // in either this switch statement or the one in CSSComputedStyleDelcara tion::getPropertyCSSValue 229 // in either this switch statement or the one in CSSComputedStyleDelcara tion::getPropertyCSSValue
207 ASSERT_WITH_MESSAGE(0, "unimplemented propertyID: %d", propertyID); 230 ASSERT_WITH_MESSAGE(0, "unimplemented propertyID: %d", propertyID);
208 } 231 }
209 LOG_ERROR("unimplemented propertyID: %d", propertyID); 232 LOG_ERROR("unimplemented propertyID: %d", propertyID);
210 return 0; 233 return 0;
211 } 234 }
212 235
213 } 236 }
OLDNEW
« no previous file with comments | « Source/core/css/CSSValueKeywords.in ('k') | Source/core/css/SVGCSSParser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698