mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-05 07:18:39 +09:00
Optimize array capacity settings in style and SVG processing classes
This commit is contained in:
parent
d8c48d6830
commit
cd020e380d
3 changed files with 6 additions and 2 deletions
|
|
@ -530,7 +530,7 @@ nsStyleSet::GatherRuleProcessors(SheetType aType)
|
|||
scope->SetIsScopedStyleRoot();
|
||||
|
||||
// Create a rule processor for the scope.
|
||||
nsTArray<RefPtr<CSSStyleSheet>> sheetsForScope;
|
||||
nsTArray<RefPtr<CSSStyleSheet>> sheetsForScope(end - start);
|
||||
sheetsForScope.AppendElements(sheets.Elements() + start, end - start);
|
||||
nsCSSRuleProcessor* oldRP = oldScopedRuleProcessorHash.Get(scope);
|
||||
mScopedDocSheetRuleProcessors.AppendElement
|
||||
|
|
|
|||
|
|
@ -409,7 +409,7 @@ nsCSSFilterInstance::SetBounds(FilterPrimitiveDescription& aDescr,
|
|||
nsIntRect inputBounds = (inputIndex < 0) ?
|
||||
mTargetBoundsInFilterSpace : aPrimitiveDescrs[inputIndex].PrimitiveSubregion();
|
||||
|
||||
nsTArray<nsIntRegion> inputExtents;
|
||||
AutoTArray<nsIntRegion, 1> inputExtents;
|
||||
inputExtents.AppendElement(inputBounds);
|
||||
|
||||
nsIntRegion outputExtents =
|
||||
|
|
|
|||
|
|
@ -670,6 +670,7 @@ nsSVGEffects::EffectProperties::GetMaskFrames()
|
|||
|
||||
bool ok = false;
|
||||
const nsTArray<RefPtr<nsSVGPaintingProperty>>& props = mMask->GetProps();
|
||||
result.SetCapacity(props.Length());
|
||||
for (size_t i = 0; i < props.Length(); i++) {
|
||||
nsSVGMaskFrame* maskFrame =
|
||||
static_cast<nsSVGMaskFrame *>(props[i]->GetReferencedFrame(
|
||||
|
|
@ -731,6 +732,7 @@ nsSVGRenderingObserverList::InvalidateAll()
|
|||
return;
|
||||
|
||||
AutoTArray<nsSVGRenderingObserver*,10> observers;
|
||||
observers.SetCapacity(mObservers.Count());
|
||||
|
||||
for (auto it = mObservers.Iter(); !it.Done(); it.Next()) {
|
||||
observers.AppendElement(it.Get()->GetKey());
|
||||
|
|
@ -749,6 +751,7 @@ nsSVGRenderingObserverList::InvalidateAllForReflow()
|
|||
return;
|
||||
|
||||
AutoTArray<nsSVGRenderingObserver*,10> observers;
|
||||
observers.SetCapacity(mObservers.Count());
|
||||
|
||||
for (auto it = mObservers.Iter(); !it.Done(); it.Next()) {
|
||||
nsSVGRenderingObserver* obs = it.Get()->GetKey();
|
||||
|
|
@ -767,6 +770,7 @@ void
|
|||
nsSVGRenderingObserverList::RemoveAll()
|
||||
{
|
||||
AutoTArray<nsSVGRenderingObserver*,10> observers;
|
||||
observers.SetCapacity(mObservers.Count());
|
||||
|
||||
for (auto it = mObservers.Iter(); !it.Done(); it.Next()) {
|
||||
observers.AppendElement(it.Get()->GetKey());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue