Open Bug 869679 Opened 12 years ago Updated 2 years ago

Create const versions of nsSVGElement::GetXYZInfo methods (so we can invoke those methods from other const accessors)

Categories

(Core :: SVG, defect)

defect

Tracking

()

People

(Reporter: dholbert, Unassigned)

References

Details

I *think* nsSVGElement::GetLengthInfo, etc. can be made into const methods. Filing this bug on doing that. I'm making this depend on bug 869668, which marks these methods as MOZ_OVERRIDE so that we won't accidentally orphan one of them when changing the base class's method-signature.
er, never mind -- For GetLengthInfo to be usefully const, its "mLengths" array would need to be const as well (since that's generally a pointer to an array on |this|). And while many of the GetLengthInfo accesses are read-only, there are also some that involve writes to |mLengths|. For example, nsSVGElement::ParseAttribute() has: > LengthAttributesInfo lengthInfo = GetLengthInfo(); [...] > rv = lengthInfo.mLengths[i].SetBaseValueString(aValue, this, false); (and SetBaseValueString is a non-const method) So: the correct, more workable (but slightly more clumsy) version of this bug is: we could *create* const versions of GetLengthInfo() & friends, alongside the existing mutable versions.
Summary: Mark nsSVGElement::GetXYZInfo methods as const → Create const versions of nsSVGElement::GetXYZInfo methods (so we can invoke those methods from other const accessors)
Severity: normal → S3

I imagine the easy way to fix this is to wait for C++23 deducing this: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p0847r7.html

You need to log in before you can comment on or make changes to this bug.