Index: Source/core/svg/SVGGeometryElement.cpp |
diff --git a/Source/core/inspector/ScriptArguments.cpp b/Source/core/svg/SVGGeometryElement.cpp |
similarity index 51% |
copy from Source/core/inspector/ScriptArguments.cpp |
copy to Source/core/svg/SVGGeometryElement.cpp |
index 6c5ac58f57e411cb76f26df042c418a881d91d1e..56b3d03b56089c0f849a9eaf40257b35047f450a 100644 |
--- a/Source/core/inspector/ScriptArguments.cpp |
+++ b/Source/core/svg/SVGGeometryElement.cpp |
@@ -1,5 +1,5 @@ |
/* |
- * Copyright (c) 2010 Google Inc. All rights reserved. |
+ * Copyright (C) 2013 Samsung Electronics. All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions are |
@@ -29,73 +29,46 @@ |
*/ |
#include "config.h" |
-#include "core/inspector/ScriptArguments.h" |
+#include "core/svg/SVGGeometryElement.h" |
-#include "bindings/v8/ScriptScope.h" |
-#include "bindings/v8/ScriptValue.h" |
+#include "SVGNames.h" |
+#include "core/rendering/HitTestRequest.h" |
+#include "core/rendering/PointerEventsHitRules.h" |
+#include "core/rendering/svg/RenderSVGShape.h" |
namespace WebCore { |
-PassRefPtr<ScriptArguments> ScriptArguments::create(ScriptState* scriptState, Vector<ScriptValue>& arguments) |
+SVGGeometryElement::SVGGeometryElement(const QualifiedName& tagName, Document& document, ConstructionType constructionType) |
+ : SVGGraphicsElement(tagName, document, constructionType) |
{ |
- return adoptRef(new ScriptArguments(scriptState, arguments)); |
} |
-ScriptArguments::ScriptArguments(ScriptState* scriptState, Vector<ScriptValue>& arguments) |
- : m_scriptState(scriptState) |
+bool SVGGeometryElement::isPointInFill(const SVGPoint& point) const |
{ |
- m_arguments.swap(arguments); |
-} |
- |
-ScriptArguments::~ScriptArguments() |
-{ |
-} |
- |
-const ScriptValue &ScriptArguments::argumentAt(size_t index) const |
-{ |
- ASSERT(m_arguments.size() > index); |
- return m_arguments[index]; |
-} |
- |
-ScriptState* ScriptArguments::globalState() const |
-{ |
- return m_scriptState.get(); |
-} |
+ document().updateLayoutIgnorePendingStylesheets(); |
-bool ScriptArguments::getFirstArgumentAsString(String& result, bool checkForNullOrUndefined) |
-{ |
- if (!argumentCount()) |
+ // FIXME: Eventually we should support isPointInFill for display:none elements. |
+ if (!renderer() || !renderer()->isSVGShape()) |
return false; |
- const ScriptValue& value = argumentAt(0); |
- ScriptScope scope(m_scriptState.get()); |
- if (checkForNullOrUndefined && (value.isNull() || value.isUndefined())) |
- return false; |
- |
- if (!globalState()) { |
- ASSERT_NOT_REACHED(); |
- return false; |
- } |
- |
- result = value.toString(); |
- return true; |
+ HitTestRequest request(HitTestRequest::ReadOnly); |
+ PointerEventsHitRules hitRules(PointerEventsHitRules::SVG_GEOMETRY_HITTESTING, request, renderer()->style()->pointerEvents()); |
+ hitRules.canHitStroke = false; |
+ return toRenderSVGShape(renderer())->nodeAtFloatPointInternal(request, point, hitRules); |
} |
-bool ScriptArguments::isEqual(ScriptArguments* other) const |
+bool SVGGeometryElement::isPointInStroke(const SVGPoint& point) const |
{ |
- if (!other) |
- return false; |
+ document().updateLayoutIgnorePendingStylesheets(); |
- if (m_arguments.size() != other->m_arguments.size()) |
- return false; |
- if (!globalState() && m_arguments.size()) |
+ // FIXME: Eventually we should support isPointInStroke for display:none elements. |
+ if (!renderer() || !renderer()->isSVGShape()) |
return false; |
- for (size_t i = 0; i < m_arguments.size(); ++i) { |
- if (!m_arguments[i].isEqual(other->globalState(), other->m_arguments[i])) |
- return false; |
- } |
- return true; |
+ HitTestRequest request(HitTestRequest::ReadOnly); |
+ PointerEventsHitRules hitRules(PointerEventsHitRules::SVG_GEOMETRY_HITTESTING, request, renderer()->style()->pointerEvents()); |
+ hitRules.canHitFill = false; |
+ return toRenderSVGShape(renderer())->nodeAtFloatPointInternal(request, point, hitRules); |
} |
-} // namespace WebCore |
+} |