summaryrefslogtreecommitdiffstats
path: root/chrome/third_party/jstemplate/jstemplate.js
diff options
context:
space:
mode:
authorjungshik@google.com <jungshik@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-03 21:30:51 +0000
committerjungshik@google.com <jungshik@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-03 21:30:51 +0000
commit243ed6775d053407531a16ce1bf986f1df697f62 (patch)
tree5d8b46fa35fcf4c2dcf65652488fc914a4235ecf /chrome/third_party/jstemplate/jstemplate.js
parent1c370c041ab3333d091efdfbbc814853934d574d (diff)
downloadchromium_src-243ed6775d053407531a16ce1bf986f1df697f62.zip
chromium_src-243ed6775d053407531a16ce1bf986f1df697f62.tar.gz
chromium_src-243ed6775d053407531a16ce1bf986f1df697f62.tar.bz2
Make the font family and the font size used in dom UI localizable. This is a part 1 of the fix for bug 7319 and will be followed by part 2 for non-DOM UI.
For some Indian languages (Malayalam, Bengali and Telugu), we have to use a bigger size and a font family for that script on Windows. This is because Windows' stock fonts for those scripts are smaller than fonts for other scripts at a given size. I removed 'WEB' style in chrome_font.h because it's not used anywhere any more after our switch to the html UI. In addition, IDS_WEB_FONT_FAMILY is recycled to localize the font family (or the list of font families) for html UI. I also back-ported the support for setting 'style.fooBar' property to our copy of Jstemplate (JstProcessor.prototype.jstValues_). BUG=7319 Review URL: http://codereview.chromium.org/57025 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13114 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/third_party/jstemplate/jstemplate.js')
-rw-r--r--chrome/third_party/jstemplate/jstemplate.js21
1 files changed, 17 insertions, 4 deletions
diff --git a/chrome/third_party/jstemplate/jstemplate.js b/chrome/third_party/jstemplate/jstemplate.js
index 8ed7d02..abefae1 100644
--- a/chrome/third_party/jstemplate/jstemplate.js
+++ b/chrome/third_party/jstemplate/jstemplate.js
@@ -528,10 +528,23 @@ JstProcessor.prototype.jstValues_ = function(context, template, valuesStr) {
context.setVariable(label, value);
} else if (label.charAt(0) == '.') {
- // A jsvalues entry whose name starts with . sets a property
- // of the current template node.
- template[label.substr(1)] = value;
-
+ // A jsvalues entry whose name starts with . sets a property of
+ // the current template node. The name may have further dot
+ // separated components, which are translated into namespace
+ // objects. This specifically allows to set properties on .style
+ // using jsvalues. NOTE(mesch): Setting the style attribute has
+ // no effect in IE and hence should not be done anyway.
+ var nameSpaceLabel = label.substr(1).split('.');
+ var nameSpaceObject = template;
+ var nameSpaceDepth = jsLength(nameSpaceLabel);
+ for (var j = 0, J = nameSpaceDepth - 1; j < J; ++j) {
+ var jLabel = nameSpaceLabel[j];
+ if (!nameSpaceObject[jLabel]) {
+ nameSpaceObject[jLabel] = {};
+ }
+ nameSpaceObject = nameSpaceObject[jLabel];
+ }
+ nameSpaceObject[nameSpaceLabel[nameSpaceDepth - 1]] = value;
} else if (label) {
// Any other jsvalues entry sets an attribute of the current
// template node.