Skip to content

Commit 57f4cfb

Browse files
committed
Bug 1856755 - Implement an internal zoom: document value that forces effective zoom to 1. r=jfkthame
The name matches the value that webkit (but not blink) exposes to the web. We don't expose it. Filed w3c/csswg-drafts#9435 for this. Differential Revision: https://phabricator.services.mozilla.com/D190025 UltraBlame original commit: 3203468939abba2f75ed2c29203b6caa1b50e9ad
1 parent 5899a7b commit 57f4cfb

File tree

6 files changed

+197
-77
lines changed

6 files changed

+197
-77
lines changed

layout/style/res/scrollbars.css

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,28 @@ collapse
262262
:
263263
initial
264264
;
265+
/
266+
*
267+
We
268+
don
269+
'
270+
t
271+
want
272+
zoom
273+
on
274+
our
275+
ancestors
276+
to
277+
affect
278+
our
279+
styles
280+
.
281+
*
282+
/
283+
zoom
284+
:
285+
document
286+
;
265287
math
266288
-
267289
depth

servo/components/style/properties/cascade.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3965,7 +3965,9 @@ builder
39653965
inherited_effective_zoom
39663966
(
39673967
)
3968-
*
3968+
.
3969+
compute_effective
3970+
(
39693971
self
39703972
.
39713973
context
@@ -3975,6 +3977,7 @@ builder
39753977
specified_zoom
39763978
(
39773979
)
3980+
)
39783981
;
39793982
}
39803983
fn

servo/components/style/properties/longhands/box.mako.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4077,5 +4077,10 @@ affects
40774077
"
40784078
layout
40794079
"
4080+
enabled_in
4081+
=
4082+
"
4083+
ua
4084+
"
40804085
)
40814086
}

servo/components/style/values/computed/box.rs

Lines changed: 123 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1339,82 +1339,6 @@ ZoomFixedPoint
13391339
)
13401340
;
13411341
impl
1342-
std
1343-
:
1344-
:
1345-
ops
1346-
:
1347-
:
1348-
Mul
1349-
for
1350-
Zoom
1351-
{
1352-
type
1353-
Output
1354-
=
1355-
Zoom
1356-
;
1357-
fn
1358-
mul
1359-
(
1360-
self
1361-
rhs
1362-
:
1363-
Self
1364-
)
1365-
-
1366-
>
1367-
Self
1368-
{
1369-
if
1370-
self
1371-
=
1372-
=
1373-
Self
1374-
:
1375-
:
1376-
ONE
1377-
{
1378-
return
1379-
rhs
1380-
;
1381-
}
1382-
if
1383-
rhs
1384-
=
1385-
=
1386-
Self
1387-
:
1388-
:
1389-
ONE
1390-
{
1391-
return
1392-
self
1393-
;
1394-
}
1395-
Zoom
1396-
(
1397-
ZoomFixedPoint
1398-
:
1399-
:
1400-
from_float
1401-
(
1402-
self
1403-
.
1404-
value
1405-
(
1406-
)
1407-
*
1408-
rhs
1409-
.
1410-
value
1411-
(
1412-
)
1413-
)
1414-
)
1415-
}
1416-
}
1417-
impl
14181342
ToComputedValue
14191343
for
14201344
specified
@@ -1469,6 +1393,17 @@ ONE
14691393
Self
14701394
:
14711395
:
1396+
Document
1397+
=
1398+
>
1399+
return
1400+
Zoom
1401+
:
1402+
:
1403+
DOCUMENT
1404+
Self
1405+
:
1406+
:
14721407
Value
14731408
(
14741409
ref
@@ -1583,6 +1518,36 @@ fmt
15831518
:
15841519
Write
15851520
{
1521+
use
1522+
std
1523+
:
1524+
:
1525+
fmt
1526+
:
1527+
:
1528+
Write
1529+
;
1530+
if
1531+
*
1532+
self
1533+
=
1534+
=
1535+
Self
1536+
:
1537+
:
1538+
DOCUMENT
1539+
{
1540+
return
1541+
dest
1542+
.
1543+
write_str
1544+
(
1545+
"
1546+
document
1547+
"
1548+
)
1549+
;
1550+
}
15861551
self
15871552
.
15881553
value
@@ -1686,6 +1651,22 @@ ZOOM_FRACTION_BITS
16861651
}
16871652
)
16881653
;
1654+
pub
1655+
const
1656+
DOCUMENT
1657+
:
1658+
Zoom
1659+
=
1660+
Zoom
1661+
(
1662+
ZoomFixedPoint
1663+
{
1664+
value
1665+
:
1666+
0
1667+
}
1668+
)
1669+
;
16891670
#
16901671
[
16911672
inline
@@ -1731,6 +1712,72 @@ to_float
17311712
(
17321713
)
17331714
}
1715+
pub
1716+
fn
1717+
compute_effective
1718+
(
1719+
self
1720+
specified
1721+
:
1722+
Self
1723+
)
1724+
-
1725+
>
1726+
Self
1727+
{
1728+
if
1729+
specified
1730+
=
1731+
=
1732+
Self
1733+
:
1734+
:
1735+
DOCUMENT
1736+
{
1737+
return
1738+
Self
1739+
:
1740+
:
1741+
ONE
1742+
;
1743+
}
1744+
if
1745+
self
1746+
=
1747+
=
1748+
Self
1749+
:
1750+
:
1751+
ONE
1752+
{
1753+
return
1754+
specified
1755+
;
1756+
}
1757+
if
1758+
specified
1759+
=
1760+
=
1761+
Self
1762+
:
1763+
:
1764+
ONE
1765+
{
1766+
return
1767+
self
1768+
;
1769+
}
1770+
Zoom
1771+
(
1772+
self
1773+
.
1774+
0
1775+
*
1776+
specified
1777+
.
1778+
0
1779+
)
1780+
}
17341781
#
17351782
[
17361783
inline

servo/components/style/values/specified/box.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10316,6 +10316,21 @@ enum
1031610316
Zoom
1031710317
{
1031810318
Normal
10319+
#
10320+
[
10321+
parse
10322+
(
10323+
condition
10324+
=
10325+
"
10326+
ParserContext
10327+
:
10328+
:
10329+
in_ua_sheet
10330+
"
10331+
)
10332+
]
10333+
Document
1031910334
Value
1032010335
(
1032110336
NonNegativeNumberOrPercentage
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<
2+
style
3+
>
4+
*
5+
{
6+
overflow
7+
:
8+
scroll
9+
scroll
10+
;
11+
}
12+
<
13+
/
14+
style
15+
>
16+
<
17+
h4
18+
style
19+
=
20+
"
21+
zoom
22+
:
23+
3
24+
"
25+
>
26+
<
27+
figure
28+
>

0 commit comments

Comments
 (0)