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

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: Created 5 years, 9 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 HitTestRequest request(HitTestRequest::SVGClipContent);
251 if (layoutObject->nodeAtFloatPoint(HitTestRequest(HitTestRequest::SVGCli pContent), result, point, HitTestForeground)) 251 HitTestResult result(request, hitPoint);
Rick Byers 2015/03/31 00:51:00 nit: might as well just put this inline rather tha
ramya.v 2015/03/31 09:41:36 Done.
252 if (layoutObject->nodeAtFloatPoint(result, point, HitTestForeground))
252 return true; 253 return true;
253 } 254 }
254 255
255 return false; 256 return false;
256 } 257 }
257 258
258 FloatRect LayoutSVGResourceClipper::resourceBoundingBox(const LayoutObject* obje ct) 259 FloatRect LayoutSVGResourceClipper::resourceBoundingBox(const LayoutObject* obje ct)
259 { 260 {
260 // Resource was not layouted yet. Give back the boundingBox of the object. 261 // Resource was not layouted yet. Give back the boundingBox of the object.
261 if (selfNeedsLayout()) 262 if (selfNeedsLayout())
262 return object->objectBoundingBox(); 263 return object->objectBoundingBox();
263 264
264 if (m_clipBoundaries.isEmpty()) 265 if (m_clipBoundaries.isEmpty())
265 calculateClipContentPaintInvalidationRect(); 266 calculateClipContentPaintInvalidationRect();
266 267
267 if (clipPathUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { 268 if (clipPathUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
268 FloatRect objectBoundingBox = object->objectBoundingBox(); 269 FloatRect objectBoundingBox = object->objectBoundingBox();
269 AffineTransform transform; 270 AffineTransform transform;
270 transform.translate(objectBoundingBox.x(), objectBoundingBox.y()); 271 transform.translate(objectBoundingBox.x(), objectBoundingBox.y());
271 transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.h eight()); 272 transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.h eight());
272 return transform.mapRect(m_clipBoundaries); 273 return transform.mapRect(m_clipBoundaries);
273 } 274 }
274 275
275 return m_clipBoundaries; 276 return m_clipBoundaries;
276 } 277 }
277 278
278 } 279 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698