| <html> |
| <head> |
| <title>Line breaks after empty inline - Hebrew</title> |
| </head> |
| <body> |
| <meta charset=utf-8> |
| <div> |
| The following two paragraphs should have the same line breaks: |
| </div> |
| <div style="width: 40px; font-family: raanana;"> |
| <p style="border:solid green 1px;">אבג דהו זחט</p> |
| <p style="border:solid green 1px;">אבג <span></span> דהו זחט</p> |
| </div> |
| <div><pre id=results></pre></div> |
| <script> |
| if (window.testRunner) |
| testRunner.dumpAsText(); |
| |
| function getLineWidths(paragraphNumber) { |
| var range = document.createRange(); |
| var paragraphs = document.getElementsByTagName("p"); |
| var p = paragraphs[paragraphNumber]; |
| range.setStart(p, 0); |
| range.setEnd(p,p.childNodes.length); |
| var rects = range.getClientRects(); |
| var widths = []; |
| for (var i = 0; i < rects.length; ++i) { |
| var r = rects[i]; |
| if (r.width != 0) |
| widths.push(r.width); |
| } |
| return widths; |
| } |
| |
| var widths1 = getLineWidths(0); |
| var widths2 = getLineWidths(1); |
| var results = ''; |
| if (widths1.length != widths2.length) |
| results += 'FAIL: different number of lines, got ' + widths2.length + ', expected ' + widths1.length; |
| else { |
| for (var i = 0; i < widths1.length; ++i) { |
| if (widths2[i] != widths1[i]) { |
| if (results.length) |
| results += '\n' |
| results += 'FAIL: line[' + i + '] width differs, got ' + widths2[i] + ', expected ' + widths1[i]; |
| } |
| } |
| } |
| if (!results.length) |
| results = 'PASS'; |
| document.getElementById("results").innerText = results; |
| |
| </script> |
| </body> |
| </html> |