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

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

Issue 1838983002: Ensure display items are unique when multiple nested clip paths are used (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make patch great again Created 4 years, 8 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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 transform.translate(referenceBox.x(), referenceBox.y()); 151 transform.translate(referenceBox.x(), referenceBox.y());
152 transform.scaleNonUniform(referenceBox.width(), referenceBox.height()); 152 transform.scaleNonUniform(referenceBox.width(), referenceBox.height());
153 clipPath.transform(transform); 153 clipPath.transform(transform);
154 } 154 }
155 155
156 // Transform path by animatedLocalTransform. 156 // Transform path by animatedLocalTransform.
157 clipPath.transform(animatedLocalTransform); 157 clipPath.transform(animatedLocalTransform);
158 return true; 158 return true;
159 } 159 }
160 160
161 PassRefPtr<const SkPicture> LayoutSVGResourceClipper::createContentPicture(Affin eTransform& contentTransformation, const FloatRect& targetBoundingBox, 161 PassRefPtr<const SkPicture> LayoutSVGResourceClipper::createContentPicture()
162 GraphicsContext& context)
163 { 162 {
164 ASSERT(frame()); 163 ASSERT(frame());
165
166 if (clipPathUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
167 contentTransformation.translate(targetBoundingBox.x(), targetBoundingBox .y());
168 contentTransformation.scaleNonUniform(targetBoundingBox.width(), targetB oundingBox.height());
169 }
170
171 if (m_clipContentPicture) 164 if (m_clipContentPicture)
172 return m_clipContentPicture; 165 return m_clipContentPicture;
173 166
174 SubtreeContentTransformScope contentTransformScope(contentTransformation);
175
176 // Using strokeBoundingBox (instead of paintInvalidationRectInLocalCoordinat es) to avoid the intersection 167 // Using strokeBoundingBox (instead of paintInvalidationRectInLocalCoordinat es) to avoid the intersection
177 // with local clips/mask, which may yield incorrect results when mixing obje ctBoundingBox and 168 // with local clips/mask, which may yield incorrect results when mixing obje ctBoundingBox and
178 // userSpaceOnUse units (http://crbug.com/294900). 169 // userSpaceOnUse units (http://crbug.com/294900).
179 FloatRect bounds = strokeBoundingBox(); 170 FloatRect bounds = strokeBoundingBox();
180 171
181 SkPictureBuilder pictureBuilder(bounds, nullptr, &context); 172 SkPictureBuilder pictureBuilder(bounds, nullptr, nullptr);
182 173
183 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 )) {
184 LayoutObject* layoutObject = childElement->layoutObject(); 175 LayoutObject* layoutObject = childElement->layoutObject();
185 if (!layoutObject) 176 if (!layoutObject)
186 continue; 177 continue;
187 178
188 const ComputedStyle* style = layoutObject->style(); 179 const ComputedStyle* style = layoutObject->style();
189 if (!style || style->display() == NONE || style->visibility() != VISIBLE ) 180 if (!style || style->display() == NONE || style->visibility() != VISIBLE )
190 continue; 181 continue;
191 182
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 AffineTransform transform; 276 AffineTransform transform;
286 transform.translate(objectBoundingBox.x(), objectBoundingBox.y()); 277 transform.translate(objectBoundingBox.x(), objectBoundingBox.y());
287 transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.h eight()); 278 transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.h eight());
288 return transform.mapRect(m_clipBoundaries); 279 return transform.mapRect(m_clipBoundaries);
289 } 280 }
290 281
291 return m_clipBoundaries; 282 return m_clipBoundaries;
292 } 283 }
293 284
294 } // namespace blink 285 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698