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 27 matching lines...) Expand all Loading... |
38 markAllClientsForInvalidation(markForInvalidation ? PaintInvalidation : Pare
ntOnlyInvalidation); | 38 markAllClientsForInvalidation(markForInvalidation ? PaintInvalidation : Pare
ntOnlyInvalidation); |
39 } | 39 } |
40 | 40 |
41 void RenderSVGResourceGradient::removeClientFromCache(RenderObject* client, bool
markForInvalidation) | 41 void RenderSVGResourceGradient::removeClientFromCache(RenderObject* client, bool
markForInvalidation) |
42 { | 42 { |
43 ASSERT(client); | 43 ASSERT(client); |
44 m_gradientMap.remove(client); | 44 m_gradientMap.remove(client); |
45 markClientForInvalidation(client, markForInvalidation ? PaintInvalidation :
ParentOnlyInvalidation); | 45 markClientForInvalidation(client, markForInvalidation ? PaintInvalidation :
ParentOnlyInvalidation); |
46 } | 46 } |
47 | 47 |
48 SVGPaintServer RenderSVGResourceGradient::preparePaintServer(RenderObject* objec
t) | 48 SVGPaintServer RenderSVGResourceGradient::preparePaintServer(const RenderObject&
object) |
49 { | 49 { |
50 ASSERT(object); | |
51 | |
52 clearInvalidationMask(); | 50 clearInvalidationMask(); |
53 | 51 |
54 // Be sure to synchronize all SVG properties on the gradientElement _before_
processing any further. | 52 // Be sure to synchronize all SVG properties on the gradientElement _before_
processing any further. |
55 // Otherwhise the call to collectGradientAttributes() in createTileImage(),
may cause the SVG DOM property | 53 // Otherwhise the call to collectGradientAttributes() in createTileImage(),
may cause the SVG DOM property |
56 // synchronization to kick in, which causes removeAllClientsFromCache() to b
e called, which in turn deletes our | 54 // synchronization to kick in, which causes removeAllClientsFromCache() to b
e called, which in turn deletes our |
57 // GradientData object! Leaving out the line below will cause svg/dynamic-up
dates/SVG*GradientElement-svgdom* to crash. | 55 // GradientData object! Leaving out the line below will cause svg/dynamic-up
dates/SVG*GradientElement-svgdom* to crash. |
58 SVGGradientElement* gradientElement = toSVGGradientElement(element()); | 56 SVGGradientElement* gradientElement = toSVGGradientElement(element()); |
59 if (!gradientElement) | 57 if (!gradientElement) |
60 return SVGPaintServer::invalid(); | 58 return SVGPaintServer::invalid(); |
61 | 59 |
62 if (m_shouldCollectGradientAttributes) { | 60 if (m_shouldCollectGradientAttributes) { |
63 gradientElement->synchronizeAnimatedSVGAttribute(anyQName()); | 61 gradientElement->synchronizeAnimatedSVGAttribute(anyQName()); |
64 if (!collectGradientAttributes(gradientElement)) | 62 if (!collectGradientAttributes(gradientElement)) |
65 return SVGPaintServer::invalid(); | 63 return SVGPaintServer::invalid(); |
66 | 64 |
67 m_shouldCollectGradientAttributes = false; | 65 m_shouldCollectGradientAttributes = false; |
68 } | 66 } |
69 | 67 |
70 // Spec: When the geometry of the applicable element has no width or height
and objectBoundingBox is specified, | 68 // 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. | 69 // then the given effect (e.g. a gradient or a filter) will be ignored. |
72 FloatRect objectBoundingBox = object->objectBoundingBox(); | 70 FloatRect objectBoundingBox = object.objectBoundingBox(); |
73 if (gradientUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX && obje
ctBoundingBox.isEmpty()) | 71 if (gradientUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX && obje
ctBoundingBox.isEmpty()) |
74 return SVGPaintServer::invalid(); | 72 return SVGPaintServer::invalid(); |
75 | 73 |
76 OwnPtr<GradientData>& gradientData = m_gradientMap.add(object, nullptr).stor
edValue->value; | 74 OwnPtr<GradientData>& gradientData = m_gradientMap.add(&object, nullptr).sto
redValue->value; |
77 if (!gradientData) | 75 if (!gradientData) |
78 gradientData = adoptPtr(new GradientData); | 76 gradientData = adoptPtr(new GradientData); |
79 | 77 |
80 // Create gradient object | 78 // Create gradient object |
81 if (!gradientData->gradient) { | 79 if (!gradientData->gradient) { |
82 buildGradient(gradientData.get()); | 80 buildGradient(gradientData.get()); |
83 | 81 |
84 // We want the text bounding box applied to the gradient space transform
now, so the gradient shader can use it. | 82 // 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()) { | 83 if (gradientUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX &&
!objectBoundingBox.isEmpty()) { |
86 gradientData->userspaceTransform.translate(objectBoundingBox.x(), ob
jectBoundingBox.y()); | 84 gradientData->userspaceTransform.translate(objectBoundingBox.x(), ob
jectBoundingBox.y()); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 return SpreadMethodReflect; | 132 return SpreadMethodReflect; |
135 case SVGSpreadMethodRepeat: | 133 case SVGSpreadMethodRepeat: |
136 return SpreadMethodRepeat; | 134 return SpreadMethodRepeat; |
137 } | 135 } |
138 | 136 |
139 ASSERT_NOT_REACHED(); | 137 ASSERT_NOT_REACHED(); |
140 return SpreadMethodPad; | 138 return SpreadMethodPad; |
141 } | 139 } |
142 | 140 |
143 } | 141 } |
OLD | NEW |