summaryrefslogtreecommitdiffstats
path: root/dom/svg/SVGContentUtils.cpp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:35:37 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:35:37 +0000
commita90a5cba08fdf6c0ceb95101c275108a152a3aed (patch)
tree532507288f3defd7f4dcf1af49698bcb76034855 /dom/svg/SVGContentUtils.cpp
parentAdding debian version 126.0.1-1. (diff)
downloadfirefox-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.cpp28
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(