| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 | 55 |
| 56 void RenderSVGResourcePattern::removeClientFromCache(RenderObject* client, bool
markForInvalidation) | 56 void RenderSVGResourcePattern::removeClientFromCache(RenderObject* client, bool
markForInvalidation) |
| 57 { | 57 { |
| 58 ASSERT(client); | 58 ASSERT(client); |
| 59 m_patternMap.remove(client); | 59 m_patternMap.remove(client); |
| 60 markClientForInvalidation(client, markForInvalidation ? PaintInvalidation :
ParentOnlyInvalidation); | 60 markClientForInvalidation(client, markForInvalidation ? PaintInvalidation :
ParentOnlyInvalidation); |
| 61 } | 61 } |
| 62 | 62 |
| 63 PatternData* RenderSVGResourcePattern::patternForRenderer(const RenderObject& ob
ject) | 63 PatternData* RenderSVGResourcePattern::patternForRenderer(const RenderObject& ob
ject) |
| 64 { | 64 { |
| 65 auto addResult = m_patternMap.add(&object, nullptr); | 65 ASSERT(!m_shouldCollectPatternAttributes); |
| 66 OwnPtr<PatternData>& patternData = addResult.storedValue->value; | |
| 67 | 66 |
| 68 if (addResult.isNewEntry) | 67 // FIXME: the double hash lookup is needed to guard against paint-time inval
idation |
| 69 patternData = buildPatternData(object); | 68 // (painting animated images may trigger layout invals which delete our map
entry). |
| 69 // Hopefully that will be addressed at some point, and then we can optimize
the lookup. |
| 70 if (PatternData* currentData = m_patternMap.get(&object)) |
| 71 return currentData; |
| 70 | 72 |
| 71 ASSERT(!m_shouldCollectPatternAttributes); | 73 return m_patternMap.set(&object, buildPatternData(object)).storedValue->valu
e.get(); |
| 72 return patternData.get(); | |
| 73 } | 74 } |
| 74 | 75 |
| 75 PassOwnPtr<PatternData> RenderSVGResourcePattern::buildPatternData(const RenderO
bject& object) | 76 PassOwnPtr<PatternData> RenderSVGResourcePattern::buildPatternData(const RenderO
bject& object) |
| 76 { | 77 { |
| 77 // If we couldn't determine the pattern content element root, stop here. | 78 // If we couldn't determine the pattern content element root, stop here. |
| 78 if (!m_attributes.patternContentElement()) | 79 if (!m_attributes.patternContentElement()) |
| 79 return nullptr; | 80 return nullptr; |
| 80 | 81 |
| 81 // An empty viewBox disables rendering. | 82 // An empty viewBox disables rendering. |
| 82 if (m_attributes.hasViewBox() && m_attributes.viewBox().isEmpty()) | 83 if (m_attributes.hasViewBox() && m_attributes.viewBox().isEmpty()) |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 ASSERT(!patternRenderer->needsLayout()); | 168 ASSERT(!patternRenderer->needsLayout()); |
| 168 | 169 |
| 169 SubtreeContentTransformScope contentTransformScope(contentTransform); | 170 SubtreeContentTransformScope contentTransformScope(contentTransform); |
| 170 for (RenderObject* child = patternRenderer->firstChild(); child; child = chi
ld->nextSibling()) | 171 for (RenderObject* child = patternRenderer->firstChild(); child; child = chi
ld->nextSibling()) |
| 171 SVGRenderingContext::renderSubtree(&recordingContext, child); | 172 SVGRenderingContext::renderSubtree(&recordingContext, child); |
| 172 | 173 |
| 173 return recordingContext.endRecording(); | 174 return recordingContext.endRecording(); |
| 174 } | 175 } |
| 175 | 176 |
| 176 } | 177 } |
| OLD | NEW |