mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
LibWeb: Implement HTMLStyleElement.disabled
This commit is contained in:
parent
be08abbf8a
commit
1114bbf2f1
Notes:
sideshowbarker
2024-07-17 07:35:03 +09:00
Author: https://github.com/jamierocks Commit: https://github.com/LadybirdBrowser/ladybird/commit/1114bbf2f1 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/242 Reviewed-by: https://github.com/AtkinsSJ ✅
3 changed files with 32 additions and 1 deletions
|
@ -1,6 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
|
* Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
|
||||||
* Copyright (c) 2021, the SerenityOS developers.
|
* Copyright (c) 2021, the SerenityOS developers.
|
||||||
|
* Copyright (c) 2024, Jamie Mansfield <jmansfield@cadixdev.org>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -49,6 +50,33 @@ void HTMLStyleElement::removed_from(Node* old_parent)
|
||||||
Base::removed_from(old_parent);
|
Base::removed_from(old_parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/semantics.html#dom-style-disabled
|
||||||
|
bool HTMLStyleElement::disabled()
|
||||||
|
{
|
||||||
|
// 1. If this does not have an associated CSS style sheet, return false.
|
||||||
|
if (!sheet())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// 2. If this's associated CSS style sheet's disabled flag is set, return true.
|
||||||
|
if (sheet()->disabled())
|
||||||
|
return true;
|
||||||
|
|
||||||
|
// 3. Return false.
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/semantics.html#dom-style-disabled
|
||||||
|
void HTMLStyleElement::set_disabled(bool disabled)
|
||||||
|
{
|
||||||
|
// 1. If this does not have an associated CSS style sheet, return.
|
||||||
|
if (!sheet())
|
||||||
|
return;
|
||||||
|
|
||||||
|
// 2. If the given value is true, set this's associated CSS style sheet's disabled flag.
|
||||||
|
// Otherwise, unset this's associated CSS style sheet's disabled flag.
|
||||||
|
sheet()->set_disabled(disabled);
|
||||||
|
}
|
||||||
|
|
||||||
// https://www.w3.org/TR/cssom/#dom-linkstyle-sheet
|
// https://www.w3.org/TR/cssom/#dom-linkstyle-sheet
|
||||||
CSS::CSSStyleSheet* HTMLStyleElement::sheet()
|
CSS::CSSStyleSheet* HTMLStyleElement::sheet()
|
||||||
{
|
{
|
||||||
|
|
|
@ -23,6 +23,9 @@ public:
|
||||||
virtual void inserted() override;
|
virtual void inserted() override;
|
||||||
virtual void removed_from(Node*) override;
|
virtual void removed_from(Node*) override;
|
||||||
|
|
||||||
|
bool disabled();
|
||||||
|
void set_disabled(bool disabled);
|
||||||
|
|
||||||
CSS::CSSStyleSheet* sheet();
|
CSS::CSSStyleSheet* sheet();
|
||||||
CSS::CSSStyleSheet const* sheet() const;
|
CSS::CSSStyleSheet const* sheet() const;
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
interface HTMLStyleElement : HTMLElement {
|
interface HTMLStyleElement : HTMLElement {
|
||||||
[HTMLConstructor] constructor();
|
[HTMLConstructor] constructor();
|
||||||
|
|
||||||
[FIXME] attribute boolean disabled;
|
attribute boolean disabled;
|
||||||
[Reflect, CEReactions] attribute DOMString media;
|
[Reflect, CEReactions] attribute DOMString media;
|
||||||
[FIXME, SameObject, PutForwards=value] readonly attribute DOMTokenList blocking;
|
[FIXME, SameObject, PutForwards=value] readonly attribute DOMTokenList blocking;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue