Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: e810250b2ddff090916b496bbc09b774cb1e06e6
https://github.com/WebKit/WebKit/commit/e810250b2ddff090916b496bbc09b774cb1e06e6
Author: Ahmad Saleem <[email protected]>
Date: 2026-08-04 (Tue, 04 Aug 2026)
Changed paths:
M Source/WebCore/dom/Document.cpp
Log Message:
-----------
Avoid unnecessary Region copies when returning RegionFixedPair from Document
https://bugs.webkit.org/show_bug.cgi?id=320757
rdar://183757084
Reviewed by Chris Dumez.
Document::RegionFixedPair is std::pair<Region, bool>, and Region owns its
data through a std::unique_ptr<Shape>, so copying one allocates a Shape and
copies its two Vectors. Both absoluteEventRegionForNode() and
absoluteRegionForWheelEventTargets() constructed the returned pair from a
local lvalue, which binds to pair's const Region& constructor, so the
implicit move on return did not apply and the Region was copied.
Move the local Region into the pair instead. In
absoluteRegionForWheelEventTargets() the united region generally does carry
a Shape by the time it is returned, so this removes a heap allocation from
every caller (ScrollingCoordinator and DebugPageOverlays). In
absoluteEventRegionForNode() the region is always rect-only, so the change
is only for consistency.
No change in behavior.
* Source/WebCore/dom/Document.cpp:
(WebCore::Document::absoluteEventRegionForNode):
(WebCore::Document::absoluteRegionForWheelEventTargets):
Canonical link: https://commits.webkit.org/318531@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications