tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 6d7696a045dad7e78bd3b02736b55b6e1ad7232e
parent 80d5982126c983d26836c0ba819b3f6fff5add18
Author: longsonr <longsonr@gmail.com>
Date:   Fri,  9 Jan 2026 10:45:32 +0000

Bug 2009038 - Convert StrokeOptionFlags to an enum class r=jwatt

Differential Revision: https://phabricator.services.mozilla.com/D278198

Diffstat:
Mdom/svg/SVGContentUtils.cpp | 2+-
Mdom/svg/SVGContentUtils.h | 7+++++--
Mdom/svg/SVGLineElement.cpp | 5+++--
Mlayout/svg/SVGGeometryFrame.cpp | 5+++--
4 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/dom/svg/SVGContentUtils.cpp b/dom/svg/SVGContentUtils.cpp @@ -182,7 +182,7 @@ void SVGContentUtils::GetStrokeOptions(AutoStrokeOptions* aStrokeOptions, const nsStyleSVG* styleSVG = computedStyle->StyleSVG(); bool checkedDashAndStrokeIsDashed = false; - if (aFlags != eIgnoreStrokeDashing) { + if (!aFlags.contains(StrokeOptionFlag::IgnoreStrokeDashing)) { DashState dashState = GetStrokeDashData(aStrokeOptions, aElement, styleSVG, aContextPaint); diff --git a/dom/svg/SVGContentUtils.h b/dom/svg/SVGContentUtils.h @@ -11,6 +11,7 @@ #include <math.h> #include "gfx2DGlue.h" +#include "mozilla/EnumSet.h" #include "mozilla/gfx/2D.h" // for StrokeOptions #include "mozilla/gfx/Matrix.h" #include "nsDependentSubstring.h" @@ -102,7 +103,9 @@ class SVGContentUtils { Float mSmallArray[16]; }; - enum StrokeOptionFlags { eAllStrokeOptions, eIgnoreStrokeDashing }; + enum class StrokeOptionFlag { IgnoreStrokeDashing }; + using StrokeOptionFlags = EnumSet<StrokeOptionFlag>; + /** * Note: the linecap style returned in aStrokeOptions is not valid when * ShapeTypeHasNoCorners(aElement) == true && aFlags == eIgnoreStrokeDashing, @@ -113,7 +116,7 @@ class SVGContentUtils { dom::SVGElement* aElement, const ComputedStyle* aComputedStyle, const SVGContextPaint* aContextPaint, - StrokeOptionFlags aFlags = eAllStrokeOptions); + StrokeOptionFlags aFlags = {}); /** * Returns the current computed value of the CSS property 'stroke-width' for diff --git a/dom/svg/SVGLineElement.cpp b/dom/svg/SVGLineElement.cpp @@ -43,8 +43,9 @@ void SVGLineElement::MaybeAdjustForZeroLength(float aX1, float aY1, float& aX2, float aY2) { if (aX1 == aX2 && aY1 == aY2) { SVGContentUtils::AutoStrokeOptions strokeOptions; - SVGContentUtils::GetStrokeOptions(&strokeOptions, this, nullptr, nullptr, - SVGContentUtils::eIgnoreStrokeDashing); + SVGContentUtils::GetStrokeOptions( + &strokeOptions, this, nullptr, nullptr, + SVGContentUtils::StrokeOptionFlag::IgnoreStrokeDashing); if (strokeOptions.mLineCap != CapStyle::BUTT) { float tinyLength = diff --git a/layout/svg/SVGGeometryFrame.cpp b/layout/svg/SVGGeometryFrame.cpp @@ -399,8 +399,9 @@ SVGBBox SVGGeometryFrame::GetBBoxContribution(const Matrix& aToBBoxUserspace, SVGContentUtils::AutoStrokeOptions strokeOptions; if (getStroke) { - SVGContentUtils::GetStrokeOptions(&strokeOptions, element, Style(), nullptr, - SVGContentUtils::eIgnoreStrokeDashing); + SVGContentUtils::GetStrokeOptions( + &strokeOptions, element, Style(), nullptr, + SVGContentUtils::StrokeOptionFlag::IgnoreStrokeDashing); } else { // Override the default line width of 1.f so that when we call // GetGeometryBounds below the result doesn't include stroke bounds.