diff options
author | Moonchild <moonchild@palemoon.org> | 2022-07-23 23:35:18 +0000 |
---|---|---|
committer | Moonchild <moonchild@palemoon.org> | 2022-07-23 23:35:18 +0000 |
commit | 5487515bcab438ae29fa6342583b8b5c5bde6b92 (patch) | |
tree | f83b19123ed175060d2d2287b24ef38b0dd50152 /layout/generic/ReflowInput.cpp | |
parent | 5dace0043a35efaffb6ae30b612c613b008ff85a (diff) | |
download | uxp-5487515bcab438ae29fa6342583b8b5c5bde6b92.tar.gz |
Issue #1970 - Part 6: Rename CalcLineHeight(), and cache used line height
To better distinguish the calculation of line height (still present with args)
and simply getting the line height without args, it's now called GetLineHeight()
This also introduces `mLineHeight` to cache specifically calculated line heights
that aren't "auto" (which is a magic value), and it opens up the possibility to
override it in Part 7.
Diffstat (limited to 'layout/generic/ReflowInput.cpp')
-rw-r--r-- | layout/generic/ReflowInput.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/layout/generic/ReflowInput.cpp b/layout/generic/ReflowInput.cpp index 0c3fef3825..f308ebcdf5 100644 --- a/layout/generic/ReflowInput.cpp +++ b/layout/generic/ReflowInput.cpp @@ -2798,15 +2798,19 @@ ComputeLineHeight(nsStyleContext* aStyleContext, return GetNormalLineHeight(fm); } -nscoord -ReflowInput::CalcLineHeight() const -{ +nscoord ReflowInput::GetLineHeight() const { + if (mLineHeight != NS_AUTOHEIGHT) { + return mLineHeight; + } + nscoord blockBSize = nsLayoutUtils::IsNonWrapperBlock(mFrame) ? ComputedBSize() : (mCBReflowInput ? mCBReflowInput->ComputedBSize() : NS_AUTOHEIGHT); - return CalcLineHeight(mFrame->GetContent(), mFrame->StyleContext(), blockBSize, - nsLayoutUtils::FontSizeInflationFor(mFrame)); + mLineHeight = CalcLineHeight(mFrame->GetContent(), + mFrame->StyleContext(), + blockBSize, + nsLayoutUtils::FontSizeInflationFor(mFrame)); } /* static */ nscoord |