Skip to content

Commit 4d43a5b

Browse files
committed
simplify by using max() / min() more rather than an additional step
1 parent 70ebda6 commit 4d43a5b

2 files changed

Lines changed: 19 additions & 46 deletions

File tree

cssom-view/Overview.html

Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -952,12 +952,9 @@ <h3 id=scroll-attributes><span class=secno>5.2. </span>The <code
952952
<p>If <var title="">y</var> is infinite or NaN stop this algorithm.</p>
953953

954954
<li>
955-
<p>Let <var title="">y</var> be min(<var title="">y</var>, <a
955+
<p>Let <var title="">y</var> be max(0, min(<var title="">y</var>, <a
956956
href="#content">content</a> height - <a href="#content-edge">content
957-
edge</a> height).
958-
959-
<li>
960-
<p>If <var title="">y</var> is negative let it be zero.
957+
edge</a> height)).
961958

962959
<li>
963960
<p>Align <a href="#content">content</a> y-coordinate <var
@@ -1032,29 +1029,17 @@ <h3 id=scroll-attributes><span class=secno>5.2. </span>The <code
10321029
<dt>If <var>A</var> can have overflow to the right
10331030

10341031
<dd>
1035-
<ol>
1036-
<li>
1037-
<p>Let <var title="">x</var> be min(<var title="">x</var>, <a
1038-
href="#content">content</a> width - <a href="#content-edge">content
1039-
edge</a> width).
1040-
1041-
<li>
1042-
<p>If <var title="">x</var> is negative let it be zero.
1043-
</ol>
1032+
<p>Let <var title="">x</var> be max(0, min(<var title="">x</var>, <a
1033+
href="#content">content</a> width - <a href="#content-edge">content
1034+
edge</a> width)).
10441035

10451036
<dt>If <var>A</var> can have overflow to the left (under right-to-left
10461037
conditions)
10471038

10481039
<dd>
1049-
<ol>
1050-
<li>
1051-
<p>Let <var title="">x</var> be max(<var title="">x</var>, <a
1052-
href="#content-edge">content edge</a> width - <a
1053-
href="#content">content</a> width).
1054-
1055-
<li>
1056-
<p>If <var title="">x</var> is non-negative let it be zero.
1057-
</ol>
1040+
<p>Let <var title="">x</var> be min(0, max(<var title="">x</var>, <a
1041+
href="#content-edge">content edge</a> width - <a
1042+
href="#content">content</a> width)).
10581043
</dl>
10591044

10601045
<li>

cssom-view/Overview.src.html

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -756,10 +756,8 @@ <h3 id="scroll-attributes">The <code title="">scrollTop</code>,
756756
<li><p>If <var title="">y</var> is infinite or NaN stop this
757757
algorithm.</p>
758758

759-
<li><p>Let <var title="">y</var> be min(<var title="">y</var>,
760-
<span>content</span> height - <span>content edge</span> height).</p></li>
761-
762-
<li><p>If <var title="">y</var> is negative let it be zero.</p></li>
759+
<li><p>Let <var title="">y</var> be max(0, min(<var title="">y</var>,
760+
<span>content</span> height - <span>content edge</span> height)).</p></li>
763761

764762
<li><p>Align <span>content</span> y-coordinate <var title="">y</var> with
765763
the top of the <span>content edge</span> of the element.</p></li>
@@ -813,30 +811,20 @@ <h3 id="scroll-attributes">The <code title="">scrollTop</code>,
813811

814812
<li>
815813
<dl>
816-
<dt>If <var>A</var> can have overflow to the right
814+
<dt>If <var>A</var> can have overflow to the right</dt>
817815

818-
<dd>
819-
<ol>
820-
<li><p>Let <var title="">x</var> be min(<var title="">x</var>,
821-
<span>content</span> width - <span>content edge</span>
822-
width).</p></li>
823-
824-
<li><p>If <var title="">x</var> is negative let it be zero.</p></li>
825-
</ol>
816+
<dd><p>Let <var title="">x</var> be max(0, min(<var title="">x</var>,
817+
<span>content</span> width -
818+
<span>content edge</span> width)).</p></dd>
826819

827820
<dt>If <var>A</var> can have overflow to the left (under right-to-left
828-
conditions)
821+
conditions)</dt>
829822

830-
<dd>
831-
<ol>
832-
<li><p>Let <var title="">x</var> be max(<var title="">x</var>,
833-
<span>content edge</span> width - <span>content</span>
834-
width).</p></li>
835-
836-
<li><p>If <var title="">x</var> is non-negative let it be
837-
zero.</p></li>
838-
</ol>
823+
<dd><p>Let <var title="">x</var> be min(0, max(<var title="">x</var>,
824+
<span>content edge</span> width -
825+
<span>content</span> width)).</p></dd>
839826
</dl>
827+
</li>
840828

841829
<li><p>Align <span>content</span> x-coordinate <var title="">x</var> with
842830
the left of the <span>content edge</span> of <var>A</var>.</p></li>

0 commit comments

Comments
 (0)