mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-24 09:52:31 +00:00
LibWeb: Implement the translate attribute
This commit is contained in:
parent
4b3715ccba
commit
279913a223
Notes:
github-actions[bot]
2025-05-23 12:35:07 +00:00
Author: https://github.com/Calme1709
Commit: 279913a223
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4855
Reviewed-by: https://github.com/gmta ✅
24 changed files with 399 additions and 1 deletions
|
@ -104,6 +104,25 @@ bool HTMLElement::is_potentially_render_blocking()
|
|||
return is_implicitly_potentially_render_blocking();
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/dom.html#dom-translate
|
||||
bool HTMLElement::translate() const
|
||||
{
|
||||
// The translate IDL attribute must, on getting, return true if the element's translation mode is
|
||||
// translate-enabled, and false otherwise
|
||||
return translation_mode() == TranslationMode::TranslateEnabled;
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/dom.html#dom-translate
|
||||
void HTMLElement::set_translate(bool new_value)
|
||||
{
|
||||
// On setting, it must set the content attribute's value to "yes" if the new value is true, and set the content
|
||||
// attribute's value to "no" otherwise.
|
||||
if (new_value)
|
||||
MUST(set_attribute(HTML::AttributeNames::translate, "yes"_string));
|
||||
else
|
||||
MUST(set_attribute(HTML::AttributeNames::translate, "no"_string));
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/dom.html#dom-dir
|
||||
StringView HTMLElement::dir() const
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue