diff options
Diffstat (limited to 'Source/WebCore/html/canvas/CanvasGradient.h')
-rw-r--r-- | Source/WebCore/html/canvas/CanvasGradient.h | 60 |
1 files changed, 27 insertions, 33 deletions
diff --git a/Source/WebCore/html/canvas/CanvasGradient.h b/Source/WebCore/html/canvas/CanvasGradient.h index 8529d584d..bf7501338 100644 --- a/Source/WebCore/html/canvas/CanvasGradient.h +++ b/Source/WebCore/html/canvas/CanvasGradient.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2007, 2008 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. * Copyright (C) 2007 Alp Toker <alp@atoker.com> * * Redistribution and use in source and binary forms, with or without @@ -11,10 +11,10 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR @@ -24,47 +24,41 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef CanvasGradient_h -#define CanvasGradient_h +#pragma once +#include "ExceptionOr.h" #include "Gradient.h" -#include <wtf/Forward.h> -#include <wtf/PassRefPtr.h> -#include <wtf/RefCounted.h> namespace WebCore { - typedef int ExceptionCode; +class CanvasGradient : public RefCounted<CanvasGradient> { +public: + static Ref<CanvasGradient> create(const FloatPoint& p0, const FloatPoint& p1) + { + return adoptRef(*new CanvasGradient(p0, p1)); + } + static Ref<CanvasGradient> create(const FloatPoint& p0, float r0, const FloatPoint& p1, float r1) + { + return adoptRef(*new CanvasGradient(p0, r0, p1, r1)); + } - class CanvasGradient : public RefCounted<CanvasGradient> { - public: - static PassRefPtr<CanvasGradient> create(const FloatPoint& p0, const FloatPoint& p1) - { - return adoptRef(new CanvasGradient(p0, p1)); - } - static PassRefPtr<CanvasGradient> create(const FloatPoint& p0, float r0, const FloatPoint& p1, float r1) - { - return adoptRef(new CanvasGradient(p0, r0, p1, r1)); - } - - Gradient* gradient() const { return m_gradient.get(); } + Gradient& gradient() { return m_gradient; } + const Gradient& gradient() const { return m_gradient; } - void addColorStop(float value, const String& color, ExceptionCode&); + ExceptionOr<void> addColorStop(float value, const String& color); #if ENABLE(DASHBOARD_SUPPORT) - void setDashboardCompatibilityMode() { m_dashbardCompatibilityMode = true; } + void setDashboardCompatibilityMode() { m_dashboardCompatibilityMode = true; } #endif - private: - CanvasGradient(const FloatPoint& p0, const FloatPoint& p1); - CanvasGradient(const FloatPoint& p0, float r0, const FloatPoint& p1, float r1); - - RefPtr<Gradient> m_gradient; +private: + CanvasGradient(const FloatPoint& p0, const FloatPoint& p1); + CanvasGradient(const FloatPoint& p0, float r0, const FloatPoint& p1, float r1); + + Ref<Gradient> m_gradient; #if ENABLE(DASHBOARD_SUPPORT) - bool m_dashbardCompatibilityMode; + bool m_dashboardCompatibilityMode { false }; #endif - }; - -} //namespace +}; -#endif +} |