Closed Bug 1325487 Opened 7 years ago Closed 7 years ago

Improve SVGContentUtils::ComputeNormalizedHypotenuse and use it more

Categories

(Core :: SVG, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla53
Tracking Status
firefox53 --- fixed

People

(Reporter: longsonr, Assigned: longsonr)

Details

Attachments

(1 file)

      No description provided.
Attached patch hypot.txtSplinter Review
Assignee: nobody → longsonr
Attachment #8821333 - Flags: review?(dholbert)
Comment on attachment 8821333 [details] [diff] [review]
hypot.txt

Review of attachment 8821333 [details] [diff] [review]:
-----------------------------------------------------------------

Nice! I didn't realize we had this helper-function. Thanks for fixing this to share code better.

::: dom/svg/SVGContentUtils.cpp
@@ +20,5 @@
>  #include "nsFontMetrics.h"
>  #include "nsIFrame.h"
>  #include "nsIScriptError.h"
>  #include "nsLayoutUtils.h"
> +#include "nsMathUtils.h"§

There's a squiggly special-character "§" at the end of this line. :) I think you need to remove that, or this probably won't compile...

::: layout/svg/nsCSSClipPathInstance.cpp
@@ +263,5 @@
>    } else {
>      // We resolve percent <shape-radius> value for circle() as defined here:
>      // https://drafts.csswg.org/css-shapes/#funcdef-circle
> +    double referenceLength = SVGContentUtils::ComputeNormalizedHypotenuse(
> +                               aRefBox.width, aRefBox.height);

This would be more coding-style-compliant (and easier to read IMO) if we add a newline after the "=" and after "width", to look like this:

    double referenceLength =
      SVGContentUtils::ComputeNormalizedHypotenuse(aRefBox.width,
                                                   aRefBox.height);

Could you rewrap it along those lines?
Attachment #8821333 - Flags: review?(dholbert) → review+
https://treeherder.mozilla.org/#/jobs?repo=try&revision=2b2362c208988345294c6ec26e4eba636f06f14f

In the end I think M_SQRT2 is better than computing sqrt(2), I think that's trivial enough not to require a rereview.
Pushed by longsonr@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/f520551796df
Improve SVGContentUtils::ComputeNormalizedHypotenuse and use it more r=dholbert
https://hg.mozilla.org/mozilla-central/rev/f520551796df
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla53
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: