Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 179a9b95449564c6598507566f68e08be882fa3c
https://github.com/WebKit/WebKit/commit/179a9b95449564c6598507566f68e08be882fa3c
Author: Ahmad Saleem <[email protected]>
Date: 2026-07-08 (Wed, 08 Jul 2026)
Changed paths:
M Source/WebCore/dom/Node.cpp
Log Message:
-----------
Node::lastDescendant()/firstDescendant() call lastChild()/firstChild() twice
per iteration
https://bugs.webkit.org/show_bug.cgi?id=318309
rdar://181101887
Reviewed by Ryosuke Niwa.
lastDescendant() and firstDescendant() evaluated the child accessor
twice on every loop iteration: once in the while condition and again in
the loop body. Bind the result in the condition so the accessor is
called once per step. This also removes the redundant null check on the
walker, which starts at `this` (non-null) and is only ever reassigned to
a non-null child.
No change in behavior.
* Source/WebCore/dom/Node.cpp:
(WebCore::Node::lastDescendant const):
(WebCore::Node::firstDescendant const):
Canonical link: https://commits.webkit.org/316769@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications