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

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

Issue 2279823002: Use LayoutSVGResourceClipper::resourceBoundingBox() in ClipPathClipper (Closed)
Patch Set: Rebase Created 4 years, 3 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 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 continue; 257 continue;
258 IntPoint hitPoint; 258 IntPoint hitPoint;
259 HitTestResult result(HitTestRequest::SVGClipContent, hitPoint); 259 HitTestResult result(HitTestRequest::SVGClipContent, hitPoint);
260 if (layoutObject->nodeAtFloatPoint(result, point, HitTestForeground)) 260 if (layoutObject->nodeAtFloatPoint(result, point, HitTestForeground))
261 return true; 261 return true;
262 } 262 }
263 263
264 return false; 264 return false;
265 } 265 }
266 266
267 FloatRect LayoutSVGResourceClipper::resourceBoundingBox(const LayoutObject* obje ct) 267 FloatRect LayoutSVGResourceClipper::resourceBoundingBox(const FloatRect& referen ceBox)
268 { 268 {
269 // Resource was not layouted yet. Give back the boundingBox of the object. 269 // The resource has not been layouted yet. Return the reference box.
270 if (selfNeedsLayout()) 270 if (selfNeedsLayout())
271 return object->objectBoundingBox(); 271 return referenceBox;
272 272
273 if (m_localClipBounds.isEmpty()) 273 if (m_localClipBounds.isEmpty())
274 calculateLocalClipBounds(); 274 calculateLocalClipBounds();
275 275
276 AffineTransform transform = toSVGClipPathElement(element())->calculateAnimat edLocalTransform(); 276 AffineTransform transform = toSVGClipPathElement(element())->calculateAnimat edLocalTransform();
277 if (clipPathUnits() == SVGUnitTypes::kSvgUnitTypeObjectboundingbox) { 277 if (clipPathUnits() == SVGUnitTypes::kSvgUnitTypeObjectboundingbox) {
278 FloatRect objectBoundingBox = object->objectBoundingBox(); 278 transform.translate(referenceBox.x(), referenceBox.y());
279 transform.translate(objectBoundingBox.x(), objectBoundingBox.y()); 279 transform.scaleNonUniform(referenceBox.width(), referenceBox.height());
280 transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.h eight());
281 } 280 }
282
283 return transform.mapRect(m_localClipBounds); 281 return transform.mapRect(m_localClipBounds);
284 } 282 }
285 283
286 } // namespace blink 284 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698