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

Side by Side Diff: Source/core/css/LayoutStyleCSSValueMapping.cpp

Issue 983103003: Use Length for the stroke-width property in SVGLayoutStyle (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: lengthSetterForProperty Created 5 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/css/CSSProperties.in ('k') | Source/core/css/resolver/AnimatedStyleBuilder.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) 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 return cssValuePool().createValue(value / style.effectiveZoom(), CSSPrimitiv eValue::CSS_NUMBER); 65 return cssValuePool().createValue(value / style.effectiveZoom(), CSSPrimitiv eValue::CSS_NUMBER);
66 } 66 }
67 67
68 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> zoomAdjustedPixelValueForLength (const Length& length, const LayoutStyle& style) 68 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> zoomAdjustedPixelValueForLength (const Length& length, const LayoutStyle& style)
69 { 69 {
70 if (length.isFixed()) 70 if (length.isFixed())
71 return zoomAdjustedPixelValue(length.value(), style); 71 return zoomAdjustedPixelValue(length.value(), style);
72 return cssValuePool().createValue(length, style); 72 return cssValuePool().createValue(length, style);
73 } 73 }
74 74
75 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> pixelValueForUnzoomedLength(con st UnzoomedLength& unzoomedLength, const LayoutStyle& style)
76 {
77 const Length& length = unzoomedLength.length();
78 if (length.isFixed())
79 return cssValuePool().createValue(length.value(), CSSPrimitiveValue::CSS _PX);
80 return cssValuePool().createValue(length, style);
81 }
82
75 static PassRefPtrWillBeRawPtr<CSSValueList> createPositionListForLayer(CSSProper tyID propertyID, const FillLayer& layer, const LayoutStyle& style) 83 static PassRefPtrWillBeRawPtr<CSSValueList> createPositionListForLayer(CSSProper tyID propertyID, const FillLayer& layer, const LayoutStyle& style)
76 { 84 {
77 RefPtrWillBeRawPtr<CSSValueList> positionList = CSSValueList::createSpaceSep arated(); 85 RefPtrWillBeRawPtr<CSSValueList> positionList = CSSValueList::createSpaceSep arated();
78 if (layer.isBackgroundXOriginSet()) { 86 if (layer.isBackgroundXOriginSet()) {
79 ASSERT_UNUSED(propertyID, propertyID == CSSPropertyBackgroundPosition || propertyID == CSSPropertyWebkitMaskPosition); 87 ASSERT_UNUSED(propertyID, propertyID == CSSPropertyBackgroundPosition || propertyID == CSSPropertyWebkitMaskPosition);
80 positionList->append(cssValuePool().createValue(layer.backgroundXOrigin( ))); 88 positionList->append(cssValuePool().createValue(layer.backgroundXOrigin( )));
81 } 89 }
82 positionList->append(zoomAdjustedPixelValueForLength(layer.xPosition(), styl e)); 90 positionList->append(zoomAdjustedPixelValueForLength(layer.xPosition(), styl e));
83 if (layer.isBackgroundYOriginSet()) { 91 if (layer.isBackgroundYOriginSet()) {
84 ASSERT(propertyID == CSSPropertyBackgroundPosition || propertyID == CSSP ropertyWebkitMaskPosition); 92 ASSERT(propertyID == CSSPropertyBackgroundPosition || propertyID == CSSP ropertyWebkitMaskPosition);
(...skipping 2430 matching lines...) Expand 10 before | Expand all | Expand 10 after
2515 if (!svgStyle.markerStartResource().isEmpty()) 2523 if (!svgStyle.markerStartResource().isEmpty())
2516 return CSSPrimitiveValue::create(serializeAsFragmentIdentifier(svgSt yle.markerStartResource()), CSSPrimitiveValue::CSS_URI); 2524 return CSSPrimitiveValue::create(serializeAsFragmentIdentifier(svgSt yle.markerStartResource()), CSSPrimitiveValue::CSS_URI);
2517 return CSSPrimitiveValue::createIdentifier(CSSValueNone); 2525 return CSSPrimitiveValue::createIdentifier(CSSValueNone);
2518 case CSSPropertyStroke: 2526 case CSSPropertyStroke:
2519 return adjustSVGPaintForCurrentColor(svgStyle.strokePaintType(), svgStyl e.strokePaintUri(), svgStyle.strokePaintColor(), style.color()); 2527 return adjustSVGPaintForCurrentColor(svgStyle.strokePaintType(), svgStyl e.strokePaintUri(), svgStyle.strokePaintColor(), style.color());
2520 case CSSPropertyStrokeDasharray: 2528 case CSSPropertyStrokeDasharray:
2521 return strokeDashArrayToCSSValueList(*svgStyle.strokeDashArray(), style) ; 2529 return strokeDashArrayToCSSValueList(*svgStyle.strokeDashArray(), style) ;
2522 case CSSPropertyStrokeDashoffset: 2530 case CSSPropertyStrokeDashoffset:
2523 return zoomAdjustedPixelValueForLength(svgStyle.strokeDashOffset(), styl e); 2531 return zoomAdjustedPixelValueForLength(svgStyle.strokeDashOffset(), styl e);
2524 case CSSPropertyStrokeWidth: 2532 case CSSPropertyStrokeWidth:
2525 return SVGLength::toCSSPrimitiveValue(svgStyle.strokeWidth()); 2533 return pixelValueForUnzoomedLength(svgStyle.strokeWidth(), style);
2526 case CSSPropertyBaselineShift: { 2534 case CSSPropertyBaselineShift: {
2527 switch (svgStyle.baselineShift()) { 2535 switch (svgStyle.baselineShift()) {
2528 case BS_SUPER: 2536 case BS_SUPER:
2529 return CSSPrimitiveValue::createIdentifier(CSSValueSuper); 2537 return CSSPrimitiveValue::createIdentifier(CSSValueSuper);
2530 case BS_SUB: 2538 case BS_SUB:
2531 return CSSPrimitiveValue::createIdentifier(CSSValueSub); 2539 return CSSPrimitiveValue::createIdentifier(CSSValueSub);
2532 case BS_LENGTH: 2540 case BS_LENGTH:
2533 return zoomAdjustedPixelValueForLength(svgStyle.baselineShiftValue() , style); 2541 return zoomAdjustedPixelValueForLength(svgStyle.baselineShiftValue() , style);
2534 } 2542 }
2535 ASSERT_NOT_REACHED(); 2543 ASSERT_NOT_REACHED();
(...skipping 30 matching lines...) Expand all
2566 return zoomAdjustedPixelValueForLength(svgStyle.ry(), style); 2574 return zoomAdjustedPixelValueForLength(svgStyle.ry(), style);
2567 2575
2568 case CSSPropertyAll: 2576 case CSSPropertyAll:
2569 return nullptr; 2577 return nullptr;
2570 } 2578 }
2571 ASSERT_NOT_REACHED(); 2579 ASSERT_NOT_REACHED();
2572 return nullptr; 2580 return nullptr;
2573 } 2581 }
2574 2582
2575 } 2583 }
OLDNEW
« no previous file with comments | « Source/core/css/CSSProperties.in ('k') | Source/core/css/resolver/AnimatedStyleBuilder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698