Measure mtable entries all at once (to reduce reflows)
This commit is contained in:
parent
b719fb481b
commit
3717fcfb57
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
File diff suppressed because one or more lines are too long
|
@ -22,7 +22,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
|
MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
|
||||||
var VERSION = "1.1";
|
var VERSION = "1.1.1";
|
||||||
var MML = MathJax.ElementJax.mml,
|
var MML = MathJax.ElementJax.mml,
|
||||||
HTMLCSS = MathJax.OutputJax["HTML-CSS"];
|
HTMLCSS = MathJax.OutputJax["HTML-CSS"];
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
|
||||||
var stack = HTMLCSS.createStack(span);
|
var stack = HTMLCSS.createStack(span);
|
||||||
var scale = this.HTMLgetScale(); var LABEL = -1;
|
var scale = this.HTMLgetScale(); var LABEL = -1;
|
||||||
|
|
||||||
var H = [], D = [], W = [], A = [], C = [], i, j, J = -1, m, M, s, row;
|
var H = [], D = [], W = [], A = [], C = [], i, j, J = -1, m, M, s, row, entries = [];
|
||||||
var LHD = HTMLCSS.FONTDATA.baselineskip * scale * values.useHeight,
|
var LHD = HTMLCSS.FONTDATA.baselineskip * scale * values.useHeight,
|
||||||
LH = HTMLCSS.FONTDATA.lineH * scale, LD = HTMLCSS.FONTDATA.lineD * scale;
|
LH = HTMLCSS.FONTDATA.lineH * scale, LD = HTMLCSS.FONTDATA.lineD * scale;
|
||||||
|
|
||||||
|
@ -55,7 +55,13 @@ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
|
||||||
W[j] = -HTMLCSS.BIGDIMEN;
|
W[j] = -HTMLCSS.BIGDIMEN;
|
||||||
}
|
}
|
||||||
A[i][j] = HTMLCSS.createBox(C[j]);
|
A[i][j] = HTMLCSS.createBox(C[j]);
|
||||||
HTMLCSS.Measured(row.data[j-s].toHTML(A[i][j]),A[i][j]);
|
entries.push(row.data[j-s].toHTML(A[i][j]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
HTMLCSS.MeasureSpans(entries);
|
||||||
|
for (i = 0, m = this.data.length; i < m; i++) {
|
||||||
|
row = this.data[i]; s = (row.type === "mlabeledtr" ? LABEL : 0);
|
||||||
|
for (j = s, M = row.data.length + s; j < M; j++) {
|
||||||
if (row.data[j-s].isMultiline) {A[i][j].style.width = "100%"}
|
if (row.data[j-s].isMultiline) {A[i][j].style.width = "100%"}
|
||||||
if (A[i][j].bbox.h > H[i]) {H[i] = A[i][j].bbox.h}
|
if (A[i][j].bbox.h > H[i]) {H[i] = A[i][j].bbox.h}
|
||||||
if (A[i][j].bbox.d > D[i]) {D[i] = A[i][j].bbox.d}
|
if (A[i][j].bbox.d > D[i]) {D[i] = A[i][j].bbox.d}
|
||||||
|
@ -419,9 +425,8 @@ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
|
||||||
span = this.HTMLcreateSpan(span);
|
span = this.HTMLcreateSpan(span);
|
||||||
if (this.data[0]) {
|
if (this.data[0]) {
|
||||||
var box = this.data[0].toHTML(span);
|
var box = this.data[0].toHTML(span);
|
||||||
if (D != null) {HTMLCSS.Remeasured(this.data[0].HTMLstretchV(span,HW,D),span)}
|
if (D != null) {box = this.data[0].HTMLstretchV(span,HW,D)}
|
||||||
else if (HW != null) {HTMLCSS.Remeasured(this.data[0].HTMLstretchH(span,HW),span)}
|
else if (HW != null) {box = this.data[0].HTMLstretchH(span,HW)}
|
||||||
else {HTMLCSS.Measured(box,span)}
|
|
||||||
span.bbox = box.bbox;
|
span.bbox = box.bbox;
|
||||||
}
|
}
|
||||||
this.HTMLhandleSpace(span);
|
this.HTMLhandleSpace(span);
|
||||||
|
|
|
@ -663,13 +663,13 @@
|
||||||
Remeasured: function (span,parent) {
|
Remeasured: function (span,parent) {
|
||||||
parent.bbox = this.Measured(span,parent).bbox;
|
parent.bbox = this.Measured(span,parent).bbox;
|
||||||
},
|
},
|
||||||
MeasureSpans: function () {
|
MeasureSpans: function (SPANS) {
|
||||||
var spans = [], span, i, m, bbox, start, end, W;
|
var spans = [], span, i, m, bbox, start, end, W;
|
||||||
//
|
//
|
||||||
// Insert the needed markers
|
// Insert the needed markers
|
||||||
//
|
//
|
||||||
for (i = 0, m = arguments.length; i < m; i++) {
|
for (i = 0, m = SPANS.length; i < m; i++) {
|
||||||
span = arguments[i]; if (!span) continue;
|
span = SPANS[i]; if (!span) continue;
|
||||||
bbox = span.bbox;
|
bbox = span.bbox;
|
||||||
if (bbox.exactW || bbox.width || bbox.w === 0 || bbox.isMultiline) {
|
if (bbox.exactW || bbox.width || bbox.w === 0 || bbox.isMultiline) {
|
||||||
if (!span.parentNode.bbox) {span.parentNode.bbox = bbox}
|
if (!span.parentNode.bbox) {span.parentNode.bbox = bbox}
|
||||||
|
@ -1889,7 +1889,7 @@
|
||||||
span = this.HTMLcreateSpan(span);
|
span = this.HTMLcreateSpan(span);
|
||||||
var frac = HTMLCSS.createStack(span);
|
var frac = HTMLCSS.createStack(span);
|
||||||
var num = HTMLCSS.createBox(frac), den = HTMLCSS.createBox(frac);
|
var num = HTMLCSS.createBox(frac), den = HTMLCSS.createBox(frac);
|
||||||
HTMLCSS.MeasureSpans(this.HTMLboxChild(0,num),this.HTMLboxChild(1,den));
|
HTMLCSS.MeasureSpans([this.HTMLboxChild(0,num),this.HTMLboxChild(1,den)]);
|
||||||
var values = this.getValues("displaystyle","linethickness","numalign","denomalign","bevelled");
|
var values = this.getValues("displaystyle","linethickness","numalign","denomalign","bevelled");
|
||||||
var scale = this.HTMLgetScale(), isDisplay = values.displaystyle;
|
var scale = this.HTMLgetScale(), isDisplay = values.displaystyle;
|
||||||
var a = HTMLCSS.TeX.axis_height * scale;
|
var a = HTMLCSS.TeX.axis_height * scale;
|
||||||
|
@ -1951,7 +1951,7 @@
|
||||||
var BASE = this.HTMLboxChild(0,base);
|
var BASE = this.HTMLboxChild(0,base);
|
||||||
H = BASE.bbox.h + BASE.bbox.d + q + t;
|
H = BASE.bbox.h + BASE.bbox.d + q + t;
|
||||||
HTMLCSS.createDelimiter(surd,0x221A,H,scale);
|
HTMLCSS.createDelimiter(surd,0x221A,H,scale);
|
||||||
HTMLCSS.MeasureSpans(BASE,surd);
|
HTMLCSS.MeasureSpans([BASE,surd]);
|
||||||
W = BASE.bbox.w;
|
W = BASE.bbox.w;
|
||||||
var x = 0;
|
var x = 0;
|
||||||
if (surd.isMultiChar || (HTMLCSS.AdjustSurd && HTMLCSS.imgFonts)) {surd.bbox.w *= .95}
|
if (surd.isMultiChar || (HTMLCSS.AdjustSurd && HTMLCSS.imgFonts)) {surd.bbox.w *= .95}
|
||||||
|
@ -2083,7 +2083,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
HTMLCSS.MeasureSpans.apply(HTMLCSS,children);
|
HTMLCSS.MeasureSpans(children);
|
||||||
var W = -HTMLCSS.BIGDIMEN, WW = W;
|
var W = -HTMLCSS.BIGDIMEN, WW = W;
|
||||||
for (i = 0, m = this.data.length; i < m; i++) {
|
for (i = 0, m = this.data.length; i < m; i++) {
|
||||||
if (this.data[i]) {
|
if (this.data[i]) {
|
||||||
|
@ -2163,7 +2163,7 @@
|
||||||
{sup = HTMLCSS.createBox(stack); children.push(this.data[this.sup].toHTML(sup))}
|
{sup = HTMLCSS.createBox(stack); children.push(this.data[this.sup].toHTML(sup))}
|
||||||
if (this.HTMLnotEmpty(this.data[this.sub]))
|
if (this.HTMLnotEmpty(this.data[this.sub]))
|
||||||
{sub = HTMLCSS.createBox(stack); children.push(this.data[this.sub].toHTML(sub))}
|
{sub = HTMLCSS.createBox(stack); children.push(this.data[this.sub].toHTML(sub))}
|
||||||
HTMLCSS.MeasureSpans.apply(HTMLCSS,children);
|
HTMLCSS.MeasureSpans(children);
|
||||||
if (sup) {sup.bbox.w += s; sup.bbox.rw = Math.max(sup.bbox.w,sup.bbox.rw)}
|
if (sup) {sup.bbox.w += s; sup.bbox.rw = Math.max(sup.bbox.w,sup.bbox.rw)}
|
||||||
if (sub) {sub.bbox.w += s; sub.bbox.rw = Math.max(sub.bbox.w,sub.bbox.rw)}
|
if (sub) {sub.bbox.w += s; sub.bbox.rw = Math.max(sub.bbox.w,sub.bbox.rw)}
|
||||||
HTMLCSS.placeBox(base,0,0);
|
HTMLCSS.placeBox(base,0,0);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user