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

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

Issue 2068053002: Rename Blink constants generated from IDL files. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 4 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) Research In Motion Limited 2010. All rights reserved. 3 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
4 * Copyright 2014 The Chromium Authors. All rights reserved. 4 * Copyright 2014 The Chromium Authors. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 return nullptr; 98 return nullptr;
99 99
100 AffineTransform tileTransform; 100 AffineTransform tileTransform;
101 if (attributes.hasViewBox()) { 101 if (attributes.hasViewBox()) {
102 if (attributes.viewBox().isEmpty()) 102 if (attributes.viewBox().isEmpty())
103 return nullptr; 103 return nullptr;
104 tileTransform = SVGFitToViewBox::viewBoxToViewTransform(attributes.viewB ox(), 104 tileTransform = SVGFitToViewBox::viewBoxToViewTransform(attributes.viewB ox(),
105 attributes.preserveAspectRatio(), tileBounds.width(), tileBounds.hei ght()); 105 attributes.preserveAspectRatio(), tileBounds.width(), tileBounds.hei ght());
106 } else { 106 } else {
107 // A viewbox overrides patternContentUnits, per spec. 107 // A viewbox overrides patternContentUnits, per spec.
108 if (attributes.patternContentUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJE CTBOUNDINGBOX) 108 if (attributes.patternContentUnits() == SVGUnitTypes::kSvgUnitTypeObject boundingbox)
109 tileTransform.scale(clientBoundingBox.width(), clientBoundingBox.hei ght()); 109 tileTransform.scale(clientBoundingBox.width(), clientBoundingBox.hei ght());
110 } 110 }
111 111
112 std::unique_ptr<PatternData> patternData = wrapUnique(new PatternData); 112 std::unique_ptr<PatternData> patternData = wrapUnique(new PatternData);
113 patternData->pattern = Pattern::createPicturePattern(asPicture(tileBounds, t ileTransform)); 113 patternData->pattern = Pattern::createPicturePattern(asPicture(tileBounds, t ileTransform));
114 114
115 // Compute pattern space transformation. 115 // Compute pattern space transformation.
116 patternData->transform.translate(tileBounds.x(), tileBounds.y()); 116 patternData->transform.translate(tileBounds.x(), tileBounds.y());
117 patternData->transform.preMultiply(attributes.patternTransform()); 117 patternData->transform.preMultiply(attributes.patternTransform());
118 118
(...skipping 12 matching lines...) Expand all
131 patternElement->synchronizeAnimatedSVGAttribute(anyQName()); 131 patternElement->synchronizeAnimatedSVGAttribute(anyQName());
132 132
133 m_attributesWrapper->set(PatternAttributes()); 133 m_attributesWrapper->set(PatternAttributes());
134 patternElement->collectPatternAttributes(mutableAttributes()); 134 patternElement->collectPatternAttributes(mutableAttributes());
135 m_shouldCollectPatternAttributes = false; 135 m_shouldCollectPatternAttributes = false;
136 } 136 }
137 137
138 // Spec: When the geometry of the applicable element has no width or height and objectBoundingBox is specified, 138 // Spec: When the geometry of the applicable element has no width or height and objectBoundingBox is specified,
139 // then the given effect (e.g. a gradient or a filter) will be ignored. 139 // then the given effect (e.g. a gradient or a filter) will be ignored.
140 FloatRect objectBoundingBox = object.objectBoundingBox(); 140 FloatRect objectBoundingBox = object.objectBoundingBox();
141 if (attributes().patternUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDIN GBOX && objectBoundingBox.isEmpty()) 141 if (attributes().patternUnits() == SVGUnitTypes::kSvgUnitTypeObjectboundingb ox && objectBoundingBox.isEmpty())
142 return SVGPaintServer::invalid(); 142 return SVGPaintServer::invalid();
143 143
144 PatternData* patternData = patternForLayoutObject(object); 144 PatternData* patternData = patternForLayoutObject(object);
145 if (!patternData || !patternData->pattern) 145 if (!patternData || !patternData->pattern)
146 return SVGPaintServer::invalid(); 146 return SVGPaintServer::invalid();
147 147
148 return SVGPaintServer(patternData->pattern, patternData->transform); 148 return SVGPaintServer(patternData->pattern, patternData->transform);
149 } 149 }
150 150
151 const LayoutSVGResourceContainer* LayoutSVGResourcePattern::resolveContentElemen t() const 151 const LayoutSVGResourceContainer* LayoutSVGResourcePattern::resolveContentElemen t() const
(...skipping 20 matching lines...) Expand all
172 // though it will be empty (have no children). 172 // though it will be empty (have no children).
173 return this; 173 return this;
174 } 174 }
175 175
176 PassRefPtr<SkPicture> LayoutSVGResourcePattern::asPicture(const FloatRect& tileB ounds, 176 PassRefPtr<SkPicture> LayoutSVGResourcePattern::asPicture(const FloatRect& tileB ounds,
177 const AffineTransform& tileTransform) const 177 const AffineTransform& tileTransform) const
178 { 178 {
179 ASSERT(!m_shouldCollectPatternAttributes); 179 ASSERT(!m_shouldCollectPatternAttributes);
180 180
181 AffineTransform contentTransform; 181 AffineTransform contentTransform;
182 if (attributes().patternContentUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECT BOUNDINGBOX) 182 if (attributes().patternContentUnits() == SVGUnitTypes::kSvgUnitTypeObjectbo undingbox)
183 contentTransform = tileTransform; 183 contentTransform = tileTransform;
184 184
185 FloatRect bounds(FloatPoint(), tileBounds.size()); 185 FloatRect bounds(FloatPoint(), tileBounds.size());
186 SkPictureBuilder pictureBuilder(bounds); 186 SkPictureBuilder pictureBuilder(bounds);
187 187
188 const LayoutSVGResourceContainer* patternLayoutObject = resolveContentElemen t(); 188 const LayoutSVGResourceContainer* patternLayoutObject = resolveContentElemen t();
189 ASSERT(patternLayoutObject && !patternLayoutObject->needsLayout()); 189 ASSERT(patternLayoutObject && !patternLayoutObject->needsLayout());
190 190
191 SubtreeContentTransformScope contentTransformScope(contentTransform); 191 SubtreeContentTransformScope contentTransformScope(contentTransform);
192 192
193 { 193 {
194 TransformRecorder transformRecorder(pictureBuilder.context(), *patternLa youtObject, tileTransform); 194 TransformRecorder transformRecorder(pictureBuilder.context(), *patternLa youtObject, tileTransform);
195 for (LayoutObject* child = patternLayoutObject->firstChild(); child; chi ld = child->nextSibling()) 195 for (LayoutObject* child = patternLayoutObject->firstChild(); child; chi ld = child->nextSibling())
196 SVGPaintContext::paintSubtree(pictureBuilder.context(), child); 196 SVGPaintContext::paintSubtree(pictureBuilder.context(), child);
197 } 197 }
198 198
199 return pictureBuilder.endRecording(); 199 return pictureBuilder.endRecording();
200 } 200 }
201 201
202 } // namespace blink 202 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698