OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. | 2 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. |
3 * | 3 * |
4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
8 * | 8 * |
9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 ASSERT(context); | 108 ASSERT(context); |
109 | 109 |
110 AffineTransform contentTransformation; | 110 AffineTransform contentTransformation; |
111 SVGUnitTypes::SVGUnitType contentUnits = toSVGMaskElement(element())->maskCo
ntentUnits()->currentValue()->enumValue(); | 111 SVGUnitTypes::SVGUnitType contentUnits = toSVGMaskElement(element())->maskCo
ntentUnits()->currentValue()->enumValue(); |
112 if (contentUnits == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { | 112 if (contentUnits == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { |
113 contentTransformation.translate(targetBoundingBox.x(), targetBoundingBox
.y()); | 113 contentTransformation.translate(targetBoundingBox.x(), targetBoundingBox
.y()); |
114 contentTransformation.scaleNonUniform(targetBoundingBox.width(), targetB
oundingBox.height()); | 114 contentTransformation.scaleNonUniform(targetBoundingBox.width(), targetB
oundingBox.height()); |
115 context->concatCTM(contentTransformation); | 115 context->concatCTM(contentTransformation); |
116 } | 116 } |
117 | 117 |
118 if (!m_maskContentDisplayList) | 118 if (!m_maskContentDisplayList) { |
119 createDisplayList(context, contentTransformation); | 119 SubtreeContentTransformScope contentTransformScope(contentTransformation
); |
| 120 createDisplayList(context); |
| 121 } |
120 ASSERT(m_maskContentDisplayList); | 122 ASSERT(m_maskContentDisplayList); |
121 context->drawDisplayList(m_maskContentDisplayList.get()); | 123 context->drawDisplayList(m_maskContentDisplayList.get()); |
122 } | 124 } |
123 | 125 |
124 void RenderSVGResourceMasker::createDisplayList(GraphicsContext* context, | 126 void RenderSVGResourceMasker::createDisplayList(GraphicsContext* context) |
125 const AffineTransform& contentTransform) | |
126 { | 127 { |
127 ASSERT(context); | 128 ASSERT(context); |
128 | 129 |
129 // Using strokeBoundingBox (instead of paintInvalidationRectInLocalCoordinat
es) to avoid the intersection | 130 // Using strokeBoundingBox (instead of paintInvalidationRectInLocalCoordinat
es) to avoid the intersection |
130 // with local clips/mask, which may yield incorrect results when mixing obje
ctBoundingBox and | 131 // with local clips/mask, which may yield incorrect results when mixing obje
ctBoundingBox and |
131 // userSpaceOnUse units (http://crbug.com/294900). | 132 // userSpaceOnUse units (http://crbug.com/294900). |
132 FloatRect bounds = strokeBoundingBox(); | 133 FloatRect bounds = strokeBoundingBox(); |
133 context->beginRecording(bounds); | 134 context->beginRecording(bounds); |
134 for (SVGElement* childElement = Traversal<SVGElement>::firstChild(*element()
); childElement; childElement = Traversal<SVGElement>::nextSibling(*childElement
)) { | 135 for (SVGElement* childElement = Traversal<SVGElement>::firstChild(*element()
); childElement; childElement = Traversal<SVGElement>::nextSibling(*childElement
)) { |
135 RenderObject* renderer = childElement->renderer(); | 136 RenderObject* renderer = childElement->renderer(); |
136 if (!renderer) | 137 if (!renderer) |
137 continue; | 138 continue; |
138 RenderStyle* style = renderer->style(); | 139 RenderStyle* style = renderer->style(); |
139 if (!style || style->display() == NONE || style->visibility() != VISIBLE
) | 140 if (!style || style->display() == NONE || style->visibility() != VISIBLE
) |
140 continue; | 141 continue; |
141 | 142 |
142 SVGRenderingContext::renderSubtree(context, renderer, contentTransform); | 143 SVGRenderingContext::renderSubtree(context, renderer); |
143 } | 144 } |
144 m_maskContentDisplayList = context->endRecording(); | 145 m_maskContentDisplayList = context->endRecording(); |
145 } | 146 } |
146 | 147 |
147 void RenderSVGResourceMasker::calculateMaskContentPaintInvalidationRect() | 148 void RenderSVGResourceMasker::calculateMaskContentPaintInvalidationRect() |
148 { | 149 { |
149 for (SVGElement* childElement = Traversal<SVGElement>::firstChild(*element()
); childElement; childElement = Traversal<SVGElement>::nextSibling(*childElement
)) { | 150 for (SVGElement* childElement = Traversal<SVGElement>::firstChild(*element()
); childElement; childElement = Traversal<SVGElement>::nextSibling(*childElement
)) { |
150 RenderObject* renderer = childElement->renderer(); | 151 RenderObject* renderer = childElement->renderer(); |
151 if (!renderer) | 152 if (!renderer) |
152 continue; | 153 continue; |
(...skipping 25 matching lines...) Expand all Loading... |
178 transform.translate(objectBoundingBox.x(), objectBoundingBox.y()); | 179 transform.translate(objectBoundingBox.x(), objectBoundingBox.y()); |
179 transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.h
eight()); | 180 transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.h
eight()); |
180 maskRect = transform.mapRect(maskRect); | 181 maskRect = transform.mapRect(maskRect); |
181 } | 182 } |
182 | 183 |
183 maskRect.intersect(maskBoundaries); | 184 maskRect.intersect(maskBoundaries); |
184 return maskRect; | 185 return maskRect; |
185 } | 186 } |
186 | 187 |
187 } | 188 } |
OLD | NEW |