зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1862411 - simplify array access by using range based loops and LastElement r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D192465
This commit is contained in:
Родитель
f4ff77a8a4
Коммит
87a1d9c8eb
|
@ -65,8 +65,8 @@ bool SVGFilterPrimitiveElement::OutputIsTainted(
|
|||
nsIPrincipal* aReferencePrincipal) {
|
||||
// This is the default implementation for OutputIsTainted.
|
||||
// Our output is tainted if we have at least one tainted input.
|
||||
for (uint32_t i = 0; i < aInputsAreTainted.Length(); i++) {
|
||||
if (aInputsAreTainted[i]) {
|
||||
for (const auto& inputIsTainted : aInputsAreTainted) {
|
||||
if (inputIsTainted) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@ void SVGPolyElement::GetMarkPoints(nsTArray<SVGMark>* aMarks) {
|
|||
if (i == 1) {
|
||||
aMarks->ElementAt(0).angle = angle;
|
||||
} else {
|
||||
aMarks->ElementAt(aMarks->Length() - 1).angle =
|
||||
aMarks->LastElement().angle =
|
||||
SVGContentUtils::AngleBisect(prevAngle, angle);
|
||||
}
|
||||
|
||||
|
|
|
@ -331,11 +331,10 @@ bool SVGTransformListSMILType::GetTransforms(
|
|||
aTransforms.Clear();
|
||||
if (!aTransforms.SetCapacity(smilTransforms.Length(), fallible)) return false;
|
||||
|
||||
for (uint32_t i = 0; i < smilTransforms.Length(); ++i) {
|
||||
for (const auto& smilTransform : smilTransforms) {
|
||||
// No need to check the return value below since we have already allocated
|
||||
// the necessary space
|
||||
(void)aTransforms.AppendElement(smilTransforms[i].ToSVGTransform(),
|
||||
fallible);
|
||||
(void)aTransforms.AppendElement(smilTransform.ToSVGTransform(), fallible);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -162,8 +162,7 @@ IntRect SVGFilterInstance::ComputeFilterPrimitiveSubregion(
|
|||
|
||||
IntRect defaultFilterSubregion(0, 0, 0, 0);
|
||||
if (fE->SubregionIsUnionOfRegions()) {
|
||||
for (uint32_t i = 0; i < aInputIndices.Length(); ++i) {
|
||||
int32_t inputIndex = aInputIndices[i];
|
||||
for (const auto& inputIndex : aInputIndices) {
|
||||
bool isStandardInput =
|
||||
inputIndex < 0 || inputIndex == mSourceGraphicIndex;
|
||||
IntRect inputSubregion =
|
||||
|
@ -206,8 +205,7 @@ void SVGFilterInstance::GetInputsAreTainted(
|
|||
const nsTArray<FilterPrimitiveDescription>& aPrimitiveDescrs,
|
||||
const nsTArray<int32_t>& aInputIndices, bool aFilterInputIsTainted,
|
||||
nsTArray<bool>& aOutInputsAreTainted) {
|
||||
for (uint32_t i = 0; i < aInputIndices.Length(); i++) {
|
||||
int32_t inputIndex = aInputIndices[i];
|
||||
for (const auto& inputIndex : aInputIndices) {
|
||||
if (inputIndex < 0) {
|
||||
aOutInputsAreTainted.AppendElement(aFilterInputIsTainted);
|
||||
} else {
|
||||
|
@ -270,9 +268,9 @@ nsresult SVGFilterInstance::GetSourceIndices(
|
|||
AutoTArray<SVGStringInfo, 2> sources;
|
||||
aPrimitiveElement->GetSourceImageNames(sources);
|
||||
|
||||
for (uint32_t j = 0; j < sources.Length(); j++) {
|
||||
for (const auto& source : sources) {
|
||||
nsAutoString str;
|
||||
sources[j].mString->GetAnimValue(str, sources[j].mElement);
|
||||
source.mString->GetAnimValue(str, source.mElement);
|
||||
|
||||
int32_t sourceIndex = 0;
|
||||
if (str.EqualsLiteral("SourceGraphic")) {
|
||||
|
|
|
@ -130,11 +130,6 @@ class SVGFilterInstance {
|
|||
gfxRect UserSpaceToFilterSpace(const gfxRect& aUserSpaceRect) const;
|
||||
|
||||
private:
|
||||
/**
|
||||
* Finds the filter frame associated with this SVG filter.
|
||||
*/
|
||||
SVGFilterFrame* GetFilterFrame(nsIFrame* aTargetFrame);
|
||||
|
||||
/**
|
||||
* Computes the filter primitive subregion for the given primitive.
|
||||
*/
|
||||
|
|
|
@ -1164,8 +1164,8 @@ void SVGRenderingObserverSet::InvalidateAllForReflow() {
|
|||
}
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < observers.Length(); ++i) {
|
||||
observers[i]->OnNonDOMMutationRenderingChange();
|
||||
for (const auto& observer : observers) {
|
||||
observer->OnNonDOMMutationRenderingChange();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1335,8 +1335,8 @@ static SVGObserverUtils::ReferenceState GetAndObserveFilters(
|
|||
return SVGObserverUtils::eHasNoRefs;
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < observers.Length(); i++) {
|
||||
SVGFilterFrame* filter = observers[i]->GetAndObserveFilterFrame();
|
||||
for (const auto& observer : observers) {
|
||||
SVGFilterFrame* filter = observer->GetAndObserveFilterFrame();
|
||||
if (!filter) {
|
||||
if (aFilterFrames) {
|
||||
aFilterFrames->Clear();
|
||||
|
|
|
@ -1481,16 +1481,14 @@ class MOZ_STACK_CLASS TextFrameIterator {
|
|||
* are inside one.
|
||||
*/
|
||||
nsIFrame* TextPathFrame() const {
|
||||
return mTextPathFrames.IsEmpty()
|
||||
? nullptr
|
||||
: mTextPathFrames.ElementAt(mTextPathFrames.Length() - 1);
|
||||
return mTextPathFrames.IsEmpty() ? nullptr : mTextPathFrames.LastElement();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current frame's computed dominant-baseline value.
|
||||
*/
|
||||
StyleDominantBaseline DominantBaseline() const {
|
||||
return mBaselines.ElementAt(mBaselines.Length() - 1);
|
||||
return mBaselines.LastElement();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Загрузка…
Ссылка в новой задаче