Save heights when getting widths (so don't need to do offsetHeight in placeBox, or rely on assumptions)
This commit is contained in:
parent
a97410976e
commit
c1a5ba16a3
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
|
@ -563,12 +563,13 @@
|
||||||
return HD;
|
return HD;
|
||||||
},
|
},
|
||||||
getW: function (span) {
|
getW: function (span) {
|
||||||
var W, w, start;
|
var W, H, w, start;
|
||||||
if (span.bbox && span.bbox.exactW) {return span.bbox.w}
|
if (span.bbox && span.bbox.exactW) {return span.bbox.w}
|
||||||
if (this.negativeBBoxes) {W = span.offsetWidth}
|
if (this.negativeBBoxes) {W = span.offsetWidth; H = span.parentNode.offsetHeight}
|
||||||
else {
|
else {
|
||||||
w = (span.bbox||{w:0}).w; start = span;
|
w = (span.bbox||{w:0}).w; start = span;
|
||||||
if (w < 0 && this.msieNegativeBBoxBug) {W = -span.offsetWidth}
|
if (w < 0 && this.msieNegativeBBoxBug) {W = -span.offsetWidth, H = span.parentNode.offsetHeight}
|
||||||
|
else if (w > 0) {W = span.offseWidth; H = span.parentNode.offsetHeight}
|
||||||
else {
|
else {
|
||||||
// IE can't deal with a space at the beginning, so put something else first
|
// IE can't deal with a space at the beginning, so put something else first
|
||||||
if (this.negativeSkipBug) {
|
if (this.negativeSkipBug) {
|
||||||
|
@ -584,6 +585,7 @@
|
||||||
if (this.negativeSkipBug) {span.removeChild(start); span.style.position = position}
|
if (this.negativeSkipBug) {span.removeChild(start); span.style.position = position}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (H != null) {span.parentNode.HH = H/this.em}
|
||||||
return W/this.em;
|
return W/this.em;
|
||||||
},
|
},
|
||||||
Measured: function (span,parent) {
|
Measured: function (span,parent) {
|
||||||
|
@ -673,6 +675,7 @@
|
||||||
w: w*span.scale, rw: w*span.scale, lw: 0
|
w: w*span.scale, rw: w*span.scale, lw: 0
|
||||||
};
|
};
|
||||||
span.style.height = H; span.style.verticalAlign = D;
|
span.style.height = H; span.style.verticalAlign = D;
|
||||||
|
span.HH = (h+d)*span.scale;
|
||||||
} else {
|
} else {
|
||||||
span = this.addElement(span,"span",{style: {height:H, verticalAlign:D}});
|
span = this.addElement(span,"span",{style: {height:H, verticalAlign:D}});
|
||||||
}
|
}
|
||||||
|
@ -699,10 +702,10 @@
|
||||||
var rule = this.addElement(span,"span",{
|
var rule = this.addElement(span,"span",{
|
||||||
style: {borderLeft: color, display: "inline-block", overflow:"hidden",
|
style: {borderLeft: color, display: "inline-block", overflow:"hidden",
|
||||||
width:0, height:H, verticalAlign:D},
|
width:0, height:H, verticalAlign:D},
|
||||||
bbox: {h:h, d:d, w:w, rw:w, lw:0, exactW: true}, noAdjust: true
|
bbox: {h:h, d:d, w:w, rw:w, lw:0, exactW: true}, noAdjust: true, HH:h+d
|
||||||
});
|
});
|
||||||
if (w > 0 && rule.offsetWidth == 0) {rule.style.width = this.Em(w)}
|
if (w > 0 && rule.offsetWidth == 0) {rule.style.width = this.Em(w)}
|
||||||
if (span.isBox || span.className == "mspace") {span.bbox = rule.bbox}
|
if (span.isBox || span.className == "mspace") {span.bbox = rule.bbox, span.HH = h+d}
|
||||||
return rule;
|
return rule;
|
||||||
},
|
},
|
||||||
createFrame: function (span,h,d,w,t,style) {
|
createFrame: function (span,h,d,w,t,style) {
|
||||||
|
@ -711,7 +714,7 @@
|
||||||
var B = this.Em(t)+" "+style;
|
var B = this.Em(t)+" "+style;
|
||||||
var frame = this.addElement(span,"span",{
|
var frame = this.addElement(span,"span",{
|
||||||
style: {border: B, display:"inline-block", overflow:"hidden", width:W, height:H},
|
style: {border: B, display:"inline-block", overflow:"hidden", width:W, height:H},
|
||||||
bbox: {h:h, d:d, w:w, rw:w, lw:0, exactW: true}, noAdjust: true
|
bbox: {h:h, d:d, w:w, rw:w, lw:0, exactW: true}, noAdjust: true, HH:h+d
|
||||||
});
|
});
|
||||||
if (D) {frame.style.verticalAlign = D}
|
if (D) {frame.style.verticalAlign = D}
|
||||||
return frame;
|
return frame;
|
||||||
|
@ -722,7 +725,7 @@
|
||||||
var relativeW = String(w).match(/%$/);
|
var relativeW = String(w).match(/%$/);
|
||||||
var W = (!relativeW && w != null ? w : 0);
|
var W = (!relativeW && w != null ? w : 0);
|
||||||
span = this.addElement(span,"span",{
|
span = this.addElement(span,"span",{
|
||||||
noAdjust: true,
|
noAdjust: true, HH: 0,
|
||||||
style: {display:"inline-block", position:"relative",
|
style: {display:"inline-block", position:"relative",
|
||||||
width:(relativeW ? "100%" : this.Em(W)), height:0}
|
width:(relativeW ? "100%" : this.Em(W)), height:0}
|
||||||
});
|
});
|
||||||
|
@ -751,7 +754,9 @@
|
||||||
if (this.imgSpaceBug) {this.addText(span,this.imgSpace)}
|
if (this.imgSpaceBug) {this.addText(span,this.imgSpace)}
|
||||||
// Place the box
|
// Place the box
|
||||||
var HH, dx = 0;
|
var HH, dx = 0;
|
||||||
if (bbox && this.msieNoHeightBug) {HH = Math.max(5,bbox.h+bbox.d)} else {HH = span.offsetHeight/this.em}
|
if (span.HH != null) {HH = span.HH}
|
||||||
|
else if (bbox) {HH = Math.max(3,bbox.h+bbox.d)}
|
||||||
|
else {HH = span.offsetHeight/this.em}
|
||||||
if (!span.noAdjust) {
|
if (!span.noAdjust) {
|
||||||
HH += 1;
|
HH += 1;
|
||||||
if (this.msieInlineBlockAlignBug) {
|
if (this.msieInlineBlockAlignBug) {
|
||||||
|
@ -1251,7 +1256,7 @@
|
||||||
toHTMLmultiline: function (span) {MML.mbase.HTMLautoloadFile("multiline")},
|
toHTMLmultiline: function (span) {MML.mbase.HTMLautoloadFile("multiline")},
|
||||||
HTMLcomputeBBox: function (span,full,i,m) {
|
HTMLcomputeBBox: function (span,full,i,m) {
|
||||||
if (i == null) {i = 0}; if (m == null) {m = this.data.length}
|
if (i == null) {i = 0}; if (m == null) {m = this.data.length}
|
||||||
var BBOX = span.bbox = {}, stretchy = [];
|
var BBOX = span.bbox = {exactW: true}, stretchy = [];
|
||||||
while (i < m) {
|
while (i < m) {
|
||||||
var core = this.data[i]; if (!core) continue;
|
var core = this.data[i]; if (!core) continue;
|
||||||
if (!full && core.HTMLcanStretch("Vertical"))
|
if (!full && core.HTMLcanStretch("Vertical"))
|
||||||
|
@ -1275,6 +1280,7 @@
|
||||||
BBOX.w += bbox.w;
|
BBOX.w += bbox.w;
|
||||||
if (child.style.paddingRight) {BBOX.w += parseFloat(child.style.paddingRight)*(child.scale||1)}
|
if (child.style.paddingRight) {BBOX.w += parseFloat(child.style.paddingRight)*(child.scale||1)}
|
||||||
if (bbox.width) {BBOX.width = bbox.width}
|
if (bbox.width) {BBOX.width = bbox.width}
|
||||||
|
if (BBOX.exactW && !bbox.exactW) {delete BBOX.exactW}
|
||||||
},
|
},
|
||||||
HTMLemptyBBox: function (BBOX) {
|
HTMLemptyBBox: function (BBOX) {
|
||||||
BBOX.h = BBOX.d = BBOX.H = BBOX.D = BBOX.rw = -HTMLCSS.BIGDIMEN;
|
BBOX.h = BBOX.d = BBOX.H = BBOX.D = BBOX.rw = -HTMLCSS.BIGDIMEN;
|
||||||
|
@ -2213,7 +2219,6 @@
|
||||||
msieNegativeSpaceBug: quirks,
|
msieNegativeSpaceBug: quirks,
|
||||||
negativeSkipBug: (mode < 8), // confused by initial negative margin
|
negativeSkipBug: (mode < 8), // confused by initial negative margin
|
||||||
msieNegativeBBoxBug: (mode >= 8), // negative bboxes have positive widths
|
msieNegativeBBoxBug: (mode >= 8), // negative bboxes have positive widths
|
||||||
msieNoHeightBug: true,//(mode >= 8), // don't compute offsetHeight in placeBox
|
|
||||||
msieIE6: !isIE7,
|
msieIE6: !isIE7,
|
||||||
msieItalicWidthBug: true,
|
msieItalicWidthBug: true,
|
||||||
zeroWidthBug: (mode < 8),
|
zeroWidthBug: (mode < 8),
|
||||||
|
|
Loading…
Reference in New Issue
Block a user