mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-02-04 14:33:47 +00:00
implement html5ever createPI callback
This commit is contained in:
@@ -43,6 +43,7 @@ pub extern "C" fn html5ever_parse_document(
|
||||
parse_error_callback: ParseErrorCallback,
|
||||
pop_callback: PopCallback,
|
||||
create_comment_callback: CreateCommentCallback,
|
||||
create_processing_instruction: CreateProcessingInstruction,
|
||||
append_doctype_to_document: AppendDoctypeToDocumentCallback,
|
||||
add_attrs_if_missing_callback: AddAttrsIfMissingCallback,
|
||||
get_template_contents_callback: GetTemplateContentsCallback,
|
||||
@@ -66,6 +67,7 @@ pub extern "C" fn html5ever_parse_document(
|
||||
parse_error_callback: parse_error_callback,
|
||||
create_element_callback: create_element_callback,
|
||||
create_comment_callback: create_comment_callback,
|
||||
create_processing_instruction: create_processing_instruction,
|
||||
append_doctype_to_document: append_doctype_to_document,
|
||||
add_attrs_if_missing_callback: add_attrs_if_missing_callback,
|
||||
get_template_contents_callback: get_template_contents_callback,
|
||||
@@ -91,6 +93,7 @@ pub extern "C" fn html5ever_parse_fragment(
|
||||
parse_error_callback: ParseErrorCallback,
|
||||
pop_callback: PopCallback,
|
||||
create_comment_callback: CreateCommentCallback,
|
||||
create_processing_instruction: CreateProcessingInstruction,
|
||||
append_doctype_to_document: AppendDoctypeToDocumentCallback,
|
||||
add_attrs_if_missing_callback: AddAttrsIfMissingCallback,
|
||||
get_template_contents_callback: GetTemplateContentsCallback,
|
||||
@@ -114,6 +117,7 @@ pub extern "C" fn html5ever_parse_fragment(
|
||||
parse_error_callback: parse_error_callback,
|
||||
create_element_callback: create_element_callback,
|
||||
create_comment_callback: create_comment_callback,
|
||||
create_processing_instruction: create_processing_instruction,
|
||||
append_doctype_to_document: append_doctype_to_document,
|
||||
add_attrs_if_missing_callback: add_attrs_if_missing_callback,
|
||||
get_template_contents_callback: get_template_contents_callback,
|
||||
@@ -199,6 +203,7 @@ pub extern "C" fn html5ever_streaming_parser_create(
|
||||
parse_error_callback: ParseErrorCallback,
|
||||
pop_callback: PopCallback,
|
||||
create_comment_callback: CreateCommentCallback,
|
||||
create_processing_instruction: CreateProcessingInstruction,
|
||||
append_doctype_to_document: AppendDoctypeToDocumentCallback,
|
||||
add_attrs_if_missing_callback: AddAttrsIfMissingCallback,
|
||||
get_template_contents_callback: GetTemplateContentsCallback,
|
||||
@@ -225,6 +230,7 @@ pub extern "C" fn html5ever_streaming_parser_create(
|
||||
parse_error_callback: parse_error_callback,
|
||||
create_element_callback: create_element_callback,
|
||||
create_comment_callback: create_comment_callback,
|
||||
create_processing_instruction: create_processing_instruction,
|
||||
append_doctype_to_document: append_doctype_to_document,
|
||||
add_attrs_if_missing_callback: add_attrs_if_missing_callback,
|
||||
get_template_contents_callback: get_template_contents_callback,
|
||||
|
||||
@@ -54,6 +54,7 @@ pub struct Sink<'arena> {
|
||||
pub parse_error_callback: ParseErrorCallback,
|
||||
pub create_element_callback: CreateElementCallback,
|
||||
pub create_comment_callback: CreateCommentCallback,
|
||||
pub create_processing_instruction: CreateProcessingInstruction,
|
||||
pub append_doctype_to_document: AppendDoctypeToDocumentCallback,
|
||||
pub add_attrs_if_missing_callback: AddAttrsIfMissingCallback,
|
||||
pub get_template_contents_callback: GetTemplateContentsCallback,
|
||||
@@ -144,9 +145,11 @@ impl<'arena> TreeSink for Sink<'arena> {
|
||||
}
|
||||
|
||||
fn create_pi(&self, target: StrTendril, data: StrTendril) -> Ref {
|
||||
_ = target;
|
||||
_ = data;
|
||||
panic!("create_pi");
|
||||
let str_target = StringSlice{ ptr: target.as_ptr(), len: target.len()};
|
||||
let str_data = StringSlice{ ptr: data.as_ptr(), len: data.len()};
|
||||
unsafe {
|
||||
return (self.create_processing_instruction)(self.ctx, str_target, str_data);
|
||||
}
|
||||
}
|
||||
|
||||
fn append(&self, parent: &Ref, child: NodeOrText<Ref>) {
|
||||
|
||||
@@ -39,6 +39,12 @@ pub type AppendDoctypeToDocumentCallback = unsafe extern "C" fn(
|
||||
system_id: StringSlice,
|
||||
) -> ();
|
||||
|
||||
pub type CreateProcessingInstruction = unsafe extern "C" fn(
|
||||
ctx: Ref,
|
||||
target: StringSlice,
|
||||
data: StringSlice,
|
||||
) -> Ref;
|
||||
|
||||
pub type GetDataCallback = unsafe extern "C" fn(ctx: Ref) -> *mut c_void;
|
||||
|
||||
pub type AppendCallback = unsafe extern "C" fn(
|
||||
|
||||
Reference in New Issue
Block a user