Add error handling to percentage parsing to restrict it to 0-100%.
authorSilvia Pfeiffer
Fri, 08 Mar 2013 18:55:02 +1100
changeset 75 48d35535d98e
parent 74 17b3b4696208
child 76 3f0ef4d6f3a8
Add error handling to percentage parsing to restrict it to 0-100%.
608toVTT/region.html
--- a/608toVTT/region.html	Fri Mar 08 18:41:22 2013 +1100
+++ b/608toVTT/region.html	Fri Mar 08 18:55:02 2013 +1100
@@ -543,7 +543,7 @@
 
         <p>We first introduce an algorithm to <a href="#parse-a-percentage-string" class="internalDFN">parse a percentage string</a> and then the algorithm to <a href="#collect-webvtt-region-settings" class="internalDFN">collect WebVTT region settings</a>.</p>
 
-        <p>The rules to <dfn id="parse-a-percentage-string">parse a percentage string</dfn> are as follows. This will return a percentage value or, if at any point the algorithm says that it "fails", this means that it is aborted at that point and returns nothing.</p>
+        <p>The rules to <dfn id="parse-a-percentage-string">parse a percentage string</dfn> are as follows. This will return a percentage value or, if at any point the algorithm says that it "fails", this means that it is aborted at that point with an IndexSizeError and returns nothing.</p>
         <ol>
          <li><p>Let <var>input</var> be the string being parsed.</p></li>
 
@@ -559,6 +559,8 @@
 
          <li><p>Ignoring the trailing percent sign, interpret <var>input</var> as a real number. Let that number be the <var>percentage</var>.</p></li>
 
+         <li><p>If <var>percentage</var> is outside Throws an the range 0.0% .. 100.0%, fail.</p></li>
+
          <li><p>Return <var>percentage</var>.</p></li>
         </ol>
 
@@ -949,22 +951,22 @@
           <dd>Returns the text track region identifier. Can be set.</dd>
 
           <dt>attribute double width</dt>
-          <dd>Returns the text track region width as a percentage of the video width. Can be set.</dd>
+          <dd>Returns the text track region width as a percentage of the video width. Can be set. Throws an IndexSizeError if the new value is not in the range 0.0% .. 100.0%.</dd>
 
           <dt>attribute long height</dt>
           <dd>Returns the text track region height as a number of lines. Can be set.</dd>
 
           <dt>attribute double regionAnchorX</dt>
-          <dd>Returns the text track region anchor X offset as a percentage of the region width. Can be set.</dd>
+          <dd>Returns the text track region anchor X offset as a percentage of the region width. Can be set. Throws an IndexSizeError if the new value is not in the range 0.0% .. 100.0%.</dd>
 
           <dt>attribute double regionAnchorY</dt>
-          <dd>Returns the text track region anchor Y offset as a percentage of the region height. Can be set.</dd>
+          <dd>Returns the text track region anchor Y offset as a percentage of the region height. Can be set. Throws an IndexSizeError if the new value is not in the range 0.0% .. 100.0%.</dd>
 
           <dt>attribute double viewportAnchorX</dt>
-          <dd>Returns the text track viewport anchor X offset as a percentage of the video width. Can be set.</dd>
+          <dd>Returns the text track viewport anchor X offset as a percentage of the video width. Can be set. Throws an IndexSizeError if the new value is not in the range 0.0% .. 100.0%.</dd>
 
           <dt>attribute double viewportAnchorY</dt>
-          <dd>Returns the text track viewport anchor Y offset as a percentage of the video height. Can be set.</dd>
+          <dd>Returns the text track viewport anchor Y offset as a percentage of the video height. Can be set. Throws an IndexSizeError if the new value is not in the range 0.0% .. 100.0%.</dd>
 
           <dt>attribute DOMString scroll</dt>
           <dd><p>Returns a string representing the text track region scroll as follows:</p>