| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 ASSERT(client); | 45 ASSERT(client); |
| 46 m_gradientMap.remove(client); | 46 m_gradientMap.remove(client); |
| 47 markClientForInvalidation( | 47 markClientForInvalidation( |
| 48 client, markForInvalidation ? PaintInvalidation : ParentOnlyInvalidation); | 48 client, markForInvalidation ? PaintInvalidation : ParentOnlyInvalidation); |
| 49 } | 49 } |
| 50 | 50 |
| 51 SVGPaintServer LayoutSVGResourceGradient::preparePaintServer( | 51 SVGPaintServer LayoutSVGResourceGradient::preparePaintServer( |
| 52 const LayoutObject& object) { | 52 const LayoutObject& object) { |
| 53 clearInvalidationMask(); | 53 clearInvalidationMask(); |
| 54 | 54 |
| 55 // Be sure to synchronize all SVG properties on the gradientElement _before_ p
rocessing any further. | 55 // Be sure to synchronize all SVG properties on the gradientElement _before_ |
| 56 // Otherwhise the call to collectGradientAttributes() in createTileImage(), ma
y cause the SVG DOM property | 56 // processing any further. Otherwhise the call to collectGradientAttributes() |
| 57 // synchronization to kick in, which causes removeAllClientsFromCache() to be
called, which in turn deletes our | 57 // in createTileImage(), may cause the SVG DOM property synchronization to |
| 58 // GradientData object! Leaving out the line below will cause svg/dynamic-upda
tes/SVG*GradientElement-svgdom* to crash. | 58 // kick in, which causes removeAllClientsFromCache() to be called, which in |
| 59 // turn deletes our GradientData object! Leaving out the line below will cause |
| 60 // svg/dynamic-updates/SVG*GradientElement-svgdom* to crash. |
| 59 SVGGradientElement* gradientElement = toSVGGradientElement(element()); | 61 SVGGradientElement* gradientElement = toSVGGradientElement(element()); |
| 60 if (!gradientElement) | 62 if (!gradientElement) |
| 61 return SVGPaintServer::invalid(); | 63 return SVGPaintServer::invalid(); |
| 62 | 64 |
| 63 if (m_shouldCollectGradientAttributes) { | 65 if (m_shouldCollectGradientAttributes) { |
| 64 gradientElement->synchronizeAnimatedSVGAttribute(anyQName()); | 66 gradientElement->synchronizeAnimatedSVGAttribute(anyQName()); |
| 65 if (!collectGradientAttributes(gradientElement)) | 67 if (!collectGradientAttributes(gradientElement)) |
| 66 return SVGPaintServer::invalid(); | 68 return SVGPaintServer::invalid(); |
| 67 | 69 |
| 68 m_shouldCollectGradientAttributes = false; | 70 m_shouldCollectGradientAttributes = false; |
| 69 } | 71 } |
| 70 | 72 |
| 71 // Spec: When the geometry of the applicable element has no width or height an
d objectBoundingBox is specified, | 73 // Spec: When the geometry of the applicable element has no width or height |
| 72 // then the given effect (e.g. a gradient or a filter) will be ignored. | 74 // and objectBoundingBox is specified, then the given effect (e.g. a gradient |
| 75 // or a filter) will be ignored. |
| 73 FloatRect objectBoundingBox = object.objectBoundingBox(); | 76 FloatRect objectBoundingBox = object.objectBoundingBox(); |
| 74 if (gradientUnits() == SVGUnitTypes::kSvgUnitTypeObjectboundingbox && | 77 if (gradientUnits() == SVGUnitTypes::kSvgUnitTypeObjectboundingbox && |
| 75 objectBoundingBox.isEmpty()) | 78 objectBoundingBox.isEmpty()) |
| 76 return SVGPaintServer::invalid(); | 79 return SVGPaintServer::invalid(); |
| 77 | 80 |
| 78 std::unique_ptr<GradientData>& gradientData = | 81 std::unique_ptr<GradientData>& gradientData = |
| 79 m_gradientMap.add(&object, nullptr).storedValue->value; | 82 m_gradientMap.add(&object, nullptr).storedValue->value; |
| 80 if (!gradientData) | 83 if (!gradientData) |
| 81 gradientData = wrapUnique(new GradientData); | 84 gradientData = wrapUnique(new GradientData); |
| 82 | 85 |
| 83 // Create gradient object | 86 // Create gradient object |
| 84 if (!gradientData->gradient) { | 87 if (!gradientData->gradient) { |
| 85 gradientData->gradient = buildGradient(); | 88 gradientData->gradient = buildGradient(); |
| 86 | 89 |
| 87 // We want the text bounding box applied to the gradient space transform now
, so the gradient shader can use it. | 90 // We want the text bounding box applied to the gradient space transform |
| 91 // now, so the gradient shader can use it. |
| 88 if (gradientUnits() == SVGUnitTypes::kSvgUnitTypeObjectboundingbox && | 92 if (gradientUnits() == SVGUnitTypes::kSvgUnitTypeObjectboundingbox && |
| 89 !objectBoundingBox.isEmpty()) { | 93 !objectBoundingBox.isEmpty()) { |
| 90 gradientData->userspaceTransform.translate(objectBoundingBox.x(), | 94 gradientData->userspaceTransform.translate(objectBoundingBox.x(), |
| 91 objectBoundingBox.y()); | 95 objectBoundingBox.y()); |
| 92 gradientData->userspaceTransform.scaleNonUniform( | 96 gradientData->userspaceTransform.scaleNonUniform( |
| 93 objectBoundingBox.width(), objectBoundingBox.height()); | 97 objectBoundingBox.width(), objectBoundingBox.height()); |
| 94 } | 98 } |
| 95 | 99 |
| 96 AffineTransform gradientTransform = calculateGradientTransform(); | 100 AffineTransform gradientTransform = calculateGradientTransform(); |
| 97 gradientData->userspaceTransform *= gradientTransform; | 101 gradientData->userspaceTransform *= gradientTransform; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 return SpreadMethodReflect; | 136 return SpreadMethodReflect; |
| 133 case SVGSpreadMethodRepeat: | 137 case SVGSpreadMethodRepeat: |
| 134 return SpreadMethodRepeat; | 138 return SpreadMethodRepeat; |
| 135 } | 139 } |
| 136 | 140 |
| 137 ASSERT_NOT_REACHED(); | 141 ASSERT_NOT_REACHED(); |
| 138 return SpreadMethodPad; | 142 return SpreadMethodPad; |
| 139 } | 143 } |
| 140 | 144 |
| 141 } // namespace blink | 145 } // namespace blink |
| OLD | NEW |