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

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

Issue 1032823003: Refactor HitTestResult to store the HitTestRequest (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Updating as per review comments Created 5 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 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 240
241 point = animatedLocalTransform.inverse().mapPoint(point); 241 point = animatedLocalTransform.inverse().mapPoint(point);
242 242
243 for (SVGElement* childElement = Traversal<SVGElement>::firstChild(*element() ); childElement; childElement = Traversal<SVGElement>::nextSibling(*childElement )) { 243 for (SVGElement* childElement = Traversal<SVGElement>::firstChild(*element() ); childElement; childElement = Traversal<SVGElement>::nextSibling(*childElement )) {
244 LayoutObject* layoutObject = childElement->layoutObject(); 244 LayoutObject* layoutObject = childElement->layoutObject();
245 if (!layoutObject) 245 if (!layoutObject)
246 continue; 246 continue;
247 if (!layoutObject->isSVGShape() && !layoutObject->isSVGText() && !isSVGU seElement(*childElement)) 247 if (!layoutObject->isSVGShape() && !layoutObject->isSVGText() && !isSVGU seElement(*childElement))
248 continue; 248 continue;
249 IntPoint hitPoint; 249 IntPoint hitPoint;
250 HitTestResult result(hitPoint); 250 HitTestResult result(HitTestRequest(HitTestRequest::SVGClipContent), hit Point);
Rick Byers 2015/03/31 13:53:42 nit: is the 'HitTestRequest' here required or can
ramya.v 2015/04/01 07:13:00 Done.
251 if (layoutObject->nodeAtFloatPoint(HitTestRequest(HitTestRequest::SVGCli pContent), result, point, HitTestForeground)) 251 if (layoutObject->nodeAtFloatPoint(result, point, HitTestForeground))
252 return true; 252 return true;
253 } 253 }
254 254
255 return false; 255 return false;
256 } 256 }
257 257
258 FloatRect LayoutSVGResourceClipper::resourceBoundingBox(const LayoutObject* obje ct) 258 FloatRect LayoutSVGResourceClipper::resourceBoundingBox(const LayoutObject* obje ct)
259 { 259 {
260 // Resource was not layouted yet. Give back the boundingBox of the object. 260 // Resource was not layouted yet. Give back the boundingBox of the object.
261 if (selfNeedsLayout()) 261 if (selfNeedsLayout())
262 return object->objectBoundingBox(); 262 return object->objectBoundingBox();
263 263
264 if (m_clipBoundaries.isEmpty()) 264 if (m_clipBoundaries.isEmpty())
265 calculateClipContentPaintInvalidationRect(); 265 calculateClipContentPaintInvalidationRect();
266 266
267 if (clipPathUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { 267 if (clipPathUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
268 FloatRect objectBoundingBox = object->objectBoundingBox(); 268 FloatRect objectBoundingBox = object->objectBoundingBox();
269 AffineTransform transform; 269 AffineTransform transform;
270 transform.translate(objectBoundingBox.x(), objectBoundingBox.y()); 270 transform.translate(objectBoundingBox.x(), objectBoundingBox.y());
271 transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.h eight()); 271 transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.h eight());
272 return transform.mapRect(m_clipBoundaries); 272 return transform.mapRect(m_clipBoundaries);
273 } 273 }
274 274
275 return m_clipBoundaries; 275 return m_clipBoundaries;
276 } 276 }
277 277
278 } 278 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698