mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-22 02:09:24 +00:00
LibWeb: Use as_if<T>
in TreeNode methods
Some checks are pending
CI / Lagom (arm64, Sanitizer_CI, false, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (x86_64, Fuzzers_CI, false, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, false, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, true, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (arm64, macos-15, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (x86_64, ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
Some checks are pending
CI / Lagom (arm64, Sanitizer_CI, false, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (x86_64, Fuzzers_CI, false, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, false, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, true, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (arm64, macos-15, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (x86_64, ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
Using `as<T>` calls into `as_if<T>`, so let's just immediately use that for the "node of type" iterators. No functional changes.
This commit is contained in:
parent
6426586052
commit
e57e38dafc
Notes:
github-actions[bot]
2025-05-02 09:03:14 +00:00
Author: https://github.com/gmta
Commit: e57e38dafc
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4550
1 changed files with 12 additions and 12 deletions
|
@ -235,8 +235,8 @@ public:
|
|||
void for_each_child_of_type(Callback callback)
|
||||
{
|
||||
for (auto* node = first_child(); node; node = node->next_sibling()) {
|
||||
if (is<U>(node)) {
|
||||
if (callback(as<U>(*node)) == IterationDecision::Break)
|
||||
if (auto* node_of_type = as_if<U>(node)) {
|
||||
if (callback(*node_of_type) == IterationDecision::Break)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -258,8 +258,8 @@ public:
|
|||
inline U* next_sibling_of_type()
|
||||
{
|
||||
for (auto* sibling = next_sibling(); sibling; sibling = sibling->next_sibling()) {
|
||||
if (is<U>(*sibling))
|
||||
return &as<U>(*sibling);
|
||||
if (auto* sibling_of_type = as_if<U>(*sibling))
|
||||
return sibling_of_type;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -274,8 +274,8 @@ public:
|
|||
U* previous_sibling_of_type()
|
||||
{
|
||||
for (auto* sibling = previous_sibling(); sibling; sibling = sibling->previous_sibling()) {
|
||||
if (is<U>(*sibling))
|
||||
return &as<U>(*sibling);
|
||||
if (auto* sibling_of_type = as_if<U>(*sibling))
|
||||
return sibling_of_type;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -296,8 +296,8 @@ public:
|
|||
U* first_child_of_type()
|
||||
{
|
||||
for (auto* child = first_child(); child; child = child->next_sibling()) {
|
||||
if (is<U>(*child))
|
||||
return &as<U>(*child);
|
||||
if (auto* child_of_type = as_if<U>(*child))
|
||||
return child_of_type;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -306,8 +306,8 @@ public:
|
|||
U* last_child_of_type()
|
||||
{
|
||||
for (auto* child = last_child(); child; child = child->previous_sibling()) {
|
||||
if (is<U>(*child))
|
||||
return &as<U>(*child);
|
||||
if (auto* child_of_type = as_if<U>(*child))
|
||||
return child_of_type;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -322,8 +322,8 @@ public:
|
|||
U* first_ancestor_of_type()
|
||||
{
|
||||
for (auto* ancestor = parent(); ancestor; ancestor = ancestor->parent()) {
|
||||
if (is<U>(*ancestor))
|
||||
return &as<U>(*ancestor);
|
||||
if (auto* ancestor_of_type = as_if<U>(*ancestor))
|
||||
return ancestor_of_type;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue