diff options
Diffstat (limited to '')
-rw-r--r-- | dom/svg/SVGAnimatedLength.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/dom/svg/SVGAnimatedLength.cpp b/dom/svg/SVGAnimatedLength.cpp index 081db5704a..156fde0e23 100644 --- a/dom/svg/SVGAnimatedLength.cpp +++ b/dom/svg/SVGAnimatedLength.cpp @@ -225,6 +225,10 @@ CSSSize SVGElementMetrics::GetCSSViewportSize() const { return GetCSSViewportSizeFromContext(context); } +float SVGElementMetrics::GetLineHeight(Type aType) const { + return SVGContentUtils::GetLineHeight(GetElementForType(aType)); +} + bool SVGElementMetrics::EnsureCtx() const { if (!mCtx && mSVGElement) { mCtx = mSVGElement->GetCtx(); @@ -298,6 +302,23 @@ CSSSize NonSVGFrameUserSpaceMetrics::GetCSSViewportSize() const { return GetCSSViewportSizeFromContext(mFrame->PresContext()); } +float NonSVGFrameUserSpaceMetrics::GetLineHeight(Type aType) const { + auto* context = mFrame->PresContext(); + switch (aType) { + case Type::This: { + const auto lineHeightAu = ReflowInput::CalcLineHeight( + *mFrame->Style(), context, mFrame->GetContent(), NS_UNCONSTRAINEDSIZE, + 1.0f); + return CSSPixel::FromAppUnits(lineHeightAu); + } + case Type::Root: + return SVGContentUtils::GetLineHeight( + context->Document()->GetRootElement()); + } + MOZ_ASSERT_UNREACHABLE("Was a new value added to the enumeration?"); + return 1.0f; +} + float UserSpaceMetricsWithSize::GetAxisLength(uint8_t aCtxType) const { gfx::Size size = GetSize(); float length; |