Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Tor Browser
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
The Tor Project
Applications
Tor Browser
Commits
c99c6930
Verified
Commit
c99c6930
authored
1 year ago
by
Pier Angelo Vendrame
Browse files
Options
Downloads
Patches
Plain Diff
fixup! Bug 23104: Add a default line height compensation
parent
6bdafd8f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!641
Bug 41759: Rebase Base Browser to 115 Nightly
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
layout/generic/ReflowInput.cpp
+9
-7
9 additions, 7 deletions
layout/generic/ReflowInput.cpp
with
9 additions
and
7 deletions
layout/generic/ReflowInput.cpp
+
9
−
7
View file @
c99c6930
...
...
@@ -2728,13 +2728,12 @@ void ReflowInput::CalculateBlockSideMargins() {
// This is necessary because without this compensation, normal line height might
// look too tight.
constexpr
float
kNormalLineHeightFactor
=
1.2
f
;
static
nscoord
GetNormalLineHeight
(
nsFontMetrics
*
aFontMetrics
)
{
static
nscoord
GetNormalLineHeight
(
nsFontMetrics
*
aFontMetrics
,
bool
aRFP
)
{
MOZ_ASSERT
(
aFontMetrics
,
"no font metrics"
);
nscoord
externalLeading
=
aFontMetrics
->
ExternalLeading
();
nscoord
internalLeading
=
aFontMetrics
->
InternalLeading
();
nscoord
emHeight
=
aFontMetrics
->
EmHeight
();
if
((
!
internalLeading
&&
!
externalLeading
)
||
nsContentUtils
::
ShouldResistFingerprinting
())
{
if
((
!
internalLeading
&&
!
externalLeading
)
||
aRFP
)
{
return
NSToCoordRound
(
emHeight
*
kNormalLineHeightFactor
);
}
return
emHeight
+
internalLeading
+
externalLeading
;
...
...
@@ -2744,7 +2743,7 @@ static inline nscoord ComputeLineHeight(const StyleLineHeight& aLh,
const
nsStyleFont
&
aRelativeToFont
,
nsPresContext
*
aPresContext
,
bool
aIsVertical
,
nscoord
aBlockBSize
,
float
aFontSizeInflation
)
{
float
aFontSizeInflation
,
bool
aRFP
)
{
if
(
aLh
.
IsLength
())
{
nscoord
result
=
aLh
.
AsLength
().
ToAppUnits
();
if
(
aFontSizeInflation
!=
1.0
f
)
{
...
...
@@ -2774,7 +2773,7 @@ static inline nscoord ComputeLineHeight(const StyleLineHeight& aLh,
RefPtr
<
nsFontMetrics
>
fm
=
nsLayoutUtils
::
GetMetricsFor
(
aPresContext
,
aIsVertical
,
&
aRelativeToFont
,
size
,
/* aUseUserFontSet = */
true
);
return
GetNormalLineHeight
(
fm
);
return
GetNormalLineHeight
(
fm
,
aRFP
);
}
// If we don't have a pres context, use a 1.2em fallback.
size
.
ScaleBy
(
kNormalLineHeightFactor
);
...
...
@@ -2824,9 +2823,12 @@ nscoord ReflowInput::CalcLineHeight(
const
StyleLineHeight
&
aLh
,
const
nsStyleFont
&
aRelativeToFont
,
nsPresContext
*
aPresContext
,
bool
aIsVertical
,
const
nsIContent
*
aContent
,
nscoord
aBlockBSize
,
float
aFontSizeInflation
)
{
const
bool
rfp
=
aContent
?
aContent
->
OwnerDoc
()
->
ShouldResistFingerprinting
()
:
nsContentUtils
::
ShouldResistFingerprinting
(
"nullptr aContent"
);
nscoord
lineHeight
=
ComputeLineHeight
(
aLh
,
aRelativeToFont
,
aPresContext
,
aIsVertical
,
aBlockBSize
,
aFontSizeInflation
);
aBlockBSize
,
aFontSizeInflation
,
rfp
);
NS_ASSERTION
(
lineHeight
>=
0
,
"ComputeLineHeight screwed up"
);
...
...
@@ -2837,7 +2839,7 @@ nscoord ReflowInput::CalcLineHeight(
if
(
!
aLh
.
IsNormal
())
{
nscoord
normal
=
ComputeLineHeight
(
StyleLineHeight
::
Normal
(),
aRelativeToFont
,
aPresContext
,
aIsVertical
,
aBlockBSize
,
aFontSizeInflation
);
aBlockBSize
,
aFontSizeInflation
,
rfp
);
if
(
lineHeight
<
normal
)
{
lineHeight
=
normal
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment