You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[css-viewport-1] Add automation support for viewport segments
This commits define ways to emulate display features of
a device. A display feature is a hardware feature that acts
as a divider and creates logically separate regions of the
viewport.
Using WebDriver developers and user agents will have the
opportunity to test or emulate several types of devices.
@@ -554,10 +574,12 @@ Each {{DOMRect}} contains the geometry of the segment (x, y, width, height) in C
554
574
555
575
Additonal details about the definition of a viewport segment can be found here: [[css-env-1#viewport-segments]].
556
576
557
-
The {{segments}} attribute must run these steps:
577
+
The {{segments}} attribute getter steps are:
558
578
1. If the {{Viewport}}'s associated {{Document}} is not <a>fully active</a>, return null.
559
-
2. Returns null if there is only a single viewport segment and abort these steps.
560
-
3. Otherwise, return the {{Viewport}}'s [[css-env-1#viewport-segments|segments]] array.
579
+
2. Let |topLevelTraversable| be |document|'s [=relevant global object=]'s [=/navigable=]'s [=browsing context/top-level traversable=].
580
+
3. If |topLevelTraversable|.[=[[DisplayFeaturesOverride]]=] is non-null, return {{Viewport}}'s [[css-env-1#viewport-segments|segments]] array calculated from |topLevelTraversable|.[=[[DisplayFeaturesOverride]]=].
581
+
4. Returns null if there is only a single viewport segment and abort these steps.
582
+
5. Otherwise, return the {{Viewport}}'s [[css-env-1#viewport-segments|segments]] array calculated from the hardware features.
561
583
562
584
<div class=non-normative>
563
585
<em>This section is not normative.</em>
@@ -608,3 +630,186 @@ This appendix is <em>informative</em>.
608
630
<li>Extend [[!CSS3-CONDITIONAL]] rather than CSS21 for nesting in @media.
609
631
<li>Removed @viewport
610
632
</ul>
633
+
634
+
<h2 class="no-num" id="automation">Appendix B. Automation</h2>
635
+
636
+
<h3>Automation of the {{segments}} property</h3>
637
+
The {{segments}} property poses a challenge to test authors, as exercising this property
638
+
requires access to specific hardware devices. To address this challenge this document defines
639
+
[[WEBDRIVER2]][=extension commands=] that allow users to control how the viewport is split by
640
+
one or more [=display feature| display features=] (such as a fold or a hinge between two separate displays).
641
+
642
+
A <dfn>display feature override</dfn> is a [=struct=] encapsulating the result of a single display feature.
643
+
It has a <dfn data-dfn-for="display feature override">orientation</dfn> (a string that is either "vertical" or "horizontal"),
644
+
a <dfn data-dfn-for="display feature override">mask length</dfn> (a positive number describing the length of the feature in CSS ''<length>/px''), and
645
+
an <dfn data-dfn-for="display feature override">offset</dfn> (which describe the distance from the origin of the viewport in CSS ''<length>/px'').
646
+
647
+
<h4 id="internal-slots">Internal slots</h4>
648
+
To support the [=extension commands=] below and their integration with
649
+
the {{segments}} attribute getter steps, [=browsing context/top-level traversables=] must have the following
<li>Let |features| be the result of invoking <a spec="WEBDRIVER2">getting a property</a> "features" from
747
+
|parameters|.
748
+
</li>
749
+
<li>If |features| is not a {{Array}}, return [=error=] with [=error
750
+
code|WebDriver error code=][=invalid argument=].
751
+
</li>
752
+
<li>Let |parsedFeatures| be a new <a spec=infra>list</a> of [=display feature override=].</li>
753
+
<li>For each |feature item| in |features|:
754
+
<ol>
755
+
<li>If |feature item| is not an {{Object}}, return [=error=] with [=error code|WebDriver error code=][=invalid argument=].</li>
756
+
<li>Let |mask length| be the result of invoking <a spec="WEBDRIVER2">getting a property</a> "maskLength" from |feature item|.</li>
757
+
<li>If |mask length| is not a {{Number}} or its value is {{Number/NaN}}, +∞, −∞, or negative return [=error=] with [=error code|WebDriver error code=][=invalid argument=].
758
+
<li>Let |offset| be the result of invoking <a spec="WEBDRIVER2">getting a property</a> "offset" from |feature item|.</li>
759
+
<li>If |offset| is not a {{Number}} or its value is {{Number/NaN}}, +∞, −∞, or negative return [=error=] with [=error code|WebDriver error code=][=invalid argument=].
760
+
<li>Let |orientation| be the result of invoking <a spec="WEBDRIVER2">getting a property</a> "orientation" from |feature item|.</li>
761
+
<li>If |orientation| is not a {{string}}, return [=error=] with [=error code|WebDriver error code=][=invalid argument=].</li>
762
+
<li>If |orientation| is neither "vertical" or "vertical", return [=error=] with [=error code|WebDriver error code=][=invalid argument=].
763
+
<li>If |orientation| is "vertical" and |mask length| + |offset| is greater than viewport width including the size of the rendered scrollbar, return [=error=] with [=error code|WebDriver error code=][=invalid argument=].</li>
764
+
<li>If |orientation| is "vertical" and |mask length| + |offset| is greater than viewport height including the size of the rendered scrollbar, return [=error=] with [=error code|WebDriver error code=][=invalid argument=].</li>
765
+
<li>Let |override| be a new [=display feature override=].</li>
766
+
<li>Set |override|'s [=mask length=] to |mask length|.</li>
767
+
<li>Set |override|'s [=orientation=] to |orientation|.</li>
768
+
<li>Set |override|'s [=offset=] to |offset|.</li>
769
+
<li>[=list/Append=] |override| to |parsedFeatures|.</li>
770
+
</ol>
771
+
</li>
772
+
<li>Let |topLevelTraversable| be the <a spec="WEBDRIVER2">current browsing context</a>'s
773
+
[=browsing context/top-level traversable=].
774
+
</li>
775
+
<li>Set |topLevelTraversable|.[=[[DisplayFeaturesOverride]]=] to |parsedFeatures|.
776
+
</li>
777
+
<li>Return [=success=] with data <code>null</code>.
0 commit comments