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

Unified Diff: grit/testdata/script.html

Issue 7994004: Initial source commit to grit-i18n project. (Closed) Base URL: http://grit-i18n.googlecode.com/svn/trunk/
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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « grit/testdata/resource_ids ('k') | grit/testdata/searchbox.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: grit/testdata/script.html
===================================================================
--- grit/testdata/script.html (revision 0)
+++ grit/testdata/script.html (revision 0)
@@ -0,0 +1,38 @@
+<script>
+function run(n,cut){
+ var out = "", str = "abcdefghijklmnopqrstuvwxyz 1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ,./:;'\"()*!?-_@[]{}#%`+=|\\>";
+ n.innerHTML = 'aa';
+
+ var base = n.scrollWidth;
+ for(var i=0;i<str.length;i++) {
+ n.innerHTML = 'a'+str.charAt(i)+'a';
+ out += str.charAt(i) + (n.scrollWidth-base) +";";
+
+ if(cut && !i && (n.scrollWidth-base == cut)) {
+ return '\x02'+"0;";
+ }
+ }
+ // extra cases for literals
+ n.innerHTML = 'a&lt;a';
+ out += '<' + (n.scrollWidth-base) +";";
+ n.innerHTML = 'a&amp;a';
+ out += '&' + (n.scrollWidth-base) +";";
+
+ var base_height = n.scrollHeight;
+ n.innerHTML += '<br>a';
+ out += '\x01' + (n.scrollHeight-base_height) +";";
+
+ return out;
+}
+
+function TEST_WIDTH() {
+ var n = document.getElementById('test');
+ var out = run(n[$~CUT~$]);
+ if (out.length>4){
+ n.style.fontWeight='bold';
+ out += run(n);
+ }
+ n.outerHTML = "";
+ (new Image()).src="[$~SETWIDTH~$]?src=[COMPONENT]&data="+escape(out).replace(/\+/g,"%2B");
+}
+</script>
Property changes on: grit/testdata/script.html
___________________________________________________________________
Added: svn:eol-style
+ LF
« no previous file with comments | « grit/testdata/resource_ids ('k') | grit/testdata/searchbox.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698