mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 964504 - Add Editor.setFontSize/getFontSize. r=msucan
This commit is contained in:
parent
7596d973db
commit
d91df90422
@ -758,6 +758,25 @@ Editor.prototype = {
|
||||
{ line: end.line + 1, ch: end.ch });
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns current font size for the editor area, in pixels.
|
||||
*/
|
||||
getFontSize: function () {
|
||||
let cm = editors.get(this);
|
||||
let el = cm.getWrapperElement();
|
||||
let win = el.ownerDocument.defaultView;
|
||||
|
||||
return parseInt(win.getComputedStyle(el).getPropertyValue("font-size"), 10);
|
||||
},
|
||||
|
||||
/**
|
||||
* Sets font size for the editor area.
|
||||
*/
|
||||
setFontSize: function (size) {
|
||||
let cm = editors.get(this);
|
||||
cm.getWrapperElement().style.fontSize = parseInt(size, 10) + "px";
|
||||
},
|
||||
|
||||
/**
|
||||
* Extends an instance of the Editor object with additional
|
||||
* functions. Each function will be called with context as
|
||||
|
@ -51,6 +51,12 @@ function test() {
|
||||
ed.removeLineClass(0, "test");
|
||||
ok(!ed.hasLineClass(0, "test"), "test line class is gone");
|
||||
|
||||
// Font size
|
||||
let size = ed.getFontSize();
|
||||
is("number", typeof size, "we have the default font size");
|
||||
ed.setFontSize(ed.getFontSize() + 1);
|
||||
is(ed.getFontSize(), size + 1, "new font size was set");
|
||||
|
||||
teardown(ed, win);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user