| 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 * | 4 * |
| 5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
| 6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
| 7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
| 8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
| 9 * | 9 * |
| 10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 markAllClientsForInvalidation(markForInvalidation ? PaintInvalidation : Pare
ntOnlyInvalidation); | 45 markAllClientsForInvalidation(markForInvalidation ? PaintInvalidation : Pare
ntOnlyInvalidation); |
| 46 } | 46 } |
| 47 | 47 |
| 48 void RenderSVGResourcePattern::removeClientFromCache(RenderObject* client, bool
markForInvalidation) | 48 void RenderSVGResourcePattern::removeClientFromCache(RenderObject* client, bool
markForInvalidation) |
| 49 { | 49 { |
| 50 ASSERT(client); | 50 ASSERT(client); |
| 51 m_patternMap.remove(client); | 51 m_patternMap.remove(client); |
| 52 markClientForInvalidation(client, markForInvalidation ? PaintInvalidation :
ParentOnlyInvalidation); | 52 markClientForInvalidation(client, markForInvalidation ? PaintInvalidation :
ParentOnlyInvalidation); |
| 53 } | 53 } |
| 54 | 54 |
| 55 PatternData* RenderSVGResourcePattern::buildPattern(RenderObject* object, unsign
ed short resourceMode) | 55 PatternData* RenderSVGResourcePattern::buildPattern(RenderObject* object, const
SVGPatternElement* patternElement) |
| 56 { | 56 { |
| 57 ASSERT(object); | 57 ASSERT(object); |
| 58 PatternData* currentData = m_patternMap.get(object); | 58 PatternData* currentData = m_patternMap.get(object); |
| 59 if (currentData && currentData->pattern) | 59 if (currentData && currentData->pattern) |
| 60 return currentData; | 60 return currentData; |
| 61 | 61 |
| 62 SVGPatternElement* patternElement = toSVGPatternElement(element()); | |
| 63 if (!patternElement) | |
| 64 return 0; | |
| 65 | |
| 66 if (m_shouldCollectPatternAttributes) { | |
| 67 patternElement->synchronizeAnimatedSVGAttribute(anyQName()); | |
| 68 | |
| 69 m_attributes = PatternAttributes(); | |
| 70 patternElement->collectPatternAttributes(m_attributes); | |
| 71 m_shouldCollectPatternAttributes = false; | |
| 72 } | |
| 73 | |
| 74 // If we couldn't determine the pattern content element root, stop here. | 62 // If we couldn't determine the pattern content element root, stop here. |
| 75 if (!m_attributes.patternContentElement()) | 63 if (!m_attributes.patternContentElement()) |
| 76 return 0; | 64 return 0; |
| 77 | 65 |
| 78 // An empty viewBox disables rendering. | 66 // An empty viewBox disables rendering. |
| 79 if (m_attributes.hasViewBox() && m_attributes.viewBox().isEmpty()) | 67 if (m_attributes.hasViewBox() && m_attributes.viewBox().isEmpty()) |
| 80 return 0; | 68 return 0; |
| 81 | 69 |
| 82 // Compute all necessary transformations to build the tile image & the patte
rn. | 70 // Compute all necessary transformations to build the tile image & the patte
rn. |
| 83 FloatRect tileBoundaries; | 71 FloatRect tileBoundaries; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 | 114 |
| 127 bool RenderSVGResourcePattern::applyResource(RenderObject* object, RenderStyle*
style, GraphicsContext*& context, unsigned short resourceMode) | 115 bool RenderSVGResourcePattern::applyResource(RenderObject* object, RenderStyle*
style, GraphicsContext*& context, unsigned short resourceMode) |
| 128 { | 116 { |
| 129 ASSERT(object); | 117 ASSERT(object); |
| 130 ASSERT(style); | 118 ASSERT(style); |
| 131 ASSERT(context); | 119 ASSERT(context); |
| 132 ASSERT(resourceMode != ApplyToDefaultMode); | 120 ASSERT(resourceMode != ApplyToDefaultMode); |
| 133 | 121 |
| 134 clearInvalidationMask(); | 122 clearInvalidationMask(); |
| 135 | 123 |
| 124 SVGPatternElement* patternElement = toSVGPatternElement(element()); |
| 125 if (!patternElement) |
| 126 return false; |
| 127 |
| 128 if (m_shouldCollectPatternAttributes) { |
| 129 patternElement->synchronizeAnimatedSVGAttribute(anyQName()); |
| 130 |
| 131 m_attributes = PatternAttributes(); |
| 132 patternElement->collectPatternAttributes(m_attributes); |
| 133 m_shouldCollectPatternAttributes = false; |
| 134 } |
| 135 |
| 136 // Spec: When the geometry of the applicable element has no width or height
and objectBoundingBox is specified, | 136 // Spec: When the geometry of the applicable element has no width or height
and objectBoundingBox is specified, |
| 137 // then the given effect (e.g. a gradient or a filter) will be ignored. | 137 // then the given effect (e.g. a gradient or a filter) will be ignored. |
| 138 FloatRect objectBoundingBox = object->objectBoundingBox(); | 138 FloatRect objectBoundingBox = object->objectBoundingBox(); |
| 139 if (m_attributes.patternUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDIN
GBOX && objectBoundingBox.isEmpty()) | 139 if (m_attributes.patternUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDIN
GBOX && objectBoundingBox.isEmpty()) |
| 140 return false; | 140 return false; |
| 141 | 141 |
| 142 PatternData* patternData = buildPattern(object, resourceMode); | 142 PatternData* patternData = buildPattern(object, patternElement); |
| 143 if (!patternData) | 143 if (!patternData) |
| 144 return false; | 144 return false; |
| 145 | 145 |
| 146 const SVGRenderStyle& svgStyle = style->svgStyle(); | 146 const SVGRenderStyle& svgStyle = style->svgStyle(); |
| 147 | 147 |
| 148 AffineTransform computedPatternSpaceTransform = computeResourceSpaceTransfor
m(object, patternData->transform, svgStyle, resourceMode); | 148 AffineTransform computedPatternSpaceTransform = computeResourceSpaceTransfor
m(object, patternData->transform, svgStyle, resourceMode); |
| 149 patternData->pattern->setPatternSpaceTransform(computedPatternSpaceTransform
); | 149 patternData->pattern->setPatternSpaceTransform(computedPatternSpaceTransform
); |
| 150 | 150 |
| 151 // Draw pattern | 151 // Draw pattern |
| 152 context->save(); | 152 context->save(); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 continue; | 248 continue; |
| 249 if (element->renderer()->needsLayout()) | 249 if (element->renderer()->needsLayout()) |
| 250 return nullptr; | 250 return nullptr; |
| 251 SVGRenderingContext::renderSubtree(tileImage->context(), element->render
er(), contentTransformation); | 251 SVGRenderingContext::renderSubtree(tileImage->context(), element->render
er(), contentTransformation); |
| 252 } | 252 } |
| 253 | 253 |
| 254 return tileImage.release(); | 254 return tileImage.release(); |
| 255 } | 255 } |
| 256 | 256 |
| 257 } | 257 } |
| OLD | NEW |