Branch Coverage

DOM.xs
Criterion Covered Total %
branch 728 2284 31.8


line true false branch
66 171 160 while (node) {
67 162 9 if (node->tag_id == MyHTML_TAG__TEXT) {
70 162 0 if (text_len)
72 9 0 } else if (node_is_element(node)) {
9 0 } else if (node_is_element(node)) {
6 3 } else if (node_is_element(node)) {
6 0 } else if (node_is_element(node)) {
82 2 127 if (tree_obj)
108 1065 181 if (node->tag_id != MyHTML_TAG__UNDEF) {
109 84 981 if (node->tag_id == MyHTML_TAG__TEXT) {
111 32 949 } else if (node->tag_id == MyHTML_TAG__COMMENT) {
113 175 774 } else if (node->tag_id == MyHTML_TAG__DOCTYPE) {
115 109 665 } else if (context->fragment_tag_id && node->tag_id == context->fragment_tag_id) {
14 95 } else if (context->fragment_tag_id && node->tag_id == context->fragment_tag_id) {
122 181 0 if (node_is_document(node))
181 0 if (node_is_document(node))
130 582 0 if (!context || !context->utf8) {
579 3 if (!context || !context->utf8) {
140 179 0 if (!selector || !selector->utf8) {
176 3 if (!selector || !selector->utf8) {
160 16 1377 if (!node)
164 1246 131 if (!sv) {
184 177 8 if (collection) {
185 229 177 for (int i = 0; i < collection->length; ++i)
192 0 848 if (SvROK(sv)) {
194 0 0 if (SvOBJECT(tmp_sv)) {
198 0 0 if (to_string) {
200 0 0 ENTER; SAVETMPS; PUSHMARK(SP);
201 0 0 XPUSHs(sv_bless(sv_2mortal(newRV_inc(tmp_sv)), stash));
209 0 0 FREETMPS; LEAVE;
227 0 108 if (combinator) {
231 0 0 const char *combo = SvPV_const(combinator, combo_len);
233 0 0 if (combo_len > 0)
237 0 108 if (SvROK(query)) {
238 0 0 if (sv_derived_from(query, "HTML5::DOM::CSS::Selector")) { // Precompiler selectors
239 0 0 html5_css_selector_t *selector = INT2PTR(html5_css_selector_t *, SvIV((SV*)SvRV(query)));
242 0 0 } else if (sv_derived_from(query, "HTML5::DOM::CSS::Selector::Entry")) { // One precompiled selector
243 0 0 html5_css_selector_entry_t *selector = INT2PTR(html5_css_selector_entry_t *, SvIV((SV*)SvRV(query)));
247 0 0 sub_croak(cv, "%s: %s is not of type %s or %s", "HTML5::DOM::Tree::find", "query", "HTML5::DOM::CSS::Selector", "HTML5::DOM::CSS::Selector::Entry");
0 0 sub_croak(cv, "%s: %s is not of type %s or %s", "HTML5::DOM::Tree::find", "query", "HTML5::DOM::CSS::Selector", "HTML5::DOM::CSS::Selector::Entry");
0 0 sub_croak(cv, "%s: %s is not of type %s or %s", "HTML5::DOM::Tree::find", "query", "HTML5::DOM::CSS::Selector", "HTML5::DOM::CSS::Selector::Entry");
0 0 sub_croak(cv, "%s: %s is not of type %s or %s", "HTML5::DOM::Tree::find", "query", "HTML5::DOM::CSS::Selector", "HTML5::DOM::CSS::Selector::Entry");
0 0 sub_croak(cv, "%s: %s is not of type %s or %s", "HTML5::DOM::Tree::find", "query", "HTML5::DOM::CSS::Selector", "HTML5::DOM::CSS::Selector::Entry");
0 0 sub_croak(cv, "%s: %s is not of type %s or %s", "HTML5::DOM::Tree::find", "query", "HTML5::DOM::CSS::Selector", "HTML5::DOM::CSS::Selector::Entry");
0 0 sub_croak(cv, "%s: %s is not of type %s or %s", "HTML5::DOM::Tree::find", "query", "HTML5::DOM::CSS::Selector", "HTML5::DOM::CSS::Selector::Entry");
0 0 sub_croak(cv, "%s: %s is not of type %s or %s", "HTML5::DOM::Tree::find", "query", "HTML5::DOM::CSS::Selector", "HTML5::DOM::CSS::Selector::Entry");
0 0 sub_croak(cv, "%s: %s is not of type %s or %s", "HTML5::DOM::Tree::find", "query", "HTML5::DOM::CSS::Selector", "HTML5::DOM::CSS::Selector::Entry");
0 0 sub_croak(cv, "%s: %s is not of type %s or %s", "HTML5::DOM::Tree::find", "query", "HTML5::DOM::CSS::Selector", "HTML5::DOM::CSS::Selector::Entry");
0 0 sub_croak(cv, "%s: %s is not of type %s or %s", "HTML5::DOM::Tree::find", "query", "HTML5::DOM::CSS::Selector", "HTML5::DOM::CSS::Selector::Entry");
254 108 0 const char *query_str = SvPV_const(query, query_len);
257 0 108 if (status)
258 0 0 sub_croak(cv, "mycss_init failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "mycss_init failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "mycss_init failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "mycss_init failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "mycss_init failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "mycss_init failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "mycss_init failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "mycss_init failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "mycss_init failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "mycss_init failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "mycss_init failed: %d (%s)", status, modest_strerror(status));
262 0 108 if (!selector)
263 0 0 sub_croak(cv, "bad selector: %s", query_str);
0 0 sub_croak(cv, "bad selector: %s", query_str);
0 0 sub_croak(cv, "bad selector: %s", query_str);
0 0 sub_croak(cv, "bad selector: %s", query_str);
0 0 sub_croak(cv, "bad selector: %s", query_str);
0 0 sub_croak(cv, "bad selector: %s", query_str);
0 0 sub_croak(cv, "bad selector: %s", query_str);
0 0 sub_croak(cv, "bad selector: %s", query_str);
0 0 sub_croak(cv, "bad selector: %s", query_str);
0 0 sub_croak(cv, "bad selector: %s", query_str);
0 0 sub_croak(cv, "bad selector: %s", query_str);
269 71 37 if (one) { // search one element
275 37 0 if (collection)
280 108 0 if (selector)
287 0 160 if (!self)
294 160 0 const char *key_str = SvPV_const(key, key_len);
308 12 0 if (collection && collection->length)
8 4 if (collection && collection->length)
312 96 0 if (val) {
314 96 0 const char *val_str = SvPV_const(val, val_len);
317 96 0 if (cmp) {
320 96 0 const char *cmp_str = SvPV_const(cmp, cmp_len);
322 96 0 if (cmp_len)
326 16 80 if (cmp_type == '=') {
329 16 64 } else if (cmp_type == '~') {
332 16 48 } else if (cmp_type == '^') {
335 16 32 } else if (cmp_type == '$') {
338 16 16 } else if (cmp_type == '*') {
341 16 0 } else if (cmp_type == '|') {
345 0 0 sub_croak(cv, "unknown cmp type: %c", cmp_type);
0 0 sub_croak(cv, "unknown cmp type: %c", cmp_type);
0 0 sub_croak(cv, "unknown cmp type: %c", cmp_type);
0 0 sub_croak(cv, "unknown cmp type: %c", cmp_type);
0 0 sub_croak(cv, "unknown cmp type: %c", cmp_type);
0 0 sub_croak(cv, "unknown cmp type: %c", cmp_type);
0 0 sub_croak(cv, "unknown cmp type: %c", cmp_type);
0 0 sub_croak(cv, "unknown cmp type: %c", cmp_type);
0 0 sub_croak(cv, "unknown cmp type: %c", cmp_type);
0 0 sub_croak(cv, "unknown cmp type: %c", cmp_type);
0 0 sub_croak(cv, "unknown cmp type: %c", cmp_type);
355 152 8 if (collection)
362 231 1862 if (hv) {
364 10 221 if (sv && *sv)
10 0 if (sv && *sv)
365 10 0 return SvIV(*sv);
371 66 532 if (hv) {
373 15 51 if (sv && *sv) {
15 0 if (sv && *sv) {
377 15 0 const char *enc_str = SvPV_const(encoding, enc_length);
379 15 0 if (enc_length > 0) {
381 0 15 if (isdigit(enc_str[0])) { // May be encoding id
382 0 0 enc_id = SvIV(encoding);
383 0 0 if (enc_id == MyENCODING_AUTO || enc_id == MyENCODING_DEFAULT || enc_id == MyENCODING_NOT_DETERMINED)
0 0 if (enc_id == MyENCODING_AUTO || enc_id == MyENCODING_DEFAULT || enc_id == MyENCODING_NOT_DETERMINED)
0 0 if (enc_id == MyENCODING_AUTO || enc_id == MyENCODING_DEFAULT || enc_id == MyENCODING_NOT_DETERMINED)
385 0 0 if (!myencoding_name_by_id(enc_id, NULL))
388 0 15 if (!myencoding_by_name(enc_str, enc_length, &enc_id)) {
389 0 0 if (enc_length == 4 && strcasecmp(enc_str, "auto") == 0)
0 0 if (enc_length == 4 && strcasecmp(enc_str, "auto") == 0)
391 0 0 if (enc_length == 7 && strcasecmp(enc_str, "default") == 0)
0 0 if (enc_length == 7 && strcasecmp(enc_str, "default") == 0)
404 33 266 if (hv) {
406 8 25 if (sv && *sv) {
8 0 if (sv && *sv) {
410 4 4 const char *enc_str = SvPV_const(encoding, enc_length);
412 8 0 if (enc_length > 0) {
413 4 4 if (isdigit(enc_str[0])) {
414 4 0 return SvIV(encoding) != 0;
415 4 0 } else if (length == 4 && strcasecmp(enc_str, "auto") == 0) {
4 0 } else if (length == 4 && strcasecmp(enc_str, "auto") == 0) {
426 166 133 opts->threads = hv_get_int_value(options, "threads", 7, extend ? extend->threads : 0);
427 166 133 opts->ignore_whitespace = hv_get_int_value(options, "ignore_whitespace", 17, extend ? extend->ignore_whitespace : 0) > 0;
428 166 133 opts->ignore_doctype = hv_get_int_value(options, "ignore_doctype", 14, extend ? extend->ignore_doctype : 0) > 0;
429 166 133 opts->scripts = hv_get_int_value(options, "scripts", 7, extend ? extend->scripts : 0) > 0;
430 166 133 opts->encoding = hv_get_encoding_value(options, "encoding", 8, extend ? extend->encoding : MyENCODING_AUTO);
431 166 133 opts->default_encoding = hv_get_encoding_value(options, "default_encoding", 16, extend ? extend->default_encoding : MyENCODING_DEFAULT);
432 166 133 opts->encoding_use_meta = hv_get_int_value(options, "encoding_use_meta", 17, extend ? extend->encoding_use_meta : 1) > 0;
433 166 133 opts->encoding_use_bom = hv_get_int_value(options, "encoding_use_bom", 16, extend ? extend->encoding_use_bom : 1) > 0;
434 166 133 opts->encoding_prescan_limit = hv_get_int_value(options, "encoding_prescan_limit", 22, extend ? extend->encoding_prescan_limit : 1024);
435 166 133 opts->utf8 = hv_get_utf8_value(options, "utf8", 4, extend ? extend->utf8 : 2);
443 0 249 if (opts->encoding == MyENCODING_NOT_DETERMINED)
444 0 0 sub_croak(cv, "invalid encoding value");
0 0 sub_croak(cv, "invalid encoding value");
0 0 sub_croak(cv, "invalid encoding value");
0 0 sub_croak(cv, "invalid encoding value");
0 0 sub_croak(cv, "invalid encoding value");
0 0 sub_croak(cv, "invalid encoding value");
0 0 sub_croak(cv, "invalid encoding value");
0 0 sub_croak(cv, "invalid encoding value");
0 0 sub_croak(cv, "invalid encoding value");
0 0 sub_croak(cv, "invalid encoding value");
0 0 sub_croak(cv, "invalid encoding value");
445 249 0 if (opts->default_encoding == MyENCODING_NOT_DETERMINED || opts->default_encoding == MyENCODING_AUTO)
0 249 if (opts->default_encoding == MyENCODING_NOT_DETERMINED || opts->default_encoding == MyENCODING_AUTO)
446 0 0 sub_croak(cv, "invalid default_encoding value");
0 0 sub_croak(cv, "invalid default_encoding value");
0 0 sub_croak(cv, "invalid default_encoding value");
0 0 sub_croak(cv, "invalid default_encoding value");
0 0 sub_croak(cv, "invalid default_encoding value");
0 0 sub_croak(cv, "invalid default_encoding value");
0 0 sub_croak(cv, "invalid default_encoding value");
0 0 sub_croak(cv, "invalid default_encoding value");
0 0 sub_croak(cv, "invalid default_encoding value");
0 0 sub_croak(cv, "invalid default_encoding value");
0 0 sub_croak(cv, "invalid default_encoding value");
447 0 249 if (opts->threads < 0)
448 0 0 sub_croak(cv, "invalid threads count");
0 0 sub_croak(cv, "invalid threads count");
0 0 sub_croak(cv, "invalid threads count");
0 0 sub_croak(cv, "invalid threads count");
0 0 sub_croak(cv, "invalid threads count");
0 0 sub_croak(cv, "invalid threads count");
0 0 sub_croak(cv, "invalid threads count");
0 0 sub_croak(cv, "invalid threads count");
0 0 sub_croak(cv, "invalid threads count");
0 0 sub_croak(cv, "invalid threads count");
0 0 sub_croak(cv, "invalid threads count");
449 0 249 if (opts->encoding_prescan_limit < 0)
450 0 0 sub_croak(cv, "invalid encoding_prescan_limit value");
0 0 sub_croak(cv, "invalid encoding_prescan_limit value");
0 0 sub_croak(cv, "invalid encoding_prescan_limit value");
0 0 sub_croak(cv, "invalid encoding_prescan_limit value");
0 0 sub_croak(cv, "invalid encoding_prescan_limit value");
0 0 sub_croak(cv, "invalid encoding_prescan_limit value");
0 0 sub_croak(cv, "invalid encoding_prescan_limit value");
0 0 sub_croak(cv, "invalid encoding_prescan_limit value");
0 0 sub_croak(cv, "invalid encoding_prescan_limit value");
0 0 sub_croak(cv, "invalid encoding_prescan_limit value");
0 0 sub_croak(cv, "invalid encoding_prescan_limit value");
457 1 1 while (selector) {
458 5 1 for (size_t i = 0; i < selector->entries_list_length; ++i) {
495 17 6 while (entry) {
496 4 13 if (entry->combinator != MyCSS_SELECTORS_COMBINATOR_UNDEF) {
505 0 17 if ((selector->flags) & MyCSS_SELECTORS_FLAGS_SELECTOR_BAD)
533 14 0 if (entry->key)
534 14 0 hv_store_ent(data, sv_2mortal(newSVpv_utf8_auto_css(self, "value", 5)), newSVpv_utf8_auto_css(self, entry->key->length ? entry->key->data : "", entry->key->length), 0);
542 2 0 if (entry->key)
543 2 0 hv_store_ent(data, sv_2mortal(newSVpv_utf8_auto_css(self, "name", 4)), newSVpv_utf8_auto_css(self, entry->key->length ? entry->key->data : "", entry->key->length), 0);
546 2 0 if (mycss_selector_value_attribute(entry->value)->value) {
548 2 0 hv_store_ent(data, sv_2mortal(newSVpv_utf8_auto_css(self, "value", 5)), newSVpv_utf8_auto_css(self, str_value->length ? str_value->data : "", str_value->length), 0);
558 0 2 if (mycss_selector_value_attribute(entry->value)->mod & MyCSS_SELECTORS_MOD_I) {
612 0 1 if (a_plus_b->of) {
623 0 0 if (entry->value) {
625 0 0 hv_store_ent(data, sv_2mortal(newSVpv_utf8_auto_css(self, "value", 5)), newSVpv_utf8_auto_css(self, str_fname->length ? str_fname->data : "", str_fname->length), 0);
638 0 0 if (drop_val & MyCSS_SELECTORS_FUNCTION_DROP_TYPE_ACTIVE)
640 0 0 if (drop_val & MyCSS_SELECTORS_FUNCTION_DROP_TYPE_VALID)
642 0 0 if (drop_val & MyCSS_SELECTORS_FUNCTION_DROP_TYPE_INVALID)
652 0 0 if (entry->value) {
654 0 0 while (lang) {
655 0 0 av_push(langs, newSVpv_utf8_auto_css(self, lang->str.length ? lang->str.data : "", lang->str.length));
692 8 0 if (result->opts.utf8 == 2)
698 8 0 const char *html_str = SvPV_const(html, html_len);
710 0 8 if (status) {
714 0 0 sub_croak(cv, "mythread_init failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "mythread_init failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "mythread_init failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "mythread_init failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "mythread_init failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "mythread_init failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "mythread_init failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "mythread_init failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "mythread_init failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "mythread_init failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "mythread_init failed: %d (%s)", status, modest_strerror(status));
723 0 8 if (status) {
727 0 0 sub_croak(cv, "myhread_entry_create failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhread_entry_create failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhread_entry_create failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhread_entry_create failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhread_entry_create failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhread_entry_create failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhread_entry_create failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhread_entry_create failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhread_entry_create failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhread_entry_create failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhread_entry_create failed: %d (%s)", status, modest_strerror(status));
734 0 8 if (status) {
738 0 0 sub_croak(cv, "mythread_resume failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "mythread_resume failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "mythread_resume failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "mythread_resume failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "mythread_resume failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "mythread_resume failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "mythread_resume failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "mythread_resume failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "mythread_resume failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "mythread_resume failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "mythread_resume failed: %d (%s)", status, modest_strerror(status));
750 2 6 if (!wait && !result->done)
0 2 if (!wait && !result->done)
754 6 2 if (result->thread)
758 6 2 if (result->html) {
763 0 8 if (result->status) {
764 0 0 sub_croak(cv, "parse failed: %d (%s)", result->status, modest_strerror(result->status));
0 0 sub_croak(cv, "parse failed: %d (%s)", result->status, modest_strerror(result->status));
0 0 sub_croak(cv, "parse failed: %d (%s)", result->status, modest_strerror(result->status));
0 0 sub_croak(cv, "parse failed: %d (%s)", result->status, modest_strerror(result->status));
0 0 sub_croak(cv, "parse failed: %d (%s)", result->status, modest_strerror(result->status));
0 0 sub_croak(cv, "parse failed: %d (%s)", result->status, modest_strerror(result->status));
0 0 sub_croak(cv, "parse failed: %d (%s)", result->status, modest_strerror(result->status));
0 0 sub_croak(cv, "parse failed: %d (%s)", result->status, modest_strerror(result->status));
0 0 sub_croak(cv, "parse failed: %d (%s)", result->status, modest_strerror(result->status));
0 0 sub_croak(cv, "parse failed: %d (%s)", result->status, modest_strerror(result->status));
0 0 sub_croak(cv, "parse failed: %d (%s)", result->status, modest_strerror(result->status));
768 6 2 if (result->tree) {
776 8 0 return result->tree_sv ? SvREFCNT_inc((SV *) result->tree_sv) : &PL_sv_undef;
798 104 3 if (self->opts.threads <= 1) {
804 0 107 if (status) {
806 0 0 sub_croak(cv, "myhtml_init failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_init failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_init failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_init failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_init failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_init failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_init failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_init failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_init failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_init failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_init failed: %d (%s)", status, modest_strerror(status));
822 0 2 if (self->tree) {
823 0 0 if (self->tree->context) {
835 0 2 if (status) {
837 0 0 sub_croak(cv, "myhtml_tree_init failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_tree_init failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_tree_init failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_tree_init failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_tree_init failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_tree_init failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_tree_init failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_tree_init failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_tree_init failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_tree_init failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_tree_init failed: %d (%s)", status, modest_strerror(status));
841 2 0 myhtml_encoding_set(self->tree, self->chunk_opts.encoding == MyENCODING_AUTO ? self->chunk_opts.default_encoding : self->chunk_opts.encoding);
855 0 5 if (!self->tree) {
858 0 0 if (status) {
860 0 0 sub_croak(cv, "myhtml_tree_init failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_tree_init failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_tree_init failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_tree_init failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_tree_init failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_tree_init failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_tree_init failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_tree_init failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_tree_init failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_tree_init failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_tree_init failed: %d (%s)", status, modest_strerror(status));
863 0 0 myhtml_encoding_set(self->tree, self->chunk_opts.encoding == MyENCODING_AUTO ? self->chunk_opts.default_encoding : self->chunk_opts.encoding);
868 5 0 const char *html_str = SvPV_const(html, html_length);
871 2 3 if (!self->chunks) {
875 2 0 if (self->chunk_opts.utf8 == 2)
884 0 5 if (status) {
885 0 0 if (!self->tree->context)
887 0 0 sub_croak(cv, "myhtml_parse_chunk failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_parse_chunk failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_parse_chunk failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_parse_chunk failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_parse_chunk failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_parse_chunk failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_parse_chunk failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_parse_chunk failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_parse_chunk failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_parse_chunk failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_parse_chunk failed: %d (%s)", status, modest_strerror(status));
900 0 3 if (!self->tree)
901 0 0 sub_croak(cv, "call parseChunkStart or parseChunk first");
0 0 sub_croak(cv, "call parseChunkStart or parseChunk first");
0 0 sub_croak(cv, "call parseChunkStart or parseChunk first");
0 0 sub_croak(cv, "call parseChunkStart or parseChunk first");
0 0 sub_croak(cv, "call parseChunkStart or parseChunk first");
0 0 sub_croak(cv, "call parseChunkStart or parseChunk first");
0 0 sub_croak(cv, "call parseChunkStart or parseChunk first");
0 0 sub_croak(cv, "call parseChunkStart or parseChunk first");
0 0 sub_croak(cv, "call parseChunkStart or parseChunk first");
0 0 sub_croak(cv, "call parseChunkStart or parseChunk first");
0 0 sub_croak(cv, "call parseChunkStart or parseChunk first");
913 0 2 if (!self->tree)
914 0 0 sub_croak(cv, "call parseChunkStart or parseChunk first");
0 0 sub_croak(cv, "call parseChunkStart or parseChunk first");
0 0 sub_croak(cv, "call parseChunkStart or parseChunk first");
0 0 sub_croak(cv, "call parseChunkStart or parseChunk first");
0 0 sub_croak(cv, "call parseChunkStart or parseChunk first");
0 0 sub_croak(cv, "call parseChunkStart or parseChunk first");
0 0 sub_croak(cv, "call parseChunkStart or parseChunk first");
0 0 sub_croak(cv, "call parseChunkStart or parseChunk first");
0 0 sub_croak(cv, "call parseChunkStart or parseChunk first");
0 0 sub_croak(cv, "call parseChunkStart or parseChunk first");
0 0 sub_croak(cv, "call parseChunkStart or parseChunk first");
917 0 2 if (status) {
918 0 0 if (!self->tree->context)
920 0 0 sub_croak(cv, "myhtml_parse_chunk failed:%d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_parse_chunk failed:%d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_parse_chunk failed:%d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_parse_chunk failed:%d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_parse_chunk failed:%d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_parse_chunk failed:%d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_parse_chunk failed:%d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_parse_chunk failed:%d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_parse_chunk failed:%d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_parse_chunk failed:%d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_parse_chunk failed:%d (%s)", status, modest_strerror(status));
923 2 0 if (self->tree) {
947 0 118 if (status) {
949 0 0 sub_croak(cv, "myhtml_tree_init failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_tree_init failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_tree_init failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_tree_init failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_tree_init failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_tree_init failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_tree_init failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_tree_init failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_tree_init failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_tree_init failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_tree_init failed: %d (%s)", status, modest_strerror(status));
953 118 0 const char *html_str = SvPV_const(html, html_length);
958 114 4 if (opts.utf8 == 2)
964 0 118 if (status) {
966 0 0 sub_croak(cv, "myhtml_parse failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_parse failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_parse failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_parse failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_parse failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_parse failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_parse failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_parse failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_parse failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_parse failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_parse failed: %d (%s)", status, modest_strerror(status));
1024 2 6 if (self->thread)
1027 2 6 if (self->tree) {
1030 2 0 if (self->parser)
1034 6 2 if (self->tree_sv)
1037 2 6 if (self->html)
1059 2 34 if (ns_name) {
1062 2 0 const char *ns_name_str = SvPV_const(ns_name, ns_name_len);
1063 0 2 if (!myhtml_namespace_id_by_name(ns_name_str, ns_name_len, &ns))
1064 0 0 sub_croak(cv, "unknown namespace: %s", ns_name_str);
0 0 sub_croak(cv, "unknown namespace: %s", ns_name_str);
0 0 sub_croak(cv, "unknown namespace: %s", ns_name_str);
0 0 sub_croak(cv, "unknown namespace: %s", ns_name_str);
0 0 sub_croak(cv, "unknown namespace: %s", ns_name_str);
0 0 sub_croak(cv, "unknown namespace: %s", ns_name_str);
0 0 sub_croak(cv, "unknown namespace: %s", ns_name_str);
0 0 sub_croak(cv, "unknown namespace: %s", ns_name_str);
0 0 sub_croak(cv, "unknown namespace: %s", ns_name_str);
0 0 sub_croak(cv, "unknown namespace: %s", ns_name_str);
0 0 sub_croak(cv, "unknown namespace: %s", ns_name_str);
1070 36 0 const char *tag_str = SvPV_const(tag, tag_len);
1077 1 35 if (myhtml_node_is_void_element(node)) {
1078 1 0 if (!node->token) {
1080 0 1 if (!node->token) {
1082 0 0 sub_croak(cv, "myhtml_token_node_create failed");
0 0 sub_croak(cv, "myhtml_token_node_create failed");
0 0 sub_croak(cv, "myhtml_token_node_create failed");
0 0 sub_croak(cv, "myhtml_token_node_create failed");
0 0 sub_croak(cv, "myhtml_token_node_create failed");
0 0 sub_croak(cv, "myhtml_token_node_create failed");
0 0 sub_croak(cv, "myhtml_token_node_create failed");
0 0 sub_croak(cv, "myhtml_token_node_create failed");
0 0 sub_croak(cv, "myhtml_token_node_create failed");
0 0 sub_croak(cv, "myhtml_token_node_create failed");
0 0 sub_croak(cv, "myhtml_token_node_create failed");
1097 6 0 const char *text_str = SvPV_const(text, text_len);
1109 6 0 const char *text_str = SvPV_const(text, text_len);
1121 14 0 const char *text_str = SvPV_const(text, text_len);
1127 0 14 if (ns) {
1130 0 0 const char *ns_str = SvPV_const(ns, ns_len);
1132 0 0 if (!myhtml_namespace_id_by_name(ns_str, ns_len, &ns_id))
1133 0 0 sub_croak(cv, "unknown namespace: %s", ns_str);
0 0 sub_croak(cv, "unknown namespace: %s", ns_str);
0 0 sub_croak(cv, "unknown namespace: %s", ns_str);
0 0 sub_croak(cv, "unknown namespace: %s", ns_str);
0 0 sub_croak(cv, "unknown namespace: %s", ns_str);
0 0 sub_croak(cv, "unknown namespace: %s", ns_str);
0 0 sub_croak(cv, "unknown namespace: %s", ns_str);
0 0 sub_croak(cv, "unknown namespace: %s", ns_str);
0 0 sub_croak(cv, "unknown namespace: %s", ns_str);
0 0 sub_croak(cv, "unknown namespace: %s", ns_str);
0 0 sub_croak(cv, "unknown namespace: %s", ns_str);
1136 10 4 if (tag) {
1139 10 0 const char *tag_str = SvPV_const(tag, tag_len);
1148 0 14 if (status)
1149 0 0 sub_croak(cv, "myhtml_parse_fragment failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_parse_fragment failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_parse_fragment failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_parse_fragment failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_parse_fragment failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_parse_fragment failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_parse_fragment failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_parse_fragment failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_parse_fragment failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_parse_fragment failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_parse_fragment failed: %d (%s)", status, modest_strerror(status));
1184 90 0 if (scope) {
1185 28 62 RETVAL = html5_node_find(cv, self->parser, scope, query, combinator, ix == 1 || ix == 2);
3 25 RETVAL = html5_node_find(cv, self->parser, scope, query, combinator, ix == 1 || ix == 2);
1213 0 1 if (!value) {
1219 0 1 const char *enc_str = SvPV_const(value, enc_length);
1221 1 0 if (enc_length > 0) {
1222 1 0 if (isdigit(enc_str[0])) {
1223 1 0 self->utf8 = SvIV(value) != 0;
1260 1 1 if (self->tree->compat_mode == MyHTML_TREE_COMPAT_MODE_QUIRKS) {
1276 1 0 RETVAL = newSVpv_utf8_auto(self->tree, name ? name : "", length);
1294 4 0 const char *tag_str = SvPV_const(tag, tag_len);
1305 1 1 if (tag_ctx)
1306 1 0 RETVAL = newSVpv_utf8_auto(self->tree, tag_ctx->name ? tag_ctx->name : "", tag_ctx->name_length);
1316 3 0 const char *ns_str = SvPV_const(ns, ns_len);
1319 1 2 if (!myhtml_namespace_id_by_name(ns_str, ns_len, &ns_id))
1332 1 1 RETVAL = ns_name ? newSVpv_utf8_auto(self->tree, ns_name, ns_len) : &PL_sv_undef;
1357 27 0 if (sv_derived_from(other_tree, "HTML5::DOM::Tree")) {
1358 27 0 html5_dom_tree_t *tree = INT2PTR(html5_dom_tree_t *, SvIV((SV*)SvRV(other_tree)));
1359 27 0 if (tree == self)
1370 2 125 if (self->used) {
1387 2 7 if (new_tag_id) {
1388 2 0 const myhtml_tag_context_t *tag_ctx = myhtml_tag_get_by_id(self->tree->tags, SvIV(new_tag_id));
1389 1 1 if (tag_ctx) {
1390 1 0 self->tag_id = SvIV(new_tag_id);
1392 1 0 sub_croak(cv, "unknown tag id %ld", SvIV(new_tag_id));
1 0 sub_croak(cv, "unknown tag id %ld", SvIV(new_tag_id));
1 0 sub_croak(cv, "unknown tag id %ld", SvIV(new_tag_id));
1 0 sub_croak(cv, "unknown tag id %ld", SvIV(new_tag_id));
0 1 sub_croak(cv, "unknown tag id %ld", SvIV(new_tag_id));
0 0 sub_croak(cv, "unknown tag id %ld", SvIV(new_tag_id));
1 0 sub_croak(cv, "unknown tag id %ld", SvIV(new_tag_id));
0 1 sub_croak(cv, "unknown tag id %ld", SvIV(new_tag_id));
1 0 sub_croak(cv, "unknown tag id %ld", SvIV(new_tag_id));
1 0 sub_croak(cv, "unknown tag id %ld", SvIV(new_tag_id));
1 0 sub_croak(cv, "unknown tag id %ld", SvIV(new_tag_id));
1 0 sub_croak(cv, "unknown tag id %ld", SvIV(new_tag_id));
1406 2 4 if (new_ns_id) {
1407 2 0 if (!myhtml_namespace_name_by_id(SvIV(new_ns_id), NULL)) {
1 1 if (!myhtml_namespace_name_by_id(SvIV(new_ns_id), NULL)) {
1408 1 0 sub_croak(cv, "unknown namespace id %ld", SvIV(new_ns_id));
1 0 sub_croak(cv, "unknown namespace id %ld", SvIV(new_ns_id));
1 0 sub_croak(cv, "unknown namespace id %ld", SvIV(new_ns_id));
1 0 sub_croak(cv, "unknown namespace id %ld", SvIV(new_ns_id));
0 1 sub_croak(cv, "unknown namespace id %ld", SvIV(new_ns_id));
0 0 sub_croak(cv, "unknown namespace id %ld", SvIV(new_ns_id));
1 0 sub_croak(cv, "unknown namespace id %ld", SvIV(new_ns_id));
0 1 sub_croak(cv, "unknown namespace id %ld", SvIV(new_ns_id));
1 0 sub_croak(cv, "unknown namespace id %ld", SvIV(new_ns_id));
1 0 sub_croak(cv, "unknown namespace id %ld", SvIV(new_ns_id));
1 0 sub_croak(cv, "unknown namespace id %ld", SvIV(new_ns_id));
1 0 sub_croak(cv, "unknown namespace id %ld", SvIV(new_ns_id));
1410 1 0 myhtml_node_namespace_set(self, SvIV(new_ns_id));
1429 12 25 if (new_tag_name) {
1432 12 0 const char *new_tag_name_str = SvPV_const(new_tag_name, new_tag_name_len);
1434 3 9 if (!new_tag_name_len)
1435 3 0 sub_croak(cv, "empty tag name not allowed.");
3 0 sub_croak(cv, "empty tag name not allowed.");
3 0 sub_croak(cv, "empty tag name not allowed.");
3 0 sub_croak(cv, "empty tag name not allowed.");
0 3 sub_croak(cv, "empty tag name not allowed.");
0 0 sub_croak(cv, "empty tag name not allowed.");
3 0 sub_croak(cv, "empty tag name not allowed.");
0 3 sub_croak(cv, "empty tag name not allowed.");
3 0 sub_croak(cv, "empty tag name not allowed.");
3 0 sub_croak(cv, "empty tag name not allowed.");
3 0 sub_croak(cv, "empty tag name not allowed.");
1446 25 0 if (tree && tree->tags) {
25 0 if (tree && tree->tags) {
1448 25 0 if (tag_ctx) {
1450 15 10 if (ix == 1 || ix == 2) {
1 14 if (ix == 1 || ix == 2) {
1452 11 0 char *value = SvPV(RETVAL, value_len);
1453 2764845 11 for (size_t i = 0; i < value_len; ++i)
1469 2 4 if (new_ns) {
1472 2 0 const char *new_ns_str = SvPV_const(new_ns, new_ns_len);
1475 1 1 if (!myhtml_namespace_id_by_name(new_ns_str, new_ns_len, &ns))
1476 1 0 sub_croak(cv, "unknown namespace: %s", new_ns_str);
1 0 sub_croak(cv, "unknown namespace: %s", new_ns_str);
1 0 sub_croak(cv, "unknown namespace: %s", new_ns_str);
1 0 sub_croak(cv, "unknown namespace: %s", new_ns_str);
0 1 sub_croak(cv, "unknown namespace: %s", new_ns_str);
0 0 sub_croak(cv, "unknown namespace: %s", new_ns_str);
1 0 sub_croak(cv, "unknown namespace: %s", new_ns_str);
0 1 sub_croak(cv, "unknown namespace: %s", new_ns_str);
1 0 sub_croak(cv, "unknown namespace: %s", new_ns_str);
1 0 sub_croak(cv, "unknown namespace: %s", new_ns_str);
1 0 sub_croak(cv, "unknown namespace: %s", new_ns_str);
1485 4 0 RETVAL = newSVpv_utf8_auto(self->tree, ns_name ? ns_name : "", ns_name_len);
1513 5 1 if (self->tag_id != MyHTML_TAG__UNDEF) {
1514 1 4 if (self->tag_id == MyHTML_TAG__TEXT) {
1516 1 3 } else if (self->tag_id == MyHTML_TAG__COMMENT) {
1518 1 2 } else if (self->tag_id == MyHTML_TAG__DOCTYPE) {
1520 1 1 } else if (context->fragment_tag_id && self->tag_id == context->fragment_tag_id) {
1 0 } else if (context->fragment_tag_id && self->tag_id == context->fragment_tag_id) {
1527 1 0 if (node_is_document(self))
1 0 if (node_is_document(self))
1542 3 63 if (text) {
1543 1 2 if (ix == 2 && !myhtml_node_parent(self)) // outerHTML
0 1 if (ix == 2 && !myhtml_node_parent(self)) // outerHTML
1544 0 0 sub_croak(cv, "This element has no parent node.");
0 0 sub_croak(cv, "This element has no parent node.");
0 0 sub_croak(cv, "This element has no parent node.");
0 0 sub_croak(cv, "This element has no parent node.");
0 0 sub_croak(cv, "This element has no parent node.");
0 0 sub_croak(cv, "This element has no parent node.");
0 0 sub_croak(cv, "This element has no parent node.");
0 0 sub_croak(cv, "This element has no parent node.");
0 0 sub_croak(cv, "This element has no parent node.");
0 0 sub_croak(cv, "This element has no parent node.");
0 0 sub_croak(cv, "This element has no parent node.");
1548 3 0 const char *text_str = SvPV_const(text, text_len);
1550 3 0 if (node_is_element(self) || node_is_document(self)) { // parse fragment and replace all node childrens with it
3 0 if (node_is_element(self) || node_is_document(self)) { // parse fragment and replace all node childrens with it
3 0 if (node_is_element(self) || node_is_document(self)) { // parse fragment and replace all node childrens with it
0 3 if (node_is_element(self) || node_is_document(self)) { // parse fragment and replace all node childrens with it
0 0 if (node_is_element(self) || node_is_document(self)) { // parse fragment and replace all node childrens with it
0 0 if (node_is_element(self) || node_is_document(self)) { // parse fragment and replace all node childrens with it
1554 1 2 myhtml_tree_node_t *context_node = ix == 2 ? myhtml_node_parent(self) : self;
1558 0 3 if (node_is_document(context_node))
0 0 if (node_is_document(context_node))
1570 0 3 if (status)
1571 0 0 sub_croak(cv, "myhtml_parse_fragment failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_parse_fragment failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_parse_fragment failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_parse_fragment failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_parse_fragment failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_parse_fragment failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_parse_fragment failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_parse_fragment failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_parse_fragment failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_parse_fragment failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "myhtml_parse_fragment failed: %d (%s)", status, modest_strerror(status));
1575 3 3 while (node) {
1583 3 0 if (node_is_root(self)) {
0 3 if (node_is_root(self)) {
1586 0 3 } else if (node_is_document(self)) {
0 0 } else if (node_is_document(self)) {
1592 3 0 if (fragment != self->tree->node_html) {
1595 3 3 while (node) {
1598 1 2 if (ix == 2) { // outerHTML
1607 1 2 if (ix == 2)
1624 63 0 if (self->tag_id == MyHTML_TAG__UNDEF || ix == 1 || html5_dom_is_fragment(self)) { // innerHTML
62 1 if (self->tag_id == MyHTML_TAG__UNDEF || ix == 1 || html5_dom_is_fragment(self)) { // innerHTML
7 55 if (self->tag_id == MyHTML_TAG__UNDEF || ix == 1 || html5_dom_is_fragment(self)) { // innerHTML
1 6 if (self->tag_id == MyHTML_TAG__UNDEF || ix == 1 || html5_dom_is_fragment(self)) { // innerHTML
1626 4 2 while (node) {
1654 213 0 if (!node_is_element(self)) {
178 35 if (!node_is_element(self)) {
167 11 if (!node_is_element(self)) {
0 167 if (!node_is_element(self)) {
1655 46 0 if (ix == 2 || ix == 3 || ix == 5) {
46 0 if (ix == 2 || ix == 3 || ix == 5) {
0 46 if (ix == 2 || ix == 3 || ix == 5) {
1656 0 0 if (text) {
1657 0 0 sub_croak(cv, "%s unsupported in %s", names[ix], get_node_class(self));
0 0 sub_croak(cv, "%s unsupported in %s", names[ix], get_node_class(self));
0 0 sub_croak(cv, "%s unsupported in %s", names[ix], get_node_class(self));
0 0 sub_croak(cv, "%s unsupported in %s", names[ix], get_node_class(self));
0 0 sub_croak(cv, "%s unsupported in %s", names[ix], get_node_class(self));
0 0 sub_croak(cv, "%s unsupported in %s", names[ix], get_node_class(self));
0 0 sub_croak(cv, "%s unsupported in %s", names[ix], get_node_class(self));
0 0 sub_croak(cv, "%s unsupported in %s", names[ix], get_node_class(self));
0 0 sub_croak(cv, "%s unsupported in %s", names[ix], get_node_class(self));
0 0 sub_croak(cv, "%s unsupported in %s", names[ix], get_node_class(self));
0 0 sub_croak(cv, "%s unsupported in %s", names[ix], get_node_class(self));
1661 0 46 } else if (text) { // set node value
1664 0 0 const char *text_str = SvPV_const(text, text_len);
1671 46 0 RETVAL = newSVpv_utf8_auto(self->tree, text ? text : "", text_len);
1674 166 1 if (ix == 1 || ix == 4) {
1 165 if (ix == 1 || ix == 4) {
1675 0 2 if (text) {
1676 0 0 sub_croak(cv, "%s unsupported in %s", names[ix], get_node_class(self));
0 0 sub_croak(cv, "%s unsupported in %s", names[ix], get_node_class(self));
0 0 sub_croak(cv, "%s unsupported in %s", names[ix], get_node_class(self));
0 0 sub_croak(cv, "%s unsupported in %s", names[ix], get_node_class(self));
0 0 sub_croak(cv, "%s unsupported in %s", names[ix], get_node_class(self));
0 0 sub_croak(cv, "%s unsupported in %s", names[ix], get_node_class(self));
0 0 sub_croak(cv, "%s unsupported in %s", names[ix], get_node_class(self));
0 0 sub_croak(cv, "%s unsupported in %s", names[ix], get_node_class(self));
0 0 sub_croak(cv, "%s unsupported in %s", names[ix], get_node_class(self));
0 0 sub_croak(cv, "%s unsupported in %s", names[ix], get_node_class(self));
0 0 sub_croak(cv, "%s unsupported in %s", names[ix], get_node_class(self));
1680 9 156 } else if (text) { // remove all childrens and add text node
1683 8 1 const char *text_str = SvPV_const(text, text_len);
1687 9 9 while (node) {
1695 9 0 if (node_is_root(self)) {
0 9 if (node_is_root(self)) {
1698 0 9 } else if (node_is_document(self)) {
0 0 } else if (node_is_document(self)) {
1705 8 1 if (ix == 2 || ix == 5) {
1 7 if (ix == 2 || ix == 5) {
1707 50 2 for (size_t i = 0; i < text_len; ++i) {
1709 46 4 bool is_new_line = (text_str[i] == '\n' || text_str[i] == '\r');
0 46 bool is_new_line = (text_str[i] == '\n' || text_str[i] == '\r');
1710 48 2 if (is_end || is_new_line) {
2 46 if (is_end || is_new_line) {
1711 2 2 if (is_end && !is_new_line)
0 2 if (is_end && !is_new_line)
1715 2 2 if (i - last_pos) {
1718 1 1 if (ix == 5) { // outerText
1726 4 0 if (is_new_line) {
1728 4 0 if (!text_node->token) {
1730 0 4 if (!text_node->token) {
1732 0 0 sub_croak(cv, "myhtml_token_node_create failed");
0 0 sub_croak(cv, "myhtml_token_node_create failed");
0 0 sub_croak(cv, "myhtml_token_node_create failed");
0 0 sub_croak(cv, "myhtml_token_node_create failed");
0 0 sub_croak(cv, "myhtml_token_node_create failed");
0 0 sub_croak(cv, "myhtml_token_node_create failed");
0 0 sub_croak(cv, "myhtml_token_node_create failed");
0 0 sub_croak(cv, "myhtml_token_node_create failed");
0 0 sub_croak(cv, "myhtml_token_node_create failed");
0 0 sub_croak(cv, "myhtml_token_node_create failed");
0 0 sub_croak(cv, "myhtml_token_node_create failed");
1737 2 2 if (ix == 5) { // outerText
1744 2 2 if (!is_end) {
1745 0 2 if (text_str[i] == '\r' && text_str[i + 1] == '\n')
0 0 if (text_str[i] == '\r' && text_str[i + 1] == '\n')
1761 1 8 if (ix == 5) {
1767 155 1 if (ix == 2 || ix == 5) {
1 154 if (ix == 2 || ix == 5) {
1775 2 2 while (next) {
1781 2 0 RETVAL = newSVpv_utf8_auto(self->tree, state.value.length ? state.value.data : "", state.value.length);
1817 14 2 while (node && !node_is_element(node))
0 14 while (node && !node_is_element(node))
8 6 while (node && !node_is_element(node))
2 4 while (node && !node_is_element(node))
0 4 while (node && !node_is_element(node))
1840 14 2 while (node && !node_is_element(node))
0 14 while (node && !node_is_element(node))
8 6 while (node && !node_is_element(node))
2 4 while (node && !node_is_element(node))
0 4 while (node && !node_is_element(node))
1864 6 66 RETVAL = ix == 1 ? newSViv(myhtml_node_parent(self) ? 1 : 0) : node_to_sv(myhtml_node_parent(self));
1884 1 1 if (ix == 1) {
1885 0 1 if (!node)
1886 0 0 sub_croak(cv, "%s is not of type %s", "node", "HTML5::DOM::Node");
0 0 sub_croak(cv, "%s is not of type %s", "node", "HTML5::DOM::Node");
0 0 sub_croak(cv, "%s is not of type %s", "node", "HTML5::DOM::Node");
0 0 sub_croak(cv, "%s is not of type %s", "node", "HTML5::DOM::Node");
0 0 sub_croak(cv, "%s is not of type %s", "node", "HTML5::DOM::Node");
0 0 sub_croak(cv, "%s is not of type %s", "node", "HTML5::DOM::Node");
0 0 sub_croak(cv, "%s is not of type %s", "node", "HTML5::DOM::Node");
0 0 sub_croak(cv, "%s is not of type %s", "node", "HTML5::DOM::Node");
0 0 sub_croak(cv, "%s is not of type %s", "node", "HTML5::DOM::Node");
0 0 sub_croak(cv, "%s is not of type %s", "node", "HTML5::DOM::Node");
0 0 sub_croak(cv, "%s is not of type %s", "node", "HTML5::DOM::Node");
1887 0 1 if (node->parent != self)
1888 0 0 sub_croak(cv, "The node to be removed is not a child of this node.");
0 0 sub_croak(cv, "The node to be removed is not a child of this node.");
0 0 sub_croak(cv, "The node to be removed is not a child of this node.");
0 0 sub_croak(cv, "The node to be removed is not a child of this node.");
0 0 sub_croak(cv, "The node to be removed is not a child of this node.");
0 0 sub_croak(cv, "The node to be removed is not a child of this node.");
0 0 sub_croak(cv, "The node to be removed is not a child of this node.");
0 0 sub_croak(cv, "The node to be removed is not a child of this node.");
0 0 sub_croak(cv, "The node to be removed is not a child of this node.");
0 0 sub_croak(cv, "The node to be removed is not a child of this node.");
0 0 sub_croak(cv, "The node to be removed is not a child of this node.");
1904 4 4 if (ix == 1) {
1908 0 4 if (!reference_node)
1909 0 0 sub_croak(cv, "%s is not of type %s", "reference_node", "HTML5::DOM::Node");
0 0 sub_croak(cv, "%s is not of type %s", "reference_node", "HTML5::DOM::Node");
0 0 sub_croak(cv, "%s is not of type %s", "reference_node", "HTML5::DOM::Node");
0 0 sub_croak(cv, "%s is not of type %s", "reference_node", "HTML5::DOM::Node");
0 0 sub_croak(cv, "%s is not of type %s", "reference_node", "HTML5::DOM::Node");
0 0 sub_croak(cv, "%s is not of type %s", "reference_node", "HTML5::DOM::Node");
0 0 sub_croak(cv, "%s is not of type %s", "reference_node", "HTML5::DOM::Node");
0 0 sub_croak(cv, "%s is not of type %s", "reference_node", "HTML5::DOM::Node");
0 0 sub_croak(cv, "%s is not of type %s", "reference_node", "HTML5::DOM::Node");
0 0 sub_croak(cv, "%s is not of type %s", "reference_node", "HTML5::DOM::Node");
0 0 sub_croak(cv, "%s is not of type %s", "reference_node", "HTML5::DOM::Node");
1910 0 4 if (reference_node->parent != self)
1911 0 0 sub_croak(cv, "The node before which the new node is to be inserted is not a child of this node.");
0 0 sub_croak(cv, "The node before which the new node is to be inserted is not a child of this node.");
0 0 sub_croak(cv, "The node before which the new node is to be inserted is not a child of this node.");
0 0 sub_croak(cv, "The node before which the new node is to be inserted is not a child of this node.");
0 0 sub_croak(cv, "The node before which the new node is to be inserted is not a child of this node.");
0 0 sub_croak(cv, "The node before which the new node is to be inserted is not a child of this node.");
0 0 sub_croak(cv, "The node before which the new node is to be inserted is not a child of this node.");
0 0 sub_croak(cv, "The node before which the new node is to be inserted is not a child of this node.");
0 0 sub_croak(cv, "The node before which the new node is to be inserted is not a child of this node.");
0 0 sub_croak(cv, "The node before which the new node is to be inserted is not a child of this node.");
0 0 sub_croak(cv, "The node before which the new node is to be inserted is not a child of this node.");
1917 0 8 if (!myhtml_node_parent(reference_node))
1918 0 0 sub_croak(cv, "can't insert before detached node");
0 0 sub_croak(cv, "can't insert before detached node");
0 0 sub_croak(cv, "can't insert before detached node");
0 0 sub_croak(cv, "can't insert before detached node");
0 0 sub_croak(cv, "can't insert before detached node");
0 0 sub_croak(cv, "can't insert before detached node");
0 0 sub_croak(cv, "can't insert before detached node");
0 0 sub_croak(cv, "can't insert before detached node");
0 0 sub_croak(cv, "can't insert before detached node");
0 0 sub_croak(cv, "can't insert before detached node");
0 0 sub_croak(cv, "can't insert before detached node");
1920 0 8 if (reference_node->tree != new_node->tree) {
1923 0 0 if (!new_node)
1924 0 0 sub_croak(cv, "node copying internal error");
0 0 sub_croak(cv, "node copying internal error");
0 0 sub_croak(cv, "node copying internal error");
0 0 sub_croak(cv, "node copying internal error");
0 0 sub_croak(cv, "node copying internal error");
0 0 sub_croak(cv, "node copying internal error");
0 0 sub_croak(cv, "node copying internal error");
0 0 sub_croak(cv, "node copying internal error");
0 0 sub_croak(cv, "node copying internal error");
0 0 sub_croak(cv, "node copying internal error");
0 0 sub_croak(cv, "node copying internal error");
1927 2 6 if (html5_dom_is_fragment(new_node)) {
2 0 if (html5_dom_is_fragment(new_node)) {
1929 10 2 while (fragment_child) {
1940 4 4 if (ix == 1) {
1956 4 4 if (ix == 1) {
1960 0 4 if (!reference_node)
1961 0 0 sub_croak(cv, "%s is not of type %s", "reference_node", "HTML5::DOM::Node");
0 0 sub_croak(cv, "%s is not of type %s", "reference_node", "HTML5::DOM::Node");
0 0 sub_croak(cv, "%s is not of type %s", "reference_node", "HTML5::DOM::Node");
0 0 sub_croak(cv, "%s is not of type %s", "reference_node", "HTML5::DOM::Node");
0 0 sub_croak(cv, "%s is not of type %s", "reference_node", "HTML5::DOM::Node");
0 0 sub_croak(cv, "%s is not of type %s", "reference_node", "HTML5::DOM::Node");
0 0 sub_croak(cv, "%s is not of type %s", "reference_node", "HTML5::DOM::Node");
0 0 sub_croak(cv, "%s is not of type %s", "reference_node", "HTML5::DOM::Node");
0 0 sub_croak(cv, "%s is not of type %s", "reference_node", "HTML5::DOM::Node");
0 0 sub_croak(cv, "%s is not of type %s", "reference_node", "HTML5::DOM::Node");
0 0 sub_croak(cv, "%s is not of type %s", "reference_node", "HTML5::DOM::Node");
1962 0 4 if (reference_node->parent != self)
1963 0 0 sub_croak(cv, "The node after which the new node is to be inserted is not a child of this node.");
0 0 sub_croak(cv, "The node after which the new node is to be inserted is not a child of this node.");
0 0 sub_croak(cv, "The node after which the new node is to be inserted is not a child of this node.");
0 0 sub_croak(cv, "The node after which the new node is to be inserted is not a child of this node.");
0 0 sub_croak(cv, "The node after which the new node is to be inserted is not a child of this node.");
0 0 sub_croak(cv, "The node after which the new node is to be inserted is not a child of this node.");
0 0 sub_croak(cv, "The node after which the new node is to be inserted is not a child of this node.");
0 0 sub_croak(cv, "The node after which the new node is to be inserted is not a child of this node.");
0 0 sub_croak(cv, "The node after which the new node is to be inserted is not a child of this node.");
0 0 sub_croak(cv, "The node after which the new node is to be inserted is not a child of this node.");
0 0 sub_croak(cv, "The node after which the new node is to be inserted is not a child of this node.");
1969 0 8 if (!myhtml_node_parent(reference_node))
1970 0 0 sub_croak(cv, "can't insert before detached node");
0 0 sub_croak(cv, "can't insert before detached node");
0 0 sub_croak(cv, "can't insert before detached node");
0 0 sub_croak(cv, "can't insert before detached node");
0 0 sub_croak(cv, "can't insert before detached node");
0 0 sub_croak(cv, "can't insert before detached node");
0 0 sub_croak(cv, "can't insert before detached node");
0 0 sub_croak(cv, "can't insert before detached node");
0 0 sub_croak(cv, "can't insert before detached node");
0 0 sub_croak(cv, "can't insert before detached node");
0 0 sub_croak(cv, "can't insert before detached node");
1972 0 8 if (reference_node->tree != new_node->tree) {
1975 0 0 if (!new_node)
1976 0 0 sub_croak(cv, "node copying internal error");
0 0 sub_croak(cv, "node copying internal error");
0 0 sub_croak(cv, "node copying internal error");
0 0 sub_croak(cv, "node copying internal error");
0 0 sub_croak(cv, "node copying internal error");
0 0 sub_croak(cv, "node copying internal error");
0 0 sub_croak(cv, "node copying internal error");
0 0 sub_croak(cv, "node copying internal error");
0 0 sub_croak(cv, "node copying internal error");
0 0 sub_croak(cv, "node copying internal error");
0 0 sub_croak(cv, "node copying internal error");
1979 2 6 if (html5_dom_is_fragment(new_node)) {
2 0 if (html5_dom_is_fragment(new_node)) {
1981 10 2 while (fragment_child) {
1992 4 4 if (ix == 1) {
2006 5 0 if (!node_is_element(self))
5 0 if (!node_is_element(self))
5 0 if (!node_is_element(self))
0 5 if (!node_is_element(self))
2007 0 0 sub_croak(cv, "can't append children to non-element node");
0 0 sub_croak(cv, "can't append children to non-element node");
0 0 sub_croak(cv, "can't append children to non-element node");
0 0 sub_croak(cv, "can't append children to non-element node");
0 0 sub_croak(cv, "can't append children to non-element node");
0 0 sub_croak(cv, "can't append children to non-element node");
0 0 sub_croak(cv, "can't append children to non-element node");
0 0 sub_croak(cv, "can't append children to non-element node");
0 0 sub_croak(cv, "can't append children to non-element node");
0 0 sub_croak(cv, "can't append children to non-element node");
0 0 sub_croak(cv, "can't append children to non-element node");
2009 0 5 if (self->tree != child->tree) {
2012 0 0 if (!child)
2013 0 0 sub_croak(cv, "node copying internal error");
0 0 sub_croak(cv, "node copying internal error");
0 0 sub_croak(cv, "node copying internal error");
0 0 sub_croak(cv, "node copying internal error");
0 0 sub_croak(cv, "node copying internal error");
0 0 sub_croak(cv, "node copying internal error");
0 0 sub_croak(cv, "node copying internal error");
0 0 sub_croak(cv, "node copying internal error");
0 0 sub_croak(cv, "node copying internal error");
0 0 sub_croak(cv, "node copying internal error");
0 0 sub_croak(cv, "node copying internal error");
2016 2 3 if (html5_dom_is_fragment(child)) {
2 0 if (html5_dom_is_fragment(child)) {
2018 10 2 while (fragment_child) {
2029 2 3 if (ix == 1) {
2043 4 0 if (!node_is_element(self))
4 0 if (!node_is_element(self))
4 0 if (!node_is_element(self))
0 4 if (!node_is_element(self))
2044 0 0 sub_croak(cv, "can't prepend children to non-element node");
0 0 sub_croak(cv, "can't prepend children to non-element node");
0 0 sub_croak(cv, "can't prepend children to non-element node");
0 0 sub_croak(cv, "can't prepend children to non-element node");
0 0 sub_croak(cv, "can't prepend children to non-element node");
0 0 sub_croak(cv, "can't prepend children to non-element node");
0 0 sub_croak(cv, "can't prepend children to non-element node");
0 0 sub_croak(cv, "can't prepend children to non-element node");
0 0 sub_croak(cv, "can't prepend children to non-element node");
0 0 sub_croak(cv, "can't prepend children to non-element node");
0 0 sub_croak(cv, "can't prepend children to non-element node");
2046 0 4 if (self->tree != child->tree) {
2049 0 0 if (!child)
2050 0 0 sub_croak(cv, "node copying internal error");
0 0 sub_croak(cv, "node copying internal error");
0 0 sub_croak(cv, "node copying internal error");
0 0 sub_croak(cv, "node copying internal error");
0 0 sub_croak(cv, "node copying internal error");
0 0 sub_croak(cv, "node copying internal error");
0 0 sub_croak(cv, "node copying internal error");
0 0 sub_croak(cv, "node copying internal error");
0 0 sub_croak(cv, "node copying internal error");
0 0 sub_croak(cv, "node copying internal error");
0 0 sub_croak(cv, "node copying internal error");
2054 2 2 if (html5_dom_is_fragment(child)) {
2 0 if (html5_dom_is_fragment(child)) {
2056 10 2 while (fragment_child) {
2059 10 0 if (first_node) {
2068 2 0 if (first_node) {
2075 2 2 if (ix == 1) {
2091 2 2 if (ix == 1) {
2095 0 2 if (!old_node)
2096 0 0 sub_croak(cv, "%s is not of type %s", "old_node", "HTML5::DOM::Node");
0 0 sub_croak(cv, "%s is not of type %s", "old_node", "HTML5::DOM::Node");
0 0 sub_croak(cv, "%s is not of type %s", "old_node", "HTML5::DOM::Node");
0 0 sub_croak(cv, "%s is not of type %s", "old_node", "HTML5::DOM::Node");
0 0 sub_croak(cv, "%s is not of type %s", "old_node", "HTML5::DOM::Node");
0 0 sub_croak(cv, "%s is not of type %s", "old_node", "HTML5::DOM::Node");
0 0 sub_croak(cv, "%s is not of type %s", "old_node", "HTML5::DOM::Node");
0 0 sub_croak(cv, "%s is not of type %s", "old_node", "HTML5::DOM::Node");
0 0 sub_croak(cv, "%s is not of type %s", "old_node", "HTML5::DOM::Node");
0 0 sub_croak(cv, "%s is not of type %s", "old_node", "HTML5::DOM::Node");
0 0 sub_croak(cv, "%s is not of type %s", "old_node", "HTML5::DOM::Node");
2097 0 2 if (old_node->parent != self)
2098 0 0 sub_croak(cv, "The node to be replaced is not a child of this node.");
0 0 sub_croak(cv, "The node to be replaced is not a child of this node.");
0 0 sub_croak(cv, "The node to be replaced is not a child of this node.");
0 0 sub_croak(cv, "The node to be replaced is not a child of this node.");
0 0 sub_croak(cv, "The node to be replaced is not a child of this node.");
0 0 sub_croak(cv, "The node to be replaced is not a child of this node.");
0 0 sub_croak(cv, "The node to be replaced is not a child of this node.");
0 0 sub_croak(cv, "The node to be replaced is not a child of this node.");
0 0 sub_croak(cv, "The node to be replaced is not a child of this node.");
0 0 sub_croak(cv, "The node to be replaced is not a child of this node.");
0 0 sub_croak(cv, "The node to be replaced is not a child of this node.");
2104 0 4 if (old_node->tree != new_node->tree) {
2107 0 0 if (!new_node)
2108 0 0 sub_croak(cv, "node copying internal error");
0 0 sub_croak(cv, "node copying internal error");
0 0 sub_croak(cv, "node copying internal error");
0 0 sub_croak(cv, "node copying internal error");
0 0 sub_croak(cv, "node copying internal error");
0 0 sub_croak(cv, "node copying internal error");
0 0 sub_croak(cv, "node copying internal error");
0 0 sub_croak(cv, "node copying internal error");
0 0 sub_croak(cv, "node copying internal error");
0 0 sub_croak(cv, "node copying internal error");
0 0 sub_croak(cv, "node copying internal error");
2111 2 2 if (html5_dom_is_fragment(new_node)) {
2 0 if (html5_dom_is_fragment(new_node)) {
2113 10 2 while (fragment_child) {
2126 2 2 RETVAL = (ix == 1 ? node_to_sv(old_node) : SvREFCNT_inc(ST(0)));
2136 24 0 myhtml_tree_t *tree = new_tree ? new_tree->tree : self->tree;
2137 12 12 if (deep) {
2166 1 0 hv_store_ent(hash, sv_2mortal(newSVpv_utf8_auto(self->tree, "raw_begin", 9)), newSViv(self->token ? self->token->raw_begin : 0), 0);
2167 1 0 hv_store_ent(hash, sv_2mortal(newSVpv_utf8_auto(self->tree, "raw_length", 10)), newSViv(self->token ? self->token->raw_length : 0), 0);
2168 1 0 hv_store_ent(hash, sv_2mortal(newSVpv_utf8_auto(self->tree, "element_begin", 13)), newSViv(self->token ? self->token->element_begin : 0), 0);
2169 1 0 hv_store_ent(hash, sv_2mortal(newSVpv_utf8_auto(self->tree, "element_length", 14)), newSViv(self->token ? self->token->element_length : 0), 0);
2187 221 0 if (sv_derived_from(other_node, "HTML5::DOM::Node")) {
2188 221 0 myhtml_tree_node_t *node = INT2PTR(myhtml_tree_node_t *, SvIV((SV*)SvRV(other_node)));
2189 170 51 if (node == self)
2202 1246 0 if (sv) {
2206 256 990 if (!myhtml_node_parent(self) && self != myhtml_tree_get_document(self->tree)) {
75 181 if (!myhtml_node_parent(self) && self != myhtml_tree_get_document(self->tree)) {
2207 0 75 if (self == self->tree->node_html) {
2209 0 75 } else if (self == self->tree->node_body) {
2211 0 75 } else if (self == self->tree->node_head) {
2213 0 75 } else if (self == self->tree->node_form) {
2215 0 75 } else if (self == self->tree->fragment) {
2217 0 75 } else if (self == self->tree->document) {
2239 15 3 RETVAL = html5_node_find(cv, tree_context->parser, self, query, combinator, ix == 1 || ix == 2);
3 12 RETVAL = html5_node_find(cv, tree_context->parser, self, query, combinator, ix == 1 || ix == 2);
2270 32 2 while (node && !node_is_element(node))
0 32 while (node && !node_is_element(node))
14 18 while (node && !node_is_element(node))
2 16 while (node && !node_is_element(node))
0 16 while (node && !node_is_element(node))
2293 30 2 while (node && !node_is_element(node))
0 30 while (node && !node_is_element(node))
14 16 while (node && !node_is_element(node))
2 14 while (node && !node_is_element(node))
0 14 while (node && !node_is_element(node))
2316 5 1 while (attr) {
2328 5 0 hv_store_ent(hash, sv_2mortal(newSVpv_utf8_auto(self->tree, "name", 4)), newSVpv_utf8_auto(self->tree, attr_key ? attr_key : "", attr_key_len), 0);
2329 3 2 hv_store_ent(hash, sv_2mortal(newSVpv_utf8_auto(self->tree, "value", 5)), newSVpv_utf8_auto(self->tree, attr_val ? attr_val : "", attr_val_len), 0);
2330 5 0 hv_store_ent(hash, sv_2mortal(newSVpv_utf8_auto(self->tree, "namespace", 9)), newSVpv_utf8_auto(self->tree, ns_name ? ns_name : "", ns_len), 0);
2353 9 118 if (ix == 1) { // setAttribute
2354 0 9 if (!key)
2355 0 0 sub_croak(cv, "attribute key required for setAttribute");
0 0 sub_croak(cv, "attribute key required for setAttribute");
0 0 sub_croak(cv, "attribute key required for setAttribute");
0 0 sub_croak(cv, "attribute key required for setAttribute");
0 0 sub_croak(cv, "attribute key required for setAttribute");
0 0 sub_croak(cv, "attribute key required for setAttribute");
0 0 sub_croak(cv, "attribute key required for setAttribute");
0 0 sub_croak(cv, "attribute key required for setAttribute");
0 0 sub_croak(cv, "attribute key required for setAttribute");
0 0 sub_croak(cv, "attribute key required for setAttribute");
0 0 sub_croak(cv, "attribute key required for setAttribute");
2357 0 9 if (!value)
2358 0 0 sub_croak(cv, "attribute value required for setAttribute");
0 0 sub_croak(cv, "attribute value required for setAttribute");
0 0 sub_croak(cv, "attribute value required for setAttribute");
0 0 sub_croak(cv, "attribute value required for setAttribute");
0 0 sub_croak(cv, "attribute value required for setAttribute");
0 0 sub_croak(cv, "attribute value required for setAttribute");
0 0 sub_croak(cv, "attribute value required for setAttribute");
0 0 sub_croak(cv, "attribute value required for setAttribute");
0 0 sub_croak(cv, "attribute value required for setAttribute");
0 0 sub_croak(cv, "attribute value required for setAttribute");
0 0 sub_croak(cv, "attribute value required for setAttribute");
2359 6 112 } else if (ix == 2) { // getAttribute
2360 0 6 if (!key)
2361 0 0 sub_croak(cv, "attribute key required for getAttribute");
0 0 sub_croak(cv, "attribute key required for getAttribute");
0 0 sub_croak(cv, "attribute key required for getAttribute");
0 0 sub_croak(cv, "attribute key required for getAttribute");
0 0 sub_croak(cv, "attribute key required for getAttribute");
0 0 sub_croak(cv, "attribute key required for getAttribute");
0 0 sub_croak(cv, "attribute key required for getAttribute");
0 0 sub_croak(cv, "attribute key required for getAttribute");
0 0 sub_croak(cv, "attribute key required for getAttribute");
0 0 sub_croak(cv, "attribute key required for getAttribute");
0 0 sub_croak(cv, "attribute key required for getAttribute");
2367 126 1 if (key && value) { // Set value by key or delete by key
23 103 if (key && value) { // Set value by key or delete by key
2372 23 0 const char *key_str = SvPV_const(key, key_len);
2374 23 0 if (key_len) {
2376 15 8 if (SvTYPE(value) != SVt_NULL) {
2378 15 0 const char *val_str = SvPV_const(value, val_len);
2387 103 1 } else if (key && !value) {
103 0 } else if (key && !value) {
2389 1 102 if (SvROK(key) && SvTYPE(SvRV(key)) == SVt_PVHV) {
1 0 if (SvROK(key) && SvTYPE(SvRV(key)) == SVt_PVHV) {
2393 7 1 while ((entry = hv_iternext(hash)) != NULL) {
2397 7 0 if (value && key_len) {
7 0 if (value && key_len) {
2401 3 4 if (SvTYPE(value) != SVt_NULL) {
2403 2 1 const char *val_str = SvPV_const(value, val_len);
2418 102 0 const char *key_str = SvPV_const(key, key_len);
2420 102 0 if (key_len) {
2422 77 25 if (attr) {
2425 64 13 RETVAL = newSVpv_utf8_auto(self->tree, attr_val ? attr_val : "", attr_val_len);
2433 5 1 while (attr) {
2440 3 2 hv_store_ent(hash, sv_2mortal(newSVpv_utf8_auto(self->tree, attr_key ? attr_key : "", attr_key_len)), newSVpv_utf8_auto(self->tree, attr_val ? attr_val : "", attr_val_len), 0);
5 0 hv_store_ent(hash, sv_2mortal(newSVpv_utf8_auto(self->tree, attr_key ? attr_key : "", attr_key_len)), newSVpv_utf8_auto(self->tree, attr_val ? attr_val : "", attr_val_len), 0);
2459 8 0 const char *key_str = SvPV_const(key, key_len);
2461 8 0 if (key_len)
2475 525 43 while (child) {
2476 525 0 if (node_is_element(child))
244 281 if (node_is_element(child))
219 25 if (node_is_element(child))
219 0 if (node_is_element(child))
2494 100 21 while (child) {
2565 5 0 RETVAL = ret ? newSVpv_utf8_auto(self->tree, ret, strlen(ret)) : &PL_sv_undef;
2581 171 0 myhtml_tree_attr_t *root_name = self->token ? self->token->attr_first : NULL;
2582 162 9 myhtml_tree_attr_t *restrict_type = root_name ? root_name->next : NULL;
2583 131 40 myhtml_tree_attr_t *public_id = restrict_type ? restrict_type->next : NULL;
2584 125 46 myhtml_tree_attr_t *system_id = public_id ? public_id->next : NULL;
2586 131 40 if (restrict_type && restrict_type->value.length == 6) {
131 0 if (restrict_type && restrict_type->value.length == 6) {
2587 38 93 if (mycore_strcasecmp(restrict_type->value.data, "SYSTEM") == 0) {
2593 15 156 if (value) {
2596 15 0 myhtml_tree_attr_t *attr_first = self->token ? self->token->attr_first : NULL;
2597 15 0 myhtml_tree_attr_t *attr_last = self->token ? self->token->attr_last : NULL;
2600 15 0 const char *val_str = SvPV_const(value, val_len);
2603 5 10 if (ix == 0) {
2606 8 2 myhtml_attribute_add(self, root_name && root_name->key.length ? root_name->key.data : "", root_name ? root_name->key.length : 0, "", 0, MyENCODING_DEFAULT);
8 2 myhtml_attribute_add(self, root_name && root_name->key.length ? root_name->key.data : "", root_name ? root_name->key.length : 0, "", 0, MyENCODING_DEFAULT);
8 0 myhtml_attribute_add(self, root_name && root_name->key.length ? root_name->key.data : "", root_name ? root_name->key.length : 0, "", 0, MyENCODING_DEFAULT);
2611 5 10 if ((ix == 2 && val_len) || (system_id && system_id->value.length))
0 5 if ((ix == 2 && val_len) || (system_id && system_id->value.length))
4 6 if ((ix == 2 && val_len) || (system_id && system_id->value.length))
4 0 if ((ix == 2 && val_len) || (system_id && system_id->value.length))
2614 5 10 if ((ix == 1 && val_len) || (public_id && public_id->value.length))
0 5 if ((ix == 1 && val_len) || (public_id && public_id->value.length))
4 6 if ((ix == 1 && val_len) || (public_id && public_id->value.length))
4 0 if ((ix == 1 && val_len) || (public_id && public_id->value.length))
2617 13 2 if (restrict_type_str) {
2621 9 4 if (restrict_type_str == TYPE_PUBLIC) {
2623 5 4 if (ix == 1) {
2626 4 0 myhtml_attribute_add(self, "", 0, public_id && public_id->value.length ? public_id->value.data : "", public_id ? public_id->value.length : 0, MyENCODING_DEFAULT);
4 0 myhtml_attribute_add(self, "", 0, public_id && public_id->value.length ? public_id->value.data : "", public_id ? public_id->value.length : 0, MyENCODING_DEFAULT);
4 0 myhtml_attribute_add(self, "", 0, public_id && public_id->value.length ? public_id->value.data : "", public_id ? public_id->value.length : 0, MyENCODING_DEFAULT);
2631 5 8 if (ix == 2) {
2634 4 4 myhtml_attribute_add(self, "", 0, system_id && system_id->value.length ? system_id->value.data : "", system_id ? system_id->value.length : 0, MyENCODING_DEFAULT);
4 4 myhtml_attribute_add(self, "", 0, system_id && system_id->value.length ? system_id->value.data : "", system_id ? system_id->value.length : 0, MyENCODING_DEFAULT);
4 0 myhtml_attribute_add(self, "", 0, system_id && system_id->value.length ? system_id->value.data : "", system_id ? system_id->value.length : 0, MyENCODING_DEFAULT);
2639 33 3 while (attr_last && attr_first) {
33 0 while (attr_last && attr_first) {
2643 12 21 if (attr_first == attr_last)
2655 50 2 RETVAL = newSVpv_utf8_auto(self->tree, root_name && root_name->key.length ? root_name->key.data : "", root_name ? root_name->key.length : 0);
50 2 RETVAL = newSVpv_utf8_auto(self->tree, root_name && root_name->key.length ? root_name->key.data : "", root_name ? root_name->key.length : 0);
46 4 RETVAL = newSVpv_utf8_auto(self->tree, root_name && root_name->key.length ? root_name->key.data : "", root_name ? root_name->key.length : 0);
2659 26 26 RETVAL = newSVpv_utf8_auto(self->tree, public_id && public_id->value.length ? public_id->value.data : "", public_id ? public_id->value.length : 0);
26 26 RETVAL = newSVpv_utf8_auto(self->tree, public_id && public_id->value.length ? public_id->value.data : "", public_id ? public_id->value.length : 0);
25 1 RETVAL = newSVpv_utf8_auto(self->tree, public_id && public_id->value.length ? public_id->value.data : "", public_id ? public_id->value.length : 0);
2663 34 18 RETVAL = newSVpv_utf8_auto(self->tree, system_id && system_id->value.length ? system_id->value.data : "", system_id ? system_id->value.length : 0);
34 18 RETVAL = newSVpv_utf8_auto(self->tree, system_id && system_id->value.length ? system_id->value.data : "", system_id ? system_id->value.length : 0);
26 8 RETVAL = newSVpv_utf8_auto(self->tree, system_id && system_id->value.length ? system_id->value.data : "", system_id ? system_id->value.length : 0);
2682 0 21 if (status) {
2684 0 0 sub_croak(cv, "mycss_init failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "mycss_init failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "mycss_init failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "mycss_init failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "mycss_init failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "mycss_init failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "mycss_init failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "mycss_init failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "mycss_init failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "mycss_init failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "mycss_init failed: %d (%s)", status, modest_strerror(status));
2689 0 21 if (status) {
2692 0 0 sub_croak(cv, "mycss_entry_init failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "mycss_entry_init failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "mycss_entry_init failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "mycss_entry_init failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "mycss_entry_init failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "mycss_entry_init failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "mycss_entry_init failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "mycss_entry_init failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "mycss_entry_init failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "mycss_entry_init failed: %d (%s)", status, modest_strerror(status));
0 0 sub_croak(cv, "mycss_entry_init failed: %d (%s)", status, modest_strerror(status));
2718 21 0 const char *query_str = SvPV_const(query, query_len);
2728 19 2 if (opts.utf8 == 2) {
2758 8 0 if (self->list)
2767 2 1 RETVAL = self->list ? !(self->list->flags & MyCSS_SELECTORS_FLAGS_SELECTOR_BAD) : 0;
1 1 RETVAL = self->list ? !(self->list->flags & MyCSS_SELECTORS_FLAGS_SELECTOR_BAD) : 0;
2776 1 0 if (self->list)
2786 1 0 RETVAL = self->list ? self->list->entries_list_length : 0;
2794 16 0 if (!self->list || index < 0 || index >= self->list->entries_list_length) {
15 1 if (!self->list || index < 0 || index >= self->list->entries_list_length) {
1 14 if (!self->list || index < 0 || index >= self->list->entries_list_length) {
2813 0 1 if (!value) {
2819 0 1 const char *enc_str = SvPV_const(value, enc_length);
2821 1 0 if (enc_length > 0) {
2822 1 0 if (isdigit(enc_str[0])) {
2823 1 0 self->utf8 = SvIV(value) != 0;
2840 20 1 if (self->list)
2876 3 1 while (entry) {
2877 1 2 if (entry->type == MyCSS_SELECTORS_TYPE_PSEUDO_ELEMENT) {
2878 1 0 RETVAL = newSVpv_utf8_auto_css(self->selector, entry->key->length ? entry->key->data : "", entry->key->length);
2935 1 1 RETVAL = name ? newSVpv(name, len) : &PL_sv_undef;
2945 2 0 const char *text_str = SvPV_const(text, text_len);
2949 1 1 RETVAL = encoding != MyENCODING_NOT_DETERMINED ? newSViv(encoding) : &PL_sv_undef;
2967 8 0 const char *text_str = SvPV_const(text, text_len);
2969 0 8 if (max_len > 0 && max_len < text_len)
0 0 if (max_len > 0 && max_len < text_len)
2976 0 2 if (!myencoding_detect(text_str, text_len, &encoding))
2985 0 3 if (!myencoding_detect_russian(text_str, text_len, &encoding))
2989 0 1 if (!myencoding_detect_unicode(text_str, text_len, &encoding))
2993 0 0 if (!myencoding_detect_bom(text_str, text_len, &encoding))
2997 0 1 if (!myencoding_extracting_character_encoding_from_charset(text_str, text_len, &encoding))
3012 1 0 const char *text_str = SvPV_const(text, text_len);
3014 0 1 if (max_len > 0 && max_len < text_len)
0 0 if (max_len > 0 && max_len < text_len)
3019 0 1 if (!myencoding_detect_and_cut_bom(text_str, text_len, &encoding, &text_str, &text_len))
3025 0 1 if (SvUTF8(text))
3039 5 0 const char *text_str = SvPV_const(text, text_len);
3041 0 5 if (max_len > 0 && max_len < text_len)
0 0 if (max_len > 0 && max_len < text_len)
3056 0 5 if (SvUTF8(text))