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

Side by Side Diff: LayoutTests/editing/style/script-tests/push-down-font-styles.js

Issue 7973008: Revert 93001 - Apple-style-span class seems unnecessary (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/874/
Patch Set: Created 9 years, 3 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
OLDNEW
1 description('Test to make sure we push down inline styles properly.'); 1 description('Test to make sure we push down inline styles properly.');
2 2
3 var testContainer = document.createElement("div"); 3 var testContainer = document.createElement("div");
4 testContainer.contentEditable = true; 4 testContainer.contentEditable = true;
5 document.body.appendChild(testContainer); 5 document.body.appendChild(testContainer);
6 6
7 var styleWithCSS = false; 7 var styleWithCSS = false;
8 8
9 function testSingleToggle(toggleCommand, value, selector, initialContents, expec tedContents) 9 function testSingleToggle(toggleCommand, value, selector, initialContents, expec tedContents)
10 { 10 {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 function selectLastTwoWords(container) { 45 function selectLastTwoWords(container) {
46 window.getSelection().setPosition(container, container.childNodes.length); 46 window.getSelection().setPosition(container, container.childNodes.length);
47 window.getSelection().modify('extend', 'backward', 'word'); 47 window.getSelection().modify('extend', 'backward', 'word');
48 window.getSelection().modify('extend', 'backward', 'word'); 48 window.getSelection().modify('extend', 'backward', 'word');
49 return 'last two words'; 49 return 'last two words';
50 } 50 }
51 51
52 52
53 debug("Font size"); 53 debug("Font size");
54 styleWithCSS = false; 54 styleWithCSS = false;
55 testSingleToggle("fontsize", 2, selectAll, 'hello world', '<font size="2">hello world</font>'); 55 testSingleToggle("fontsize", 2, selectAll, 'hello world', '<font class="Apple-st yle-span" size="2">hello world</font>');
56 testSingleToggle("fontsize", 4, selectAll, 'hello world', '<font size="4">hello world</font>'); 56 testSingleToggle("fontsize", 4, selectAll, 'hello world', '<font class="Apple-st yle-span" size="4">hello world</font>');
57 testSingleToggle("fontsize", 5, selectFirstWord, 'hello world', '<font size="5"> hello</font> world'); 57 testSingleToggle("fontsize", 5, selectFirstWord, 'hello world', '<font class="Ap ple-style-span" size="5">hello</font> world');
58 testSingleToggle("fontsize", 3, selectFirstWord, '<font size="7">hello <div>worl d</div></font>', 'hello <div style="font-size: -webkit-xxx-large; ">world</div>' ); 58 testSingleToggle("fontsize", 3, selectFirstWord, '<font size="7">hello <div>worl d</div></font>', 'hello <div style="font-size: -webkit-xxx-large; ">world</div>' );
59 testSingleToggle("fontsize", 3, selectFirstWord, '<font size="7"><div>hello</div ><div>world</div></font>', '<div>hello</div><div style="font-size: -webkit-xxx-l arge; ">world</div>'); 59 testSingleToggle("fontsize", 3, selectFirstWord, '<font size="7"><div>hello</div ><div>world</div></font>', '<div>hello</div><div style="font-size: -webkit-xxx-l arge; ">world</div>');
60 testSingleToggle("fontsize", 3, selectSecondWord, '<font size="7"><div>hello</di v>world</font>', '<div style="font-size: -webkit-xxx-large; ">hello</div>world') ; 60 testSingleToggle("fontsize", 3, selectSecondWord, '<font size="7"><div>hello</di v>world</font>', '<div style="font-size: -webkit-xxx-large; ">hello</div>world') ;
61 61
62 testSingleToggle("fontsize", 7, selectAll, '<font size="7"><div>hello</div>world </font>', '<font size="7"><div>hello</div>world</font>'); 62 testSingleToggle("fontsize", 7, selectAll, '<font size="7"><div>hello</div>world </font>', '<font size="7"><div>hello</div>world</font>');
63 testSingleToggle("fontsize", 7, selectAll, '<font size="3"><div>hello</div>world </font>', '<div><font size="7">hello</font></div><font size="7">world</font>'); 63 testSingleToggle("fontsize", 7, selectAll, '<font size="3"><div>hello</div>world </font>', '<div><font class="Apple-style-span" size="7">hello</font></div><font class="Apple-style-span" size="7">world</font>');
64 testSingleToggle("fontsize", 6, selectAll, '<font size="7"><div>hello</div>world </font>', '<div><font size="6">hello</font></div><font size="6">world</font>'); 64 testSingleToggle("fontsize", 6, selectAll, '<font size="7"><div>hello</div>world </font>', '<div><font class="Apple-style-span" size="6">hello</font></div><font class="Apple-style-span" size="6">world</font>');
65 testSingleToggle("fontsize", 5, selectAll, '<font size="7"><div>hello</div>world </font>', '<div><font size="5">hello</font></div><font size="5">world</font>'); 65 testSingleToggle("fontsize", 5, selectAll, '<font size="7"><div>hello</div>world </font>', '<div><font class="Apple-style-span" size="5">hello</font></div><font class="Apple-style-span" size="5">world</font>');
66 testSingleToggle("fontsize", 3, selectAll, '<font size="7"><div>hello</div>world </font>', '<div>hello</div>world'); 66 testSingleToggle("fontsize", 3, selectAll, '<font size="7"><div>hello</div>world </font>', '<div>hello</div>world');
67 testSingleToggle("fontsize", 3, selectAll, '<font size="3"><div>hello</div>world </font>', '<font size="3"><div>hello</div>world</font>'); 67 testSingleToggle("fontsize", 3, selectAll, '<font size="3"><div>hello</div>world </font>', '<font size="3"><div>hello</div>world</font>');
68 testSingleToggle("fontsize", 1, selectAll, '<font size="3"><div>hello</div>world </font>', '<div><font size="1">hello</font></div><font size="1">world</font>'); 68 testSingleToggle("fontsize", 1, selectAll, '<font size="3"><div>hello</div>world </font>', '<div><font class="Apple-style-span" size="1">hello</font></div><font class="Apple-style-span" size="1">world</font>');
69 69
70 debug(""); 70 debug("");
71 debug("Font size (with CSS)"); 71 debug("Font size (with CSS)");
72 styleWithCSS = true; 72 styleWithCSS = true;
73 testSingleToggle("fontsize", 7, selectAll, '<font size="7"><div>hello</div>world </font>', '<font size="7"><div>hello</div>world</font>'); 73 testSingleToggle("fontsize", 7, selectAll, '<font size="7"><div>hello</div>world </font>', '<font size="7"><div>hello</div>world</font>');
74 testSingleToggle("fontsize", 7, selectAll, '<font size="3"><div>hello</div>world </font>', '<div><span style="font-size: -webkit-xxx-large;">hello</span></div><s pan style="font-size: -webkit-xxx-large;">world</span>'); 74 testSingleToggle("fontsize", 7, selectAll, '<font size="3"><div>hello</div>world </font>', '<div><span class="Apple-style-span" style="font-size: -webkit-xxx-lar ge;">hello</span></div><span class="Apple-style-span" style="font-size: -webkit- xxx-large;">world</span>');
75 testSingleToggle("fontsize", 6, selectAll, '<font size="7"><div>hello</div>world </font>', '<div><span style="font-size: xx-large;">hello</span></div><span style ="font-size: xx-large;">world</span>'); 75 testSingleToggle("fontsize", 6, selectAll, '<font size="7"><div>hello</div>world </font>', '<div><span class="Apple-style-span" style="font-size: xx-large;">hell o</span></div><span class="Apple-style-span" style="font-size: xx-large;">world< /span>');
76 testSingleToggle("fontsize", 5, selectAll, '<font size="7"><div>hello</div>world </font>', '<div><span style="font-size: x-large;">hello</span></div><span style= "font-size: x-large;">world</span>'); 76 testSingleToggle("fontsize", 5, selectAll, '<font size="7"><div>hello</div>world </font>', '<div><span class="Apple-style-span" style="font-size: x-large;">hello </span></div><span class="Apple-style-span" style="font-size: x-large;">world</s pan>');
77 testSingleToggle("fontsize", 3, selectAll, '<font size="7"><div>hello</div>world </font>', '<div>hello</div>world'); 77 testSingleToggle("fontsize", 3, selectAll, '<font size="7"><div>hello</div>world </font>', '<div>hello</div>world');
78 testSingleToggle("fontsize", 3, selectAll, '<font size="3"><div>hello</div>world </font>', '<font size="3"><div>hello</div>world</font>'); 78 testSingleToggle("fontsize", 3, selectAll, '<font size="3"><div>hello</div>world </font>', '<font size="3"><div>hello</div>world</font>');
79 testSingleToggle("fontsize", 1, selectAll, '<font size="3"><div>hello</div>world </font>', '<div><span style="font-size: x-small;">hello</span></div><span style= "font-size: x-small;">world</span>'); 79 testSingleToggle("fontsize", 1, selectAll, '<font size="3"><div>hello</div>world </font>', '<div><span class="Apple-style-span" style="font-size: x-small;">hello </span></div><span class="Apple-style-span" style="font-size: x-small;">world</s pan>');
80 80
81 debug(""); 81 debug("");
82 debug("Font family"); 82 debug("Font family");
83 styleWithCSS = false; 83 styleWithCSS = false;
84 testSingleToggle("fontname", "Arial", selectAll, 'hello world', '<font face="Ari al">hello world</font>'); 84 testSingleToggle("fontname", "Arial", selectAll, 'hello world', '<font class="Ap ple-style-span" face="Arial">hello world</font>');
85 testSingleToggle("fontname", "Arial", selectFirstWord, '<font face="sans-serif"> hello world</font>', '<font face="Arial">hello</font><font face="sans-serif"> wo rld</font>'); 85 testSingleToggle("fontname", "Arial", selectFirstWord, '<font face="sans-serif"> hello world</font>', '<font class="Apple-style-span" face="Arial">hello</font><f ont face="sans-serif"> world</font>');
86 testSingleToggle("fontname", "Arial", selectFirstWord, '<font face="sans-serif"> hello<div>world</div></font>', '<font face="Arial">hello</font><div style="font- family: sans-serif; ">world</div>'); 86 testSingleToggle("fontname", "Arial", selectFirstWord, '<font face="sans-serif"> hello<div>world</div></font>', '<font class="Apple-style-span" face="Arial">hell o</font><div style="font-family: sans-serif; ">world</div>');
87 testSingleToggle("fontname", "Arial", selectSecondWord, '<font face="sans-serif" >hello<div>world</div></font>', '<font face="sans-serif">hello</font><div><font face="Arial">world</font></div>'); 87 testSingleToggle("fontname", "Arial", selectSecondWord, '<font face="sans-serif" >hello<div>world</div></font>', '<font class="Apple-style-span" face="sans-serif ">hello</font><div><font class="Apple-style-span" face="Arial">world</font></div >');
88 testSingleToggle("fontname", "Sans-Serif", selectAll, '<font face="sans-serif">< div>hello</div><div>world</div></font>', '<font face="sans-serif"><div>hello</di v><div>world</div></font>'); 88 testSingleToggle("fontname", "Sans-Serif", selectAll, '<font face="sans-serif">< div>hello</div><div>world</div></font>', '<font face="sans-serif"><div>hello</di v><div>world</div></font>');
89 testSingleToggle("fontname", "Arial", selectAll, '<font face="sans-serif"><div>h ello</div><div>world</div></font>', '<div><font face="Arial">hello</font></div>< div><font face="Arial">world</font></div>'); 89 testSingleToggle("fontname", "Arial", selectAll, '<font face="sans-serif"><div>h ello</div><div>world</div></font>', '<div><font class="Apple-style-span" face="A rial">hello</font></div><div><font class="Apple-style-span" face="Arial">world</ font></div>');
90 90
91 debug(""); 91 debug("");
92 debug("Font family (with CSS)"); 92 debug("Font family (with CSS)");
93 styleWithCSS = true; 93 styleWithCSS = true;
94 testSingleToggle("fontname", "Arial", selectAll, 'hello world', '<span style="fo nt-family: Arial;">hello world</span>'); 94 testSingleToggle("fontname", "Arial", selectAll, 'hello world', '<span class="Ap ple-style-span" style="font-family: Arial;">hello world</span>');
95 testSingleToggle("fontname", "Arial", selectFirstWord, '<font face="sans-serif"> hello world</font>', '<span style="font-family: Arial;">hello</span><font face=" sans-serif"> world</font>'); 95 testSingleToggle("fontname", "Arial", selectFirstWord, '<font face="sans-serif"> hello world</font>', '<span class="Apple-style-span" style="font-family: Arial;" >hello</span><font face="sans-serif"> world</font>');
96 testSingleToggle("fontname", "Arial", selectFirstWord, '<font face="sans-serif"> hello<div>world</div></font>', '<span style="font-family: Arial;">hello</span><d iv style="font-family: sans-serif; ">world</div>'); 96 testSingleToggle("fontname", "Arial", selectFirstWord, '<font face="sans-serif"> hello<div>world</div></font>', '<span class="Apple-style-span" style="font-famil y: Arial;">hello</span><div style="font-family: sans-serif; ">world</div>');
97 testSingleToggle("fontname", "Arial", selectSecondWord, '<font face="sans-serif" >hello<div>world</div></font>', '<span style="font-family: sans-serif;">hello</s pan><div><span style="font-family: Arial;">world</span></div>'); 97 testSingleToggle("fontname", "Arial", selectSecondWord, '<font face="sans-serif" >hello<div>world</div></font>', '<span class="Apple-style-span" style="font-fami ly: sans-serif;">hello</span><div><span class="Apple-style-span" style="font-fam ily: Arial;">world</span></div>');
98 testSingleToggle("fontname", "Sans-Serif", selectAll, '<font face="sans-serif">< div>hello</div><div>world</div></font>', '<font face="sans-serif"><div>hello</di v><div>world</div></font>'); 98 testSingleToggle("fontname", "Sans-Serif", selectAll, '<font face="sans-serif">< div>hello</div><div>world</div></font>', '<font face="sans-serif"><div>hello</di v><div>world</div></font>');
99 testSingleToggle("fontname", "Arial", selectAll, '<font face="sans-serif"><div>h ello</div><div>world</div></font>', '<div><span style="font-family: Arial;">hell o</span></div><div><span style="font-family: Arial;">world</span></div>'); 99 testSingleToggle("fontname", "Arial", selectAll, '<font face="sans-serif"><div>h ello</div><div>world</div></font>', '<div><span class="Apple-style-span" style=" font-family: Arial;">hello</span></div><div><span class="Apple-style-span" style ="font-family: Arial;">world</span></div>');
100 100
101 document.body.removeChild(testContainer); 101 document.body.removeChild(testContainer);
102 102
103 var successfullyParsed = true; 103 var successfullyParsed = true;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698