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

Side by Side Diff: Source/core/svg/SVGGeometryElement.cpp

Issue 62943002: Implement SVGGeometryElement (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Update copyrights 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
OLDNEW
(Empty)
1 /*
2 * Copyright (C) 2013 Samsung Electronics. All rights reserved.
3 *
4 * This library is free software; you can redistribute it and/or
5 * 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.
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
13 *
14 * You should have received a copy of the GNU Library General Public License
15 * along with this library; see the file COPYING.LIB. If not, write to
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18 */
19
20 #include "config.h"
21 #include "core/svg/SVGGeometryElement.h"
22
23 #include "core/rendering/HitTestRequest.h"
24 #include "core/rendering/PointerEventsHitRules.h"
25 #include "core/rendering/svg/RenderSVGShape.h"
26
27 #include "SVGNames.h"
28
29 namespace WebCore {
30
31 SVGGeometryElement::SVGGeometryElement(const QualifiedName& tagName, Document& d ocument, ConstructionType constructionType)
32 : SVGGraphicsElement(tagName, document, constructionType)
33 {
34 }
35
36 SVGGeometryElement::~SVGGeometryElement()
37 {
38 }
39
40 bool SVGGeometryElement::isPointInFill(const SVGPoint& point) const
41 {
42 document().updateLayoutIgnorePendingStylesheets();
43
44 // 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
45 if (!renderer() || !renderer()->isSVGShape())
pdr. 2013/11/09 00:20:08 Can we replace isSVGShape with isSVGGeometry and r
46 return false;
47
48 HitTestRequest request(HitTestRequest::SVGClipContent);
pdr. 2013/11/09 00:20:08 Why is SVGClipContent used here?
49 PointerEventsHitRules hitRules(PointerEventsHitRules::SVG_PATH_HITTESTING, r equest, renderer()->style()->pointerEvents());
pdr. 2013/11/09 00:20:08 Should we rename "PointerEventsHitRules::SVG_PATH_
50 hitRules.canHitFill = true;
51 hitRules.canHitStroke = false;
52 return static_cast<RenderSVGShape*>(renderer())->nodeAtFloatPointInternal(re quest, point, hitRules);
pdr. 2013/11/09 00:20:08 Danger danger! Please use toSVGShape() instead of
53 }
54
55 bool SVGGeometryElement::isPointInStroke(const SVGPoint& point) const
56 {
57 document().updateLayoutIgnorePendingStylesheets();
58
59 // FIXME: Eventually we should support isPointInStroke for detached elements .
60 if (!renderer() || !renderer()->isSVGShape())
61 return false;
62
63 HitTestRequest request(HitTestRequest::SVGClipContent);
64 PointerEventsHitRules hitRules(PointerEventsHitRules::SVG_PATH_HITTESTING, r equest, renderer()->style()->pointerEvents());
65 hitRules.canHitFill = false;
66 hitRules.canHitStroke = true;
67 return static_cast<RenderSVGShape*>(renderer())->nodeAtFloatPointInternal(re quest, point, hitRules);
68 }
69
70 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698