diff options
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( |