mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1225873 - micro-optimize creating event target chains; r=smaug
This code is only called in a few cases that aren't on the critical path, but less code is less code: we eliminate the checks for whether we have enough space in the copying loop, and maybe save some function calls.
This commit is contained in:
parent
53349d20c9
commit
23ca44b6a7
@ -642,9 +642,10 @@ EventDispatcher::Dispatch(nsISupports* aTarget,
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
if (aTargets) {
|
||||
aTargets->Clear();
|
||||
aTargets->SetCapacity(chain.Length());
|
||||
for (uint32_t i = 0; i < chain.Length(); ++i) {
|
||||
aTargets->AppendElement(chain[i].CurrentTarget()->GetTargetForDOMEvent());
|
||||
uint32_t numTargets = chain.Length();
|
||||
EventTarget** targets = aTargets->AppendElements(numTargets);
|
||||
for (uint32_t i = 0; i < numTargets; ++i) {
|
||||
targets[i] = chain[i].CurrentTarget()->GetTargetForDOMEvent();
|
||||
}
|
||||
} else {
|
||||
// Event target chain is created. Handle the chain.
|
||||
|
Loading…
Reference in New Issue
Block a user