| Index: Source/bindings/v8/ExceptionState.h
|
| diff --git a/Source/core/animation/AnimatableUnknown.h b/Source/bindings/v8/ExceptionState.h
|
| similarity index 53%
|
| copy from Source/core/animation/AnimatableUnknown.h
|
| copy to Source/bindings/v8/ExceptionState.h
|
| index d253478e752935df4677dfdec8a2ad8261f2f1be..b2b88fb861244e39e6f587a31d47f9d75deb3245 100644
|
| --- a/Source/core/animation/AnimatableUnknown.h
|
| +++ b/Source/bindings/v8/ExceptionState.h
|
| @@ -28,46 +28,68 @@
|
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| */
|
|
|
| -#ifndef AnimatableUnknown_h
|
| -#define AnimatableUnknown_h
|
| +#ifndef ExceptionState_h
|
| +#define ExceptionState_h
|
|
|
| -#include "core/animation/AnimatableValue.h"
|
| +#include "wtf/Noncopyable.h"
|
| +#include <v8.h>
|
|
|
| namespace WebCore {
|
|
|
| -class AnimatableUnknown : public AnimatableValue {
|
| +typedef int ExceptionCode;
|
| +
|
| +class ExceptionState {
|
| + WTF_MAKE_NONCOPYABLE(ExceptionState);
|
| public:
|
| - virtual ~AnimatableUnknown() { }
|
| + explicit ExceptionState(v8::Isolate* isolate)
|
| + : m_code(0)
|
| + , m_exceptionThrown(false)
|
| + , m_isolate(isolate) { }
|
|
|
| - static PassRefPtr<AnimatableUnknown> create(PassRefPtr<CSSValue> value)
|
| - {
|
| - return adoptRef(new AnimatableUnknown(value));
|
| - }
|
| + virtual void throwDOMException(const ExceptionCode&, const char* message = 0);
|
| + virtual void throwTypeError(const char* message = 0);
|
|
|
| - virtual PassRefPtr<CSSValue> toCSSValue() const OVERRIDE { return m_value; }
|
| + bool hadException() const { return m_exceptionThrown || m_code; }
|
|
|
| -protected:
|
| - virtual PassRefPtr<AnimatableValue> interpolateTo(const AnimatableValue* value, double fraction) const OVERRIDE
|
| + bool throwIfNeeded()
|
| {
|
| - return defaultInterpolateTo(this, value, fraction);
|
| + if (m_code) {
|
| + throwDOMException(m_code);
|
| + return true;
|
| + }
|
| + return m_exceptionThrown;
|
| }
|
|
|
| - virtual PassRefPtr<AnimatableValue> addWith(const AnimatableValue* value) const OVERRIDE
|
| + // FIXME: Remove the rest of the public methods/operators once the transition is done.
|
| + typedef void* ExceptionState::*UnspecifiedBoolType;
|
| + operator UnspecifiedBoolType*() const
|
| {
|
| - return defaultAddWith(this, value);
|
| + return m_code ? reinterpret_cast<UnspecifiedBoolType*>(1) : 0;
|
| }
|
|
|
| -private:
|
| - explicit AnimatableUnknown(PassRefPtr<CSSValue> value)
|
| - : AnimatableValue(TypeUnknown)
|
| - , m_value(value)
|
| + operator ExceptionCode& () { return m_code; }
|
| +
|
| + ExceptionState& operator=(const ExceptionCode& ec)
|
| {
|
| - ASSERT(m_value);
|
| + throwDOMException(ec);
|
| + return *this;
|
| }
|
|
|
| - RefPtr<CSSValue> m_value;
|
| +protected:
|
| + ExceptionCode m_code;
|
| +
|
| +private:
|
| + bool m_exceptionThrown;
|
| + v8::Isolate* m_isolate;
|
| +};
|
| +
|
| +class NonThrowExceptionState : public ExceptionState {
|
| +public:
|
| + NonThrowExceptionState();
|
| + virtual void throwDOMException(const ExceptionCode&, const char* = 0) OVERRIDE FINAL;
|
| + virtual void throwTypeError(const char* = 0) OVERRIDE FINAL;
|
| };
|
|
|
| } // namespace WebCore
|
|
|
| -#endif // AnimatableUnknown_h
|
| +#endif // ExceptionState_h
|
|
|