|
7 | 7 | //#include "bindings/qjs/qjs_patch.h" |
8 | 8 | //#include "page.h" |
9 | 9 | // |
10 | | -//namespace kraken { |
| 10 | +// namespace kraken { |
11 | 11 | // |
12 | | -//ImageElement::ImageElement(ExecutionContext* context) : Element(context) { |
| 12 | +// ImageElement::ImageElement(ExecutionContext* context) : Element(context) { |
13 | 13 | // JS_SetPrototype(m_ctx, m_prototypeObject, Element::instance(m_context)->prototype()); |
14 | 14 | //} |
15 | 15 | // |
16 | | -//void bindImageElement(ExecutionContext* context) { |
| 16 | +// void bindImageElement(ExecutionContext* context) { |
17 | 17 | // auto* constructor = ImageElement::instance(context); |
18 | 18 | // context->defineGlobalProperty("HTMLImageElement", constructor->jsObject); |
19 | 19 | // context->defineGlobalProperty("Image", JS_DupValue(context->ctx(), constructor->jsObject)); |
20 | 20 | //} |
21 | 21 | // |
22 | | -//JSValue ImageElement::instanceConstructor(JSContext* ctx, JSValue func_obj, JSValue this_val, int argc, JSValue* argv) { |
| 22 | +// JSValue ImageElement::instanceConstructor(JSContext* ctx, JSValue func_obj, JSValue this_val, int argc, JSValue* argv) { |
23 | 23 | // auto instance = new ImageElementInstance(this); |
24 | 24 | // return instance->jsObject; |
25 | 25 | //} |
26 | | -//IMPL_PROPERTY_GETTER(ImageElement, width)(JSContext* ctx, JSValue this_val, int argc, JSValue* argv) { |
| 26 | +// IMPL_PROPERTY_GETTER(ImageElement, width)(JSContext* ctx, JSValue this_val, int argc, JSValue* argv) { |
27 | 27 | // getDartMethod()->flushUICommand(); |
28 | 28 | // auto* element = static_cast<ImageElementInstance*>(JS_GetOpaque(this_val, Element::classId())); |
29 | 29 | // return element->getNativeProperty("width"); |
30 | 30 | //} |
31 | | -//IMPL_PROPERTY_SETTER(ImageElement, width)(JSContext* ctx, JSValue this_val, int argc, JSValue* argv) { |
| 31 | +// IMPL_PROPERTY_SETTER(ImageElement, width)(JSContext* ctx, JSValue this_val, int argc, JSValue* argv) { |
32 | 32 | // auto* element = static_cast<ImageElementInstance*>(JS_GetOpaque(this_val, Element::classId())); |
33 | 33 | // std::string key = "width"; |
34 | 34 | // std::unique_ptr<NativeString> args_01 = stringToNativeString(key); |
35 | 35 | // std::unique_ptr<NativeString> args_02 = jsValueToNativeString(ctx, argv[0]); |
36 | 36 | // element->m_context->uiCommandBuffer()->addCommand(element->m_eventTargetId, UICommand::setProperty, *args_01, *args_02, nullptr); |
37 | 37 | // return JS_NULL; |
38 | 38 | //} |
39 | | -//IMPL_PROPERTY_GETTER(ImageElement, height)(JSContext* ctx, JSValue this_val, int argc, JSValue* argv) { |
| 39 | +// IMPL_PROPERTY_GETTER(ImageElement, height)(JSContext* ctx, JSValue this_val, int argc, JSValue* argv) { |
40 | 40 | // getDartMethod()->flushUICommand(); |
41 | 41 | // auto* element = static_cast<ImageElementInstance*>(JS_GetOpaque(this_val, Element::classId())); |
42 | 42 | // return element->getNativeProperty("height"); |
43 | 43 | //} |
44 | | -//IMPL_PROPERTY_SETTER(ImageElement, height)(JSContext* ctx, JSValue this_val, int argc, JSValue* argv) { |
| 44 | +// IMPL_PROPERTY_SETTER(ImageElement, height)(JSContext* ctx, JSValue this_val, int argc, JSValue* argv) { |
45 | 45 | // auto* element = static_cast<ImageElementInstance*>(JS_GetOpaque(this_val, Element::classId())); |
46 | 46 | // std::string key = "height"; |
47 | 47 | // std::unique_ptr<NativeString> args_01 = stringToNativeString(key); |
48 | 48 | // std::unique_ptr<NativeString> args_02 = jsValueToNativeString(ctx, argv[0]); |
49 | 49 | // element->m_context->uiCommandBuffer()->addCommand(element->m_eventTargetId, UICommand::setProperty, *args_01, *args_02, nullptr); |
50 | 50 | // return JS_NULL; |
51 | 51 | //} |
52 | | -//IMPL_PROPERTY_GETTER(ImageElement, naturalWidth)(JSContext* ctx, JSValue this_val, int argc, JSValue* argv) { |
| 52 | +// IMPL_PROPERTY_GETTER(ImageElement, naturalWidth)(JSContext* ctx, JSValue this_val, int argc, JSValue* argv) { |
53 | 53 | // getDartMethod()->flushUICommand(); |
54 | 54 | // auto* element = static_cast<ImageElementInstance*>(JS_GetOpaque(this_val, Element::classId())); |
55 | 55 | // return element->getNativeProperty("naturalWidth"); |
56 | 56 | //} |
57 | | -//IMPL_PROPERTY_GETTER(ImageElement, naturalHeight)(JSContext* ctx, JSValue this_val, int argc, JSValue* argv) { |
| 57 | +// IMPL_PROPERTY_GETTER(ImageElement, naturalHeight)(JSContext* ctx, JSValue this_val, int argc, JSValue* argv) { |
58 | 58 | // getDartMethod()->flushUICommand(); |
59 | 59 | // auto* element = static_cast<ImageElementInstance*>(JS_GetOpaque(this_val, Element::classId())); |
60 | 60 | // return element->getNativeProperty("naturalHeight"); |
61 | 61 | //} |
62 | | -//IMPL_PROPERTY_GETTER(ImageElement, src)(JSContext* ctx, JSValue this_val, int argc, JSValue* argv) { |
| 62 | +// IMPL_PROPERTY_GETTER(ImageElement, src)(JSContext* ctx, JSValue this_val, int argc, JSValue* argv) { |
63 | 63 | // getDartMethod()->flushUICommand(); |
64 | 64 | // auto* element = static_cast<ImageElementInstance*>(JS_GetOpaque(this_val, Element::classId())); |
65 | 65 | // return element->getNativeProperty("src"); |
66 | 66 | //} |
67 | | -//IMPL_PROPERTY_SETTER(ImageElement, src)(JSContext* ctx, JSValue this_val, int argc, JSValue* argv) { |
| 67 | +// IMPL_PROPERTY_SETTER(ImageElement, src)(JSContext* ctx, JSValue this_val, int argc, JSValue* argv) { |
68 | 68 | // auto* element = static_cast<ImageElementInstance*>(JS_GetOpaque(this_val, Element::classId())); |
69 | 69 | // std::string key = "src"; |
70 | 70 | // std::unique_ptr<NativeString> args_01 = stringToNativeString(key); |
71 | 71 | // std::unique_ptr<NativeString> args_02 = jsValueToNativeString(ctx, argv[0]); |
72 | 72 | // element->m_context->uiCommandBuffer()->addCommand(element->m_eventTargetId, UICommand::setProperty, *args_01, *args_02, nullptr); |
73 | 73 | // return JS_NULL; |
74 | 74 | //} |
75 | | -//IMPL_PROPERTY_GETTER(ImageElement, loading)(JSContext* ctx, JSValue this_val, int argc, JSValue* argv) { |
| 75 | +// IMPL_PROPERTY_GETTER(ImageElement, loading)(JSContext* ctx, JSValue this_val, int argc, JSValue* argv) { |
76 | 76 | // getDartMethod()->flushUICommand(); |
77 | 77 | // auto* element = static_cast<ImageElementInstance*>(JS_GetOpaque(this_val, Element::classId())); |
78 | 78 | // return element->getNativeProperty("loading"); |
79 | 79 | //} |
80 | | -//IMPL_PROPERTY_SETTER(ImageElement, loading)(JSContext* ctx, JSValue this_val, int argc, JSValue* argv) { |
| 80 | +// IMPL_PROPERTY_SETTER(ImageElement, loading)(JSContext* ctx, JSValue this_val, int argc, JSValue* argv) { |
81 | 81 | // auto* element = static_cast<ImageElementInstance*>(JS_GetOpaque(this_val, Element::classId())); |
82 | 82 | // std::string key = "loading"; |
83 | 83 | // std::unique_ptr<NativeString> args_01 = stringToNativeString(key); |
|
86 | 86 | // return JS_NULL; |
87 | 87 | //} |
88 | 88 | // |
89 | | -//ImageElementInstance::ImageElementInstance(ImageElement* element) : ElementInstance(element, "img", true) { |
| 89 | +// ImageElementInstance::ImageElementInstance(ImageElement* element) : ElementInstance(element, "img", true) { |
90 | 90 | // // Protect image instance util load or error event triggered. |
91 | 91 | // refer(); |
92 | 92 | //} |
93 | 93 | // |
94 | | -//bool ImageElementInstance::dispatchEvent(EventInstance* event) { |
| 94 | +// bool ImageElementInstance::dispatchEvent(EventInstance* event) { |
95 | 95 | // std::u16string u16EventType = std::u16string(reinterpret_cast<const char16_t*>(event->nativeEvent->type->string), event->nativeEvent->type->length); |
96 | 96 | // std::string eventType = toUTF8(u16EventType); |
97 | 97 | // bool result = EventTargetInstance::dispatchEvent(event); |
|
0 commit comments