Chromium Code Reviews| Index: Source/core/svg/SVGGeometryElement.cpp |
| diff --git a/Source/core/svg/SVGGeometryElement.cpp b/Source/core/svg/SVGGeometryElement.cpp |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..2378e02d102810fbb530f61e33c038e6383bb307 |
| --- /dev/null |
| +++ b/Source/core/svg/SVGGeometryElement.cpp |
| @@ -0,0 +1,70 @@ |
| +/* |
| + * Copyright (C) 2013 Samsung Electronics. All rights reserved. |
| + * |
| + * This library is free software; you can redistribute it and/or |
| + * modify it under the terms of the GNU Library General Public |
|
krit
2013/11/09 02:20:18
Samsung is using LGPL and not BSD? Interesting.
rwlbuis
2013/11/11 16:54:58
I guess I copied the wrong file, will fix.
|
| + * License as published by the Free Software Foundation; either |
| + * version 2 of the License, or (at your option) any later version. |
| + * |
| + * This library is distributed in the hope that it will be useful, |
| + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| + * Library General Public License for more details. |
| + * |
| + * You should have received a copy of the GNU Library General Public License |
| + * along with this library; see the file COPYING.LIB. If not, write to |
| + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| + * Boston, MA 02110-1301, USA. |
| + */ |
| + |
| +#include "config.h" |
| +#include "core/svg/SVGGeometryElement.h" |
| + |
| +#include "core/rendering/HitTestRequest.h" |
| +#include "core/rendering/PointerEventsHitRules.h" |
| +#include "core/rendering/svg/RenderSVGShape.h" |
| + |
| +#include "SVGNames.h" |
| + |
| +namespace WebCore { |
| + |
| +SVGGeometryElement::SVGGeometryElement(const QualifiedName& tagName, Document& document, ConstructionType constructionType) |
| + : SVGGraphicsElement(tagName, document, constructionType) |
| +{ |
| +} |
| + |
| +SVGGeometryElement::~SVGGeometryElement() |
| +{ |
| +} |
| + |
| +bool SVGGeometryElement::isPointInFill(const SVGPoint& point) const |
| +{ |
| + document().updateLayoutIgnorePendingStylesheets(); |
| + |
| + // FIXME: Eventually we should support isPointInFill for detached elements. |
|
pdr.
2013/11/09 00:20:08
Is this comment correct? I'm not sure we can check
|
| + if (!renderer() || !renderer()->isSVGShape()) |
|
pdr.
2013/11/09 00:20:08
Can we replace isSVGShape with isSVGGeometry and r
|
| + return false; |
| + |
| + HitTestRequest request(HitTestRequest::SVGClipContent); |
|
pdr.
2013/11/09 00:20:08
Why is SVGClipContent used here?
|
| + PointerEventsHitRules hitRules(PointerEventsHitRules::SVG_PATH_HITTESTING, request, renderer()->style()->pointerEvents()); |
|
pdr.
2013/11/09 00:20:08
Should we rename "PointerEventsHitRules::SVG_PATH_
|
| + hitRules.canHitFill = true; |
| + hitRules.canHitStroke = false; |
| + return static_cast<RenderSVGShape*>(renderer())->nodeAtFloatPointInternal(request, point, hitRules); |
|
pdr.
2013/11/09 00:20:08
Danger danger!
Please use toSVGShape() instead of
|
| +} |
| + |
| +bool SVGGeometryElement::isPointInStroke(const SVGPoint& point) const |
| +{ |
| + document().updateLayoutIgnorePendingStylesheets(); |
| + |
| + // FIXME: Eventually we should support isPointInStroke for detached elements. |
| + if (!renderer() || !renderer()->isSVGShape()) |
| + return false; |
| + |
| + HitTestRequest request(HitTestRequest::SVGClipContent); |
| + PointerEventsHitRules hitRules(PointerEventsHitRules::SVG_PATH_HITTESTING, request, renderer()->style()->pointerEvents()); |
| + hitRules.canHitFill = false; |
| + hitRules.canHitStroke = true; |
| + return static_cast<RenderSVGShape*>(renderer())->nodeAtFloatPointInternal(request, point, hitRules); |
| +} |
| + |
| +} |