| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 void LayoutSVGResourceMasker::removeClientFromCache(LayoutObject* client, bool m
arkForInvalidation) | 48 void LayoutSVGResourceMasker::removeClientFromCache(LayoutObject* client, bool m
arkForInvalidation) |
| 49 { | 49 { |
| 50 ASSERT(client); | 50 ASSERT(client); |
| 51 markClientForInvalidation(client, markForInvalidation ? BoundariesInvalidati
on : ParentOnlyInvalidation); | 51 markClientForInvalidation(client, markForInvalidation ? BoundariesInvalidati
on : ParentOnlyInvalidation); |
| 52 } | 52 } |
| 53 | 53 |
| 54 PassRefPtr<const SkPicture> LayoutSVGResourceMasker::createContentPicture(Affine
Transform& contentTransformation, const FloatRect& targetBoundingBox, | 54 PassRefPtr<const SkPicture> LayoutSVGResourceMasker::createContentPicture(Affine
Transform& contentTransformation, const FloatRect& targetBoundingBox, |
| 55 GraphicsContext& context) | 55 GraphicsContext& context) |
| 56 { | 56 { |
| 57 SVGUnitTypes::SVGUnitType contentUnits = toSVGMaskElement(element())->maskCo
ntentUnits()->currentValue()->enumValue(); | 57 SVGUnitTypes::SVGUnitType contentUnits = toSVGMaskElement(element())->maskCo
ntentUnits()->currentValue()->enumValue(); |
| 58 if (contentUnits == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { | 58 if (contentUnits == SVGUnitTypes::kSvgUnitTypeObjectboundingbox) { |
| 59 contentTransformation.translate(targetBoundingBox.x(), targetBoundingBox
.y()); | 59 contentTransformation.translate(targetBoundingBox.x(), targetBoundingBox
.y()); |
| 60 contentTransformation.scaleNonUniform(targetBoundingBox.width(), targetB
oundingBox.height()); | 60 contentTransformation.scaleNonUniform(targetBoundingBox.width(), targetB
oundingBox.height()); |
| 61 } | 61 } |
| 62 | 62 |
| 63 if (m_maskContentPicture) | 63 if (m_maskContentPicture) |
| 64 return m_maskContentPicture; | 64 return m_maskContentPicture; |
| 65 | 65 |
| 66 SubtreeContentTransformScope contentTransformScope(contentTransformation); | 66 SubtreeContentTransformScope contentTransformScope(contentTransformation); |
| 67 | 67 |
| 68 // Using strokeBoundingBox (instead of paintInvalidationRectInLocalCoordinat
es) to avoid the intersection | 68 // Using strokeBoundingBox (instead of paintInvalidationRectInLocalCoordinat
es) to avoid the intersection |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 FloatRect maskBoundaries = SVGLengthContext::resolveRectangle<SVGMaskElement
>(maskElement, maskElement->maskUnits()->currentValue()->enumValue(), objectBoun
dingBox); | 113 FloatRect maskBoundaries = SVGLengthContext::resolveRectangle<SVGMaskElement
>(maskElement, maskElement->maskUnits()->currentValue()->enumValue(), objectBoun
dingBox); |
| 114 | 114 |
| 115 // Resource was not layouted yet. Give back clipping rect of the mask. | 115 // Resource was not layouted yet. Give back clipping rect of the mask. |
| 116 if (selfNeedsLayout()) | 116 if (selfNeedsLayout()) |
| 117 return maskBoundaries; | 117 return maskBoundaries; |
| 118 | 118 |
| 119 if (m_maskContentBoundaries.isEmpty()) | 119 if (m_maskContentBoundaries.isEmpty()) |
| 120 calculateMaskContentPaintInvalidationRect(); | 120 calculateMaskContentPaintInvalidationRect(); |
| 121 | 121 |
| 122 FloatRect maskRect = m_maskContentBoundaries; | 122 FloatRect maskRect = m_maskContentBoundaries; |
| 123 if (maskElement->maskContentUnits()->currentValue()->value() == SVGUnitTypes
::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { | 123 if (maskElement->maskContentUnits()->currentValue()->value() == SVGUnitTypes
::kSvgUnitTypeObjectboundingbox) { |
| 124 AffineTransform transform; | 124 AffineTransform transform; |
| 125 transform.translate(objectBoundingBox.x(), objectBoundingBox.y()); | 125 transform.translate(objectBoundingBox.x(), objectBoundingBox.y()); |
| 126 transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.h
eight()); | 126 transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.h
eight()); |
| 127 maskRect = transform.mapRect(maskRect); | 127 maskRect = transform.mapRect(maskRect); |
| 128 } | 128 } |
| 129 | 129 |
| 130 maskRect.intersect(maskBoundaries); | 130 maskRect.intersect(maskBoundaries); |
| 131 return maskRect; | 131 return maskRect; |
| 132 } | 132 } |
| 133 | 133 |
| 134 } // namespace blink | 134 } // namespace blink |
| OLD | NEW |