1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 06:07:34 +00:00

LibWeb: Give Document a "target element"

The target element is the one matching the URL fragment. We don't yet
set it to anything.
This commit is contained in:
Sam Atkins 2023-08-11 20:14:44 +01:00 committed by Andreas Kling
parent 28aa4ca767
commit 13b4bf48a8
4 changed files with 28 additions and 1 deletions

View file

@ -2,7 +2,7 @@
* Copyright (c) 2018-2023, Andreas Kling <kling@serenityos.org>
* Copyright (c) 2021-2023, Linus Groh <linusg@serenityos.org>
* Copyright (c) 2021-2023, Luke Wilde <lukew@serenityos.org>
* Copyright (c) 2021, Sam Atkins <atkinssj@serenityos.org>
* Copyright (c) 2021-2023, Sam Atkins <atkinssj@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@ -1713,6 +1713,23 @@ void Document::set_active_element(Element* element)
m_layout_root->set_needs_display();
}
void Document::set_target_element(Element* element)
{
if (m_target_element.ptr() == element)
return;
if (m_target_element)
m_target_element->set_needs_style_update(true);
m_target_element = element;
if (m_target_element)
m_target_element->set_needs_style_update(true);
if (m_layout_root)
m_layout_root->set_needs_display();
}
DeprecatedString Document::ready_state() const
{
switch (m_readiness) {