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

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

Issue 2670643004: Rename EDisplay values with k prefix. (Closed)
Patch Set: Rebase Created 3 years, 9 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 if (strategy != ClipStrategy::Path || !style.clipPath()) 44 if (strategy != ClipStrategy::Path || !style.clipPath())
45 return strategy; 45 return strategy;
46 return ClipStrategy::Mask; 46 return ClipStrategy::Mask;
47 } 47 }
48 48
49 ClipStrategy determineClipStrategy(const SVGGraphicsElement& element) { 49 ClipStrategy determineClipStrategy(const SVGGraphicsElement& element) {
50 const LayoutObject* layoutObject = element.layoutObject(); 50 const LayoutObject* layoutObject = element.layoutObject();
51 if (!layoutObject) 51 if (!layoutObject)
52 return ClipStrategy::None; 52 return ClipStrategy::None;
53 const ComputedStyle& style = layoutObject->styleRef(); 53 const ComputedStyle& style = layoutObject->styleRef();
54 if (style.display() == EDisplay::None || 54 if (style.display() == EDisplay::kNone ||
55 style.visibility() != EVisibility::kVisible) 55 style.visibility() != EVisibility::kVisible)
56 return ClipStrategy::None; 56 return ClipStrategy::None;
57 ClipStrategy strategy = ClipStrategy::None; 57 ClipStrategy strategy = ClipStrategy::None;
58 // Only shapes, paths and texts are allowed for clipping. 58 // Only shapes, paths and texts are allowed for clipping.
59 if (layoutObject->isSVGShape()) { 59 if (layoutObject->isSVGShape()) {
60 strategy = ClipStrategy::Path; 60 strategy = ClipStrategy::Path;
61 } else if (layoutObject->isSVGText()) { 61 } else if (layoutObject->isSVGText()) {
62 // Text requires masking. 62 // Text requires masking.
63 strategy = ClipStrategy::Mask; 63 strategy = ClipStrategy::Mask;
64 } 64 }
65 return modifyStrategyForClipPath(style, strategy); 65 return modifyStrategyForClipPath(style, strategy);
66 } 66 }
67 67
68 ClipStrategy determineClipStrategy(const SVGElement& element) { 68 ClipStrategy determineClipStrategy(const SVGElement& element) {
69 // <use> within <clipPath> have a restricted content model. 69 // <use> within <clipPath> have a restricted content model.
70 // (https://drafts.fxtf.org/css-masking-1/#ClipPathElement) 70 // (https://drafts.fxtf.org/css-masking-1/#ClipPathElement)
71 if (isSVGUseElement(element)) { 71 if (isSVGUseElement(element)) {
72 const LayoutObject* useLayoutObject = element.layoutObject(); 72 const LayoutObject* useLayoutObject = element.layoutObject();
73 if (!useLayoutObject || 73 if (!useLayoutObject ||
74 useLayoutObject->styleRef().display() == EDisplay::None) 74 useLayoutObject->styleRef().display() == EDisplay::kNone)
75 return ClipStrategy::None; 75 return ClipStrategy::None;
76 const SVGGraphicsElement* shapeElement = 76 const SVGGraphicsElement* shapeElement =
77 toSVGUseElement(element).visibleTargetGraphicsElementForClipping(); 77 toSVGUseElement(element).visibleTargetGraphicsElementForClipping();
78 if (!shapeElement) 78 if (!shapeElement)
79 return ClipStrategy::None; 79 return ClipStrategy::None;
80 ClipStrategy shapeStrategy = determineClipStrategy(*shapeElement); 80 ClipStrategy shapeStrategy = determineClipStrategy(*shapeElement);
81 return modifyStrategyForClipPath(useLayoutObject->styleRef(), 81 return modifyStrategyForClipPath(useLayoutObject->styleRef(),
82 shapeStrategy); 82 shapeStrategy);
83 } 83 }
84 if (!element.isSVGGraphicsElement()) 84 if (!element.isSVGGraphicsElement())
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 toSVGClipPathElement(element())->calculateTransform( 303 toSVGClipPathElement(element())->calculateTransform(
304 SVGElement::IncludeMotionTransform); 304 SVGElement::IncludeMotionTransform);
305 if (clipPathUnits() == SVGUnitTypes::kSvgUnitTypeObjectboundingbox) { 305 if (clipPathUnits() == SVGUnitTypes::kSvgUnitTypeObjectboundingbox) {
306 transform.translate(referenceBox.x(), referenceBox.y()); 306 transform.translate(referenceBox.x(), referenceBox.y());
307 transform.scaleNonUniform(referenceBox.width(), referenceBox.height()); 307 transform.scaleNonUniform(referenceBox.width(), referenceBox.height());
308 } 308 }
309 return transform.mapRect(m_localClipBounds); 309 return transform.mapRect(m_localClipBounds);
310 } 310 }
311 311
312 } // namespace blink 312 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698