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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 { | 49 { |
50 } | 50 } |
51 | 51 |
52 void RenderSVGResourcePattern::removeAllClientsFromCache(bool markForInvalidatio
n) | 52 void RenderSVGResourcePattern::removeAllClientsFromCache(bool markForInvalidatio
n) |
53 { | 53 { |
54 m_patternMap.clear(); | 54 m_patternMap.clear(); |
55 m_shouldCollectPatternAttributes = true; | 55 m_shouldCollectPatternAttributes = true; |
56 markAllClientsForInvalidation(markForInvalidation ? PaintInvalidation : Pare
ntOnlyInvalidation); | 56 markAllClientsForInvalidation(markForInvalidation ? PaintInvalidation : Pare
ntOnlyInvalidation); |
57 } | 57 } |
58 | 58 |
59 void RenderSVGResourcePattern::removeClientFromCache(RenderObject* client, bool
markForInvalidation) | 59 void RenderSVGResourcePattern::removeClientFromCache(LayoutObject* client, bool
markForInvalidation) |
60 { | 60 { |
61 ASSERT(client); | 61 ASSERT(client); |
62 m_patternMap.remove(client); | 62 m_patternMap.remove(client); |
63 markClientForInvalidation(client, markForInvalidation ? PaintInvalidation :
ParentOnlyInvalidation); | 63 markClientForInvalidation(client, markForInvalidation ? PaintInvalidation :
ParentOnlyInvalidation); |
64 } | 64 } |
65 | 65 |
66 PatternData* RenderSVGResourcePattern::patternForRenderer(const RenderObject& ob
ject) | 66 PatternData* RenderSVGResourcePattern::patternForRenderer(const LayoutObject& ob
ject) |
67 { | 67 { |
68 ASSERT(!m_shouldCollectPatternAttributes); | 68 ASSERT(!m_shouldCollectPatternAttributes); |
69 | 69 |
70 // FIXME: the double hash lookup is needed to guard against paint-time inval
idation | 70 // FIXME: the double hash lookup is needed to guard against paint-time inval
idation |
71 // (painting animated images may trigger layout invals which delete our map
entry). | 71 // (painting animated images may trigger layout invals which delete our map
entry). |
72 // Hopefully that will be addressed at some point, and then we can optimize
the lookup. | 72 // Hopefully that will be addressed at some point, and then we can optimize
the lookup. |
73 if (PatternData* currentData = m_patternMap.get(&object)) | 73 if (PatternData* currentData = m_patternMap.get(&object)) |
74 return currentData; | 74 return currentData; |
75 | 75 |
76 return m_patternMap.set(&object, buildPatternData(object)).storedValue->valu
e.get(); | 76 return m_patternMap.set(&object, buildPatternData(object)).storedValue->valu
e.get(); |
77 } | 77 } |
78 | 78 |
79 PassOwnPtr<PatternData> RenderSVGResourcePattern::buildPatternData(const RenderO
bject& object) | 79 PassOwnPtr<PatternData> RenderSVGResourcePattern::buildPatternData(const LayoutO
bject& object) |
80 { | 80 { |
81 // If we couldn't determine the pattern content element root, stop here. | 81 // If we couldn't determine the pattern content element root, stop here. |
82 const PatternAttributes& attributes = this->attributes(); | 82 const PatternAttributes& attributes = this->attributes(); |
83 if (!attributes.patternContentElement()) | 83 if (!attributes.patternContentElement()) |
84 return nullptr; | 84 return nullptr; |
85 | 85 |
86 // An empty viewBox disables rendering. | 86 // An empty viewBox disables rendering. |
87 if (attributes.hasViewBox() && attributes.viewBox().isEmpty()) | 87 if (attributes.hasViewBox() && attributes.viewBox().isEmpty()) |
88 return nullptr; | 88 return nullptr; |
89 | 89 |
(...skipping 23 matching lines...) Expand all Loading... |
113 | 113 |
114 // Compute pattern space transformation. | 114 // Compute pattern space transformation. |
115 patternData->transform.translate(tileBounds.x(), tileBounds.y()); | 115 patternData->transform.translate(tileBounds.x(), tileBounds.y()); |
116 AffineTransform patternTransform = attributes.patternTransform(); | 116 AffineTransform patternTransform = attributes.patternTransform(); |
117 if (!patternTransform.isIdentity()) | 117 if (!patternTransform.isIdentity()) |
118 patternData->transform = patternTransform * patternData->transform; | 118 patternData->transform = patternTransform * patternData->transform; |
119 | 119 |
120 return patternData.release(); | 120 return patternData.release(); |
121 } | 121 } |
122 | 122 |
123 SVGPaintServer RenderSVGResourcePattern::preparePaintServer(const RenderObject&
object) | 123 SVGPaintServer RenderSVGResourcePattern::preparePaintServer(const LayoutObject&
object) |
124 { | 124 { |
125 clearInvalidationMask(); | 125 clearInvalidationMask(); |
126 | 126 |
127 SVGPatternElement* patternElement = toSVGPatternElement(element()); | 127 SVGPatternElement* patternElement = toSVGPatternElement(element()); |
128 if (!patternElement) | 128 if (!patternElement) |
129 return SVGPaintServer::invalid(); | 129 return SVGPaintServer::invalid(); |
130 | 130 |
131 if (m_shouldCollectPatternAttributes) { | 131 if (m_shouldCollectPatternAttributes) { |
132 patternElement->synchronizeAnimatedSVGAttribute(anyQName()); | 132 patternElement->synchronizeAnimatedSVGAttribute(anyQName()); |
133 | 133 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 ASSERT(attributes().patternContentElement()); | 174 ASSERT(attributes().patternContentElement()); |
175 RenderSVGResourceContainer* patternRenderer = | 175 RenderSVGResourceContainer* patternRenderer = |
176 toRenderSVGResourceContainer(attributes().patternContentElement()->rende
rer()); | 176 toRenderSVGResourceContainer(attributes().patternContentElement()->rende
rer()); |
177 ASSERT(patternRenderer); | 177 ASSERT(patternRenderer); |
178 ASSERT(!patternRenderer->needsLayout()); | 178 ASSERT(!patternRenderer->needsLayout()); |
179 | 179 |
180 SubtreeContentTransformScope contentTransformScope(contentTransform); | 180 SubtreeContentTransformScope contentTransformScope(contentTransform); |
181 | 181 |
182 { | 182 { |
183 TransformRecorder transformRecorder(recordingContext, patternRenderer->d
isplayItemClient(), tileTransform); | 183 TransformRecorder transformRecorder(recordingContext, patternRenderer->d
isplayItemClient(), tileTransform); |
184 for (RenderObject* child = patternRenderer->firstChild(); child; child =
child->nextSibling()) | 184 for (LayoutObject* child = patternRenderer->firstChild(); child; child =
child->nextSibling()) |
185 SVGRenderingContext::renderSubtree(&recordingContext, child); | 185 SVGRenderingContext::renderSubtree(&recordingContext, child); |
186 } | 186 } |
187 | 187 |
188 if (displayItemList) | 188 if (displayItemList) |
189 displayItemList->replay(&recordingContext); | 189 displayItemList->replay(&recordingContext); |
190 return recordingContext.endRecording(); | 190 return recordingContext.endRecording(); |
191 } | 191 } |
192 | 192 |
193 } | 193 } |
OLD | NEW |