diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:35:37 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:35:37 +0000 |
commit | a90a5cba08fdf6c0ceb95101c275108a152a3aed (patch) | |
tree | 532507288f3defd7f4dcf1af49698bcb76034855 /dom/svg/SVGContentUtils.cpp | |
parent | Adding debian version 126.0.1-1. (diff) | |
download | firefox-a90a5cba08fdf6c0ceb95101c275108a152a3aed.tar.xz firefox-a90a5cba08fdf6c0ceb95101c275108a152a3aed.zip |
Merging upstream version 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( |