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

Side by Side Diff: Source/core/rendering/svg/RenderSVGShape.cpp

Issue 62943002: Implement SVGGeometryElement (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add SVGGeometryElement in expected results Created 7 years, 1 month 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
« no previous file with comments | « Source/core/rendering/svg/RenderSVGShape.h ('k') | Source/core/svg/SVGCircleElement.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2008 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2008 Rob Buis <buis@kde.org>
4 * Copyright (C) 2005, 2007 Eric Seidel <eric@webkit.org> 4 * Copyright (C) 2005, 2007 Eric Seidel <eric@webkit.org>
5 * Copyright (C) 2009 Google, Inc. 5 * Copyright (C) 2009 Google, Inc.
6 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> 6 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
7 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 7 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
8 * Copyright (C) 2009 Jeff Schiller <codedread@gmail.com> 8 * Copyright (C) 2009 Jeff Schiller <codedread@gmail.com>
9 * Copyright (C) 2011 Renata Hodovan <reni@webkit.org> 9 * Copyright (C) 2011 Renata Hodovan <reni@webkit.org>
10 * Copyright (C) 2011 University of Szeged 10 * Copyright (C) 2011 University of Szeged
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 // while transformed to our coord system, return local coords 305 // while transformed to our coord system, return local coords
306 void RenderSVGShape::addFocusRingRects(Vector<IntRect>& rects, const LayoutPoint &, const RenderLayerModelObject*) 306 void RenderSVGShape::addFocusRingRects(Vector<IntRect>& rects, const LayoutPoint &, const RenderLayerModelObject*)
307 { 307 {
308 IntRect rect = enclosingIntRect(repaintRectInLocalCoordinates()); 308 IntRect rect = enclosingIntRect(repaintRectInLocalCoordinates());
309 if (!rect.isEmpty()) 309 if (!rect.isEmpty())
310 rects.append(rect); 310 rects.append(rect);
311 } 311 }
312 312
313 bool RenderSVGShape::nodeAtFloatPoint(const HitTestRequest& request, HitTestResu lt& result, const FloatPoint& pointInParent, HitTestAction hitTestAction) 313 bool RenderSVGShape::nodeAtFloatPoint(const HitTestRequest& request, HitTestResu lt& result, const FloatPoint& pointInParent, HitTestAction hitTestAction)
314 { 314 {
315 // We only draw in the forground phase, so we only hit-test then. 315 // We only draw in the foreground phase, so we only hit-test then.
316 if (hitTestAction != HitTestForeground) 316 if (hitTestAction != HitTestForeground)
317 return false; 317 return false;
318 318
319 FloatPoint localPoint = m_localTransform.inverse().mapPoint(pointInParent); 319 FloatPoint localPoint = m_localTransform.inverse().mapPoint(pointInParent);
320 320
321 if (!SVGRenderSupport::pointInClippingArea(this, localPoint)) 321 if (!SVGRenderSupport::pointInClippingArea(this, localPoint))
322 return false; 322 return false;
323 323
324 PointerEventsHitRules hitRules(PointerEventsHitRules::SVG_PATH_HITTESTING, r equest, style()->pointerEvents()); 324 PointerEventsHitRules hitRules(PointerEventsHitRules::SVG_GEOMETRY_HITTESTIN G, request, style()->pointerEvents());
325 if (nodeAtFloatPointInternal(request, localPoint, hitRules)) {
326 updateHitTestResult(result, roundedLayoutPoint(localPoint));
327 return true;
328 }
329
330 return false;
331 }
332
333 bool RenderSVGShape::nodeAtFloatPointInternal(const HitTestRequest& request, con st FloatPoint& localPoint, PointerEventsHitRules hitRules)
334 {
325 bool isVisible = (style()->visibility() == VISIBLE); 335 bool isVisible = (style()->visibility() == VISIBLE);
326 if (isVisible || !hitRules.requireVisible) { 336 if (isVisible || !hitRules.requireVisible) {
327 const SVGRenderStyle* svgStyle = style()->svgStyle(); 337 const SVGRenderStyle* svgStyle = style()->svgStyle();
328 WindRule fillRule = svgStyle->fillRule(); 338 WindRule fillRule = svgStyle->fillRule();
329 if (request.svgClipContent()) 339 if (request.svgClipContent())
330 fillRule = svgStyle->clipRule(); 340 fillRule = svgStyle->clipRule();
331 if ((hitRules.canHitStroke && (svgStyle->hasStroke() || !hitRules.requir eStroke) && strokeContains(localPoint, hitRules.requireStroke)) 341 if ((hitRules.canHitStroke && (svgStyle->hasStroke() || !hitRules.requir eStroke) && strokeContains(localPoint, hitRules.requireStroke))
332 || (hitRules.canHitFill && (svgStyle->hasFill() || !hitRules.require Fill) && fillContains(localPoint, hitRules.requireFill, fillRule))) { 342 || (hitRules.canHitFill && (svgStyle->hasFill() || !hitRules.require Fill) && fillContains(localPoint, hitRules.requireFill, fillRule)))
333 updateHitTestResult(result, roundedLayoutPoint(localPoint));
334 return true; 343 return true;
335 }
336 } 344 }
337 return false; 345 return false;
338 } 346 }
339 347
340 static inline RenderSVGResourceMarker* markerForType(SVGMarkerType type, RenderS VGResourceMarker* markerStart, RenderSVGResourceMarker* markerMid, RenderSVGReso urceMarker* markerEnd) 348 static inline RenderSVGResourceMarker* markerForType(SVGMarkerType type, RenderS VGResourceMarker* markerStart, RenderSVGResourceMarker* markerMid, RenderSVGReso urceMarker* markerEnd)
341 { 349 {
342 switch (type) { 350 switch (type) {
343 case StartMarker: 351 case StartMarker:
344 return markerStart; 352 return markerStart;
345 case MidMarker: 353 case MidMarker:
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 return; 466 return;
459 467
460 ASSERT(m_path); 468 ASSERT(m_path);
461 469
462 SVGMarkerData markerData(m_markerPositions); 470 SVGMarkerData markerData(m_markerPositions);
463 m_path->apply(&markerData, SVGMarkerData::updateFromPathElement); 471 m_path->apply(&markerData, SVGMarkerData::updateFromPathElement);
464 markerData.pathIsDone(); 472 markerData.pathIsDone();
465 } 473 }
466 474
467 } 475 }
OLDNEW
« no previous file with comments | « Source/core/rendering/svg/RenderSVGShape.h ('k') | Source/core/svg/SVGCircleElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698