nokolexbor 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/ext/nokolexbor/config.h +186 -0
- data/ext/nokolexbor/extconf.rb +131 -0
- data/ext/nokolexbor/libxml/HTMLparser.h +320 -0
- data/ext/nokolexbor/libxml/SAX2.h +173 -0
- data/ext/nokolexbor/libxml/chvalid.h +230 -0
- data/ext/nokolexbor/libxml/debugXML.h +217 -0
- data/ext/nokolexbor/libxml/dict.h +81 -0
- data/ext/nokolexbor/libxml/encoding.h +232 -0
- data/ext/nokolexbor/libxml/entities.h +153 -0
- data/ext/nokolexbor/libxml/globals.h +529 -0
- data/ext/nokolexbor/libxml/hash.h +236 -0
- data/ext/nokolexbor/libxml/list.h +137 -0
- data/ext/nokolexbor/libxml/parser.h +1264 -0
- data/ext/nokolexbor/libxml/parserInternals.h +641 -0
- data/ext/nokolexbor/libxml/pattern.h +100 -0
- data/ext/nokolexbor/libxml/threads.h +94 -0
- data/ext/nokolexbor/libxml/tree.h +1315 -0
- data/ext/nokolexbor/libxml/uri.h +94 -0
- data/ext/nokolexbor/libxml/valid.h +448 -0
- data/ext/nokolexbor/libxml/xmlIO.h +369 -0
- data/ext/nokolexbor/libxml/xmlautomata.h +146 -0
- data/ext/nokolexbor/libxml/xmlerror.h +919 -0
- data/ext/nokolexbor/libxml/xmlexports.h +79 -0
- data/ext/nokolexbor/libxml/xmlmemory.h +226 -0
- data/ext/nokolexbor/libxml/xmlregexp.h +222 -0
- data/ext/nokolexbor/libxml/xmlstring.h +140 -0
- data/ext/nokolexbor/libxml/xmlversion.h +526 -0
- data/ext/nokolexbor/libxml/xpath.h +575 -0
- data/ext/nokolexbor/libxml/xpathInternals.h +632 -0
- data/ext/nokolexbor/libxml/xpointer.h +137 -0
- data/ext/nokolexbor/libxml.h +76 -0
- data/ext/nokolexbor/memory.c +39 -0
- data/ext/nokolexbor/nl_document.c +51 -0
- data/ext/nokolexbor/nl_node.c +790 -0
- data/ext/nokolexbor/nl_node_set.c +368 -0
- data/ext/nokolexbor/nl_xpath_context.c +200 -0
- data/ext/nokolexbor/nokolexbor.c +63 -0
- data/ext/nokolexbor/nokolexbor.h +37 -0
- data/ext/nokolexbor/private/buf.h +70 -0
- data/ext/nokolexbor/private/dict.h +11 -0
- data/ext/nokolexbor/private/enc.h +17 -0
- data/ext/nokolexbor/private/error.h +21 -0
- data/ext/nokolexbor/private/globals.h +9 -0
- data/ext/nokolexbor/private/memory.h +9 -0
- data/ext/nokolexbor/private/parser.h +27 -0
- data/ext/nokolexbor/private/string.h +9 -0
- data/ext/nokolexbor/private/threads.h +50 -0
- data/ext/nokolexbor/private/tree.h +18 -0
- data/ext/nokolexbor/private/xpath.h +7 -0
- data/ext/nokolexbor/timsort.h +601 -0
- data/ext/nokolexbor/xml_SAX2.c +80 -0
- data/ext/nokolexbor/xml_buf.c +363 -0
- data/ext/nokolexbor/xml_chvalid.c +334 -0
- data/ext/nokolexbor/xml_dict.c +1264 -0
- data/ext/nokolexbor/xml_encoding.c +124 -0
- data/ext/nokolexbor/xml_error.c +134 -0
- data/ext/nokolexbor/xml_globals.c +1085 -0
- data/ext/nokolexbor/xml_hash.c +1141 -0
- data/ext/nokolexbor/xml_memory.c +203 -0
- data/ext/nokolexbor/xml_parser.c +127 -0
- data/ext/nokolexbor/xml_parserInternals.c +338 -0
- data/ext/nokolexbor/xml_pattern.c +2375 -0
- data/ext/nokolexbor/xml_string.c +1051 -0
- data/ext/nokolexbor/xml_threads.c +881 -0
- data/ext/nokolexbor/xml_tree.c +148 -0
- data/ext/nokolexbor/xml_xpath.c +14743 -0
- data/lib/nokolexbor/attribute.rb +18 -0
- data/lib/nokolexbor/document.rb +6 -0
- data/lib/nokolexbor/node.rb +264 -0
- data/lib/nokolexbor/node_set.rb +124 -0
- data/lib/nokolexbor/version.rb +5 -0
- data/lib/nokolexbor/xpath_context.rb +14 -0
- data/lib/nokolexbor.rb +17 -0
- data/patches/0001-lexbor-support-text-pseudo-element.patch +137 -0
- data/patches/0002-lexbor-match-id-class-case-sensitive.patch +22 -0
- data/patches/0003-lexbor-attach-template-content-to-self.patch +13 -0
- data/vendor/lexbor/CMakeLists.txt +331 -0
- data/vendor/lexbor/config.cmake +890 -0
- data/vendor/lexbor/feature.cmake +134 -0
- data/vendor/lexbor/source/lexbor/core/array.c +208 -0
- data/vendor/lexbor/source/lexbor/core/array.h +100 -0
- data/vendor/lexbor/source/lexbor/core/array_obj.c +216 -0
- data/vendor/lexbor/source/lexbor/core/array_obj.h +134 -0
- data/vendor/lexbor/source/lexbor/core/avl.c +442 -0
- data/vendor/lexbor/source/lexbor/core/avl.h +82 -0
- data/vendor/lexbor/source/lexbor/core/base.h +86 -0
- data/vendor/lexbor/source/lexbor/core/bst.c +468 -0
- data/vendor/lexbor/source/lexbor/core/bst.h +108 -0
- data/vendor/lexbor/source/lexbor/core/bst_map.c +238 -0
- data/vendor/lexbor/source/lexbor/core/bst_map.h +87 -0
- data/vendor/lexbor/source/lexbor/core/config.cmake +12 -0
- data/vendor/lexbor/source/lexbor/core/conv.c +203 -0
- data/vendor/lexbor/source/lexbor/core/conv.h +53 -0
- data/vendor/lexbor/source/lexbor/core/core.h +35 -0
- data/vendor/lexbor/source/lexbor/core/def.h +57 -0
- data/vendor/lexbor/source/lexbor/core/diyfp.c +153 -0
- data/vendor/lexbor/source/lexbor/core/diyfp.h +258 -0
- data/vendor/lexbor/source/lexbor/core/dobject.c +187 -0
- data/vendor/lexbor/source/lexbor/core/dobject.h +92 -0
- data/vendor/lexbor/source/lexbor/core/dtoa.c +404 -0
- data/vendor/lexbor/source/lexbor/core/dtoa.h +28 -0
- data/vendor/lexbor/source/lexbor/core/fs.h +60 -0
- data/vendor/lexbor/source/lexbor/core/hash.c +476 -0
- data/vendor/lexbor/source/lexbor/core/hash.h +218 -0
- data/vendor/lexbor/source/lexbor/core/in.c +267 -0
- data/vendor/lexbor/source/lexbor/core/in.h +172 -0
- data/vendor/lexbor/source/lexbor/core/lexbor.h +35 -0
- data/vendor/lexbor/source/lexbor/core/mem.c +228 -0
- data/vendor/lexbor/source/lexbor/core/mem.h +141 -0
- data/vendor/lexbor/source/lexbor/core/mraw.c +428 -0
- data/vendor/lexbor/source/lexbor/core/mraw.h +114 -0
- data/vendor/lexbor/source/lexbor/core/perf.h +45 -0
- data/vendor/lexbor/source/lexbor/core/plog.c +73 -0
- data/vendor/lexbor/source/lexbor/core/plog.h +102 -0
- data/vendor/lexbor/source/lexbor/core/print.c +168 -0
- data/vendor/lexbor/source/lexbor/core/print.h +39 -0
- data/vendor/lexbor/source/lexbor/core/sbst.h +59 -0
- data/vendor/lexbor/source/lexbor/core/serialize.c +27 -0
- data/vendor/lexbor/source/lexbor/core/serialize.h +32 -0
- data/vendor/lexbor/source/lexbor/core/shs.c +118 -0
- data/vendor/lexbor/source/lexbor/core/shs.h +82 -0
- data/vendor/lexbor/source/lexbor/core/str.c +617 -0
- data/vendor/lexbor/source/lexbor/core/str.h +247 -0
- data/vendor/lexbor/source/lexbor/core/str_res.h +369 -0
- data/vendor/lexbor/source/lexbor/core/strtod.c +326 -0
- data/vendor/lexbor/source/lexbor/core/strtod.h +28 -0
- data/vendor/lexbor/source/lexbor/core/types.h +39 -0
- data/vendor/lexbor/source/lexbor/core/utils.c +43 -0
- data/vendor/lexbor/source/lexbor/core/utils.h +36 -0
- data/vendor/lexbor/source/lexbor/css/base.h +44 -0
- data/vendor/lexbor/source/lexbor/css/config.cmake +2 -0
- data/vendor/lexbor/source/lexbor/css/css.h +25 -0
- data/vendor/lexbor/source/lexbor/css/log.c +336 -0
- data/vendor/lexbor/source/lexbor/css/log.h +103 -0
- data/vendor/lexbor/source/lexbor/css/node.h +29 -0
- data/vendor/lexbor/source/lexbor/css/parser.c +473 -0
- data/vendor/lexbor/source/lexbor/css/parser.h +368 -0
- data/vendor/lexbor/source/lexbor/css/selectors/base.h +48 -0
- data/vendor/lexbor/source/lexbor/css/selectors/pseudo.c +91 -0
- data/vendor/lexbor/source/lexbor/css/selectors/pseudo.h +66 -0
- data/vendor/lexbor/source/lexbor/css/selectors/pseudo_const.h +109 -0
- data/vendor/lexbor/source/lexbor/css/selectors/pseudo_res.h +302 -0
- data/vendor/lexbor/source/lexbor/css/selectors/pseudo_state.c +279 -0
- data/vendor/lexbor/source/lexbor/css/selectors/pseudo_state.h +85 -0
- data/vendor/lexbor/source/lexbor/css/selectors/selector.c +927 -0
- data/vendor/lexbor/source/lexbor/css/selectors/selector.h +200 -0
- data/vendor/lexbor/source/lexbor/css/selectors/selectors.c +340 -0
- data/vendor/lexbor/source/lexbor/css/selectors/selectors.h +137 -0
- data/vendor/lexbor/source/lexbor/css/selectors/state.c +1718 -0
- data/vendor/lexbor/source/lexbor/css/selectors/state.h +79 -0
- data/vendor/lexbor/source/lexbor/css/stylesheet.h +37 -0
- data/vendor/lexbor/source/lexbor/css/syntax/anb.c +443 -0
- data/vendor/lexbor/source/lexbor/css/syntax/anb.h +45 -0
- data/vendor/lexbor/source/lexbor/css/syntax/base.h +33 -0
- data/vendor/lexbor/source/lexbor/css/syntax/parser.c +9 -0
- data/vendor/lexbor/source/lexbor/css/syntax/parser.h +25 -0
- data/vendor/lexbor/source/lexbor/css/syntax/res.h +48 -0
- data/vendor/lexbor/source/lexbor/css/syntax/state.c +2603 -0
- data/vendor/lexbor/source/lexbor/css/syntax/state.h +140 -0
- data/vendor/lexbor/source/lexbor/css/syntax/state_res.h +273 -0
- data/vendor/lexbor/source/lexbor/css/syntax/syntax.c +67 -0
- data/vendor/lexbor/source/lexbor/css/syntax/token.c +618 -0
- data/vendor/lexbor/source/lexbor/css/syntax/token.h +298 -0
- data/vendor/lexbor/source/lexbor/css/syntax/token_res.h +68 -0
- data/vendor/lexbor/source/lexbor/css/syntax/tokenizer/error.c +30 -0
- data/vendor/lexbor/source/lexbor/css/syntax/tokenizer/error.h +58 -0
- data/vendor/lexbor/source/lexbor/css/syntax/tokenizer.c +278 -0
- data/vendor/lexbor/source/lexbor/css/syntax/tokenizer.h +121 -0
- data/vendor/lexbor/source/lexbor/dom/base.h +32 -0
- data/vendor/lexbor/source/lexbor/dom/collection.c +97 -0
- data/vendor/lexbor/source/lexbor/dom/collection.h +112 -0
- data/vendor/lexbor/source/lexbor/dom/config.cmake +3 -0
- data/vendor/lexbor/source/lexbor/dom/dom.h +29 -0
- data/vendor/lexbor/source/lexbor/dom/exception.c +18 -0
- data/vendor/lexbor/source/lexbor/dom/exception.h +73 -0
- data/vendor/lexbor/source/lexbor/dom/interface.c +110 -0
- data/vendor/lexbor/source/lexbor/dom/interface.h +88 -0
- data/vendor/lexbor/source/lexbor/dom/interfaces/attr.c +445 -0
- data/vendor/lexbor/source/lexbor/dom/interfaces/attr.h +152 -0
- data/vendor/lexbor/source/lexbor/dom/interfaces/attr_const.h +62 -0
- data/vendor/lexbor/source/lexbor/dom/interfaces/attr_res.h +143 -0
- data/vendor/lexbor/source/lexbor/dom/interfaces/cdata_section.c +55 -0
- data/vendor/lexbor/source/lexbor/dom/interfaces/cdata_section.h +38 -0
- data/vendor/lexbor/source/lexbor/dom/interfaces/character_data.c +110 -0
- data/vendor/lexbor/source/lexbor/dom/interfaces/character_data.h +51 -0
- data/vendor/lexbor/source/lexbor/dom/interfaces/comment.c +64 -0
- data/vendor/lexbor/source/lexbor/dom/interfaces/comment.h +42 -0
- data/vendor/lexbor/source/lexbor/dom/interfaces/document.c +536 -0
- data/vendor/lexbor/source/lexbor/dom/interfaces/document.h +243 -0
- data/vendor/lexbor/source/lexbor/dom/interfaces/document_fragment.c +36 -0
- data/vendor/lexbor/source/lexbor/dom/interfaces/document_fragment.h +36 -0
- data/vendor/lexbor/source/lexbor/dom/interfaces/document_type.c +125 -0
- data/vendor/lexbor/source/lexbor/dom/interfaces/document_type.h +108 -0
- data/vendor/lexbor/source/lexbor/dom/interfaces/element.c +1411 -0
- data/vendor/lexbor/source/lexbor/dom/interfaces/element.h +319 -0
- data/vendor/lexbor/source/lexbor/dom/interfaces/event_target.c +32 -0
- data/vendor/lexbor/source/lexbor/dom/interfaces/event_target.h +34 -0
- data/vendor/lexbor/source/lexbor/dom/interfaces/node.c +661 -0
- data/vendor/lexbor/source/lexbor/dom/interfaces/node.h +192 -0
- data/vendor/lexbor/source/lexbor/dom/interfaces/processing_instruction.c +87 -0
- data/vendor/lexbor/source/lexbor/dom/interfaces/processing_instruction.h +66 -0
- data/vendor/lexbor/source/lexbor/dom/interfaces/shadow_root.c +36 -0
- data/vendor/lexbor/source/lexbor/dom/interfaces/shadow_root.h +44 -0
- data/vendor/lexbor/source/lexbor/dom/interfaces/text.c +63 -0
- data/vendor/lexbor/source/lexbor/dom/interfaces/text.h +42 -0
- data/vendor/lexbor/source/lexbor/encoding/base.h +218 -0
- data/vendor/lexbor/source/lexbor/encoding/big5.c +42839 -0
- data/vendor/lexbor/source/lexbor/encoding/config.cmake +12 -0
- data/vendor/lexbor/source/lexbor/encoding/const.h +65 -0
- data/vendor/lexbor/source/lexbor/encoding/decode.c +3193 -0
- data/vendor/lexbor/source/lexbor/encoding/decode.h +370 -0
- data/vendor/lexbor/source/lexbor/encoding/encode.c +1931 -0
- data/vendor/lexbor/source/lexbor/encoding/encode.h +377 -0
- data/vendor/lexbor/source/lexbor/encoding/encoding.c +252 -0
- data/vendor/lexbor/source/lexbor/encoding/encoding.h +475 -0
- data/vendor/lexbor/source/lexbor/encoding/euc_kr.c +53883 -0
- data/vendor/lexbor/source/lexbor/encoding/gb18030.c +47905 -0
- data/vendor/lexbor/source/lexbor/encoding/iso_2022_jp_katakana.c +159 -0
- data/vendor/lexbor/source/lexbor/encoding/jis0208.c +22477 -0
- data/vendor/lexbor/source/lexbor/encoding/jis0212.c +15787 -0
- data/vendor/lexbor/source/lexbor/encoding/multi.h +53 -0
- data/vendor/lexbor/source/lexbor/encoding/range.c +71 -0
- data/vendor/lexbor/source/lexbor/encoding/range.h +34 -0
- data/vendor/lexbor/source/lexbor/encoding/res.c +222 -0
- data/vendor/lexbor/source/lexbor/encoding/res.h +34 -0
- data/vendor/lexbor/source/lexbor/encoding/single.c +13748 -0
- data/vendor/lexbor/source/lexbor/encoding/single.h +116 -0
- data/vendor/lexbor/source/lexbor/html/base.h +44 -0
- data/vendor/lexbor/source/lexbor/html/config.cmake +3 -0
- data/vendor/lexbor/source/lexbor/html/encoding.c +574 -0
- data/vendor/lexbor/source/lexbor/html/encoding.h +106 -0
- data/vendor/lexbor/source/lexbor/html/html.h +107 -0
- data/vendor/lexbor/source/lexbor/html/interface.c +165 -0
- data/vendor/lexbor/source/lexbor/html/interface.h +186 -0
- data/vendor/lexbor/source/lexbor/html/interface_res.h +4449 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/anchor_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/anchor_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/area_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/area_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/audio_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/audio_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/base_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/base_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/body_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/body_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/br_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/br_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/button_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/button_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/canvas_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/canvas_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/d_list_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/d_list_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/data_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/data_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/data_list_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/data_list_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/details_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/details_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/dialog_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/dialog_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/directory_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/directory_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/div_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/div_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/document.c +444 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/document.h +256 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/element.c +64 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/element.h +54 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/embed_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/embed_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/field_set_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/field_set_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/font_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/font_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/form_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/form_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/frame_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/frame_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/frame_set_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/frame_set_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/head_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/head_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/heading_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/heading_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/hr_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/hr_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/html_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/html_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/iframe_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/iframe_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/image_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/image_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/input_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/input_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/label_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/label_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/legend_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/legend_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/li_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/li_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/link_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/link_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/map_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/map_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/marquee_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/marquee_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/media_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/media_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/menu_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/menu_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/meta_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/meta_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/meter_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/meter_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/mod_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/mod_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/o_list_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/o_list_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/object_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/object_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/opt_group_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/opt_group_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/option_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/option_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/output_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/output_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/paragraph_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/paragraph_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/param_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/param_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/picture_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/picture_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/pre_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/pre_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/progress_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/progress_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/quote_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/quote_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/script_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/script_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/select_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/select_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/slot_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/slot_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/source_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/source_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/span_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/span_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/style_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/style_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/table_caption_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/table_caption_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/table_cell_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/table_cell_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/table_col_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/table_col_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/table_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/table_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/table_row_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/table_row_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/table_section_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/table_section_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/template_element.c +46 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/template_element.h +38 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/text_area_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/text_area_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/time_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/time_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/title_element.c +133 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/title_element.h +42 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/track_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/track_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/u_list_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/u_list_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/unknown_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/unknown_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/video_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/video_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/window.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/window.h +34 -0
- data/vendor/lexbor/source/lexbor/html/node.c +14 -0
- data/vendor/lexbor/source/lexbor/html/node.h +67 -0
- data/vendor/lexbor/source/lexbor/html/parser.c +469 -0
- data/vendor/lexbor/source/lexbor/html/parser.h +170 -0
- data/vendor/lexbor/source/lexbor/html/serialize.c +1510 -0
- data/vendor/lexbor/source/lexbor/html/serialize.h +93 -0
- data/vendor/lexbor/source/lexbor/html/tag.h +103 -0
- data/vendor/lexbor/source/lexbor/html/tag_res.h +2262 -0
- data/vendor/lexbor/source/lexbor/html/token.c +386 -0
- data/vendor/lexbor/source/lexbor/html/token.h +130 -0
- data/vendor/lexbor/source/lexbor/html/token_attr.c +44 -0
- data/vendor/lexbor/source/lexbor/html/token_attr.h +67 -0
- data/vendor/lexbor/source/lexbor/html/tokenizer/error.c +28 -0
- data/vendor/lexbor/source/lexbor/html/tokenizer/error.h +141 -0
- data/vendor/lexbor/source/lexbor/html/tokenizer/res.h +4956 -0
- data/vendor/lexbor/source/lexbor/html/tokenizer/state.c +2171 -0
- data/vendor/lexbor/source/lexbor/html/tokenizer/state.h +225 -0
- data/vendor/lexbor/source/lexbor/html/tokenizer/state_comment.c +489 -0
- data/vendor/lexbor/source/lexbor/html/tokenizer/state_comment.h +27 -0
- data/vendor/lexbor/source/lexbor/html/tokenizer/state_doctype.c +1654 -0
- data/vendor/lexbor/source/lexbor/html/tokenizer/state_doctype.h +27 -0
- data/vendor/lexbor/source/lexbor/html/tokenizer/state_rawtext.c +303 -0
- data/vendor/lexbor/source/lexbor/html/tokenizer/state_rawtext.h +32 -0
- data/vendor/lexbor/source/lexbor/html/tokenizer/state_rcdata.c +311 -0
- data/vendor/lexbor/source/lexbor/html/tokenizer/state_rcdata.h +32 -0
- data/vendor/lexbor/source/lexbor/html/tokenizer/state_script.c +1209 -0
- data/vendor/lexbor/source/lexbor/html/tokenizer/state_script.h +32 -0
- data/vendor/lexbor/source/lexbor/html/tokenizer.c +499 -0
- data/vendor/lexbor/source/lexbor/html/tokenizer.h +343 -0
- data/vendor/lexbor/source/lexbor/html/tree/active_formatting.c +241 -0
- data/vendor/lexbor/source/lexbor/html/tree/active_formatting.h +117 -0
- data/vendor/lexbor/source/lexbor/html/tree/error.c +26 -0
- data/vendor/lexbor/source/lexbor/html/tree/error.h +114 -0
- data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/after_after_body.c +62 -0
- data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/after_after_frameset.c +63 -0
- data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/after_body.c +82 -0
- data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/after_frameset.c +88 -0
- data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/after_head.c +222 -0
- data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/before_head.c +144 -0
- data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/before_html.c +166 -0
- data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/foreign_content.c +358 -0
- data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/in_body.c +1974 -0
- data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/in_caption.c +158 -0
- data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/in_cell.c +187 -0
- data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/in_column_group.c +194 -0
- data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/in_frameset.c +149 -0
- data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/in_head.c +374 -0
- data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/in_head_noscript.c +121 -0
- data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/in_row.c +211 -0
- data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/in_select.c +341 -0
- data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/in_select_in_table.c +115 -0
- data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/in_table.c +451 -0
- data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/in_table_body.c +208 -0
- data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/in_table_text.c +127 -0
- data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/in_template.c +189 -0
- data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/initial.c +411 -0
- data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/text.c +61 -0
- data/vendor/lexbor/source/lexbor/html/tree/insertion_mode.h +135 -0
- data/vendor/lexbor/source/lexbor/html/tree/open_elements.c +251 -0
- data/vendor/lexbor/source/lexbor/html/tree/open_elements.h +105 -0
- data/vendor/lexbor/source/lexbor/html/tree/template_insertion.c +10 -0
- data/vendor/lexbor/source/lexbor/html/tree/template_insertion.h +100 -0
- data/vendor/lexbor/source/lexbor/html/tree.c +1726 -0
- data/vendor/lexbor/source/lexbor/html/tree.h +431 -0
- data/vendor/lexbor/source/lexbor/html/tree_res.h +111 -0
- data/vendor/lexbor/source/lexbor/ns/base.h +32 -0
- data/vendor/lexbor/source/lexbor/ns/config.cmake +2 -0
- data/vendor/lexbor/source/lexbor/ns/const.h +37 -0
- data/vendor/lexbor/source/lexbor/ns/ns.c +154 -0
- data/vendor/lexbor/source/lexbor/ns/ns.h +66 -0
- data/vendor/lexbor/source/lexbor/ns/res.h +97 -0
- data/vendor/lexbor/source/lexbor/ports/posix/config.cmake +11 -0
- data/vendor/lexbor/source/lexbor/ports/posix/lexbor/core/fs.c +236 -0
- data/vendor/lexbor/source/lexbor/ports/posix/lexbor/core/memory.c +33 -0
- data/vendor/lexbor/source/lexbor/ports/posix/lexbor/core/perf.c +158 -0
- data/vendor/lexbor/source/lexbor/ports/windows_nt/config.cmake +18 -0
- data/vendor/lexbor/source/lexbor/ports/windows_nt/lexbor/core/fs.c +239 -0
- data/vendor/lexbor/source/lexbor/ports/windows_nt/lexbor/core/memory.c +33 -0
- data/vendor/lexbor/source/lexbor/ports/windows_nt/lexbor/core/perf.c +81 -0
- data/vendor/lexbor/source/lexbor/selectors/base.h +30 -0
- data/vendor/lexbor/source/lexbor/selectors/config.cmake +2 -0
- data/vendor/lexbor/source/lexbor/selectors/selectors.c +1591 -0
- data/vendor/lexbor/source/lexbor/selectors/selectors.h +71 -0
- data/vendor/lexbor/source/lexbor/tag/base.h +32 -0
- data/vendor/lexbor/source/lexbor/tag/config.cmake +2 -0
- data/vendor/lexbor/source/lexbor/tag/const.h +225 -0
- data/vendor/lexbor/source/lexbor/tag/res.h +562 -0
- data/vendor/lexbor/source/lexbor/tag/tag.c +144 -0
- data/vendor/lexbor/source/lexbor/tag/tag.h +123 -0
- data/vendor/lexbor/source/lexbor/utils/base.h +32 -0
- data/vendor/lexbor/source/lexbor/utils/config.cmake +2 -0
- data/vendor/lexbor/source/lexbor/utils/http.c +534 -0
- data/vendor/lexbor/source/lexbor/utils/http.h +90 -0
- data/vendor/lexbor/source/lexbor/utils/utils.h +15 -0
- data/vendor/lexbor/source/lexbor/utils/warc.c +817 -0
- data/vendor/lexbor/source/lexbor/utils/warc.h +126 -0
- data/vendor/lexbor/utils/lexbor/css/selectors/pseudo.py +231 -0
- data/vendor/lexbor/utils/lexbor/css/selectors/tmp/const.h +21 -0
- data/vendor/lexbor/utils/lexbor/css/selectors/tmp/res.h +26 -0
- data/vendor/lexbor/utils/lexbor/css/syntax/definitions.py +49 -0
- data/vendor/lexbor/utils/lexbor/css/syntax/token_res.py +54 -0
- data/vendor/lexbor/utils/lexbor/css/syntax/tokenizer_code_map.py +36 -0
- data/vendor/lexbor/version +1 -0
- metadata +542 -0
@@ -0,0 +1,661 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (C) 2018-2021 Alexander Borisov
|
3
|
+
*
|
4
|
+
* Author: Alexander Borisov <borisov@lexbor.com>
|
5
|
+
*/
|
6
|
+
|
7
|
+
#include "lexbor/dom/interfaces/node.h"
|
8
|
+
#include "lexbor/dom/interfaces/attr.h"
|
9
|
+
#include "lexbor/dom/interfaces/document.h"
|
10
|
+
#include "lexbor/dom/interfaces/document_type.h"
|
11
|
+
#include "lexbor/dom/interfaces/element.h"
|
12
|
+
#include "lexbor/dom/interfaces/processing_instruction.h"
|
13
|
+
|
14
|
+
|
15
|
+
LXB_API lxb_dom_attr_data_t *
|
16
|
+
lxb_dom_attr_local_name_append(lexbor_hash_t *hash,
|
17
|
+
const lxb_char_t *name, size_t length);
|
18
|
+
|
19
|
+
LXB_API const lxb_tag_data_t *
|
20
|
+
lxb_tag_append(lexbor_hash_t *hash, lxb_tag_id_t tag_id,
|
21
|
+
const lxb_char_t *name, size_t length);
|
22
|
+
|
23
|
+
LXB_API const lxb_ns_data_t *
|
24
|
+
lxb_ns_append(lexbor_hash_t *hash, const lxb_char_t *link, size_t length);
|
25
|
+
|
26
|
+
|
27
|
+
static lexbor_action_t
|
28
|
+
lxb_dom_node_text_content_size(lxb_dom_node_t *node, void *ctx);
|
29
|
+
|
30
|
+
static lexbor_action_t
|
31
|
+
lxb_dom_node_text_content_concatenate(lxb_dom_node_t *node, void *ctx);
|
32
|
+
|
33
|
+
|
34
|
+
lxb_dom_node_t *
|
35
|
+
lxb_dom_node_interface_create(lxb_dom_document_t *document)
|
36
|
+
{
|
37
|
+
lxb_dom_node_t *element;
|
38
|
+
|
39
|
+
element = lexbor_mraw_calloc(document->mraw,
|
40
|
+
sizeof(lxb_dom_node_t));
|
41
|
+
if (element == NULL) {
|
42
|
+
return NULL;
|
43
|
+
}
|
44
|
+
|
45
|
+
element->owner_document = lxb_dom_document_owner(document);
|
46
|
+
element->type = LXB_DOM_NODE_TYPE_UNDEF;
|
47
|
+
|
48
|
+
return element;
|
49
|
+
}
|
50
|
+
|
51
|
+
lxb_dom_node_t *
|
52
|
+
lxb_dom_node_interface_clone(lxb_dom_document_t *document,
|
53
|
+
const lxb_dom_node_t *node, bool is_attr)
|
54
|
+
{
|
55
|
+
lxb_dom_node_t *new;
|
56
|
+
|
57
|
+
new = lxb_dom_node_interface_create(document);
|
58
|
+
if (new == NULL) {
|
59
|
+
return NULL;
|
60
|
+
}
|
61
|
+
|
62
|
+
if (lxb_dom_node_interface_copy(new, node, is_attr) != LXB_STATUS_OK) {
|
63
|
+
return lxb_dom_document_destroy_interface(new);
|
64
|
+
}
|
65
|
+
|
66
|
+
return new;
|
67
|
+
}
|
68
|
+
|
69
|
+
lxb_dom_node_t *
|
70
|
+
lxb_dom_node_interface_destroy(lxb_dom_node_t *node)
|
71
|
+
{
|
72
|
+
return lexbor_mraw_free(node->owner_document->mraw, node);
|
73
|
+
}
|
74
|
+
|
75
|
+
lxb_status_t
|
76
|
+
lxb_dom_node_interface_copy(lxb_dom_node_t *dst,
|
77
|
+
const lxb_dom_node_t *src, bool is_attr)
|
78
|
+
{
|
79
|
+
lxb_dom_document_t *from, *to;
|
80
|
+
const lxb_ns_data_t *ns;
|
81
|
+
const lxb_tag_data_t *tag;
|
82
|
+
const lxb_ns_prefix_data_t *prefix;
|
83
|
+
const lexbor_hash_entry_t *entry;
|
84
|
+
const lxb_dom_attr_data_t *data;
|
85
|
+
|
86
|
+
dst->type = src->type;
|
87
|
+
dst->user = src->user;
|
88
|
+
|
89
|
+
if (dst->owner_document == src->owner_document) {
|
90
|
+
dst->local_name = src->local_name;
|
91
|
+
dst->ns = src->ns;
|
92
|
+
dst->prefix = src->prefix;
|
93
|
+
|
94
|
+
return LXB_STATUS_OK;
|
95
|
+
}
|
96
|
+
|
97
|
+
from = src->owner_document;
|
98
|
+
to = dst->owner_document;
|
99
|
+
|
100
|
+
if (is_attr) {
|
101
|
+
if (src->local_name < LXB_DOM_ATTR__LAST_ENTRY) {
|
102
|
+
dst->local_name = src->local_name;
|
103
|
+
}
|
104
|
+
else {
|
105
|
+
data = lxb_dom_attr_data_by_id(from->attrs, src->local_name);
|
106
|
+
if (data == NULL) {
|
107
|
+
return LXB_STATUS_ERROR_NOT_EXISTS;
|
108
|
+
}
|
109
|
+
|
110
|
+
entry = &data->entry;
|
111
|
+
|
112
|
+
data = lxb_dom_attr_local_name_append(to->attrs,
|
113
|
+
lexbor_hash_entry_str(entry),
|
114
|
+
entry->length);
|
115
|
+
if (data == NULL) {
|
116
|
+
return LXB_STATUS_ERROR_MEMORY_ALLOCATION;
|
117
|
+
}
|
118
|
+
|
119
|
+
dst->local_name = (lxb_dom_attr_id_t) data;
|
120
|
+
}
|
121
|
+
}
|
122
|
+
else {
|
123
|
+
if (src->local_name < LXB_TAG__LAST_ENTRY) {
|
124
|
+
dst->local_name = src->local_name;
|
125
|
+
}
|
126
|
+
else {
|
127
|
+
tag = lxb_tag_data_by_id(from->tags, src->local_name);
|
128
|
+
if (tag == NULL) {
|
129
|
+
return LXB_STATUS_ERROR_NOT_EXISTS;
|
130
|
+
}
|
131
|
+
|
132
|
+
entry = &tag->entry;
|
133
|
+
|
134
|
+
tag = lxb_tag_append(to->tags, LXB_TAG__UNDEF,
|
135
|
+
lexbor_hash_entry_str(entry), entry->length);
|
136
|
+
if (tag == NULL) {
|
137
|
+
return LXB_STATUS_ERROR_MEMORY_ALLOCATION;
|
138
|
+
}
|
139
|
+
|
140
|
+
dst->local_name = (lxb_dom_attr_id_t) tag;
|
141
|
+
}
|
142
|
+
}
|
143
|
+
|
144
|
+
if (src->ns < LXB_NS__LAST_ENTRY) {
|
145
|
+
dst->ns = src->ns;
|
146
|
+
}
|
147
|
+
else {
|
148
|
+
ns = lxb_ns_data_by_id(from->ns, src->ns);
|
149
|
+
if (ns == NULL) {
|
150
|
+
return LXB_STATUS_ERROR_NOT_EXISTS;
|
151
|
+
}
|
152
|
+
|
153
|
+
entry = &ns->entry;
|
154
|
+
|
155
|
+
ns = lxb_ns_append(to->ns, lexbor_hash_entry_str(entry),
|
156
|
+
entry->length);
|
157
|
+
if (ns == NULL) {
|
158
|
+
return LXB_STATUS_ERROR_MEMORY_ALLOCATION;
|
159
|
+
}
|
160
|
+
|
161
|
+
dst->ns = (lxb_ns_id_t) ns;
|
162
|
+
}
|
163
|
+
|
164
|
+
if (src->prefix < LXB_NS__LAST_ENTRY) {
|
165
|
+
dst->prefix = src->prefix;
|
166
|
+
}
|
167
|
+
else {
|
168
|
+
prefix = lxb_ns_prefix_data_by_id(from->prefix, src->prefix);
|
169
|
+
if (prefix == NULL) {
|
170
|
+
return LXB_STATUS_ERROR_NOT_EXISTS;
|
171
|
+
}
|
172
|
+
|
173
|
+
entry = &prefix->entry;
|
174
|
+
|
175
|
+
prefix = lxb_ns_prefix_append(to->prefix, lexbor_hash_entry_str(entry),
|
176
|
+
entry->length);
|
177
|
+
if (prefix == NULL) {
|
178
|
+
return LXB_STATUS_ERROR;
|
179
|
+
}
|
180
|
+
|
181
|
+
dst->prefix = (lxb_ns_prefix_id_t) prefix;
|
182
|
+
}
|
183
|
+
|
184
|
+
return LXB_STATUS_OK;
|
185
|
+
}
|
186
|
+
|
187
|
+
lxb_dom_node_t *
|
188
|
+
lxb_dom_node_destroy(lxb_dom_node_t *node)
|
189
|
+
{
|
190
|
+
lxb_dom_node_remove(node);
|
191
|
+
|
192
|
+
return lxb_dom_document_destroy_interface(node);
|
193
|
+
}
|
194
|
+
|
195
|
+
lxb_dom_node_t *
|
196
|
+
lxb_dom_node_destroy_deep(lxb_dom_node_t *root)
|
197
|
+
{
|
198
|
+
lxb_dom_node_t *tmp;
|
199
|
+
lxb_dom_node_t *node = root;
|
200
|
+
|
201
|
+
while (node != NULL) {
|
202
|
+
if (node->first_child != NULL) {
|
203
|
+
node = node->first_child;
|
204
|
+
}
|
205
|
+
else {
|
206
|
+
while(node != root && node->next == NULL) {
|
207
|
+
tmp = node->parent;
|
208
|
+
|
209
|
+
lxb_dom_node_destroy(node);
|
210
|
+
|
211
|
+
node = tmp;
|
212
|
+
}
|
213
|
+
|
214
|
+
if (node == root) {
|
215
|
+
lxb_dom_node_destroy(node);
|
216
|
+
|
217
|
+
break;
|
218
|
+
}
|
219
|
+
|
220
|
+
tmp = node->next;
|
221
|
+
|
222
|
+
lxb_dom_node_destroy(node);
|
223
|
+
|
224
|
+
node = tmp;
|
225
|
+
}
|
226
|
+
}
|
227
|
+
|
228
|
+
return NULL;
|
229
|
+
}
|
230
|
+
|
231
|
+
lxb_dom_node_t *
|
232
|
+
lxb_dom_node_clone(lxb_dom_node_t *node, bool deep)
|
233
|
+
{
|
234
|
+
return lxb_dom_document_import_node(node->owner_document, node, deep);
|
235
|
+
}
|
236
|
+
|
237
|
+
const lxb_char_t *
|
238
|
+
lxb_dom_node_name(lxb_dom_node_t *node, size_t *len)
|
239
|
+
{
|
240
|
+
switch (node->type) {
|
241
|
+
case LXB_DOM_NODE_TYPE_ELEMENT:
|
242
|
+
return lxb_dom_element_tag_name(lxb_dom_interface_element(node),
|
243
|
+
len);
|
244
|
+
|
245
|
+
case LXB_DOM_NODE_TYPE_ATTRIBUTE:
|
246
|
+
return lxb_dom_attr_qualified_name(lxb_dom_interface_attr(node),
|
247
|
+
len);
|
248
|
+
|
249
|
+
case LXB_DOM_NODE_TYPE_TEXT:
|
250
|
+
if (len != NULL) {
|
251
|
+
*len = sizeof("#text") - 1;
|
252
|
+
}
|
253
|
+
|
254
|
+
return (const lxb_char_t *) "#text";
|
255
|
+
|
256
|
+
case LXB_DOM_NODE_TYPE_CDATA_SECTION:
|
257
|
+
if (len != NULL) {
|
258
|
+
*len = sizeof("#cdata-section") - 1;
|
259
|
+
}
|
260
|
+
|
261
|
+
return (const lxb_char_t *) "#cdata-section";
|
262
|
+
|
263
|
+
case LXB_DOM_NODE_TYPE_PROCESSING_INSTRUCTION:
|
264
|
+
return lxb_dom_processing_instruction_target(lxb_dom_interface_processing_instruction(node),
|
265
|
+
len);
|
266
|
+
|
267
|
+
case LXB_DOM_NODE_TYPE_COMMENT:
|
268
|
+
if (len != NULL) {
|
269
|
+
*len = sizeof("#comment") - 1;
|
270
|
+
}
|
271
|
+
|
272
|
+
return (const lxb_char_t *) "#comment";
|
273
|
+
|
274
|
+
case LXB_DOM_NODE_TYPE_DOCUMENT:
|
275
|
+
if (len != NULL) {
|
276
|
+
*len = sizeof("#document") - 1;
|
277
|
+
}
|
278
|
+
|
279
|
+
return (const lxb_char_t *) "#document";
|
280
|
+
|
281
|
+
case LXB_DOM_NODE_TYPE_DOCUMENT_TYPE:
|
282
|
+
return lxb_dom_document_type_name(lxb_dom_interface_document_type(node),
|
283
|
+
len);
|
284
|
+
|
285
|
+
case LXB_DOM_NODE_TYPE_DOCUMENT_FRAGMENT:
|
286
|
+
if (len != NULL) {
|
287
|
+
*len = sizeof("#document-fragment") - 1;
|
288
|
+
}
|
289
|
+
|
290
|
+
return (const lxb_char_t *) "#document-fragment";
|
291
|
+
|
292
|
+
default:
|
293
|
+
break;
|
294
|
+
}
|
295
|
+
|
296
|
+
if (len != NULL) {
|
297
|
+
*len = 0;
|
298
|
+
}
|
299
|
+
|
300
|
+
return NULL;
|
301
|
+
}
|
302
|
+
|
303
|
+
void
|
304
|
+
lxb_dom_node_insert_child(lxb_dom_node_t *to, lxb_dom_node_t *node)
|
305
|
+
{
|
306
|
+
if (to->last_child != NULL) {
|
307
|
+
to->last_child->next = node;
|
308
|
+
}
|
309
|
+
else {
|
310
|
+
to->first_child = node;
|
311
|
+
}
|
312
|
+
|
313
|
+
node->parent = to;
|
314
|
+
node->next = NULL;
|
315
|
+
node->prev = to->last_child;
|
316
|
+
|
317
|
+
to->last_child = node;
|
318
|
+
}
|
319
|
+
|
320
|
+
void
|
321
|
+
lxb_dom_node_insert_before(lxb_dom_node_t *to, lxb_dom_node_t *node)
|
322
|
+
{
|
323
|
+
if (to->prev != NULL) {
|
324
|
+
to->prev->next = node;
|
325
|
+
}
|
326
|
+
else {
|
327
|
+
if (to->parent != NULL) {
|
328
|
+
to->parent->first_child = node;
|
329
|
+
}
|
330
|
+
}
|
331
|
+
|
332
|
+
node->parent = to->parent;
|
333
|
+
node->next = to;
|
334
|
+
node->prev = to->prev;
|
335
|
+
|
336
|
+
to->prev = node;
|
337
|
+
}
|
338
|
+
|
339
|
+
void
|
340
|
+
lxb_dom_node_insert_after(lxb_dom_node_t *to, lxb_dom_node_t *node)
|
341
|
+
{
|
342
|
+
if (to->next != NULL) {
|
343
|
+
to->next->prev = node;
|
344
|
+
}
|
345
|
+
else {
|
346
|
+
if (to->parent != NULL) {
|
347
|
+
to->parent->last_child = node;
|
348
|
+
}
|
349
|
+
}
|
350
|
+
|
351
|
+
node->parent = to->parent;
|
352
|
+
node->next = to->next;
|
353
|
+
node->prev = to;
|
354
|
+
to->next = node;
|
355
|
+
}
|
356
|
+
|
357
|
+
void
|
358
|
+
lxb_dom_node_remove(lxb_dom_node_t *node)
|
359
|
+
{
|
360
|
+
if (node->parent != NULL) {
|
361
|
+
if (node->parent->first_child == node) {
|
362
|
+
node->parent->first_child = node->next;
|
363
|
+
}
|
364
|
+
|
365
|
+
if (node->parent->last_child == node) {
|
366
|
+
node->parent->last_child = node->prev;
|
367
|
+
}
|
368
|
+
}
|
369
|
+
|
370
|
+
if (node->next != NULL) {
|
371
|
+
node->next->prev = node->prev;
|
372
|
+
}
|
373
|
+
|
374
|
+
if (node->prev != NULL) {
|
375
|
+
node->prev->next = node->next;
|
376
|
+
}
|
377
|
+
|
378
|
+
node->parent = NULL;
|
379
|
+
node->next = NULL;
|
380
|
+
node->prev = NULL;
|
381
|
+
}
|
382
|
+
|
383
|
+
lxb_status_t
|
384
|
+
lxb_dom_node_replace_all(lxb_dom_node_t *parent, lxb_dom_node_t *node)
|
385
|
+
{
|
386
|
+
while (parent->first_child != NULL) {
|
387
|
+
lxb_dom_node_destroy_deep(parent->first_child);
|
388
|
+
}
|
389
|
+
|
390
|
+
lxb_dom_node_insert_child(parent, node);
|
391
|
+
|
392
|
+
return LXB_STATUS_OK;
|
393
|
+
}
|
394
|
+
|
395
|
+
void
|
396
|
+
lxb_dom_node_simple_walk(lxb_dom_node_t *root,
|
397
|
+
lxb_dom_node_simple_walker_f walker_cb, void *ctx)
|
398
|
+
{
|
399
|
+
lexbor_action_t action;
|
400
|
+
lxb_dom_node_t *node = root->first_child;
|
401
|
+
|
402
|
+
while (node != NULL) {
|
403
|
+
action = walker_cb(node, ctx);
|
404
|
+
if (action == LEXBOR_ACTION_STOP) {
|
405
|
+
return;
|
406
|
+
}
|
407
|
+
|
408
|
+
if (node->first_child != NULL && action != LEXBOR_ACTION_NEXT) {
|
409
|
+
node = node->first_child;
|
410
|
+
}
|
411
|
+
else {
|
412
|
+
while(node != root && node->next == NULL) {
|
413
|
+
node = node->parent;
|
414
|
+
}
|
415
|
+
|
416
|
+
if (node == root) {
|
417
|
+
break;
|
418
|
+
}
|
419
|
+
|
420
|
+
node = node->next;
|
421
|
+
}
|
422
|
+
}
|
423
|
+
}
|
424
|
+
|
425
|
+
lxb_char_t *
|
426
|
+
lxb_dom_node_text_content(lxb_dom_node_t *node, size_t *len)
|
427
|
+
{
|
428
|
+
lxb_char_t *text;
|
429
|
+
size_t length = 0;
|
430
|
+
|
431
|
+
switch (node->type) {
|
432
|
+
case LXB_DOM_NODE_TYPE_DOCUMENT_FRAGMENT:
|
433
|
+
case LXB_DOM_NODE_TYPE_ELEMENT:
|
434
|
+
lxb_dom_node_simple_walk(node, lxb_dom_node_text_content_size,
|
435
|
+
&length);
|
436
|
+
|
437
|
+
text = lxb_dom_document_create_text(node->owner_document,
|
438
|
+
(length + 1));
|
439
|
+
if (text == NULL) {
|
440
|
+
goto failed;
|
441
|
+
}
|
442
|
+
|
443
|
+
lxb_dom_node_simple_walk(node, lxb_dom_node_text_content_concatenate,
|
444
|
+
&text);
|
445
|
+
|
446
|
+
text -= length;
|
447
|
+
|
448
|
+
break;
|
449
|
+
|
450
|
+
case LXB_DOM_NODE_TYPE_ATTRIBUTE: {
|
451
|
+
const lxb_char_t *attr_text;
|
452
|
+
|
453
|
+
attr_text = lxb_dom_attr_value(lxb_dom_interface_attr(node), &length);
|
454
|
+
if (attr_text == NULL) {
|
455
|
+
goto failed;
|
456
|
+
}
|
457
|
+
|
458
|
+
text = lxb_dom_document_create_text(node->owner_document,
|
459
|
+
(length + 1));
|
460
|
+
if (text == NULL) {
|
461
|
+
goto failed;
|
462
|
+
}
|
463
|
+
|
464
|
+
/* +1 == with null '\0' */
|
465
|
+
memcpy(text, attr_text, sizeof(lxb_char_t) * (length + 1));
|
466
|
+
|
467
|
+
break;
|
468
|
+
}
|
469
|
+
|
470
|
+
case LXB_DOM_NODE_TYPE_TEXT:
|
471
|
+
case LXB_DOM_NODE_TYPE_PROCESSING_INSTRUCTION:
|
472
|
+
case LXB_DOM_NODE_TYPE_COMMENT: {
|
473
|
+
lxb_dom_character_data_t *ch_data;
|
474
|
+
|
475
|
+
ch_data = lxb_dom_interface_character_data(node);
|
476
|
+
length = ch_data->data.length;
|
477
|
+
|
478
|
+
text = lxb_dom_document_create_text(node->owner_document,
|
479
|
+
(length + 1));
|
480
|
+
if (text == NULL) {
|
481
|
+
goto failed;
|
482
|
+
}
|
483
|
+
|
484
|
+
/* +1 == with null '\0' */
|
485
|
+
memcpy(text, ch_data->data.data, sizeof(lxb_char_t) * (length + 1));
|
486
|
+
|
487
|
+
break;
|
488
|
+
}
|
489
|
+
|
490
|
+
default:
|
491
|
+
goto failed;
|
492
|
+
}
|
493
|
+
|
494
|
+
if (len != NULL) {
|
495
|
+
*len = length;
|
496
|
+
}
|
497
|
+
|
498
|
+
text[length] = 0x00;
|
499
|
+
|
500
|
+
return text;
|
501
|
+
|
502
|
+
failed:
|
503
|
+
|
504
|
+
if (len != NULL) {
|
505
|
+
*len = 0;
|
506
|
+
}
|
507
|
+
|
508
|
+
return NULL;
|
509
|
+
}
|
510
|
+
|
511
|
+
static lexbor_action_t
|
512
|
+
lxb_dom_node_text_content_size(lxb_dom_node_t *node, void *ctx)
|
513
|
+
{
|
514
|
+
if (node->type == LXB_DOM_NODE_TYPE_TEXT) {
|
515
|
+
*((size_t *) ctx) += lxb_dom_interface_text(node)->char_data.data.length;
|
516
|
+
}
|
517
|
+
|
518
|
+
return LEXBOR_ACTION_OK;
|
519
|
+
}
|
520
|
+
|
521
|
+
static lexbor_action_t
|
522
|
+
lxb_dom_node_text_content_concatenate(lxb_dom_node_t *node, void *ctx)
|
523
|
+
{
|
524
|
+
if (node->type != LXB_DOM_NODE_TYPE_TEXT) {
|
525
|
+
return LEXBOR_ACTION_OK;
|
526
|
+
}
|
527
|
+
|
528
|
+
lxb_char_t **text = (lxb_char_t **) ctx;
|
529
|
+
lxb_dom_character_data_t *ch_data = &lxb_dom_interface_text(node)->char_data;
|
530
|
+
|
531
|
+
memcpy(*text, ch_data->data.data, sizeof(lxb_char_t) * ch_data->data.length);
|
532
|
+
|
533
|
+
*text = *text + ch_data->data.length;
|
534
|
+
|
535
|
+
return LEXBOR_ACTION_OK;
|
536
|
+
}
|
537
|
+
|
538
|
+
lxb_status_t
|
539
|
+
lxb_dom_node_text_content_set(lxb_dom_node_t *node,
|
540
|
+
const lxb_char_t *content, size_t len)
|
541
|
+
{
|
542
|
+
lxb_status_t status;
|
543
|
+
|
544
|
+
switch (node->type) {
|
545
|
+
case LXB_DOM_NODE_TYPE_DOCUMENT_FRAGMENT:
|
546
|
+
case LXB_DOM_NODE_TYPE_ELEMENT: {
|
547
|
+
lxb_dom_text_t *text;
|
548
|
+
|
549
|
+
text = lxb_dom_document_create_text_node(node->owner_document,
|
550
|
+
content, len);
|
551
|
+
if (text == NULL) {
|
552
|
+
return LXB_STATUS_ERROR_MEMORY_ALLOCATION;
|
553
|
+
}
|
554
|
+
|
555
|
+
status = lxb_dom_node_replace_all(node, lxb_dom_interface_node(text));
|
556
|
+
if (status != LXB_STATUS_OK) {
|
557
|
+
lxb_dom_document_destroy_interface(text);
|
558
|
+
|
559
|
+
return status;
|
560
|
+
}
|
561
|
+
|
562
|
+
break;
|
563
|
+
}
|
564
|
+
|
565
|
+
case LXB_DOM_NODE_TYPE_ATTRIBUTE:
|
566
|
+
return lxb_dom_attr_set_existing_value(lxb_dom_interface_attr(node),
|
567
|
+
content, len);
|
568
|
+
|
569
|
+
case LXB_DOM_NODE_TYPE_TEXT:
|
570
|
+
case LXB_DOM_NODE_TYPE_PROCESSING_INSTRUCTION:
|
571
|
+
case LXB_DOM_NODE_TYPE_COMMENT:
|
572
|
+
return lxb_dom_character_data_replace(lxb_dom_interface_character_data(node),
|
573
|
+
content, len, 0, 0);
|
574
|
+
|
575
|
+
default:
|
576
|
+
return LXB_STATUS_OK;
|
577
|
+
}
|
578
|
+
|
579
|
+
return LXB_STATUS_OK;
|
580
|
+
}
|
581
|
+
|
582
|
+
bool
|
583
|
+
lxb_dom_node_is_empty(lxb_dom_node_t *root)
|
584
|
+
{
|
585
|
+
lxb_char_t chr;
|
586
|
+
lexbor_str_t *str;
|
587
|
+
const lxb_char_t *data, *end;
|
588
|
+
lxb_dom_node_t *node = root->first_child;
|
589
|
+
|
590
|
+
while (node != NULL) {
|
591
|
+
if(node->local_name != LXB_TAG__EM_COMMENT) {
|
592
|
+
if(node->local_name != LXB_TAG__TEXT)
|
593
|
+
return false;
|
594
|
+
|
595
|
+
str = &lxb_dom_interface_text(node)->char_data.data;
|
596
|
+
data = str->data;
|
597
|
+
end = data + str->length;
|
598
|
+
|
599
|
+
while (data < end) {
|
600
|
+
chr = *data++;
|
601
|
+
|
602
|
+
if (lexbor_utils_whitespace(chr, !=, &&)) {
|
603
|
+
return false;
|
604
|
+
}
|
605
|
+
}
|
606
|
+
}
|
607
|
+
|
608
|
+
if(node->first_child != NULL) {
|
609
|
+
node = node->first_child;
|
610
|
+
}
|
611
|
+
else {
|
612
|
+
while(node != root && node->next == NULL) {
|
613
|
+
node = node->parent;
|
614
|
+
}
|
615
|
+
|
616
|
+
if(node == root) {
|
617
|
+
break;
|
618
|
+
}
|
619
|
+
|
620
|
+
node = node->next;
|
621
|
+
}
|
622
|
+
}
|
623
|
+
|
624
|
+
return true;
|
625
|
+
}
|
626
|
+
|
627
|
+
lxb_tag_id_t
|
628
|
+
lxb_dom_node_tag_id_noi(lxb_dom_node_t *node)
|
629
|
+
{
|
630
|
+
return lxb_dom_node_tag_id(node);
|
631
|
+
}
|
632
|
+
|
633
|
+
lxb_dom_node_t *
|
634
|
+
lxb_dom_node_next_noi(lxb_dom_node_t *node)
|
635
|
+
{
|
636
|
+
return lxb_dom_node_next(node);
|
637
|
+
}
|
638
|
+
|
639
|
+
lxb_dom_node_t *
|
640
|
+
lxb_dom_node_prev_noi(lxb_dom_node_t *node)
|
641
|
+
{
|
642
|
+
return lxb_dom_node_prev(node);
|
643
|
+
}
|
644
|
+
|
645
|
+
lxb_dom_node_t *
|
646
|
+
lxb_dom_node_parent_noi(lxb_dom_node_t *node)
|
647
|
+
{
|
648
|
+
return lxb_dom_node_parent(node);
|
649
|
+
}
|
650
|
+
|
651
|
+
lxb_dom_node_t *
|
652
|
+
lxb_dom_node_first_child_noi(lxb_dom_node_t *node)
|
653
|
+
{
|
654
|
+
return lxb_dom_node_first_child(node);
|
655
|
+
}
|
656
|
+
|
657
|
+
lxb_dom_node_t *
|
658
|
+
lxb_dom_node_last_child_noi(lxb_dom_node_t *node)
|
659
|
+
{
|
660
|
+
return lxb_dom_node_last_child(node);
|
661
|
+
}
|