Skip to content

Commit 5f12ad9

Browse files
committed
Use viewport instead of initial viewport in screenshot algorithms
The screenshot algorithms reference the initial viewport when computing framebuffer bounds. If the browser window is resized after the document loads, this can lead to incorrect clipping. Update the algorithms to reference the viewport instead. Fixes #1947
1 parent cc4c0d2 commit 5f12ad9

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

index.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10926,12 +10926,12 @@ <h2>Screen capture</h2>
1092610926

1092710927
<p>Screenshots are a mechanism for providing
1092810928
additional visual diagnostic information.
10929-
They work by dumping a snapshot of the <a>initial viewport</a>&apos;s
10929+
They work by dumping a snapshot of the <a>viewport</a>&apos;s
1093010930
framebuffer as a lossless PNG image.
1093110931
It is returned to the <a>local end</a> as a Base64 encoded string.
1093210932

1093310933
<p>WebDriver provides the <a>Take Screenshot</a> <a>command</a>
10934-
to capture the <a>top-level browsing context</a>&apos;s <a>initial viewport</a>,
10934+
to capture the <a>top-level browsing context</a>&apos;s <a>viewport</a>,
1093510935
and a <a>command</a> <a>Take Element Screenshot</a>
1093610936
for doing the same with the visible region of an <a>element</a>&apos;s
1093710937
<a>bounding rectangle</a> after it has been <a>scrolled into view</a>.
@@ -10940,15 +10940,15 @@ <h2>Screen capture</h2>
1094010940
given a <a>rectangle</a>:
1094110941

1094210942
<ol>
10943-
<li><p>If either the <a>initial viewport</a>&apos;s width or height
10943+
<li><p>If either the <a>viewport</a>&apos;s width or height
1094410944
is 0 <a>CSS pixels</a>,
1094510945
return <a>error</a> with <a>error code</a> <a>unable to capture screen</a>.
1094610946

10947-
<li><p>Let <var>paint width</var> be the <a>initial viewport</a>&apos;s width –
10947+
<li><p>Let <var>paint width</var> be the <a>viewport</a>&apos;s width –
1094810948
<a>min</a>(<a>rectangle x coordinate</a>,
1094910949
<a>rectangle x coordinate</a> + <a>rectangle width dimension</a>).
1095010950

10951-
<li><p>Let <var>paint height</var> be the <a>initial viewport</a>&apos;s height –
10951+
<li><p>Let <var>paint height</var> be the <a>viewport</a>&apos;s height –
1095210952
<a>min</a>(<a>rectangle y coordinate</a>,
1095310953
<a>rectangle y coordinate</a> + <a>rectangle height dimension</a>).
1095410954

0 commit comments

Comments
 (0)