Skip to content

Commit e92ed20

Browse files
authored
[css-nesting-1][editorial] Added WPTs (#13217)
* [css-nesting-1][editorial] Added WPTs * [css-viewport-1][editorial] Fixed Bikeshed issues
1 parent 9ad1da2 commit e92ed20

File tree

2 files changed

+127
-38
lines changed

2 files changed

+127
-38
lines changed

css-nesting-1/Overview.bs

Lines changed: 84 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ Former Editor: Adam Argyle, Google, https://nerdy.dev, w3cid 112669
1212
Abstract: This module introduces the ability to nest one style rule inside another, with the selector of the child rule relative to the selector of the parent rule. This increases the modularity and maintainability of CSS stylesheets.
1313
Default Highlight: css
1414
Include MDN Panels: no
15+
WPT Path Prefix: css/css-nesting/
16+
WPT Display: open
1517
</pre>
1618

1719
<pre class=link-defaults>
@@ -36,6 +38,24 @@ Introduction</h2>
3638
This feature allows related styles to be aggregated into a single structure within the CSS document,
3739
improving readability and maintainability.
3840

41+
<wpt title="General tests for nesting">
42+
block-skipping.html
43+
delete-other-rule-crash.html
44+
double-parent-pseudo-in-placeholder-crash.html
45+
has-nesting.html
46+
invalidation-001.html
47+
invalidation-002.html
48+
invalidation-003.html
49+
invalidation-004.html
50+
nested-error-recovery.html
51+
nesting-basic.html
52+
nesting-revert-rule.tentative.html
53+
parent-pseudo-in-placeholder-crash.html
54+
pseudo-part-crash.html
55+
pseudo-where-crash.html
56+
supports-is-consistent.html
57+
</wpt>
58+
3959
<h3 id="placement">
4060
Module Interactions</h3>
4161

@@ -192,6 +212,13 @@ Nesting Style Rules {#nesting}
192212
which are implicitly relative
193213
to the elements matched by the parent rule.
194214

215+
<wpt>
216+
implicit-nesting.html
217+
implicit-nesting-ident.html
218+
implicit-nesting-ident-recovery.html
219+
implicit-parent-insertion-crash.html
220+
</wpt>
221+
195222
<div class=example>
196223
That is,
197224
a nested style rule like:
@@ -254,6 +281,10 @@ Nesting Style Rules {#nesting}
254281
</pre>
255282
</div>
256283

284+
<wpt>
285+
nested-rule-cssom-invalidation.html
286+
</wpt>
287+
257288

258289
<!-- Big Text: syntax
259290

@@ -361,6 +392,11 @@ Syntax {#syntax}
361392
an invalid selector still fails to match anything--
362393
just the serialization of the selector.)
363394

395+
<wpt>
396+
nest-containing-forgiving.html
397+
parsing.html
398+
</wpt>
399+
364400
Issue: The preceding paragraph needs to move to Selectors
365401
when we move ''&'' itself to Selectors;
366402
I'm monkey-patching for convenience here.
@@ -648,6 +684,13 @@ Nesting Other At-Rules {#conditionals}
648684
* ''@scope''
649685
</div>
650686

687+
<wpt>
688+
conditional-properties.html
689+
conditional-rules.html
690+
invalid-inner-rules.html
691+
supports-rule.html
692+
</wpt>
693+
651694
The meanings and behavior of such [=nested group rules=]
652695
is otherwise unchanged,
653696
unless otherwise specified.
@@ -757,6 +800,10 @@ Nesting Other At-Rules {#conditionals}
757800
are automatically wrapped in [=nested declarations rules=].
758801
(This is observable in the CSSOM.)
759802

803+
<wpt>
804+
nesting-layer.html
805+
</wpt>
806+
760807
<h4 id=nesting-at-scope>
761808
Nested ''@scope'' Rules</h4>
762809

@@ -914,6 +961,10 @@ Nesting Selector: the ''&'' selector {#nest-selector}
914961
it represents the same elements as '':scope'' in that context
915962
(unless otherwise defined).
916963

964+
<wpt>
965+
top-level-is-scope.html
966+
</wpt>
967+
917968
<div class="note">
918969
The <a>nesting selector</a> can be desugared
919970
by replacing it with the parent style rule's selector,
@@ -971,6 +1022,10 @@ Nesting Selector: the ''&'' selector {#nest-selector}
9711022
(identical to the behavior of '':is()''),
9721023
or zero if no such selector list exists.
9731024

1025+
<wpt>
1026+
top-level-parent-pseudo-specificity.html
1027+
</wpt>
1028+
9741029
<div class="example">
9751030
For example, given the following style rules:
9761031

@@ -1098,6 +1153,18 @@ Nesting Selector: the ''&'' selector {#nest-selector}
10981153
continues to apply
10991154
(that is, ''&amp;div'' is illegal, and must be written ''div&amp;'' instead).
11001155

1156+
<wpt>
1157+
contextually-invalid-selectors-001.html
1158+
contextually-invalid-selectors-002.html
1159+
contextually-invalid-selectors-003.html
1160+
host-nesting-001.html
1161+
host-nesting-002.html
1162+
host-nesting-003.html
1163+
host-nesting-004.html
1164+
host-nesting-005.html
1165+
nesting-type-selector.html
1166+
</wpt>
1167+
11011168

11021169
<!-- Big Text: Nested Decl
11031170

@@ -1271,7 +1338,12 @@ The Nested Declarations Rule</h2>
12711338
at <code highlight=js>fooRule.cssRules[1].style</code>.
12721339
</div>
12731340

1274-
1341+
<wpt>
1342+
mixed-declarations-rules.html
1343+
nested-declarations-cssom-whitespace.html
1344+
nested-declarations-cssom.html
1345+
nested-declarations-matching.html
1346+
</wpt>
12751347

12761348

12771349

@@ -1301,6 +1373,11 @@ with the implied [=nesting selector=] inserted.
13011373
will serialize as ''& > .foo''.
13021374
</div>
13031375

1376+
<wpt>
1377+
cssom.html
1378+
set-selector-text.html
1379+
</wpt>
1380+
13041381
The {{CSSNestedDeclarations}} Interface {#the-cssnestrule}
13051382
-----------------------------
13061383

@@ -1334,6 +1411,10 @@ The {{CSSNestedDeclarations}} rule [=serialize a CSS rule|serializes=]
13341411
as if its [=CSS declaration block|declaration block=]
13351412
had been [=serialize a CSS declaration block|serialized=] directly.
13361413

1414+
<wpt>
1415+
serialize-group-rules-with-decls.html
1416+
</wpt>
1417+
13371418
Note: This means that multiple adjacent [=nested declarations rules=]
13381419
(which is possible to create with e.g. {{CSSGroupingRule/insertRule}})
13391420
will collapse into a single rule when serialized and parsed again.
@@ -1380,3 +1461,5 @@ Significant changes since the
13801461

13811462
* Replaced <code>@nest</code> with [=nested declarations rules=].
13821463
(<a href="https://github.com/w3c/csswg-drafts/issues/10234">Issue 10234</a>)
1464+
1465+
* Added Web Platform Tests coverage.

css-viewport-1/Overview.bs

Lines changed: 43 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Former Editor: Ryan Betts, Adobe Systems, [email protected]
1717
Former Editor: Øyvind Stenhaug, Opera Software, [email protected]
1818
Abstract: This specification provides a way for an author to specify, in CSS, the size, zoom factor, and orientation of the viewport that is used as the base for the initial containing block.
1919
Issue Tracking: CSSWG GitHub https://github.com/w3c/csswg-drafts/labels/css-viewport-1
20-
Ignored Vars: <viewport-length>
20+
Ignored Vars: document, parameters, <viewport-length>
2121
</pre>
2222

2323
<pre class="anchors">
@@ -32,8 +32,10 @@ spec: fenced-frames; urlPrefix: https://wicg.github.io/fenced-frame/
3232
</pre>
3333

3434
<pre class=link-defaults>
35-
spec:webdriver2; type:dfn; text:remote end steps
36-
spec:webdriver2; type:dfn; text:error
35+
spec:webdriver2; type:dfn;
36+
text:error
37+
text:remote end steps
38+
text:success
3739
</pre>
3840

3941
<h2 id="intro">
@@ -90,14 +92,14 @@ The page area can be set through ''@page'' rules.
9092

9193
This specification introduces a way of overriding the size of the viewport
9294
provided by the user agent (UA). Because of this, we need to introduce the
93-
difference between the ''initial viewport'' and the ''actual viewport''.
95+
difference between the [=initial viewport=] and the [=actual viewport=].
9496

9597
<dl>
9698
<dt><dfn>initial viewport</dfn></dt>
9799
<dd>
98100
This refers to the viewport before any UA or author styles have
99101
overridden the viewport given by the window or viewing area of the UA.
100-
Note that the ''initial viewport'' size will change with the
102+
Note that the [=initial viewport=] size will change with the
101103
size of the window or viewing area.</dd>
102104
<dt><dfn>actual viewport</dfn></dt>
103105
<dd>
@@ -106,25 +108,25 @@ difference between the ''initial viewport'' and the ''actual viewport''.
106108
</dd>
107109
</dl>
108110

109-
ISSUE: Make ''actual viewport'' the layout viewport, define visual viewport.
111+
ISSUE: Make [=actual viewport=] the layout viewport, define visual viewport.
110112

111-
When the ''actual viewport'' cannot fit inside the window or
112-
viewing area, either because the ''actual viewport'' is
113-
larger than the ''initial viewport'' or the zoom factor
114-
causes only parts of the ''actual viewport'' to be visible,
113+
When the [=actual viewport=] cannot fit inside the window or
114+
viewing area, either because the [=actual viewport=] is
115+
larger than the [=initial viewport=] or the zoom factor
116+
causes only parts of the [=actual viewport=] to be visible,
115117
the UA should offer a scrolling or panning mechanism.
116118

117119
It is recommended that initially the upper-left corners of the
118-
''actual viewport'' and the window or viewing area are aligned if the
120+
[=actual viewport=] and the window or viewing area are aligned if the
119121
base direction of the document is ltr. Similarly, that the upper-right
120122
corners are aligned when the base direction is rtl. The base direction
121123
for a document is defined as the computed value of the 'direction'
122124
property for the first <code class=html>&lt;BODY&gt;</code> element of
123125
an HTML or XHTML document. For other document types, it is the
124126
computed 'direction' for the root element.
125127

126-
<h3 id="display-feature"><dfn>Display feature</dfn> definition</h3>
127-
A display feature is a hardware feature that acts as a divider
128+
<h3 id="the-display-feature">Display feature definition</h3>
129+
A <dfn>Display feature</dfn> is a hardware feature that acts as a divider
128130
and creates logically separate region of the viewport called {{segments}}.
129131
It can be a fold area of a device with a foldable screen or a physical
130132
split occupying a logical space within the viewport for example some dual
@@ -133,10 +135,10 @@ screen models.
133135
Below is an illustration describing the concept of display features and how
134136
they divide the viewport in {{segments}}:
135137

136-
<img src="display_features_general.svg" alt="Two images,
137-
showing two display feature configurations and the respective segments.
138-
One image is showing an vertical display feature, the other is showing
139-
an horizontal display feature" style="width: 70%;height: auto; margin:auto; display: flex;">
138+
<img src="display_features_general.svg" width="560" height="258"
139+
alt="Two images, showing two display feature configurations and the respective segments.
140+
One image is showing an vertical display feature, the other is showing
141+
an horizontal display feature" style="width: 70%;height: auto; margin:auto; display: flex;">
140142

141143

142144
<h2 id="viewport-meta">
@@ -389,7 +391,7 @@ only the value previously set to it.
389391
An element becomes zoomed when the 'zoom' property has a positive computed value different than 1
390392
(or when a flat tree ancestor has zoom).
391393

392-
To apply zoom, the [=used value=] of a CSS property (including values inside of [=path()=] strings) is pre-multiplied
394+
To apply zoom, the [=used value=] of a CSS property (including values inside of ''path()'' strings) is pre-multiplied
393395
(before any other steps in the [=used value=] stage)
394396
by the [=used value=] of 'zoom' for the element.
395397
It also multiplies the [=natural size=] of all replaced elements,
@@ -406,7 +408,7 @@ all inherited properties such as 'line-height' and 'font-size'.
406408
Nested values of 'zoom' multiply, resulting in additional scaling of <<length>> values.
407409
The [=used value=] for zoom is always its [=effective zoom=].
408410

409-
The 'zoom' property has no effect on <<length>> property values with computed values that are 'auto' or <<percentage>>.
411+
The 'zoom' property has no effect on <<length>> property values with computed values that are <css>auto</css> or <<percentage>>.
410412

411413
Note: Unlike 'transform',
412414
scaling the 'zoom' property affects layout.
@@ -480,8 +482,8 @@ Negative values for 'zoom' are illegal.
480482
</pre>
481483

482484
Here is an llustration of the before and after hover state of the message box element:
483-
<img src="css_zoom_hover_example.png" alt="Two images,
484-
showing the zooming effect before and after zoom has applied. The second is 1.5 larger.">
485+
<img src="css_zoom_hover_example.png" width="704" height="270"
486+
alt="Two images showing the zooming effect before and after zoom has applied. The second is 1.5 larger.">
485487
</div>
486488

487489
<div class="example">
@@ -553,9 +555,7 @@ partial interface Window {
553555
};
554556
</pre>
555557

556-
<h2 id=viewport>Viewport</h2>
557-
558-
<h3 id="the-viewport-interface">The {{Viewport}} Interface</h3>
558+
<h2 id="the-viewport-interface">The {{Viewport}} Interface</h2>
559559

560560
<pre class=idl>
561561
[Exposed=Window]
@@ -593,23 +593,31 @@ If a viewport of 400px by 400px is split horizontally into two side-by-side segm
593593

594594
</div>
595595

596+
<h2 class=no-num id="privacy">Privacy Considerations</h2>
597+
598+
No new privacy considerations have been reported on this specification.
599+
600+
<h2 class=no-num id="security">Security Considerations</h2>
601+
602+
No new security considerations have been reported on this specification.
603+
596604
<h2 class="no-num" id="changes">Appendix A. Changes</h2>
597605

598606
This appendix is <em>informative</em>.
599607

600-
<h3 class="no-num">Since the
608+
<h3 class="no-num" id="changes-20160329">Since the
601609
<a href="http://www.w3.org/TR/2016/WD-css-device-adapt-1-20160329/">29
602610
March 2016 Working Draft</a>
603611
</h3>
604612

605613
<ul>
606-
<li>Added 'interactive-widgets' property to viewport meta</li>
607-
<li>Removed @viewport rule</li>
614+
<li>Added <css>interactive-widgets</css> property to viewport meta</li>
615+
<li>Removed <css>@viewport</css> rule</li>
608616
<li>Renamed spec from device-adapt to css-viewport</li>
609617
<li>CSSViewportRule exposed to Window</li>
610618
</ul>
611619

612-
<h3 class="no-num">Since the
620+
<h3 class="no-num" id="changes-20110915">Since the
613621
<a href="https://www.w3.org/TR/2011/WD-css-device-adapt-20110915/">15
614622
September 2011 First Public Working Draft</a>.
615623
</h3>
@@ -622,17 +630,16 @@ This appendix is <em>informative</em>.
622630
<li>Added recommendation for when to respect orientation property.
623631
<li>Dropped support for the resolution descriptor.
624632
<li>Decouple width/height and zoom, introducing ''extend-to-zoom'' value for meta viewport translation.
625-
<li>Made normative rules about interaction of @viewport and @media.
626-
<li>Allow 0 for <<viewport-length>> and '@viewport/zoom' values
633+
<li>Made normative rules about interaction of <css>@viewport</css> and ''@media''.
634+
<li>Allow 0 for <css>&lt;viewport-length&gt;</css> and <css>zoom</css> values
627635
<li>Removed support for device-width/height.
628-
<li>Apply @viewport to top level document only.
629-
<li>Extend [[!CSS3-CONDITIONAL]] rather than CSS21 for nesting in @media.
630-
<li>Removed @viewport
636+
<li>Apply <css>@viewport</css> to top level document only.
637+
<li>Extend [[!CSS3-CONDITIONAL]] rather than CSS21 for nesting in ''@media''.
631638
</ul>
632639

633640
<h2 class="no-num" id="automation">Appendix B. Automation</h2>
634641

635-
<h3>Automation of the {{segments}} property</h3>
642+
<h3 id="automation-segments">Automation of the {{segments}} property</h3>
636643
The {{segments}} property poses a challenge to test authors, as exercising this property
637644
requires access to specific hardware devices. To address this challenge this document defines
638645
[[WEBDRIVER2]] [=extension commands=] that allow users to control how the viewport is split by
@@ -715,9 +722,8 @@ parameter.
715722

716723
Below is an illustration showing the various properties of a display feature:
717724

718-
<img src="display_features.svg" alt="Two images,
719-
showing the meaning of each display feature attributes. One image is showing an
720-
vertical display feature, the other is showing an horizontal display feature" style="width: 70%;height: auto; margin:auto; display: flex;">
725+
<img src="display_features.svg" width="560" height="258"
726+
alt="Two images showing the meaning of each display feature attributes. One image is showing a vertical display feature, the other is showing an horizontal display feature" style="width: 70%;height: auto; margin:auto; display: flex;">
721727

722728
<div class="example">
723729
To create a [=[[DisplayFeaturesOverride]]=] in the <a spec="WEBDRIVER2">current browsing context</a> of the [=session=] with ID 23,

0 commit comments

Comments
 (0)