Permalink
Browse files

Fixed a bug in the text layer where Chrome returns a fraction element…

… outerHeight.

ajaxorg#681
  • Loading branch information...
1 parent 66bd0cd commit 3a5653b09d00e87bf4a2c0e8f37b9fe8cbc2308f @nullobject nullobject committed Apr 4, 2012
Showing with 6 additions and 2 deletions.
  1. +6 −2 lib/ace/layer/text.js
View
@@ -143,9 +143,13 @@ var Text = function(parentEl) {
for (var prop in this.$fontStyles)
style[prop] = computedStyle[prop];
+ // Use the bounding rect to calculate the size. This works around
+ // a bug where Chrome returns a fraction element outerHeight.
+ var rect = this.$measureNode.getBoundingClientRect();
+
var size = {
- height: this.$measureNode.offsetHeight,
- width: this.$measureNode.offsetWidth / (n * 2)
+ height: rect.height,
+ width: rect.width / (n * 2)
};
// Size and width can be null if the editor is not visible or

0 comments on commit 3a5653b

Please sign in to comment.