Closed Bug 274698 Opened 20 years ago Closed 19 years ago

Improve nsSVGLength.cpp

Categories

(Core :: SVG, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: jwatt, Assigned: jwatt)

References

Details

Attachments

(1 file, 3 obsolete files)

 
Attached patch patch (obsolete) — Splinter Review
these are some changes that I'd like to make to this file
Attachment #168752 - Flags: review?(tor)
Comment on attachment 168752 [details] [diff] [review]
patch

> /* void newValueSpecifiedUnits (in unsigned short unitType, in float valueInSpecifiedUnits); */
>  NS_IMETHODIMP
> nsSVGLength::NewValueSpecifiedUnits(PRUint16 unitType, float valueInSpecifiedUnits)
> {
>+  // We assume unitType != mSpecifiedUnitType since the consumer should use
>+  // SetValueInSpecifiedUnits in that case.
> 
>-  bool observer_change = (unitType != mSpecifiedUnitType);

> /* void convertToSpecifiedUnits (in unsigned short unitType); */
> NS_IMETHODIMP
> nsSVGLength::ConvertToSpecifiedUnits(PRUint16 unitType)
> {
>-  if (!IsValidUnitType(unitType)) return NS_ERROR_FAILURE;
>-
>-  bool observer_change = (unitType != mSpecifiedUnitType);

I don't think these optimizations should be removed.

> float nsSVGLength::AxisLength()
> {
>-  if (d == 0.0f)
>-    d = 1e-20f;
>+  if (d == 0.0f) {
>+    NS_ASSERTION(d!=0.0f, "invalid axis length");
>+    d = 1.0f;
>+  }
>+
>   return d;
> }

Not comfortable with this, as zero is a valid axis length.
Attachment #168752 - Flags: review?(tor) → review-
Blocks: 280364
Attached patch quite a different patch (obsolete) — Splinter Review
Okay, this is what I'd like to do before trying to fix bz's bug. The utility
functions that were only called from one place I've moved inline which makes
for better error reporting.
Attachment #173501 - Flags: review?(tor)
Attached patch quite a different patch v2 (obsolete) — Splinter Review
let's try that again
Attachment #168752 - Attachment is obsolete: true
Attachment #173501 - Attachment is obsolete: true
Attachment #173503 - Flags: review?(tor)
Attachment #173501 - Flags: review?(tor)
Attachment #173503 - Attachment is obsolete: true
Attachment #173503 - Flags: review?(tor)
Attachment #173767 - Flags: review?(tor)
Attachment #173767 - Flags: review?(tor) → review+
Checked in.

Checking in mozilla/content/svg/content/src/nsSVGLength.cpp;
/cvsroot/mozilla/content/svg/content/src/nsSVGLength.cpp,v  <--  nsSVGLength.cpp
new revision: 1.19; previous revision: 1.18
done
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: