Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(42)

Side by Side Diff: third_party/WebKit/Source/core/layout/svg/LayoutSVGResourceClipper.cpp

Issue 2370673002: Changed EDisplay to an enum class and renamed its members to be keywords (Closed)
Patch Set: Comment Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Rob Buis <buis@kde.org>
4 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. 4 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved.
5 * Copyright (C) 2011 Dirk Schulze <krit@webkit.org> 5 * Copyright (C) 2011 Dirk Schulze <krit@webkit.org>
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 continue; 79 continue;
80 // Only shapes or paths are supported for direct clipping. We need to fa llback to masking for texts. 80 // Only shapes or paths are supported for direct clipping. We need to fa llback to masking for texts.
81 if (childLayoutObject->isSVGText()) { 81 if (childLayoutObject->isSVGText()) {
82 m_clipContentPath.clear(); 82 m_clipContentPath.clear();
83 return false; 83 return false;
84 } 84 }
85 if (!childElement->isSVGGraphicsElement()) 85 if (!childElement->isSVGGraphicsElement())
86 continue; 86 continue;
87 87
88 const ComputedStyle* style = childLayoutObject->style(); 88 const ComputedStyle* style = childLayoutObject->style();
89 if (!style || style->display() == NONE || (style->visibility() != EVisib ility::Visible && !isSVGUseElement(*childElement))) 89 if (!style || style->display() == EDisplay::None || (style->visibility() != EVisibility::Visible && !isSVGUseElement(*childElement)))
90 continue; 90 continue;
91 91
92 // Current shape in clip-path gets clipped too. Fallback to masking. 92 // Current shape in clip-path gets clipped too. Fallback to masking.
93 if (style->clipPath()) { 93 if (style->clipPath()) {
94 m_clipContentPath.clear(); 94 m_clipContentPath.clear();
95 return false; 95 return false;
96 } 96 }
97 97
98 // First clip shape. 98 // First clip shape.
99 if (m_clipContentPath.isEmpty()) { 99 if (m_clipContentPath.isEmpty()) {
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 FloatRect bounds = strokeBoundingBox(); 170 FloatRect bounds = strokeBoundingBox();
171 171
172 SkPictureBuilder pictureBuilder(bounds, nullptr, nullptr); 172 SkPictureBuilder pictureBuilder(bounds, nullptr, nullptr);
173 173
174 for (SVGElement* childElement = Traversal<SVGElement>::firstChild(*element() ); childElement; childElement = Traversal<SVGElement>::nextSibling(*childElement )) { 174 for (SVGElement* childElement = Traversal<SVGElement>::firstChild(*element() ); childElement; childElement = Traversal<SVGElement>::nextSibling(*childElement )) {
175 LayoutObject* layoutObject = childElement->layoutObject(); 175 LayoutObject* layoutObject = childElement->layoutObject();
176 if (!layoutObject) 176 if (!layoutObject)
177 continue; 177 continue;
178 178
179 const ComputedStyle* style = layoutObject->style(); 179 const ComputedStyle* style = layoutObject->style();
180 if (!style || style->display() == NONE || (style->visibility() != EVisib ility::Visible && !isSVGUseElement(*childElement))) 180 if (!style || style->display() == EDisplay::None || (style->visibility() != EVisibility::Visible && !isSVGUseElement(*childElement)))
181 continue; 181 continue;
182 182
183 bool isUseElement = isSVGUseElement(*childElement); 183 bool isUseElement = isSVGUseElement(*childElement);
184 if (isUseElement) { 184 if (isUseElement) {
185 const SVGGraphicsElement* clippingElement = toSVGUseElement(*childEl ement).visibleTargetGraphicsElementForClipping(); 185 const SVGGraphicsElement* clippingElement = toSVGUseElement(*childEl ement).visibleTargetGraphicsElementForClipping();
186 if (!clippingElement) 186 if (!clippingElement)
187 continue; 187 continue;
188 188
189 layoutObject = clippingElement->layoutObject(); 189 layoutObject = clippingElement->layoutObject();
190 if (!layoutObject) 190 if (!layoutObject)
(...skipping 23 matching lines...) Expand all
214 void LayoutSVGResourceClipper::calculateLocalClipBounds() 214 void LayoutSVGResourceClipper::calculateLocalClipBounds()
215 { 215 {
216 // This is a rough heuristic to appraise the clip size and doesn't consider clip on clip. 216 // This is a rough heuristic to appraise the clip size and doesn't consider clip on clip.
217 for (SVGElement* childElement = Traversal<SVGElement>::firstChild(*element() ); childElement; childElement = Traversal<SVGElement>::nextSibling(*childElement )) { 217 for (SVGElement* childElement = Traversal<SVGElement>::firstChild(*element() ); childElement; childElement = Traversal<SVGElement>::nextSibling(*childElement )) {
218 LayoutObject* layoutObject = childElement->layoutObject(); 218 LayoutObject* layoutObject = childElement->layoutObject();
219 if (!layoutObject) 219 if (!layoutObject)
220 continue; 220 continue;
221 if (!layoutObject->isSVGShape() && !layoutObject->isSVGText() && !isSVGU seElement(*childElement)) 221 if (!layoutObject->isSVGShape() && !layoutObject->isSVGText() && !isSVGU seElement(*childElement))
222 continue; 222 continue;
223 const ComputedStyle* style = layoutObject->style(); 223 const ComputedStyle* style = layoutObject->style();
224 if (!style || style->display() == NONE || (style->visibility() != EVisib ility::Visible && !isSVGUseElement(*childElement))) 224 if (!style || style->display() == EDisplay::None || (style->visibility() != EVisibility::Visible && !isSVGUseElement(*childElement)))
225 continue; 225 continue;
226 if (isSVGUseElement(*childElement) && !toSVGUseElement(*childElement).vi sibleTargetGraphicsElementForClipping()) 226 if (isSVGUseElement(*childElement) && !toSVGUseElement(*childElement).vi sibleTargetGraphicsElementForClipping())
227 continue; 227 continue;
228 228
229 m_localClipBounds.unite(layoutObject->localToSVGParentTransform().mapRec t(layoutObject->paintInvalidationRectInLocalSVGCoordinates())); 229 m_localClipBounds.unite(layoutObject->localToSVGParentTransform().mapRec t(layoutObject->paintInvalidationRectInLocalSVGCoordinates()));
230 } 230 }
231 } 231 }
232 232
233 bool LayoutSVGResourceClipper::hitTestClipContent(const FloatRect& objectBoundin gBox, const FloatPoint& nodeAtPoint) 233 bool LayoutSVGResourceClipper::hitTestClipContent(const FloatRect& objectBoundin gBox, const FloatPoint& nodeAtPoint)
234 { 234 {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 275
276 AffineTransform transform = toSVGClipPathElement(element())->calculateAnimat edLocalTransform(); 276 AffineTransform transform = toSVGClipPathElement(element())->calculateAnimat edLocalTransform();
277 if (clipPathUnits() == SVGUnitTypes::kSvgUnitTypeObjectboundingbox) { 277 if (clipPathUnits() == SVGUnitTypes::kSvgUnitTypeObjectboundingbox) {
278 transform.translate(referenceBox.x(), referenceBox.y()); 278 transform.translate(referenceBox.x(), referenceBox.y());
279 transform.scaleNonUniform(referenceBox.width(), referenceBox.height()); 279 transform.scaleNonUniform(referenceBox.width(), referenceBox.height());
280 } 280 }
281 return transform.mapRect(m_localClipBounds); 281 return transform.mapRect(m_localClipBounds);
282 } 282 }
283 283
284 } // namespace blink 284 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698