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

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

Issue 2478233002: Make 'transform' a presentation attribute on SVG elements (Closed)
Patch Set: Rebase Created 4 years 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 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 263
264 if (clipPathUnits() == SVGUnitTypes::kSvgUnitTypeObjectboundingbox) { 264 if (clipPathUnits() == SVGUnitTypes::kSvgUnitTypeObjectboundingbox) {
265 AffineTransform transform; 265 AffineTransform transform;
266 transform.translate(objectBoundingBox.x(), objectBoundingBox.y()); 266 transform.translate(objectBoundingBox.x(), objectBoundingBox.y());
267 transform.scaleNonUniform(objectBoundingBox.width(), 267 transform.scaleNonUniform(objectBoundingBox.width(),
268 objectBoundingBox.height()); 268 objectBoundingBox.height());
269 point = transform.inverse().mapPoint(point); 269 point = transform.inverse().mapPoint(point);
270 } 270 }
271 271
272 AffineTransform animatedLocalTransform = 272 AffineTransform animatedLocalTransform =
273 toSVGClipPathElement(element())->calculateAnimatedLocalTransform(); 273 toSVGClipPathElement(element())->calculateTransform(
274 SVGElement::IncludeMotionTransform);
274 if (!animatedLocalTransform.isInvertible()) 275 if (!animatedLocalTransform.isInvertible())
275 return false; 276 return false;
276 277
277 point = animatedLocalTransform.inverse().mapPoint(point); 278 point = animatedLocalTransform.inverse().mapPoint(point);
278 279
279 for (SVGElement* childElement = Traversal<SVGElement>::firstChild(*element()); 280 for (SVGElement* childElement = Traversal<SVGElement>::firstChild(*element());
280 childElement; 281 childElement;
281 childElement = Traversal<SVGElement>::nextSibling(*childElement)) { 282 childElement = Traversal<SVGElement>::nextSibling(*childElement)) {
282 LayoutObject* layoutObject = childElement->layoutObject(); 283 LayoutObject* layoutObject = childElement->layoutObject();
283 if (!layoutObject) 284 if (!layoutObject)
(...skipping 13 matching lines...) Expand all
297 FloatRect LayoutSVGResourceClipper::resourceBoundingBox( 298 FloatRect LayoutSVGResourceClipper::resourceBoundingBox(
298 const FloatRect& referenceBox) { 299 const FloatRect& referenceBox) {
299 // The resource has not been layouted yet. Return the reference box. 300 // The resource has not been layouted yet. Return the reference box.
300 if (selfNeedsLayout()) 301 if (selfNeedsLayout())
301 return referenceBox; 302 return referenceBox;
302 303
303 if (m_localClipBounds.isEmpty()) 304 if (m_localClipBounds.isEmpty())
304 calculateLocalClipBounds(); 305 calculateLocalClipBounds();
305 306
306 AffineTransform transform = 307 AffineTransform transform =
307 toSVGClipPathElement(element())->calculateAnimatedLocalTransform(); 308 toSVGClipPathElement(element())->calculateTransform(
309 SVGElement::IncludeMotionTransform);
308 if (clipPathUnits() == SVGUnitTypes::kSvgUnitTypeObjectboundingbox) { 310 if (clipPathUnits() == SVGUnitTypes::kSvgUnitTypeObjectboundingbox) {
309 transform.translate(referenceBox.x(), referenceBox.y()); 311 transform.translate(referenceBox.x(), referenceBox.y());
310 transform.scaleNonUniform(referenceBox.width(), referenceBox.height()); 312 transform.scaleNonUniform(referenceBox.width(), referenceBox.height());
311 } 313 }
312 return transform.mapRect(m_localClipBounds); 314 return transform.mapRect(m_localClipBounds);
313 } 315 }
314 316
315 } // namespace blink 317 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698