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

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

Issue 2400783002: Reformat comments in core/layout/svg (Closed)
Patch Set: 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) 2006 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2007 Rob Buis <buis@kde.org> 3 * Copyright (C) 2007 Rob Buis <buis@kde.org>
4 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org> 4 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org>
5 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 5 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 bool applyToFill = mode == ApplyToFillMode; 75 bool applyToFill = mode == ApplyToFillMode;
76 SVGPaintType paintType = 76 SVGPaintType paintType =
77 applyToFill ? svgStyle.fillPaintType() : svgStyle.strokePaintType(); 77 applyToFill ? svgStyle.fillPaintType() : svgStyle.strokePaintType();
78 ASSERT(paintType != SVG_PAINTTYPE_NONE); 78 ASSERT(paintType != SVG_PAINTTYPE_NONE);
79 79
80 Color color; 80 Color color;
81 bool hasColor = false; 81 bool hasColor = false;
82 switch (paintType) { 82 switch (paintType) {
83 case SVG_PAINTTYPE_CURRENTCOLOR: 83 case SVG_PAINTTYPE_CURRENTCOLOR:
84 case SVG_PAINTTYPE_URI_CURRENTCOLOR: 84 case SVG_PAINTTYPE_URI_CURRENTCOLOR:
85 // The keyword `currentcolor` takes its value from the value of the `color ` property on the same element. 85 // The keyword `currentcolor` takes its value from the value of the
86 // `color` property on the same element.
86 color = style.visitedDependentColor(CSSPropertyColor); 87 color = style.visitedDependentColor(CSSPropertyColor);
87 hasColor = true; 88 hasColor = true;
88 break; 89 break;
89 case SVG_PAINTTYPE_RGBCOLOR: 90 case SVG_PAINTTYPE_RGBCOLOR:
90 case SVG_PAINTTYPE_URI_RGBCOLOR: 91 case SVG_PAINTTYPE_URI_RGBCOLOR:
91 color = 92 color =
92 applyToFill ? svgStyle.fillPaintColor() : svgStyle.strokePaintColor(); 93 applyToFill ? svgStyle.fillPaintColor() : svgStyle.strokePaintColor();
93 hasColor = true; 94 hasColor = true;
94 default: 95 default:
95 break; 96 break;
96 } 97 }
97 98
98 if (style.insideLink() == InsideVisitedLink) { 99 if (style.insideLink() == InsideVisitedLink) {
99 // FIXME: This code doesn't support the uri component of the visited link pa int, https://bugs.webkit.org/show_bug.cgi?id=70006 100 // FIXME: This code doesn't support the uri component of the visited link
101 // paint, https://bugs.webkit.org/show_bug.cgi?id=70006
100 SVGPaintType visitedPaintType = applyToFill 102 SVGPaintType visitedPaintType = applyToFill
101 ? svgStyle.visitedLinkFillPaintType() 103 ? svgStyle.visitedLinkFillPaintType()
102 : svgStyle.visitedLinkStrokePaintType(); 104 : svgStyle.visitedLinkStrokePaintType();
103 105
104 // For SVG_PAINTTYPE_CURRENTCOLOR, 'color' already contains the 'visitedColo r'. 106 // For SVG_PAINTTYPE_CURRENTCOLOR, 'color' already contains the
107 // 'visitedColor'.
105 if (visitedPaintType < SVG_PAINTTYPE_URI_NONE && 108 if (visitedPaintType < SVG_PAINTTYPE_URI_NONE &&
106 visitedPaintType != SVG_PAINTTYPE_CURRENTCOLOR) { 109 visitedPaintType != SVG_PAINTTYPE_CURRENTCOLOR) {
107 const Color& visitedColor = applyToFill 110 const Color& visitedColor = applyToFill
108 ? svgStyle.visitedLinkFillPaintColor() 111 ? svgStyle.visitedLinkFillPaintColor()
109 : svgStyle.visitedLinkStrokePaintColor(); 112 : svgStyle.visitedLinkStrokePaintColor();
110 color = Color(visitedColor.red(), visitedColor.green(), 113 color = Color(visitedColor.red(), visitedColor.green(),
111 visitedColor.blue(), color.alpha()); 114 visitedColor.blue(), color.alpha());
112 hasColor = true; 115 hasColor = true;
113 } 116 }
114 } 117 }
115 118
116 // If the primary resource is just a color, return immediately. 119 // If the primary resource is just a color, return immediately.
117 if (paintType < SVG_PAINTTYPE_URI_NONE) { 120 if (paintType < SVG_PAINTTYPE_URI_NONE) {
118 // |paintType| will be either <current-color> or <rgb-color> here - both of which will have a color. 121 // |paintType| will be either <current-color> or <rgb-color> here - both of
122 // which will have a color.
119 ASSERT(hasColor); 123 ASSERT(hasColor);
120 return SVGPaintDescription(color); 124 return SVGPaintDescription(color);
121 } 125 }
122 126
123 LayoutSVGResourcePaintServer* uriResource = nullptr; 127 LayoutSVGResourcePaintServer* uriResource = nullptr;
124 if (SVGResources* resources = 128 if (SVGResources* resources =
125 SVGResourcesCache::cachedResourcesForLayoutObject(&object)) 129 SVGResourcesCache::cachedResourcesForLayoutObject(&object))
126 uriResource = applyToFill ? resources->fill() : resources->stroke(); 130 uriResource = applyToFill ? resources->fill() : resources->stroke();
127 131
128 // If the requested resource is not available, return the color resource or 'n one'. 132 // If the requested resource is not available, return the color resource or
133 // 'none'.
129 if (!uriResource) { 134 if (!uriResource) {
130 // The fallback is 'none'. (SVG2 say 'none' is implied when no fallback is s pecified.) 135 // The fallback is 'none'. (SVG2 say 'none' is implied when no fallback is
136 // specified.)
131 if (paintType == SVG_PAINTTYPE_URI_NONE || !hasColor) 137 if (paintType == SVG_PAINTTYPE_URI_NONE || !hasColor)
132 return SVGPaintDescription(); 138 return SVGPaintDescription();
133 139
134 return SVGPaintDescription(color); 140 return SVGPaintDescription(color);
135 } 141 }
136 142
137 // The paint server resource exists, though it may be invalid (pattern with wi dth/height=0). 143 // The paint server resource exists, though it may be invalid (pattern with
138 // Return the fallback color to our caller so it can use it, if 144 // width/height=0). Return the fallback color to our caller so it can use it,
139 // preparePaintServer() on the resource container failed. 145 // if preparePaintServer() on the resource container failed.
140 if (hasColor) 146 if (hasColor)
141 return SVGPaintDescription(uriResource, color); 147 return SVGPaintDescription(uriResource, color);
142 148
143 return SVGPaintDescription(uriResource); 149 return SVGPaintDescription(uriResource);
144 } 150 }
145 151
146 SVGPaintServer SVGPaintServer::requestForLayoutObject( 152 SVGPaintServer SVGPaintServer::requestForLayoutObject(
147 const LayoutObject& layoutObject, 153 const LayoutObject& layoutObject,
148 const ComputedStyle& style, 154 const ComputedStyle& style,
149 LayoutSVGResourceMode resourceMode) { 155 LayoutSVGResourceMode resourceMode) {
(...skipping 26 matching lines...) Expand all
176 LayoutSVGResourcePaintServer::~LayoutSVGResourcePaintServer() {} 182 LayoutSVGResourcePaintServer::~LayoutSVGResourcePaintServer() {}
177 183
178 SVGPaintDescription LayoutSVGResourcePaintServer::requestPaintDescription( 184 SVGPaintDescription LayoutSVGResourcePaintServer::requestPaintDescription(
179 const LayoutObject& layoutObject, 185 const LayoutObject& layoutObject,
180 const ComputedStyle& style, 186 const ComputedStyle& style,
181 LayoutSVGResourceMode resourceMode) { 187 LayoutSVGResourceMode resourceMode) {
182 return requestPaint(layoutObject, style, resourceMode); 188 return requestPaint(layoutObject, style, resourceMode);
183 } 189 }
184 190
185 } // namespace blink 191 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698