dymokomi/luce-browser-engine
Source of release 0.6.1
0.6.1 / src / web / dom / document_h_1.lucb
#==============================================================================================
#
# document_h_1 - DOM::Document: the inline functions of Document.h (accessors, part 1)
#
# DESCRIPTION:
# Port of the functions defined in LibWeb/DOM/Document.h (lines 226-650), in the
# header's order: the accessors and setters of the document's state, the encoding
# queries, the quirks-mode and document-type tests, the visibility state, the parser
# link and for_each_node_iterator.
#
# Document.h also declares invalidate_style_of_elements_affected_by_has() and
# build_counter_style_cache(), which the donor never defines (and nothing calls); they
# are not ported.
#
#==============================================================================================
# mark: Accessors ===============================================================================
## Ported from Document.h:226 Web::DOM::Document::dom_tree_version.
pub func dom_document_dom_tree_version(this: DomDocument*) -> u64:
return this.m_dom_tree_version
## Ported from Document.h:227 Web::DOM::Document::bump_dom_tree_version.
pub func dom_document_bump_dom_tree_version(this: DomDocument*):
this.m_dom_tree_version += 1
## Ported from Document.h:231 Web::DOM::Document::character_data_version.
pub func dom_document_character_data_version(this: DomDocument*) -> u64:
return this.m_character_data_version
## Ported from Document.h:232 Web::DOM::Document::bump_character_data_version.
pub func dom_document_bump_character_data_version(this: DomDocument*):
this.m_character_data_version += 1
## Ported from Document.h:242 Web::DOM::Document::set_cookie_version_index.
pub func dom_document_set_cookie_version_index(this: DomDocument*, cookie_version_index: u32):
this.m_cookie_version_index = cookie_version_index
## Ported from Document.h:243 Web::DOM::Document::reset_cookie_version.
pub func dom_document_reset_cookie_version(this: DomDocument*):
# Core::INVALID_SHARED_VERSION
this.m_cookie_version = 0
## Ported from Document.h:264 Web::DOM::Document::url.
pub func dom_document_url(this: DomDocument*) -> web_url.Url:
return this.m_url
## Ported from Document.h:273 Web::DOM::Document::url_string.
pub func dom_document_url_string(this: DomDocument*) -> ak.String:
return web_url.url_to_string(&this.m_url)
## Ported from Document.h:274 Web::DOM::Document::document_uri.
pub func dom_document_document_uri(this: DomDocument*) -> ak.String:
return dom_document_url_string(this)
## Ported from Document.h:279 Web::DOM::Document::opener_policy.
pub func dom_document_opener_policy(this: DomDocument*) -> HtmlOpenerPolicy:
return this.m_opener_policy
## Ported from Document.h:280 Web::DOM::Document::set_opener_policy.
pub func dom_document_set_opener_policy(this: DomDocument*, policy: HtmlOpenerPolicy):
this.m_opener_policy = policy
## Ported from Document.h:285 Web::DOM::Document::style_computer.
pub func dom_document_style_computer(this: DomDocument*) -> CssStyleComputer*:
return this.m_style_computer else trap("the document has no style computer")
## Ported from Document.h:286 Web::DOM::Document::style_computer.
pub func dom_document_style_computer_const(this: DomDocument*) -> CssStyleComputer*:
return this.m_style_computer else trap("the document has no style computer")
## Ported from Document.h:288 Web::DOM::Document::font_computer.
pub func dom_document_font_computer(this: DomDocument*) -> CssFontComputer*:
return this.m_font_computer else trap("the document has no font computer")
## Ported from Document.h:289 Web::DOM::Document::font_computer.
pub func dom_document_font_computer_const(this: DomDocument*) -> CssFontComputer*:
return this.m_font_computer else trap("the document has no font computer")
## Ported from Document.h:296 Web::DOM::Document::style_sheets_for_bindings.
pub func dom_document_style_sheets_for_bindings(this: DomDocument*) -> CssStyleSheetList*?:
return dom_document_style_sheets(this)
## Ported from Document.h:302 Web::DOM::Document::node_name (override).
pub func dom_document_node_name_impl(base: DomNode*) -> ak.FlyString:
return ak.fly_string_from_str("#document")
## Ported from Document.h:305 Web::DOM::Document::hovered_node.
pub func dom_document_hovered_node(this: DomDocument*) -> DomNode*?:
return this.m_hovered_node
## Ported from Document.h:306 Web::DOM::Document::hovered_node.
pub func dom_document_hovered_node_const(this: DomDocument*) -> DomNode*?:
return this.m_hovered_node
## Ported from Document.h:309 Web::DOM::Document::inspected_node.
pub func dom_document_inspected_node(this: DomDocument*) -> DomNode*?:
return this.m_inspected_node
## Ported from Document.h:312 Web::DOM::Document::highlighted_node.
pub func dom_document_highlighted_node(this: DomDocument*) -> DomNode*?:
return this.m_highlighted_node
## Ported from Document.h:314 Web::DOM::Document::highlighted_layout_node.
pub func dom_document_highlighted_layout_node_const(this: DomDocument*) -> LayoutNode*?:
return dom_document_highlighted_layout_node(this)
## Ported from Document.h:331 Web::DOM::Document::html_element.
pub func dom_document_html_element_const(this: DomDocument*) -> HtmlHtmlElement*?:
return dom_document_html_element(this)
## Ported from Document.h:336 Web::DOM::Document::head.
pub func dom_document_head_const(this: DomDocument*) -> HtmlHeadElement*?:
return dom_document_head(this)
## Ported from Document.h:341 Web::DOM::Document::title_element.
pub func dom_document_title_element_const(this: DomDocument*) -> HtmlTitleElement*?:
return dom_document_title_element(this)
## Ported from Document.h:346 Web::DOM::Document::body.
pub func dom_document_body_const(this: DomDocument*) -> HtmlElement*?:
return dom_document_body(this)
## Ported from Document.h:356 Web::DOM::Document::browsing_context.
pub func dom_document_browsing_context(this: DomDocument*) -> HtmlBrowsingContext*?:
return this.m_browsing_context
## Ported from Document.h:357 Web::DOM::Document::browsing_context.
pub func dom_document_browsing_context_const(this: DomDocument*) -> HtmlBrowsingContext*?:
return this.m_browsing_context
## Ported from Document.h:427 Web::DOM::Document::source.
pub func dom_document_source(this: DomDocument*) -> ak.String:
return this.m_source
## Ported from Document.h:428 Web::DOM::Document::set_source.
pub func dom_document_set_source(this: DomDocument*, source: ak.String):
this.m_source = source
## Ported from Document.h:447 Web::DOM::Document::pending_parsing_blocking_script.
pub func dom_document_pending_parsing_blocking_script(this: DomDocument*) -> HtmlScriptElement*?:
return this.m_pending_parsing_blocking_script
## Ported from Document.h:451 Web::DOM::Document::pending_parsing_blocking_svg_script.
pub func dom_document_pending_parsing_blocking_svg_script(this: DomDocument*) -> SvgScriptElement*?:
return this.m_pending_parsing_blocking_svg_script
## Ported from Document.h:453 Web::DOM::Document::has_pending_parsing_blocking_script.
pub func dom_document_has_pending_parsing_blocking_script(this: DomDocument*) -> bool:
return this.m_pending_parsing_blocking_script != none or this.m_pending_parsing_blocking_svg_script != none
## Ported from Document.h:460 Web::DOM::Document::scripts_to_execute_when_parsing_has_finished.
pub func dom_document_scripts_to_execute_when_parsing_has_finished(this: DomDocument*) -> ak.Vector[HtmlScriptElement*]*:
return &this.m_scripts_to_execute_when_parsing_has_finished
## Ported from Document.h:464 Web::DOM::Document::scripts_to_execute_as_soon_as_possible.
pub func dom_document_scripts_to_execute_as_soon_as_possible(this: DomDocument*) -> ak.Vector[HtmlScriptElement*]*:
return &this.m_scripts_to_execute_as_soon_as_possible
## Ported from Document.h:468 Web::DOM::Document::scripts_to_execute_in_order_as_soon_as_possible.
pub func dom_document_scripts_to_execute_in_order_as_soon_as_possible(this: DomDocument*) -> ak.Vector[HtmlScriptElement*]*:
return &this.m_scripts_to_execute_in_order_as_soon_as_possible
## Ported from Document.h:470 Web::DOM::Document::mode.
pub func dom_document_mode(this: DomDocument*) -> DomQuirksMode:
return this.m_quirks_mode
## Ported from Document.h:471 Web::DOM::Document::in_quirks_mode.
pub func dom_document_in_quirks_mode(this: DomDocument*) -> bool:
return this.m_quirks_mode == DomQuirksMode.yes
## Ported from Document.h:472 Web::DOM::Document::in_limited_quirks_mode.
pub func dom_document_in_limited_quirks_mode(this: DomDocument*) -> bool:
return this.m_quirks_mode == DomQuirksMode.limited
## Ported from Document.h:473 Web::DOM::Document::set_quirks_mode.
pub func dom_document_set_quirks_mode(this: DomDocument*, mode: DomQuirksMode):
this.m_quirks_mode = mode
## Ported from Document.h:475 Web::DOM::Document::parser_cannot_change_the_mode.
pub func dom_document_parser_cannot_change_the_mode(this: DomDocument*) -> bool:
return this.m_parser_cannot_change_the_mode
## Ported from Document.h:476 Web::DOM::Document::set_parser_cannot_change_the_mode.
pub func dom_document_set_parser_cannot_change_the_mode(this: DomDocument*, parser_cannot_change_the_mode: bool):
this.m_parser_cannot_change_the_mode = parser_cannot_change_the_mode
## Ported from Document.h:478 Web::DOM::Document::document_type.
pub func dom_document_document_type(this: DomDocument*) -> DocumentDomDocumentType:
return this.m_type
## Ported from Document.h:479 Web::DOM::Document::set_document_type.
pub func dom_document_set_document_type(this: DomDocument*, type_: DocumentDomDocumentType):
this.m_type = type_
## Ported from Document.h:482 Web::DOM::Document::is_html_document.
pub func dom_document_is_html_document(this: DomDocument*) -> bool:
return this.m_type == DocumentDomDocumentType.html
## Ported from Document.h:485 Web::DOM::Document::is_xml_document.
pub func dom_document_is_xml_document(this: DomDocument*) -> bool:
return this.m_type == DocumentDomDocumentType.xml
## Ported from Document.h:494 Web::DOM::Document::set_editable.
pub func dom_document_set_editable(this: DomDocument*, editable: bool):
this.m_editable = editable
## Ported from Document.h:497 Web::DOM::Document::focused_area.
pub func dom_document_focused_area(this: DomDocument*) -> DomNode*?:
return this.m_focused_area
## Ported from Document.h:498 Web::DOM::Document::focused_area.
pub func dom_document_focused_area_const(this: DomDocument*) -> DomNode*?:
return this.m_focused_area
## Ported from Document.h:501 Web::DOM::Document::last_focus_trigger.
pub func dom_document_last_focus_trigger(this: DomDocument*) -> HtmlFocusTrigger:
return this.m_last_focus_trigger
## Ported from Document.h:502 Web::DOM::Document::set_last_focus_trigger.
pub func dom_document_set_last_focus_trigger(this: DomDocument*, trigger: HtmlFocusTrigger):
this.m_last_focus_trigger = trigger
## Ported from Document.h:507 Web::DOM::Document::target_element.
pub func dom_document_target_element(this: DomDocument*) -> DomElement*?:
return this.m_target_element
## Ported from Document.h:510 Web::DOM::Document::autofocus_candidates.
pub func dom_document_autofocus_candidates(this: DomDocument*) -> ak.Vector[DomElement*]*:
return &this.m_autofocus_candidates
## Ported from Document.h:511 Web::DOM::Document::autofocus_processed_flag.
pub func dom_document_autofocus_processed_flag(this: DomDocument*) -> bool:
return this.m_autofocus_processed_flag
## Ported from Document.h:512 Web::DOM::Document::set_autofocus_processed_flag.
pub func dom_document_set_autofocus_processed_flag(this: DomDocument*, value: bool):
this.m_autofocus_processed_flag = value
## Ported from Document.h:519 Web::DOM::Document::created_for_appropriate_template_contents.
pub func dom_document_created_for_appropriate_template_contents(this: DomDocument*) -> bool:
return this.m_created_for_appropriate_template_contents
## Ported from Document.h:524 Web::DOM::Document::readiness.
pub func dom_document_readiness(this: DomDocument*) -> HtmlDocumentReadyState:
return this.m_readiness
## Ported from Document.h:529 Web::DOM::Document::window.
pub func dom_document_window(this: DomDocument*) -> HtmlWindow*?:
return this.m_window
## Ported from Document.h:543 Web::DOM::Document::content_type.
pub func dom_document_content_type(this: DomDocument*) -> ak.String:
return this.m_content_type
## Ported from Document.h:544 Web::DOM::Document::set_content_type.
pub func dom_document_set_content_type(this: DomDocument*, content_type: ak.String):
this.m_content_type = content_type
## Ported from Document.h:546 Web::DOM::Document::pragma_set_default_language.
pub func dom_document_pragma_set_default_language(this: DomDocument*) -> ak.String?:
return this.m_pragma_set_default_language
## Ported from Document.h:547 Web::DOM::Document::set_pragma_set_default_language.
pub func dom_document_set_pragma_set_default_language(this: DomDocument*, language: ak.String):
this.m_pragma_set_default_language = language
## Ported from Document.h:548 Web::DOM::Document::http_content_language.
pub func dom_document_http_content_language(this: DomDocument*) -> ak.String?:
return this.m_http_content_language
## Ported from Document.h:550 Web::DOM::Document::has_encoding.
pub func dom_document_has_encoding(this: DomDocument*) -> bool:
return this.m_encoding != none
## Ported from Document.h:551 Web::DOM::Document::encoding.
pub func dom_document_encoding(this: DomDocument*) -> ak.String?:
return this.m_encoding
## Ported from Document.h:552 Web::DOM::Document::encoding_or_default.
pub func dom_document_encoding_or_default(this: DomDocument*) -> ak.String:
return this.m_encoding else ak.string_from_str("UTF-8")
## Ported from Document.h:553 Web::DOM::Document::set_encoding.
pub func dom_document_set_encoding(this: DomDocument*, encoding: ak.String?):
this.m_encoding = encoding
## Ported from Document.h:556 Web::DOM::Document::character_set.
pub func dom_document_character_set(this: DomDocument*) -> ak.String:
return dom_document_encoding_or_default(this)
## Ported from Document.h:557 Web::DOM::Document::charset.
pub func dom_document_charset(this: DomDocument*) -> ak.String:
return dom_document_encoding_or_default(this)
## Ported from Document.h:558 Web::DOM::Document::input_encoding.
pub func dom_document_input_encoding(this: DomDocument*) -> ak.String:
return dom_document_encoding_or_default(this)
## Ported from Document.h:560 Web::DOM::Document::ready_for_post_load_tasks.
pub func dom_document_ready_for_post_load_tasks(this: DomDocument*) -> bool:
return this.m_ready_for_post_load_tasks
## Ported from Document.h:564 Web::DOM::Document::completely_loaded_deferred.
pub func dom_document_completely_loaded_deferred(this: DomDocument*) -> bool:
return this.m_completely_loaded_deferred
## Ported from Document.h:568 Web::DOM::Document::current_script.
pub func dom_document_current_script(this: DomDocument*) -> HtmlScriptElement*?:
return this.m_current_script
## Ported from Document.h:569 Web::DOM::Document::set_current_script.
pub func dom_document_set_current_script(this: DomDocument*, script: HtmlScriptElement*?):
this.m_current_script = script
## Ported from Document.h:571 Web::DOM::Document::ignore_destructive_writes_counter.
pub func dom_document_ignore_destructive_writes_counter(this: DomDocument*) -> u32:
return this.m_ignore_destructive_writes_counter
## Ported from Document.h:572 Web::DOM::Document::increment_ignore_destructive_writes_counter.
pub func dom_document_increment_ignore_destructive_writes_counter(this: DomDocument*):
this.m_ignore_destructive_writes_counter += 1
## Ported from Document.h:573 Web::DOM::Document::decrement_ignore_destructive_writes_counter.
pub func dom_document_decrement_ignore_destructive_writes_counter(this: DomDocument*):
this.m_ignore_destructive_writes_counter -= 1
## Ported from Document.h:603 Web::DOM::Document::page_showing.
pub func dom_document_page_showing(this: DomDocument*) -> bool:
return this.m_page_showing
## Ported from Document.h:608 Web::DOM::Document::visibility_state_value.
pub func dom_document_visibility_state_value(this: DomDocument*) -> HtmlVisibilityState:
return this.m_visibility_state
## Ported from Document.h:617 Web::DOM::Document::set_needs_media_query_evaluation.
pub func dom_document_set_needs_media_query_evaluation(this: DomDocument*):
this.m_needs_media_query_evaluation = true
## Ported from Document.h:634 Web::DOM::Document::parser.
pub func dom_document_parser(this: DomDocument*) -> HtmlParser*?:
return this.m_parser
## Ported from Document.h:636 Web::DOM::Document::is_temporary_document_for_fragment_parsing.
pub func dom_document_is_temporary_document_for_fragment_parsing(this: DomDocument*) -> bool:
return this.m_temporary_document_for_fragment_parsing == DomDocumentTemporaryDocumentForFragmentParsing.yes
## Ported from Document.h:650 Web::DOM::Document::for_each_node_iterator.
pub func dom_document_for_each_node_iterator(this: DomDocument*, callback: ak.Function1[DomNodeIterator*, unit]):
for node_iterator in ak.hash_table_begin(&this.m_node_iterators):
ak.function1_call(&callback, *node_iterator else trap("a null node iterator"))