Simplify login in getW and handle IE7 problem with initial space in the span

This commit is contained in:
Davide P. Cervone 2011-09-06 08:52:31 -04:00
parent 66be7cd2f7
commit 17f03acbbe
6 changed files with 22 additions and 27 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -611,27 +611,22 @@
return HD;
},
getW: function (span) {
var W, H, w, start;
var W, H, w = (span.bbox||{w:0}).w, start = span;
if (span.bbox && span.bbox.exactW) {return span.bbox.w}
if (this.negativeBBoxes) {W = span.offsetWidth; H = span.parentNode.offsetHeight}
if ((w > 0 && !this.negativeSkipBug) || this.negativeBBoxes) {W = span.offsetWidth; H = span.parentNode.offsetHeight}
else if (w < 0 && this.msieNegativeBBoxBug) {W = -span.offsetWidth, H = span.parentNode.offsetHeight}
else {
w = (span.bbox||{w:0}).w; start = span;
if (w < 0 && this.msieNegativeBBoxBug) {W = -span.offsetWidth, H = span.parentNode.offsetHeight}
else if (w > 0) {W = span.offsetWidth; H = span.parentNode.offsetHeight}
else {
// IE can't deal with a space at the beginning, so put something else first
if (this.negativeSkipBug) {
var position = span.style.position; span.style.position = "absolute";
start = this.startMarker;
if (span.firstChild) {span.insertBefore(start,span.firstChild)}
else {span.appendChild(start)}
start = this.startMarker;
}
span.appendChild(this.endMarker);
W = this.endMarker.offsetLeft - start.offsetLeft;
span.removeChild(this.endMarker);
if (this.negativeSkipBug) {span.removeChild(start); span.style.position = position}
// IE can't deal with a space at the beginning, so put something else first
if (this.negativeSkipBug) {
var position = span.style.position; span.style.position = "absolute";
start = this.startMarker;
if (span.firstChild) {span.insertBefore(start,span.firstChild)} else {span.appendChild(start)}
start = this.startMarker;
}
span.appendChild(this.endMarker);
W = this.endMarker.offsetLeft - start.offsetLeft;
span.removeChild(this.endMarker);
if (this.negativeSkipBug) {span.removeChild(start); span.style.position = position}
}
if (H != null) {span.parentNode.HH = H/this.em}
return W/this.em;