Skip to content

Commit

Permalink
Bug 1532122 - Make word-spacing, letter-spacing, and line-height use …
Browse files Browse the repository at this point in the history
…Rust lengths. r=boris

This also adopts the resolution from [1] while at it, making letter-spacing
compute to a length, serializing 0 to normal rather than keeping normal in the
computed value, which matches every other engine.

This removes the SMIL tests for percentages from letter-spacing since
letter-spacing does in fact not support percentages, so they were passing just
by chance.

[1]: w3c/csswg-drafts#1484

Differential Revision: https://phabricator.services.mozilla.com/D21850

UltraBlame original commit: ea800ec9b4ae8877c2bc4b56aa7cf892a2612205
  • Loading branch information
marco-c committed Oct 4, 2019
1 parent fa640ac commit 84278f9
Show file tree
Hide file tree
Showing 22 changed files with 836 additions and 2,077 deletions.
113 changes: 81 additions & 32 deletions dom/smil/test/db_smilCSSFromTo.js
Original file line number Diff line number Diff line change
Expand Up @@ -1688,6 +1688,85 @@ none
]
}
;
function
_tweakForLetterSpacing
(
testcases
)
{
return
testcases
.
map
(
function
(
t
)
{
let
valMap
=
Object
.
assign
(
{
}
t
.
computedValMap
)
;
for
(
let
prop
of
Object
.
keys
(
valMap
)
)
if
(
valMap
[
prop
]
=
=
"
0px
"
)
valMap
[
prop
]
=
"
normal
"
;
return
new
AnimTestcaseFromTo
(
t
.
from
t
.
to
valMap
)
}
)
;
}
/
/
List
Expand Down Expand Up @@ -3650,6 +3729,8 @@ TestcaseBundle
gPropList
.
letter_spacing
_tweakForLetterSpacing
(
[
]
.
Expand All @@ -3661,40 +3742,8 @@ lengthNoUnits
_fromToTestLists
.
lengthPx
_fromToTestLists
.
lengthPxPctSVG
)
)
new
TestcaseBundle
(
gPropList
.
letter_spacing
_fromToTestLists
.
lengthPctSVG
"
pct
-
>
pct
animations
don
'
t
currently
work
for
"
+
"
*
-
spacing
properties
"
)
new
TestcaseBundle
Expand Down
32 changes: 8 additions & 24 deletions layout/forms/nsTextControlFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1264,9 +1264,9 @@ spacing
.
{
const
nsStyleCoord
StyleLength
&
lsCoord
letterSpacing
=
StyleText
(
Expand All @@ -1277,31 +1277,12 @@ mLetterSpacing
;
if
(
eStyleUnit_Coord
=
=
lsCoord
.
GetUnit
(
)
)
{
nscoord
!
letterSpacing
=
lsCoord
.
GetCoordValue
IsZero
(
)
;
if
(
letterSpacing
!
=
0
)
{
intrinsicSize
Expand All @@ -1315,10 +1296,13 @@ aWM
cols
*
letterSpacing
.
ToAppUnits
(
)
;
}
}
}
/
/
Set
Expand Down
119 changes: 28 additions & 91 deletions layout/generic/ReflowInput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5935,36 +5935,11 @@ mStyleText
>
mLineHeight
.
GetUnit
IsMozBlockHeight
(
)
=
=
eStyleUnit_Enumerated
)
{
NS_ASSERTION
(
mStyleText
-
>
mLineHeight
.
GetIntValue
(
)
=
=
NS_STYLE_LINE_HEIGHT_BLOCK_HEIGHT
"
bad
line
-
height
value
"
)
;
/
/
line
Expand Down Expand Up @@ -22569,9 +22544,9 @@ aFontSizeInflation
)
{
const
nsStyleCoord
StyleLineHeight
&
lhCoord
lineHeight
=
aComputedStyle
-
Expand All @@ -22585,22 +22560,23 @@ mLineHeight
;
if
(
lhCoord
lineHeight
.
GetUnit
IsLength
(
)
=
=
eStyleUnit_Coord
)
{
nscoord
result
=
lhCoord
lineHeight
.
length
.
_0
.
GetCoordValue
ToAppUnits
(
)
;
Expand Down Expand Up @@ -22630,15 +22606,13 @@ result
}
if
(
lhCoord
lineHeight
.
GetUnit
IsNumber
(
)
=
=
eStyleUnit_Factor
)
{
/
/
For
Expand Down Expand Up @@ -22685,11 +22659,11 @@ zoom
return
NSToCoordRound
(
lhCoord
lineHeight
.
GetFactorValue
(
)
number
.
_0
*
aFontSizeInflation
*
Expand All @@ -22706,68 +22680,32 @@ mFont
size
)
;
NS_ASSERTION
}
MOZ_ASSERT
(
lhCoord
lineHeight
.
GetUnit
IsNormal
(
)
=
=
eStyleUnit_Normal
|
|
lhCoord
lineHeight
.
GetUnit
IsMozBlockHeight
(
)
=
=
eStyleUnit_Enumerated
"
bad
line
-
height
unit
"
)
;
if
(
lhCoord
.
GetUnit
(
)
=
=
eStyleUnit_Enumerated
)
{
NS_ASSERTION
(
lhCoord
lineHeight
.
GetIntValue
IsMozBlockHeight
(
)
=
=
NS_STYLE_LINE_HEIGHT_BLOCK_HEIGHT
"
bad
line
-
height
value
"
)
;
if
(
&
&
aBlockBSize
!
=
Expand All @@ -22778,7 +22716,6 @@ return
aBlockBSize
;
}
}
RefPtr
<
nsFontMetrics
Expand Down
Loading

0 comments on commit 84278f9

Please sign in to comment.