| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> |
| 3 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> | 3 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> |
| 4 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org> | 4 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org> |
| 5 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 5 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
| 6 * | 6 * |
| 7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
| 8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
| 9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
| 10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 gradientElement->synchronizeAnimatedSVGAttribute(anyQName()); | 63 gradientElement->synchronizeAnimatedSVGAttribute(anyQName()); |
| 64 if (!collectGradientAttributes(gradientElement)) | 64 if (!collectGradientAttributes(gradientElement)) |
| 65 return SVGPaintServer::invalid(); | 65 return SVGPaintServer::invalid(); |
| 66 | 66 |
| 67 m_shouldCollectGradientAttributes = false; | 67 m_shouldCollectGradientAttributes = false; |
| 68 } | 68 } |
| 69 | 69 |
| 70 // Spec: When the geometry of the applicable element has no width or height
and objectBoundingBox is specified, | 70 // Spec: When the geometry of the applicable element has no width or height
and objectBoundingBox is specified, |
| 71 // then the given effect (e.g. a gradient or a filter) will be ignored. | 71 // then the given effect (e.g. a gradient or a filter) will be ignored. |
| 72 FloatRect objectBoundingBox = object.objectBoundingBox(); | 72 FloatRect objectBoundingBox = object.objectBoundingBox(); |
| 73 if (gradientUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX && obje
ctBoundingBox.isEmpty()) | 73 if (gradientUnits() == SVGUnitTypes::kSvgUnitTypeObjectboundingbox && object
BoundingBox.isEmpty()) |
| 74 return SVGPaintServer::invalid(); | 74 return SVGPaintServer::invalid(); |
| 75 | 75 |
| 76 std::unique_ptr<GradientData>& gradientData = m_gradientMap.add(&object, nul
lptr).storedValue->value; | 76 std::unique_ptr<GradientData>& gradientData = m_gradientMap.add(&object, nul
lptr).storedValue->value; |
| 77 if (!gradientData) | 77 if (!gradientData) |
| 78 gradientData = wrapUnique(new GradientData); | 78 gradientData = wrapUnique(new GradientData); |
| 79 | 79 |
| 80 // Create gradient object | 80 // Create gradient object |
| 81 if (!gradientData->gradient) { | 81 if (!gradientData->gradient) { |
| 82 gradientData->gradient = buildGradient(); | 82 gradientData->gradient = buildGradient(); |
| 83 | 83 |
| 84 // We want the text bounding box applied to the gradient space transform
now, so the gradient shader can use it. | 84 // We want the text bounding box applied to the gradient space transform
now, so the gradient shader can use it. |
| 85 if (gradientUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX &&
!objectBoundingBox.isEmpty()) { | 85 if (gradientUnits() == SVGUnitTypes::kSvgUnitTypeObjectboundingbox && !o
bjectBoundingBox.isEmpty()) { |
| 86 gradientData->userspaceTransform.translate(objectBoundingBox.x(), ob
jectBoundingBox.y()); | 86 gradientData->userspaceTransform.translate(objectBoundingBox.x(), ob
jectBoundingBox.y()); |
| 87 gradientData->userspaceTransform.scaleNonUniform(objectBoundingBox.w
idth(), objectBoundingBox.height()); | 87 gradientData->userspaceTransform.scaleNonUniform(objectBoundingBox.w
idth(), objectBoundingBox.height()); |
| 88 } | 88 } |
| 89 | 89 |
| 90 AffineTransform gradientTransform = calculateGradientTransform(); | 90 AffineTransform gradientTransform = calculateGradientTransform(); |
| 91 gradientData->userspaceTransform *= gradientTransform; | 91 gradientData->userspaceTransform *= gradientTransform; |
| 92 } | 92 } |
| 93 | 93 |
| 94 if (!gradientData->gradient) | 94 if (!gradientData->gradient) |
| 95 return SVGPaintServer::invalid(); | 95 return SVGPaintServer::invalid(); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 124 return SpreadMethodReflect; | 124 return SpreadMethodReflect; |
| 125 case SVGSpreadMethodRepeat: | 125 case SVGSpreadMethodRepeat: |
| 126 return SpreadMethodRepeat; | 126 return SpreadMethodRepeat; |
| 127 } | 127 } |
| 128 | 128 |
| 129 ASSERT_NOT_REACHED(); | 129 ASSERT_NOT_REACHED(); |
| 130 return SpreadMethodPad; | 130 return SpreadMethodPad; |
| 131 } | 131 } |
| 132 | 132 |
| 133 } // namespace blink | 133 } // namespace blink |
| OLD | NEW |