diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:35:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:35:29 +0000 |
commit | 59203c63bb777a3bacec32fb8830fba33540e809 (patch) | |
tree | 58298e711c0ff0575818c30485b44a2f21bf28a0 /dom/svg/SVGContentUtils.cpp | |
parent | Adding upstream version 126.0.1. (diff) | |
download | firefox-59203c63bb777a3bacec32fb8830fba33540e809.tar.xz firefox-59203c63bb777a3bacec32fb8830fba33540e809.zip |
Adding upstream version 127.0.upstream/127.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/svg/SVGContentUtils.cpp')
-rw-r--r-- | dom/svg/SVGContentUtils.cpp | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/dom/svg/SVGContentUtils.cpp b/dom/svg/SVGContentUtils.cpp index 72534c12e8..6a87c64acc 100644 --- a/dom/svg/SVGContentUtils.cpp +++ b/dom/svg/SVGContentUtils.cpp @@ -433,6 +433,26 @@ float SVGContentUtils::GetFontXHeight(const ComputedStyle* aComputedStyle, return nsPresContext::AppUnitsToFloatCSSPixels(xHeight) / aPresContext->TextZoom(); } + +float SVGContentUtils::GetLineHeight(const Element* aElement) { + float result = 16.0f * ReflowInput::kNormalLineHeightFactor; + if (!aElement) { + return result; + } + SVGGeometryProperty::DoForComputedStyle( + aElement, [&](const ComputedStyle* style) { + auto* context = nsContentUtils::GetContextForContent(aElement); + if (!context) { + return; + } + const auto lineHeightAu = ReflowInput::CalcLineHeight( + *style, context, aElement, NS_UNCONSTRAINEDSIZE, 1.0f); + result = CSSPixel::FromAppUnits(lineHeightAu); + }); + + return result; +} + nsresult SVGContentUtils::ReportToConsole(const Document* doc, const char* aWarning, const nsTArray<nsString>& aParams) { @@ -596,8 +616,12 @@ static gfx::Matrix GetCTMInternal(SVGElement* aElement, bool aScreenCTM, : tm; } -gfx::Matrix SVGContentUtils::GetCTM(SVGElement* aElement, bool aScreenCTM) { - return GetCTMInternal(aElement, aScreenCTM, false); +gfx::Matrix SVGContentUtils::GetCTM(SVGElement* aElement) { + return GetCTMInternal(aElement, false, false); +} + +gfx::Matrix SVGContentUtils::GetScreenCTM(SVGElement* aElement) { + return GetCTMInternal(aElement, true, false); } void SVGContentUtils::RectilinearGetStrokeBounds( |