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) Research In Motion Limited 2010. All rights reserved. | 3 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
4 * Copyright 2014 The Chromium Authors. All rights reserved. | 4 * Copyright 2014 The Chromium Authors. All rights reserved. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 ASSERT(client); | 62 ASSERT(client); |
63 m_patternMap.remove(client); | 63 m_patternMap.remove(client); |
64 markClientForInvalidation( | 64 markClientForInvalidation( |
65 client, markForInvalidation ? PaintInvalidation : ParentOnlyInvalidation); | 65 client, markForInvalidation ? PaintInvalidation : ParentOnlyInvalidation); |
66 } | 66 } |
67 | 67 |
68 PatternData* LayoutSVGResourcePattern::patternForLayoutObject( | 68 PatternData* LayoutSVGResourcePattern::patternForLayoutObject( |
69 const LayoutObject& object) { | 69 const LayoutObject& object) { |
70 ASSERT(!m_shouldCollectPatternAttributes); | 70 ASSERT(!m_shouldCollectPatternAttributes); |
71 | 71 |
72 // FIXME: the double hash lookup is needed to guard against paint-time invalid
ation | 72 // FIXME: the double hash lookup is needed to guard against paint-time |
73 // (painting animated images may trigger layout invals which delete our map en
try). | 73 // invalidation (painting animated images may trigger layout invals which |
74 // Hopefully that will be addressed at some point, and then we can optimize th
e lookup. | 74 // delete our map entry). Hopefully that will be addressed at some point, and |
| 75 // then we can optimize the lookup. |
75 if (PatternData* currentData = m_patternMap.get(&object)) | 76 if (PatternData* currentData = m_patternMap.get(&object)) |
76 return currentData; | 77 return currentData; |
77 | 78 |
78 return m_patternMap.set(&object, buildPatternData(object)) | 79 return m_patternMap.set(&object, buildPatternData(object)) |
79 .storedValue->value.get(); | 80 .storedValue->value.get(); |
80 } | 81 } |
81 | 82 |
82 std::unique_ptr<PatternData> LayoutSVGResourcePattern::buildPatternData( | 83 std::unique_ptr<PatternData> LayoutSVGResourcePattern::buildPatternData( |
83 const LayoutObject& object) { | 84 const LayoutObject& object) { |
84 // If we couldn't determine the pattern content element root, stop here. | 85 // If we couldn't determine the pattern content element root, stop here. |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 return SVGPaintServer::invalid(); | 135 return SVGPaintServer::invalid(); |
135 | 136 |
136 if (m_shouldCollectPatternAttributes) { | 137 if (m_shouldCollectPatternAttributes) { |
137 patternElement->synchronizeAnimatedSVGAttribute(anyQName()); | 138 patternElement->synchronizeAnimatedSVGAttribute(anyQName()); |
138 | 139 |
139 m_attributesWrapper->set(PatternAttributes()); | 140 m_attributesWrapper->set(PatternAttributes()); |
140 patternElement->collectPatternAttributes(mutableAttributes()); | 141 patternElement->collectPatternAttributes(mutableAttributes()); |
141 m_shouldCollectPatternAttributes = false; | 142 m_shouldCollectPatternAttributes = false; |
142 } | 143 } |
143 | 144 |
144 // Spec: When the geometry of the applicable element has no width or height an
d objectBoundingBox is specified, | 145 // Spec: When the geometry of the applicable element has no width or height |
145 // then the given effect (e.g. a gradient or a filter) will be ignored. | 146 // and objectBoundingBox is specified, then the given effect (e.g. a gradient |
| 147 // or a filter) will be ignored. |
146 FloatRect objectBoundingBox = object.objectBoundingBox(); | 148 FloatRect objectBoundingBox = object.objectBoundingBox(); |
147 if (attributes().patternUnits() == | 149 if (attributes().patternUnits() == |
148 SVGUnitTypes::kSvgUnitTypeObjectboundingbox && | 150 SVGUnitTypes::kSvgUnitTypeObjectboundingbox && |
149 objectBoundingBox.isEmpty()) | 151 objectBoundingBox.isEmpty()) |
150 return SVGPaintServer::invalid(); | 152 return SVGPaintServer::invalid(); |
151 | 153 |
152 PatternData* patternData = patternForLayoutObject(object); | 154 PatternData* patternData = patternForLayoutObject(object); |
153 if (!patternData || !patternData->pattern) | 155 if (!patternData || !patternData->pattern) |
154 return SVGPaintServer::invalid(); | 156 return SVGPaintServer::invalid(); |
155 | 157 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 *patternLayoutObject, tileTransform); | 210 *patternLayoutObject, tileTransform); |
209 for (LayoutObject* child = patternLayoutObject->firstChild(); child; | 211 for (LayoutObject* child = patternLayoutObject->firstChild(); child; |
210 child = child->nextSibling()) | 212 child = child->nextSibling()) |
211 SVGPaintContext::paintSubtree(pictureBuilder.context(), child); | 213 SVGPaintContext::paintSubtree(pictureBuilder.context(), child); |
212 } | 214 } |
213 | 215 |
214 return pictureBuilder.endRecording(); | 216 return pictureBuilder.endRecording(); |
215 } | 217 } |
216 | 218 |
217 } // namespace blink | 219 } // namespace blink |
OLD | NEW |