tor-browser

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

css-text-line-break-de-in-normal.html (2751B)


      1 <!DOCTYPE html>
      2 <html  lang="en" >
      3 <head>
      4 <meta charset="utf-8"/>
      5 <title>CSS text, linebreaks: IN (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 NOT allow a break before an inseparable character.">
     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 = `2024  ONE DOT LEADER
     25 2025  TWO DOT LEADER
     26 2026  HORIZONTAL ELLIPSIS
     27 22EF  MIDLINE HORIZONTAL ELLIPSIS
     28 FE19  PRESENTATION FORM FOR VERTICAL HORIZONTAL ELLIPSIS`
     29 </script>
     30 </head>
     31 <body>
     32 <script>
     33 var lines = charlist.split('\n')
     34 var out = '<div id="log"></div>\n'
     35 for (var i=0;i<lines.length;i++) {
     36 // get the data
     37 var firstSpace = lines[i].indexOf(' ')
     38 var hex = lines[i].substr(0,firstSpace)
     39 var name = lines[i].substr(firstSpace)
     40 // make a test
     41 out +=  '<div class="wrapper"><div>'+hex+'</div>' +
     42 '<div class="test" id="test'+i+'" lang="de">文文文文文文&#x'+hex+';字<span id="testSpan'+i+'">字</span></div>' +
     43  '<div class="ref" id="ref'+i+'" lang="de">文文文文文<br/>文&#x'+hex+';字<span id="refSpan'+i+'">字</span></div>' +
     44  '</div>'
     45 }
     46 
     47 document.querySelector('body').innerHTML = out
     48 setup({explicit_done: true});
     49 
     50 document.fonts.ready.then(validate);
     51 
     52 function validate() {
     53  for (i=0;i<lines.length;i++) {
     54    test(function() {
     55      assert_approx_equals(
     56        document.getElementById('testSpan'+i).getBoundingClientRect().left,
     57        document.getElementById('refSpan'+i).getBoundingClientRect().left, 1);
     58      // Hide successful tests.
     59      document.getElementById('test'+i).parentNode.style.display = 'none';
     60    }, lines[i]+' may NOT appear at line start if de and normal');
     61  }
     62  done();
     63 }
     64 </script>
     65 <!--Notes:
     66 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.
     67 
     68 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.
     69 -->
     70 </body>
     71 </html>