summaryrefslogtreecommitdiff
path: root/webhelper
diff options
context:
space:
mode:
authorPatrick Ward <patrick@endlessm.com>2014-01-17 11:13:01 -0800
committerPatrick Ward <patrick@endlessm.com>2014-01-29 10:27:44 -0800
commitb71ccdd0f0718fdea5da42108afcf194507a84fd (patch)
tree4222bdf940504d407fb05424586ccbe8e03f502a /webhelper
parentb124b623944c574d2325589cd20198d2a79bb993 (diff)
Add publicly available font size property
Added a publicly available calculated font size property. This allows Endless applications to perform actions based on the calculated font size of an EosWindow. In particular, the WebHelper application now uses the property to update the 'default-font-size' property of a WebSettings object. [endlessm/eos-sdk#484]
Diffstat (limited to 'webhelper')
-rw-r--r--webhelper/webhelper.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/webhelper/webhelper.js b/webhelper/webhelper.js
index 32ad4ec..d4f6811 100644
--- a/webhelper/webhelper.js
+++ b/webhelper/webhelper.js
@@ -263,5 +263,28 @@ const Application = new Lang.Class({
"your app?");
element.inner_html = this._translationFunction(element.inner_text);
}
+ },
+
+ /**
+ * Method: set_web_settings_font_resizable
+ * Set an eos_window to update font size of web_settings
+ *
+ * Parameters:
+ * eos_windw - an <Endless.Window>
+ * web_settings - a <WebKit.WebSettings>
+ *
+ * The <Endless.Window> will be connected on its "size-allocate" signal
+ * to the given <WebKit.WebSettings>. The <Endless.Window> will update the
+ * "default-font-size" property of the <WebKit.WebSettings> calculated font size
+ * to the <Endless.Window>'s calculated font size.
+ */
+ set_web_settings_font_resizable: function (eos_window, web_settings) {
+ eos_window.connect('size-allocate',
+ Lang.bind(this, function (widget, allocation) {
+ if (eos_window.font_scaling_active) {
+ web_settings.default_font_size = eos_window.font_scaling_calculated_font_size;
+ }
+ }
+ ));
}
});