mirror of
https://github.com/RGBCube/serenity
synced 2025-09-14 12:08:00 +00:00
LibWeb: Implement EventHandler::focus_previous_element()
This implements EventHandler::focus_previous_element() so we can cycle backwards through focusable elements on a web page with Shift+Tab.
This commit is contained in:
parent
3f9fc0f690
commit
bf7f6a9e98
2 changed files with 26 additions and 2 deletions
|
@ -24,6 +24,15 @@ public:
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
Element* previous_element_in_pre_order()
|
||||
{
|
||||
for (auto* node = static_cast<NodeType*>(this)->previous_in_pre_order(); node; node = node->previous_in_pre_order()) {
|
||||
if (is<Element>(*node))
|
||||
return verify_cast<Element>(node);
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Element* next_element_sibling()
|
||||
{
|
||||
for (auto* sibling = static_cast<NodeType*>(this)->next_sibling(); sibling; sibling = sibling->next_sibling()) {
|
||||
|
@ -43,6 +52,7 @@ public:
|
|||
}
|
||||
|
||||
const Element* previous_element_sibling() const { return const_cast<NonDocumentTypeChildNode*>(this)->previous_element_sibling(); }
|
||||
const Element* previous_element_in_pre_order() const { return const_cast<NonDocumentTypeChildNode*>(this)->previous_element_in_pre_order(); }
|
||||
const Element* next_element_sibling() const { return const_cast<NonDocumentTypeChildNode*>(this)->next_element_sibling(); }
|
||||
const Element* next_element_in_pre_order() const { return const_cast<NonDocumentTypeChildNode*>(this)->next_element_in_pre_order(); }
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue