mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-24 16:17:29 +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();
|
scope->SetIsScopedStyleRoot();
|
||||||
|
|
||||||
// Create a rule processor for the scope.
|
// Create a rule processor for the scope.
|
||||||
nsTArray<RefPtr<CSSStyleSheet>> sheetsForScope;
|
nsTArray<RefPtr<CSSStyleSheet>> sheetsForScope(end - start);
|
||||||
sheetsForScope.AppendElements(sheets.Elements() + start, end - start);
|
sheetsForScope.AppendElements(sheets.Elements() + start, end - start);
|
||||||
nsCSSRuleProcessor* oldRP = oldScopedRuleProcessorHash.Get(scope);
|
nsCSSRuleProcessor* oldRP = oldScopedRuleProcessorHash.Get(scope);
|
||||||
mScopedDocSheetRuleProcessors.AppendElement
|
mScopedDocSheetRuleProcessors.AppendElement
|
||||||
|
|
|
||||||
|
|
@ -409,7 +409,7 @@ nsCSSFilterInstance::SetBounds(FilterPrimitiveDescription& aDescr,
|
||||||
nsIntRect inputBounds = (inputIndex < 0) ?
|
nsIntRect inputBounds = (inputIndex < 0) ?
|
||||||
mTargetBoundsInFilterSpace : aPrimitiveDescrs[inputIndex].PrimitiveSubregion();
|
mTargetBoundsInFilterSpace : aPrimitiveDescrs[inputIndex].PrimitiveSubregion();
|
||||||
|
|
||||||
nsTArray<nsIntRegion> inputExtents;
|
AutoTArray<nsIntRegion, 1> inputExtents;
|
||||||
inputExtents.AppendElement(inputBounds);
|
inputExtents.AppendElement(inputBounds);
|
||||||
|
|
||||||
nsIntRegion outputExtents =
|
nsIntRegion outputExtents =
|
||||||
|
|
|
||||||
|
|
@ -670,6 +670,7 @@ nsSVGEffects::EffectProperties::GetMaskFrames()
|
||||||
|
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
const nsTArray<RefPtr<nsSVGPaintingProperty>>& props = mMask->GetProps();
|
const nsTArray<RefPtr<nsSVGPaintingProperty>>& props = mMask->GetProps();
|
||||||
|
result.SetCapacity(props.Length());
|
||||||
for (size_t i = 0; i < props.Length(); i++) {
|
for (size_t i = 0; i < props.Length(); i++) {
|
||||||
nsSVGMaskFrame* maskFrame =
|
nsSVGMaskFrame* maskFrame =
|
||||||
static_cast<nsSVGMaskFrame *>(props[i]->GetReferencedFrame(
|
static_cast<nsSVGMaskFrame *>(props[i]->GetReferencedFrame(
|
||||||
|
|
@ -731,6 +732,7 @@ nsSVGRenderingObserverList::InvalidateAll()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
AutoTArray<nsSVGRenderingObserver*,10> observers;
|
AutoTArray<nsSVGRenderingObserver*,10> observers;
|
||||||
|
observers.SetCapacity(mObservers.Count());
|
||||||
|
|
||||||
for (auto it = mObservers.Iter(); !it.Done(); it.Next()) {
|
for (auto it = mObservers.Iter(); !it.Done(); it.Next()) {
|
||||||
observers.AppendElement(it.Get()->GetKey());
|
observers.AppendElement(it.Get()->GetKey());
|
||||||
|
|
@ -749,6 +751,7 @@ nsSVGRenderingObserverList::InvalidateAllForReflow()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
AutoTArray<nsSVGRenderingObserver*,10> observers;
|
AutoTArray<nsSVGRenderingObserver*,10> observers;
|
||||||
|
observers.SetCapacity(mObservers.Count());
|
||||||
|
|
||||||
for (auto it = mObservers.Iter(); !it.Done(); it.Next()) {
|
for (auto it = mObservers.Iter(); !it.Done(); it.Next()) {
|
||||||
nsSVGRenderingObserver* obs = it.Get()->GetKey();
|
nsSVGRenderingObserver* obs = it.Get()->GetKey();
|
||||||
|
|
@ -767,6 +770,7 @@ void
|
||||||
nsSVGRenderingObserverList::RemoveAll()
|
nsSVGRenderingObserverList::RemoveAll()
|
||||||
{
|
{
|
||||||
AutoTArray<nsSVGRenderingObserver*,10> observers;
|
AutoTArray<nsSVGRenderingObserver*,10> observers;
|
||||||
|
observers.SetCapacity(mObservers.Count());
|
||||||
|
|
||||||
for (auto it = mObservers.Iter(); !it.Done(); it.Next()) {
|
for (auto it = mObservers.Iter(); !it.Done(); it.Next()) {
|
||||||
observers.AppendElement(it.Get()->GetKey());
|
observers.AppendElement(it.Get()->GetKey());
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue