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.erase(client); | 46 m_gradientMap.erase(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_ | 55 // Validate gradient DOM state before building the actual |
56 // processing any further. Otherwhise the call to collectGradientAttributes() | 56 // gradient. This should avoid tearing down the gradient we're |
57 // in createTileImage(), may cause the SVG DOM property synchronization to | 57 // currently working on. Preferably the state validation should have |
58 // kick in, which causes removeAllClientsFromCache() to be called, which in | 58 // no side-effects though. |
59 // turn deletes our GradientData object! Leaving out the line below will cause | |
60 // svg/dynamic-updates/SVG*GradientElement-svgdom* to crash. | |
61 SVGGradientElement* gradientElement = toSVGGradientElement(element()); | |
62 if (!gradientElement) | |
63 return SVGPaintServer::invalid(); | |
64 | |
65 if (m_shouldCollectGradientAttributes) { | 59 if (m_shouldCollectGradientAttributes) { |
66 gradientElement->synchronizeAnimatedSVGAttribute(anyQName()); | 60 if (!collectGradientAttributes()) |
67 if (!collectGradientAttributes(gradientElement)) | |
68 return SVGPaintServer::invalid(); | 61 return SVGPaintServer::invalid(); |
69 | |
70 m_shouldCollectGradientAttributes = false; | 62 m_shouldCollectGradientAttributes = false; |
71 } | 63 } |
72 | 64 |
73 // Spec: When the geometry of the applicable element has no width or height | 65 // Spec: When the geometry of the applicable element has no width or height |
74 // and objectBoundingBox is specified, then the given effect (e.g. a gradient | 66 // and objectBoundingBox is specified, then the given effect (e.g. a gradient |
75 // or a filter) will be ignored. | 67 // or a filter) will be ignored. |
76 FloatRect objectBoundingBox = object.objectBoundingBox(); | 68 FloatRect objectBoundingBox = object.objectBoundingBox(); |
77 if (gradientUnits() == SVGUnitTypes::kSvgUnitTypeObjectboundingbox && | 69 if (gradientUnits() == SVGUnitTypes::kSvgUnitTypeObjectboundingbox && |
78 objectBoundingBox.isEmpty()) | 70 objectBoundingBox.isEmpty()) |
79 return SVGPaintServer::invalid(); | 71 return SVGPaintServer::invalid(); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 return SpreadMethodReflect; | 121 return SpreadMethodReflect; |
130 case SVGSpreadMethodRepeat: | 122 case SVGSpreadMethodRepeat: |
131 return SpreadMethodRepeat; | 123 return SpreadMethodRepeat; |
132 } | 124 } |
133 | 125 |
134 ASSERT_NOT_REACHED(); | 126 ASSERT_NOT_REACHED(); |
135 return SpreadMethodPad; | 127 return SpreadMethodPad; |
136 } | 128 } |
137 | 129 |
138 } // namespace blink | 130 } // namespace blink |
OLD | NEW |