Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
87ef4cb
Add definition of the zoom css property
chrishtr Dec 12, 2023
60e6b37
Spell out the complete spec
chrishtr Dec 20, 2023
949b515
none
chrishtr Dec 20, 2023
44b4fdf
Avoid zero
chrishtr Dec 20, 2023
b150914
Further clarifications
chrishtr Dec 20, 2023
75dce70
Add zoom in more places
chrishtr Dec 21, 2023
120441e
Fixes to formatting
chrishtr Jan 4, 2024
aa8c478
Fixes to formatting
chrishtr Jan 4, 2024
abfba55
Replace 'or zoom' with 'unscaled'
chrishtr Jan 4, 2024
11ee897
Fix formatting and add alt text
chrishtr Jan 4, 2024
5c144b6
Shorten notes
chrishtr Jan 4, 2024
ec234ea
Shorten heading
chrishtr Jan 4, 2024
2fdbf35
Add background images
chrishtr Jan 4, 2024
56a6b7d
Omit fenced frames; clarify note about iframes
chrishtr Jan 4, 2024
bf27c4b
Fix spec reference type
chrishtr Jan 4, 2024
0ba0eed
Fix spaces and tabs
chrishtr Jan 4, 2024
78a456c
Fix some lint issues
chrishtr Jan 4, 2024
7b4e3d3
Remove stray character
chrishtr Jan 4, 2024
9471f9d
Remove more 'and zoom'
chrishtr Jan 4, 2024
665e588
fix unscaled
chrishtr Jan 4, 2024
742955c
Fix newlines
chrishtr Jan 4, 2024
a7612a6
Special-case 0 and 0%
chrishtr Jan 10, 2024
9fa4adf
HTMLImageElement.{x,y} should be scaled
chrishtr Jan 12, 2024
65cfc7d
Address code review feedback
chrishtr Jan 17, 2024
51a2dfc
Address code review comments
chrishtr Jan 17, 2024
75ba05b
Fix flat tree
chrishtr Jan 17, 2024
3729a02
Add notes about web compat
chrishtr Jan 17, 2024
8cce793
Fix references that should say 'scaled'
chrishtr Jan 17, 2024
652f315
Clarify effective zoom
chrishtr Jan 17, 2024
1f6d09a
Fix typo
chrishtr Jan 18, 2024
92d9734
Switch to used value instead of computed style
chrishtr Jan 23, 2024
e5a842f
Merge branch 'zoom' of https://github.com/chrishtr/csswg-drafts into …
chrishtr Jan 23, 2024
ce7628c
define used value instead of claiming it as a consequence
chrishtr Jan 23, 2024
993c701
Clarify flat tree ancestors
chrishtr Jan 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fixes to formatting
  • Loading branch information
chrishtr committed Jan 4, 2024
commit 120441e89cad08e7e7a5e0a253151cfd041d7ca7
150 changes: 75 additions & 75 deletions css-viewport/Overview.bs
Original file line number Diff line number Diff line change
Expand Up @@ -357,115 +357,115 @@ only the value previously set to it.
</pre>

<h2 id='zoom-property'>
The 'zoom' property</h2>
The 'zoom' property
</h2>

An element becomes zoomed when the 'zoom' property has a positive computed value
different than 1. 'zoom' affects computed property values and inherited
property values. The computed value of 'zoom' is applied as a scalar to
the used value &lt;length&gt;s CSS properties for the element and
its descendants (including inherited properties such as 'line-height' or
'font-size'), plus intrinsic sizing of
all replaced elements and nested frames, resulting in a magnification or
minification effect.
An element becomes zoomed when the 'zoom' property has a positive computed value different than 1.
'zoom' affects computed property values and inherited property values.
The computed value of 'zoom' is applied as a scalar to the used value of <<length>> CSS properties for the element and its descendants
(including inherited properties such as 'line-height' or 'font-size'),
plus intrinsic sizing of all replaced elements and nested frames,
resulting in a magnification or minification effect.

Nested values of 'zoom' multiply, resulting in additional scaling
of &lt;length&gt; values.
Nested values of 'zoom' multiply, resulting in additional scaling of <<length> values.

The 'zoom' property has no effect on &lt;length&gt; property values with
computed values that are ''auto'' or &lt;percent&gt;.
The 'zoom' property has no effect on <<length>> property values with computed values that are ''auto'' or <<percentage>>.

<div class="note">Unlike 'transform', scaling the 'zoom' property affects
layout.</div>
<div class="note">Unlike 'transform',
scaling the 'zoom' property affects layout.</div>

<p class="note"> The computed value of 'font-size' is never &lt;percent&gt;
thus 'zoom' always applies.</p>
<p class="note">
The computed value of 'font-size' is never <<percentage>>;
thus 'zoom' always applies.
</p>

<p class="note">'zoom' does not affect or prevent 'transform' scaling.</p>

<pre class="propdef">
Name: zoom
Value: &lt;number&gt;
Initial: 1
Applies to: all &lt;length&gt; property values of block-level elements
Inherited: no
Percentages: Refer to all &lt;length&gt; property values
Media: visual
Computed value: as specified
Name: zoom
Value: <<number>>;
Initial: 1
Applies to: all <<length>> property values of block-level elements
Inherited: no
Percentages: Refer to all <<length>> property values
Media: visual
Computed value: as specified
</pre>

The values of this property have the following meanings:

<dl dfn-for="wrap-flow" dfn-type=value>
<dt><dfn lt="'zoom'!!'number'">number</dfn>
<dd>
Positive floating point number indicating a zoom factor. Numbers smaller
than 1.0 indicate a "zoom out" or minification effect, while numbers
greater than 1.0 indicate a "zoom in" or magnification effect.
Positive floating point number indicating a zoom factor.
Numbers smaller than 1.0 indicate a "zoom out" or minification effect,
while numbers greater than 1.0 indicate a "zoom in" or magnification effect.

<dt><dfn lt="'zoom'!!&lt;percent&gt;">percent</dfn>
<dt><dfn lt="'zoom'!!'percentage'">percent</dfn>
<dd>
Positive floating point number, followed by a percentage character ("%")
which indicates a zoom factor multiplied by 100.
Positive floating point number,
followed by a percentage character ("%") which indicates a zoom factor multiplied by 100.
</dl>

Negative or zero values for 'zoom' are illegal.

<div class="example">
Example of the 'zoom' property applied during hover for magnification effect.

<pre>
&lt;div class="messageBox"&gt;
&lt;div class="label"&gt;Text of the label&lt;/div&gt;
&lt;/div&gt;

&lt;style type="text/css"&gt;
.messageBox {
width: 10em;
padding: 2em;
border: medium solid lightblue;
}

.messageBox:hover {
zoom: 150%;
}

.label {
background: lightgrey;
padding: 1em;
text-align: center;
}
&lt;/style&gt;
</pre>
<pre>
&lt;div class="messageBox"&gt;
&lt;div class="label"&gt;Text of the label&lt;/div&gt;
&lt;/div&gt;

&lt;style type="text/css"&gt;
.messageBox {
width: 10em;
padding: 2em;
border: medium solid lightblue;
}

.messageBox:hover {
zoom: 150%;
}

.label {
background: lightgrey;
padding: 1em;
text-align: center;
}
&lt;/style&gt;
</pre>

Illustration of the before and after hover state of the message box element.
<img src="css_zoom_hover_example.png" />
</div>

<div class="example">
Example of nested zoom. In this example, "Inner text" is 4x as large as
"Outer text", and "Middle text" is 2x as large as "Outer text".

<pre>
&lt;div style="zoom: 2"&gt;
Middle text
&lt;div style="zoom: 2"&gt;
Inner text
&lt;div&gt;
&lt;div&gt;
Outer text
</pre>
Example of nested zoom.
In this example, "Inner text" is 4x as large as "Outer text",
and "Middle text" is 2x as large as "Outer text".

<pre>
&lt;div style="zoom: 2"&gt;
Middle text
&lt;div style="zoom: 2"&gt;
Inner text
&lt;div&gt;
&lt;div&gt;
Outer text
</pre>
</div>

<div class="example">
Example of replaced elements. In this example, the image and iframe will
be twice as large as their default sizing.

<pre>
&lt;div style="zoom: 2"&gt;
&lt;img src=""&gt;
&lt;iframe src=""&gt;
&lt;div&gt;
</pre>
Example of replaced elements. In this example,
the image and iframe will be twice as large as their default sizing.

<pre>
&lt;div style="zoom: 2"&gt;
&lt;img src=""&gt;
&lt;iframe src=""&gt;
&lt;div&gt;
</pre>
</div>

The <dfn>effective zoom</dfn> of an element is the product of its computed
Expand Down
3 changes: 2 additions & 1 deletion cssom-view-1/Overview.bs
Original file line number Diff line number Diff line change
Expand Up @@ -1548,7 +1548,8 @@ The <dfn attribute for=HTMLElement>offsetParent</dfn> attribute must return the
The <dfn attribute for=HTMLElement>offsetTop</dfn> attribute must return the result of running these steps:

1. If the element is <a>the <code>body</code> element</a> or does not have any associated [=CSS/box=] return zero and terminate this algorithm.
1. If the {{HTMLElement/offsetParent}} of the element is null return the y-coordinate of the top <a>border edge</a> of the first [=CSS/box=] associated with the element, relative to the <a>initial containing block</a> origin, ignoring any <a>transforms</a> 'or zoom' that apply to the element and its ancestors, and terminate this algorithm.
1. If the {{HTMLElement/offsetParent}} of the element is null return the
[=unscaled=] y-coordinate of the top <a>border edge</a> of the first [=CSS/box=] associated with the element, relative to the <a>initial containing block</a> origin, ignoring any <a>transforms</a>that apply to the element and its ancestors and terminate this algorithm.
1. Return the result of subtracting the y-coordinate of the top <a>padding edge</a>
of the first [=CSS/box=] associated with the {{HTMLElement/offsetParent}} of the element
from the y-coordinate of the top <a>border edge</a>
Expand Down