| 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 27 matching lines...) Expand all Loading... |
| 38 bool markForInvalidation) { | 38 bool markForInvalidation) { |
| 39 m_cachedPaintRecord.reset(); | 39 m_cachedPaintRecord.reset(); |
| 40 m_maskContentBoundaries = FloatRect(); | 40 m_maskContentBoundaries = FloatRect(); |
| 41 markAllClientsForInvalidation(markForInvalidation | 41 markAllClientsForInvalidation(markForInvalidation |
| 42 ? LayoutAndBoundariesInvalidation | 42 ? LayoutAndBoundariesInvalidation |
| 43 : ParentOnlyInvalidation); | 43 : ParentOnlyInvalidation); |
| 44 } | 44 } |
| 45 | 45 |
| 46 void LayoutSVGResourceMasker::removeClientFromCache(LayoutObject* client, | 46 void LayoutSVGResourceMasker::removeClientFromCache(LayoutObject* client, |
| 47 bool markForInvalidation) { | 47 bool markForInvalidation) { |
| 48 ASSERT(client); | 48 DCHECK(client); |
| 49 markClientForInvalidation(client, markForInvalidation | 49 markClientForInvalidation(client, markForInvalidation |
| 50 ? BoundariesInvalidation | 50 ? BoundariesInvalidation |
| 51 : ParentOnlyInvalidation); | 51 : ParentOnlyInvalidation); |
| 52 } | 52 } |
| 53 | 53 |
| 54 sk_sp<const PaintRecord> LayoutSVGResourceMasker::createPaintRecord( | 54 sk_sp<const PaintRecord> LayoutSVGResourceMasker::createPaintRecord( |
| 55 AffineTransform& contentTransformation, | 55 AffineTransform& contentTransformation, |
| 56 const FloatRect& targetBoundingBox, | 56 const FloatRect& targetBoundingBox, |
| 57 GraphicsContext& context) { | 57 GraphicsContext& context) { |
| 58 SVGUnitTypes::SVGUnitType contentUnits = toSVGMaskElement(element()) | 58 SVGUnitTypes::SVGUnitType contentUnits = toSVGMaskElement(element()) |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 continue; | 105 continue; |
| 106 m_maskContentBoundaries.unite( | 106 m_maskContentBoundaries.unite( |
| 107 layoutObject->localToSVGParentTransform().mapRect( | 107 layoutObject->localToSVGParentTransform().mapRect( |
| 108 layoutObject->visualRectInLocalSVGCoordinates())); | 108 layoutObject->visualRectInLocalSVGCoordinates())); |
| 109 } | 109 } |
| 110 } | 110 } |
| 111 | 111 |
| 112 FloatRect LayoutSVGResourceMasker::resourceBoundingBox( | 112 FloatRect LayoutSVGResourceMasker::resourceBoundingBox( |
| 113 const LayoutObject* object) { | 113 const LayoutObject* object) { |
| 114 SVGMaskElement* maskElement = toSVGMaskElement(element()); | 114 SVGMaskElement* maskElement = toSVGMaskElement(element()); |
| 115 ASSERT(maskElement); | 115 DCHECK(maskElement); |
| 116 | 116 |
| 117 FloatRect objectBoundingBox = object->objectBoundingBox(); | 117 FloatRect objectBoundingBox = object->objectBoundingBox(); |
| 118 FloatRect maskBoundaries = SVGLengthContext::resolveRectangle<SVGMaskElement>( | 118 FloatRect maskBoundaries = SVGLengthContext::resolveRectangle<SVGMaskElement>( |
| 119 maskElement, maskElement->maskUnits()->currentValue()->enumValue(), | 119 maskElement, maskElement->maskUnits()->currentValue()->enumValue(), |
| 120 objectBoundingBox); | 120 objectBoundingBox); |
| 121 | 121 |
| 122 // Resource was not layouted yet. Give back clipping rect of the mask. | 122 // Resource was not layouted yet. Give back clipping rect of the mask. |
| 123 if (selfNeedsLayout()) | 123 if (selfNeedsLayout()) |
| 124 return maskBoundaries; | 124 return maskBoundaries; |
| 125 | 125 |
| 126 if (m_maskContentBoundaries.isEmpty()) | 126 if (m_maskContentBoundaries.isEmpty()) |
| 127 calculateMaskContentVisualRect(); | 127 calculateMaskContentVisualRect(); |
| 128 | 128 |
| 129 FloatRect maskRect = m_maskContentBoundaries; | 129 FloatRect maskRect = m_maskContentBoundaries; |
| 130 if (maskElement->maskContentUnits()->currentValue()->value() == | 130 if (maskElement->maskContentUnits()->currentValue()->value() == |
| 131 SVGUnitTypes::kSvgUnitTypeObjectboundingbox) { | 131 SVGUnitTypes::kSvgUnitTypeObjectboundingbox) { |
| 132 AffineTransform transform; | 132 AffineTransform transform; |
| 133 transform.translate(objectBoundingBox.x(), objectBoundingBox.y()); | 133 transform.translate(objectBoundingBox.x(), objectBoundingBox.y()); |
| 134 transform.scaleNonUniform(objectBoundingBox.width(), | 134 transform.scaleNonUniform(objectBoundingBox.width(), |
| 135 objectBoundingBox.height()); | 135 objectBoundingBox.height()); |
| 136 maskRect = transform.mapRect(maskRect); | 136 maskRect = transform.mapRect(maskRect); |
| 137 } | 137 } |
| 138 | 138 |
| 139 maskRect.intersect(maskBoundaries); | 139 maskRect.intersect(maskBoundaries); |
| 140 return maskRect; | 140 return maskRect; |
| 141 } | 141 } |
| 142 | 142 |
| 143 } // namespace blink | 143 } // namespace blink |
| OLD | NEW |