@@ -1025,25 +1025,25 @@ Issue(23): The focusing steps should probably reset the <a>spatial navigation st
10251025<div algorithm="to run the spatial navigation steps">
10261026To run the <dfn>spatial navigation steps</dfn> in <var> direction</var> , do the following:
10271027
1028- 1. Let <var> startingPoint </var> be the <a>DOM anchor</a> of the <a>currently focused area of a top-level browsing context</a> .
1028+ 1. Let <var> searchOrigin </var> be the <a>DOM anchor</a> of the <a>currently focused area of a top-level browsing context</a> .
102910292. If the <a>spatial navigation starting point</a> is not <code> null</code>
1030- and it is inside <var> startingPoint </var>
1031- then set <var> startingPoint </var> to the <a>spatial navigation starting point</a>
1030+ and it is inside <var> searchOrigin </var>
1031+ then set <var> searchOrigin </var> to the <a>spatial navigation starting point</a>
103210323.
1033- * If <var> startingPoint </var> is an <a>node</a> ,
1034- let <var> eventTarget</var> be <var> startingPoint </var>
1035- * else (<a>assert</a> : the starting point is a position)
1036- let <var> eventTarget</var> be the <a>node</a> which contains <var> startingPoint </var>
1033+ * If <var> searchOrigin </var> is an <a>node</a> ,
1034+ let <var> eventTarget</var> be <var> searchOrigin </var>
1035+ * else (<a>assert</a> : <var> searchOrigin </var> is a position)
1036+ let <var> eventTarget</var> be the <a>node</a> which contains <var> searchOrigin </var>
103710374. If <var> eventTarget</var> is the <a>Document</a> or the <a>document element</a> ,
10381038 set <var> eventTarget</var> be <a>the body element</a> if it is not <code> null</code>
10391039 or to the <a>document element</a> otherwise.
1040- 5. If <var> startingPoint </var> is either a <a>scroll container</a> or the <a>document</a>
1040+ 5. If <var> searchOrigin </var> is either a <a>scroll container</a> or the <a>document</a>
10411041 1. Let <var> candidates</var> be the result of <a>finding focusable areas</a>
1042- within <var> startingPoint </var>
1042+ within <var> searchOrigin </var>
10431043 2.
10441044 * If <var> candidates</var> contains at least 1 item:
10451045 1. Let <var> bestCandidate</var> be the result of <a>selecting the best candidate</a>
1046- within <var> candidates</var> in <var> direction</var> starting from <var> startingPoint </var>
1046+ within <var> candidates</var> in <var> direction</var> starting from <var> searchOrigin </var>
10471047 2. <span class=api> <a>Fire an event</a> named <a event>navbeforefocus</a> at <var> eventTarget</var> using {{NavigationEvent}}
10481048 with its {{NavigationEvent/dir}} set to <var> direction</var> and {{NavigationEvent/relatedTarget}} set to <var> bestCandidate</var>
10491049 and with it's <code> bubbles</code> and <code> cancelable</code> attributes set to <code> true</code> ,
@@ -1059,7 +1059,7 @@ To run the <dfn>spatial navigation steps</dfn> in <var>direction</var>, do the f
10591059 * Else, fallback to the next step
106010606. Let <var> container</var> be the nearest ancestor of <var> eventTarget</var> that is a <a>spatial navigation container</a> .
106110617. <i> Loop</i> : Let <var> candidates</var> be the result of <a>finding focusable areas</a>
1062- within <var> container</var> , excluding <var> startingPoint </var>
1062+ within <var> container</var> , excluding <var> searchOrigin </var>
106310638. If <var> candidates</var> is empty:
10641064 * If <var> container</var> is a <a>scroll container</a> that <a>can be manually scrolled</a> :
10651065 1. <span class=api> <a>Fire an event</a> named <a event>navbeforescroll</a> at <var> eventTarget</var> using {{NavigationEvent}}
@@ -1078,16 +1078,16 @@ To run the <dfn>spatial navigation steps</dfn> in <var>direction</var>, do the f
10781078 then return.
10791079 The User Agent may transfer focus to its own controls (if any) honouring <var> direction</var> .
10801080 * Else, if <var> container</var> is the <a>document element</a> of a <a>nested browsing context</a> then:
1081- 1. Set <var> startingPoint </var> to <var> container</var> 's <a>browsing context container</a>
1082- 2. Set <var> eventTarget</var> be <var> startingPoint </var>
1083- 3. Set <var> container</var> to the nearest ancestor of <var> startingPoint </var> that is a <a>spatial navigation container</a> .
1081+ 1. Set <var> searchOrigin </var> to <var> container</var> 's <a>browsing context container</a>
1082+ 2. Set <var> eventTarget</var> be <var> searchOrigin </var>
1083+ 3. Set <var> container</var> to the nearest ancestor of <var> searchOrigin </var> that is a <a>spatial navigation container</a> .
10841084 4. Return to the step labeled <i> loop</i> .
10851085
10861086 Issue(28): is it sane from a security standpoint that this propagates up from iframes?
10871087 * Else, set <var> container</var> to its closest ancestor that is itself a <a>spatial navigation container</a>
10881088 and return to the step labeled <i> loop</i> .
108910899. Let <var> bestCandidate</var> be the result of <a>selecting the best candidate</a>
1090- within <var> candidates</var> in <var> direction</var> starting from <var> startingPoint </var>
1090+ within <var> candidates</var> in <var> direction</var> starting from <var> searchOrigin </var>
1091109110. <span class=api> <a>Fire an event</a> named <a event>navbeforefocus</a> at <var> eventTarget</var> using {{NavigationEvent}}
10921092 with its {{NavigationEvent/dir}} set to <var> direction</var> and {{NavigationEvent/relatedTarget}} set to <var> bestCandidate</var>
10931093 and with it's <code> bubbles</code> and <code> cancelable</code> attributes set to <code> true</code> ,
@@ -1167,17 +1167,17 @@ follow the following steps:
11671167To <dfn lt="select the best candidate | selecting the best candidate">select the best candidate</dfn>
11681168within a <a spec=infra for="/">set</a> of <var> candidates</var>
11691169in a direction <var> dir</var> ,
1170- starting from <var> starting point </var> ,
1170+ starting from <var> searchOrigin </var> ,
11711171follow the following steps:
11721172
117311731. If <var> candidates</var> is <a spec=infra for=set>empty</a> , return <code> null</code>
117411742. If <var> candidates</var> contains a single item, return that item
117511753. Let <var> insideArea</var> be
1176- * the <a>optimal viewing region</a> of <var> starting point </var> if <var> starting point </var> is a <a>scroll container</a> ,
1177- * the viewport if <var> starting point </var> is a <a>Document</a> ,
1178- * the <a>border box</a> of <var> starting point </var> otherwise.
1176+ * the <a>optimal viewing region</a> of <var> searchOrigin </var> if <var> searchOrigin </var> is a <a>scroll container</a> ,
1177+ * the viewport if <var> searchOrigin </var> is a <a>Document</a> ,
1178+ * the <a>border box</a> of <var> searchOrigin </var> otherwise.
117911794. Let <var> insiders</var> be the subset of <var> candidates</var> items
1180- whose [=DOM anchor=] are descendants of <var> starting point </var>
1180+ whose [=DOM anchor=] are descendants of <var> searchOrigin </var>
11811181 and whose <a>boundary box</a> 's
11821182 * top edge is below the top edge of <var> insideArea</var> if <var> D</var> is <code> down</code>
11831183 * bottom edge is above the bottom edge of <var> insideArea</var> if <var> D</var> is <code> up</code>
@@ -1203,10 +1203,10 @@ follow the following steps:
12031203 * Else
12041204 1. Set <var> candidates</var> be the subset of its items
12051205 whose <a>boundary box</a> 's geometric center is within the closed half plane
1206- whose boundary goes through the geometric center of the <var> starting point </var>
1206+ whose boundary goes through the geometric center of the <var> searchOrigin </var>
12071207 and is perpendicular to <var> D</var> .
12081208 2. For each <var> candidate</var> in <var> candidates</var> ,
1209- find the points <var> P1</var> inside the <a>boundary box</a> of <var> starting point </var>
1209+ find the points <var> P1</var> inside the <a>boundary box</a> of <var> searchOrigin </var>
12101210 and <var> P2</var> inside the <a>boundary box</a> of <var> candidate</var>
12111211 that minimize the <var> distance</var> between these two points,
12121212 when <var> distance</var> is defined as follows:
@@ -1225,7 +1225,7 @@ follow the following steps:
12251225 <dd> The absolute distance in the direction which is orthogonal to <var> dir</var> between <var> P1</var> and <var> P2</var>
12261226
12271227 <dt><var> D</var> :
1228- <dd> The square root of the area of intersection between the <a>boundary boxes</a> of <var> candidate</var> and <var> starting point </var>
1228+ <dd> The square root of the area of intersection between the <a>boundary boxes</a> of <var> candidate</var> and <var> searchOrigin </var>
12291229 </dl>
12301230 3. Return the item of the <var> candidates</var> set that has the smallest <var> distance</var> .
12311231 If several have the same distance,
0 commit comments