OLD | NEW |
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 Loading... |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |