[webkit-reviews] review granted: [Bug 221316] Optimize PointerCaptureController::elementWasRemoved() : [Attachment 419102] Patch
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Tue Feb 2 22:02:50 PST 2021
Ryosuke Niwa <rniwa at webkit.org> has granted Simon Fraser (smfr)
<simon.fraser at apple.com>'s request for review:
Bug 221316: Optimize PointerCaptureController::elementWasRemoved()
https://bugs.webkit.org/show_bug.cgi?id=221316
Attachment 419102: Patch
https://bugs.webkit.org/attachment.cgi?id=419102&action=review
--- Comment #2 from Ryosuke Niwa <rniwa at webkit.org> ---
Comment on attachment 419102
--> https://bugs.webkit.org/attachment.cgi?id=419102
Patch
View in context: https://bugs.webkit.org/attachment.cgi?id=419102&action=review
> Source/WebCore/page/PointerCaptureController.cpp:178
> +void PointerCaptureController::updateHaveAnyCapturingElement()
Do we need to eagerly update this or can we compute it lazily?
e.g. use Optional<bool> for m_haveAnyCapturingElement
and then haveAnyCapturingElement() inlined like haveAnyCapturingElement() {
return m_haveAnyCapturingElement ? *m_haveAnyCapturingElement :
haveAnyCapturingElementSlowCase(); }
> Source/WebCore/page/PointerCaptureController.cpp:180
> + auto haveAnyCapturingElement = [&] {
Do we really need to use lambda here?
I find that setting m_haveAnyCapturingElement = false and breaking when the
condition is hit would be easier to read.
Alternatively, can we just use anyOf in Algorithms.h so that:
m_haveAnyCapturingElement =
WTF::anyOf(m_activePointerIdsToCapturingData.values(), [&] { ~ })
> Source/WebCore/page/PointerCaptureController.cpp:183
> + if (capturingData.pendingTargetOverride ||
capturingData.targetOverride
Can we add a helper function on CapturingData like
CapturingData::hasCapturingElement()?
More information about the webkit-reviews
mailing list