Index: components/dom_distiller/content/resources/dom_distiller_viewer.js |
diff --git a/components/dom_distiller/content/resources/dom_distiller_viewer.js b/components/dom_distiller/content/resources/dom_distiller_viewer.js |
index 94299467ef3df0b6ffa129f1ee149d008e58eec8..9a86239f45240be793e8317725e97bf7ef747578 100644 |
--- a/components/dom_distiller/content/resources/dom_distiller_viewer.js |
+++ b/components/dom_distiller/content/resources/dom_distiller_viewer.js |
@@ -13,6 +13,24 @@ function showLoadingIndicator(isLastPage) { |
isLastPage ? 'hidden' : 'visible'; |
} |
+// Maps JS Font Family to CSS class and then changes body class name. |
+// CSS classes must agree with distilledpage.css. |
+function useFontFamily(fontFamily) { |
+ var cssClass; |
+ if (fontFamily == "serif") { |
+ cssClass = "serif"; |
+ } else if (fontFamily == "monospace") { |
+ cssClass = "monospace"; |
+ } else { |
+ cssClass = "sans-serif"; |
+ } |
+ // Relies on the classname order of the body being Theme class, then Font |
Yaron
2014/08/13 01:58:47
Hrmm. This seems a little fragile (this is a share
nyquist
2014/08/13 05:44:31
I was discussing this offline with sunangel@ befor
Yaron
2014/08/13 16:49:29
Agreed that the latter approach is better but what
|
+ // Family class. |
+ var themeClass = document.body.className.split(" ")[0]; |
+ cssClass = themeClass + " " + cssClass; |
Yaron
2014/08/13 01:58:47
No need for intermediate assignment. Just do it be
sunangel
2014/08/13 18:09:04
Done.
|
+ document.body.className = cssClass; |
+} |
+ |
// Maps JS theme to CSS class and then changes body class name. |
// CSS classes must agree with distilledpage.css. |
function useTheme(theme) { |
@@ -24,5 +42,9 @@ function useTheme(theme) { |
} else { |
cssClass = "light"; |
} |
+ // Relies on the classname order of the body being Theme class, then Font |
+ // Family class. |
+ var fontFamilyClass = document.body.className.split(" ")[1]; |
+ cssClass = cssClass + " " + fontFamilyClass; |
document.body.className = cssClass; |
} |