tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

markuprules.xml (14122B)


      1 <?xml version="1.0"?>
      2 
      3 <!--
      4  This XML file is used to create sequence of accessible name tests. It consist
      5  of two sections. The first section 'ruledfn' declares name computation rules.
      6  The second section 'rulesample' defines markup samples we need to check name
      7  computation rules for.
      8 
      9  <ruledfn>
     10    <ruleset>
     11      <rule>
     12 
     13  Section 'ruledfn' contains 'ruleset' elements. Every 'ruleset' element is
     14  presented by 'rule' elements so that sequence of 'rule' elements gives the
     15  sequence of name computations rules. Every 'rule' element can be one of four
     16  types.
     17 
     18   * <rule attr='' type='string'/> used when name is equal to the value of
     19     attribute presented on the element.
     20 
     21     Example, 'aria-label' attribute. In this case 'rule' element has 'attr'
     22     attribute pointing to attribute name and 'type' attribute with 'string'
     23     value. For example, <rule attr="aria-label" type="string"/>.
     24 
     25   * <rule attr='' type='ref'/> used when name is calculated from elements that
     26     are pointed to by attribute value on the element.
     27 
     28     Example is 'aria-labelledby'. In this case 'rule' element has 'attr'
     29     attribute holding the sequence of IDs of elements used to compute the name,
     30     in addition the 'rule' element has 'type' attribute with 'ref' value.
     31     For example, <rule attr="aria-labelledby" type="ref"/>.
     32 
     33   * <rule elm='' elmattr=''/> used when name is calculated from another
     34     element. These attributes are used to find an element by tagname and
     35     attribute with value equaled to ID of the element. If 'elmattr' is missed
     36     then element from subtree with the given tagname is used.
     37 
     38     Example, html:label@for element, <rule elm="label" elmattr="for"/>.
     39     Example, html:caption element, <rule elm="caption"/>
     40 
     41   * <rule fromsubtree='true'/> used when name is computed from subtree.
     42 
     43     Example, html:button. In this case 'rule' element has 'fromsubtree'
     44     attribute with 'true' value.
     45 
     46  <rulesample>
     47    <markup ruleset=''>
     48 
     49  Section 'rulesample' provides set of markup samples ('markup' elements). Every
     50  'markup' element contains an element that accessible name will be computed for
     51  (let's call it test element). In addition the 'markup' element contains some
     52  other elements from native markup used in name calculation process for test
     53  element. Test element is pointed to by 'ref' attribute on 'markup' element.
     54  Also 'markup' element has 'ruleset' attribute to indicate ruleset for the test
     55  element.
     56 
     57  How does it work? Let's consider simple example:
     58  <ruledfn>
     59    <ruleset id="aria">
     60      <rule attr="aria-label" type="string"/>
     61      <rule attr="aria-labelledby" type="ref"/>
     62    </ruleset>
     63  </ruledfn>
     64  <rulesample>
     65    <markup ref="html:div" ruleset="aria">
     66      <html:span id="label" textequiv="test2">test2</html:span>
     67      <html:div aria-label="test1"
     68                aria-labelledby="label">it's a div</html:div>
     69    </markup>
     70  </rulesample>
     71 
     72  Initially 'markup' element holds markup for all rules specified by 'ruleset'
     73  attribute. This allows us to check if the sequence of name computation rules
     74  is correct. Here 'ruleset' element defines two rules. We get the first rule
     75  which means accessible name is computed from value of 'aria-label' attribute.
     76  Then we check accessible name for the test element and remove 'aria-label'
     77  attribute. After we get the second rule which means we should get IDs from
     78  'aria-labelledby' attribute and compose accessible name from values of
     79  'textequiv' attributes (that are supposed to give the desired name for each
     80  element that is being pointed to by aria-labelledby). Check accessible name
     81  and finish test.
     82 -->
     83 
     84 <rules xmlns:html="http://www.w3.org/1999/xhtml"
     85       xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
     86 
     87  <ruledfn>
     88 
     89    <!-- bricks -->
     90    <ruleset id="ARIA">
     91      <rule attr="aria-labelledby" type="ref"/>
     92      <rule attr="aria-label" type="string"/>
     93    </ruleset>
     94 
     95    <ruleset id="HTMLControl:Head">
     96      <ruleset ref="ARIA"/>
     97      <rule elm="label" elmattr="for"/>
     98    </ruleset>
     99 
    100    <!-- general -->
    101    <ruleset id="HTMLControl">
    102      <ruleset ref="HTMLControl:Head"/>
    103      <rule fromsubtree="true"/>
    104      <rule attr="title" type="string"/>
    105    </ruleset>
    106 
    107    <ruleset id="HTMLElm">
    108      <ruleset ref="ARIA"/>
    109      <rule attr="title" type="string"/>
    110    </ruleset>
    111 
    112    <!-- specific -->
    113    <ruleset id="HTMLCell">
    114      <ruleset ref="ARIA"/>
    115      <rule fromsubtree="true"/>
    116      <rule attr="title" type="string"/>
    117    </ruleset>
    118 
    119    <ruleset id="HTMLInputButton">
    120      <ruleset ref="HTMLControl:Head"/>
    121      <rule attr="value" type="string" explicit-name="false" reordered="true"/>
    122      <rule attr="title" type="string"/>
    123    </ruleset>
    124 
    125    <ruleset id="HTMLInputSubmit" defaultName="Submit Query">
    126      <ruleset ref="HTMLControl:Head"/>
    127      <rule attr="value" type="string" explicit-name="false"/>
    128    </ruleset>
    129 
    130    <ruleset id="HTMLInputReset" defaultName="Reset">
    131      <ruleset ref="HTMLControl:Head"/>
    132      <rule attr="value" type="string" explicit-name="false"/>
    133    </ruleset>
    134 
    135    <ruleset id="HTMLInputImage">
    136      <ruleset ref="HTMLControl:Head"/>
    137      <rule attr="alt" type="string"/>
    138      <rule attr="value" type="string"/>
    139      <rule attr="title" type="string"/>
    140    </ruleset>
    141 
    142    <ruleset id="HTMLInputImageNoValidSrc" defaultName="Submit Query">
    143      <ruleset ref="HTMLControl:Head"/>
    144      <rule attr="alt" type="string"/>
    145      <rule attr="value" type="string"/>
    146    </ruleset>
    147 
    148    <ruleset id="HTMLOption">
    149      <ruleset ref="ARIA"/>
    150      <rule attr="label" type="string"/>
    151      <rule fromsubtree="true"/>
    152      <rule attr="title" type="string"/>
    153    </ruleset>
    154 
    155    <ruleset id="HTMLImg">
    156      <ruleset ref="ARIA"/>
    157      <rule attr="alt" type="string"/>
    158      <rule attr="title" type="string"/>
    159    </ruleset>
    160 
    161    <ruleset id="HTMLTable">
    162      <ruleset ref="ARIA"/>
    163      <rule elm="caption"/>
    164      <rule attr="summary" type="string"/>
    165      <rule attr="title" type="string"/>
    166    </ruleset>
    167  </ruledfn>
    168 
    169  <rulesample>
    170 
    171    <markup id="HTMLButtonTest"
    172            ref="html:button" ruleset="HTMLControl">
    173      <html:span id="l1" textequiv="test2">test2</html:span>
    174      <html:span id="l2" textequiv="test3">test3</html:span>
    175      <html:label for="btn" textequiv="test4">test4</html:label>
    176      <html:button id="btn"
    177                   aria-label="test1"
    178                   aria-labelledby="l1 l2"
    179                   title="test5"
    180                   textequiv="press me">press me</html:button>
    181    </markup>
    182 
    183    <markup id="HTMLInputButtonTest"
    184            ref="html:input" ruleset="HTMLInputButton">
    185      <html:span id="l1" textequiv="test2">test2</html:span>
    186      <html:span id="l2" textequiv="test3">test3</html:span>
    187      <html:label for="btn" textequiv="test4">test4</html:label>
    188      <html:input id="btn"
    189                  type="button"
    190                  aria-label="test1"
    191                  aria-labelledby="l1 l2"
    192                  value="name from value"
    193                  alt="no name from al"
    194                  src="no name from src"
    195                  data="no name from data"
    196                  title="name from title"/>
    197    </markup>
    198 
    199    <markup id="HTMLInputSubmitTest"
    200            ref="html:input" ruleset="HTMLInputSubmit">
    201      <html:span id="l1" textequiv="test2">test2</html:span>
    202      <html:span id="l2" textequiv="test3">test3</html:span>
    203      <html:label for="btn-submit" textequiv="test4">test4</html:label>
    204      <html:input id="btn-submit"
    205                  type="submit"
    206                  aria-label="test1"
    207                  aria-labelledby="l1 l2"
    208                  value="name from value"
    209                  alt="no name from atl"
    210                  src="no name from src"
    211                  data="no name from data"
    212                  title="no name from title"/>
    213    </markup>
    214 
    215    <markup id="HTMLInputResetTest"
    216            ref="html:input" ruleset="HTMLInputReset">
    217      <html:span id="l1" textequiv="test2">test2</html:span>
    218      <html:span id="l2" textequiv="test3">test3</html:span>
    219      <html:label for="btn-reset" textequiv="test4">test4</html:label>
    220      <html:input id="btn-reset"
    221                  type="reset"
    222                  aria-label="test1"
    223                  aria-labelledby="l1 l2"
    224                  value="name from value"
    225                  alt="no name from alt"
    226                  src="no name from src"
    227                  data="no name from data"
    228                  title="no name from title"/>
    229    </markup>
    230 
    231    <!--
    232      Disabled due to intermittent failures (bug 1436323) which became more
    233      frequent due to the landing of bug 1383682. The latter bug made loading
    234      of images from cache much more consistent, which appears to have impacted
    235      the timing for this test case. If the image is switched to a unique
    236      image (e.g. always decoding since there is no cache), the failure rate
    237      increases, presumably because the test is dependent on a specific ordering
    238      of events, and implicitly assumes the image is loaded immediately.
    239    -->
    240 
    241    <!--
    242    <markup id="HTMLInputImageTest"
    243            ref="html:input" ruleset="HTMLInputImage">
    244      <html:span id="l1" textequiv="test2">test2</html:span>
    245      <html:span id="l2" textequiv="test3">test3</html:span>
    246      <html:label for="btn-image" textequiv="test4">test4</html:label>
    247      <html:input id="btn-image"
    248                  type="image"
    249                  aria-label="test1"
    250                  aria-labelledby="l1 l2"
    251                  alt="name from alt"
    252                  value="name from value"
    253                  src="../moz.png"
    254                  data="no name from data"
    255                  title="name from title"/>
    256    </markup>
    257    -->
    258 
    259    <markup id="HTMLInputImageNoValidSrcTest"
    260            ref="html:input" ruleset="HTMLInputImageNoValidSrc">
    261      <html:span id="l1" textequiv="test2">test2</html:span>
    262      <html:span id="l2" textequiv="test3">test3</html:span>
    263      <html:label for="btn-image" textequiv="test4">test4</html:label>
    264      <html:input id="btn-image"
    265                  type="image"
    266                  aria-label="test1"
    267                  aria-labelledby="l1 l2"
    268                  alt="name from alt"
    269                  value="name from value"
    270                  data="no name from data"
    271                  title="no name from title"/>
    272    </markup>
    273 
    274    <markup id="HTMLOptionTest"
    275            ref="html:select/html:option[1]" ruleset="HTMLOption">
    276      <html:span id="l1" textequiv="test2">test2</html:span>
    277      <html:span id="l2" textequiv="test3">test3</html:span>
    278      <html:select>
    279        <html:option id="opt"
    280                     aria-label="test1"
    281                     aria-labelledby="l1 l2"
    282                     label="test4"
    283                     title="test5"
    284                     textequiv="option1">option1</html:option>
    285        <html:option>option2</html:option>
    286      </html:select>
    287    </markup>
    288 
    289    <markup id="HTMLImageTest"
    290            ref="html:img" ruleset="HTMLImg">
    291      <html:span id="l1" textequiv="test2">test2</html:span>
    292      <html:span id="l2" textequiv="test3">test3</html:span>
    293      <html:img id="img"
    294                aria-label="Logo of Mozilla"
    295                aria-labelledby="l1 l2"
    296                alt="Mozilla logo"
    297                title="This is a logo"
    298                src="../moz.png"/>
    299    </markup>
    300 
    301    <markup id="HTMLTdTest"
    302            ref="html:table/html:tr/html:td" ruleset="HTMLCell">
    303      <html:span id="l1" textequiv="test2">test2</html:span>
    304      <html:span id="l2" textequiv="test3">test3</html:span>
    305      <html:label for="tc" textequiv="test4">test4</html:label>
    306      <html:table>
    307        <html:tr>
    308          <html:td id="tc"
    309                   aria-label="test1"
    310                   aria-labelledby="l1 l2"
    311                   title="test5"
    312                   textequiv="This is a paragraph This is a link • This is a list">
    313            <html:p>This is a paragraph</html:p>
    314            <html:a href="#">This is a link</html:a>
    315            <html:ul>
    316              <html:li>This is a list</html:li>
    317            </html:ul>
    318          </html:td>
    319        </html:tr>
    320      </html:table>
    321    </markup>
    322 
    323    <markup id="HTMLTdARIAGridCellTest"
    324            ref="html:table/html:tr/html:td" ruleset="HTMLCell">
    325      <html:span id="l1" textequiv="test2">test2</html:span>
    326      <html:span id="l2" textequiv="test3">test3</html:span>
    327      <html:label for="gc" textequiv="test4">test4</html:label>
    328      <html:table>
    329        <html:tr>
    330          <html:td id="gc"
    331                   role="gridcell"
    332                   aria-label="test1"
    333                   aria-labelledby="l1 l2"
    334                   textequiv="This is a paragraph This is a link • Listitem1 • Listitem2"
    335                   title="This is a paragraph This is a link This is a list">
    336            <html:p>This is a paragraph</html:p>
    337            <html:a href="#">This is a link</html:a>
    338            <html:ul>
    339              <html:li>Listitem1</html:li>
    340              <html:li>Listitem2</html:li>
    341            </html:ul>
    342          </html:td>
    343        </html:tr>
    344      </html:table>
    345    </markup>
    346 
    347    <markup id="HTMLTableTest"
    348            ref="html:table" ruleset="HTMLTable">
    349      <html:span id="l1" textequiv="lby_tst6_1">lby_tst6_1</html:span>
    350      <html:span id="l2" textequiv="lby_tst6_2">lby_tst6_2</html:span>
    351      <html:label for="t" textequiv="label_tst6">label_tst6</html:label>
    352      <!-- layout frame are recreated due to varous reasons, here's text frame
    353          placed after caption frame triggres table frame recreation when
    354          caption element is removed from DOM; get rid text node after caption
    355          node to make the test working -->
    356      <html:table id="t" aria-label="arialabel_tst6"
    357                  aria-labelledby="l1 l2"
    358                  summary="summary_tst6"
    359                  title="title_tst6">
    360        <html:caption textequiv="caption_tst6">caption_tst6</html:caption><html:tr>
    361          <html:td>cell1</html:td>
    362          <html:td>cell2</html:td>
    363        </html:tr>
    364      </html:table>
    365    </markup>
    366 
    367  </rulesample>
    368 </rules>