1From ce1cb529bb5415e4ea17332731c20d2c78adc601 Mon Sep 17 00:00:00 2001 2From: Niels Dossche <7771979+nielsdos@users.noreply.github.com> 3Date: Mon, 14 Aug 2023 20:18:51 +0200 4Subject: [PATCH 2/6] Track implied added nodes for options use in PHP 5 6--- 7 source/lexbor/html/tree.h | 3 +++ 8 source/lexbor/html/tree/insertion_mode/after_head.c | 1 + 9 source/lexbor/html/tree/insertion_mode/before_head.c | 2 ++ 10 source/lexbor/html/tree/insertion_mode/before_html.c | 2 ++ 11 4 files changed, 8 insertions(+) 12 13diff --git a/source/lexbor/html/tree.h b/source/lexbor/html/tree.h 14index 2a43f8b..d964f01 100644 15--- a/source/lexbor/html/tree.h 16+++ b/source/lexbor/html/tree.h 17@@ -55,6 +55,9 @@ struct lxb_html_tree { 18 bool foster_parenting; 19 bool frameset_ok; 20 bool scripting; 21+ bool has_explicit_html_tag; 22+ bool has_explicit_head_tag; 23+ bool has_explicit_body_tag; 24 25 lxb_html_tree_insertion_mode_f mode; 26 lxb_html_tree_insertion_mode_f original_mode; 27diff --git a/source/lexbor/html/tree/insertion_mode/after_head.c b/source/lexbor/html/tree/insertion_mode/after_head.c 28index ad551b5..1448654 100644 29--- a/source/lexbor/html/tree/insertion_mode/after_head.c 30+++ b/source/lexbor/html/tree/insertion_mode/after_head.c 31@@ -71,6 +71,7 @@ lxb_html_tree_insertion_mode_after_head_open(lxb_html_tree_t *tree, 32 return lxb_html_tree_process_abort(tree); 33 } 34 35+ tree->has_explicit_body_tag = true; 36 tree->frameset_ok = false; 37 tree->mode = lxb_html_tree_insertion_mode_in_body; 38 39diff --git a/source/lexbor/html/tree/insertion_mode/before_head.c b/source/lexbor/html/tree/insertion_mode/before_head.c 40index 14621f2..cd2ac2a 100644 41--- a/source/lexbor/html/tree/insertion_mode/before_head.c 42+++ b/source/lexbor/html/tree/insertion_mode/before_head.c 43@@ -67,6 +67,8 @@ lxb_html_tree_insertion_mode_before_head_open(lxb_html_tree_t *tree, 44 return lxb_html_tree_process_abort(tree); 45 } 46 47+ tree->has_explicit_head_tag = true; 48+ 49 tree->mode = lxb_html_tree_insertion_mode_in_head; 50 51 break; 52diff --git a/source/lexbor/html/tree/insertion_mode/before_html.c b/source/lexbor/html/tree/insertion_mode/before_html.c 53index ed5e367..b078ac5 100644 54--- a/source/lexbor/html/tree/insertion_mode/before_html.c 55+++ b/source/lexbor/html/tree/insertion_mode/before_html.c 56@@ -79,6 +79,8 @@ lxb_html_tree_insertion_mode_before_html_open(lxb_html_tree_t *tree, 57 return lxb_html_tree_process_abort(tree); 58 } 59 60+ tree->has_explicit_html_tag = true; 61+ 62 tree->mode = lxb_html_tree_insertion_mode_before_head; 63 64 break; 65-- 662.44.0 67 68