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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 FloatRect bounds = strokeBoundingBox(); | 78 FloatRect bounds = strokeBoundingBox(); |
79 | 79 |
80 SkPictureBuilder pictureBuilder(bounds, nullptr, &context); | 80 SkPictureBuilder pictureBuilder(bounds, nullptr, &context); |
81 | 81 |
82 ColorFilter maskContentFilter = | 82 ColorFilter maskContentFilter = |
83 style()->svgStyle().colorInterpolation() == CI_LINEARRGB | 83 style()->svgStyle().colorInterpolation() == CI_LINEARRGB |
84 ? ColorFilterSRGBToLinearRGB | 84 ? ColorFilterSRGBToLinearRGB |
85 : ColorFilterNone; | 85 : ColorFilterNone; |
86 pictureBuilder.context().setColorFilter(maskContentFilter); | 86 pictureBuilder.context().setColorFilter(maskContentFilter); |
87 | 87 |
88 for (SVGElement* childElement = Traversal<SVGElement>::firstChild(*element()); | 88 for (const SVGElement& childElement : |
89 childElement; | 89 Traversal<SVGElement>::childrenOf(*element())) { |
90 childElement = Traversal<SVGElement>::nextSibling(*childElement)) { | 90 const LayoutObject* layoutObject = childElement.layoutObject(); |
91 LayoutObject* layoutObject = childElement->layoutObject(); | 91 if (!layoutObject || layoutObject->styleRef().display() == EDisplay::None) |
92 if (!layoutObject) | |
93 continue; | 92 continue; |
94 const ComputedStyle* style = layoutObject->style(); | |
95 if (!style || style->display() == EDisplay::None || | |
96 style->visibility() != EVisibility::Visible) | |
97 continue; | |
98 | |
99 SVGPaintContext::paintSubtree(pictureBuilder.context(), layoutObject); | 93 SVGPaintContext::paintSubtree(pictureBuilder.context(), layoutObject); |
100 } | 94 } |
101 | 95 |
102 m_maskContentPicture = pictureBuilder.endRecording(); | 96 m_maskContentPicture = pictureBuilder.endRecording(); |
103 return m_maskContentPicture; | 97 return m_maskContentPicture; |
104 } | 98 } |
105 | 99 |
106 void LayoutSVGResourceMasker::calculateMaskContentVisualRect() { | 100 void LayoutSVGResourceMasker::calculateMaskContentVisualRect() { |
107 for (SVGElement* childElement = Traversal<SVGElement>::firstChild(*element()); | 101 for (const SVGElement& childElement : |
108 childElement; | 102 Traversal<SVGElement>::childrenOf(*element())) { |
109 childElement = Traversal<SVGElement>::nextSibling(*childElement)) { | 103 const LayoutObject* layoutObject = childElement.layoutObject(); |
110 LayoutObject* layoutObject = childElement->layoutObject(); | 104 if (!layoutObject || layoutObject->styleRef().display() == EDisplay::None) |
111 if (!layoutObject) | |
112 continue; | |
113 const ComputedStyle* style = layoutObject->style(); | |
114 if (!style || style->display() == EDisplay::None || | |
115 style->visibility() != EVisibility::Visible) | |
116 continue; | 105 continue; |
117 m_maskContentBoundaries.unite( | 106 m_maskContentBoundaries.unite( |
118 layoutObject->localToSVGParentTransform().mapRect( | 107 layoutObject->localToSVGParentTransform().mapRect( |
119 layoutObject->visualRectInLocalSVGCoordinates())); | 108 layoutObject->visualRectInLocalSVGCoordinates())); |
120 } | 109 } |
121 } | 110 } |
122 | 111 |
123 FloatRect LayoutSVGResourceMasker::resourceBoundingBox( | 112 FloatRect LayoutSVGResourceMasker::resourceBoundingBox( |
124 const LayoutObject* object) { | 113 const LayoutObject* object) { |
125 SVGMaskElement* maskElement = toSVGMaskElement(element()); | 114 SVGMaskElement* maskElement = toSVGMaskElement(element()); |
(...skipping 19 matching lines...) Expand all Loading... |
145 transform.scaleNonUniform(objectBoundingBox.width(), | 134 transform.scaleNonUniform(objectBoundingBox.width(), |
146 objectBoundingBox.height()); | 135 objectBoundingBox.height()); |
147 maskRect = transform.mapRect(maskRect); | 136 maskRect = transform.mapRect(maskRect); |
148 } | 137 } |
149 | 138 |
150 maskRect.intersect(maskBoundaries); | 139 maskRect.intersect(maskBoundaries); |
151 return maskRect; | 140 return maskRect; |
152 } | 141 } |
153 | 142 |
154 } // namespace blink | 143 } // namespace blink |
OLD | NEW |