├── .gitignore ├── CMakeLists.txt ├── LICENSE ├── README.md ├── docker-compose.yml ├── examples ├── CMakeLists.txt ├── array.cc ├── image.cc ├── promise.cc ├── string.cc ├── style_sheet.cc ├── test_exec.cc └── video.cc ├── include ├── application_cache.h ├── array.h ├── array_buffer.h ├── array_buffer_view.h ├── attr.h ├── audio_track.h ├── audio_track_list.h ├── auto_release_pool.h ├── bar_prop.h ├── blob.h ├── canvas_fill_rule.h ├── canvas_gradient.h ├── canvas_pattern.h ├── canvas_rendering_context_2d.h ├── character_data.h ├── class.h ├── comment.h ├── console.h ├── css_rule.h ├── css_rule_list.h ├── css_style_declaration.h ├── css_style_sheet.h ├── date.h ├── document.h ├── document_fragment.h ├── document_type.h ├── dom_error.h ├── dom_implementation.h ├── dom_token_list.h ├── element.h ├── event.h ├── event_handler.h ├── event_listener.h ├── event_target.h ├── export.h ├── external.h ├── file_reader.h ├── float32_array.h ├── float64_array.h ├── history.h ├── hit_region_options.h ├── html5.h ├── html5_regexp.h ├── html5_string.h ├── html_base_element.h ├── html_body_element.h ├── html_canvas_element.h ├── html_collection.h ├── html_content_element.h ├── html_div_element.h ├── html_element.h ├── html_head_element.h ├── html_image_element.h ├── html_media_element.h ├── html_menu_element.h ├── html_properties_collection.h ├── html_script_element.h ├── html_source_element.h ├── html_style_element.h ├── html_video_element.h ├── idb_cursor_direction.h ├── idb_database.h ├── idb_environment.h ├── idb_factory.h ├── idb_index.h ├── idb_index_parameters.h ├── idb_object_store.h ├── idb_open_db_request.h ├── idb_request.h ├── idb_transaction.h ├── idb_version_change_event.h ├── image_bitmap.h ├── image_data.h ├── libhtml5.h ├── link_style.h ├── location.h ├── media_controller.h ├── media_error.h ├── media_list.h ├── mime_type.h ├── mime_type_array.h ├── native_array.h ├── native_object.h ├── navigator.h ├── node.h ├── node_filter.h ├── node_iterator.h ├── node_list.h ├── object.h ├── path2d.h ├── performance.h ├── performance_entry.h ├── performance_navigation.h ├── performance_timing.h ├── plugin.h ├── plugin_array.h ├── processing_instruction.h ├── promise.h ├── range.h ├── rendering_context.h ├── response.h ├── storage.h ├── style_sheet.h ├── style_sheet_list.h ├── svgmatrix.h ├── text.h ├── text_metrics.h ├── text_track.h ├── text_track_cue.h ├── text_track_cue_list.h ├── text_track_list.h ├── time_ranges.h ├── tree_walker.h ├── uint8_array.h ├── uint8_clamped_array.h ├── video_track.h ├── video_track_list.h ├── webgl_active_info.h ├── webgl_buffer.h ├── webgl_context_attributes.h ├── webgl_context_event.h ├── webgl_extension.h ├── webgl_framebuffer.h ├── webgl_object.h ├── webgl_program.h ├── webgl_renderbuffer.h ├── webgl_rendering_context.h ├── webgl_shader.h ├── webgl_shader_precision_format.h ├── webgl_texture.h ├── webgl_uniform_location.h ├── window.h ├── xml_document.h └── xml_http_request.h ├── src ├── application_cache.cc ├── array.cc ├── array_buffer.cc ├── array_buffer_view.cc ├── attr.cc ├── audio_track.cc ├── audio_track_list.cc ├── auto_release_pool.cc ├── bar_prop.cc ├── blob.cc ├── canvas_gradient.cc ├── canvas_pattern.cc ├── canvas_rendering_context_2d.cc ├── character_data.cc ├── comment.cc ├── console.cc ├── css_rule.cc ├── css_rule_list.cc ├── css_style_declaration.cc ├── css_style_sheet.cc ├── date.cc ├── document.cc ├── document_fragment.cc ├── document_type.cc ├── dom_error.cc ├── dom_implementation.cc ├── dom_token_list.cc ├── element.cc ├── event.cc ├── event_target.cc ├── export.cc ├── external.cc ├── file_reader.cc ├── float32_array.cc ├── float64_array.cc ├── history.cc ├── hit_region_options.cc ├── html_base_element.cc ├── html_body_element.cc ├── html_canvas_element.cc ├── html_collection.cc ├── html_content_element.cc ├── html_div_element.cc ├── html_element.cc ├── html_head_element.cc ├── html_image_element.cc ├── html_media_element.cc ├── html_properties_collection.cc ├── html_script_element.cc ├── html_source_element.cc ├── html_style_element.cc ├── html_video_element.cc ├── idb_database.cc ├── idb_environment.cc ├── idb_factory.cc ├── idb_index.cc ├── idb_index_parameters.cc ├── idb_object_store.cc ├── idb_open_db_request.cc ├── idb_request.cc ├── idb_transaction.cc ├── idb_version_change_event.cc ├── image_bitmap.cc ├── image_data.cc ├── link_style.cc ├── location.cc ├── media_controller.cc ├── media_error.cc ├── media_list.cc ├── mime_type.cc ├── mime_type_array.cc ├── native_array.cc ├── native_object.cc ├── navigator.cc ├── node.cc ├── node_filter.cc ├── node_iterator.cc ├── node_list.cc ├── object.cc ├── path2d.cc ├── performance.cc ├── performance_entry.cc ├── performance_navigation.cc ├── performance_timing.cc ├── plugin.cc ├── plugin_array.cc ├── processing_instruction.cc ├── promise.cc ├── range.cc ├── regexp.cc ├── rendering_context.cc ├── response.cc ├── storage.cc ├── string.cc ├── style_sheet.cc ├── style_sheet_list.cc ├── svgmatrix.cc ├── text.cc ├── text_metrics.cc ├── text_track.cc ├── text_track_cue.cc ├── text_track_cue_list.cc ├── text_track_list.cc ├── time_ranges.cc ├── tree_walker.cc ├── uint8_array.cc ├── uint8_clamped_array.cc ├── video_track.cc ├── video_track_list.cc ├── webgl_active_info.cc ├── webgl_buffer.cc ├── webgl_context_attributes.cc ├── webgl_context_event.cc ├── webgl_extension.cc ├── webgl_framebuffer.cc ├── webgl_object.cc ├── webgl_program.cc ├── webgl_renderbuffer.cc ├── webgl_rendering_context.cc ├── webgl_shader.cc ├── webgl_shader_precision_format.cc ├── webgl_texture.cc ├── webgl_uniform_location.cc ├── window.cc ├── xml_document.cc └── xml_http_request.cc └── test ├── .gitignore ├── index.js └── package.json /.gitignore: -------------------------------------------------------------------------------- 1 | # Prerequisites 2 | *.d 3 | 4 | # Compiled Object files 5 | *.slo 6 | *.lo 7 | *.o 8 | *.obj 9 | 10 | # Precompiled Headers 11 | *.gch 12 | *.pch 13 | 14 | # Compiled Dynamic libraries 15 | *.so 16 | *.dylib 17 | *.dll 18 | 19 | # Fortran module files 20 | *.mod 21 | *.smod 22 | 23 | # Compiled Static libraries 24 | *.lai 25 | *.la 26 | *.a 27 | *.lib 28 | 29 | # Executables 30 | *.exe 31 | *.out 32 | *.app 33 | 34 | build 35 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Knocknote, Inc. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | emscripten: 2 | image: knocknote/wasm:latest 3 | container_name: 'libhtml5' 4 | environment: 5 | ROOT_PATH: "/src/emscripten" 6 | entrypoint: tail -f /dev/null 7 | volumes: 8 | - ".:/src/emscripten" 9 | -------------------------------------------------------------------------------- /examples/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.0.2) 2 | 3 | set(ENABLE_EMSCRIPTEN $ENV{ENABLE_EMSCRIPTEN}) 4 | 5 | include_directories(../include) 6 | 7 | if ($ENV{ENABLE_EMSCRIPTEN}) 8 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Oz -g -std=c++11 --memory-init-file 0 --llvm-lto 1 --bind -s DEMANGLE_SUPPORT=1 -s WASM=0 -s NO_FILESYSTEM=1 -DENABLE_EMSCRIPTEN=1 -DPROPERTY_TRACE=1") 9 | link_directories(../build) 10 | link_libraries("-lhtml5") 11 | add_executable(libhtml5_example image.cc video.cc style_sheet.cc array.cc string.cc test_exec.cc promise.cc) 12 | else() 13 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -g -std=c++11") 14 | link_libraries("-lhtml5") 15 | add_executable(libhtml5_example image.cc video.cc style_sheet.cc array.cc string.cc test_exec.cc) 16 | endif() 17 | -------------------------------------------------------------------------------- /examples/array.cc: -------------------------------------------------------------------------------- 1 | #include "libhtml5.h" 2 | #include 3 | 4 | static void arrayTest() 5 | { 6 | html5::array subarray; 7 | html5::array array = { 8 | 1, M_PI, "hello", subarray, html5::Object::create(), 9 | }; 10 | html5::console->log("array = ", array); 11 | 12 | int ivalue = array[0]; 13 | html5::console->log("array[0] = ", ivalue); 14 | 15 | double fvalue = array[1]; 16 | html5::console->log("array[1] = ", fvalue); 17 | 18 | std::string svalue = array[2]; 19 | html5::console->log("array[2] = ", svalue); 20 | 21 | html5::array *avalue = array[3]; 22 | html5::console->log("array[3] = ", avalue); 23 | 24 | html5::Object *ovalue = array[4]; 25 | html5::console->log("array[4] = ", ovalue); 26 | 27 | int index = 0; 28 | for (const auto &e : array) { 29 | switch (index) { 30 | case 0: 31 | html5::console->log((int)e); 32 | break; 33 | case 1: 34 | html5::console->log((double)e); 35 | break; 36 | case 2: 37 | html5::console->log((std::string)e); 38 | break; 39 | case 3: 40 | html5::console->log((html5::array)e); 41 | break; 42 | case 4: 43 | html5::console->log((html5::Object *)e); 44 | break; 45 | } 46 | index++; 47 | } 48 | 49 | array.forEach([](const html5::array::Element &e, int index){ 50 | html5::console->log(index); 51 | }); 52 | } 53 | 54 | EMSCRIPTEN_BINDINGS(Array) { 55 | emscripten::function("arrayTest", &arrayTest); 56 | } 57 | -------------------------------------------------------------------------------- /examples/image.cc: -------------------------------------------------------------------------------- 1 | #include "libhtml5.h" 2 | #include 3 | 4 | static void createImage(std::string url) 5 | { 6 | for (html5::StyleSheet *sheet : *html5::document->styleSheets) { 7 | html5::console->log(sheet); 8 | } 9 | html5::HTMLImageElement *image = html5::HTMLImageElement::create(); 10 | static html5::EventHandler onload = [image](html5::Event *e){ 11 | std::cout << "callback. onload" << std::endl; 12 | html5::console->trace(); 13 | std::cout << "width = " << image->width << std::endl; 14 | std::cout << "height = " << image->height << std::endl; 15 | std::cout << "naturalWidth = " << image->naturalWidth << std::endl; 16 | std::cout << "naturalHeight = " << image->naturalHeight << std::endl; 17 | }; 18 | image->onload = &onload; 19 | image->src = url; 20 | html5::document->body->appendChild(image); 21 | html5::console->log("image = ", image); 22 | } 23 | -------------------------------------------------------------------------------- /examples/promise.cc: -------------------------------------------------------------------------------- 1 | #include "libhtml5.h" 2 | 3 | static void promiseTest() 4 | { 5 | auto promise = html5::Promise::create([](std::function resolve, std::function reject) { 6 | html5::setTimeout([resolve](){ resolve("foo"); }, 300); 7 | }); 8 | promise->then([](const std::string &value) { 9 | html5::console->log(value); 10 | return html5::Promise::resolve("bar"); 11 | })->then([](const std::string &value) { 12 | html5::console->log(value); 13 | return html5::Promise::resolve(0.0); 14 | }); 15 | html5::console->log(promise); 16 | } 17 | 18 | static void fetchImageTest(const std::string &imageURL) 19 | { 20 | html5::fetch(imageURL)->then([](html5::Response *response) { 21 | return response->blob(); 22 | })->then([](html5::Blob *blob) { 23 | auto reader = html5::FileReader::create(); 24 | reader->onload = [reader](html5::Event *event) { 25 | std::string data = reader->result; 26 | auto image = html5::HTMLImageElement::create(); 27 | image->src = data; 28 | html5::document->body->appendChild(image); 29 | }; 30 | reader->readAsDataURL(blob); 31 | return nullptr; 32 | })->catchError([]{ 33 | html5::console->log("catch"); 34 | return nullptr; 35 | })->finally([]{ 36 | html5::console->log("finally"); 37 | return nullptr; 38 | }); 39 | } 40 | 41 | EMSCRIPTEN_BINDINGS(Promise) { 42 | emscripten::function("promiseTest", &promiseTest); 43 | emscripten::function("fetchImageTest", &fetchImageTest); 44 | } 45 | -------------------------------------------------------------------------------- /examples/string.cc: -------------------------------------------------------------------------------- 1 | #include "libhtml5.h" 2 | 3 | static void stringTest() 4 | { 5 | { 6 | html5::string s = "hello world"; 7 | std::cout << s << std::endl; 8 | html5::console->log(s); 9 | } 10 | { 11 | std::string s = "hello"; 12 | html5::string s2 = s; 13 | s2 += "world"; 14 | std::cout << s2 << std::endl; 15 | } 16 | { 17 | html5::string a = "hello"; 18 | html5::string b = "world"; 19 | html5::string c = a + b; 20 | std::cout << c << std::endl; 21 | } 22 | { 23 | html5::string s = "hello world"; 24 | for (const auto &splitted : s.split(" ")) { 25 | html5::string v = splitted; 26 | std::cout << v << std::endl; 27 | std::cout << "includes h? " << v.includes("h") << std::endl; 28 | } 29 | } 30 | { 31 | html5::string s = "0123456789abcdef"; 32 | std::string primitiveStr = s.substr(1, 10).toUpperCase(); 33 | std::cout << primitiveStr << std::endl; 34 | } 35 | } 36 | 37 | EMSCRIPTEN_BINDINGS(string) { 38 | emscripten::function("stringTest", &stringTest); 39 | } 40 | -------------------------------------------------------------------------------- /examples/style_sheet.cc: -------------------------------------------------------------------------------- 1 | #include "libhtml5.h" 2 | #include 3 | 4 | using namespace html5; 5 | 6 | static void addStyleSheet() { 7 | auto document = window->document; 8 | auto sheets = window->document->styleSheets; 9 | if (sheets->length == 0) { 10 | auto elem = document->createElement("style"); 11 | elem->setAttribute("type","text/css"); 12 | elem->innerText = "body { background-color: yellow; }"; 13 | window->console->log(elem); 14 | document->head->appendChild(elem); 15 | 16 | auto style = dynamic_cast(elem); 17 | std::cout << (std::string)style->media << std::endl; 18 | std::cout << (std::string)style->type << std::endl; 19 | std::cout << std::boolalpha << style->scoped << std::endl; 20 | window->console->log((StyleSheet *)style->sheet); 21 | return; 22 | } 23 | 24 | for (auto sheet : *sheets) { 25 | window->console->log(sheet); 26 | auto cssSheet = dynamic_cast(sheet); 27 | for (auto i = 0; i < cssSheet->cssRules->length; i++) { 28 | auto rule = cssSheet->cssRules->item(i); 29 | window->console->log(rule); 30 | cssSheet->deleteRule(i); 31 | } 32 | cssSheet->insertRule("body { background-color: aqua; }", 0); 33 | 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /examples/test_exec.cc: -------------------------------------------------------------------------------- 1 | #include "libhtml5.h" 2 | 3 | #include "image.cc" 4 | #include "style_sheet.cc" 5 | #include "video.cc" 6 | 7 | static void executeTest() 8 | { 9 | addStyleSheet(); 10 | createImage("https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png"); 11 | createVideo("http://clips.vorwaerts-gmbh.de/VfE_html5.mp4"); 12 | } 13 | 14 | EMSCRIPTEN_BINDINGS(html5example) { 15 | emscripten::function("executeTest", &executeTest); 16 | } 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /examples/video.cc: -------------------------------------------------------------------------------- 1 | #include "libhtml5.h" 2 | #include 3 | 4 | static void createVideo(std::string url) 5 | { 6 | html5::HTMLVideoElement *video = html5::HTMLVideoElement::create(); 7 | html5::HTMLSourceElement *source = html5::HTMLSourceElement::create(); 8 | source->src = url; 9 | video->appendChild(source); 10 | static html5::EventHandler f = [](html5::Event *e){ 11 | std::cout << "demo event fired!!!" << std::endl; 12 | std::cout << (std::string)e->type << std::endl; 13 | std::cout << e->bubbles << std::endl; 14 | std::cout << e->timeStamp << std::endl; 15 | }; 16 | video->addEventListener("demo", &f); 17 | html5::Document *document = html5::window->document; 18 | document->body->appendChild(video); 19 | html5::Event *event = html5::Event::create("demo"); 20 | video->dispatchEvent(event); 21 | } 22 | -------------------------------------------------------------------------------- /include/application_cache.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "event_target.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class ApplicationCache : public EventTarget { 8 | public: 9 | enum { 10 | UNCACHED = 0, 11 | IDLE = 1, 12 | CHECKING = 2, 13 | DOWNLOADING = 3, 14 | UPDATEREADY = 4, 15 | OBSOLETE = 5, 16 | }; 17 | 18 | HTML5_EVENT_HANDLER_PROPERTY(ApplicationCache, EventHandler *, oncached); 19 | HTML5_EVENT_HANDLER_PROPERTY(ApplicationCache, EventHandler *, onchecking); 20 | HTML5_EVENT_HANDLER_PROPERTY(ApplicationCache, EventHandler *, ondownloading); 21 | HTML5_EVENT_HANDLER_PROPERTY(ApplicationCache, EventHandler *, onerror); 22 | HTML5_EVENT_HANDLER_PROPERTY(ApplicationCache, EventHandler *, onnoupdate); 23 | HTML5_EVENT_HANDLER_PROPERTY(ApplicationCache, EventHandler *, onobsolete); 24 | HTML5_EVENT_HANDLER_PROPERTY(ApplicationCache, EventHandler *, onprogress); 25 | HTML5_EVENT_HANDLER_PROPERTY(ApplicationCache, EventHandler *, onupdateready); 26 | HTML5_PROPERTY(ApplicationCache, unsigned short, status); 27 | 28 | ApplicationCache(emscripten::val v); 29 | virtual ~ApplicationCache(); 30 | static ApplicationCache *create(emscripten::val v); 31 | void abort(); 32 | void swapCache(); 33 | void update(); 34 | }; 35 | 36 | NAMESPACE_HTML5_END; 37 | -------------------------------------------------------------------------------- /include/array_buffer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "html5.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class ArrayBuffer : public Object { 8 | public: 9 | 10 | HTML5_PROPERTY(ArrayBuffer, unsigned long, byteLength); 11 | 12 | ArrayBuffer(emscripten::val v); 13 | virtual ~ArrayBuffer(); 14 | static ArrayBuffer *create(emscripten::val v); 15 | static ArrayBuffer *create(unsigned long length); 16 | static bool isView(Object *o); 17 | ArrayBuffer *slice(long begin); 18 | ArrayBuffer *slice(long begin, long end); 19 | }; 20 | 21 | NAMESPACE_HTML5_END; 22 | -------------------------------------------------------------------------------- /include/array_buffer_view.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "html5.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class ArrayBuffer; 8 | 9 | class ArrayBufferView : public Object { 10 | public: 11 | 12 | HTML5_PROPERTY_OBJECT(ArrayBufferView, ArrayBuffer, buffer); 13 | HTML5_PROPERTY(ArrayBufferView, unsigned long, byteLength); 14 | HTML5_PROPERTY(ArrayBufferView, unsigned long, byteOffset); 15 | 16 | ArrayBufferView(emscripten::val v); 17 | virtual ~ArrayBufferView(); 18 | static ArrayBufferView *create(emscripten::val v); 19 | }; 20 | 21 | NAMESPACE_HTML5_END; 22 | -------------------------------------------------------------------------------- /include/attr.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "html5.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class Attr : public Object { 8 | public: 9 | 10 | HTML5_PROPERTY(Attr, std::string, localName); 11 | HTML5_PROPERTY(Attr, std::string, name); 12 | HTML5_PROPERTY(Attr, std::string, namespaceURI); 13 | HTML5_PROPERTY(Attr, std::string, prefix); 14 | HTML5_PROPERTY(Attr, bool, specified); 15 | HTML5_PROPERTY(Attr, std::string, value); 16 | 17 | Attr(emscripten::val v); 18 | virtual ~Attr(); 19 | static Attr *create(emscripten::val v); 20 | static Attr *create(); 21 | }; 22 | 23 | NAMESPACE_HTML5_END; 24 | -------------------------------------------------------------------------------- /include/audio_track.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "html5.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class AudioTrack : public Object { 8 | public: 9 | 10 | HTML5_PROPERTY(AudioTrack, bool, enabled); 11 | HTML5_PROPERTY(AudioTrack, std::string, id); 12 | HTML5_PROPERTY(AudioTrack, std::string, kind); 13 | HTML5_PROPERTY(AudioTrack, std::string, label); 14 | HTML5_PROPERTY(AudioTrack, std::string, language); 15 | 16 | AudioTrack(emscripten::val v); 17 | virtual ~AudioTrack(); 18 | static AudioTrack *create(emscripten::val v); 19 | }; 20 | 21 | NAMESPACE_HTML5_END; 22 | -------------------------------------------------------------------------------- /include/audio_track_list.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "event_target.h" 4 | #include "event_handler.h" 5 | 6 | NAMESPACE_HTML5_BEGIN; 7 | 8 | class AudioTrack; 9 | 10 | class AudioTrackList : public EventTarget { 11 | public: 12 | 13 | HTML5_PROPERTY(AudioTrackList, unsigned long, length); 14 | HTML5_EVENT_HANDLER_PROPERTY(AudioTrackList, EventHandler *, onaddtrack); 15 | HTML5_EVENT_HANDLER_PROPERTY(AudioTrackList, EventHandler *, onchange); 16 | HTML5_EVENT_HANDLER_PROPERTY(AudioTrackList, EventHandler *, onremovetrack); 17 | 18 | AudioTrackList(emscripten::val v); 19 | virtual ~AudioTrackList(); 20 | static AudioTrackList *create(emscripten::val v); 21 | AudioTrack *getter(unsigned long index); 22 | AudioTrack *getTrackById(std::string id); 23 | }; 24 | 25 | NAMESPACE_HTML5_END; 26 | -------------------------------------------------------------------------------- /include/auto_release_pool.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "html5.h" 4 | #include 5 | 6 | NAMESPACE_HTML5_BEGIN; 7 | 8 | class NativeObject; 9 | 10 | class AutoReleasePool { 11 | public: 12 | 13 | AutoReleasePool(); 14 | ~AutoReleasePool(); 15 | static AutoReleasePool *sharedInstance(); 16 | void addObject(NativeObject *o); 17 | void clear(); 18 | bool contains(NativeObject *o) const; 19 | void releaseObjects(); 20 | 21 | private: 22 | std::vector objects; 23 | }; 24 | 25 | NAMESPACE_HTML5_END; 26 | -------------------------------------------------------------------------------- /include/bar_prop.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "html5.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class BarProp : public Object { 8 | public: 9 | HTML5_PROPERTY(BarProp, bool, visible); 10 | 11 | BarProp(emscripten::val v); 12 | virtual ~BarProp(); 13 | static BarProp *create(emscripten::val v); 14 | }; 15 | 16 | NAMESPACE_HTML5_END; 17 | -------------------------------------------------------------------------------- /include/blob.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "html5.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class Blob : public Object { 8 | public: 9 | 10 | HTML5_PROPERTY(Blob, unsigned long long, size); 11 | HTML5_PROPERTY(Blob, std::string, type); 12 | 13 | Blob(emscripten::val v); 14 | virtual ~Blob(); 15 | static Blob *create(emscripten::val v); 16 | void close(); 17 | Blob *slice(long long start = 0); 18 | Blob *slice(long long start, long long end, std::string contentType = ""); 19 | }; 20 | 21 | NAMESPACE_HTML5_END; 22 | -------------------------------------------------------------------------------- /include/canvas_fill_rule.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | enum class CanvasFillRule { 6 | NONZERO, 7 | EVENODD, 8 | }; 9 | 10 | inline std::string toCanvasFillRuleString(CanvasFillRule rule) 11 | { 12 | switch (rule) { 13 | case CanvasFillRule::NONZERO: 14 | return "nonzero"; 15 | break; 16 | case CanvasFillRule::EVENODD: 17 | return "evenodd"; 18 | break; 19 | } 20 | return ""; 21 | } 22 | 23 | inline CanvasFillRule toCanvasFillRule(std::string rule) 24 | { 25 | if (rule == "nonzero") { 26 | return CanvasFillRule::NONZERO; 27 | } else if (rule == "evenodd") { 28 | return CanvasFillRule::EVENODD; 29 | } 30 | assert(false && "cannot convert to CanvasFillRule"); 31 | return CanvasFillRule::NONZERO; 32 | } 33 | -------------------------------------------------------------------------------- /include/canvas_gradient.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "html5.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class CanvasGradient : public Object { 8 | public: 9 | 10 | CanvasGradient(emscripten::val v); 11 | virtual ~CanvasGradient(); 12 | static CanvasGradient *create(emscripten::val v); 13 | void addColorStop(double offset, std::string color); 14 | }; 15 | 16 | NAMESPACE_HTML5_END; 17 | -------------------------------------------------------------------------------- /include/canvas_pattern.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "html5.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class SVGMatrix; 8 | 9 | class CanvasPattern : public Object { 10 | public: 11 | 12 | CanvasPattern(emscripten::val v); 13 | virtual ~CanvasPattern(); 14 | static CanvasPattern *create(emscripten::val v); 15 | void setTransform(SVGMatrix *transform); 16 | }; 17 | 18 | NAMESPACE_HTML5_END; 19 | -------------------------------------------------------------------------------- /include/character_data.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "node.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class Element; 8 | 9 | class CharacterData : public Node { 10 | public: 11 | 12 | HTML5_PROPERTY(CharacterData, std::string, data); 13 | HTML5_PROPERTY(CharacterData, unsigned long, length); 14 | HTML5_PROPERTY_OBJECT(CharacterData, Element, nextElementSibling); 15 | HTML5_PROPERTY_OBJECT(CharacterData, Element, previousElementSibling); 16 | 17 | CharacterData(emscripten::val v); 18 | virtual ~CharacterData(); 19 | static CharacterData *create(emscripten::val v); 20 | template void after(Node *node, Args ...args) { 21 | std::vector nodes = { args... }; 22 | nodes.insert(nodes.begin(), node); 23 | after(nodes); 24 | }; 25 | void after(std::vector nodes); 26 | void appendData(std::string data); 27 | template void before(Node *node, Args ...args) { 28 | std::vector nodes = { args... }; 29 | nodes.insert(nodes.begin(), node); 30 | before(nodes); 31 | }; 32 | void before(std::vector nodes); 33 | void deleteData(unsigned long offset, unsigned long count); 34 | void insertData(unsigned long offset, std::string data); 35 | void remove(); 36 | template void replace(Node *node, Args ...args) { 37 | std::vector nodes = { args... }; 38 | nodes.insert(nodes.begin(), node); 39 | replace(nodes); 40 | }; 41 | void replace(std::vector nodes); 42 | void replaceData(unsigned long offset, unsigned long count, std::string data); 43 | std::string substringData(unsigned long offset, unsigned long count); 44 | }; 45 | 46 | NAMESPACE_HTML5_END; 47 | -------------------------------------------------------------------------------- /include/comment.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "character_data.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class Comment : public CharacterData { 8 | public: 9 | 10 | Comment(emscripten::val v); 11 | virtual ~Comment(); 12 | static Comment *create(emscripten::val v); 13 | }; 14 | 15 | NAMESPACE_HTML5_END; 16 | -------------------------------------------------------------------------------- /include/css_rule.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "html5.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class CSSStyleSheet; 8 | 9 | class CSSRule : public Object { 10 | public: 11 | 12 | enum { 13 | STYLE_RULE = 1, 14 | CHARSET_RULE = 2, 15 | IMPORT_RULE = 3, 16 | MEDIA_RULE = 4, 17 | FONT_FACE_RULE = 5, 18 | PAGE_RULE = 6, 19 | MARGIN_RULE = 9, 20 | NAMESPACE_RULE = 10, 21 | HOST_RULE = 1001, 22 | }; 23 | 24 | HTML5_PROPERTY(CSSRule, std::string, cssText); 25 | HTML5_PROPERTY_OBJECT(CSSRule, CSSRule, parentRule); 26 | HTML5_PROPERTY_OBJECT(CSSRule, CSSStyleSheet, parentStyleSheet); 27 | HTML5_PROPERTY(CSSRule, unsigned short, type); 28 | 29 | CSSRule(emscripten::val v); 30 | virtual ~CSSRule(); 31 | static CSSRule *create(emscripten::val v); 32 | }; 33 | 34 | NAMESPACE_HTML5_END; 35 | -------------------------------------------------------------------------------- /include/css_rule_list.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "html5.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class CSSRule; 8 | 9 | class CSSRuleList : public Object { 10 | public: 11 | 12 | HTML5_PROPERTY(CSSRuleList, unsigned long, length); 13 | HTML5_DEFINE_ITERATOR(CSSRuleList, CSSRule); 14 | 15 | CSSRuleList(emscripten::val v); 16 | virtual ~CSSRuleList(); 17 | static CSSRuleList *create(emscripten::val v); 18 | CSSRule *item(unsigned long index); 19 | 20 | 21 | }; 22 | 23 | NAMESPACE_HTML5_END; 24 | -------------------------------------------------------------------------------- /include/css_style_sheet.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "style_sheet.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class CSSRule; 8 | class CSSRuleList; 9 | 10 | class CSSStyleSheet : public StyleSheet { 11 | public: 12 | 13 | HTML5_PROPERTY_OBJECT(CSSStyleSheet, CSSRuleList, cssRules); 14 | HTML5_PROPERTY_OBJECT(CSSStyleSheet, CSSRule, ownerRule); 15 | 16 | CSSStyleSheet(emscripten::val v); 17 | virtual ~CSSStyleSheet(); 18 | static CSSStyleSheet *create(emscripten::val v); 19 | void deleteRule(unsigned long index); 20 | unsigned long insertRule(std::string rule, unsigned long index); 21 | }; 22 | 23 | NAMESPACE_HTML5_END; 24 | -------------------------------------------------------------------------------- /include/document_fragment.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "node.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class HTMLCollection; 8 | class Element; 9 | class NodeList; 10 | 11 | class DocumentFragment : public Node { 12 | public: 13 | 14 | HTML5_PROPERTY(DocumentFragment, unsigned long, childElementCount); 15 | HTML5_PROPERTY_OBJECT(DocumentFragment, HTMLCollection, children); 16 | HTML5_PROPERTY_OBJECT(DocumentFragment, Element, firstElementChild); 17 | HTML5_PROPERTY_OBJECT(DocumentFragment, Element, lastElementChild); 18 | 19 | DocumentFragment(emscripten::val v); 20 | virtual ~DocumentFragment(); 21 | static DocumentFragment *create(emscripten::val v); 22 | template void append(Node *node, Args ...args) { 23 | std::vector nodes = { args... }; 24 | nodes.insert(nodes.begin(), node); 25 | append(nodes); 26 | }; 27 | void append(std::vector nodes); 28 | Element *getElementById(std::string elementId); 29 | template void prepend(Node *node, Args ...args) { 30 | std::vector nodes = { args... }; 31 | nodes.insert(nodes.begin(), node); 32 | prepend(nodes); 33 | }; 34 | void prepend(std::vector nodes); 35 | Element *query(std::string relativeSelectors); 36 | std::vector queryAll(std::string relativeSelectors); 37 | Element *querySelector(std::string selectors); 38 | NodeList *querySelectorAll(std::string selectors); 39 | }; 40 | 41 | NAMESPACE_HTML5_END; 42 | -------------------------------------------------------------------------------- /include/document_type.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "html5.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class Node; 8 | 9 | class DocumentType : public Object { 10 | public: 11 | 12 | HTML5_PROPERTY(DocumentType, std::string, name); 13 | HTML5_PROPERTY(DocumentType, std::string, publicId); 14 | HTML5_PROPERTY(DocumentType, std::string, systemId); 15 | 16 | DocumentType(emscripten::val v); 17 | virtual ~DocumentType(); 18 | static DocumentType *create(emscripten::val v); 19 | template void after(Node *node, Args ...args) { 20 | std::vector nodes = { args... }; 21 | nodes.insert(nodes.begin(), node); 22 | after(nodes); 23 | }; 24 | void after(std::vector nodes); 25 | template void before(Node *node, Args ...args) { 26 | std::vector nodes = { args... }; 27 | nodes.insert(nodes.begin(), node); 28 | before(nodes); 29 | }; 30 | void before(std::vector nodes); 31 | template void replace(Node *node, Args ...args) { 32 | std::vector nodes = { args... }; 33 | nodes.insert(nodes.begin(), node); 34 | replace(nodes); 35 | }; 36 | void replace(std::vector nodes); 37 | void remove(); 38 | }; 39 | 40 | NAMESPACE_HTML5_END; 41 | -------------------------------------------------------------------------------- /include/dom_error.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "html5.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class DOMError : public Object { 8 | public: 9 | 10 | HTML5_PROPERTY(DOMError, std::string, message); 11 | HTML5_PROPERTY(DOMError, std::string, name); 12 | 13 | DOMError(emscripten::val v); 14 | virtual ~DOMError(); 15 | static DOMError *create(emscripten::val v); 16 | }; 17 | 18 | NAMESPACE_HTML5_END; 19 | -------------------------------------------------------------------------------- /include/dom_implementation.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "html5.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class Document; 8 | class XMLDocument; 9 | class DocumentType; 10 | 11 | class DOMImplementation : public Object { 12 | public: 13 | 14 | DOMImplementation(emscripten::val v); 15 | virtual ~DOMImplementation(); 16 | static DOMImplementation *create(emscripten::val v); 17 | XMLDocument *createDocument(std::string _namespace, std::string qualifiedName, DocumentType *type = NULL); 18 | DocumentType *createDocumentType(std::string qualifiedName, std::string publicId, std::string systemId); 19 | Document *createHTMLDocument(std::string title = ""); 20 | bool hasFeature(); 21 | }; 22 | 23 | NAMESPACE_HTML5_END; 24 | -------------------------------------------------------------------------------- /include/dom_token_list.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "html5.h" 4 | #include 5 | 6 | NAMESPACE_HTML5_BEGIN; 7 | 8 | class DOMTokenList : public Object { 9 | public: 10 | 11 | HTML5_PROPERTY(DOMTokenList, unsigned long, length); 12 | 13 | DOMTokenList(emscripten::val v); 14 | virtual ~DOMTokenList(); 15 | static DOMTokenList *create(emscripten::val v); 16 | template void add(Args ...args) { 17 | std::vector tokens = { args... }; 18 | add(tokens); 19 | }; 20 | void add(std::vector tokens); 21 | bool contains(std::string token); 22 | std::string item(unsigned long index); 23 | template void remove(Args ...args) { 24 | std::vector tokens = { args... }; 25 | remove(tokens); 26 | }; 27 | void remove(std::vector tokens); 28 | bool toggle(std::string token, bool force = false); 29 | }; 30 | 31 | NAMESPACE_HTML5_END; 32 | -------------------------------------------------------------------------------- /include/event.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "html5.h" 4 | #include 5 | 6 | NAMESPACE_HTML5_BEGIN; 7 | 8 | class EventTarget; 9 | 10 | class Event : public Object { 11 | public: 12 | enum { 13 | NONE = 0, 14 | CAPTURING_PHASE = 1, 15 | AT_TARGET = 2, 16 | BUBBLING_PHASE = 3, 17 | }; 18 | 19 | HTML5_PROPERTY(Event, bool, bubbles); 20 | HTML5_PROPERTY(Event, bool, cancelable); 21 | HTML5_PROPERTY_OBJECT(Event, EventTarget, currentTarget); 22 | HTML5_PROPERTY(Event, bool, defaultPrevented); 23 | HTML5_PROPERTY(Event, unsigned short, eventPhase); 24 | HTML5_PROPERTY(Event, bool, isTrusted); 25 | HTML5_PROPERTY_OBJECT(Event, EventTarget, target); 26 | HTML5_PROPERTY(Event, std::string, type); 27 | HTML5_PROPERTY(Event, time_t, timeStamp); 28 | 29 | Event(emscripten::val v); 30 | virtual ~Event(); 31 | static Event *create(std::string type); 32 | static Event *create(emscripten::val v); 33 | void initEvent(std::string type, bool bubbles, bool cancelable); 34 | void preventDefault(); 35 | void stopImmediatePropagation(); 36 | void stopPropagation(); 37 | }; 38 | 39 | NAMESPACE_HTML5_END; 40 | -------------------------------------------------------------------------------- /include/event_handler.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "event.h" 4 | #include 5 | #include 6 | 7 | NAMESPACE_HTML5_BEGIN; 8 | 9 | typedef std::function EventHandler; 10 | typedef std::function OnErrorEventHandler; 11 | 12 | NAMESPACE_HTML5_END; 13 | -------------------------------------------------------------------------------- /include/event_listener.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "event.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class EventListener { 8 | public: 9 | virtual void handleEvent(Event *event) = 0; 10 | }; 11 | 12 | NAMESPACE_HTML5_END; 13 | -------------------------------------------------------------------------------- /include/event_target.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "html5.h" 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | #include "event_handler.h" 10 | #include "event_listener.h" 11 | 12 | NAMESPACE_HTML5_BEGIN; 13 | 14 | class Event; 15 | 16 | class EventTarget : public Object { 17 | public: 18 | 19 | EventTarget(emscripten::val v); 20 | virtual ~EventTarget(); 21 | static EventTarget *create(emscripten::val v); 22 | void addEventListener(std::string type, EventHandler *handler, bool capture = false); 23 | void addEventListener(std::string type, EventListener *listener, bool capture = false); 24 | bool dispatchEvent(Event *event); 25 | void removeEventListener(std::string type, EventHandler *handler, bool capture = false); 26 | void removeEventListener(std::string type, EventListener *listener, bool capture = false); 27 | void addEventListenerCallback(emscripten::val v); 28 | void addEventHandlerCallback(emscripten::val v); 29 | 30 | private: 31 | std::map> handlers; 32 | std::map> listeners; 33 | }; 34 | 35 | NAMESPACE_HTML5_END; 36 | -------------------------------------------------------------------------------- /include/export.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // this is included by libhtml5.h 4 | 5 | #include 6 | #include 7 | 8 | NAMESPACE_HTML5_BEGIN; 9 | 10 | class Window; 11 | class Document; 12 | class ApplicationCache; 13 | class Document; 14 | class External; 15 | class Element; 16 | class History; 17 | class IDBFactory; 18 | class Storage; 19 | class Location; 20 | class BarProp; 21 | class Navigator; 22 | class Promise; 23 | class CSSStyleDeclaration; 24 | class HTMLImageElement; 25 | class HTMLVideoElement; 26 | class HTMLCanvasElement; 27 | class Blob; 28 | class ImageData; 29 | class CanvasRenderingContext2D; 30 | class ImageBitmap; 31 | class Transferable; 32 | class Performance; 33 | class WindowProxy; 34 | class Console; 35 | 36 | extern void alert(std::string message); 37 | extern std::string atob(std::string atob); 38 | extern void blur(); 39 | extern std::string btoa(std::string btoa); 40 | extern void cancelAnimationFrame(long handle); 41 | extern void clearInterval(long handle); 42 | extern void clearTimeout(long handle); 43 | extern void close(); 44 | extern bool confirm(std::string message); 45 | extern Promise *createImageBitmap(HTMLImageElement *image, long sx, long sy, long sw, long sh); 46 | extern Promise *createImageBitmap(HTMLVideoElement *image, long sx, long sy, long sw, long sh); 47 | extern Promise *createImageBitmap(HTMLCanvasElement *image, long sx, long sy, long sw, long sh); 48 | extern Promise *createImageBitmap(Blob *image, long sx, long sy, long sw, long sh); 49 | extern Promise *createImageBitmap(ImageData *image, long sx, long sy, long sw, long sh); 50 | extern Promise *createImageBitmap(CanvasRenderingContext2D *image, long sx, long sy, long sw, long sh); 51 | extern Promise *createImageBitmap(ImageBitmap *image, long sx, long sy, long sw, long sh); 52 | extern Promise *fetch(const std::string &url); 53 | extern void focus(); 54 | extern CSSStyleDeclaration *getComputedStyle(Element *elt, std::string pseudoElt); 55 | extern WindowProxy *getter(void *indexName); 56 | extern WindowProxy *open(std::string url, std::string target, std::string features, bool replace); 57 | extern void postMessage(void *message, std::string targetOrigin, std::vector transfer); 58 | extern void print(); 59 | extern std::string prompt(std::string message, std::string _default); 60 | extern long requestAnimationFrame(const std::function &callback); 61 | extern long setInterval(const std::function &handler, long timeout); 62 | extern long setTimeout(const std::function &handler, long timeout); 63 | extern void stop(); 64 | 65 | NAMESPACE_HTML5_END; 66 | -------------------------------------------------------------------------------- /include/external.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "html5.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class External : public Object { 8 | public: 9 | 10 | External(emscripten::val v); 11 | virtual ~External(); 12 | static External *create(emscripten::val v); 13 | void AddSearchProvider(std::string engineURL); 14 | unsigned long IsSearchProviderInstalled(std::string engineURL); 15 | }; 16 | 17 | NAMESPACE_HTML5_END; 18 | -------------------------------------------------------------------------------- /include/file_reader.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "event_target.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class Blob; 8 | class File; 9 | class ArrayBuffer; 10 | 11 | class FileReader : public EventTarget { 12 | public: 13 | struct { 14 | FileReader &self; 15 | operator ArrayBuffer *() { return self.resultArrayBuffer(); }; 16 | operator std::string () { return self.resultString(); }; 17 | } result{*this}; 18 | HTML5_EVENT_HANDLER_PROPERTY(FileReader, EventHandler, onload); 19 | 20 | FileReader(emscripten::val v); 21 | virtual ~FileReader(); 22 | static FileReader *create(); 23 | void abort(); 24 | void readAsArrayBuffer(Blob *blob); 25 | void readAsArrayBuffer(File *file); 26 | void readAsBinaryString(Blob *blob); 27 | void readAsBinaryString(File *file); 28 | void readAsDataURL(Blob *blob); 29 | void readAsDataURL(File *file); 30 | void readAsText(Blob *blob, const std::string &encoding = "utf-8"); 31 | void readAsText(File *file, const std::string &encoding = "utf-8"); 32 | 33 | ArrayBuffer *resultArrayBuffer() const; 34 | std::string resultString() const; 35 | }; 36 | 37 | NAMESPACE_HTML5_END; -------------------------------------------------------------------------------- /include/float32_array.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "array_buffer_view.h" 4 | #include 5 | 6 | NAMESPACE_HTML5_BEGIN; 7 | 8 | class ArrayBuffer; 9 | 10 | class Float32Array : public ArrayBufferView { 11 | public: 12 | const long BYTES_PER_ELEMENT = 4; 13 | 14 | HTML5_PROPERTY(Float32Array, unsigned long, length); 15 | 16 | class doubleWrapType { 17 | public: 18 | emscripten::val v; 19 | size_t index; 20 | 21 | doubleWrapType(emscripten::val v, size_t index); 22 | ~doubleWrapType(); 23 | void operator=(double value); 24 | }; 25 | 26 | Float32Array(emscripten::val v); 27 | virtual ~Float32Array(); 28 | static Float32Array *create(emscripten::val v); 29 | static Float32Array *create(unsigned long length); 30 | static Float32Array *create(Float32Array *array); 31 | static Float32Array *create(const std::vector &array); 32 | static Float32Array *create(ArrayBuffer *buffer); 33 | static Float32Array *create(ArrayBuffer *buffer, unsigned long byteOffset); 34 | static Float32Array *create(ArrayBuffer *buffer, unsigned long byteOffset, unsigned long length); 35 | double get(unsigned long index); 36 | void set(const array &array, unsigned long offset = 0); 37 | Float32Array *subarray(long start, long end); 38 | double operator[](std::size_t index) const; 39 | doubleWrapType operator[](std::size_t index); 40 | 41 | private: 42 | std::vector _rawdata; 43 | }; 44 | 45 | NAMESPACE_HTML5_END; 46 | -------------------------------------------------------------------------------- /include/float64_array.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "array_buffer_view.h" 4 | #include 5 | 6 | NAMESPACE_HTML5_BEGIN; 7 | 8 | class ArrayBuffer; 9 | 10 | class Float64Array : public ArrayBufferView { 11 | public: 12 | const long BYTES_PER_ELEMENT = 8; 13 | 14 | HTML5_PROPERTY(Float64Array, unsigned long, length); 15 | 16 | class doubleWrapType { 17 | public: 18 | emscripten::val v; 19 | size_t index; 20 | 21 | doubleWrapType(emscripten::val v, size_t index); 22 | ~doubleWrapType(); 23 | void operator=(double value); 24 | }; 25 | 26 | Float64Array(emscripten::val v); 27 | virtual ~Float64Array(); 28 | static Float64Array *create(emscripten::val v); 29 | static Float64Array *create(unsigned long length); 30 | static Float64Array *create(Float64Array *array); 31 | static Float64Array *create(const std::vector &array); 32 | static Float64Array *create(ArrayBuffer *buffer); 33 | static Float64Array *create(ArrayBuffer *buffer, unsigned long byteOffset); 34 | static Float64Array *create(ArrayBuffer *buffer, unsigned long byteOffset, unsigned long length); 35 | double get(unsigned long index); 36 | void set(const array &array, unsigned long offset = 0); 37 | Float64Array *subarray(long start, long end); 38 | double operator[](std::size_t index) const; 39 | doubleWrapType operator[](std::size_t index); 40 | 41 | private: 42 | std::vector _rawdata; 43 | }; 44 | 45 | NAMESPACE_HTML5_END; 46 | -------------------------------------------------------------------------------- /include/history.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "html5.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class History : public Object { 8 | public: 9 | 10 | HTML5_READONLY_PROPERTY(History, long, length); 11 | //HTML5_PROPERTY(History, void *, state); 12 | 13 | History(emscripten::val v); 14 | virtual ~History(); 15 | static History *create(emscripten::val v); 16 | void back(); 17 | void forward(); 18 | void go(long delta = 0); 19 | void pushState(void *data, std::string title, std::string url); 20 | void replaceState(void *data, std::string title, std::string url); 21 | }; 22 | 23 | NAMESPACE_HTML5_END; 24 | -------------------------------------------------------------------------------- /include/hit_region_options.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "html5.h" 4 | #include "canvas_fill_rule.h" 5 | 6 | NAMESPACE_HTML5_BEGIN; 7 | 8 | class Path2D; 9 | class Element; 10 | 11 | class HitRegionOptions : public Object { 12 | public: 13 | 14 | HTML5_PROPERTY_OBJECT(HitRegionOptions, Element, control); 15 | HTML5_PROPERTY(HitRegionOptions, std::string, cursor); 16 | HTML5_PROPERTY(HitRegionOptions, std::string, id); 17 | HTML5_PROPERTY(HitRegionOptions, std::string, label); 18 | HTML5_PROPERTY(HitRegionOptions, std::string, parentID); 19 | HTML5_PROPERTY_OBJECT(HitRegionOptions, Path2D, path); 20 | HTML5_PROPERTY(HitRegionOptions, std::string, role); 21 | CanvasFillRule _fillRule; 22 | 23 | HitRegionOptions(emscripten::val v); 24 | virtual ~HitRegionOptions(); 25 | static HitRegionOptions *create(emscripten::val v); 26 | std::string getFillRule(); 27 | void setFillRule(CanvasFillRule value); 28 | 29 | struct { 30 | HitRegionOptions &self; 31 | void operator=(CanvasFillRule value) { self.setFillRule(value); }; 32 | operator std::string() { return self.getFillRule(); }; 33 | } fillRule{*this}; 34 | }; 35 | 36 | NAMESPACE_HTML5_END; 37 | -------------------------------------------------------------------------------- /include/html5_regexp.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "object.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class regexp : public Object { 8 | public: 9 | 10 | HTML5_PROPERTY(regexp, bool, global); 11 | HTML5_PROPERTY(regexp, bool, ignoreCase); 12 | HTML5_PROPERTY(regexp, int, lastIndex); 13 | HTML5_PROPERTY(regexp, bool, multiline); 14 | HTML5_PROPERTY(regexp, std::string, source); 15 | 16 | regexp(const char *pattern); 17 | regexp(const char *pattern, const char *flags); 18 | regexp(const std::string &pattern); 19 | regexp(const std::string &pattern, const std::string &flags); 20 | regexp(emscripten::val v); 21 | virtual ~regexp(); 22 | regexp& operator=(const char *str); 23 | regexp& operator=(const std::string& s); 24 | static regexp *create(emscripten::val v); 25 | static regexp *create(std::string pattern); 26 | static regexp *create(std::string pattern, std::string flags); 27 | bool test(std::string s); 28 | std::vector exec(const std::string &s); 29 | }; 30 | 31 | NAMESPACE_HTML5_END; 32 | -------------------------------------------------------------------------------- /include/html_base_element.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "html5.h" 4 | #include "html_element.h" 5 | 6 | NAMESPACE_HTML5_BEGIN; 7 | 8 | class HTMLBaseElement : public HTMLElement { 9 | public: 10 | 11 | HTML5_PROPERTY(HTMLBaseElement, std::string, href); 12 | HTML5_PROPERTY(HTMLBaseElement, std::string, target); 13 | 14 | HTMLBaseElement(emscripten::val v); 15 | virtual ~HTMLBaseElement(); 16 | static HTMLBaseElement *create(emscripten::val v); 17 | 18 | }; 19 | 20 | NAMESPACE_HTML5_END; 21 | -------------------------------------------------------------------------------- /include/html_body_element.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "html5.h" 4 | #include "event_handler.h" 5 | #include "html_element.h" 6 | 7 | NAMESPACE_HTML5_BEGIN; 8 | 9 | class HTMLBodyElement : public HTMLElement { 10 | public: 11 | 12 | HTML5_EVENT_HANDLER_PROPERTY(HTMLBodyElement, EventHandler *, onafterprint); 13 | HTML5_EVENT_HANDLER_PROPERTY(HTMLBodyElement, EventHandler *, onbeforeprint); 14 | HTML5_EVENT_HANDLER_PROPERTY(HTMLBodyElement, EventHandler *, onbeforeunload); 15 | HTML5_EVENT_HANDLER_PROPERTY(HTMLBodyElement, EventHandler *, onhashchange); 16 | HTML5_EVENT_HANDLER_PROPERTY(HTMLBodyElement, EventHandler *, onlanguagechange); 17 | HTML5_EVENT_HANDLER_PROPERTY(HTMLBodyElement, EventHandler *, onmessage); 18 | HTML5_EVENT_HANDLER_PROPERTY(HTMLBodyElement, EventHandler *, onoffline); 19 | HTML5_EVENT_HANDLER_PROPERTY(HTMLBodyElement, EventHandler *, ononline); 20 | HTML5_EVENT_HANDLER_PROPERTY(HTMLBodyElement, EventHandler *, onpagehide); 21 | HTML5_EVENT_HANDLER_PROPERTY(HTMLBodyElement, EventHandler *, onpageshow); 22 | HTML5_EVENT_HANDLER_PROPERTY(HTMLBodyElement, EventHandler *, onpopstate); 23 | HTML5_EVENT_HANDLER_PROPERTY(HTMLBodyElement, EventHandler *, onstorage); 24 | HTML5_EVENT_HANDLER_PROPERTY(HTMLBodyElement, EventHandler *, onunload); 25 | 26 | HTMLBodyElement(emscripten::val v); 27 | virtual ~HTMLBodyElement(); 28 | static HTMLBodyElement *create(emscripten::val v); 29 | }; 30 | 31 | NAMESPACE_HTML5_END; 32 | -------------------------------------------------------------------------------- /include/html_canvas_element.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "html5.h" 4 | #include "html_element.h" 5 | #include "rendering_context.h" 6 | 7 | NAMESPACE_HTML5_BEGIN; 8 | 9 | class Blob; 10 | class WebGLContextAttributes; 11 | 12 | class HTMLCanvasElement : public HTMLElement { 13 | public: 14 | 15 | HTML5_PROPERTY(HTMLCanvasElement, unsigned long, height); 16 | HTML5_PROPERTY(HTMLCanvasElement, unsigned long, width); 17 | 18 | HTMLCanvasElement(emscripten::val v); 19 | virtual ~HTMLCanvasElement(); 20 | static HTMLCanvasElement *create(emscripten::val v); 21 | RenderingContext *getContext(std::string contextId = "2d"); 22 | RenderingContext *getContext(std::string contextId, WebGLContextAttributes *attr); 23 | void toBlob(std::function *callback, std::string mimeType = "image/png", double qualityArgument = 1.0); 24 | void toBlobCallback(emscripten::val v); 25 | std::string toDataURL(std::string type, double encoderOptions = 0.92); 26 | 27 | private: 28 | std::function *_toBlobFn; 29 | }; 30 | 31 | NAMESPACE_HTML5_END; 32 | -------------------------------------------------------------------------------- /include/html_collection.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "html5.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class Element; 8 | 9 | class HTMLCollection : public Object { 10 | public: 11 | 12 | HTML5_PROPERTY(HTMLCollection, unsigned long, length); 13 | 14 | HTMLCollection(emscripten::val v); 15 | virtual ~HTMLCollection(); 16 | static HTMLCollection *create(); 17 | static HTMLCollection *create(emscripten::val v); 18 | Element *item(unsigned long index); 19 | Element *namedItem(std::string name); 20 | }; 21 | 22 | NAMESPACE_HTML5_END; 23 | -------------------------------------------------------------------------------- /include/html_content_element.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "html_element.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class HTMLContentElement : public HTMLElement { 8 | public: 9 | 10 | HTML5_PROPERTY(HTMLContentElement, bool, resetStyleInheritance); 11 | HTML5_PROPERTY(HTMLContentElement, std::string, select); 12 | 13 | HTMLContentElement(emscripten::val v); 14 | virtual ~HTMLContentElement(); 15 | static HTMLContentElement *create(emscripten::val v); 16 | NodeList *getDistributedNodes(); 17 | }; 18 | 19 | NAMESPACE_HTML5_END; 20 | -------------------------------------------------------------------------------- /include/html_div_element.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "html_element.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class HTMLDivElement : public HTMLElement { 8 | public: 9 | 10 | HTMLDivElement(emscripten::val v); 11 | virtual ~HTMLDivElement(); 12 | static HTMLDivElement *create(emscripten::val v); 13 | }; 14 | 15 | NAMESPACE_HTML5_END; 16 | -------------------------------------------------------------------------------- /include/html_head_element.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "html_element.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class HTMLHeadElement : public HTMLElement { 8 | public: 9 | 10 | HTMLHeadElement(emscripten::val v); 11 | virtual ~HTMLHeadElement(); 12 | static HTMLHeadElement *create(emscripten::val v); 13 | }; 14 | 15 | NAMESPACE_HTML5_END; 16 | -------------------------------------------------------------------------------- /include/html_image_element.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "html_element.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class HTMLImageElement : public HTMLElement { 8 | public: 9 | 10 | HTML5_PROPERTY(HTMLImageElement, std::string, alt); 11 | HTML5_PROPERTY(HTMLImageElement, bool, complete); 12 | HTML5_PROPERTY(HTMLImageElement, std::string, crossOrigin); 13 | HTML5_PROPERTY(HTMLImageElement, unsigned long, height); 14 | HTML5_PROPERTY(HTMLImageElement, bool, isMap); 15 | HTML5_PROPERTY(HTMLImageElement, unsigned long, naturalHeight); 16 | HTML5_PROPERTY(HTMLImageElement, unsigned long, naturalWidth); 17 | HTML5_PROPERTY(HTMLImageElement, std::string, src); 18 | HTML5_PROPERTY(HTMLImageElement, std::string, srcset); 19 | HTML5_PROPERTY(HTMLImageElement, std::string, useMap); 20 | HTML5_PROPERTY(HTMLImageElement, unsigned long, width); 21 | 22 | HTMLImageElement(emscripten::val v); 23 | virtual ~HTMLImageElement(); 24 | static HTMLImageElement *create(); 25 | static HTMLImageElement *create(emscripten::val v); 26 | static HTMLImageElement *create(unsigned long width, unsigned long height); 27 | }; 28 | 29 | NAMESPACE_HTML5_END; 30 | -------------------------------------------------------------------------------- /include/html_menu_element.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "html5.h" 4 | #include "html_element.h" 5 | 6 | NAMESPACE_HTML5_BEGIN; 7 | 8 | class HTMLMenuElement : public HTMLElement { 9 | public: 10 | 11 | HTMLMenuElement(emscripten::val v); 12 | virtual ~HTMLMenuElement(); 13 | static HTMLMenuElement *create(emscripten::val v); 14 | }; 15 | 16 | NAMESPACE_HTML5_END; 17 | -------------------------------------------------------------------------------- /include/html_properties_collection.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "html_collection.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class HTMLPropertiesCollection : public HTMLCollection { 8 | public: 9 | 10 | HTMLPropertiesCollection(emscripten::val v); 11 | virtual ~HTMLPropertiesCollection(); 12 | static HTMLPropertiesCollection *create(emscripten::val v); 13 | }; 14 | 15 | NAMESPACE_HTML5_END; 16 | -------------------------------------------------------------------------------- /include/html_script_element.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "html_element.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class HTMLScriptElement : public HTMLElement { 8 | public: 9 | 10 | HTML5_PROPERTY(HTMLScriptElement, bool, async); 11 | HTML5_PROPERTY(HTMLScriptElement, std::string, charset); 12 | HTML5_PROPERTY(HTMLScriptElement, std::string, crossOrigin); 13 | HTML5_PROPERTY(HTMLScriptElement, bool, defer); 14 | HTML5_PROPERTY(HTMLScriptElement, std::string, src); 15 | HTML5_PROPERTY(HTMLScriptElement, std::string, text); 16 | HTML5_PROPERTY(HTMLScriptElement, std::string, type); 17 | 18 | HTMLScriptElement(emscripten::val v); 19 | virtual ~HTMLScriptElement(); 20 | static HTMLScriptElement *create(emscripten::val v); 21 | }; 22 | 23 | NAMESPACE_HTML5_END; 24 | -------------------------------------------------------------------------------- /include/html_source_element.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "html_element.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class HTMLSourceElement : public HTMLElement { 8 | public: 9 | 10 | HTML5_PROPERTY(HTMLSourceElement, std::string, src); 11 | HTML5_PROPERTY(HTMLSourceElement, std::string, type); 12 | 13 | HTMLSourceElement(emscripten::val v); 14 | ~HTMLSourceElement(); 15 | static HTMLSourceElement *create(); 16 | static HTMLSourceElement *create(emscripten::val v); 17 | }; 18 | 19 | NAMESPACE_HTML5_END; 20 | -------------------------------------------------------------------------------- /include/html_style_element.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "html_element.h" 4 | #include "link_style.h" 5 | #include "style_sheet.h" 6 | 7 | NAMESPACE_HTML5_BEGIN; 8 | 9 | class HTMLStyleElement : public HTMLElement, public LinkStyle { 10 | public: 11 | 12 | HTML5_PROPERTY(HTMLStyleElement, std::string, media); 13 | HTML5_PROPERTY(HTMLStyleElement, bool, scoped); 14 | HTML5_VIRTUAL_READONLY_PROPERTY_OBJECT(HTMLStyleElement, StyleSheet, sheet); 15 | HTML5_PROPERTY(HTMLStyleElement, std::string, type); 16 | 17 | HTMLStyleElement(emscripten::val v); 18 | virtual ~HTMLStyleElement(); 19 | static HTMLStyleElement *create(emscripten::val v); 20 | }; 21 | 22 | NAMESPACE_HTML5_END; 23 | -------------------------------------------------------------------------------- /include/html_video_element.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "html_media_element.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class HTMLVideoElement : public HTMLMediaElement { 8 | public: 9 | 10 | HTML5_PROPERTY(HTMLVideoElement, double, height); 11 | HTML5_PROPERTY(HTMLVideoElement, std::string, poster); 12 | HTML5_PROPERTY(HTMLVideoElement, double, videoHeight); 13 | HTML5_PROPERTY(HTMLVideoElement, double, videoWidth); 14 | HTML5_PROPERTY(HTMLVideoElement, double, width); 15 | 16 | HTMLVideoElement(emscripten::val v); 17 | ~HTMLVideoElement(); 18 | static HTMLVideoElement *create(); 19 | static HTMLVideoElement *create(emscripten::val v); 20 | }; 21 | 22 | NAMESPACE_HTML5_END; 23 | -------------------------------------------------------------------------------- /include/idb_cursor_direction.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | enum class IDBCursorDirection { 4 | NEXT, 5 | NEXT_UNIQUE, 6 | PREV, 7 | PREV_UNIQUE, 8 | }; 9 | -------------------------------------------------------------------------------- /include/idb_database.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "event_target.h" 4 | #include "idb_transaction.h" 5 | 6 | NAMESPACE_HTML5_BEGIN; 7 | 8 | class IDBObjectStore; 9 | 10 | class IDBDatabase : public EventTarget { 11 | public: 12 | 13 | HTML5_PROPERTY(IDBDatabase, std::string, name); 14 | HTML5_EVENT_HANDLER_PROPERTY(IDBDatabase, EventHandler *, onabort); 15 | HTML5_EVENT_HANDLER_PROPERTY(IDBDatabase, EventHandler *, onerror); 16 | HTML5_EVENT_HANDLER_PROPERTY(IDBDatabase, EventHandler *, onversionchange); 17 | HTML5_PROPERTY(IDBDatabase, unsigned long long, version); 18 | 19 | IDBDatabase(emscripten::val v); 20 | virtual ~IDBDatabase(); 21 | static IDBDatabase *create(emscripten::val v); 22 | void close(); 23 | IDBObjectStore *createObjectStore(std::string name); 24 | void deleteObjectStore(std::string name); 25 | IDBTransaction *transaction(std::string storeName, IDBTransactionMode mode); 26 | IDBTransaction *transaction(std::vector storeNames, IDBTransactionMode mode); 27 | }; 28 | 29 | NAMESPACE_HTML5_END; 30 | -------------------------------------------------------------------------------- /include/idb_environment.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "html5.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class IDBFactory; 8 | 9 | class IDBEnvironment : public Object { 10 | public: 11 | 12 | HTML5_PROPERTY(IDBEnvironment, IDBFactory *, indexedDB); 13 | 14 | IDBEnvironment(emscripten::val v); 15 | virtual ~IDBEnvironment(); 16 | static IDBEnvironment *create(emscripten::val v); 17 | }; 18 | 19 | NAMESPACE_HTML5_END; 20 | -------------------------------------------------------------------------------- /include/idb_factory.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "html5.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class IDBOpenDBRequest; 8 | 9 | class IDBFactory : public Object { 10 | public: 11 | 12 | IDBFactory(emscripten::val v); 13 | virtual ~IDBFactory(); 14 | static IDBFactory *create(emscripten::val v); 15 | short cmp(int a, int b); 16 | IDBOpenDBRequest *deleteDatabase(std::string name); 17 | IDBOpenDBRequest *open(std::string name, unsigned long long version); 18 | }; 19 | 20 | NAMESPACE_HTML5_END; 21 | -------------------------------------------------------------------------------- /include/idb_index.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "html5.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class IDBObjectStore; 8 | class IDBRequest; 9 | 10 | class IDBIndex : public Object { 11 | public: 12 | 13 | HTML5_PROPERTY(IDBIndex, std::string, keyPath); 14 | HTML5_PROPERTY(IDBIndex, bool, multiEntry); 15 | HTML5_PROPERTY(IDBIndex, std::string, name); 16 | HTML5_PROPERTY(IDBIndex, IDBObjectStore *, objectStore); 17 | HTML5_PROPERTY(IDBIndex, bool, unique); 18 | 19 | IDBIndex(emscripten::val v); 20 | virtual ~IDBIndex(); 21 | static IDBIndex *create(emscripten::val v); 22 | IDBRequest *count(int key); 23 | IDBRequest *get(int key); 24 | IDBRequest *getKey(int key); 25 | }; 26 | 27 | NAMESPACE_HTML5_END; 28 | -------------------------------------------------------------------------------- /include/idb_index_parameters.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "html5.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class IDBIndexParameters : public Object { 8 | public: 9 | 10 | HTML5_PROPERTY(IDBIndexParameters, bool, multiEntry); 11 | HTML5_PROPERTY(IDBIndexParameters, bool, unique); 12 | 13 | IDBIndexParameters(emscripten::val v); 14 | virtual ~IDBIndexParameters(); 15 | static IDBIndexParameters *create(emscripten::val v); 16 | }; 17 | 18 | NAMESPACE_HTML5_END; 19 | -------------------------------------------------------------------------------- /include/idb_object_store.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "html5.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class IDBRequest; 8 | class IDBIndex; 9 | class IDBTransaction; 10 | 11 | class IDBObjectStore : public Object { 12 | public: 13 | 14 | HTML5_PROPERTY(IDBObjectStore, bool, autoIncrement); 15 | HTML5_PROPERTY(IDBObjectStore, std::string, keyPath); 16 | HTML5_PROPERTY(IDBObjectStore, std::string, name); 17 | HTML5_PROPERTY(IDBObjectStore, IDBTransaction *, transaction); 18 | 19 | IDBObjectStore(emscripten::val v); 20 | virtual ~IDBObjectStore(); 21 | static IDBObjectStore *create(emscripten::val v); 22 | IDBRequest *add(int value, std::string key); 23 | IDBRequest *clear(); 24 | IDBRequest *count(int key); 25 | IDBIndex *createIndex(std::string name, std::string keyPath); 26 | IDBIndex *createIndex(std::string name, std::vector keyPath); 27 | IDBRequest *deleteWithKey(int key); 28 | void deleteIndex(std::string indexName); 29 | IDBRequest *get(int key); 30 | IDBIndex *index(std::string name); 31 | IDBRequest *put(int value, int key); 32 | }; 33 | 34 | NAMESPACE_HTML5_END; 35 | -------------------------------------------------------------------------------- /include/idb_open_db_request.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "idb_request.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class IDBOpenDBRequest : public IDBRequest { 8 | public: 9 | 10 | HTML5_EVENT_HANDLER_PROPERTY(IDBOpenDBRequest, EventHandler *, onblocked); 11 | HTML5_EVENT_HANDLER_PROPERTY(IDBOpenDBRequest, EventHandler *, onupgradeneeded); 12 | 13 | IDBOpenDBRequest(emscripten::val v); 14 | virtual ~IDBOpenDBRequest(); 15 | static IDBOpenDBRequest *create(emscripten::val v); 16 | }; 17 | 18 | NAMESPACE_HTML5_END; 19 | -------------------------------------------------------------------------------- /include/idb_request.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "event_target.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | enum class IDBRequestReadyState { 8 | PENDING, 9 | DONE, 10 | }; 11 | 12 | class DOMError; 13 | class IDBTransaction; 14 | 15 | class IDBRequest : public EventTarget { 16 | public: 17 | 18 | HTML5_PROPERTY(IDBRequest, DOMError *, error); 19 | HTML5_EVENT_HANDLER_PROPERTY(IDBRequest, EventHandler *, onerror); 20 | HTML5_EVENT_HANDLER_PROPERTY(IDBRequest, EventHandler *, onsuccess); 21 | HTML5_PROPERTY(IDBRequest, IDBTransaction *, transaction); 22 | void *_result; 23 | void *_source; 24 | IDBRequestReadyState _readyState; 25 | 26 | IDBRequest(emscripten::val v); 27 | virtual ~IDBRequest(); 28 | static IDBRequest *create(emscripten::val v); 29 | }; 30 | 31 | NAMESPACE_HTML5_END; 32 | -------------------------------------------------------------------------------- /include/idb_transaction.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "event_target.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | enum class IDBTransactionMode { 8 | READONLY, 9 | READWRITE, 10 | VERSIONCHANGE, 11 | }; 12 | 13 | class IDBObjectStore; 14 | class DOMError; 15 | class IDBDatabase; 16 | 17 | class IDBTransaction : public EventTarget { 18 | public: 19 | HTML5_PROPERTY(IDBTransaction, IDBDatabase *, db); 20 | HTML5_PROPERTY(IDBTransaction, DOMError *, error); 21 | HTML5_EVENT_HANDLER_PROPERTY(IDBTransaction, EventHandler *, onabort); 22 | HTML5_EVENT_HANDLER_PROPERTY(IDBTransaction, EventHandler *, oncomplete); 23 | HTML5_EVENT_HANDLER_PROPERTY(IDBTransaction, EventHandler *, onerror); 24 | IDBTransactionMode _mode; 25 | 26 | IDBTransaction(emscripten::val v); 27 | virtual ~IDBTransaction(); 28 | static IDBTransaction *create(emscripten::val v); 29 | void abort(); 30 | IDBObjectStore *objectStore(std::string name); 31 | }; 32 | 33 | NAMESPACE_HTML5_END; 34 | -------------------------------------------------------------------------------- /include/idb_version_change_event.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "event.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class IDBVersionChangeEvent : public Event { 8 | public: 9 | 10 | HTML5_PROPERTY(IDBVersionChangeEvent, unsigned long long, newVersion); 11 | HTML5_PROPERTY(IDBVersionChangeEvent, unsigned long long, oldVersion); 12 | 13 | IDBVersionChangeEvent(emscripten::val v); 14 | virtual ~IDBVersionChangeEvent(); 15 | static IDBVersionChangeEvent *create(emscripten::val v); 16 | }; 17 | 18 | NAMESPACE_HTML5_END; 19 | -------------------------------------------------------------------------------- /include/image_bitmap.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "html5.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class ImageBitmap : public Object { 8 | public: 9 | 10 | HTML5_PROPERTY(ImageBitmap, unsigned long, height); 11 | HTML5_PROPERTY(ImageBitmap, unsigned long, width); 12 | 13 | ImageBitmap(emscripten::val v); 14 | virtual ~ImageBitmap(); 15 | static ImageBitmap *create(emscripten::val v); 16 | }; 17 | 18 | NAMESPACE_HTML5_END; 19 | -------------------------------------------------------------------------------- /include/image_data.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "html5.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class Uint8ClampedArray; 8 | 9 | class ImageData : public Object { 10 | public: 11 | 12 | HTML5_PROPERTY_OBJECT(ImageData, Uint8ClampedArray, data); 13 | HTML5_PROPERTY(ImageData, unsigned long, height); 14 | HTML5_PROPERTY(ImageData, unsigned long, width); 15 | 16 | ImageData(emscripten::val v); 17 | virtual ~ImageData(); 18 | static ImageData *create(emscripten::val v); 19 | static ImageData *create(unsigned long sw, unsigned long sh); 20 | static ImageData *create(Uint8ClampedArray *data, unsigned long sw, unsigned long sh); 21 | }; 22 | 23 | NAMESPACE_HTML5_END; 24 | -------------------------------------------------------------------------------- /include/libhtml5.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "html5.h" 4 | #include "class.h" 5 | 6 | NAMESPACE_HTML5_BEGIN; 7 | 8 | extern Window *window; 9 | extern Console *console; 10 | extern Document *document; 11 | extern Navigator *navigator; 12 | 13 | NAMESPACE_HTML5_END; 14 | -------------------------------------------------------------------------------- /include/link_style.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "html5.h" 4 | #include "style_sheet.h" 5 | 6 | NAMESPACE_HTML5_BEGIN; 7 | 8 | 9 | class LinkStyle { 10 | public: 11 | 12 | HTML5_PURE_VIRTUAL_READONLY_PROPERTY_OBJECT(LinkStyle, StyleSheet, sheet); 13 | 14 | virtual ~LinkStyle(); 15 | }; 16 | 17 | NAMESPACE_HTML5_END; 18 | -------------------------------------------------------------------------------- /include/location.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "html5.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class Location : public Object { 8 | public: 9 | 10 | Location(emscripten::val v); 11 | virtual ~Location(); 12 | static Location *create(emscripten::val v); 13 | void assign(std::string url); 14 | void reload(); 15 | void replace(std::string url); 16 | }; 17 | 18 | NAMESPACE_HTML5_END; 19 | -------------------------------------------------------------------------------- /include/media_error.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "html5.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class MediaError : public Object { 8 | public: 9 | 10 | enum { 11 | MEDIA_ERR_ABORTED = 1, 12 | MEDIA_ERR_NETWORK = 2, 13 | MEDIA_ERR_DECODE = 3, 14 | MEDIA_ERR_SRC_NOT_SUPPORTED = 4, 15 | }; 16 | 17 | HTML5_PROPERTY(MediaError, unsigned short, code); 18 | 19 | MediaError(emscripten::val v); 20 | virtual ~MediaError(); 21 | static MediaError *create(emscripten::val v); 22 | }; 23 | 24 | NAMESPACE_HTML5_END; 25 | -------------------------------------------------------------------------------- /include/media_list.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "html5.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class MediaList : public Object { 8 | public: 9 | 10 | HTML5_PROPERTY(MediaList, unsigned long, length); 11 | HTML5_PROPERTY(MediaList, std::string, mediaText); 12 | 13 | MediaList(emscripten::val v); 14 | virtual ~MediaList(); 15 | static MediaList *create(emscripten::val v); 16 | void appendMedium(std::string medium); 17 | void deleteMedium(std::string medium); 18 | std::string item(unsigned long index); 19 | }; 20 | 21 | NAMESPACE_HTML5_END; 22 | -------------------------------------------------------------------------------- /include/mime_type.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "html5.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class Plugin; 8 | 9 | class MimeType : public Object { 10 | public: 11 | 12 | HTML5_PROPERTY(MimeType, std::string, description); 13 | HTML5_PROPERTY(MimeType, Plugin *, enabledPlugin); 14 | HTML5_PROPERTY(MimeType, std::string, suffixes); 15 | HTML5_PROPERTY(MimeType, std::string, type); 16 | 17 | MimeType(emscripten::val v); 18 | virtual ~MimeType(); 19 | static MimeType *create(emscripten::val v); 20 | }; 21 | 22 | NAMESPACE_HTML5_END; 23 | -------------------------------------------------------------------------------- /include/mime_type_array.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "html5.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class MimeType; 8 | 9 | class MimeTypeArray : public Object { 10 | public: 11 | 12 | HTML5_PROPERTY(MimeTypeArray, unsigned long, length); 13 | 14 | MimeTypeArray(emscripten::val v); 15 | virtual ~MimeTypeArray(); 16 | static MimeTypeArray *create(emscripten::val v); 17 | MimeType *item(unsigned long index); 18 | MimeType *namedItem(std::string name); 19 | }; 20 | 21 | NAMESPACE_HTML5_END; 22 | -------------------------------------------------------------------------------- /include/native_array.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "native_object.h" 4 | #include 5 | 6 | NAMESPACE_HTML5_BEGIN; 7 | 8 | class NativeArray : public NativeObject { 9 | public: 10 | 11 | NativeArray(); 12 | virtual ~NativeArray(); 13 | static NativeArray *create(); 14 | void add(NativeObject *o); 15 | 16 | private: 17 | std::vector arr; 18 | }; 19 | 20 | NAMESPACE_HTML5_END; 21 | -------------------------------------------------------------------------------- /include/native_object.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "html5.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class NativeObject { 8 | public: 9 | 10 | NativeObject(); 11 | virtual ~NativeObject(); 12 | void autorelease(); 13 | void release(); 14 | void retain(); 15 | unsigned int referenceCount(); 16 | bool isAutoRelease(); 17 | 18 | private: 19 | bool _isAutoRelease; 20 | unsigned int _refCount; 21 | }; 22 | 23 | NAMESPACE_HTML5_END; 24 | -------------------------------------------------------------------------------- /include/navigator.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "html5.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class MimeTypeArray; 8 | class PluginArray; 9 | 10 | class Navigator : public Object { 11 | public: 12 | 13 | HTML5_PROPERTY(Navigator, std::string, appCodeName); 14 | HTML5_PROPERTY(Navigator, std::string, appName); 15 | HTML5_PROPERTY(Navigator, std::string, appVersion); 16 | HTML5_PROPERTY(Navigator, bool, cookieEnabled); 17 | HTML5_PROPERTY(Navigator, bool, javaEnabled); 18 | HTML5_PROPERTY(Navigator, std::string, language); 19 | HTML5_PROPERTY(Navigator, MimeTypeArray *, mimeTypes); 20 | HTML5_PROPERTY(Navigator, bool, onLine); 21 | HTML5_PROPERTY(Navigator, std::string, platform); 22 | HTML5_PROPERTY(Navigator, PluginArray *, plugins); 23 | HTML5_PROPERTY(Navigator, std::string, product); 24 | HTML5_PROPERTY(Navigator, std::string, userAgent); 25 | 26 | Navigator(emscripten::val v); 27 | virtual ~Navigator(); 28 | static Navigator *create(emscripten::val v); 29 | std::string isContentHandlerRegistered(std::string mimeType, std::string url); 30 | std::string isProtocolHandlerRegistered(std::string scheme, std::string url); 31 | void registerContentHandler(std::string mimeType, std::string url, std::string title); 32 | void registerProtocolHandler(std::string scheme, std::string url, std::string title); 33 | bool taintEnabled(); 34 | void unregisterContentHandler(std::string mimeType, std::string url); 35 | void unregisterProtocolHandler(std::string scheme, std::string url); 36 | void yieldForStorageUpdates(); 37 | }; 38 | 39 | NAMESPACE_HTML5_END; 40 | -------------------------------------------------------------------------------- /include/node_filter.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "html5.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class Node; 8 | 9 | class NodeFilter : public Object { 10 | public: 11 | 12 | enum { 13 | FILTER_ACCEPT = 1, 14 | FILTER_REJECT = 2, 15 | FILTER_SKIP = 3, 16 | SHOW_ALL = 0xFFFFFFFF, 17 | SHOW_ATTRIBUTE = 0x2, 18 | SHOW_CDATA_SECTION = 0x8, 19 | SHOW_COMMENT = 0x80, 20 | SHOW_DOCUMENT = 0x100, 21 | SHOW_DOCUMENT_FRAGMENT = 0x400, 22 | SHOW_DOCUMENT_TYPE = 0x200, 23 | SHOW_ELEMENT = 0x1, 24 | SHOW_ENTITY = 0x20, 25 | SHOW_ENTITY_REFERENCE = 0x10, 26 | SHOW_NOTATION = 0x800, 27 | SHOW_PROCESSING_INSTRUCTION = 0x40, 28 | SHOW_TEXT = 0x4, 29 | }; 30 | 31 | NodeFilter(emscripten::val v); 32 | virtual ~NodeFilter(); 33 | static NodeFilter *create(emscripten::val v); 34 | unsigned short acceptNode(Node *node); 35 | }; 36 | 37 | NAMESPACE_HTML5_END; 38 | -------------------------------------------------------------------------------- /include/node_iterator.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "html5.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class Node; 8 | class NodeFilter; 9 | 10 | class NodeIterator : public Object { 11 | public: 12 | 13 | HTML5_PROPERTY_OBJECT(NodeIterator, NodeFilter, filter); 14 | HTML5_PROPERTY(NodeIterator, bool, pointerBeforeReferenceNode); 15 | HTML5_PROPERTY_OBJECT(NodeIterator, Node, referenceNode); 16 | HTML5_PROPERTY_OBJECT(NodeIterator, Node, root); 17 | HTML5_PROPERTY(NodeIterator, unsigned long, whatsToShow); 18 | 19 | NodeIterator(emscripten::val v); 20 | virtual ~NodeIterator(); 21 | static NodeIterator *create(emscripten::val v); 22 | void detach(); 23 | Node *nextNode(); 24 | Node *previousNode(); 25 | }; 26 | 27 | NAMESPACE_HTML5_END; 28 | -------------------------------------------------------------------------------- /include/node_list.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "object.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class Node; 8 | 9 | class NodeList : public Object { 10 | public: 11 | 12 | HTML5_PROPERTY(NodeList, unsigned long, length); 13 | 14 | NodeList(emscripten::val v); 15 | virtual ~NodeList(); 16 | static NodeList *create(emscripten::val v); 17 | Node *item(unsigned long index); 18 | }; 19 | 20 | NAMESPACE_HTML5_END; 21 | -------------------------------------------------------------------------------- /include/object.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "html5.h" 4 | #include "native_object.h" 5 | #include 6 | 7 | NAMESPACE_HTML5_BEGIN; 8 | 9 | class array; 10 | 11 | class Object : public NativeObject { 12 | public: 13 | emscripten::val v; 14 | 15 | Object(emscripten::val v); 16 | virtual ~Object(); 17 | static Object *create(); 18 | static Object *create(emscripten::val v); 19 | static Object *create(Object *o); 20 | template 21 | static Object *assign(Object *target, const Args &... sources); 22 | static void freeze(Object *o); 23 | static Object *getOwnPropertyDescriptor(Object *o, std::string prop); 24 | static std::vector getOwnPropertyNames(Object *o); 25 | static Object *getPropertyOf(Object *o); 26 | static bool is(std::string value1, std::string value2); 27 | static bool is(Object *value1, Object *value2); 28 | static bool is(int value1, int value2); 29 | static bool isExtensible(Object *o); 30 | static bool isFrozen(Object *o); 31 | static bool isSealed(Object *o); 32 | static std::vector keys(Object *o); 33 | static Object *preventExtensions(Object *o); 34 | static Object *seal(Object *o); 35 | static array values(Object *o); 36 | static array entries(Object *o); 37 | virtual emscripten::val getValue() const { return this->v; }; 38 | virtual void setValue(emscripten::val v) { this->v = v; }; 39 | bool hasOwnProperty(std::string prop); 40 | bool isPrototypeOf(Object *o); 41 | bool propertyIsEnumerable(std::string s); 42 | std::string toLocaleString(); 43 | std::string toString(); 44 | Object *valueOf(); 45 | 46 | template T userData(const std::string &key); 47 | void userData(const std::string &key, int value); 48 | void userData(const std::string &key, double value); 49 | void userData(const std::string &key, std::string value); 50 | 51 | private: 52 | std::map> _userData; 53 | static emscripten::val to_val(Object *o) { return o->v; }; 54 | }; 55 | 56 | NAMESPACE_HTML5_END; 57 | -------------------------------------------------------------------------------- /include/path2d.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "html5.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class SVGMatrix; 8 | 9 | class Path2D : public Object { 10 | public: 11 | 12 | Path2D(emscripten::val v); 13 | virtual ~Path2D(); 14 | static Path2D *create(emscripten::val v); 15 | void addPath(Path2D *path); 16 | void addPath(Path2D *path, SVGMatrix *transformation); 17 | void arc(double x, double y, double radius, double startAngle, double endAngle, bool anticlockwise = false); 18 | void arcTo(double x1, double y1, double x2, double y2, double radius); 19 | void bezierCurveTo(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y); 20 | void closePath(); 21 | void ellipse(double x, double y, double radiusX, double radiusY, double rotation, double startAngle, double endAngle, bool anticlockwise = false); 22 | void lineTo(double x, double y); 23 | void moveTo(double x, double y); 24 | void quadraticCurveTo(double cpx, double cpy, double x, double y); 25 | void rect(double x, double y, double w, double h); 26 | }; 27 | 28 | NAMESPACE_HTML5_END; 29 | -------------------------------------------------------------------------------- /include/performance.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "html5.h" 4 | #include "event_handler.h" 5 | #include 6 | 7 | NAMESPACE_HTML5_BEGIN; 8 | 9 | class PerformanceNavigation; 10 | class PerformanceEntry; 11 | class PerformanceTiming; 12 | 13 | class Performance : public Object { 14 | public: 15 | 16 | HTML5_READONLY_PROPERTY(Performance, PerformanceNavigation *, navigation); 17 | HTML5_EVENT_HANDLER_PROPERTY(Performance, EventHandler *, onresourcetimingbufferfull); 18 | HTML5_READONLY_PROPERTY(Performance, PerformanceTiming *, timing); 19 | HTML5_READONLY_PROPERTY(Performance, double, timeOrigin); 20 | 21 | Performance(emscripten::val v); 22 | virtual ~Performance(); 23 | static Performance *create(emscripten::val v); 24 | emscripten::val getValue() const { return this->v; }; 25 | void clearMarks(); 26 | void clearMarks(std::string name); 27 | void clearMeasures(); 28 | void clearMeasures(std::string name); 29 | void clearResourceTimings(); 30 | std::vector getEntries(); 31 | std::vector getEntriesByName(std::string name); 32 | std::vector getEntriesByName(std::string name, std::string type); 33 | std::vector getEntriesByType(std::string type); 34 | void mark(std::string name); 35 | void measure(std::string name); 36 | void measure(std::string name, std::string startMark); 37 | void measure(std::string name, std::string startMark, std::string endMark); 38 | double now(); 39 | void setResourceTimingBufferSize(unsigned long maxSize); 40 | }; 41 | 42 | NAMESPACE_HTML5_END; 43 | -------------------------------------------------------------------------------- /include/performance_entry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "html5.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class PerformanceEntry : public Object { 8 | public: 9 | 10 | HTML5_READONLY_PROPERTY(PerformanceEntry, std::string, name); 11 | HTML5_READONLY_PROPERTY(PerformanceEntry, std::string, entryType); 12 | HTML5_READONLY_PROPERTY(PerformanceEntry, double, startTime); 13 | HTML5_READONLY_PROPERTY(PerformanceEntry, double, duration); 14 | 15 | PerformanceEntry(emscripten::val v); 16 | virtual ~PerformanceEntry(); 17 | static PerformanceEntry *create(emscripten::val v); 18 | }; 19 | 20 | NAMESPACE_HTML5_END; 21 | -------------------------------------------------------------------------------- /include/performance_navigation.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "html5.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class PerformanceNavigation : public Object { 8 | public: 9 | 10 | HTML5_READONLY_PROPERTY(PerformanceNavigation, unsigned short, type); 11 | HTML5_READONLY_PROPERTY(PerformanceNavigation, unsigned short, redirectCount); 12 | 13 | PerformanceNavigation(emscripten::val v); 14 | virtual ~PerformanceNavigation(); 15 | static PerformanceNavigation *create(emscripten::val v); 16 | }; 17 | 18 | NAMESPACE_HTML5_END; 19 | -------------------------------------------------------------------------------- /include/performance_timing.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "html5.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class PerformanceTiming : public Object { 8 | public: 9 | 10 | HTML5_READONLY_PROPERTY(PerformanceTiming, unsigned long long, navigationStart); 11 | HTML5_READONLY_PROPERTY(PerformanceTiming, unsigned long long, unloadEventStart); 12 | HTML5_READONLY_PROPERTY(PerformanceTiming, unsigned long long, unloadEventEnd); 13 | HTML5_READONLY_PROPERTY(PerformanceTiming, unsigned long long, redirectStart); 14 | HTML5_READONLY_PROPERTY(PerformanceTiming, unsigned long long, redirectEnd); 15 | HTML5_READONLY_PROPERTY(PerformanceTiming, unsigned long long, fetchStart); 16 | HTML5_READONLY_PROPERTY(PerformanceTiming, unsigned long long, domainLookupStart); 17 | HTML5_READONLY_PROPERTY(PerformanceTiming, unsigned long long, domainLookupEnd); 18 | HTML5_READONLY_PROPERTY(PerformanceTiming, unsigned long long, connectStart); 19 | HTML5_READONLY_PROPERTY(PerformanceTiming, unsigned long long, connectEnd); 20 | HTML5_READONLY_PROPERTY(PerformanceTiming, unsigned long long, secureConnectionStart); 21 | HTML5_READONLY_PROPERTY(PerformanceTiming, unsigned long long, requestStart); 22 | HTML5_READONLY_PROPERTY(PerformanceTiming, unsigned long long, responseStart); 23 | HTML5_READONLY_PROPERTY(PerformanceTiming, unsigned long long, responseEnd); 24 | HTML5_READONLY_PROPERTY(PerformanceTiming, unsigned long long, domLoading); 25 | HTML5_READONLY_PROPERTY(PerformanceTiming, unsigned long long, domInteractive); 26 | HTML5_READONLY_PROPERTY(PerformanceTiming, unsigned long long, domContentLoadedEventStart); 27 | HTML5_READONLY_PROPERTY(PerformanceTiming, unsigned long long, domContentLoadedEventEnd); 28 | HTML5_READONLY_PROPERTY(PerformanceTiming, unsigned long long, domComplete); 29 | HTML5_READONLY_PROPERTY(PerformanceTiming, unsigned long long, loadEventStart); 30 | HTML5_READONLY_PROPERTY(PerformanceTiming, unsigned long long, loadEventEnd); 31 | 32 | PerformanceTiming(emscripten::val v); 33 | virtual ~PerformanceTiming(); 34 | static PerformanceTiming *create(emscripten::val v); 35 | }; 36 | 37 | NAMESPACE_HTML5_END; 38 | -------------------------------------------------------------------------------- /include/plugin.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "html5.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class MimeType; 8 | 9 | class Plugin : public Object { 10 | public: 11 | 12 | HTML5_PROPERTY(Plugin, std::string, description); 13 | HTML5_PROPERTY(Plugin, std::string, filename); 14 | HTML5_PROPERTY(Plugin, unsigned long, length); 15 | HTML5_PROPERTY(Plugin, std::string, name); 16 | 17 | Plugin(emscripten::val v); 18 | virtual ~Plugin(); 19 | static Plugin *create(emscripten::val v); 20 | MimeType *item(unsigned long index); 21 | MimeType *namedItem(std::string name); 22 | }; 23 | 24 | NAMESPACE_HTML5_END; 25 | -------------------------------------------------------------------------------- /include/plugin_array.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "html5.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class Plugin; 8 | 9 | class PluginArray : public Object { 10 | public: 11 | 12 | HTML5_PROPERTY(PluginArray, unsigned long, length); 13 | 14 | PluginArray(emscripten::val v); 15 | virtual ~PluginArray(); 16 | static PluginArray *create(emscripten::val v); 17 | Plugin *item(unsigned long index); 18 | Plugin *namedItem(std::string name); 19 | void refresh(bool reload); 20 | }; 21 | 22 | NAMESPACE_HTML5_END; 23 | -------------------------------------------------------------------------------- /include/processing_instruction.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "character_data.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class StyleSheet; 8 | 9 | class ProcessingInstruction : public CharacterData { 10 | public: 11 | 12 | HTML5_PROPERTY_OBJECT(ProcessingInstruction, StyleSheet, sheet); 13 | HTML5_PROPERTY(ProcessingInstruction, std::string, target); 14 | 15 | ProcessingInstruction(emscripten::val v); 16 | virtual ~ProcessingInstruction(); 17 | static ProcessingInstruction *create(emscripten::val v); 18 | }; 19 | 20 | NAMESPACE_HTML5_END; 21 | -------------------------------------------------------------------------------- /include/range.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "html5.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class Node; 8 | class DocumentFragment; 9 | 10 | class Range : public Object { 11 | public: 12 | 13 | enum { 14 | START_TO_START = 0, 15 | START_TO_END = 1, 16 | END_TO_END = 2, 17 | END_TO_START = 3, 18 | }; 19 | 20 | HTML5_PROPERTY(Range, bool, collapsed); 21 | HTML5_PROPERTY_OBJECT(Range, Node, commonAncestorContainer); 22 | HTML5_PROPERTY_OBJECT(Range, Node, endContainer); 23 | HTML5_PROPERTY(Range, unsigned long, endOffset); 24 | HTML5_PROPERTY_OBJECT(Range, Node, startContainer); 25 | HTML5_PROPERTY(Range, unsigned long, startOffset); 26 | 27 | Range(emscripten::val v); 28 | virtual ~Range(); 29 | static Range *create(emscripten::val v); 30 | DocumentFragment *cloneContents(); 31 | Range *cloneRange(); 32 | void collapse(bool toStart); 33 | short compareBoundaryPoints(unsigned short how, Range *sourceRange); 34 | short comparePoint(Node *node, unsigned long offset); 35 | void deleteContents(); 36 | void detach(); 37 | DocumentFragment *extractContents(); 38 | void insertNode(Node *node); 39 | bool intersectsNode(Node *node); 40 | bool isPointInRange(Node *node, unsigned long offset); 41 | void selectNode(Node *node); 42 | void selectNodeContents(Node *node); 43 | void setEnd(Node *node, unsigned long offset); 44 | void setEndAfter(Node *node); 45 | void setEndBefore(Node *node); 46 | void setStart(Node *node, unsigned long offset); 47 | void setStartAfter(Node *node); 48 | void setStartBefore(Node *node); 49 | void surroundContents(Node *newParent); 50 | }; 51 | 52 | NAMESPACE_HTML5_END; 53 | -------------------------------------------------------------------------------- /include/rendering_context.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "html5.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class RenderingContext : public Object { 8 | public: 9 | 10 | RenderingContext(emscripten::val v); 11 | virtual ~RenderingContext(); 12 | static RenderingContext *create(emscripten::val v); 13 | }; 14 | 15 | NAMESPACE_HTML5_END; 16 | -------------------------------------------------------------------------------- /include/response.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "html5.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class Headers; 8 | class ReadableStream; 9 | 10 | class Response : public Object { 11 | public: 12 | 13 | HTML5_READONLY_PROPERTY_OBJECT(Response, Headers, headers); 14 | HTML5_READONLY_PROPERTY(Response, bool, ok); 15 | HTML5_READONLY_PROPERTY(Response, bool, redirected); 16 | HTML5_READONLY_PROPERTY(Response, int, status); 17 | HTML5_READONLY_PROPERTY(Response, std::string, type); 18 | HTML5_READONLY_PROPERTY(Response, std::string, url); 19 | HTML5_PROPERTY(Response, bool, useFinalURL); 20 | HTML5_READONLY_PROPERTY_OBJECT(Response, ReadableStream, body); 21 | HTML5_READONLY_PROPERTY(Response, bool, bodyUsed); 22 | 23 | Response(emscripten::val v); 24 | virtual ~Response(); 25 | static Response *create(emscripten::val v); 26 | Response *clone(); 27 | Response *error(); 28 | Response *redirect(const std::string &url, int status = 0); 29 | Promise *arrayBuffer(); 30 | Promise *blob(); 31 | Promise *formData(); 32 | Promise *json(); 33 | Promise *text(); 34 | }; 35 | 36 | NAMESPACE_HTML5_END; 37 | -------------------------------------------------------------------------------- /include/storage.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "html5.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class Storage : public Object { 8 | public: 9 | 10 | HTML5_PROPERTY(Storage, unsigned long, length); 11 | 12 | Storage(emscripten::val v); 13 | virtual ~Storage(); 14 | static Storage *create(emscripten::val v); 15 | void clear(); 16 | std::string getItem(std::string key); 17 | std::string key(unsigned long index); 18 | void removeItem(std::string key); 19 | void setItem(std::string key, std::string value); 20 | }; 21 | 22 | NAMESPACE_HTML5_END; 23 | -------------------------------------------------------------------------------- /include/style_sheet.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "html5.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class MediaList; 8 | class Element; 9 | 10 | class StyleSheet : public Object { 11 | public: 12 | 13 | HTML5_PROPERTY(StyleSheet, bool, disabled); 14 | HTML5_PROPERTY(StyleSheet, std::string, href); 15 | HTML5_PROPERTY_OBJECT(StyleSheet, MediaList, media); 16 | HTML5_PROPERTY_OBJECT(StyleSheet, Element, ownerNode); 17 | HTML5_PROPERTY_OBJECT(StyleSheet, StyleSheet, parentStyleSheet); 18 | HTML5_PROPERTY(StyleSheet, std::string, title); 19 | HTML5_PROPERTY(StyleSheet, std::string, type); 20 | 21 | StyleSheet(emscripten::val v); 22 | virtual ~StyleSheet(); 23 | static StyleSheet *create(emscripten::val v); 24 | }; 25 | 26 | NAMESPACE_HTML5_END; 27 | -------------------------------------------------------------------------------- /include/style_sheet_list.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "html5.h" 4 | #include "style_sheet.h" 5 | 6 | NAMESPACE_HTML5_BEGIN; 7 | 8 | class StyleSheetList : public Object { 9 | public: 10 | 11 | HTML5_PROPERTY(StyleSheetList, unsigned long, length); 12 | HTML5_DEFINE_ITERATOR(StyleSheetList, StyleSheet); 13 | 14 | StyleSheetList(emscripten::val v); 15 | virtual ~StyleSheetList(); 16 | static StyleSheetList *create(emscripten::val v); 17 | StyleSheet *item(unsigned long index); 18 | }; 19 | 20 | NAMESPACE_HTML5_END; 21 | -------------------------------------------------------------------------------- /include/svgmatrix.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "html5.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class SVGMatrix : public Object { 8 | public: 9 | 10 | HTML5_PROPERTY(SVGMatrix, double, a); 11 | HTML5_PROPERTY(SVGMatrix, double, b); 12 | HTML5_PROPERTY(SVGMatrix, double, c); 13 | HTML5_PROPERTY(SVGMatrix, double, d); 14 | HTML5_PROPERTY(SVGMatrix, double, e); 15 | HTML5_PROPERTY(SVGMatrix, double, f); 16 | 17 | SVGMatrix(emscripten::val v); 18 | virtual ~SVGMatrix(); 19 | static SVGMatrix *create(emscripten::val v); 20 | SVGMatrix *flipX(); 21 | SVGMatrix *flipY(); 22 | SVGMatrix *inverse(); 23 | SVGMatrix *multiply(SVGMatrix *secondMatrix); 24 | SVGMatrix *rotate(double angle); 25 | SVGMatrix *rotateFromVector(double x, double y); 26 | SVGMatrix *scale(double scaleFactor); 27 | SVGMatrix *scaleNonUniform(double scaleFactorX, double scaleFactorY); 28 | SVGMatrix *skewX(double angle); 29 | SVGMatrix *skewY(double angle); 30 | SVGMatrix *translate(double x, double y); 31 | }; 32 | 33 | NAMESPACE_HTML5_END; 34 | -------------------------------------------------------------------------------- /include/text.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "character_data.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class Text : public CharacterData { 8 | public: 9 | 10 | HTML5_PROPERTY(Text, std::string, wholeText); 11 | 12 | Text(emscripten::val v); 13 | virtual ~Text(); 14 | static Text *create(emscripten::val v); 15 | Text *splitText(unsigned long offset); 16 | }; 17 | 18 | NAMESPACE_HTML5_END; 19 | -------------------------------------------------------------------------------- /include/text_metrics.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "html5.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class TextMetrics : public Object { 8 | public: 9 | 10 | HTML5_PROPERTY(TextMetrics, double, actualBoundingBoxAscent); 11 | HTML5_PROPERTY(TextMetrics, double, actualBoundingBoxDescent); 12 | HTML5_PROPERTY(TextMetrics, double, actualBoundingBoxLeft); 13 | HTML5_PROPERTY(TextMetrics, double, actualBoundingBoxRight); 14 | HTML5_PROPERTY(TextMetrics, double, alphabeticBaseline); 15 | HTML5_PROPERTY(TextMetrics, double, emHeightAscent); 16 | HTML5_PROPERTY(TextMetrics, double, emHeightDescent); 17 | HTML5_PROPERTY(TextMetrics, double, fontBoundingBoxAscent); 18 | HTML5_PROPERTY(TextMetrics, double, fontBoundingBoxDescent); 19 | HTML5_PROPERTY(TextMetrics, double, hangingBaseline); 20 | HTML5_PROPERTY(TextMetrics, double, ideographicBaseline); 21 | HTML5_PROPERTY(TextMetrics, double, width); 22 | 23 | TextMetrics(emscripten::val v); 24 | virtual ~TextMetrics(); 25 | static TextMetrics *create(emscripten::val v); 26 | }; 27 | 28 | NAMESPACE_HTML5_END; 29 | -------------------------------------------------------------------------------- /include/text_track.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "event_target.h" 4 | #include "event_handler.h" 5 | 6 | NAMESPACE_HTML5_BEGIN; 7 | 8 | class TextTrackCue; 9 | class TextTrackCueList; 10 | 11 | enum class TextTrackMode { 12 | DISABLED, 13 | HIDDEN, 14 | SHOWING, 15 | }; 16 | 17 | enum class TextTrackKind { 18 | SUBTITLES, 19 | CAPTIONS, 20 | DESCRIPTIONS, 21 | CHAPTERS, 22 | METADATA, 23 | }; 24 | 25 | class TextTrack : public EventTarget { 26 | public: 27 | 28 | HTML5_PROPERTY_OBJECT(TextTrack, TextTrackCueList, activeCues); 29 | HTML5_PROPERTY_OBJECT(TextTrack, TextTrackCueList, cues); 30 | HTML5_PROPERTY(TextTrack, std::string, id); 31 | HTML5_PROPERTY(TextTrack, std::string, inBandMetadataTrackDispatchType); 32 | HTML5_PROPERTY(TextTrack, std::string, label); 33 | HTML5_PROPERTY(TextTrack, std::string, language); 34 | HTML5_EVENT_HANDLER_PROPERTY(TextTrack, EventHandler *, oncuechange); 35 | TextTrackKind _kind; 36 | TextTrackMode _mode; 37 | 38 | TextTrack(emscripten::val v); 39 | virtual ~TextTrack(); 40 | static TextTrack *create(emscripten::val v); 41 | void addCue(TextTrackCue *cue); 42 | void removeCue(TextTrackCue *cue); 43 | 44 | std::string getKind() const; 45 | void setKind(TextTrackKind value); 46 | std::string getMode() const; 47 | void setMode(TextTrackMode value); 48 | 49 | struct { 50 | TextTrack &self; 51 | void operator=(TextTrackKind value) { self.setKind(value); }; 52 | operator std::string() { return self.getKind(); }; 53 | } kind{*this}; 54 | 55 | struct { 56 | TextTrack &self; 57 | void operator=(TextTrackMode value) { self.setMode(value); }; 58 | operator std::string() { return self.getMode(); }; 59 | } mode{*this}; 60 | }; 61 | 62 | NAMESPACE_HTML5_END; 63 | -------------------------------------------------------------------------------- /include/text_track_cue.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "event_target.h" 4 | #include "event_handler.h" 5 | #include 6 | 7 | NAMESPACE_HTML5_BEGIN; 8 | 9 | class TextTrack; 10 | 11 | class TextTrackCue : public EventTarget { 12 | public: 13 | 14 | HTML5_PROPERTY(TextTrackCue, double, endTime); 15 | HTML5_PROPERTY(TextTrackCue, std::string, id); 16 | HTML5_EVENT_HANDLER_PROPERTY(TextTrackCue, EventHandler *, onenter); 17 | HTML5_EVENT_HANDLER_PROPERTY(TextTrackCue, EventHandler *, onexit); 18 | HTML5_PROPERTY(TextTrackCue, bool, pauseOnExit); 19 | HTML5_PROPERTY(TextTrackCue, double, startTime); 20 | HTML5_PROPERTY_OBJECT(TextTrackCue, TextTrack, track); 21 | 22 | TextTrackCue(emscripten::val v); 23 | virtual ~TextTrackCue(); 24 | static TextTrackCue *create(emscripten::val v); 25 | }; 26 | 27 | NAMESPACE_HTML5_END; 28 | -------------------------------------------------------------------------------- /include/text_track_cue_list.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "html5.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class TextTrackCue; 8 | 9 | class TextTrackCueList : public Object { 10 | public: 11 | 12 | HTML5_PROPERTY(TextTrackCueList, unsigned long, length); 13 | 14 | TextTrackCueList(emscripten::val v); 15 | virtual ~TextTrackCueList(); 16 | static TextTrackCueList *create(emscripten::val v); 17 | TextTrackCue *getCueById(std::string id); 18 | TextTrackCue *getter(unsigned long index); 19 | }; 20 | 21 | NAMESPACE_HTML5_END; 22 | -------------------------------------------------------------------------------- /include/text_track_list.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "event_target.h" 4 | #include "event_handler.h" 5 | 6 | NAMESPACE_HTML5_BEGIN; 7 | 8 | class TextTrack; 9 | 10 | class TextTrackList : public EventTarget { 11 | public: 12 | 13 | HTML5_PROPERTY(TextTrackList, unsigned long, length); 14 | HTML5_EVENT_HANDLER_PROPERTY(TextTrackList, EventHandler *, onaddtrack); 15 | HTML5_EVENT_HANDLER_PROPERTY(TextTrackList, EventHandler *, onchange); 16 | HTML5_EVENT_HANDLER_PROPERTY(TextTrackList, EventHandler *, onremovetrack); 17 | 18 | TextTrackList(emscripten::val v); 19 | virtual ~TextTrackList(); 20 | static TextTrackList *create(emscripten::val v); 21 | TextTrack *getter(unsigned long index); 22 | TextTrack *getTrackById(std::string id); 23 | }; 24 | 25 | NAMESPACE_HTML5_END; 26 | -------------------------------------------------------------------------------- /include/time_ranges.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "html5.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class TimeRanges : public Object { 8 | public: 9 | 10 | HTML5_PROPERTY(TimeRanges, unsigned long, length); 11 | 12 | TimeRanges(emscripten::val v); 13 | virtual ~TimeRanges(); 14 | static TimeRanges *create(emscripten::val v); 15 | double start(unsigned long index); 16 | double end(unsigned long index); 17 | }; 18 | 19 | NAMESPACE_HTML5_END; 20 | -------------------------------------------------------------------------------- /include/tree_walker.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "html5.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class Node; 8 | class NodeFilter; 9 | 10 | class TreeWalker : public Object { 11 | public: 12 | 13 | HTML5_PROPERTY_OBJECT(TreeWalker, Node, currentNode); 14 | HTML5_PROPERTY_OBJECT(TreeWalker, NodeFilter, filter); 15 | HTML5_PROPERTY_OBJECT(TreeWalker, Node, root); 16 | HTML5_PROPERTY(TreeWalker, unsigned long, whatToShow); 17 | 18 | TreeWalker(emscripten::val v); 19 | virtual ~TreeWalker(); 20 | static TreeWalker *create(emscripten::val v); 21 | Node *firstChild(); 22 | Node *lastChild(); 23 | Node *nextNode(); 24 | Node *nextSibling(); 25 | Node *parentNode(); 26 | Node *previousNode(); 27 | Node *previousSibling(); 28 | }; 29 | 30 | NAMESPACE_HTML5_END; 31 | -------------------------------------------------------------------------------- /include/uint8_array.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "array_buffer_view.h" 4 | #include 5 | 6 | NAMESPACE_HTML5_BEGIN; 7 | 8 | class Uint8Array : public ArrayBufferView { 9 | public: 10 | const long BYTES_PER_ELEMENT = 1; 11 | 12 | HTML5_PROPERTY(Uint8Array, unsigned long, length); 13 | 14 | class uint8WrapType { 15 | public: 16 | emscripten::val v; 17 | size_t index; 18 | 19 | uint8WrapType(emscripten::val v, size_t index); 20 | ~uint8WrapType(); 21 | void operator=(uint8_t value); 22 | operator uint8_t() const { 23 | return this->v[this->index].as(); 24 | }; 25 | }; 26 | 27 | Uint8Array(emscripten::val v); 28 | virtual ~Uint8Array(); 29 | static Uint8Array *create(emscripten::val v); 30 | static Uint8Array *create(); 31 | static Uint8Array *create(unsigned long length); 32 | static Uint8Array *create(Uint8Array *array); 33 | static Uint8Array *create(ArrayBuffer *buffer); 34 | static Uint8Array *create(ArrayBuffer *buffer, unsigned long byteOffset); 35 | static Uint8Array *create(ArrayBuffer *buffer, unsigned long byteOffset, unsigned long length); 36 | uint8WrapType operator[](std::size_t index) const; 37 | uint8WrapType operator[](std::size_t index); 38 | 39 | private: 40 | std::vector _rawdata; 41 | }; 42 | 43 | NAMESPACE_HTML5_END; 44 | -------------------------------------------------------------------------------- /include/uint8_clamped_array.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "array_buffer_view.h" 4 | #include 5 | 6 | NAMESPACE_HTML5_BEGIN; 7 | 8 | class Uint8ClampedArray : public ArrayBufferView { 9 | public: 10 | const long BYTES_PER_ELEMENT = 1; 11 | 12 | HTML5_PROPERTY(Uint8ClampedArray, unsigned long, length); 13 | 14 | class uint8WrapType { 15 | public: 16 | emscripten::val v; 17 | size_t index; 18 | 19 | uint8WrapType(emscripten::val v, size_t index); 20 | ~uint8WrapType(); 21 | void operator=(uint8_t value); 22 | }; 23 | 24 | Uint8ClampedArray(emscripten::val v); 25 | virtual ~Uint8ClampedArray(); 26 | static Uint8ClampedArray *create(emscripten::val v); 27 | static Uint8ClampedArray *create(); 28 | static Uint8ClampedArray *create(unsigned long length); 29 | static Uint8ClampedArray *create(Uint8ClampedArray *array); 30 | static Uint8ClampedArray *create(ArrayBuffer *buffer); 31 | static Uint8ClampedArray *create(ArrayBuffer *buffer, unsigned long byteOffset); 32 | static Uint8ClampedArray *create(ArrayBuffer *buffer, unsigned long byteOffset, unsigned long length); 33 | uint8_t operator[](std::size_t index) const; 34 | uint8WrapType operator[](std::size_t index); 35 | 36 | private: 37 | std::vector _rawdata; 38 | }; 39 | 40 | NAMESPACE_HTML5_END; 41 | -------------------------------------------------------------------------------- /include/video_track.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "html5.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class VideoTrack : public Object { 8 | public: 9 | 10 | HTML5_PROPERTY(VideoTrack, std::string, id); 11 | HTML5_PROPERTY(VideoTrack, std::string, kind); 12 | HTML5_PROPERTY(VideoTrack, std::string, label); 13 | HTML5_PROPERTY(VideoTrack, std::string, language); 14 | HTML5_PROPERTY(VideoTrack, bool, selected); 15 | 16 | VideoTrack(emscripten::val v); 17 | virtual ~VideoTrack(); 18 | static VideoTrack *create(emscripten::val v); 19 | }; 20 | 21 | NAMESPACE_HTML5_END; 22 | -------------------------------------------------------------------------------- /include/video_track_list.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "event_target.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class VideoTrack; 8 | 9 | class VideoTrackList : public EventTarget { 10 | public: 11 | 12 | HTML5_PROPERTY(VideoTrackList, unsigned long, length); 13 | HTML5_EVENT_HANDLER_PROPERTY(VideoTrackList, EventHandler *, onaddtrack); 14 | HTML5_EVENT_HANDLER_PROPERTY(VideoTrackList, EventHandler *, onchange); 15 | HTML5_EVENT_HANDLER_PROPERTY(VideoTrackList, EventHandler *, onremovetrack); 16 | HTML5_PROPERTY(VideoTrackList, long, selectedIndex); 17 | 18 | VideoTrackList(emscripten::val v); 19 | virtual ~VideoTrackList(); 20 | static VideoTrackList *create(emscripten::val v); 21 | VideoTrack *getter(unsigned long index); 22 | VideoTrack *getTrackById(std::string id); 23 | }; 24 | 25 | NAMESPACE_HTML5_END; 26 | -------------------------------------------------------------------------------- /include/webgl_active_info.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "html5.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class WebGLActiveInfo : public Object { 8 | public: 9 | 10 | HTML5_PROPERTY(WebGLActiveInfo, std::string, name); 11 | HTML5_PROPERTY(WebGLActiveInfo, GLint, size); 12 | HTML5_PROPERTY(WebGLActiveInfo, GLenum, type); 13 | 14 | WebGLActiveInfo(emscripten::val v); 15 | virtual ~WebGLActiveInfo(); 16 | static WebGLActiveInfo *create(emscripten::val v); 17 | }; 18 | 19 | NAMESPACE_HTML5_END; 20 | -------------------------------------------------------------------------------- /include/webgl_buffer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "webgl_object.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class WebGLBuffer : public WebGLObject { 8 | public: 9 | 10 | WebGLBuffer(emscripten::val v); 11 | virtual ~WebGLBuffer(); 12 | static WebGLBuffer *create(emscripten::val v); 13 | }; 14 | 15 | NAMESPACE_HTML5_END; 16 | -------------------------------------------------------------------------------- /include/webgl_context_attributes.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "html5.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class WebGLContextAttributes : public Object { 8 | public: 9 | 10 | HTML5_PROPERTY(WebGLContextAttributes, GLboolean, alpha); 11 | HTML5_PROPERTY(WebGLContextAttributes, GLboolean, antialias); 12 | HTML5_PROPERTY(WebGLContextAttributes, GLboolean, depth); 13 | HTML5_PROPERTY(WebGLContextAttributes, GLboolean, failIfMajorPerformanceCaveat); 14 | HTML5_PROPERTY(WebGLContextAttributes, GLboolean, preferLowPowerToHighPerformance); 15 | HTML5_PROPERTY(WebGLContextAttributes, GLboolean, premultipliedAlpha); 16 | HTML5_PROPERTY(WebGLContextAttributes, GLboolean, preserveDrawingBuffer); 17 | HTML5_PROPERTY(WebGLContextAttributes, GLboolean, stencil); 18 | 19 | WebGLContextAttributes(emscripten::val v); 20 | virtual ~WebGLContextAttributes(); 21 | static WebGLContextAttributes *create(); 22 | static WebGLContextAttributes *create(emscripten::val v); 23 | }; 24 | 25 | NAMESPACE_HTML5_END; 26 | -------------------------------------------------------------------------------- /include/webgl_context_event.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "event.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class WebGLContextEvent : public Event { 8 | public: 9 | HTML5_PROPERTY(WebGLContextEvent, std::string, statusMessage); 10 | 11 | WebGLContextEvent(emscripten::val v); 12 | virtual ~WebGLContextEvent(); 13 | static WebGLContextEvent *create(emscripten::val v); 14 | }; 15 | 16 | NAMESPACE_HTML5_END; 17 | -------------------------------------------------------------------------------- /include/webgl_framebuffer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "webgl_object.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class WebGLFramebuffer : public WebGLObject { 8 | public: 9 | 10 | WebGLFramebuffer(emscripten::val v); 11 | virtual ~WebGLFramebuffer(); 12 | static WebGLFramebuffer *create(emscripten::val v); 13 | }; 14 | 15 | NAMESPACE_HTML5_END; 16 | -------------------------------------------------------------------------------- /include/webgl_object.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "html5.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class WebGLObject : public Object { 8 | public: 9 | 10 | WebGLObject(emscripten::val v); 11 | virtual ~WebGLObject(); 12 | }; 13 | 14 | NAMESPACE_HTML5_END; 15 | -------------------------------------------------------------------------------- /include/webgl_program.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "webgl_object.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class WebGLProgram : public WebGLObject { 8 | public: 9 | 10 | WebGLProgram(emscripten::val v); 11 | virtual ~WebGLProgram(); 12 | static WebGLProgram *create(emscripten::val v); 13 | }; 14 | 15 | NAMESPACE_HTML5_END; 16 | -------------------------------------------------------------------------------- /include/webgl_renderbuffer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "webgl_object.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class WebGLRenderbuffer : public WebGLObject { 8 | public: 9 | 10 | WebGLRenderbuffer(emscripten::val v); 11 | virtual ~WebGLRenderbuffer(); 12 | static WebGLRenderbuffer *create(emscripten::val v); 13 | }; 14 | 15 | NAMESPACE_HTML5_END; 16 | -------------------------------------------------------------------------------- /include/webgl_shader.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "webgl_object.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class WebGLShader : public WebGLObject { 8 | public: 9 | 10 | WebGLShader(emscripten::val v); 11 | virtual ~WebGLShader(); 12 | static WebGLShader *create(emscripten::val v); 13 | }; 14 | 15 | NAMESPACE_HTML5_END; 16 | -------------------------------------------------------------------------------- /include/webgl_shader_precision_format.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "html5.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class WebGLShaderPrecisionFormat : public Object { 8 | public: 9 | 10 | HTML5_PROPERTY(WebGLShaderPrecisionFormat, GLint, precision); 11 | HTML5_PROPERTY(WebGLShaderPrecisionFormat, GLint, rangeMax); 12 | HTML5_PROPERTY(WebGLShaderPrecisionFormat, GLint, rangeMin); 13 | 14 | WebGLShaderPrecisionFormat(emscripten::val v); 15 | virtual ~WebGLShaderPrecisionFormat(); 16 | static WebGLShaderPrecisionFormat *create(emscripten::val v); 17 | }; 18 | 19 | NAMESPACE_HTML5_END; 20 | -------------------------------------------------------------------------------- /include/webgl_texture.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "webgl_object.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class WebGLTexture : public WebGLObject { 8 | public: 9 | 10 | WebGLTexture(emscripten::val v); 11 | virtual ~WebGLTexture(); 12 | static WebGLTexture *create(emscripten::val v); 13 | }; 14 | 15 | NAMESPACE_HTML5_END; 16 | -------------------------------------------------------------------------------- /include/webgl_uniform_location.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "html5.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class WebGLUniformLocation : public Object { 8 | public: 9 | 10 | WebGLUniformLocation(emscripten::val v); 11 | virtual ~WebGLUniformLocation(); 12 | static WebGLUniformLocation *create(emscripten::val v); 13 | }; 14 | 15 | NAMESPACE_HTML5_END; 16 | -------------------------------------------------------------------------------- /include/xml_document.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "document.h" 4 | 5 | NAMESPACE_HTML5_BEGIN; 6 | 7 | class XMLDocument : Document { 8 | public: 9 | 10 | XMLDocument(emscripten::val v); 11 | virtual ~XMLDocument(); 12 | static XMLDocument *create(emscripten::val v); 13 | bool load(std::string url); 14 | }; 15 | 16 | NAMESPACE_HTML5_END; 17 | -------------------------------------------------------------------------------- /src/application_cache.cc: -------------------------------------------------------------------------------- 1 | #include "application_cache.h" 2 | 3 | USING_NAMESPACE_HTML5; 4 | 5 | HTML5_BIND_CLASS(ApplicationCache); 6 | 7 | ApplicationCache::ApplicationCache(emscripten::val v) : 8 | EventTarget(v) 9 | { 10 | 11 | } 12 | 13 | ApplicationCache::~ApplicationCache() 14 | { 15 | 16 | } 17 | 18 | ApplicationCache *ApplicationCache::create(emscripten::val v) 19 | { 20 | auto cache = new ApplicationCache(v); 21 | cache->autorelease(); 22 | return cache; 23 | } 24 | 25 | void ApplicationCache::abort() 26 | { 27 | HTML5_CALL(this->v, abort); 28 | } 29 | 30 | void ApplicationCache::swapCache() 31 | { 32 | HTML5_CALL(this->v, swapCache); 33 | } 34 | 35 | void ApplicationCache::update() 36 | { 37 | HTML5_CALL(this->v, update); 38 | } 39 | 40 | HTML5_EVENT_HANDLER_PROPERTY_IMPL(ApplicationCache, EventHandler *, oncached); 41 | HTML5_EVENT_HANDLER_PROPERTY_IMPL(ApplicationCache, EventHandler *, onchecking); 42 | HTML5_EVENT_HANDLER_PROPERTY_IMPL(ApplicationCache, EventHandler *, ondownloading); 43 | HTML5_EVENT_HANDLER_PROPERTY_IMPL(ApplicationCache, EventHandler *, onerror); 44 | HTML5_EVENT_HANDLER_PROPERTY_IMPL(ApplicationCache, EventHandler *, onnoupdate); 45 | HTML5_EVENT_HANDLER_PROPERTY_IMPL(ApplicationCache, EventHandler *, onobsolete); 46 | HTML5_EVENT_HANDLER_PROPERTY_IMPL(ApplicationCache, EventHandler *, onprogress); 47 | HTML5_EVENT_HANDLER_PROPERTY_IMPL(ApplicationCache, EventHandler *, onupdateready); 48 | HTML5_PROPERTY_IMPL(ApplicationCache, unsigned short, status); 49 | -------------------------------------------------------------------------------- /src/array_buffer.cc: -------------------------------------------------------------------------------- 1 | #include "array_buffer_view.h" 2 | #include "array_buffer.h" 3 | 4 | USING_NAMESPACE_HTML5; 5 | 6 | ArrayBuffer::ArrayBuffer(emscripten::val v) : 7 | Object(v) 8 | { 9 | 10 | } 11 | 12 | ArrayBuffer::~ArrayBuffer() 13 | { 14 | 15 | } 16 | 17 | ArrayBuffer *ArrayBuffer::create(emscripten::val v) 18 | { 19 | ArrayBuffer *buf = new ArrayBuffer(v); 20 | buf->autorelease(); 21 | return buf; 22 | } 23 | 24 | ArrayBuffer *ArrayBuffer::create(unsigned long length) 25 | { 26 | return create(HTML5_NEW_PRIMITIVE_INSTANCE(ArrayBuffer, length)); 27 | } 28 | 29 | bool ArrayBuffer::isView(Object *o) 30 | { 31 | return dynamic_cast(o); 32 | } 33 | 34 | ArrayBuffer *ArrayBuffer::slice(long begin) 35 | { 36 | return create(HTML5_CALLv(this->v, slice, begin)); 37 | } 38 | 39 | ArrayBuffer *ArrayBuffer::slice(long begin, long end) 40 | { 41 | return create(HTML5_CALLv(this->v, slice, begin, end)); 42 | } 43 | 44 | HTML5_PROPERTY_IMPL(ArrayBuffer, unsigned long, byteLength); 45 | -------------------------------------------------------------------------------- /src/array_buffer_view.cc: -------------------------------------------------------------------------------- 1 | #include "array_buffer.h" 2 | #include "array_buffer_view.h" 3 | 4 | USING_NAMESPACE_HTML5; 5 | 6 | ArrayBufferView::ArrayBufferView(emscripten::val v) : 7 | Object(v) 8 | { 9 | 10 | } 11 | 12 | ArrayBufferView::~ArrayBufferView() 13 | { 14 | 15 | } 16 | 17 | ArrayBufferView *ArrayBufferView::create(emscripten::val v) 18 | { 19 | auto view = new ArrayBufferView(v); 20 | view->autorelease(); 21 | return view; 22 | } 23 | 24 | HTML5_PROPERTY_OBJECT_IMPL(ArrayBufferView, ArrayBuffer, buffer); 25 | HTML5_PROPERTY_IMPL(ArrayBufferView, unsigned long, byteLength); 26 | HTML5_PROPERTY_IMPL(ArrayBufferView, unsigned long, byteOffset); 27 | -------------------------------------------------------------------------------- /src/attr.cc: -------------------------------------------------------------------------------- 1 | #include "attr.h" 2 | 3 | USING_NAMESPACE_HTML5; 4 | 5 | Attr::Attr(emscripten::val v) : 6 | Object(v) 7 | { 8 | 9 | } 10 | 11 | Attr::~Attr() 12 | { 13 | 14 | } 15 | 16 | Attr *Attr::create(emscripten::val v) 17 | { 18 | Attr *attr = new Attr(v); 19 | attr->autorelease(); 20 | return attr; 21 | } 22 | 23 | Attr *Attr::create() 24 | { 25 | return create(HTML5_NEW_PRIMITIVE_INSTANCE(Attr)); 26 | } 27 | 28 | HTML5_PROPERTY_IMPL(Attr, std::string, localName); 29 | HTML5_PROPERTY_IMPL(Attr, std::string, name); 30 | HTML5_PROPERTY_IMPL(Attr, std::string, namespaceURI); 31 | HTML5_PROPERTY_IMPL(Attr, std::string, prefix); 32 | HTML5_PROPERTY_IMPL(Attr, bool, specified); 33 | HTML5_PROPERTY_IMPL(Attr, std::string, value); 34 | -------------------------------------------------------------------------------- /src/audio_track.cc: -------------------------------------------------------------------------------- 1 | #include "audio_track.h" 2 | 3 | USING_NAMESPACE_HTML5; 4 | 5 | AudioTrack::AudioTrack(emscripten::val v) : 6 | Object(v) 7 | { 8 | 9 | } 10 | 11 | AudioTrack::~AudioTrack() 12 | { 13 | 14 | } 15 | 16 | AudioTrack *AudioTrack::create(emscripten::val v) 17 | { 18 | AudioTrack *track = new AudioTrack(v); 19 | track->autorelease(); 20 | return track; 21 | } 22 | 23 | HTML5_PROPERTY_IMPL(AudioTrack, bool, enabled); 24 | HTML5_PROPERTY_IMPL(AudioTrack, std::string, id); 25 | HTML5_PROPERTY_IMPL(AudioTrack, std::string, kind); 26 | HTML5_PROPERTY_IMPL(AudioTrack, std::string, label); 27 | HTML5_PROPERTY_IMPL(AudioTrack, std::string, language); 28 | -------------------------------------------------------------------------------- /src/audio_track_list.cc: -------------------------------------------------------------------------------- 1 | #include "audio_track.h" 2 | #include "audio_track_list.h" 3 | #include "event.h" 4 | #include "event_handler.h" 5 | 6 | USING_NAMESPACE_HTML5; 7 | 8 | HTML5_BIND_CLASS(AudioTrackList); 9 | 10 | AudioTrackList::AudioTrackList(emscripten::val v) : 11 | EventTarget(v) 12 | { 13 | 14 | } 15 | 16 | AudioTrackList::~AudioTrackList() 17 | { 18 | 19 | } 20 | 21 | AudioTrackList *AudioTrackList::create(emscripten::val v) 22 | { 23 | AudioTrackList *trackList = new AudioTrackList(v); 24 | trackList->autorelease(); 25 | return trackList; 26 | } 27 | 28 | AudioTrack *AudioTrackList::getter(unsigned long index) 29 | { 30 | return AudioTrack::create(HTML5_CALLv(this->v, getter, index)); 31 | } 32 | 33 | AudioTrack *AudioTrackList::getTrackById(std::string id) 34 | { 35 | return AudioTrack::create(HTML5_CALLv(this->v, getTrackById, id)); 36 | } 37 | 38 | HTML5_PROPERTY_IMPL(AudioTrackList, unsigned long, length); 39 | HTML5_EVENT_HANDLER_PROPERTY_IMPL(AudioTrackList, EventHandler *, onaddtrack); 40 | HTML5_EVENT_HANDLER_PROPERTY_IMPL(AudioTrackList, EventHandler *, onchange); 41 | HTML5_EVENT_HANDLER_PROPERTY_IMPL(AudioTrackList, EventHandler *, onremovetrack); 42 | -------------------------------------------------------------------------------- /src/auto_release_pool.cc: -------------------------------------------------------------------------------- 1 | #include "libhtml5.h" 2 | #include "object.h" 3 | #include "auto_release_pool.h" 4 | 5 | USING_NAMESPACE_HTML5; 6 | 7 | static AutoReleasePool g_sharedInstance; 8 | 9 | AutoReleasePool::AutoReleasePool() 10 | { 11 | 12 | } 13 | 14 | AutoReleasePool::~AutoReleasePool() 15 | { 16 | 17 | } 18 | 19 | AutoReleasePool *AutoReleasePool::sharedInstance() 20 | { 21 | return &g_sharedInstance; 22 | } 23 | 24 | void AutoReleasePool::addObject(NativeObject *object) 25 | { 26 | this->objects.push_back(object); 27 | } 28 | 29 | bool AutoReleasePool::contains(NativeObject *o) const 30 | { 31 | for (NativeObject *obj : this->objects) { 32 | if (obj == o) { 33 | return true; 34 | } 35 | } 36 | return false; 37 | } 38 | 39 | void AutoReleasePool::clear() 40 | { 41 | 42 | } 43 | 44 | void AutoReleasePool::releaseObjects() 45 | { 46 | std::vector newObjects; 47 | for (NativeObject *o : this->objects) { 48 | if (o->referenceCount() == 0) { 49 | delete o; 50 | } else { 51 | newObjects.push_back(o); 52 | } 53 | } 54 | this->objects = newObjects; 55 | } 56 | -------------------------------------------------------------------------------- /src/bar_prop.cc: -------------------------------------------------------------------------------- 1 | #include "bar_prop.h" 2 | 3 | USING_NAMESPACE_HTML5; 4 | 5 | BarProp::BarProp(emscripten::val v) : 6 | Object(v) 7 | { 8 | 9 | } 10 | 11 | BarProp::~BarProp() 12 | { 13 | 14 | } 15 | 16 | BarProp *BarProp::create(emscripten::val v) 17 | { 18 | auto barProp = new BarProp(v); 19 | barProp->autorelease(); 20 | return barProp; 21 | } 22 | 23 | HTML5_PROPERTY_IMPL(BarProp, bool, visible); 24 | -------------------------------------------------------------------------------- /src/blob.cc: -------------------------------------------------------------------------------- 1 | #include "blob.h" 2 | 3 | USING_NAMESPACE_HTML5; 4 | 5 | Blob::Blob(emscripten::val v) : 6 | Object(v) 7 | { 8 | 9 | } 10 | 11 | Blob::~Blob() 12 | { 13 | 14 | } 15 | 16 | Blob *Blob::create(emscripten::val v) 17 | { 18 | Blob *blob = new Blob(v); 19 | blob->autorelease(); 20 | return blob; 21 | } 22 | 23 | void Blob::close() 24 | { 25 | HTML5_CALL(this->v, close); 26 | } 27 | 28 | Blob *Blob::slice(long long start) 29 | { 30 | return create(HTML5_CALLv(this->v, slice, start)); 31 | } 32 | 33 | Blob *Blob::slice(long long start, long long end, std::string contentType) 34 | { 35 | return create(HTML5_CALLv(this->v, slice, start, end, contentType)); 36 | } 37 | 38 | HTML5_PROPERTY_IMPL(Blob, unsigned long long, size); 39 | HTML5_PROPERTY_IMPL(Blob, std::string, type); 40 | -------------------------------------------------------------------------------- /src/canvas_gradient.cc: -------------------------------------------------------------------------------- 1 | #include "canvas_gradient.h" 2 | 3 | USING_NAMESPACE_HTML5; 4 | 5 | CanvasGradient::CanvasGradient(emscripten::val v) : 6 | Object(v) 7 | { 8 | } 9 | 10 | CanvasGradient::~CanvasGradient() 11 | { 12 | } 13 | 14 | CanvasGradient *CanvasGradient::create(emscripten::val v) 15 | { 16 | auto grad = new CanvasGradient(v); 17 | grad->autorelease(); 18 | return grad; 19 | } 20 | 21 | void CanvasGradient::addColorStop(double offset, std::string color) 22 | { 23 | HTML5_CALL(this->v, addColorStop, offset, color); 24 | } 25 | -------------------------------------------------------------------------------- /src/canvas_pattern.cc: -------------------------------------------------------------------------------- 1 | #include "svgmatrix.h" 2 | #include "canvas_pattern.h" 3 | 4 | USING_NAMESPACE_HTML5; 5 | 6 | CanvasPattern::CanvasPattern(emscripten::val v) : 7 | Object(v) 8 | { 9 | } 10 | 11 | CanvasPattern::~CanvasPattern() 12 | { 13 | } 14 | 15 | CanvasPattern *CanvasPattern::create(emscripten::val v) 16 | { 17 | auto pat = new CanvasPattern(v); 18 | pat->autorelease(); 19 | return pat; 20 | } 21 | 22 | void CanvasPattern::setTransform(SVGMatrix *transform) 23 | { 24 | HTML5_CALL(this->v, setTransform, transform->v); 25 | } 26 | -------------------------------------------------------------------------------- /src/character_data.cc: -------------------------------------------------------------------------------- 1 | #include "element.h" 2 | #include "character_data.h" 3 | 4 | USING_NAMESPACE_HTML5; 5 | 6 | CharacterData::CharacterData(emscripten::val v) : 7 | Node(v) 8 | { 9 | 10 | } 11 | 12 | CharacterData::~CharacterData() 13 | { 14 | } 15 | 16 | CharacterData *CharacterData::create(emscripten::val v) 17 | { 18 | auto data = new CharacterData(v); 19 | data->autorelease(); 20 | return data; 21 | } 22 | 23 | void CharacterData::after(std::vector nodes) 24 | { 25 | for (Node *node : nodes) { 26 | HTML5_CALL(this->v, after, node->v); 27 | } 28 | } 29 | 30 | void CharacterData::appendData(std::string data) 31 | { 32 | HTML5_CALL(this->v, appendData, data); 33 | } 34 | 35 | void CharacterData::before(std::vector nodes) 36 | { 37 | for (Node *node : nodes) { 38 | HTML5_CALL(this->v, after, node->v); 39 | } 40 | } 41 | 42 | void CharacterData::deleteData(unsigned long offset, unsigned long count) 43 | { 44 | HTML5_CALL(this->v, deleteData, offset, count); 45 | } 46 | 47 | void CharacterData::insertData(unsigned long offset, std::string data) 48 | { 49 | HTML5_CALL(this->v, insertData, offset, data); 50 | } 51 | 52 | void CharacterData::remove() 53 | { 54 | HTML5_CALL(this->v, remove); 55 | } 56 | 57 | void CharacterData::replace(std::vector nodes) 58 | { 59 | for (Node *node : nodes) { 60 | HTML5_CALL(this->v, replace, node->v); 61 | } 62 | } 63 | 64 | void CharacterData::replaceData(unsigned long offset, unsigned long count, std::string data) 65 | { 66 | HTML5_CALL(this->v, replaceData, offset, count); 67 | } 68 | 69 | std::string CharacterData::substringData(unsigned long offset, unsigned long count) 70 | { 71 | return HTML5_CALLs(this->v, substringData, offset, count); 72 | } 73 | 74 | HTML5_PROPERTY_IMPL(CharacterData, std::string, data); 75 | HTML5_PROPERTY_IMPL(CharacterData, unsigned long, length); 76 | HTML5_PROPERTY_OBJECT_IMPL(CharacterData, Element, nextElementSibling); 77 | HTML5_PROPERTY_OBJECT_IMPL(CharacterData, Element, previousElementSibling); 78 | -------------------------------------------------------------------------------- /src/comment.cc: -------------------------------------------------------------------------------- 1 | #include "comment.h" 2 | 3 | USING_NAMESPACE_HTML5; 4 | 5 | Comment::Comment(emscripten::val v) : 6 | CharacterData(v) 7 | { 8 | 9 | } 10 | 11 | Comment::~Comment() 12 | { 13 | 14 | } 15 | 16 | Comment *Comment::create(emscripten::val v) 17 | { 18 | auto comment = new Comment(v); 19 | comment->autorelease(); 20 | return comment; 21 | } 22 | -------------------------------------------------------------------------------- /src/css_rule.cc: -------------------------------------------------------------------------------- 1 | #include "css_style_sheet.h" 2 | #include "css_rule.h" 3 | 4 | USING_NAMESPACE_HTML5; 5 | 6 | CSSRule::CSSRule(emscripten::val v) : 7 | Object(v) 8 | { 9 | 10 | } 11 | 12 | CSSRule::~CSSRule() 13 | { 14 | 15 | } 16 | 17 | CSSRule *CSSRule::create(emscripten::val v) 18 | { 19 | CSSRule *rule = new CSSRule(v); 20 | rule->autorelease(); 21 | return rule; 22 | } 23 | 24 | HTML5_PROPERTY_IMPL(CSSRule, std::string, cssText); 25 | HTML5_PROPERTY_OBJECT_IMPL(CSSRule, CSSRule, parentRule); 26 | HTML5_PROPERTY_OBJECT_IMPL(CSSRule, CSSStyleSheet, parentStyleSheet); 27 | HTML5_PROPERTY_IMPL(CSSRule, unsigned short, type); 28 | -------------------------------------------------------------------------------- /src/css_rule_list.cc: -------------------------------------------------------------------------------- 1 | #include "css_rule.h" 2 | #include "css_rule_list.h" 3 | 4 | USING_NAMESPACE_HTML5; 5 | 6 | CSSRuleList::CSSRuleList(emscripten::val v) : 7 | Object(v) 8 | { 9 | 10 | } 11 | 12 | CSSRuleList::~CSSRuleList() 13 | { 14 | 15 | } 16 | 17 | CSSRuleList *CSSRuleList::create(emscripten::val v) 18 | { 19 | CSSRuleList *ruleList = new CSSRuleList(v); 20 | ruleList->autorelease(); 21 | return ruleList; 22 | } 23 | 24 | CSSRule *CSSRuleList::item(unsigned long index) 25 | { 26 | return CSSRule::create(HTML5_CALLv(this->v, item, index)); 27 | } 28 | 29 | HTML5_PROPERTY_IMPL(CSSRuleList, unsigned long, length); 30 | -------------------------------------------------------------------------------- /src/css_style_declaration.cc: -------------------------------------------------------------------------------- 1 | #include "css_rule.h" 2 | #include "css_style_declaration.h" 3 | 4 | USING_NAMESPACE_HTML5; 5 | 6 | CSSStyleDeclaration::CSSStyleDeclaration(emscripten::val v) : 7 | Object(v) 8 | { 9 | 10 | } 11 | 12 | CSSStyleDeclaration::~CSSStyleDeclaration() 13 | { 14 | 15 | } 16 | 17 | CSSStyleDeclaration *CSSStyleDeclaration::create(emscripten::val v) 18 | { 19 | CSSStyleDeclaration *decl = new CSSStyleDeclaration(v); 20 | decl->autorelease(); 21 | return decl; 22 | } 23 | 24 | std::string CSSStyleDeclaration::getPropertyPriority(std::string property) 25 | { 26 | return HTML5_CALLs(this->v, getPropertyPriority, property); 27 | } 28 | 29 | std::string CSSStyleDeclaration::getPropertyValue(std::string property) 30 | { 31 | return HTML5_CALLs(this->v, getPropertyValue, property); 32 | } 33 | 34 | std::string CSSStyleDeclaration::item(unsigned long index) 35 | { 36 | return HTML5_CALLs(this->v, item, index); 37 | } 38 | 39 | std::string CSSStyleDeclaration::removeProperty(std::string property) 40 | { 41 | return HTML5_CALLs(this->v, removeProperty, property); 42 | } 43 | 44 | void CSSStyleDeclaration::setProperty(std::string property, std::string value, std::string priority) 45 | { 46 | HTML5_CALL(this->v, setProperty, property, value, priority); 47 | } 48 | 49 | void CSSStyleDeclaration::setPropertyPriority(std::string property, std::string priority) 50 | { 51 | HTML5_CALL(this->v, setPropertyPriority, property, priority); 52 | } 53 | 54 | void CSSStyleDeclaration::setPropertyValue(std::string property, std::string value) 55 | { 56 | HTML5_CALL(this->v, setPropertyValue, property, value); 57 | } 58 | 59 | HTML5_PROPERTY_IMPL(CSSStyleDeclaration, std::string, cssFloat); 60 | HTML5_PROPERTY_IMPL(CSSStyleDeclaration, std::string, cssText); 61 | HTML5_PROPERTY_IMPL(CSSStyleDeclaration, unsigned long, length); 62 | HTML5_PROPERTY_OBJECT_IMPL(CSSStyleDeclaration, CSSRule, parentRule); 63 | -------------------------------------------------------------------------------- /src/css_style_sheet.cc: -------------------------------------------------------------------------------- 1 | #include "css_rule.h" 2 | #include "css_rule_list.h" 3 | #include "css_style_sheet.h" 4 | 5 | USING_NAMESPACE_HTML5; 6 | 7 | CSSStyleSheet::CSSStyleSheet(emscripten::val v) : 8 | StyleSheet(v) 9 | { 10 | 11 | } 12 | 13 | CSSStyleSheet::~CSSStyleSheet() 14 | { 15 | 16 | } 17 | 18 | CSSStyleSheet *CSSStyleSheet::create(emscripten::val v) 19 | { 20 | CSSStyleSheet *sheet = new CSSStyleSheet(v); 21 | sheet->autorelease(); 22 | return sheet; 23 | } 24 | 25 | void CSSStyleSheet::deleteRule(unsigned long index) 26 | { 27 | HTML5_CALL(this->v, deleteRule, index); 28 | } 29 | 30 | unsigned long CSSStyleSheet::insertRule(std::string rule, unsigned long index) 31 | { 32 | return HTML5_CALLi(this->v, insertRule, unsigned long, rule, index); 33 | } 34 | 35 | HTML5_PROPERTY_OBJECT_IMPL(CSSStyleSheet, CSSRuleList, cssRules); 36 | HTML5_PROPERTY_OBJECT_IMPL(CSSStyleSheet, CSSRule, ownerRule); 37 | -------------------------------------------------------------------------------- /src/document_fragment.cc: -------------------------------------------------------------------------------- 1 | #include "element.h" 2 | #include "node_list.h" 3 | #include "html_collection.h" 4 | #include "document_fragment.h" 5 | 6 | USING_NAMESPACE_HTML5; 7 | 8 | DocumentFragment::DocumentFragment(emscripten::val v) : 9 | Node(v) 10 | { 11 | 12 | } 13 | 14 | DocumentFragment::~DocumentFragment() 15 | { 16 | 17 | } 18 | 19 | DocumentFragment *DocumentFragment::create(emscripten::val v) 20 | { 21 | auto frag = new DocumentFragment(v); 22 | frag->autorelease(); 23 | return frag; 24 | } 25 | 26 | void DocumentFragment::append(std::vector nodes) 27 | { 28 | for (Node *node : nodes) { 29 | HTML5_CALL(this->v, append, node->v); 30 | } 31 | } 32 | 33 | Element *DocumentFragment::getElementById(std::string elementId) 34 | { 35 | return Element::create(HTML5_CALLv(this->v, getElementById, elementId)); 36 | } 37 | 38 | void DocumentFragment::prepend(std::vector nodes) 39 | { 40 | for (Node *node : nodes) { 41 | HTML5_CALL(this->v, prepend, node->v); 42 | } 43 | } 44 | 45 | Element *DocumentFragment::query(std::string relativeSelectors) 46 | { 47 | return Element::create(HTML5_CALLv(this->v, query, relativeSelectors)); 48 | } 49 | 50 | std::vector DocumentFragment::queryAll(std::string relativeSelectors) 51 | { 52 | return toObjectArray(HTML5_CALLv(this->v, queryAll, relativeSelectors)); 53 | } 54 | 55 | Element *DocumentFragment::querySelector(std::string selectors) 56 | { 57 | return Element::create(HTML5_CALLv(this->v, querySelector, selectors)); 58 | } 59 | 60 | NodeList *DocumentFragment::querySelectorAll(std::string selectors) 61 | { 62 | return NodeList::create(HTML5_CALLv(this->v, querySelectorAll, selectors)); 63 | } 64 | 65 | HTML5_PROPERTY_IMPL(DocumentFragment, unsigned long, childElementCount); 66 | HTML5_PROPERTY_OBJECT_IMPL(DocumentFragment, HTMLCollection, children); 67 | HTML5_PROPERTY_OBJECT_IMPL(DocumentFragment, Element, firstElementChild); 68 | HTML5_PROPERTY_OBJECT_IMPL(DocumentFragment, Element, lastElementChild); 69 | -------------------------------------------------------------------------------- /src/document_type.cc: -------------------------------------------------------------------------------- 1 | #include "node.h" 2 | #include "document_type.h" 3 | 4 | USING_NAMESPACE_HTML5; 5 | 6 | DocumentType::DocumentType(emscripten::val v) : 7 | Object(v) 8 | { 9 | 10 | } 11 | 12 | DocumentType::~DocumentType() 13 | { 14 | 15 | } 16 | 17 | DocumentType *DocumentType::create(emscripten::val v) 18 | { 19 | auto type = new DocumentType(v); 20 | type->autorelease(); 21 | return type; 22 | } 23 | 24 | void DocumentType::after(std::vector nodes) 25 | { 26 | for (size_t i = 0; i < nodes.size(); ++i) { 27 | HTML5_CALL(this->v, after, nodes[i]->v); 28 | } 29 | } 30 | 31 | void DocumentType::before(std::vector nodes) 32 | { 33 | for (size_t i = 0; i < nodes.size(); ++i) { 34 | HTML5_CALL(this->v, before, nodes[i]->v); 35 | } 36 | } 37 | 38 | void DocumentType::replace(std::vector nodes) 39 | { 40 | for (size_t i = 0; i < nodes.size(); ++i) { 41 | HTML5_CALL(this->v, replace, nodes[i]->v); 42 | } 43 | } 44 | 45 | void DocumentType::remove() 46 | { 47 | HTML5_CALL(this->v, remove); 48 | } 49 | 50 | HTML5_PROPERTY_IMPL(DocumentType, std::string, name); 51 | HTML5_PROPERTY_IMPL(DocumentType, std::string, publicId); 52 | HTML5_PROPERTY_IMPL(DocumentType, std::string, systemId); 53 | -------------------------------------------------------------------------------- /src/dom_error.cc: -------------------------------------------------------------------------------- 1 | #include "dom_error.h" 2 | 3 | USING_NAMESPACE_HTML5; 4 | 5 | DOMError::DOMError(emscripten::val v) : 6 | Object(v) 7 | { 8 | 9 | } 10 | 11 | DOMError::~DOMError() 12 | { 13 | 14 | } 15 | 16 | DOMError *DOMError::create(emscripten::val v) 17 | { 18 | auto error = new DOMError(v); 19 | error->autorelease(); 20 | return error; 21 | } 22 | 23 | HTML5_PROPERTY_IMPL(DOMError, std::string, message); 24 | HTML5_PROPERTY_IMPL(DOMError, std::string, name); 25 | -------------------------------------------------------------------------------- /src/dom_implementation.cc: -------------------------------------------------------------------------------- 1 | #include "document.h" 2 | #include "xml_document.h" 3 | #include "document_type.h" 4 | #include "dom_implementation.h" 5 | 6 | USING_NAMESPACE_HTML5; 7 | 8 | DOMImplementation::DOMImplementation(emscripten::val v) : 9 | Object(v) 10 | { 11 | 12 | } 13 | 14 | DOMImplementation::~DOMImplementation() 15 | { 16 | 17 | } 18 | 19 | DOMImplementation *DOMImplementation::create(emscripten::val v) 20 | { 21 | auto impl = new DOMImplementation(v); 22 | impl->autorelease(); 23 | return impl; 24 | } 25 | 26 | XMLDocument *DOMImplementation::createDocument(std::string _namespace, std::string qualifiedName, DocumentType *type) 27 | { 28 | return XMLDocument::create(HTML5_CALLv(this->v, createDocument, _namespace, qualifiedName, type->v)); 29 | } 30 | 31 | DocumentType *DOMImplementation::createDocumentType(std::string qualifiedName, std::string publicId, std::string systemId) 32 | { 33 | return DocumentType::create(HTML5_CALLv(this->v, createDocumentType, qualifiedName, publicId, systemId)); 34 | } 35 | 36 | Document *DOMImplementation::createHTMLDocument(std::string title) 37 | { 38 | return Document::create(HTML5_CALLv(this->v, createHTMLDocument, title)); 39 | } 40 | 41 | bool DOMImplementation::hasFeature() 42 | { 43 | return HTML5_CALLb(this->v, hasFeature); 44 | } 45 | -------------------------------------------------------------------------------- /src/dom_token_list.cc: -------------------------------------------------------------------------------- 1 | #include "dom_token_list.h" 2 | 3 | USING_NAMESPACE_HTML5; 4 | 5 | DOMTokenList::DOMTokenList(emscripten::val v) : 6 | Object(v) 7 | { 8 | 9 | } 10 | 11 | DOMTokenList::~DOMTokenList() 12 | { 13 | 14 | } 15 | 16 | DOMTokenList *DOMTokenList::create(emscripten::val v) 17 | { 18 | DOMTokenList *list = new DOMTokenList(v); 19 | list->autorelease(); 20 | return list; 21 | } 22 | 23 | void DOMTokenList::add(std::vector tokens) 24 | { 25 | for (auto &token : tokens) { 26 | HTML5_CALL(this->v, add, token); 27 | } 28 | } 29 | 30 | bool DOMTokenList::contains(std::string token) 31 | { 32 | return HTML5_CALLb(this->v, contains, token); 33 | } 34 | 35 | void DOMTokenList::remove(std::vector tokens) 36 | { 37 | for (auto &token : tokens) { 38 | HTML5_CALL(this->v, remove, token); 39 | } 40 | } 41 | 42 | bool DOMTokenList::toggle(std::string token, bool force) 43 | { 44 | return HTML5_CALLb(this->v, toggle, token, force); 45 | } 46 | 47 | HTML5_PROPERTY_IMPL(DOMTokenList, unsigned long, length); 48 | -------------------------------------------------------------------------------- /src/event.cc: -------------------------------------------------------------------------------- 1 | #include "event_target.h" 2 | #include "event.h" 3 | 4 | USING_NAMESPACE_HTML5; 5 | 6 | Event::Event(emscripten::val v) : 7 | Object(v) 8 | { 9 | 10 | } 11 | 12 | Event::~Event() 13 | { 14 | 15 | } 16 | 17 | Event *Event::create(std::string type) 18 | { 19 | Event *event = new Event(HTML5_NEW_PRIMITIVE_INSTANCE(Event, type)); 20 | event->autorelease(); 21 | return event; 22 | } 23 | 24 | Event *Event::create(emscripten::val v) 25 | { 26 | Event *event = new Event(v); 27 | event->autorelease(); 28 | return event; 29 | } 30 | 31 | void Event::initEvent(std::string type, bool bubbles, bool cancelable) 32 | { 33 | HTML5_CALL(this->v, initEvent, type, bubbles, cancelable); 34 | } 35 | 36 | void Event::preventDefault() 37 | { 38 | HTML5_CALL(this->v, preventDefault); 39 | } 40 | 41 | void Event::stopImmediatePropagation() 42 | { 43 | HTML5_CALL(this->v, stopImmediatePropagation); 44 | } 45 | 46 | void Event::stopPropagation() 47 | { 48 | HTML5_CALL(this->v, stopPropagation); 49 | } 50 | 51 | HTML5_PROPERTY_IMPL(Event, bool, bubbles); 52 | HTML5_PROPERTY_IMPL(Event, bool, cancelable); 53 | HTML5_PROPERTY_OBJECT_IMPL(Event, EventTarget, currentTarget); 54 | HTML5_PROPERTY_IMPL(Event, bool, defaultPrevented); 55 | HTML5_PROPERTY_IMPL(Event, unsigned short, eventPhase); 56 | HTML5_PROPERTY_IMPL(Event, bool, isTrusted); 57 | HTML5_PROPERTY_OBJECT_IMPL(Event, EventTarget, target); 58 | HTML5_PROPERTY_IMPL(Event, std::string, type); 59 | HTML5_PROPERTY_IMPL(Event, time_t, timeStamp); 60 | -------------------------------------------------------------------------------- /src/external.cc: -------------------------------------------------------------------------------- 1 | #include "external.h" 2 | 3 | USING_NAMESPACE_HTML5; 4 | 5 | External::External(emscripten::val v) : 6 | Object(v) 7 | { 8 | 9 | } 10 | 11 | External::~External() 12 | { 13 | 14 | } 15 | 16 | External *External::create(emscripten::val v) 17 | { 18 | auto external = new External(v); 19 | external->autorelease(); 20 | return external; 21 | } 22 | 23 | void External::AddSearchProvider(std::string engineURL) 24 | { 25 | HTML5_CALL(this->v, AddSearchProvider, engineURL); 26 | } 27 | 28 | unsigned long External::IsSearchProviderInstalled(std::string engineURL) 29 | { 30 | return HTML5_CALLi(this->v, IsSearchProviderInstalled, unsigned long, engineURL); 31 | } 32 | -------------------------------------------------------------------------------- /src/file_reader.cc: -------------------------------------------------------------------------------- 1 | #include "file_reader.h" 2 | #include "blob.h" 3 | #include "array_buffer.h" 4 | 5 | USING_NAMESPACE_HTML5; 6 | 7 | HTML5_BIND_CLASS(FileReader); 8 | 9 | FileReader::FileReader(emscripten::val v) : 10 | EventTarget(v) 11 | { 12 | } 13 | 14 | FileReader::~FileReader() 15 | { 16 | } 17 | 18 | FileReader *FileReader::create() 19 | { 20 | auto reader = new FileReader(HTML5_NEW_PRIMITIVE_INSTANCE(FileReader)); 21 | reader->autorelease(); 22 | return reader; 23 | } 24 | 25 | void FileReader::abort() 26 | { 27 | HTML5_CALL(this->v, abort); 28 | } 29 | 30 | void FileReader::readAsArrayBuffer(Blob *blob) 31 | { 32 | HTML5_CALL(this->v, readAsArrayBuffer, blob->v); 33 | } 34 | 35 | void FileReader::readAsArrayBuffer(File *file) 36 | { 37 | // HTML5_CALL(this->v, readAsArrayBuffer, file->v); 38 | } 39 | 40 | void FileReader::readAsBinaryString(Blob *blob) 41 | { 42 | HTML5_CALL(this->v, readAsBinaryString, blob->v); 43 | } 44 | 45 | void FileReader::readAsBinaryString(File *file) 46 | { 47 | //HTML5_CALL(this->v, readAsBinaryString, file->v); 48 | } 49 | 50 | void FileReader::readAsDataURL(Blob *blob) 51 | { 52 | HTML5_CALL(this->v, readAsDataURL, blob->v); 53 | } 54 | 55 | void FileReader::readAsDataURL(File *file) 56 | { 57 | //HTML5_CALL(this->v, readAsDataURL, file->v); 58 | } 59 | 60 | void FileReader::readAsText(Blob *blob, const std::string &encoding) 61 | { 62 | HTML5_CALL(this->v, readAsText, blob->v, encoding); 63 | } 64 | 65 | void FileReader::readAsText(File *file, const std::string &encoding) 66 | { 67 | //HTML5_CALL(this->v, readAsText, file->v, encoding); 68 | } 69 | 70 | ArrayBuffer *FileReader::resultArrayBuffer() const 71 | { 72 | return ArrayBuffer::create(this->v["result"]); 73 | } 74 | 75 | std::string FileReader::resultString() const 76 | { 77 | return this->v["result"].as(); 78 | } 79 | 80 | HTML5_EVENT_HANDLER_PROPERTY_IMPL_NEW(FileReader, EventHandler, onload); -------------------------------------------------------------------------------- /src/history.cc: -------------------------------------------------------------------------------- 1 | #include "history.h" 2 | 3 | USING_NAMESPACE_HTML5; 4 | 5 | History::History(emscripten::val v) : 6 | Object(v) 7 | { 8 | 9 | } 10 | 11 | History::~History() 12 | { 13 | 14 | } 15 | 16 | History *History::create(emscripten::val v) 17 | { 18 | auto history = new History(v); 19 | history->autorelease(); 20 | return history; 21 | } 22 | 23 | void History::back() 24 | { 25 | HTML5_CALL(this->v, back); 26 | } 27 | 28 | void History::forward() 29 | { 30 | HTML5_CALL(this->v, forward); 31 | } 32 | 33 | void History::go(long delta) 34 | { 35 | HTML5_CALL(this->v, go, delta); 36 | } 37 | 38 | void History::pushState(void *data, std::string title, std::string url) 39 | { 40 | //HTML5_CALL(this->v, pushState, data, title, url); 41 | } 42 | 43 | void History::replaceState(void *data, std::string title, std::string url) 44 | { 45 | //HTML5_CALL(this->v, replaceState, data, title, url); 46 | } 47 | -------------------------------------------------------------------------------- /src/hit_region_options.cc: -------------------------------------------------------------------------------- 1 | #include "element.h" 2 | #include "path2d.h" 3 | #include "hit_region_options.h" 4 | 5 | USING_NAMESPACE_HTML5; 6 | 7 | HitRegionOptions::HitRegionOptions(emscripten::val v) : 8 | Object(v) 9 | { 10 | 11 | } 12 | 13 | HitRegionOptions::~HitRegionOptions() 14 | { 15 | 16 | } 17 | 18 | HitRegionOptions *HitRegionOptions::create(emscripten::val v) 19 | { 20 | auto opt = new HitRegionOptions(v); 21 | opt->autorelease(); 22 | return opt; 23 | } 24 | 25 | std::string HitRegionOptions::getFillRule() 26 | { 27 | #if ENABLE_EMSCRIPTEN 28 | return this->v["fillRule"].as(); 29 | #else 30 | return ""; 31 | #endif 32 | } 33 | 34 | void HitRegionOptions::setFillRule(CanvasFillRule value) 35 | { 36 | this->_fillRule = value; 37 | switch (value) { 38 | case CanvasFillRule::NONZERO: 39 | this->v.set("fillRule", "nonzero"); 40 | break; 41 | case CanvasFillRule::EVENODD: 42 | this->v.set("fillRule", "evenodd"); 43 | break; 44 | } 45 | } 46 | 47 | HTML5_PROPERTY_OBJECT_IMPL(HitRegionOptions, Element, control); 48 | HTML5_PROPERTY_IMPL(HitRegionOptions, std::string, cursor); 49 | HTML5_PROPERTY_IMPL(HitRegionOptions, std::string, id); 50 | HTML5_PROPERTY_IMPL(HitRegionOptions, std::string, label); 51 | HTML5_PROPERTY_IMPL(HitRegionOptions, std::string, parentID); 52 | HTML5_PROPERTY_OBJECT_IMPL(HitRegionOptions, Path2D, path); 53 | HTML5_PROPERTY_IMPL(HitRegionOptions, std::string, role); 54 | -------------------------------------------------------------------------------- /src/html_base_element.cc: -------------------------------------------------------------------------------- 1 | #include "html_base_element.h" 2 | 3 | USING_NAMESPACE_HTML5; 4 | 5 | HTMLBaseElement::HTMLBaseElement(emscripten::val v) : 6 | HTMLElement(v) 7 | { 8 | 9 | } 10 | 11 | HTMLBaseElement::~HTMLBaseElement() 12 | { 13 | 14 | } 15 | 16 | HTMLBaseElement *HTMLBaseElement::create(emscripten::val v) 17 | { 18 | HTMLBaseElement *e = new HTMLBaseElement(v); 19 | e->autorelease(); 20 | return e; 21 | } 22 | 23 | HTML5_PROPERTY_IMPL(HTMLBaseElement, std::string, href); 24 | HTML5_PROPERTY_IMPL(HTMLBaseElement, std::string, target); -------------------------------------------------------------------------------- /src/html_body_element.cc: -------------------------------------------------------------------------------- 1 | #include "html_body_element.h" 2 | 3 | USING_NAMESPACE_HTML5; 4 | 5 | HTML5_BIND_CLASS(HTMLBodyElement); 6 | 7 | HTMLBodyElement::HTMLBodyElement(emscripten::val v) : 8 | HTMLElement(v) 9 | { 10 | 11 | } 12 | 13 | HTMLBodyElement::~HTMLBodyElement() 14 | { 15 | 16 | } 17 | 18 | HTMLBodyElement *HTMLBodyElement::create(emscripten::val v) 19 | { 20 | HTMLBodyElement *e = new HTMLBodyElement(v); 21 | e->autorelease(); 22 | return e; 23 | } 24 | 25 | 26 | HTML5_EVENT_HANDLER_PROPERTY_IMPL(HTMLBodyElement, EventHandler *, onafterprint); 27 | HTML5_EVENT_HANDLER_PROPERTY_IMPL(HTMLBodyElement, EventHandler *, onbeforeprint); 28 | HTML5_EVENT_HANDLER_PROPERTY_IMPL(HTMLBodyElement, EventHandler *, onbeforeunload); 29 | HTML5_EVENT_HANDLER_PROPERTY_IMPL(HTMLBodyElement, EventHandler *, onhashchange); 30 | HTML5_EVENT_HANDLER_PROPERTY_IMPL(HTMLBodyElement, EventHandler *, onlanguagechange); 31 | HTML5_EVENT_HANDLER_PROPERTY_IMPL(HTMLBodyElement, EventHandler *, onmessage); 32 | HTML5_EVENT_HANDLER_PROPERTY_IMPL(HTMLBodyElement, EventHandler *, onoffline); 33 | HTML5_EVENT_HANDLER_PROPERTY_IMPL(HTMLBodyElement, EventHandler *, ononline); 34 | HTML5_EVENT_HANDLER_PROPERTY_IMPL(HTMLBodyElement, EventHandler *, onpagehide); 35 | HTML5_EVENT_HANDLER_PROPERTY_IMPL(HTMLBodyElement, EventHandler *, onpageshow); 36 | HTML5_EVENT_HANDLER_PROPERTY_IMPL(HTMLBodyElement, EventHandler *, onpopstate); 37 | HTML5_EVENT_HANDLER_PROPERTY_IMPL(HTMLBodyElement, EventHandler *, onstorage); 38 | HTML5_EVENT_HANDLER_PROPERTY_IMPL(HTMLBodyElement, EventHandler *, onunload); -------------------------------------------------------------------------------- /src/html_canvas_element.cc: -------------------------------------------------------------------------------- 1 | #include "blob.h" 2 | #include "webgl_context_attributes.h" 3 | #include "html_canvas_element.h" 4 | 5 | USING_NAMESPACE_HTML5; 6 | 7 | HTML5_BIND_CLASS(HTMLCanvasElement); 8 | HTML5_BIND_METHOD(HTMLCanvasElement, toBlobCallback); 9 | 10 | HTMLCanvasElement::HTMLCanvasElement(emscripten::val v) : 11 | HTMLElement(v) 12 | { 13 | 14 | } 15 | 16 | HTMLCanvasElement::~HTMLCanvasElement() 17 | { 18 | 19 | } 20 | 21 | HTMLCanvasElement *HTMLCanvasElement::create(emscripten::val v) 22 | { 23 | auto canvas = new HTMLCanvasElement(v); 24 | canvas->autorelease(); 25 | return canvas; 26 | } 27 | 28 | RenderingContext *HTMLCanvasElement::getContext(std::string contextId) 29 | { 30 | return RenderingContext::create(HTML5_CALLv(this->v, getContext, contextId)); 31 | } 32 | 33 | RenderingContext *HTMLCanvasElement::getContext(std::string contextId, WebGLContextAttributes *attr) 34 | { 35 | return RenderingContext::create(HTML5_CALLv(this->v, getContext, contextId, attr->v)); 36 | } 37 | 38 | void HTMLCanvasElement::toBlob(std::function *callback, std::string mimeType, double qualityArgument) 39 | { 40 | this->_toBlobFn = callback; 41 | EM_ASM_({ 42 | var elem = Module['toHTMLCanvasElement']($0); 43 | var mimeType = Module['toString']($1); 44 | var quality = $2; 45 | elem['_value']['toBlob'](function(blob) { elem['toBlobCallback'](blob); }, mimeType, quality); 46 | }, this, mimeType.c_str(), qualityArgument); 47 | } 48 | 49 | void HTMLCanvasElement::toBlobCallback(emscripten::val blob) 50 | { 51 | if (!this->_toBlobFn) return; 52 | 53 | (*this->_toBlobFn)(Blob::create(blob)); 54 | } 55 | 56 | std::string HTMLCanvasElement::toDataURL(std::string type, double encoderOptions) 57 | { 58 | return HTML5_CALLs(this->v, toDataURL, type, encoderOptions); 59 | } 60 | 61 | HTML5_PROPERTY_IMPL(HTMLCanvasElement, unsigned long, height); 62 | HTML5_PROPERTY_IMPL(HTMLCanvasElement, unsigned long, width); 63 | -------------------------------------------------------------------------------- /src/html_collection.cc: -------------------------------------------------------------------------------- 1 | #include "element.h" 2 | #include "html_collection.h" 3 | 4 | USING_NAMESPACE_HTML5; 5 | 6 | HTMLCollection::HTMLCollection(emscripten::val v) : 7 | Object(v) 8 | { 9 | 10 | } 11 | 12 | HTMLCollection::~HTMLCollection() 13 | { 14 | 15 | 16 | } 17 | 18 | HTMLCollection *HTMLCollection::create(emscripten::val v) 19 | { 20 | HTMLCollection *c = new HTMLCollection(v); 21 | c->autorelease(); 22 | return c; 23 | } 24 | 25 | HTMLCollection *HTMLCollection::create() 26 | { 27 | HTMLCollection *c = new HTMLCollection(HTML5_NEW_PRIMITIVE_INSTANCE(HTMLCollection)); 28 | c->autorelease(); 29 | return c; 30 | } 31 | 32 | Element *HTMLCollection::item(unsigned long index) 33 | { 34 | return Element::create(HTML5_CALLv(this->v, item, index)); 35 | } 36 | 37 | Element *HTMLCollection::namedItem(std::string name) 38 | { 39 | return Element::create(HTML5_CALLv(this->v, namedItem, name)); 40 | } 41 | 42 | HTML5_PROPERTY_IMPL(HTMLCollection, unsigned long, length); 43 | -------------------------------------------------------------------------------- /src/html_content_element.cc: -------------------------------------------------------------------------------- 1 | #include "html_content_element.h" 2 | #include "node_list.h" 3 | 4 | USING_NAMESPACE_HTML5; 5 | 6 | HTMLContentElement::HTMLContentElement(emscripten::val v) : 7 | HTMLElement(v) 8 | { 9 | 10 | } 11 | 12 | HTMLContentElement::~HTMLContentElement() 13 | { 14 | 15 | } 16 | 17 | HTMLContentElement *HTMLContentElement::create(emscripten::val v) 18 | { 19 | HTMLContentElement *content = new HTMLContentElement(v); 20 | content->autorelease(); 21 | return content; 22 | } 23 | 24 | NodeList *HTMLContentElement::getDistributedNodes() 25 | { 26 | return NodeList::create(HTML5_CALLv(this->v, getDistributedNodes)); 27 | } 28 | 29 | HTML5_PROPERTY_IMPL(HTMLContentElement, bool, resetStyleInheritance); 30 | HTML5_PROPERTY_IMPL(HTMLContentElement, std::string, select); 31 | -------------------------------------------------------------------------------- /src/html_div_element.cc: -------------------------------------------------------------------------------- 1 | #include "html_div_element.h" 2 | 3 | USING_NAMESPACE_HTML5; 4 | 5 | HTML5_BIND_CLASS(HTMLDivElement); 6 | 7 | HTMLDivElement::HTMLDivElement(emscripten::val v) : 8 | HTMLElement(v) 9 | { 10 | 11 | } 12 | 13 | HTMLDivElement::~HTMLDivElement() 14 | { 15 | 16 | } 17 | 18 | HTMLDivElement *HTMLDivElement::create(emscripten::val v) 19 | { 20 | HTMLDivElement *e = new HTMLDivElement(v); 21 | e->autorelease(); 22 | return e; 23 | } 24 | -------------------------------------------------------------------------------- /src/html_head_element.cc: -------------------------------------------------------------------------------- 1 | #include "html_head_element.h" 2 | 3 | USING_NAMESPACE_HTML5; 4 | 5 | HTMLHeadElement::HTMLHeadElement(emscripten::val v) : 6 | HTMLElement(v) 7 | { 8 | 9 | } 10 | 11 | HTMLHeadElement::~HTMLHeadElement() 12 | { 13 | 14 | } 15 | 16 | HTMLHeadElement *HTMLHeadElement::create(emscripten::val v) 17 | { 18 | auto elem = new HTMLHeadElement(v); 19 | elem->autorelease(); 20 | return elem; 21 | } 22 | -------------------------------------------------------------------------------- /src/html_image_element.cc: -------------------------------------------------------------------------------- 1 | #include "html_image_element.h" 2 | #include 3 | 4 | USING_NAMESPACE_HTML5; 5 | 6 | HTMLImageElement::HTMLImageElement(emscripten::val v) : 7 | HTMLElement(v) 8 | { 9 | 10 | } 11 | 12 | HTMLImageElement::~HTMLImageElement() 13 | { 14 | 15 | } 16 | 17 | HTMLImageElement *HTMLImageElement::create(emscripten::val v) 18 | { 19 | HTMLImageElement *image = new HTMLImageElement(v); 20 | image->autorelease(); 21 | return image; 22 | } 23 | 24 | HTMLImageElement *HTMLImageElement::create() 25 | { 26 | return create(HTML5_NEW_PRIMITIVE_INSTANCE(Image)); 27 | } 28 | 29 | HTMLImageElement *HTMLImageElement::create(unsigned long width, unsigned long height) 30 | { 31 | return create(HTML5_NEW_PRIMITIVE_INSTANCE(Image, width, height)); 32 | } 33 | 34 | HTML5_PROPERTY_IMPL(HTMLImageElement, std::string, alt); 35 | HTML5_PROPERTY_IMPL(HTMLImageElement, bool, complete); 36 | HTML5_PROPERTY_IMPL(HTMLImageElement, std::string, crossOrigin); 37 | HTML5_PROPERTY_IMPL(HTMLImageElement, unsigned long, height); 38 | HTML5_PROPERTY_IMPL(HTMLImageElement, bool, isMap); 39 | HTML5_PROPERTY_IMPL(HTMLImageElement, unsigned long, naturalHeight); 40 | HTML5_PROPERTY_IMPL(HTMLImageElement, unsigned long, naturalWidth); 41 | HTML5_PROPERTY_IMPL(HTMLImageElement, std::string, src); 42 | HTML5_PROPERTY_IMPL(HTMLImageElement, std::string, srcset); 43 | HTML5_PROPERTY_IMPL(HTMLImageElement, std::string, useMap); 44 | HTML5_PROPERTY_IMPL(HTMLImageElement, unsigned long, width); 45 | -------------------------------------------------------------------------------- /src/html_properties_collection.cc: -------------------------------------------------------------------------------- 1 | #include "html_properties_collection.h" 2 | 3 | HTMLPropertiesCollection::HTMLPropertiesCollection(emscripten::val v) : 4 | HTMLCollection(v) 5 | { 6 | 7 | } 8 | 9 | HTMLPropertiesCollection::~HTMLPropertiesCollection() 10 | { 11 | 12 | } 13 | 14 | HTMLPropertiesCollection *HTMLPropertiesCollection::create(emscripten::val v) 15 | { 16 | auto c = new HTMLPropertiesCollection(v); 17 | c->autorelease(); 18 | return c; 19 | } 20 | -------------------------------------------------------------------------------- /src/html_script_element.cc: -------------------------------------------------------------------------------- 1 | #include "html_script_element.h" 2 | 3 | USING_NAMESPACE_HTML5; 4 | 5 | HTMLScriptElement::HTMLScriptElement(emscripten::val v) : 6 | HTMLElement(v) 7 | { 8 | 9 | } 10 | 11 | HTMLScriptElement::~HTMLScriptElement() 12 | { 13 | 14 | } 15 | 16 | HTMLScriptElement *HTMLScriptElement::create(emscripten::val v) 17 | { 18 | auto elem = new HTMLScriptElement(v); 19 | elem->autorelease(); 20 | return elem; 21 | } 22 | 23 | HTML5_PROPERTY_IMPL(HTMLScriptElement, bool, async); 24 | HTML5_PROPERTY_IMPL(HTMLScriptElement, std::string, charset); 25 | HTML5_PROPERTY_IMPL(HTMLScriptElement, std::string, crossOrigin); 26 | HTML5_PROPERTY_IMPL(HTMLScriptElement, bool, defer); 27 | HTML5_PROPERTY_IMPL(HTMLScriptElement, std::string, src); 28 | HTML5_PROPERTY_IMPL(HTMLScriptElement, std::string, text); 29 | HTML5_PROPERTY_IMPL(HTMLScriptElement, std::string, type); 30 | -------------------------------------------------------------------------------- /src/html_source_element.cc: -------------------------------------------------------------------------------- 1 | #include "document.h" 2 | #include "html_source_element.h" 3 | 4 | USING_NAMESPACE_HTML5; 5 | 6 | HTMLSourceElement::HTMLSourceElement(emscripten::val v) : 7 | HTMLElement(v) 8 | { 9 | 10 | } 11 | 12 | HTMLSourceElement::~HTMLSourceElement() 13 | { 14 | 15 | } 16 | 17 | HTMLSourceElement *HTMLSourceElement::create(emscripten::val v) 18 | { 19 | HTMLSourceElement *source = new HTMLSourceElement(v); 20 | source->autorelease(); 21 | return source; 22 | } 23 | 24 | HTMLSourceElement *HTMLSourceElement::create() 25 | { 26 | return dynamic_cast(Document::create()->createElement("source")); 27 | } 28 | 29 | HTML5_PROPERTY_IMPL(HTMLSourceElement, std::string, src); 30 | HTML5_PROPERTY_IMPL(HTMLSourceElement, std::string, type); 31 | -------------------------------------------------------------------------------- /src/html_style_element.cc: -------------------------------------------------------------------------------- 1 | #include "html_style_element.h" 2 | 3 | USING_NAMESPACE_HTML5; 4 | 5 | HTMLStyleElement::HTMLStyleElement(emscripten::val v) : 6 | HTMLElement(v) 7 | { 8 | 9 | } 10 | 11 | HTMLStyleElement::~HTMLStyleElement() 12 | { 13 | 14 | } 15 | 16 | HTMLStyleElement *HTMLStyleElement::create(emscripten::val v) 17 | { 18 | auto elem = new HTMLStyleElement(v); 19 | elem->autorelease(); 20 | return elem; 21 | } 22 | 23 | HTML5_PROPERTY_IMPL(HTMLStyleElement, std::string, media); 24 | HTML5_PROPERTY_IMPL(HTMLStyleElement, bool, scoped); 25 | HTML5_READONLY_PROPERTY_OBJECT_IMPL(HTMLStyleElement, StyleSheet, sheet); 26 | HTML5_PROPERTY_IMPL(HTMLStyleElement, std::string, type); -------------------------------------------------------------------------------- /src/html_video_element.cc: -------------------------------------------------------------------------------- 1 | #include "document.h" 2 | #include "html_video_element.h" 3 | 4 | USING_NAMESPACE_HTML5; 5 | 6 | HTMLVideoElement::HTMLVideoElement(emscripten::val v) : 7 | HTMLMediaElement(v) 8 | { 9 | 10 | } 11 | 12 | HTMLVideoElement::~HTMLVideoElement() 13 | { 14 | 15 | } 16 | 17 | HTMLVideoElement *HTMLVideoElement::create(emscripten::val v) 18 | { 19 | HTMLVideoElement *video = new HTMLVideoElement(v); 20 | video->autorelease(); 21 | return video; 22 | } 23 | 24 | HTMLVideoElement *HTMLVideoElement::create() 25 | { 26 | return dynamic_cast(Document::create()->createElement("video")); 27 | } 28 | 29 | HTML5_PROPERTY_IMPL(HTMLVideoElement, double, height); 30 | HTML5_PROPERTY_IMPL(HTMLVideoElement, std::string, poster); 31 | HTML5_PROPERTY_IMPL(HTMLVideoElement, double, videoHeight); 32 | HTML5_PROPERTY_IMPL(HTMLVideoElement, double, videoWidth); 33 | HTML5_PROPERTY_IMPL(HTMLVideoElement, double, width); 34 | -------------------------------------------------------------------------------- /src/idb_database.cc: -------------------------------------------------------------------------------- 1 | #include "idb_transaction.h" 2 | #include "idb_object_store.h" 3 | #include "idb_database.h" 4 | 5 | USING_NAMESPACE_HTML5; 6 | 7 | HTML5_BIND_CLASS(IDBDatabase); 8 | 9 | IDBDatabase::IDBDatabase(emscripten::val v) : 10 | EventTarget(v) 11 | { 12 | 13 | } 14 | 15 | IDBDatabase::~IDBDatabase() 16 | { 17 | 18 | } 19 | 20 | IDBDatabase *IDBDatabase::create(emscripten::val v) 21 | { 22 | auto db = new IDBDatabase(v); 23 | db->autorelease(); 24 | return db; 25 | } 26 | 27 | void IDBDatabase::close() 28 | { 29 | HTML5_CALL(this->v, close); 30 | } 31 | 32 | IDBObjectStore *IDBDatabase::createObjectStore(std::string name) 33 | { 34 | return IDBObjectStore::create(HTML5_CALLv(this->v, createObjectStore, name)); 35 | } 36 | 37 | void IDBDatabase::deleteObjectStore(std::string name) 38 | { 39 | HTML5_CALL(this->v, deleteObjectStore, name); 40 | } 41 | 42 | IDBTransaction *IDBDatabase::transaction(std::string storeName, IDBTransactionMode mode) 43 | { 44 | return IDBTransaction::create(HTML5_CALLv(this->v, transaction, storeName, mode)); 45 | } 46 | 47 | IDBTransaction *IDBDatabase::transaction(std::vector storeNames, IDBTransactionMode mode) 48 | { 49 | return IDBTransaction::create(HTML5_CALLv(this->v, transaction, toJSArray(storeNames), mode)); 50 | } 51 | 52 | HTML5_PROPERTY_IMPL(IDBDatabase, std::string, name); 53 | HTML5_EVENT_HANDLER_PROPERTY_IMPL(IDBDatabase, EventHandler *, onabort); 54 | HTML5_EVENT_HANDLER_PROPERTY_IMPL(IDBDatabase, EventHandler *, onerror); 55 | HTML5_EVENT_HANDLER_PROPERTY_IMPL(IDBDatabase, EventHandler *, onversionchange); 56 | HTML5_PROPERTY_IMPL(IDBDatabase, unsigned long long, version); 57 | -------------------------------------------------------------------------------- /src/idb_environment.cc: -------------------------------------------------------------------------------- 1 | #include "idb_factory.h" 2 | #include "idb_environment.h" 3 | 4 | USING_NAMESPACE_HTML5; 5 | 6 | IDBEnvironment::IDBEnvironment(emscripten::val v) : 7 | Object(v) 8 | { 9 | 10 | } 11 | 12 | IDBEnvironment::~IDBEnvironment() 13 | { 14 | 15 | } 16 | 17 | IDBEnvironment *IDBEnvironment::create(emscripten::val v) 18 | { 19 | auto env = new IDBEnvironment(v); 20 | env->autorelease(); 21 | return env; 22 | } 23 | 24 | HTML5_PROPERTY_OBJECT_IMPL(IDBEnvironment, IDBFactory, indexedDB); 25 | -------------------------------------------------------------------------------- /src/idb_factory.cc: -------------------------------------------------------------------------------- 1 | #include "idb_open_db_request.h" 2 | #include "idb_factory.h" 3 | 4 | USING_NAMESPACE_HTML5; 5 | 6 | IDBFactory::IDBFactory(emscripten::val v) : 7 | Object(v) 8 | { 9 | 10 | } 11 | 12 | IDBFactory::~IDBFactory() 13 | { 14 | 15 | } 16 | 17 | IDBFactory *IDBFactory::create(emscripten::val v) 18 | { 19 | auto factory = new IDBFactory(v); 20 | factory->autorelease(); 21 | return factory; 22 | } 23 | 24 | short IDBFactory::cmp(int a, int b) 25 | { 26 | return HTML5_CALLi(this->v, cmp, short, a, b); 27 | } 28 | 29 | IDBOpenDBRequest *IDBFactory::deleteDatabase(std::string name) 30 | { 31 | return IDBOpenDBRequest::create(HTML5_CALLv(this->v, deleteDatabase, name)); 32 | } 33 | 34 | IDBOpenDBRequest *IDBFactory::open(std::string name, unsigned long long version) 35 | { 36 | return IDBOpenDBRequest::create(HTML5_CALLv(this->v, open, name, version)); 37 | } 38 | -------------------------------------------------------------------------------- /src/idb_index.cc: -------------------------------------------------------------------------------- 1 | #include "idb_object_store.h" 2 | #include "idb_request.h" 3 | #include "idb_index.h" 4 | 5 | USING_NAMESPACE_HTML5; 6 | 7 | IDBIndex::IDBIndex(emscripten::val v) : 8 | Object(v) 9 | { 10 | 11 | } 12 | 13 | IDBIndex::~IDBIndex() 14 | { 15 | 16 | } 17 | 18 | IDBIndex *IDBIndex::create(emscripten::val v) 19 | { 20 | auto idx = new IDBIndex(v); 21 | idx->autorelease(); 22 | return idx; 23 | } 24 | 25 | IDBRequest *IDBIndex::count(int key) 26 | { 27 | return IDBRequest::create(HTML5_CALLv(this->v, count, key)); 28 | } 29 | 30 | IDBRequest *IDBIndex::get(int key) 31 | { 32 | return IDBRequest::create(HTML5_CALLv(this->v, get, key)); 33 | } 34 | 35 | IDBRequest *IDBIndex::getKey(int key) 36 | { 37 | return IDBRequest::create(HTML5_CALLv(this->v, getKey, key)); 38 | } 39 | 40 | HTML5_PROPERTY_IMPL(IDBIndex, std::string, keyPath); 41 | HTML5_PROPERTY_IMPL(IDBIndex, bool, multiEntry); 42 | HTML5_PROPERTY_IMPL(IDBIndex, std::string, name); 43 | HTML5_PROPERTY_OBJECT_IMPL(IDBIndex, IDBObjectStore, objectStore); 44 | HTML5_PROPERTY_IMPL(IDBIndex, bool, unique); 45 | -------------------------------------------------------------------------------- /src/idb_index_parameters.cc: -------------------------------------------------------------------------------- 1 | #include "idb_index_parameters.h" 2 | 3 | USING_NAMESPACE_HTML5; 4 | 5 | IDBIndexParameters::IDBIndexParameters(emscripten::val v) : 6 | Object(v) 7 | { 8 | 9 | } 10 | 11 | IDBIndexParameters::~IDBIndexParameters() 12 | { 13 | 14 | } 15 | 16 | IDBIndexParameters *IDBIndexParameters::create(emscripten::val v) 17 | { 18 | auto param = new IDBIndexParameters(v); 19 | param->autorelease(); 20 | return param; 21 | } 22 | 23 | HTML5_PROPERTY_IMPL(IDBIndexParameters, bool, multiEntry); 24 | HTML5_PROPERTY_IMPL(IDBIndexParameters, bool, unique); 25 | -------------------------------------------------------------------------------- /src/idb_object_store.cc: -------------------------------------------------------------------------------- 1 | #include "idb_transaction.h" 2 | #include "idb_request.h" 3 | #include "idb_index.h" 4 | #include "idb_object_store.h" 5 | 6 | USING_NAMESPACE_HTML5; 7 | 8 | IDBObjectStore::IDBObjectStore(emscripten::val v) : 9 | Object(v) 10 | { 11 | 12 | } 13 | 14 | IDBObjectStore::~IDBObjectStore() 15 | { 16 | 17 | } 18 | 19 | IDBObjectStore *IDBObjectStore::create(emscripten::val v) 20 | { 21 | auto store = new IDBObjectStore(v); 22 | store->autorelease(); 23 | return store; 24 | } 25 | 26 | IDBRequest *IDBObjectStore::add(int value, std::string key) 27 | { 28 | return IDBRequest::create(HTML5_CALLv(this->v, add, value, key)); 29 | } 30 | 31 | IDBRequest *IDBObjectStore::clear() 32 | { 33 | return IDBRequest::create(HTML5_CALLv(this->v, clear)); 34 | } 35 | 36 | IDBRequest *IDBObjectStore::count(int key) 37 | { 38 | return IDBRequest::create(HTML5_CALLv(this->v, count, key)); 39 | } 40 | 41 | IDBIndex *IDBObjectStore::createIndex(std::string name, std::string keyPath) 42 | { 43 | return IDBIndex::create(HTML5_CALLv(this->v, cleateIndex, name, keyPath)); 44 | } 45 | 46 | IDBIndex *IDBObjectStore::createIndex(std::string name, std::vector keyPath) 47 | { 48 | return IDBIndex::create(HTML5_CALLv(this->v, cleateIndex, name, toJSArray(keyPath))); 49 | } 50 | 51 | IDBRequest *IDBObjectStore::deleteWithKey(int key) 52 | { 53 | return IDBRequest::create(HTML5_CALLv(this->v, delete, key)); 54 | } 55 | 56 | void IDBObjectStore::deleteIndex(std::string indexName) 57 | { 58 | HTML5_CALL(this->v, deleteIndex, indexName); 59 | } 60 | 61 | IDBRequest *IDBObjectStore::get(int key) 62 | { 63 | return IDBRequest::create(HTML5_CALLv(this->v, get, key)); 64 | } 65 | 66 | IDBIndex *IDBObjectStore::index(std::string name) 67 | { 68 | return IDBIndex::create(HTML5_CALLv(this->v, index, name)); 69 | } 70 | 71 | IDBRequest *IDBObjectStore::put(int value, int key) 72 | { 73 | return IDBRequest::create(HTML5_CALLv(this->v, put, value, key)); 74 | } 75 | 76 | HTML5_PROPERTY_IMPL(IDBObjectStore, bool, autoIncrement); 77 | HTML5_PROPERTY_IMPL(IDBObjectStore, std::string, keyPath); 78 | HTML5_PROPERTY_IMPL(IDBObjectStore, std::string, name); 79 | HTML5_PROPERTY_OBJECT_IMPL(IDBObjectStore, IDBTransaction, transaction); 80 | -------------------------------------------------------------------------------- /src/idb_open_db_request.cc: -------------------------------------------------------------------------------- 1 | #include "event_handler.h" 2 | #include "idb_open_db_request.h" 3 | 4 | USING_NAMESPACE_HTML5; 5 | 6 | HTML5_BIND_CLASS(IDBOpenDBRequest); 7 | 8 | IDBOpenDBRequest::IDBOpenDBRequest(emscripten::val v) : 9 | IDBRequest(v) 10 | { 11 | 12 | } 13 | 14 | IDBOpenDBRequest::~IDBOpenDBRequest() 15 | { 16 | 17 | } 18 | 19 | IDBOpenDBRequest *IDBOpenDBRequest::create(emscripten::val v) 20 | { 21 | auto req = new IDBOpenDBRequest(v); 22 | req->autorelease(); 23 | return req; 24 | } 25 | 26 | HTML5_EVENT_HANDLER_PROPERTY_IMPL(IDBOpenDBRequest, EventHandler *, onblocked); 27 | HTML5_EVENT_HANDLER_PROPERTY_IMPL(IDBOpenDBRequest, EventHandler *, onupgradeneeded); 28 | -------------------------------------------------------------------------------- /src/idb_request.cc: -------------------------------------------------------------------------------- 1 | #include "dom_error.h" 2 | #include "idb_transaction.h" 3 | #include "idb_request.h" 4 | 5 | USING_NAMESPACE_HTML5; 6 | 7 | HTML5_BIND_CLASS(IDBRequest); 8 | 9 | IDBRequest::IDBRequest(emscripten::val v) : 10 | EventTarget(v) 11 | { 12 | 13 | } 14 | 15 | IDBRequest::~IDBRequest() 16 | { 17 | 18 | } 19 | 20 | IDBRequest *IDBRequest::create(emscripten::val v) 21 | { 22 | auto req = new IDBRequest(v); 23 | req->autorelease(); 24 | return req; 25 | } 26 | 27 | 28 | HTML5_PROPERTY_OBJECT_IMPL(IDBRequest, DOMError, error); 29 | HTML5_EVENT_HANDLER_PROPERTY_IMPL(IDBRequest, EventHandler *, onerror); 30 | HTML5_EVENT_HANDLER_PROPERTY_IMPL(IDBRequest, EventHandler *, onsuccess); 31 | HTML5_PROPERTY_OBJECT_IMPL(IDBRequest, IDBTransaction, transaction); 32 | -------------------------------------------------------------------------------- /src/idb_transaction.cc: -------------------------------------------------------------------------------- 1 | #include "dom_error.h" 2 | #include "idb_database.h" 3 | #include "idb_object_store.h" 4 | #include "idb_transaction.h" 5 | 6 | USING_NAMESPACE_HTML5; 7 | 8 | HTML5_BIND_CLASS(IDBTransaction); 9 | 10 | IDBTransaction::IDBTransaction(emscripten::val v) : 11 | EventTarget(v) 12 | { 13 | 14 | } 15 | 16 | IDBTransaction::~IDBTransaction() 17 | { 18 | 19 | } 20 | 21 | IDBTransaction *IDBTransaction::create(emscripten::val v) 22 | { 23 | auto tx = new IDBTransaction(v); 24 | tx->autorelease(); 25 | return tx; 26 | } 27 | 28 | void IDBTransaction::abort() 29 | { 30 | HTML5_CALL(this->v, abort); 31 | } 32 | 33 | IDBObjectStore *IDBTransaction::objectStore(std::string name) 34 | { 35 | return IDBObjectStore::create(HTML5_CALLv(this->v, objectStore, name)); 36 | } 37 | 38 | HTML5_PROPERTY_OBJECT_IMPL(IDBTransaction, IDBDatabase, db); 39 | HTML5_PROPERTY_OBJECT_IMPL(IDBTransaction, DOMError, error); 40 | HTML5_EVENT_HANDLER_PROPERTY_IMPL(IDBTransaction, EventHandler *, onabort); 41 | HTML5_EVENT_HANDLER_PROPERTY_IMPL(IDBTransaction, EventHandler *, oncomplete); 42 | HTML5_EVENT_HANDLER_PROPERTY_IMPL(IDBTransaction, EventHandler *, onerror); 43 | -------------------------------------------------------------------------------- /src/idb_version_change_event.cc: -------------------------------------------------------------------------------- 1 | #include "idb_version_change_event.h" 2 | 3 | USING_NAMESPACE_HTML5; 4 | 5 | IDBVersionChangeEvent::IDBVersionChangeEvent(emscripten::val v) : 6 | Event(v) 7 | { 8 | 9 | } 10 | 11 | IDBVersionChangeEvent::~IDBVersionChangeEvent() 12 | { 13 | 14 | } 15 | 16 | IDBVersionChangeEvent *IDBVersionChangeEvent::create(emscripten::val v) 17 | { 18 | auto version = new IDBVersionChangeEvent(v); 19 | version->autorelease(); 20 | return version; 21 | } 22 | 23 | HTML5_PROPERTY_IMPL(IDBVersionChangeEvent, unsigned long long, newVersion); 24 | HTML5_PROPERTY_IMPL(IDBVersionChangeEvent, unsigned long long, oldVersion); 25 | -------------------------------------------------------------------------------- /src/image_bitmap.cc: -------------------------------------------------------------------------------- 1 | #include "image_bitmap.h" 2 | 3 | USING_NAMESPACE_HTML5; 4 | 5 | ImageBitmap::ImageBitmap(emscripten::val v) : 6 | Object(v) 7 | { 8 | 9 | } 10 | 11 | ImageBitmap::~ImageBitmap() 12 | { 13 | 14 | } 15 | 16 | ImageBitmap *ImageBitmap::create(emscripten::val v) 17 | { 18 | auto bitmap = new ImageBitmap(v); 19 | bitmap->autorelease(); 20 | return bitmap; 21 | } 22 | 23 | HTML5_PROPERTY_IMPL(ImageBitmap, unsigned long, height); 24 | HTML5_PROPERTY_IMPL(ImageBitmap, unsigned long, width); 25 | -------------------------------------------------------------------------------- /src/image_data.cc: -------------------------------------------------------------------------------- 1 | #include "uint8_clamped_array.h" 2 | #include "image_data.h" 3 | 4 | USING_NAMESPACE_HTML5; 5 | 6 | ImageData::ImageData(emscripten::val v) : 7 | Object(v) 8 | { 9 | 10 | } 11 | 12 | ImageData::~ImageData() 13 | { 14 | 15 | } 16 | 17 | ImageData *ImageData::create(emscripten::val v) 18 | { 19 | auto imagedata = new ImageData(v); 20 | imagedata->autorelease(); 21 | return imagedata; 22 | } 23 | 24 | ImageData *ImageData::create(unsigned long sw, unsigned long sh) 25 | { 26 | return create(HTML5_NEW_PRIMITIVE_INSTANCE(ImageData, sw, sh)); 27 | } 28 | 29 | ImageData *ImageData::create(Uint8ClampedArray *data, unsigned long sw, unsigned long sh) 30 | { 31 | return create(HTML5_NEW_PRIMITIVE_INSTANCE(ImageData, data->v, sw, sh)); 32 | } 33 | 34 | HTML5_PROPERTY_OBJECT_IMPL(ImageData, Uint8ClampedArray, data); 35 | HTML5_PROPERTY_IMPL(ImageData, unsigned long, height); 36 | HTML5_PROPERTY_IMPL(ImageData, unsigned long, width); 37 | -------------------------------------------------------------------------------- /src/link_style.cc: -------------------------------------------------------------------------------- 1 | #include "link_style.h" 2 | 3 | USING_NAMESPACE_HTML5; 4 | 5 | LinkStyle::~LinkStyle() 6 | { 7 | 8 | } 9 | -------------------------------------------------------------------------------- /src/location.cc: -------------------------------------------------------------------------------- 1 | #include "location.h" 2 | 3 | USING_NAMESPACE_HTML5; 4 | 5 | Location::Location(emscripten::val v) : 6 | Object(v) 7 | { 8 | 9 | } 10 | 11 | Location::~Location() 12 | { 13 | 14 | } 15 | 16 | Location *Location::create(emscripten::val v) 17 | { 18 | auto location = new Location(v); 19 | location->autorelease(); 20 | return location; 21 | } 22 | 23 | void Location::assign(std::string url) 24 | { 25 | HTML5_CALL(this->v, assign, url); 26 | } 27 | 28 | void Location::reload() 29 | { 30 | HTML5_CALL(this->v, reload); 31 | } 32 | 33 | void Location::replace(std::string url) 34 | { 35 | HTML5_CALL(this->v, replace, url); 36 | } 37 | -------------------------------------------------------------------------------- /src/media_error.cc: -------------------------------------------------------------------------------- 1 | #include "media_error.h" 2 | 3 | USING_NAMESPACE_HTML5; 4 | 5 | MediaError::MediaError(emscripten::val v) : 6 | Object(v) 7 | { 8 | 9 | } 10 | 11 | MediaError::~MediaError() 12 | { 13 | 14 | } 15 | 16 | MediaError *MediaError::create(emscripten::val v) 17 | { 18 | MediaError *me = new MediaError(v); 19 | me->autorelease(); 20 | return me; 21 | } 22 | 23 | HTML5_PROPERTY_IMPL(MediaError, unsigned short, code); 24 | -------------------------------------------------------------------------------- /src/media_list.cc: -------------------------------------------------------------------------------- 1 | #include "media_list.h" 2 | 3 | USING_NAMESPACE_HTML5; 4 | 5 | MediaList::MediaList(emscripten::val v) : 6 | Object(v) 7 | { 8 | 9 | } 10 | 11 | MediaList::~MediaList() 12 | { 13 | 14 | } 15 | 16 | MediaList *MediaList::create(emscripten::val v) 17 | { 18 | MediaList *ml = new MediaList(v); 19 | ml->autorelease(); 20 | return ml; 21 | } 22 | 23 | void MediaList::appendMedium(std::string medium) 24 | { 25 | HTML5_CALL(this->v, appendMedium, medium); 26 | } 27 | 28 | void MediaList::deleteMedium(std::string medium) 29 | { 30 | HTML5_CALL(this->v, deleteMedium, medium); 31 | } 32 | 33 | std::string MediaList::item(unsigned long index) 34 | { 35 | return HTML5_CALLs(this->v, item, index); 36 | } 37 | 38 | HTML5_PROPERTY_IMPL(MediaList, unsigned long, length); 39 | HTML5_PROPERTY_IMPL(MediaList, std::string, mediaText); 40 | -------------------------------------------------------------------------------- /src/mime_type.cc: -------------------------------------------------------------------------------- 1 | #include "plugin.h" 2 | #include "mime_type.h" 3 | 4 | USING_NAMESPACE_HTML5; 5 | 6 | MimeType::MimeType(emscripten::val v) : 7 | Object(v) 8 | { 9 | 10 | } 11 | 12 | MimeType::~MimeType() 13 | { 14 | 15 | } 16 | 17 | MimeType *MimeType::create(emscripten::val v) 18 | { 19 | auto mimetype = new MimeType(v); 20 | mimetype->autorelease(); 21 | return mimetype; 22 | } 23 | 24 | HTML5_PROPERTY_IMPL(MimeType, std::string, description); 25 | HTML5_PROPERTY_OBJECT_IMPL(MimeType, Plugin, enabledPlugin); 26 | HTML5_PROPERTY_IMPL(MimeType, std::string, suffixes); 27 | HTML5_PROPERTY_IMPL(MimeType, std::string, type); 28 | -------------------------------------------------------------------------------- /src/mime_type_array.cc: -------------------------------------------------------------------------------- 1 | #include "mime_type.h" 2 | #include "mime_type_array.h" 3 | 4 | USING_NAMESPACE_HTML5; 5 | 6 | MimeTypeArray::MimeTypeArray(emscripten::val v) : 7 | Object(v) 8 | { 9 | 10 | } 11 | 12 | MimeTypeArray::~MimeTypeArray() 13 | { 14 | 15 | } 16 | 17 | MimeTypeArray *MimeTypeArray::create(emscripten::val v) 18 | { 19 | auto array = new MimeTypeArray(v); 20 | array->autorelease(); 21 | return array; 22 | } 23 | 24 | MimeType *MimeTypeArray::item(unsigned long index) 25 | { 26 | return MimeType::create(HTML5_CALLv(this->v, item, index)); 27 | } 28 | 29 | MimeType *MimeTypeArray::namedItem(std::string name) 30 | { 31 | return MimeType::create(HTML5_CALLv(this->v, namedItem, name)); 32 | } 33 | 34 | HTML5_PROPERTY_IMPL(MimeTypeArray, unsigned long, length); 35 | -------------------------------------------------------------------------------- /src/native_array.cc: -------------------------------------------------------------------------------- 1 | #include "libhtml5.h" 2 | #include "native_array.h" 3 | 4 | USING_NAMESPACE_HTML5; 5 | 6 | NativeArray::NativeArray() 7 | { 8 | 9 | } 10 | 11 | NativeArray::~NativeArray() 12 | { 13 | for (NativeObject *o : this->arr) { 14 | HTML5_RELEASE(o); 15 | } 16 | this->arr.clear(); 17 | } 18 | 19 | NativeArray *NativeArray::create() 20 | { 21 | NativeArray *arr = new NativeArray(); 22 | arr->autorelease(); 23 | return arr; 24 | } 25 | 26 | void NativeArray::add(NativeObject *o) 27 | { 28 | if (o->isAutoRelease()) { 29 | o->retain(); 30 | } 31 | this->arr.push_back(o); 32 | } 33 | -------------------------------------------------------------------------------- /src/native_object.cc: -------------------------------------------------------------------------------- 1 | #include "libhtml5.h" 2 | #include "native_object.h" 3 | #include "auto_release_pool.h" 4 | 5 | USING_NAMESPACE_HTML5; 6 | 7 | NativeObject::NativeObject() : 8 | _isAutoRelease(false), 9 | _refCount(0) 10 | { 11 | } 12 | 13 | NativeObject::~NativeObject() 14 | { 15 | 16 | } 17 | 18 | bool NativeObject::isAutoRelease() 19 | { 20 | return this->_isAutoRelease; 21 | } 22 | 23 | void NativeObject::autorelease() 24 | { 25 | this->_isAutoRelease = true; 26 | AutoReleasePool::sharedInstance()->addObject(this); 27 | } 28 | 29 | void NativeObject::release() 30 | { 31 | if (this->_refCount > 0) { 32 | this->_refCount--; 33 | } 34 | } 35 | 36 | void NativeObject::retain() 37 | { 38 | this->_refCount++; 39 | } 40 | 41 | unsigned int NativeObject::referenceCount() 42 | { 43 | return this->_refCount; 44 | } 45 | -------------------------------------------------------------------------------- /src/navigator.cc: -------------------------------------------------------------------------------- 1 | #include "mime_type_array.h" 2 | #include "plugin_array.h" 3 | #include "navigator.h" 4 | 5 | USING_NAMESPACE_HTML5; 6 | 7 | Navigator::Navigator(emscripten::val v) : 8 | Object(v) 9 | { 10 | 11 | } 12 | 13 | Navigator::~Navigator() 14 | { 15 | 16 | } 17 | 18 | Navigator *Navigator::create(emscripten::val v) 19 | { 20 | auto navigator = new Navigator(v); 21 | navigator->autorelease(); 22 | return navigator; 23 | } 24 | 25 | std::string Navigator::isContentHandlerRegistered(std::string mimeType, std::string url) 26 | { 27 | return HTML5_CALLs(this->v, isContentHandlerRegistered, mimeType, url); 28 | } 29 | 30 | std::string Navigator::isProtocolHandlerRegistered(std::string scheme, std::string url) 31 | { 32 | return HTML5_CALLs(this->v, isProtocolHandlerRegistered, scheme, url); 33 | } 34 | 35 | void Navigator::registerContentHandler(std::string mimeType, std::string url, std::string title) 36 | { 37 | HTML5_CALL(this->v, registerContentHandler, mimeType, url, title); 38 | } 39 | 40 | void Navigator::registerProtocolHandler(std::string scheme, std::string url, std::string title) 41 | { 42 | HTML5_CALL(this->v, registerProtocolHandler, scheme, url, title); 43 | } 44 | 45 | bool Navigator::taintEnabled() 46 | { 47 | return HTML5_CALLb(this->v, taintEnabled); 48 | } 49 | 50 | void Navigator::unregisterContentHandler(std::string mimeType, std::string url) 51 | { 52 | HTML5_CALL(this->v, unregisterContentHandler, mimeType, url); 53 | } 54 | 55 | void Navigator::unregisterProtocolHandler(std::string scheme, std::string url) 56 | { 57 | HTML5_CALL(this->v, unregisterProtocolHandler, scheme, url); 58 | } 59 | 60 | void Navigator::yieldForStorageUpdates() 61 | { 62 | HTML5_CALL(this->v, yieldForStorageUpdates); 63 | } 64 | 65 | HTML5_PROPERTY_IMPL(Navigator, std::string, appCodeName); 66 | HTML5_PROPERTY_IMPL(Navigator, std::string, appName); 67 | HTML5_PROPERTY_IMPL(Navigator, std::string, appVersion); 68 | HTML5_PROPERTY_IMPL(Navigator, bool, cookieEnabled); 69 | HTML5_PROPERTY_IMPL(Navigator, bool, javaEnabled); 70 | HTML5_PROPERTY_IMPL(Navigator, std::string, language); 71 | HTML5_PROPERTY_OBJECT_IMPL(Navigator, MimeTypeArray, mimeTypes); 72 | HTML5_PROPERTY_IMPL(Navigator, bool, onLine); 73 | HTML5_PROPERTY_IMPL(Navigator, std::string, platform); 74 | HTML5_PROPERTY_OBJECT_IMPL(Navigator, PluginArray, plugins); 75 | HTML5_PROPERTY_IMPL(Navigator, std::string, product); 76 | HTML5_PROPERTY_IMPL(Navigator, std::string, userAgent); 77 | -------------------------------------------------------------------------------- /src/node_filter.cc: -------------------------------------------------------------------------------- 1 | #include "node.h" 2 | #include "node_filter.h" 3 | 4 | USING_NAMESPACE_HTML5; 5 | 6 | NodeFilter::NodeFilter(emscripten::val v) : 7 | Object(v) 8 | { 9 | 10 | } 11 | 12 | NodeFilter::~NodeFilter() 13 | { 14 | 15 | } 16 | 17 | NodeFilter *NodeFilter::create(emscripten::val v) 18 | { 19 | auto filter = new NodeFilter(v); 20 | filter->autorelease(); 21 | return filter; 22 | } 23 | 24 | unsigned short NodeFilter::acceptNode(Node *node) 25 | { 26 | return HTML5_CALLi(this->v, acceptNode, unsigned short, node->v); 27 | } 28 | -------------------------------------------------------------------------------- /src/node_iterator.cc: -------------------------------------------------------------------------------- 1 | #include "node.h" 2 | #include "node_filter.h" 3 | #include "node_iterator.h" 4 | 5 | USING_NAMESPACE_HTML5; 6 | 7 | NodeIterator::NodeIterator(emscripten::val v) : 8 | Object(v) 9 | { 10 | 11 | } 12 | 13 | NodeIterator::~NodeIterator() 14 | { 15 | 16 | } 17 | 18 | NodeIterator *NodeIterator::create(emscripten::val v) 19 | { 20 | auto iter = new NodeIterator(v); 21 | iter->autorelease(); 22 | return iter; 23 | } 24 | 25 | void NodeIterator::detach() 26 | { 27 | HTML5_CALL(this->v, detach); 28 | } 29 | 30 | Node *NodeIterator::nextNode() 31 | { 32 | return Node::create(HTML5_CALLv(this->v, nextNode)); 33 | } 34 | 35 | Node *NodeIterator::previousNode() 36 | { 37 | return Node::create(HTML5_CALLv(this->v, previousNode)); 38 | } 39 | 40 | HTML5_PROPERTY_OBJECT_IMPL(NodeIterator, NodeFilter, filter); 41 | HTML5_PROPERTY_IMPL(NodeIterator, bool, pointerBeforeReferenceNode); 42 | HTML5_PROPERTY_OBJECT_IMPL(NodeIterator, Node, referenceNode); 43 | HTML5_PROPERTY_OBJECT_IMPL(NodeIterator, Node, root); 44 | HTML5_PROPERTY_IMPL(NodeIterator, unsigned long, whatsToShow); 45 | -------------------------------------------------------------------------------- /src/node_list.cc: -------------------------------------------------------------------------------- 1 | #include "node.h" 2 | #include "node_list.h" 3 | 4 | USING_NAMESPACE_HTML5; 5 | 6 | NodeList::NodeList(emscripten::val v) : 7 | Object(v) 8 | { 9 | 10 | } 11 | 12 | NodeList::~NodeList() 13 | { 14 | 15 | 16 | } 17 | 18 | NodeList *NodeList::create(emscripten::val v) 19 | { 20 | NodeList *nl = new NodeList(v); 21 | nl->autorelease(); 22 | return nl; 23 | } 24 | 25 | Node *NodeList::item(unsigned long index) 26 | { 27 | return Node::create(HTML5_CALLv(this->v, item, index)); 28 | } 29 | 30 | HTML5_PROPERTY_IMPL(NodeList, unsigned long, length); 31 | -------------------------------------------------------------------------------- /src/path2d.cc: -------------------------------------------------------------------------------- 1 | #include "svgmatrix.h" 2 | #include "path2d.h" 3 | 4 | USING_NAMESPACE_HTML5; 5 | 6 | Path2D::Path2D(emscripten::val v) : 7 | Object(v) 8 | { 9 | 10 | } 11 | 12 | Path2D::~Path2D() 13 | { 14 | 15 | } 16 | 17 | Path2D *Path2D::create(emscripten::val v) 18 | { 19 | Path2D *p = new Path2D(v); 20 | p->autorelease(); 21 | return p; 22 | } 23 | 24 | void Path2D::addPath(Path2D *path) 25 | { 26 | HTML5_CALL(this->v, addPath, path->v); 27 | } 28 | 29 | void Path2D::addPath(Path2D *path, SVGMatrix *transformation) 30 | { 31 | HTML5_CALL(this->v, addPath, path->v, transformation->v); 32 | } 33 | 34 | void Path2D::arc(double x, double y, double radius, double startAngle, double endAngle, bool anticlockwise) 35 | { 36 | HTML5_CALL(this->v, arc, x, y, radius, startAngle, endAngle, anticlockwise); 37 | } 38 | 39 | void Path2D::arcTo(double x1, double y1, double x2, double y2, double radius) 40 | { 41 | HTML5_CALL(this->v, arcTo, x1, y1, x2, y2, radius); 42 | } 43 | 44 | void Path2D::bezierCurveTo(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y) 45 | { 46 | HTML5_CALL(this->v, cp1x, cp1y, cp2x, cp2y, x, y); 47 | } 48 | 49 | void Path2D::closePath() 50 | { 51 | HTML5_CALL(this->v, closePath); 52 | } 53 | 54 | void Path2D::ellipse(double x, double y, double radiusX, double radiusY, double rotation, double startAngle, double endAngle, bool anticlockwise) 55 | { 56 | HTML5_CALL(this->v, ellipse, x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise); 57 | } 58 | 59 | void Path2D::lineTo(double x, double y) 60 | { 61 | HTML5_CALL(this->v, lineTo, x, y); 62 | } 63 | 64 | void Path2D::moveTo(double x, double y) 65 | { 66 | HTML5_CALL(this->v, moveTo, x, y); 67 | } 68 | 69 | void Path2D::quadraticCurveTo(double cpx, double cpy, double x, double y) 70 | { 71 | HTML5_CALL(this->v, quadraticCurveTo, cpx, cpy, x, y); 72 | } 73 | 74 | void Path2D::rect(double x, double y, double w, double h) 75 | { 76 | HTML5_CALL(this->v, rect, x, y, w, h); 77 | } 78 | -------------------------------------------------------------------------------- /src/performance_entry.cc: -------------------------------------------------------------------------------- 1 | #include "performance_entry.h" 2 | 3 | USING_NAMESPACE_HTML5; 4 | 5 | PerformanceEntry::PerformanceEntry(emscripten::val v) : 6 | Object(v) 7 | { 8 | 9 | } 10 | 11 | PerformanceEntry::~PerformanceEntry() 12 | { 13 | 14 | } 15 | 16 | PerformanceEntry *PerformanceEntry::create(emscripten::val v) 17 | { 18 | auto entry = new PerformanceEntry(v); 19 | entry->autorelease(); 20 | return entry; 21 | } 22 | 23 | HTML5_READONLY_PROPERTY_IMPL(PerformanceEntry, std::string, name); 24 | HTML5_READONLY_PROPERTY_IMPL(PerformanceEntry, std::string, entryType); 25 | HTML5_READONLY_PROPERTY_IMPL(PerformanceEntry, double, startTime); 26 | HTML5_READONLY_PROPERTY_IMPL(PerformanceEntry, double, duration); 27 | -------------------------------------------------------------------------------- /src/performance_navigation.cc: -------------------------------------------------------------------------------- 1 | #include "performance_navigation.h" 2 | 3 | USING_NAMESPACE_HTML5; 4 | 5 | PerformanceNavigation::PerformanceNavigation(emscripten::val v) : 6 | Object(v) 7 | { 8 | 9 | } 10 | 11 | PerformanceNavigation::~PerformanceNavigation() 12 | { 13 | 14 | } 15 | 16 | PerformanceNavigation *PerformanceNavigation::create(emscripten::val v) 17 | { 18 | auto navi = new PerformanceNavigation(v); 19 | navi->autorelease(); 20 | return navi; 21 | } 22 | 23 | HTML5_READONLY_PROPERTY_IMPL(PerformanceNavigation, unsigned short, type); 24 | HTML5_READONLY_PROPERTY_IMPL(PerformanceNavigation, unsigned short, redirectCount); 25 | -------------------------------------------------------------------------------- /src/performance_timing.cc: -------------------------------------------------------------------------------- 1 | #include "performance_timing.h" 2 | 3 | USING_NAMESPACE_HTML5; 4 | 5 | PerformanceTiming::PerformanceTiming(emscripten::val v) : 6 | Object(v) 7 | { 8 | 9 | } 10 | 11 | PerformanceTiming::~PerformanceTiming() 12 | { 13 | 14 | } 15 | 16 | PerformanceTiming *PerformanceTiming::create(emscripten::val v) 17 | { 18 | auto timing = new PerformanceTiming(v); 19 | timing->autorelease(); 20 | return timing; 21 | } 22 | 23 | HTML5_READONLY_PROPERTY_IMPL(PerformanceTiming, unsigned long long, navigationStart); 24 | HTML5_READONLY_PROPERTY_IMPL(PerformanceTiming, unsigned long long, unloadEventStart); 25 | HTML5_READONLY_PROPERTY_IMPL(PerformanceTiming, unsigned long long, unloadEventEnd); 26 | HTML5_READONLY_PROPERTY_IMPL(PerformanceTiming, unsigned long long, redirectStart); 27 | HTML5_READONLY_PROPERTY_IMPL(PerformanceTiming, unsigned long long, redirectEnd); 28 | HTML5_READONLY_PROPERTY_IMPL(PerformanceTiming, unsigned long long, fetchStart); 29 | HTML5_READONLY_PROPERTY_IMPL(PerformanceTiming, unsigned long long, domainLookupStart); 30 | HTML5_READONLY_PROPERTY_IMPL(PerformanceTiming, unsigned long long, domainLookupEnd); 31 | HTML5_READONLY_PROPERTY_IMPL(PerformanceTiming, unsigned long long, connectStart); 32 | HTML5_READONLY_PROPERTY_IMPL(PerformanceTiming, unsigned long long, connectEnd); 33 | HTML5_READONLY_PROPERTY_IMPL(PerformanceTiming, unsigned long long, secureConnectionStart); 34 | HTML5_READONLY_PROPERTY_IMPL(PerformanceTiming, unsigned long long, requestStart); 35 | HTML5_READONLY_PROPERTY_IMPL(PerformanceTiming, unsigned long long, responseStart); 36 | HTML5_READONLY_PROPERTY_IMPL(PerformanceTiming, unsigned long long, responseEnd); 37 | HTML5_READONLY_PROPERTY_IMPL(PerformanceTiming, unsigned long long, domLoading); 38 | HTML5_READONLY_PROPERTY_IMPL(PerformanceTiming, unsigned long long, domInteractive); 39 | HTML5_READONLY_PROPERTY_IMPL(PerformanceTiming, unsigned long long, domContentLoadedEventStart); 40 | HTML5_READONLY_PROPERTY_IMPL(PerformanceTiming, unsigned long long, domContentLoadedEventEnd); 41 | HTML5_READONLY_PROPERTY_IMPL(PerformanceTiming, unsigned long long, domComplete); 42 | HTML5_READONLY_PROPERTY_IMPL(PerformanceTiming, unsigned long long, loadEventStart); 43 | HTML5_READONLY_PROPERTY_IMPL(PerformanceTiming, unsigned long long, loadEventEnd); 44 | -------------------------------------------------------------------------------- /src/plugin.cc: -------------------------------------------------------------------------------- 1 | #include "mime_type.h" 2 | #include "plugin.h" 3 | 4 | USING_NAMESPACE_HTML5; 5 | 6 | Plugin::Plugin(emscripten::val v) : 7 | Object(v) 8 | { 9 | 10 | } 11 | 12 | Plugin::~Plugin() 13 | { 14 | 15 | } 16 | 17 | Plugin *Plugin::create(emscripten::val v) 18 | { 19 | auto plugin = new Plugin(v); 20 | plugin->autorelease(); 21 | return plugin; 22 | } 23 | 24 | MimeType *Plugin::item(unsigned long index) 25 | { 26 | return MimeType::create(HTML5_CALLv(this->v, item, index)); 27 | } 28 | 29 | MimeType *Plugin::namedItem(std::string name) 30 | { 31 | return MimeType::create(HTML5_CALLv(this->v, namedImte, name)); 32 | } 33 | -------------------------------------------------------------------------------- /src/plugin_array.cc: -------------------------------------------------------------------------------- 1 | #include "plugin.h" 2 | #include "plugin_array.h" 3 | 4 | USING_NAMESPACE_HTML5; 5 | 6 | PluginArray::PluginArray(emscripten::val v) : 7 | Object(v) 8 | { 9 | 10 | } 11 | 12 | PluginArray::~PluginArray() 13 | { 14 | 15 | } 16 | 17 | PluginArray *PluginArray::create(emscripten::val v) 18 | { 19 | auto array = new PluginArray(v); 20 | array->autorelease(); 21 | return array; 22 | } 23 | 24 | Plugin *PluginArray::item(unsigned long index) 25 | { 26 | return Plugin::create(HTML5_CALLv(this->v, item, index)); 27 | } 28 | 29 | Plugin *PluginArray::namedItem(std::string name) 30 | { 31 | return Plugin::create(HTML5_CALLv(this->v, namedItem, name)); 32 | } 33 | 34 | void PluginArray::refresh(bool reload) 35 | { 36 | HTML5_CALL(this->v, refresh, reload); 37 | } 38 | 39 | HTML5_PROPERTY_IMPL(PluginArray, unsigned long, length); 40 | -------------------------------------------------------------------------------- /src/processing_instruction.cc: -------------------------------------------------------------------------------- 1 | #include "style_sheet.h" 2 | #include "processing_instruction.h" 3 | 4 | USING_NAMESPACE_HTML5; 5 | 6 | ProcessingInstruction::ProcessingInstruction(emscripten::val v) : 7 | CharacterData(v) 8 | { 9 | 10 | } 11 | 12 | ProcessingInstruction::~ProcessingInstruction() 13 | { 14 | 15 | } 16 | 17 | ProcessingInstruction *ProcessingInstruction::create(emscripten::val v) 18 | { 19 | auto inst = new ProcessingInstruction(v); 20 | inst->autorelease(); 21 | return inst; 22 | } 23 | 24 | HTML5_PROPERTY_OBJECT_IMPL(ProcessingInstruction, StyleSheet, sheet); 25 | HTML5_PROPERTY_IMPL(ProcessingInstruction, std::string, target); 26 | -------------------------------------------------------------------------------- /src/regexp.cc: -------------------------------------------------------------------------------- 1 | #include "libhtml5.h" 2 | #include "html5_regexp.h" 3 | 4 | USING_NAMESPACE_HTML5; 5 | 6 | regexp::regexp(const char *pattern) : 7 | Object(HTML5_NEW_PRIMITIVE_INSTANCE(RegExp, std::string(pattern))) 8 | { 9 | 10 | } 11 | 12 | regexp::regexp(const char *pattern, const char *flags) : 13 | Object(HTML5_NEW_PRIMITIVE_INSTANCE(RegExp, std::string(pattern), std::string(flags))) 14 | { 15 | 16 | } 17 | 18 | regexp::regexp(const std::string &pattern) : 19 | Object(HTML5_NEW_PRIMITIVE_INSTANCE(RegExp, pattern)) 20 | { 21 | 22 | } 23 | 24 | regexp::regexp(const std::string &pattern, const std::string &flags) : 25 | Object(HTML5_NEW_PRIMITIVE_INSTANCE(RegExp, pattern, flags)) 26 | { 27 | 28 | } 29 | 30 | regexp::regexp(emscripten::val v) : 31 | Object(v) 32 | { 33 | 34 | } 35 | 36 | regexp::~regexp() 37 | { 38 | 39 | } 40 | 41 | regexp& regexp::operator=(const char *str) 42 | { 43 | this->v = HTML5_NEW_PRIMITIVE_INSTANCE(RegExp, std::string(str)); 44 | return *this; 45 | } 46 | 47 | regexp& regexp::operator=(const std::string& s) 48 | { 49 | this->v = HTML5_NEW_PRIMITIVE_INSTANCE(RegExp, s); 50 | return *this; 51 | } 52 | 53 | regexp *regexp::create(emscripten::val v) 54 | { 55 | auto re = new regexp(v); 56 | re->autorelease(); 57 | return re; 58 | } 59 | 60 | regexp *regexp::create(std::string pattern, std::string flags) 61 | { 62 | return create(HTML5_NEW_PRIMITIVE_INSTANCE(RegExp, pattern, flags)); 63 | } 64 | 65 | bool regexp::test(std::string s) 66 | { 67 | return HTML5_CALLb(this->v, test, s); 68 | } 69 | 70 | std::vector regexp::exec(const std::string &s) 71 | { 72 | auto v = HTML5_CALLv(this->v, exec, s); 73 | if (v.isNull()) { 74 | return std::vector(); 75 | } 76 | return toArray(v); 77 | } 78 | 79 | HTML5_PROPERTY_IMPL(regexp, bool, global); 80 | HTML5_PROPERTY_IMPL(regexp, bool, ignoreCase); 81 | HTML5_PROPERTY_IMPL(regexp, int, lastIndex); 82 | HTML5_PROPERTY_IMPL(regexp, bool, multiline); 83 | HTML5_PROPERTY_IMPL(regexp, std::string, source); 84 | -------------------------------------------------------------------------------- /src/rendering_context.cc: -------------------------------------------------------------------------------- 1 | #include "rendering_context.h" 2 | #include 3 | #include 4 | #include "canvas_rendering_context_2d.h" 5 | #include "webgl_rendering_context.h" 6 | 7 | USING_NAMESPACE_HTML5; 8 | 9 | HTML5_CLASS_FACTORY(RenderingContext) { 10 | HTML5_SUBCLASS_FACTORY(CanvasRenderingContext2D), 11 | HTML5_SUBCLASS_FACTORY(WebGLRenderingContext), 12 | }; 13 | 14 | HTML5_CREATE_IMPL(RenderingContext); 15 | 16 | RenderingContext::RenderingContext(emscripten::val v) : 17 | Object(v) 18 | { 19 | 20 | } 21 | 22 | RenderingContext::~RenderingContext() 23 | { 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/response.cc: -------------------------------------------------------------------------------- 1 | #include "response.h" 2 | #include "promise.h" 3 | 4 | USING_NAMESPACE_HTML5; 5 | 6 | Response::Response(emscripten::val v) : 7 | Object(v) 8 | { 9 | } 10 | 11 | Response::~Response() 12 | { 13 | } 14 | 15 | Response *Response::create(emscripten::val v) 16 | { 17 | auto response = new Response(v); 18 | response->autorelease(); 19 | return response; 20 | } 21 | 22 | Response *Response::clone() 23 | { 24 | return Response::create(HTML5_CALLv(this->v, clone)); 25 | } 26 | 27 | Response *Response::error() 28 | { 29 | return Response::create(HTML5_CALLv(this->v, error)); 30 | } 31 | 32 | Response *Response::redirect(const std::string &url, int status) 33 | { 34 | return Response::create(HTML5_CALLv(this->v, redirect, url, status)); 35 | } 36 | 37 | Promise *Response::arrayBuffer() 38 | { 39 | return Promise::create(HTML5_CALLv(this->v, arrayBuffer)); 40 | } 41 | 42 | Promise *Response::blob() 43 | { 44 | return Promise::create(HTML5_CALLv(this->v, blob)); 45 | } 46 | 47 | Promise *Response::formData() 48 | { 49 | return Promise::create(HTML5_CALLv(this->v, formData)); 50 | } 51 | 52 | Promise *Response::json() 53 | { 54 | return Promise::create(HTML5_CALLv(this->v, json)); 55 | } 56 | 57 | Promise *Response::text() 58 | { 59 | return Promise::create(HTML5_CALLv(this->v, text)); 60 | } 61 | 62 | //HTML5_READONLY_PROPERTY_OBJECT_IMPL(Response, Headers, headers); 63 | HTML5_READONLY_PROPERTY_IMPL(Response, bool, ok); 64 | HTML5_READONLY_PROPERTY_IMPL(Response, bool, redirected); 65 | HTML5_READONLY_PROPERTY_IMPL(Response, int, status); 66 | HTML5_READONLY_PROPERTY_IMPL(Response, std::string, type); 67 | HTML5_READONLY_PROPERTY_IMPL(Response, std::string, url); 68 | HTML5_PROPERTY_IMPL(Response, bool, useFinalURL); 69 | //HTML5_READONLY_PROPERTY_OBJECT_IMPL(Response, ReadableStream, body); 70 | HTML5_READONLY_PROPERTY_IMPL(Response, bool, bodyUsed); -------------------------------------------------------------------------------- /src/storage.cc: -------------------------------------------------------------------------------- 1 | #include "storage.h" 2 | 3 | USING_NAMESPACE_HTML5; 4 | 5 | Storage::Storage(emscripten::val v) : 6 | Object(v) 7 | { 8 | 9 | } 10 | 11 | Storage::~Storage() 12 | { 13 | 14 | } 15 | 16 | Storage *Storage::create(emscripten::val v) 17 | { 18 | auto storage = new Storage(v); 19 | storage->autorelease(); 20 | return storage; 21 | } 22 | 23 | void Storage::clear() 24 | { 25 | HTML5_CALL(this->v, clear); 26 | } 27 | 28 | std::string Storage::getItem(std::string key) 29 | { 30 | return HTML5_CALLs(this->v, getItem, key); 31 | } 32 | 33 | std::string Storage::key(unsigned long index) 34 | { 35 | return HTML5_CALLs(this->v, key, index); 36 | } 37 | 38 | void Storage::removeItem(std::string key) 39 | { 40 | HTML5_CALL(this->v, removeItem, key); 41 | } 42 | 43 | void Storage::setItem(std::string key, std::string value) 44 | { 45 | HTML5_CALL(this->v, setItem, key, value); 46 | } 47 | 48 | HTML5_PROPERTY_IMPL(Storage, unsigned long, length); 49 | -------------------------------------------------------------------------------- /src/style_sheet.cc: -------------------------------------------------------------------------------- 1 | #include "media_list.h" 2 | #include "element.h" 3 | #include "style_sheet.h" 4 | #include "css_style_sheet.h" 5 | 6 | USING_NAMESPACE_HTML5; 7 | 8 | HTML5_CLASS_FACTORY(StyleSheet) { 9 | HTML5_SUBCLASS_FACTORY(CSSStyleSheet), 10 | }; 11 | 12 | HTML5_CREATE_IMPL(StyleSheet); 13 | 14 | StyleSheet::StyleSheet(emscripten::val v) : 15 | Object(v) 16 | { 17 | 18 | } 19 | 20 | StyleSheet::~StyleSheet() 21 | { 22 | 23 | } 24 | 25 | HTML5_PROPERTY_IMPL(StyleSheet, bool, disabled); 26 | HTML5_PROPERTY_IMPL(StyleSheet, std::string, href); 27 | HTML5_PROPERTY_OBJECT_IMPL(StyleSheet, MediaList, media); 28 | HTML5_PROPERTY_OBJECT_IMPL(StyleSheet, Element, ownerNode); 29 | HTML5_PROPERTY_OBJECT_IMPL(StyleSheet, StyleSheet, parentStyleSheet); 30 | HTML5_PROPERTY_IMPL(StyleSheet, std::string, title); 31 | HTML5_PROPERTY_IMPL(StyleSheet, std::string, type); 32 | -------------------------------------------------------------------------------- /src/style_sheet_list.cc: -------------------------------------------------------------------------------- 1 | #include "style_sheet.h" 2 | #include "style_sheet_list.h" 3 | 4 | USING_NAMESPACE_HTML5; 5 | 6 | StyleSheetList::StyleSheetList(emscripten::val v) : 7 | Object(v) 8 | { 9 | 10 | } 11 | 12 | StyleSheetList::~StyleSheetList() 13 | { 14 | 15 | } 16 | 17 | StyleSheetList *StyleSheetList::create(emscripten::val v) 18 | { 19 | auto list = new StyleSheetList(v); 20 | list->autorelease(); 21 | return list; 22 | } 23 | 24 | StyleSheet *StyleSheetList::item(unsigned long index) 25 | { 26 | return StyleSheet::create(HTML5_CALLv(this->v, item, index)); 27 | } 28 | 29 | HTML5_PROPERTY_IMPL(StyleSheetList, unsigned long, length); 30 | -------------------------------------------------------------------------------- /src/svgmatrix.cc: -------------------------------------------------------------------------------- 1 | #include "svgmatrix.h" 2 | 3 | USING_NAMESPACE_HTML5; 4 | 5 | SVGMatrix::SVGMatrix(emscripten::val v) : 6 | Object(v) 7 | { 8 | 9 | } 10 | 11 | SVGMatrix::~SVGMatrix() 12 | { 13 | 14 | } 15 | 16 | SVGMatrix *SVGMatrix::create(emscripten::val v) 17 | { 18 | SVGMatrix *mat = new SVGMatrix(v); 19 | mat->autorelease(); 20 | return mat; 21 | } 22 | 23 | SVGMatrix *SVGMatrix::flipX() 24 | { 25 | return SVGMatrix::create(HTML5_CALLv(this->v, flipX)); 26 | } 27 | 28 | SVGMatrix *SVGMatrix::flipY() 29 | { 30 | return SVGMatrix::create(HTML5_CALLv(this->v, flipY)); 31 | } 32 | 33 | SVGMatrix *SVGMatrix::inverse() 34 | { 35 | return SVGMatrix::create(HTML5_CALLv(this->v, inverse)); 36 | } 37 | 38 | SVGMatrix *SVGMatrix::multiply(SVGMatrix *secondMatrix) 39 | { 40 | return SVGMatrix::create(HTML5_CALLv(this->v, multiply, secondMatrix->v)); 41 | } 42 | 43 | SVGMatrix *SVGMatrix::rotate(double angle) 44 | { 45 | return SVGMatrix::create(HTML5_CALLv(this->v, rotate, angle)); 46 | } 47 | 48 | SVGMatrix *SVGMatrix::rotateFromVector(double x, double y) 49 | { 50 | return SVGMatrix::create(HTML5_CALLv(this->v, rotateFromVector, x, y)); 51 | } 52 | 53 | SVGMatrix *SVGMatrix::scale(double scaleFactor) 54 | { 55 | return SVGMatrix::create(HTML5_CALLv(this->v, scale, scaleFactor)); 56 | } 57 | 58 | SVGMatrix *SVGMatrix::scaleNonUniform(double scaleFactorX, double scaleFactorY) 59 | { 60 | return SVGMatrix::create(HTML5_CALLv(this->v, scaleNonUniform, scaleFactorX, scaleFactorY)); 61 | } 62 | 63 | SVGMatrix *SVGMatrix::skewX(double angle) 64 | { 65 | return SVGMatrix::create(HTML5_CALLv(this->v, skewX, angle)); 66 | } 67 | 68 | SVGMatrix *SVGMatrix::skewY(double angle) 69 | { 70 | return SVGMatrix::create(HTML5_CALLv(this->v, skewY, angle)); 71 | } 72 | 73 | SVGMatrix *SVGMatrix::translate(double x, double y) 74 | { 75 | return SVGMatrix::create(HTML5_CALLv(this->v, translate, x, y)); 76 | } 77 | 78 | HTML5_PROPERTY_IMPL(SVGMatrix, double, a); 79 | HTML5_PROPERTY_IMPL(SVGMatrix, double, b); 80 | HTML5_PROPERTY_IMPL(SVGMatrix, double, c); 81 | HTML5_PROPERTY_IMPL(SVGMatrix, double, d); 82 | HTML5_PROPERTY_IMPL(SVGMatrix, double, e); 83 | HTML5_PROPERTY_IMPL(SVGMatrix, double, f); 84 | -------------------------------------------------------------------------------- /src/text.cc: -------------------------------------------------------------------------------- 1 | #include "text.h" 2 | 3 | USING_NAMESPACE_HTML5; 4 | 5 | Text::Text(emscripten::val v) : 6 | CharacterData(v) 7 | { 8 | 9 | } 10 | 11 | Text::~Text() 12 | { 13 | 14 | } 15 | 16 | Text *Text::create(emscripten::val v) 17 | { 18 | Text *text = new Text(v); 19 | text->autorelease(); 20 | return text; 21 | } 22 | 23 | Text *Text::splitText(unsigned long offset) 24 | { 25 | return Text::create(HTML5_CALLv(this->v, splitText, offset)); 26 | } 27 | 28 | HTML5_PROPERTY_IMPL(Text, std::string, wholeText); 29 | -------------------------------------------------------------------------------- /src/text_metrics.cc: -------------------------------------------------------------------------------- 1 | #include "text_metrics.h" 2 | 3 | USING_NAMESPACE_HTML5; 4 | 5 | TextMetrics::TextMetrics(emscripten::val v) : 6 | Object(v) 7 | { 8 | 9 | } 10 | 11 | TextMetrics::~TextMetrics() 12 | { 13 | 14 | } 15 | 16 | TextMetrics *TextMetrics::create(emscripten::val v) 17 | { 18 | TextMetrics *tm = new TextMetrics(v); 19 | tm->autorelease(); 20 | return tm; 21 | } 22 | 23 | HTML5_PROPERTY_IMPL(TextMetrics, double, actualBoundingBoxAscent); 24 | HTML5_PROPERTY_IMPL(TextMetrics, double, actualBoundingBoxDescent); 25 | HTML5_PROPERTY_IMPL(TextMetrics, double, actualBoundingBoxLeft); 26 | HTML5_PROPERTY_IMPL(TextMetrics, double, actualBoundingBoxRight); 27 | HTML5_PROPERTY_IMPL(TextMetrics, double, alphabeticBaseline); 28 | HTML5_PROPERTY_IMPL(TextMetrics, double, emHeightAscent); 29 | HTML5_PROPERTY_IMPL(TextMetrics, double, emHeightDescent); 30 | HTML5_PROPERTY_IMPL(TextMetrics, double, fontBoundingBoxAscent); 31 | HTML5_PROPERTY_IMPL(TextMetrics, double, fontBoundingBoxDescent); 32 | HTML5_PROPERTY_IMPL(TextMetrics, double, hangingBaseline); 33 | HTML5_PROPERTY_IMPL(TextMetrics, double, ideographicBaseline); 34 | HTML5_PROPERTY_IMPL(TextMetrics, double, width); 35 | -------------------------------------------------------------------------------- /src/text_track_cue.cc: -------------------------------------------------------------------------------- 1 | #include "text_track.h" 2 | #include "text_track_cue.h" 3 | 4 | USING_NAMESPACE_HTML5; 5 | 6 | HTML5_BIND_CLASS(TextTrackCue); 7 | 8 | TextTrackCue::TextTrackCue(emscripten::val v) : 9 | EventTarget(v) 10 | { 11 | 12 | } 13 | 14 | TextTrackCue::~TextTrackCue() 15 | { 16 | 17 | } 18 | 19 | TextTrackCue *TextTrackCue::create(emscripten::val v) 20 | { 21 | TextTrackCue *trackCue = new TextTrackCue(v); 22 | trackCue->autorelease(); 23 | return trackCue; 24 | } 25 | 26 | HTML5_PROPERTY_IMPL(TextTrackCue, double, endTime); 27 | HTML5_PROPERTY_IMPL(TextTrackCue, std::string, id); 28 | HTML5_EVENT_HANDLER_PROPERTY_IMPL(TextTrackCue, EventHandler *, onenter); 29 | HTML5_EVENT_HANDLER_PROPERTY_IMPL(TextTrackCue, EventHandler *, onexit); 30 | HTML5_PROPERTY_IMPL(TextTrackCue, bool, pauseOnExit); 31 | HTML5_PROPERTY_IMPL(TextTrackCue, double, startTime); 32 | HTML5_PROPERTY_OBJECT_IMPL(TextTrackCue, TextTrack, track); 33 | -------------------------------------------------------------------------------- /src/text_track_cue_list.cc: -------------------------------------------------------------------------------- 1 | #include "text_track_cue.h" 2 | #include "text_track_cue_list.h" 3 | 4 | USING_NAMESPACE_HTML5; 5 | 6 | TextTrackCueList::TextTrackCueList(emscripten::val v) : 7 | Object(v) 8 | { 9 | 10 | } 11 | 12 | TextTrackCueList::~TextTrackCueList() 13 | { 14 | 15 | } 16 | 17 | TextTrackCueList *TextTrackCueList::create(emscripten::val v) 18 | { 19 | auto list = new TextTrackCueList(v); 20 | list->autorelease(); 21 | return list; 22 | } 23 | 24 | TextTrackCue *TextTrackCueList::getCueById(std::string id) 25 | { 26 | return TextTrackCue::create(HTML5_CALLv(this->v, getCueById, id)); 27 | } 28 | 29 | TextTrackCue *TextTrackCueList::getter(unsigned long index) 30 | { 31 | return TextTrackCue::create(HTML5_CALLv(this->v, getter, index)); 32 | } 33 | 34 | HTML5_PROPERTY_IMPL(TextTrackCueList, unsigned long, length); 35 | -------------------------------------------------------------------------------- /src/text_track_list.cc: -------------------------------------------------------------------------------- 1 | #include "text_track.h" 2 | #include "text_track_list.h" 3 | #include "event.h" 4 | #include "event_handler.h" 5 | 6 | USING_NAMESPACE_HTML5; 7 | 8 | HTML5_BIND_CLASS(TextTrackList); 9 | 10 | TextTrackList::TextTrackList(emscripten::val v) : 11 | EventTarget(v) 12 | { 13 | 14 | } 15 | 16 | TextTrackList::~TextTrackList() 17 | { 18 | 19 | } 20 | 21 | TextTrackList *TextTrackList::create(emscripten::val v) 22 | { 23 | TextTrackList *trackList = new TextTrackList(v); 24 | trackList->autorelease(); 25 | return trackList; 26 | } 27 | 28 | TextTrack *TextTrackList::getter(unsigned long index) 29 | { 30 | return TextTrack::create(HTML5_CALLv(this->v, getter, index)); 31 | } 32 | 33 | TextTrack *TextTrackList::getTrackById(std::string id) 34 | { 35 | return TextTrack::create(HTML5_CALLv(this->v, getTrackById, id)); 36 | } 37 | 38 | HTML5_PROPERTY_IMPL(TextTrackList, unsigned long, length); 39 | HTML5_EVENT_HANDLER_PROPERTY_IMPL(TextTrackList, EventHandler *, onaddtrack); 40 | HTML5_EVENT_HANDLER_PROPERTY_IMPL(TextTrackList, EventHandler *, onchange); 41 | HTML5_EVENT_HANDLER_PROPERTY_IMPL(TextTrackList, EventHandler *, onremovetrack); 42 | -------------------------------------------------------------------------------- /src/time_ranges.cc: -------------------------------------------------------------------------------- 1 | #include "time_ranges.h" 2 | 3 | USING_NAMESPACE_HTML5; 4 | 5 | TimeRanges::TimeRanges(emscripten::val v) : 6 | Object(v) 7 | { 8 | 9 | } 10 | 11 | TimeRanges::~TimeRanges() 12 | { 13 | 14 | } 15 | 16 | TimeRanges *TimeRanges::create(emscripten::val v) 17 | { 18 | TimeRanges *tr = new TimeRanges(v); 19 | tr->autorelease(); 20 | return tr; 21 | } 22 | 23 | double TimeRanges::start(unsigned long index) 24 | { 25 | return HTML5_CALLf(this->v, start, double, index); 26 | } 27 | 28 | double TimeRanges::end(unsigned long index) 29 | { 30 | return HTML5_CALLf(this->v, end, double, index); 31 | } 32 | 33 | HTML5_PROPERTY_IMPL(TimeRanges, unsigned long, length); 34 | -------------------------------------------------------------------------------- /src/tree_walker.cc: -------------------------------------------------------------------------------- 1 | #include "node.h" 2 | #include "node_filter.h" 3 | #include "tree_walker.h" 4 | 5 | USING_NAMESPACE_HTML5; 6 | 7 | TreeWalker::TreeWalker(emscripten::val v) : 8 | Object(v) 9 | { 10 | 11 | } 12 | 13 | TreeWalker::~TreeWalker() 14 | { 15 | 16 | } 17 | 18 | TreeWalker *TreeWalker::create(emscripten::val v) 19 | { 20 | auto walker = new TreeWalker(v); 21 | walker->autorelease(); 22 | return walker; 23 | } 24 | 25 | Node *TreeWalker::firstChild() 26 | { 27 | return Node::create(HTML5_CALLv(this->v, firstChild)); 28 | } 29 | 30 | Node *TreeWalker::lastChild() 31 | { 32 | return Node::create(HTML5_CALLv(this->v, lastChild)); 33 | } 34 | 35 | Node *TreeWalker::nextNode() 36 | { 37 | return Node::create(HTML5_CALLv(this->v, nextNode)); 38 | } 39 | 40 | Node *TreeWalker::nextSibling() 41 | { 42 | return Node::create(HTML5_CALLv(this->v, nextSibling)); 43 | } 44 | 45 | Node *TreeWalker::parentNode() 46 | { 47 | return Node::create(HTML5_CALLv(this->v, parentNode)); 48 | } 49 | 50 | Node *TreeWalker::previousNode() 51 | { 52 | return Node::create(HTML5_CALLv(this->v, previousNode)); 53 | } 54 | 55 | Node *TreeWalker::previousSibling() 56 | { 57 | return Node::create(HTML5_CALLv(this->v, previousSibling)); 58 | } 59 | 60 | HTML5_PROPERTY_OBJECT_IMPL(TreeWalker, Node, currentNode); 61 | HTML5_PROPERTY_OBJECT_IMPL(TreeWalker, NodeFilter, filter); 62 | HTML5_PROPERTY_OBJECT_IMPL(TreeWalker, Node, root); 63 | HTML5_PROPERTY_IMPL(TreeWalker, unsigned long, whatToShow); 64 | -------------------------------------------------------------------------------- /src/uint8_array.cc: -------------------------------------------------------------------------------- 1 | #include "array_buffer.h" 2 | #include "uint8_array.h" 3 | 4 | USING_NAMESPACE_HTML5; 5 | 6 | Uint8Array::Uint8Array(emscripten::val v) : 7 | ArrayBufferView(v) 8 | { 9 | 10 | } 11 | 12 | Uint8Array::~Uint8Array() 13 | { 14 | 15 | } 16 | 17 | Uint8Array *Uint8Array::create(emscripten::val v) 18 | { 19 | auto array = new Uint8Array(v); 20 | array->autorelease(); 21 | return array; 22 | } 23 | 24 | Uint8Array *Uint8Array::create() 25 | { 26 | return create(HTML5_NEW_PRIMITIVE_INSTANCE(Uint8Array)); 27 | } 28 | 29 | Uint8Array *Uint8Array::create(unsigned long length) 30 | { 31 | return create(HTML5_NEW_PRIMITIVE_INSTANCE(Uint8Array, length)); 32 | } 33 | 34 | Uint8Array *Uint8Array::create(Uint8Array *array) 35 | { 36 | return create(array->v); 37 | } 38 | 39 | Uint8Array *Uint8Array::create(ArrayBuffer *buffer) 40 | { 41 | return create(HTML5_NEW_PRIMITIVE_INSTANCE(Uint8Array, buffer->v)); 42 | } 43 | 44 | Uint8Array *Uint8Array::create(ArrayBuffer *buffer, unsigned long byteOffset) 45 | { 46 | return create(HTML5_NEW_PRIMITIVE_INSTANCE(Uint8Array, buffer->v, byteOffset)); 47 | } 48 | 49 | Uint8Array *Uint8Array::create(ArrayBuffer *buffer, unsigned long byteOffset, unsigned long length) 50 | { 51 | return create(HTML5_NEW_PRIMITIVE_INSTANCE(Uint8Array, buffer->v, byteOffset, length)); 52 | } 53 | 54 | Uint8Array::uint8WrapType Uint8Array::operator[](std::size_t index) const 55 | { 56 | return Uint8Array::uint8WrapType(this->v, index); 57 | } 58 | 59 | Uint8Array::uint8WrapType Uint8Array::operator[](std::size_t index) 60 | { 61 | return Uint8Array::uint8WrapType(this->v, index); 62 | } 63 | 64 | Uint8Array::uint8WrapType::uint8WrapType(emscripten::val v, size_t index) : 65 | v(v), 66 | index(index) 67 | { 68 | 69 | } 70 | 71 | Uint8Array::uint8WrapType::~uint8WrapType() 72 | { 73 | 74 | } 75 | 76 | void Uint8Array::uint8WrapType::operator=(uint8_t value) 77 | { 78 | this->v.set(this->index, value); 79 | } 80 | 81 | HTML5_PROPERTY_IMPL(Uint8Array, unsigned long, length); 82 | -------------------------------------------------------------------------------- /src/uint8_clamped_array.cc: -------------------------------------------------------------------------------- 1 | #include "array_buffer.h" 2 | #include "uint8_clamped_array.h" 3 | 4 | USING_NAMESPACE_HTML5; 5 | 6 | Uint8ClampedArray::Uint8ClampedArray(emscripten::val v) : 7 | ArrayBufferView(v) 8 | { 9 | 10 | } 11 | 12 | Uint8ClampedArray::~Uint8ClampedArray() 13 | { 14 | 15 | } 16 | 17 | Uint8ClampedArray *Uint8ClampedArray::create(emscripten::val v) 18 | { 19 | auto array = new Uint8ClampedArray(v); 20 | array->autorelease(); 21 | return array; 22 | } 23 | 24 | Uint8ClampedArray *Uint8ClampedArray::create() 25 | { 26 | return create(HTML5_NEW_PRIMITIVE_INSTANCE(Uint8ClampedArray)); 27 | } 28 | 29 | Uint8ClampedArray *Uint8ClampedArray::create(unsigned long length) 30 | { 31 | return create(HTML5_NEW_PRIMITIVE_INSTANCE(Uint8ClampedArray, length)); 32 | } 33 | 34 | Uint8ClampedArray *Uint8ClampedArray::create(Uint8ClampedArray *array) 35 | { 36 | return create(array->v); 37 | } 38 | 39 | Uint8ClampedArray *Uint8ClampedArray::create(ArrayBuffer *buffer) 40 | { 41 | return create(HTML5_NEW_PRIMITIVE_INSTANCE(Uint8ClampedArray, buffer->v)); 42 | } 43 | 44 | Uint8ClampedArray *Uint8ClampedArray::create(ArrayBuffer *buffer, unsigned long byteOffset) 45 | { 46 | return create(HTML5_NEW_PRIMITIVE_INSTANCE(Uint8ClampedArray, buffer->v, byteOffset)); 47 | } 48 | 49 | Uint8ClampedArray *Uint8ClampedArray::create(ArrayBuffer *buffer, unsigned long byteOffset, unsigned long length) 50 | { 51 | return create(HTML5_NEW_PRIMITIVE_INSTANCE(Uint8ClampedArray, buffer->v, byteOffset, length)); 52 | } 53 | 54 | uint8_t Uint8ClampedArray::operator[](std::size_t index) const 55 | { 56 | #if ENABLE_EMSCRIPTEN 57 | return this->v[index].as(); 58 | #else 59 | return this->_rawdata[index]; 60 | #endif 61 | } 62 | 63 | Uint8ClampedArray::uint8WrapType::uint8WrapType(emscripten::val v, size_t index) : 64 | v(v), 65 | index(index) 66 | { 67 | 68 | } 69 | 70 | Uint8ClampedArray::uint8WrapType::~uint8WrapType() 71 | { 72 | 73 | } 74 | 75 | void Uint8ClampedArray::uint8WrapType::operator=(uint8_t value) 76 | { 77 | this->v.set(this->index, value); 78 | } 79 | 80 | Uint8ClampedArray::uint8WrapType Uint8ClampedArray::operator[](std::size_t index) 81 | { 82 | return Uint8ClampedArray::uint8WrapType(this->v, index); 83 | } 84 | 85 | HTML5_PROPERTY_IMPL(Uint8ClampedArray, unsigned long, length); 86 | -------------------------------------------------------------------------------- /src/video_track.cc: -------------------------------------------------------------------------------- 1 | #include "video_track.h" 2 | 3 | USING_NAMESPACE_HTML5; 4 | 5 | VideoTrack::VideoTrack(emscripten::val v) : 6 | Object(v) 7 | { 8 | 9 | } 10 | 11 | VideoTrack::~VideoTrack() 12 | { 13 | 14 | } 15 | 16 | VideoTrack *VideoTrack::create(emscripten::val v) 17 | { 18 | VideoTrack *track = new VideoTrack(v); 19 | track->autorelease(); 20 | return track; 21 | } 22 | 23 | HTML5_PROPERTY_IMPL(VideoTrack, std::string, id); 24 | HTML5_PROPERTY_IMPL(VideoTrack, std::string, kind); 25 | HTML5_PROPERTY_IMPL(VideoTrack, std::string, label); 26 | HTML5_PROPERTY_IMPL(VideoTrack, std::string, language); 27 | HTML5_PROPERTY_IMPL(VideoTrack, bool, selected); 28 | -------------------------------------------------------------------------------- /src/video_track_list.cc: -------------------------------------------------------------------------------- 1 | #include "video_track.h" 2 | #include "video_track_list.h" 3 | #include "event.h" 4 | #include "event_handler.h" 5 | 6 | USING_NAMESPACE_HTML5; 7 | 8 | HTML5_BIND_CLASS(VideoTrackList); 9 | 10 | VideoTrackList::VideoTrackList(emscripten::val v) : 11 | EventTarget(v) 12 | { 13 | 14 | } 15 | 16 | VideoTrackList::~VideoTrackList() 17 | { 18 | 19 | } 20 | 21 | VideoTrackList *VideoTrackList::create(emscripten::val v) 22 | { 23 | VideoTrackList *trackList = new VideoTrackList(v); 24 | trackList->autorelease(); 25 | return trackList; 26 | } 27 | 28 | VideoTrack *VideoTrackList::getter(unsigned long index) 29 | { 30 | return VideoTrack::create(HTML5_CALLv(this->v, getter, index)); 31 | } 32 | 33 | VideoTrack *VideoTrackList::getTrackById(std::string id) 34 | { 35 | return VideoTrack::create(HTML5_CALLv(this->v, getTrackById, id)); 36 | } 37 | 38 | HTML5_PROPERTY_IMPL(VideoTrackList, unsigned long, length); 39 | HTML5_EVENT_HANDLER_PROPERTY_IMPL(VideoTrackList, EventHandler *, onaddtrack); 40 | HTML5_EVENT_HANDLER_PROPERTY_IMPL(VideoTrackList, EventHandler *, onchange); 41 | HTML5_EVENT_HANDLER_PROPERTY_IMPL(VideoTrackList, EventHandler *, onremovetrack); 42 | HTML5_PROPERTY_IMPL(VideoTrackList, long, selectedIndex); 43 | -------------------------------------------------------------------------------- /src/webgl_active_info.cc: -------------------------------------------------------------------------------- 1 | #include "webgl_active_info.h" 2 | 3 | USING_NAMESPACE_HTML5; 4 | 5 | WebGLActiveInfo::WebGLActiveInfo(emscripten::val v) : 6 | Object(v) 7 | { 8 | 9 | } 10 | 11 | WebGLActiveInfo::~WebGLActiveInfo() 12 | { 13 | 14 | } 15 | 16 | WebGLActiveInfo *WebGLActiveInfo::create(emscripten::val v) 17 | { 18 | auto info = new WebGLActiveInfo(v); 19 | info->autorelease(); 20 | return info; 21 | } 22 | 23 | HTML5_PROPERTY_IMPL(WebGLActiveInfo, std::string, name); 24 | HTML5_PROPERTY_IMPL(WebGLActiveInfo, GLint, size); 25 | HTML5_PROPERTY_IMPL(WebGLActiveInfo, GLenum, type); 26 | -------------------------------------------------------------------------------- /src/webgl_buffer.cc: -------------------------------------------------------------------------------- 1 | #include "webgl_buffer.h" 2 | 3 | USING_NAMESPACE_HTML5; 4 | 5 | WebGLBuffer::WebGLBuffer(emscripten::val v) : 6 | WebGLObject(v) 7 | { 8 | 9 | } 10 | 11 | WebGLBuffer::~WebGLBuffer() 12 | { 13 | 14 | } 15 | 16 | WebGLBuffer *WebGLBuffer::create(emscripten::val v) 17 | { 18 | auto buffer = new WebGLBuffer(v); 19 | buffer->autorelease(); 20 | return buffer; 21 | } 22 | -------------------------------------------------------------------------------- /src/webgl_context_attributes.cc: -------------------------------------------------------------------------------- 1 | #include "webgl_context_attributes.h" 2 | 3 | USING_NAMESPACE_HTML5; 4 | 5 | WebGLContextAttributes::WebGLContextAttributes(emscripten::val v) : 6 | Object(v) 7 | { 8 | 9 | } 10 | 11 | WebGLContextAttributes::~WebGLContextAttributes() 12 | { 13 | 14 | } 15 | 16 | WebGLContextAttributes *WebGLContextAttributes::create(emscripten::val v) 17 | { 18 | auto attr = new WebGLContextAttributes(v); 19 | attr->autorelease(); 20 | return attr; 21 | } 22 | 23 | WebGLContextAttributes *WebGLContextAttributes::create() 24 | { 25 | return create(HTML5_NEW_PRIMITIVE_INSTANCE(Object)); 26 | } 27 | 28 | HTML5_PROPERTY_IMPL(WebGLContextAttributes, GLboolean, alpha); 29 | HTML5_PROPERTY_IMPL(WebGLContextAttributes, GLboolean, antialias); 30 | HTML5_PROPERTY_IMPL(WebGLContextAttributes, GLboolean, depth); 31 | HTML5_PROPERTY_IMPL(WebGLContextAttributes, GLboolean, failIfMajorPerformanceCaveat); 32 | HTML5_PROPERTY_IMPL(WebGLContextAttributes, GLboolean, preferLowPowerToHighPerformance); 33 | HTML5_PROPERTY_IMPL(WebGLContextAttributes, GLboolean, premultipliedAlpha); 34 | HTML5_PROPERTY_IMPL(WebGLContextAttributes, GLboolean, preserveDrawingBuffer); 35 | HTML5_PROPERTY_IMPL(WebGLContextAttributes, GLboolean, stencil); 36 | -------------------------------------------------------------------------------- /src/webgl_context_event.cc: -------------------------------------------------------------------------------- 1 | #include "webgl_context_event.h" 2 | 3 | USING_NAMESPACE_HTML5; 4 | 5 | WebGLContextEvent::WebGLContextEvent(emscripten::val v) : 6 | Event(v) 7 | { 8 | 9 | } 10 | 11 | WebGLContextEvent::~WebGLContextEvent() 12 | { 13 | 14 | } 15 | 16 | WebGLContextEvent *WebGLContextEvent::create(emscripten::val v) 17 | { 18 | auto event = new WebGLContextEvent(v); 19 | event->autorelease(); 20 | return event; 21 | } 22 | 23 | HTML5_PROPERTY_IMPL(WebGLContextEvent, std::string, statusMessage); 24 | -------------------------------------------------------------------------------- /src/webgl_extension.cc: -------------------------------------------------------------------------------- 1 | #include "webgl_extension.h" 2 | 3 | USING_NAMESPACE_HTML5; 4 | 5 | WebGLExtension::WebGLExtension(emscripten::val v) : 6 | Object(v) 7 | { 8 | 9 | } 10 | 11 | WebGLExtension::~WebGLExtension() 12 | { 13 | 14 | } 15 | 16 | WebGLExtension *WebGLExtension::create(emscripten::val v) 17 | { 18 | auto ext = new WebGLExtension(v); 19 | ext->autorelease(); 20 | return ext; 21 | } 22 | -------------------------------------------------------------------------------- /src/webgl_framebuffer.cc: -------------------------------------------------------------------------------- 1 | #include "webgl_framebuffer.h" 2 | 3 | USING_NAMESPACE_HTML5; 4 | 5 | WebGLFramebuffer::WebGLFramebuffer(emscripten::val v) : 6 | WebGLObject(v) 7 | { 8 | 9 | } 10 | 11 | WebGLFramebuffer::~WebGLFramebuffer() 12 | { 13 | 14 | } 15 | 16 | WebGLFramebuffer *WebGLFramebuffer::create(emscripten::val v) 17 | { 18 | auto buffer = new WebGLFramebuffer(v); 19 | buffer->autorelease(); 20 | return buffer; 21 | } 22 | -------------------------------------------------------------------------------- /src/webgl_object.cc: -------------------------------------------------------------------------------- 1 | #include "webgl_object.h" 2 | 3 | USING_NAMESPACE_HTML5; 4 | 5 | WebGLObject::WebGLObject(emscripten::val v) : 6 | Object(v) 7 | { 8 | 9 | } 10 | 11 | WebGLObject::~WebGLObject() 12 | { 13 | 14 | } 15 | -------------------------------------------------------------------------------- /src/webgl_program.cc: -------------------------------------------------------------------------------- 1 | #include "webgl_program.h" 2 | 3 | USING_NAMESPACE_HTML5; 4 | 5 | WebGLProgram::WebGLProgram(emscripten::val v) : 6 | WebGLObject(v) 7 | { 8 | 9 | } 10 | 11 | WebGLProgram::~WebGLProgram() 12 | { 13 | 14 | } 15 | 16 | WebGLProgram *WebGLProgram::create(emscripten::val v) 17 | { 18 | auto program = new WebGLProgram(v); 19 | program->autorelease(); 20 | return program; 21 | } 22 | -------------------------------------------------------------------------------- /src/webgl_renderbuffer.cc: -------------------------------------------------------------------------------- 1 | #include "webgl_renderbuffer.h" 2 | 3 | USING_NAMESPACE_HTML5; 4 | 5 | WebGLRenderbuffer::WebGLRenderbuffer(emscripten::val v) : 6 | WebGLObject(v) 7 | { 8 | 9 | } 10 | 11 | WebGLRenderbuffer::~WebGLRenderbuffer() 12 | { 13 | 14 | } 15 | 16 | WebGLRenderbuffer *WebGLRenderbuffer::create(emscripten::val v) 17 | { 18 | auto buffer = new WebGLRenderbuffer(v); 19 | buffer->autorelease(); 20 | return buffer; 21 | } 22 | -------------------------------------------------------------------------------- /src/webgl_shader.cc: -------------------------------------------------------------------------------- 1 | #include "webgl_shader.h" 2 | 3 | USING_NAMESPACE_HTML5; 4 | 5 | WebGLShader::WebGLShader(emscripten::val v) : 6 | WebGLObject(v) 7 | { 8 | 9 | } 10 | 11 | WebGLShader::~WebGLShader() 12 | { 13 | 14 | } 15 | 16 | WebGLShader *WebGLShader::create(emscripten::val v) 17 | { 18 | auto shader = new WebGLShader(v); 19 | shader->autorelease(); 20 | return shader; 21 | } 22 | -------------------------------------------------------------------------------- /src/webgl_shader_precision_format.cc: -------------------------------------------------------------------------------- 1 | #include "webgl_shader_precision_format.h" 2 | 3 | USING_NAMESPACE_HTML5; 4 | 5 | WebGLShaderPrecisionFormat::WebGLShaderPrecisionFormat(emscripten::val v) : 6 | Object(v) 7 | { 8 | 9 | } 10 | 11 | WebGLShaderPrecisionFormat::~WebGLShaderPrecisionFormat() 12 | { 13 | 14 | } 15 | 16 | WebGLShaderPrecisionFormat *WebGLShaderPrecisionFormat::create(emscripten::val v) 17 | { 18 | auto format = new WebGLShaderPrecisionFormat(v); 19 | format->autorelease(); 20 | return format; 21 | } 22 | 23 | HTML5_PROPERTY_IMPL(WebGLShaderPrecisionFormat, GLint, precision); 24 | HTML5_PROPERTY_IMPL(WebGLShaderPrecisionFormat, GLint, rangeMax); 25 | HTML5_PROPERTY_IMPL(WebGLShaderPrecisionFormat, GLint, rangeMin); 26 | -------------------------------------------------------------------------------- /src/webgl_texture.cc: -------------------------------------------------------------------------------- 1 | #include "webgl_texture.h" 2 | 3 | USING_NAMESPACE_HTML5; 4 | 5 | WebGLTexture::WebGLTexture(emscripten::val v) : 6 | WebGLObject(v) 7 | { 8 | 9 | } 10 | 11 | WebGLTexture::~WebGLTexture() 12 | { 13 | 14 | } 15 | 16 | WebGLTexture *WebGLTexture::create(emscripten::val v) 17 | { 18 | auto texture = new WebGLTexture(v); 19 | texture->autorelease(); 20 | return texture; 21 | } 22 | -------------------------------------------------------------------------------- /src/webgl_uniform_location.cc: -------------------------------------------------------------------------------- 1 | #include "webgl_uniform_location.h" 2 | 3 | USING_NAMESPACE_HTML5; 4 | 5 | WebGLUniformLocation::WebGLUniformLocation(emscripten::val v) : 6 | Object(v) 7 | { 8 | 9 | } 10 | 11 | WebGLUniformLocation::~WebGLUniformLocation() 12 | { 13 | 14 | } 15 | 16 | WebGLUniformLocation *WebGLUniformLocation::create(emscripten::val v) 17 | { 18 | auto location = new WebGLUniformLocation(v); 19 | location->autorelease(); 20 | return location; 21 | } 22 | -------------------------------------------------------------------------------- /src/xml_document.cc: -------------------------------------------------------------------------------- 1 | #include "xml_document.h" 2 | 3 | USING_NAMESPACE_HTML5; 4 | 5 | XMLDocument::XMLDocument(emscripten::val v) : 6 | Document(v) 7 | { 8 | 9 | } 10 | 11 | XMLDocument::~XMLDocument() 12 | { 13 | 14 | } 15 | 16 | XMLDocument *XMLDocument::create(emscripten::val v) 17 | { 18 | auto doc = new XMLDocument(v); 19 | doc->autorelease(); 20 | return doc; 21 | } 22 | 23 | bool XMLDocument::load(std::string url) 24 | { 25 | return HTML5_CALLb(this->v, load, url); 26 | } 27 | -------------------------------------------------------------------------------- /test/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | yarn.lock 3 | -------------------------------------------------------------------------------- /test/index.js: -------------------------------------------------------------------------------- 1 | const puppeteer = require('puppeteer'); 2 | 3 | puppeteer.launch({ 4 | /** 5 | * if you want to see console log in browser javascript, enable options. 6 | * devtools: true, 7 | */ 8 | }).then(async browser => { 9 | const page = await browser.newPage(); 10 | await page.addScriptTag({ 11 | path: '../examples/build/libhtml5_example.js', 12 | }); 13 | 14 | await page.on('console', async msg => { 15 | console.log(msg.text()); 16 | }); 17 | 18 | await page.evaluate(() => { 19 | Module.executeTest(); 20 | return Promise.resolve(); 21 | }).catch(e => { 22 | console.error(e); 23 | return Promise.resolve(e); 24 | }); 25 | 26 | await browser.close(); 27 | }); 28 | -------------------------------------------------------------------------------- /test/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "libhtml5", 3 | "version": "1.0.0", 4 | "main": "index.js", 5 | "license": "MIT", 6 | "devDependencies": { 7 | "puppeteer": "^1.9.0" 8 | } 9 | } 10 | --------------------------------------------------------------------------------