Chromium Code Reviews| 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..54339fd736a58c597204570b30cd36c87c1daa47 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> ret = create(); |
|
haraken
2014/01/09 11:09:23
ret => svgBoolean
kouhei (in TOK)
2014/01/10 08:16:10
Done.
|
| + ret->setValueAsString(value, IGNORE_EXCEPTION); |
| + return ret.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; |
| +} |
| + |
| +} |