| 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. | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. |
| 4 * All rights reserved. | 4 * All rights reserved. |
| 5 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> | 5 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> |
| 6 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> | 6 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> |
| 7 * Copyright (C) 2011 Sencha, Inc. All rights reserved. | 7 * Copyright (C) 2011 Sencha, Inc. All rights reserved. |
| 8 * Copyright (C) 2015 Google Inc. All rights reserved. | 8 * Copyright (C) 2015 Google Inc. All rights reserved. |
| 9 * | 9 * |
| 10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 return zoomAdjustedPixelValue(length.value(), style); | 91 return zoomAdjustedPixelValue(length.value(), style); |
| 92 } | 92 } |
| 93 | 93 |
| 94 static CSSValue* zoomAdjustedPixelValueForLength(const Length& length, | 94 static CSSValue* zoomAdjustedPixelValueForLength(const Length& length, |
| 95 const ComputedStyle& style) { | 95 const ComputedStyle& style) { |
| 96 if (length.isFixed()) | 96 if (length.isFixed()) |
| 97 return zoomAdjustedPixelValue(length.value(), style); | 97 return zoomAdjustedPixelValue(length.value(), style); |
| 98 return CSSValue::create(length, style.effectiveZoom()); | 98 return CSSValue::create(length, style.effectiveZoom()); |
| 99 } | 99 } |
| 100 | 100 |
| 101 static CSSValue* pixelValueForUnzoomedLength( | 101 static CSSValue* pixelValueForUnzoomedLength(const ComputedStyle& style) { |
| 102 const UnzoomedLength& unzoomedLength, | 102 const UnzoomedLength unzoomedLength = style.strokeWidth(); |
| 103 const ComputedStyle& style) { | |
| 104 const Length& length = unzoomedLength.length(); | 103 const Length& length = unzoomedLength.length(); |
| 105 if (length.isFixed()) | 104 if (length.isFixed()) |
| 106 return CSSPrimitiveValue::create(length.value(), | 105 return CSSPrimitiveValue::create(length.value(), |
| 107 CSSPrimitiveValue::UnitType::Pixels); | 106 CSSPrimitiveValue::UnitType::Pixels); |
| 108 return CSSValue::create(length, style.effectiveZoom()); | 107 return CSSValue::create(length, style.effectiveZoom()); |
| 109 } | 108 } |
| 110 | 109 |
| 111 static CSSValueList* createPositionListForLayer(CSSPropertyID propertyID, | 110 static CSSValueList* createPositionListForLayer(CSSPropertyID propertyID, |
| 112 const FillLayer& layer, | 111 const FillLayer& layer, |
| 113 const ComputedStyle& style) { | 112 const ComputedStyle& style) { |
| (...skipping 1544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1658 if (dashes.isEmpty()) | 1657 if (dashes.isEmpty()) |
| 1659 return CSSIdentifierValue::create(CSSValueNone); | 1658 return CSSIdentifierValue::create(CSSValueNone); |
| 1660 | 1659 |
| 1661 CSSValueList* list = CSSValueList::createCommaSeparated(); | 1660 CSSValueList* list = CSSValueList::createCommaSeparated(); |
| 1662 for (const Length& dashLength : dashes.vector()) | 1661 for (const Length& dashLength : dashes.vector()) |
| 1663 list->append(*zoomAdjustedPixelValueForLength(dashLength, style)); | 1662 list->append(*zoomAdjustedPixelValueForLength(dashLength, style)); |
| 1664 | 1663 |
| 1665 return list; | 1664 return list; |
| 1666 } | 1665 } |
| 1667 | 1666 |
| 1668 static CSSValue* paintOrderToCSSValueList(const SVGComputedStyle& svgStyle) { | 1667 static CSSValue* paintOrderToCSSValueList(const ComputedStyle& style) { |
| 1669 CSSValueList* list = CSSValueList::createSpaceSeparated(); | 1668 CSSValueList* list = CSSValueList::createSpaceSeparated(); |
| 1670 for (int i = 0; i < 3; i++) { | 1669 for (int i = 0; i < 3; i++) { |
| 1671 EPaintOrderType paintOrderType = svgStyle.paintOrderType(i); | 1670 EPaintOrderType paintOrderType = style.paintOrderType(i); |
| 1672 switch (paintOrderType) { | 1671 switch (paintOrderType) { |
| 1673 case PT_FILL: | 1672 case PT_FILL: |
| 1674 case PT_STROKE: | 1673 case PT_STROKE: |
| 1675 case PT_MARKERS: | 1674 case PT_MARKERS: |
| 1676 list->append(*CSSIdentifierValue::create(paintOrderType)); | 1675 list->append(*CSSIdentifierValue::create(paintOrderType)); |
| 1677 break; | 1676 break; |
| 1678 case PT_NONE: | 1677 case PT_NONE: |
| 1679 default: | 1678 default: |
| 1680 ASSERT_NOT_REACHED(); | 1679 ASSERT_NOT_REACHED(); |
| 1681 break; | 1680 break; |
| (...skipping 1675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3357 case CSSPropertyOffsetRotate: | 3356 case CSSPropertyOffsetRotate: |
| 3358 case CSSPropertyOffsetRotation: { | 3357 case CSSPropertyOffsetRotation: { |
| 3359 CSSValueList* list = CSSValueList::createSpaceSeparated(); | 3358 CSSValueList* list = CSSValueList::createSpaceSeparated(); |
| 3360 if (style.offsetRotation().type == OffsetRotationAuto) | 3359 if (style.offsetRotation().type == OffsetRotationAuto) |
| 3361 list->append(*CSSIdentifierValue::create(CSSValueAuto)); | 3360 list->append(*CSSIdentifierValue::create(CSSValueAuto)); |
| 3362 list->append(*CSSPrimitiveValue::create( | 3361 list->append(*CSSPrimitiveValue::create( |
| 3363 style.offsetRotation().angle, CSSPrimitiveValue::UnitType::Degrees)); | 3362 style.offsetRotation().angle, CSSPrimitiveValue::UnitType::Degrees)); |
| 3364 return list; | 3363 return list; |
| 3365 } | 3364 } |
| 3366 | 3365 |
| 3366 case CSSPropertyStrokeLinecap: |
| 3367 return CSSIdentifierValue::create(style.capStyle()); |
| 3368 case CSSPropertyStrokeLinejoin: |
| 3369 return CSSIdentifierValue::create(style.joinStyle()); |
| 3370 case CSSPropertyPaintOrder: |
| 3371 return paintOrderToCSSValueList(style); |
| 3372 case CSSPropertyStrokeWidth: |
| 3373 return pixelValueForUnzoomedLength(style); |
| 3374 |
| 3367 // Unimplemented CSS 3 properties (including CSS3 shorthand properties). | 3375 // Unimplemented CSS 3 properties (including CSS3 shorthand properties). |
| 3368 case CSSPropertyWebkitTextEmphasis: | 3376 case CSSPropertyWebkitTextEmphasis: |
| 3369 return nullptr; | 3377 return nullptr; |
| 3370 | 3378 |
| 3371 // Directional properties are resolved by resolveDirectionAwareProperty() | 3379 // Directional properties are resolved by resolveDirectionAwareProperty() |
| 3372 // before the switch. | 3380 // before the switch. |
| 3373 case CSSPropertyBlockSize: | 3381 case CSSPropertyBlockSize: |
| 3374 case CSSPropertyInlineSize: | 3382 case CSSPropertyInlineSize: |
| 3375 case CSSPropertyMaxBlockSize: | 3383 case CSSPropertyMaxBlockSize: |
| 3376 case CSSPropertyMaxInlineSize: | 3384 case CSSPropertyMaxInlineSize: |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3454 return CSSIdentifierValue::create(svgStyle.colorInterpolationFilters()); | 3462 return CSSIdentifierValue::create(svgStyle.colorInterpolationFilters()); |
| 3455 case CSSPropertyFillOpacity: | 3463 case CSSPropertyFillOpacity: |
| 3456 return CSSPrimitiveValue::create(svgStyle.fillOpacity(), | 3464 return CSSPrimitiveValue::create(svgStyle.fillOpacity(), |
| 3457 CSSPrimitiveValue::UnitType::Number); | 3465 CSSPrimitiveValue::UnitType::Number); |
| 3458 case CSSPropertyFillRule: | 3466 case CSSPropertyFillRule: |
| 3459 return CSSIdentifierValue::create(svgStyle.fillRule()); | 3467 return CSSIdentifierValue::create(svgStyle.fillRule()); |
| 3460 case CSSPropertyColorRendering: | 3468 case CSSPropertyColorRendering: |
| 3461 return CSSIdentifierValue::create(svgStyle.colorRendering()); | 3469 return CSSIdentifierValue::create(svgStyle.colorRendering()); |
| 3462 case CSSPropertyShapeRendering: | 3470 case CSSPropertyShapeRendering: |
| 3463 return CSSIdentifierValue::create(svgStyle.shapeRendering()); | 3471 return CSSIdentifierValue::create(svgStyle.shapeRendering()); |
| 3464 case CSSPropertyStrokeLinecap: | |
| 3465 return CSSIdentifierValue::create(svgStyle.capStyle()); | |
| 3466 case CSSPropertyStrokeLinejoin: | |
| 3467 return CSSIdentifierValue::create(svgStyle.joinStyle()); | |
| 3468 case CSSPropertyStrokeMiterlimit: | 3472 case CSSPropertyStrokeMiterlimit: |
| 3469 return CSSPrimitiveValue::create(svgStyle.strokeMiterLimit(), | 3473 return CSSPrimitiveValue::create(svgStyle.strokeMiterLimit(), |
| 3470 CSSPrimitiveValue::UnitType::Number); | 3474 CSSPrimitiveValue::UnitType::Number); |
| 3471 case CSSPropertyStrokeOpacity: | 3475 case CSSPropertyStrokeOpacity: |
| 3472 return CSSPrimitiveValue::create(svgStyle.strokeOpacity(), | 3476 return CSSPrimitiveValue::create(svgStyle.strokeOpacity(), |
| 3473 CSSPrimitiveValue::UnitType::Number); | 3477 CSSPrimitiveValue::UnitType::Number); |
| 3474 case CSSPropertyAlignmentBaseline: | 3478 case CSSPropertyAlignmentBaseline: |
| 3475 return CSSIdentifierValue::create(svgStyle.alignmentBaseline()); | 3479 return CSSIdentifierValue::create(svgStyle.alignmentBaseline()); |
| 3476 case CSSPropertyDominantBaseline: | 3480 case CSSPropertyDominantBaseline: |
| 3477 return CSSIdentifierValue::create(svgStyle.dominantBaseline()); | 3481 return CSSIdentifierValue::create(svgStyle.dominantBaseline()); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3509 return CSSIdentifierValue::create(CSSValueNone); | 3513 return CSSIdentifierValue::create(CSSValueNone); |
| 3510 case CSSPropertyStroke: | 3514 case CSSPropertyStroke: |
| 3511 return adjustSVGPaintForCurrentColor( | 3515 return adjustSVGPaintForCurrentColor( |
| 3512 svgStyle.strokePaintType(), svgStyle.strokePaintUri(), | 3516 svgStyle.strokePaintType(), svgStyle.strokePaintUri(), |
| 3513 svgStyle.strokePaintColor(), style.color()); | 3517 svgStyle.strokePaintColor(), style.color()); |
| 3514 case CSSPropertyStrokeDasharray: | 3518 case CSSPropertyStrokeDasharray: |
| 3515 return strokeDashArrayToCSSValueList(*svgStyle.strokeDashArray(), style); | 3519 return strokeDashArrayToCSSValueList(*svgStyle.strokeDashArray(), style); |
| 3516 case CSSPropertyStrokeDashoffset: | 3520 case CSSPropertyStrokeDashoffset: |
| 3517 return zoomAdjustedPixelValueForLength(svgStyle.strokeDashOffset(), | 3521 return zoomAdjustedPixelValueForLength(svgStyle.strokeDashOffset(), |
| 3518 style); | 3522 style); |
| 3519 case CSSPropertyStrokeWidth: | |
| 3520 return pixelValueForUnzoomedLength(svgStyle.strokeWidth(), style); | |
| 3521 case CSSPropertyBaselineShift: { | 3523 case CSSPropertyBaselineShift: { |
| 3522 switch (svgStyle.baselineShift()) { | 3524 switch (svgStyle.baselineShift()) { |
| 3523 case BS_SUPER: | 3525 case BS_SUPER: |
| 3524 return CSSIdentifierValue::create(CSSValueSuper); | 3526 return CSSIdentifierValue::create(CSSValueSuper); |
| 3525 case BS_SUB: | 3527 case BS_SUB: |
| 3526 return CSSIdentifierValue::create(CSSValueSub); | 3528 return CSSIdentifierValue::create(CSSValueSub); |
| 3527 case BS_LENGTH: | 3529 case BS_LENGTH: |
| 3528 return zoomAdjustedPixelValueForLength(svgStyle.baselineShiftValue(), | 3530 return zoomAdjustedPixelValueForLength(svgStyle.baselineShiftValue(), |
| 3529 style); | 3531 style); |
| 3530 } | 3532 } |
| 3531 ASSERT_NOT_REACHED(); | 3533 ASSERT_NOT_REACHED(); |
| 3532 return nullptr; | 3534 return nullptr; |
| 3533 } | 3535 } |
| 3534 case CSSPropertyBufferedRendering: | 3536 case CSSPropertyBufferedRendering: |
| 3535 return CSSIdentifierValue::create(svgStyle.bufferedRendering()); | 3537 return CSSIdentifierValue::create(svgStyle.bufferedRendering()); |
| 3536 case CSSPropertyPaintOrder: | |
| 3537 return paintOrderToCSSValueList(svgStyle); | |
| 3538 case CSSPropertyVectorEffect: | 3538 case CSSPropertyVectorEffect: |
| 3539 return CSSIdentifierValue::create(svgStyle.vectorEffect()); | 3539 return CSSIdentifierValue::create(svgStyle.vectorEffect()); |
| 3540 case CSSPropertyMaskType: | 3540 case CSSPropertyMaskType: |
| 3541 return CSSIdentifierValue::create(svgStyle.maskType()); | 3541 return CSSIdentifierValue::create(svgStyle.maskType()); |
| 3542 case CSSPropertyMarker: | 3542 case CSSPropertyMarker: |
| 3543 // the above properties are not yet implemented in the engine | 3543 // the above properties are not yet implemented in the engine |
| 3544 return nullptr; | 3544 return nullptr; |
| 3545 case CSSPropertyD: | 3545 case CSSPropertyD: |
| 3546 if (const StylePath* stylePath = svgStyle.d()) | 3546 if (const StylePath* stylePath = svgStyle.d()) |
| 3547 return stylePath->computedCSSValue(); | 3547 return stylePath->computedCSSValue(); |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3663 case CSSPropertyAll: | 3663 case CSSPropertyAll: |
| 3664 return nullptr; | 3664 return nullptr; |
| 3665 default: | 3665 default: |
| 3666 break; | 3666 break; |
| 3667 } | 3667 } |
| 3668 ASSERT_NOT_REACHED(); | 3668 ASSERT_NOT_REACHED(); |
| 3669 return nullptr; | 3669 return nullptr; |
| 3670 } | 3670 } |
| 3671 | 3671 |
| 3672 } // namespace blink | 3672 } // namespace blink |
| OLD | NEW |