Index: Source/core/svg/SVGBoolean.cpp |
diff --git a/Source/core/workers/AbstractWorker.cpp b/Source/core/svg/SVGBoolean.cpp |
similarity index 51% |
copy from Source/core/workers/AbstractWorker.cpp |
copy to Source/core/svg/SVGBoolean.cpp |
index a617c23b4f5da262cc5eb717e56938a281ac8f96..eeaa416d6751aea1366adbea320a992c5e14d59d 100644 |
--- a/Source/core/workers/AbstractWorker.cpp |
+++ b/Source/core/svg/SVGBoolean.cpp |
@@ -1,5 +1,5 @@ |
/* |
- * Copyright (C) 2010 Google Inc. All rights reserved. |
+ * Copyright (C) 2014 Google Inc. All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions are |
@@ -29,46 +29,57 @@ |
*/ |
#include "config.h" |
-#include "core/workers/AbstractWorker.h" |
+ |
+#include "core/svg/SVGBoolean.h" |
#include "bindings/v8/ExceptionState.h" |
+#include "bindings/v8/ExceptionStatePlaceholder.h" |
#include "core/dom/ExceptionCode.h" |
-#include "core/dom/ExecutionContext.h" |
-#include "core/frame/ContentSecurityPolicy.h" |
-#include "platform/weborigin/SecurityOrigin.h" |
+#include "core/svg/SVGAnimationElement.h" |
namespace WebCore { |
-AbstractWorker::AbstractWorker(ExecutionContext* context) |
- : ActiveDOMObject(context) |
+PassRefPtr<NewSVGPropertyBase> SVGBoolean::cloneForAnimation(const String& value) const |
{ |
+ RefPtr<SVGBoolean> svgBoolean = create(); |
+ svgBoolean->setValueAsString(value, IGNORE_EXCEPTION); |
+ return svgBoolean.release(); |
} |
-AbstractWorker::~AbstractWorker() |
+String SVGBoolean::valueAsString() const |
{ |
+ return m_value ? "true" : "false"; |
} |
-KURL AbstractWorker::resolveURL(const String& url, ExceptionState& exceptionState) |
+void SVGBoolean::setValueAsString(const String& value, ExceptionState& exceptionState) |
{ |
- // FIXME: This should use the dynamic global scope (bug #27887) |
- KURL scriptURL = executionContext()->completeURL(url); |
- if (!scriptURL.isValid()) { |
- exceptionState.throwDOMException(SyntaxError, "'" + url + "' is not a valid URL."); |
- return KURL(); |
+ if (value == "true") { |
+ m_value = true; |
+ } else if (value == "false") { |
+ m_value = false; |
+ } else { |
+ exceptionState.throwDOMException(SyntaxError, "The value provided ('" + value + "') is invalid."); |
} |
+} |
- // We can safely expose the URL in the following exceptions, as these checks happen synchronously before redirection. JavaScript receives no new information. |
- if (!executionContext()->securityOrigin()->canRequest(scriptURL)) { |
- exceptionState.throwSecurityError("Script at '" + scriptURL.elidedString() + "' cannot be accessed from origin '" + executionContext()->securityOrigin()->toString() + "'."); |
- return KURL(); |
- } |
+void SVGBoolean::add(PassRefPtr<NewSVGPropertyBase>, SVGElement*) |
+{ |
+ ASSERT_NOT_REACHED(); |
+} |
- if (executionContext()->contentSecurityPolicy() && !executionContext()->contentSecurityPolicy()->allowScriptFromSource(scriptURL)) { |
- exceptionState.throwSecurityError("Access to the script at '" + scriptURL.elidedString() + "' is denied by the document's Content Security Policy."); |
- return KURL(); |
- } |
+void SVGBoolean::calculateAnimatedValue(SVGAnimationElement* animationElement, float percentage, unsigned repeatCount, PassRefPtr<NewSVGPropertyBase> from, PassRefPtr<NewSVGPropertyBase> to, PassRefPtr<NewSVGPropertyBase>, SVGElement*) |
+{ |
+ ASSERT(animationElement); |
+ bool fromBoolean = animationElement->animationMode() == ToAnimation ? m_value : toSVGBoolean(from)->value(); |
+ bool toBoolean = toSVGBoolean(to)->value(); |
- return scriptURL; |
+ animationElement->animateDiscreteType<bool>(percentage, fromBoolean, toBoolean, m_value); |
} |
-} // namespace WebCore |
+float SVGBoolean::calculateDistance(PassRefPtr<NewSVGPropertyBase>, SVGElement*) |
+{ |
+ // No paced animations for boolean. |
+ return -1; |
+} |
+ |
+} |