~oif-team/ubuntu/natty/qt4-x11/xi2.1

« back to all changes in this revision

Viewing changes to src/3rdparty/webkit/WebCore/generated/JSCanvasGradient.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Alessandro Ghersi
  • Date: 2009-11-02 18:30:08 UTC
  • mfrom: (1.2.2 upstream)
  • mto: (15.2.5 experimental)
  • mto: This revision was merged to the branch mainline in revision 88.
  • Revision ID: james.westby@ubuntu.com-20091102183008-b6a4gcs128mvfb3m
Tags: upstream-4.6.0~beta1
ImportĀ upstreamĀ versionĀ 4.6.0~beta1

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
*/
20
20
 
21
21
#include "config.h"
22
 
 
23
22
#include "JSCanvasGradient.h"
24
23
 
25
 
#include <wtf/GetPtr.h>
26
 
 
27
24
#include "CanvasGradient.h"
28
25
#include "PlatformString.h"
29
 
 
30
26
#include <runtime/Error.h>
 
27
#include <wtf/GetPtr.h>
31
28
 
32
29
using namespace JSC;
33
30
 
34
31
namespace WebCore {
35
32
 
36
 
ASSERT_CLASS_FITS_IN_CELL(JSCanvasGradient)
 
33
ASSERT_CLASS_FITS_IN_CELL(JSCanvasGradient);
37
34
 
38
35
/* Hash table for prototype */
39
36
 
43
40
    { 0, 0, 0, 0 }
44
41
};
45
42
 
46
 
static const HashTable JSCanvasGradientPrototypeTable =
 
43
static JSC_CONST_HASHTABLE HashTable JSCanvasGradientPrototypeTable =
47
44
#if ENABLE(PERFECT_HASH_SIZE)
48
45
    { 0, JSCanvasGradientPrototypeTableValues, 0 };
49
46
#else
62
59
    return getStaticFunctionSlot<JSObject>(exec, &JSCanvasGradientPrototypeTable, this, propertyName, slot);
63
60
}
64
61
 
 
62
bool JSCanvasGradientPrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
 
63
{
 
64
    return getStaticFunctionDescriptor<JSObject>(exec, &JSCanvasGradientPrototypeTable, this, propertyName, descriptor);
 
65
}
 
66
 
65
67
const ClassInfo JSCanvasGradient::s_info = { "CanvasGradient", 0, 0, 0 };
66
68
 
67
 
JSCanvasGradient::JSCanvasGradient(PassRefPtr<Structure> structure, PassRefPtr<CanvasGradient> impl)
68
 
    : DOMObject(structure)
 
69
JSCanvasGradient::JSCanvasGradient(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<CanvasGradient> impl)
 
70
    : DOMObjectWithGlobalPointer(structure, globalObject)
69
71
    , m_impl(impl)
70
72
{
71
73
}
72
74
 
73
75
JSCanvasGradient::~JSCanvasGradient()
74
76
{
75
 
    forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get());
76
 
 
 
77
    forgetDOMObject(*Heap::heap(this)->globalData(), impl());
77
78
}
78
79
 
79
80
JSObject* JSCanvasGradient::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
81
82
    return new (exec) JSCanvasGradientPrototype(JSCanvasGradientPrototype::createStructure(globalObject->objectPrototype()));
82
83
}
83
84
 
84
 
JSValuePtr jsCanvasGradientPrototypeFunctionAddColorStop(ExecState* exec, JSObject*, JSValuePtr thisValue, const ArgList& args)
 
85
JSValue JSC_HOST_CALL jsCanvasGradientPrototypeFunctionAddColorStop(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
85
86
{
86
 
    if (!thisValue->isObject(&JSCanvasGradient::s_info))
 
87
    UNUSED_PARAM(args);
 
88
    if (!thisValue.inherits(&JSCanvasGradient::s_info))
87
89
        return throwError(exec, TypeError);
88
90
    JSCanvasGradient* castedThisObj = static_cast<JSCanvasGradient*>(asObject(thisValue));
89
91
    CanvasGradient* imp = static_cast<CanvasGradient*>(castedThisObj->impl());
90
92
    ExceptionCode ec = 0;
91
 
    float offset = args.at(exec, 0)->toFloat(exec);
92
 
    const UString& color = args.at(exec, 1)->toString(exec);
 
93
    float offset = args.at(0).toFloat(exec);
 
94
    const UString& color = args.at(1).toString(exec);
93
95
 
94
96
    imp->addColorStop(offset, color, ec);
95
97
    setDOMException(exec, ec);
96
98
    return jsUndefined();
97
99
}
98
100
 
99
 
JSC::JSValuePtr toJS(JSC::ExecState* exec, CanvasGradient* object)
 
101
JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, CanvasGradient* object)
100
102
{
101
 
    return getDOMObjectWrapper<JSCanvasGradient>(exec, object);
 
103
    return getDOMObjectWrapper<JSCanvasGradient>(exec, globalObject, object);
102
104
}
103
 
CanvasGradient* toCanvasGradient(JSC::JSValuePtr value)
 
105
CanvasGradient* toCanvasGradient(JSC::JSValue value)
104
106
{
105
 
    return value->isObject(&JSCanvasGradient::s_info) ? static_cast<JSCanvasGradient*>(asObject(value))->impl() : 0;
 
107
    return value.inherits(&JSCanvasGradient::s_info) ? static_cast<JSCanvasGradient*>(asObject(value))->impl() : 0;
106
108
}
107
109
 
108
110
}