tor-browser

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

css-text-line-break-de-pr-normal.html (2816B)


      1 <!DOCTYPE html>
      2 <html  lang="en" >
      3 <head>
      4 <meta charset="utf-8"/>
      5 <title>CSS text, linebreaks: PR AFW (normal,de)</title>
      6 <link rel="author" title="Richard Ishida" href="mailto:ishida@w3.org">
      7 <link rel="help" href="https://drafts.csswg.org/css-text-3/#line-break-property">
      8 <script src="/resources/testharness.js"></script>
      9 <script src="/resources/testharnessreport.js"></script>
     10 <meta name="assert" content="When the language is neither Japanese nor Chinese, and line-break:normal, a browser will allow a break before a PR character with East Asian Width of A, F, or W.">
     11 <style type="text/css">
     12 @font-face {
     13    font-family: 'mplus-1p-regular';
     14    src: url('/fonts/mplus-1p-regular.woff') format('woff');
     15    }
     16 #wrapper { position: relative; }
     17 .test { color: red; }
     18 .test, .ref { font-size: 30px; font-family: mplus-1p-regular, sans-serif; width: 185px; padding: 0; border: 1px solid orange; line-height: 1em; }
     19 </style>
     20 <style>
     21 .test { line-break: normal; }
     22 </style>
     23 <script>
     24 var charlist = `00B1  PLUS-MINUS SIGN
     25 20AC  EURO SIGN
     26 2116  NUMERO SIGN
     27 FE69  SMALL DOLLAR SIGN
     28 FF04  FULLWIDTH DOLLAR SIGN
     29 FFE1  FULLWIDTH POUND SIGN
     30 FFE5  FULLWIDTH YEN SIGN
     31 FFE6  FULLWIDTH WON SIGN`
     32 </script>
     33 </head>
     34 <body>
     35 <script>
     36 var lines = charlist.split('\n')
     37 var out = '<div id="log"></div>\n'
     38 for (var i=0;i<lines.length;i++) {
     39 // get the data
     40 var firstSpace = lines[i].indexOf(' ')
     41 var hex = lines[i].substr(0,firstSpace)
     42 var name = lines[i].substr(firstSpace)
     43 // make a test (ID ÷ PR × ID)
     44 out +=  '<div class="wrapper"><div>'+hex+'</div>' +
     45 '<div class="test" id="test'+i+'" lang="de">文文文文文文&#x'+hex+';字<span id="testSpan'+i+'">字</span></div>' +
     46  '<div class="ref" id="ref'+i+'" lang="de">文文文文文文<br/>&#x'+hex+';字<span id="refSpan'+i+'">字</span></div>' +
     47  '</div>'
     48 }
     49 
     50 document.querySelector('body').innerHTML = out
     51 setup({explicit_done: true});
     52 
     53 document.fonts.ready.then(validate);
     54 
     55 function validate() {
     56  for (i=0;i<lines.length;i++) {
     57    test(function() {
     58      assert_approx_equals(
     59        document.getElementById('testSpan'+i).getBoundingClientRect().left,
     60        document.getElementById('refSpan'+i).getBoundingClientRect().left, 1);
     61      // Hide successful tests.
     62      document.getElementById('test'+i).parentNode.style.display = 'none';
     63    }, lines[i]+' may appear at line start if de and normal');
     64  }
     65  done();
     66 }
     67 </script>
     68 <!--Notes:
     69 The test creates a box with room for 6 characters, causing wrapping to occur either between the 6th and the 7th character, or before the 6th if the breaks after the 6th or before the 7th are prohibited.
     70 
     71 It also creates the expected behaviour with a ref instance, using <br/>. Each line ends with a span. The test then checks whether the left edge of the span is in the same place in test and ref instance.
     72 -->
     73 </body>
     74 </html>