Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(960)

Side by Side Diff: third_party/WebKit/LayoutTests/fast/text/line-break-ascii.html

Issue 1370203005: Fix line break opportunities between HYPHEN-MINUS and closing punctuation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/text/line-break-ascii-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <style>
3 #break-test {
4 font:50px/1 Ahem;
5 width:3em;
6 }
7 #result {
8 font:15px/1 monospace;
9 white-space:pre;
10 }
11 </style>
12 <div id="result"></div>
13 <div id="break-test"></div>
14 <script>
15 var beginChar = 33;
16 var endChar = 127;
17 var breakTest = document.getElementById("break-test");
18 var breakTestFontsize = parseFloat(getComputedStyle(breakTest).fontSize);
19 var nbsp = String.fromCharCode(0xA0);
20 nbsp = nbsp + nbsp;
21
22 var matrix = getLineBreakMatrix();
23
24 var header = [];
25 for (var i = 0; i < matrix.length; i++)
26 header.push(String.fromCharCode(beginChar + i));
27 var rows = [" " + header.join("")];
28 for (var i = 0; i < matrix.length; i++) {
29 rows.push(String.fromCharCode(beginChar + i) + " " + matrix[i].map(function (canBreak) {
30 return canBreak ? "/" : "X";
31 }).join(""));
32 }
33 result.textContent = rows.join("\n");
34
35 function getLineBreakMatrix() {
36 var matrix = [];
37 for (var last = beginChar; last < endChar; last++) {
38 var canBreakBefore = [];
39 for (var current = beginChar; current < endChar; current++)
40 canBreakBefore.push(canBreakBetween(last, current));
41 matrix.push(canBreakBefore);
42 }
43 return matrix;
44 }
45
46 function canBreakBetween(last, current) {
47 breakTest.textContent = nbsp + String.fromCharCode(last) + String.fromCharCo de(current);
48 return breakTest.offsetHeight / breakTestFontsize > 1.9;
49 }
50
51 breakTest.textContent = "";
52 if (window.testRunner)
53 testRunner.dumpAsText();
54 </script>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/text/line-break-ascii-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698