Merge v2.0-candidate into SVG

This commit is contained in:
Davide P. Cervone 2011-11-15 16:41:39 -05:00
commit 3bb798f6f4
15 changed files with 53 additions and 44 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

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

@ -12,9 +12,5 @@
* http://www.apache.org/licenses/LICENSE-2.0
*/
<<<<<<< HEAD
MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function(){var c="1.1.1";var a=MathJax.ElementJax.mml,b=MathJax.OutputJax["HTML-CSS"];a.mmultiscripts.Augment({toHTML:function(I,G,A){I=this.HTMLcreateSpan(I);var N=this.HTMLgetScale();var k=b.createStack(I),f;var j=b.createBox(k);this.HTMLmeasureChild(this.base,j);if(this.data[this.base]){if(A!=null){b.Remeasured(this.data[this.base].HTMLstretchV(j,G,A),j)}else{if(G!=null){b.Remeasured(this.data[this.base].HTMLstretchH(j,G),j)}}}var L=b.TeX.x_height*N,z=b.TeX.scriptspace*N*0.75;var y=this.HTMLgetScripts(k,z);var l=y[0],e=y[1],o=y[2],i=y[3];var g=(this.data[1]||this).HTMLgetScale();var C=b.TeX.sup_drop*g,B=b.TeX.sub_drop*g;var w=j.bbox.h-C,n=j.bbox.d+B,M=0,F;if(j.bbox.ic){M=j.bbox.ic}if(this.data[this.base]&&(this.data[this.base].type==="mi"||this.data[this.base].type==="mo")){if(this.data[this.base].data.join("").length===1&&j.bbox.scale===1&&!this.data[this.base].Get("largeop")){w=n=0}}var H=this.getValues("subscriptshift","superscriptshift"),E=this.HTMLgetMu(I);H.subscriptshift=(H.subscriptshift===""?0:b.length2em(H.subscriptshift,E));H.superscriptshift=(H.superscriptshift===""?0:b.length2em(H.superscriptshift,E));var m=0;if(o){m=o.bbox.w+M}else{if(i){m=i.bbox.w-M}}if(m<0){m=0}b.placeBox(j,m,0);if(!e&&!i){n=Math.max(n,b.TeX.sub1*N,H.subscriptshift);if(l){n=Math.max(n,l.bbox.h-(4/5)*L)}if(o){n=Math.max(n,o.bbox.h-(4/5)*L)}if(l){b.placeBox(l,m+j.bbox.w+z-M,-n)}if(o){b.placeBox(o,0,-n)}}else{if(!l&&!o){f=this.getValues("displaystyle","texprimestyle");F=b.TeX[(f.displaystyle?"sup1":(f.texprimestyle?"sup3":"sup2"))];w=Math.max(w,F*N,H.superscriptshift);if(e){w=Math.max(w,e.bbox.d+(1/4)*L)}if(i){w=Math.max(w,i.bbox.d+(1/4)*L)}if(e){b.placeBox(e,m+j.bbox.w+z,w)}if(i){b.placeBox(i,0,w)}}else{n=Math.max(n,b.TeX.sub2*N);var x=b.TeX.rule_thickness*N;var J=(l||o).bbox.h,K=(e||i).bbox.d;if(o){J=Math.max(J,o.bbox.h)}if(i){K=Math.max(K,i.bbox.d)}if((w-K)-(J-n)<3*x){n=3*x-w+K+J;C=(4/5)*L-(w-K);if(C>0){w+=C;n-=C}}w=Math.max(w,H.superscriptshift);n=Math.max(n,H.subscriptshift);if(e){b.placeBox(e,m+j.bbox.w+z,w)}if(i){b.placeBox(i,m+M-i.bbox.w,w)}if(l){b.placeBox(l,m+j.bbox.w+z-M,-n)}if(o){b.placeBox(o,m-o.bbox.w,-n)}}}this.HTMLhandleSpace(I);this.HTMLhandleColor(I);return I},HTMLgetScripts:function(p,q){var o,d,e=[];var n=1,g=this.data.length,f=0;for(var h=0;h<4;h+=2){while(n<g&&this.data[n].type!=="mprescripts"){for(var l=h;l<h+2;l++){if(this.data[n]&&this.data[n].type!=="none"){if(!e[l]){e[l]=b.createBox(p);e[l].bbox=this.HTMLemptyBBox({});if(f){b.createBlank(e[l],f);e[l].bbox.w=e[l].bbox.rw=f}}this.data[n].toHTML(e[l]);this.HTMLcombineBBoxes(this.data[n],e[l].bbox)}n++}d=e[h];o=e[h+1];if(d&&o){if(d.bbox.w<o.bbox.w){b.createBlank(d,o.bbox.w-d.bbox.w);d.bbox.w=o.bbox.w;d.bbox.rw=Math.max(d.bbox.w,d.bbox.rw)}else{if(d.bbox.w>o.bbox.w){b.createBlank(o,d.bbox.w-o.bbox.w);o.bbox.w=d.bbox.w;o.bbox.rw=Math.max(o.bbox.w,o.bbox.rw)}}}if(d){f=d.bbox.w}else{if(o){f=o.bbox.w}}}n++;f=0}for(l=0;l<4;l++){if(e[l]){e[l].bbox.w+=q;e[l].bbox.rw=Math.max(e[l].bbox.w,e[l].bbox.rw);this.HTMLcleanBBox(e[l].bbox)}}return e},HTMLstretchH:a.mbase.HTMLstretchH,HTMLstretchV:a.mbase.HTMLstretchV});MathJax.Hub.Startup.signal.Post("HTML-CSS mmultiscripts Ready");MathJax.Ajax.loadComplete(b.autoloadDir+"/mmultiscripts.js")});
=======
MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function(){var c="1.1.1";var a=MathJax.ElementJax.mml,b=MathJax.OutputJax["HTML-CSS"];a.mmultiscripts.Augment({toHTML:function(I,G,B){I=this.HTMLcreateSpan(I);var N=this.HTMLgetScale();var l=b.createStack(I),f;var j=b.createBox(l);if(this.data[this.base]){var k=this.data[this.base].toHTML(j);if(B!=null){this.data[this.base].HTMLstretchV(j,G,B)}else{if(G!=null){this.data[this.base].HTMLstretchH(j,G)}}b.Measured(k,j)}else{j.bbox=this.HTMLzeroBBox()}var L=b.TeX.x_height*N,A=b.TeX.scriptspace*N*0.75;var z=this.HTMLgetScripts(l,A);var m=z[0],e=z[1],w=z[2],i=z[3];var g=(this.data[1]||this).HTMLgetScale();var E=b.TeX.sup_drop*g,C=b.TeX.sub_drop*g;var x=j.bbox.h-E,o=j.bbox.d+C,M=0,F;if(j.bbox.ic){M=j.bbox.ic}if(this.data[this.base]&&(this.data[this.base].type==="mi"||this.data[this.base].type==="mo")){if(this.data[this.base].data.join("").length===1&&j.bbox.scale===1&&!this.data[this.base].Get("largeop")){x=o=0}}var H=this.getValues("subscriptshift","superscriptshift");H.subscriptshift=(H.subscriptshift===""?0:b.length2em(H.subscriptshift));H.superscriptshift=(H.superscriptshift===""?0:b.length2em(H.superscriptshift));var n=0;if(w){n=w.bbox.w+M}else{if(i){n=i.bbox.w-M}}if(n<0){n=0}b.placeBox(j,n,0);if(!e&&!i){o=Math.max(o,b.TeX.sub1*N,H.subscriptshift);if(m){o=Math.max(o,m.bbox.h-(4/5)*L)}if(w){o=Math.max(o,w.bbox.h-(4/5)*L)}if(m){b.placeBox(m,n+j.bbox.w+A-M,-o)}if(w){b.placeBox(w,0,-o)}}else{if(!m&&!w){f=this.getValues("displaystyle","texprimestyle");F=b.TeX[(f.displaystyle?"sup1":(f.texprimestyle?"sup3":"sup2"))];x=Math.max(x,F*N,H.superscriptshift);if(e){x=Math.max(x,e.bbox.d+(1/4)*L)}if(i){x=Math.max(x,i.bbox.d+(1/4)*L)}if(e){b.placeBox(e,n+j.bbox.w+A,x)}if(i){b.placeBox(i,0,x)}}else{o=Math.max(o,b.TeX.sub2*N);var y=b.TeX.rule_thickness*N;var J=(m||w).bbox.h,K=(e||i).bbox.d;if(w){J=Math.max(J,w.bbox.h)}if(i){K=Math.max(K,i.bbox.d)}if((x-K)-(J-o)<3*y){o=3*y-x+K+J;E=(4/5)*L-(x-K);if(E>0){x+=E;o-=E}}x=Math.max(x,H.superscriptshift);o=Math.max(o,H.subscriptshift);if(e){b.placeBox(e,n+j.bbox.w+A,x)}if(i){b.placeBox(i,n+M-i.bbox.w,x)}if(m){b.placeBox(m,n+j.bbox.w+A-M,-o)}if(w){b.placeBox(w,n-w.bbox.w,-o)}}}this.HTMLhandleSpace(I);this.HTMLhandleColor(I);return I},HTMLgetScripts:function(p,q){var o,d,e=[];var n=1,g=this.data.length,f=0;for(var h=0;h<4;h+=2){while(n<g&&this.data[n].type!=="mprescripts"){for(var l=h;l<h+2;l++){if(this.data[n]&&this.data[n].type!=="none"){if(!e[l]){e[l]=b.createBox(p);e[l].bbox=this.HTMLemptyBBox({});if(f){b.createBlank(e[l],f);e[l].bbox.w=e[l].bbox.rw=f}}this.data[n].toHTML(e[l]);this.HTMLcombineBBoxes(this.data[n],e[l].bbox)}n++}d=e[h];o=e[h+1];if(d&&o){if(d.bbox.w<o.bbox.w){b.createBlank(d,o.bbox.w-d.bbox.w);d.bbox.w=o.bbox.w;d.bbox.rw=Math.max(d.bbox.w,d.bbox.rw)}else{if(d.bbox.w>o.bbox.w){b.createBlank(o,d.bbox.w-o.bbox.w);o.bbox.w=d.bbox.w;o.bbox.rw=Math.max(o.bbox.w,o.bbox.rw)}}}if(d){f=d.bbox.w}else{if(o){f=o.bbox.w}}}n++;f=0}for(l=0;l<4;l++){if(e[l]){e[l].bbox.w+=q;e[l].bbox.rw=Math.max(e[l].bbox.w,e[l].bbox.rw);this.HTMLcleanBBox(e[l].bbox)}}return e},HTMLstretchH:a.mbase.HTMLstretchH,HTMLstretchV:a.mbase.HTMLstretchV});MathJax.Hub.Startup.signal.Post("HTML-CSS mmultiscripts Ready");MathJax.Ajax.loadComplete(b.autoloadDir+"/mmultiscripts.js")});
>>>>>>> performance
MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function(){var c="1.1.1";var a=MathJax.ElementJax.mml,b=MathJax.OutputJax["HTML-CSS"];a.mmultiscripts.Augment({toHTML:function(J,H,B){J=this.HTMLcreateSpan(J);var O=this.HTMLgetScale();var l=b.createStack(J),f;var j=b.createBox(l);if(this.data[this.base]){var k=this.data[this.base].toHTML(j);if(B!=null){this.data[this.base].HTMLstretchV(j,H,B)}else{if(H!=null){this.data[this.base].HTMLstretchH(j,H)}}b.Measured(k,j)}else{j.bbox=this.HTMLzeroBBox()}var M=b.TeX.x_height*O,A=b.TeX.scriptspace*O*0.75;var z=this.HTMLgetScripts(l,A);var m=z[0],e=z[1],w=z[2],i=z[3];var g=(this.data[1]||this).HTMLgetScale();var E=b.TeX.sup_drop*g,C=b.TeX.sub_drop*g;var x=j.bbox.h-E,o=j.bbox.d+C,N=0,G;if(j.bbox.ic){N=j.bbox.ic}if(this.data[this.base]&&(this.data[this.base].type==="mi"||this.data[this.base].type==="mo")){if(this.data[this.base].data.join("").length===1&&j.bbox.scale===1&&!this.data[this.base].Get("largeop")){x=o=0}}var I=this.getValues("subscriptshift","superscriptshift"),F=this.HTMLgetMu(J);I.subscriptshift=(I.subscriptshift===""?0:b.length2em(I.subscriptshift,F));I.superscriptshift=(I.superscriptshift===""?0:b.length2em(I.superscriptshift,F));var n=0;if(w){n=w.bbox.w+N}else{if(i){n=i.bbox.w-N}}if(n<0){n=0}b.placeBox(j,n,0);if(!e&&!i){o=Math.max(o,b.TeX.sub1*O,I.subscriptshift);if(m){o=Math.max(o,m.bbox.h-(4/5)*M)}if(w){o=Math.max(o,w.bbox.h-(4/5)*M)}if(m){b.placeBox(m,n+j.bbox.w+A-N,-o)}if(w){b.placeBox(w,0,-o)}}else{if(!m&&!w){f=this.getValues("displaystyle","texprimestyle");G=b.TeX[(f.displaystyle?"sup1":(f.texprimestyle?"sup3":"sup2"))];x=Math.max(x,G*O,I.superscriptshift);if(e){x=Math.max(x,e.bbox.d+(1/4)*M)}if(i){x=Math.max(x,i.bbox.d+(1/4)*M)}if(e){b.placeBox(e,n+j.bbox.w+A,x)}if(i){b.placeBox(i,0,x)}}else{o=Math.max(o,b.TeX.sub2*O);var y=b.TeX.rule_thickness*O;var K=(m||w).bbox.h,L=(e||i).bbox.d;if(w){K=Math.max(K,w.bbox.h)}if(i){L=Math.max(L,i.bbox.d)}if((x-L)-(K-o)<3*y){o=3*y-x+L+K;E=(4/5)*M-(x-L);if(E>0){x+=E;o-=E}}x=Math.max(x,I.superscriptshift);o=Math.max(o,I.subscriptshift);if(e){b.placeBox(e,n+j.bbox.w+A,x)}if(i){b.placeBox(i,n+N-i.bbox.w,x)}if(m){b.placeBox(m,n+j.bbox.w+A-N,-o)}if(w){b.placeBox(w,n-w.bbox.w,-o)}}}this.HTMLhandleSpace(J);this.HTMLhandleColor(J);return J},HTMLgetScripts:function(p,q){var o,d,e=[];var n=1,g=this.data.length,f=0;for(var h=0;h<4;h+=2){while(n<g&&this.data[n].type!=="mprescripts"){for(var l=h;l<h+2;l++){if(this.data[n]&&this.data[n].type!=="none"){if(!e[l]){e[l]=b.createBox(p);e[l].bbox=this.HTMLemptyBBox({});if(f){b.createBlank(e[l],f);e[l].bbox.w=e[l].bbox.rw=f}}this.data[n].toHTML(e[l]);this.HTMLcombineBBoxes(this.data[n],e[l].bbox)}n++}d=e[h];o=e[h+1];if(d&&o){if(d.bbox.w<o.bbox.w){b.createBlank(d,o.bbox.w-d.bbox.w);d.bbox.w=o.bbox.w;d.bbox.rw=Math.max(d.bbox.w,d.bbox.rw)}else{if(d.bbox.w>o.bbox.w){b.createBlank(o,d.bbox.w-o.bbox.w);o.bbox.w=d.bbox.w;o.bbox.rw=Math.max(o.bbox.w,o.bbox.rw)}}}if(d){f=d.bbox.w}else{if(o){f=o.bbox.w}}}n++;f=0}for(l=0;l<4;l++){if(e[l]){e[l].bbox.w+=q;e[l].bbox.rw=Math.max(e[l].bbox.w,e[l].bbox.rw);this.HTMLcleanBBox(e[l].bbox)}}return e},HTMLstretchH:a.mbase.HTMLstretchH,HTMLstretchV:a.mbase.HTMLstretchV});MathJax.Hub.Startup.signal.Post("HTML-CSS mmultiscripts Ready");MathJax.Ajax.loadComplete(b.autoloadDir+"/mmultiscripts.js")});

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -181,10 +181,10 @@
for (var i = 0, m = this.items.length; i < m; i++) {this.items[i].Create(menu)}
if (MENU.isMobile) {
HTML.addElement(menu,"img",{
className: "MathJax_Menu_Close", menu: parent, src: CONFIG.closeImg,
HTML.addElement(menu,"span",{
className: "MathJax_Menu_Close", menu: parent,
ontouchstart: MENU.Close, ontouchend: FALSE, onmousedown: MENU.Close
});
},[["img",{src: CONFIG.closeImg, style:{width:"100%",height:"100%"}}]]);
}
this.posted = true;

View File

@ -885,6 +885,7 @@
if (w >= 0) {
span.style.width = this.Em(w);
span.style.display = "inline-block";
span.style.overflow = "hidden"; // for IE in quirks mode
} else {
if (this.msieNegativeSpaceBug) {span.style.height = ""}
span.style.marginLeft = this.Em(w);
@ -1501,6 +1502,7 @@
BBOX.w += bbox.w;
if (child.style.paddingRight) {BBOX.w += parseFloat(child.style.paddingRight)*(child.scale||1)}
if (bbox.width) {BBOX.width = bbox.width}
if (bbox.ic) {BBOX.ic = bbox.ic} else {delete BBOX.ic}
if (BBOX.exactW && !bbox.exactW) {delete BBOX.exactW}
},
HTMLemptyBBox: function (BBOX) {
@ -1802,7 +1804,13 @@
for (var i = 0, m = this.data.length; i < m; i++)
{if (this.data[i]) {this.data[i].toHTML(span,variant)}}
if (!span.bbox) {span.bbox = {w:0, h:0, d:0, rw:0, lw:0}}
if (this.data.join("").length !== 1) {delete span.bbox.skew}
var text = this.data.join(""), bbox = span.bbox;
if (bbox.skew && text.length !== 1) {delete bbox.skew}
if (bbox.rw > bbox.w && text.length === 1) {
bbox.ic = bbox.rw - bbox.w;
HTMLCSS.createBlank(span,bbox.ic);
bbox.w = bbox.rw;
}
this.HTMLhandleSpace(span);
this.HTMLhandleColor(span);
return span;
@ -2263,8 +2271,9 @@
if (box.bbox.w > WW) {WW = box.bbox.w}
}}
var t = HTMLCSS.TeX.rule_thickness, factor = HTMLCSS.FONTDATA.TeX_factor;
var base = boxes[this.base] || {bbox: this.HTMLzeroBBox()}, delta = (base.bbox.ic || 0);
var x, y, z1, z2, z3, dw, k;
var base = boxes[this.base] || {bbox: this.HTMLzeroBBox()};
var x, y, z1, z2, z3, dw, k, delta = 0;
if (base.bbox.ic) {delta = 1.3*base.bbox.ic + .05} // adjust faked IC to be more in line with expeted results
for (i = 0, m = this.data.length; i < m; i++) {
if (this.data[i] != null) {
box = boxes[i];
@ -2288,7 +2297,7 @@
k = Math.max(z1,z2-Math.max(0,box.bbox.d));
}
k = Math.max(k,1.5/this.em); // force to be at least 1.5px
x += delta; y = base.bbox.h + box.bbox.d + k;
x += delta/2; y = base.bbox.h + box.bbox.d + k;
box.bbox.h += z3;
} else if (i == this.under) {
if (accent) {
@ -2299,7 +2308,7 @@
k = Math.max(z1,z2-box.bbox.h);
}
k = Math.max(k,1.5/this.em); // force to be at least 1.5px
x -= delta; y = -(base.bbox.d + box.bbox.h + k);
x -= delta/2; y = -(base.bbox.d + box.bbox.h + k);
box.bbox.d += z3;
}
HTMLCSS.placeBox(box,x,y);
@ -2338,7 +2347,10 @@
HTMLCSS.placeBox(base,0,0);
var q = HTMLCSS.TeX.sup_drop * sscale, r = HTMLCSS.TeX.sub_drop * sscale;
var u = base.bbox.h - q, v = base.bbox.d + r, delta = 0, p;
if (base.bbox.ic) {delta = base.bbox.ic}
if (base.bbox.ic) {
base.bbox.w -= base.bbox.ic; // remove IC (added by mo and mi)
delta = 1.3*base.bbox.ic + .05; // adjust faked IC to be more in line with expected results
}
if (this.data[this.base] &&
(this.data[this.base].type === "mi" || this.data[this.base].type === "mo")) {
if (this.data[this.base].data.join("").length === 1 && base.bbox.scale === 1 &&
@ -2350,14 +2362,14 @@
if (!sup) {
if (sub) {
v = Math.max(v,HTMLCSS.TeX.sub1*scale,sub.bbox.h-(4/5)*x_height,min.subscriptshift);
HTMLCSS.placeBox(sub,base.bbox.w+s-delta,-v,sub.bbox);
HTMLCSS.placeBox(sub,base.bbox.w,-v,sub.bbox);
}
} else {
if (!sub) {
values = this.getValues("displaystyle","texprimestyle");
p = HTMLCSS.TeX[(values.displaystyle ? "sup1" : (values.texprimestyle ? "sup3" : "sup2"))];
u = Math.max(u,p*scale,sup.bbox.d+(1/4)*x_height,min.superscriptshift);
HTMLCSS.placeBox(sup,base.bbox.w+s,u,sup.bbox);
HTMLCSS.placeBox(sup,base.bbox.w+delta,u,sup.bbox);
} else {
v = Math.max(v,HTMLCSS.TeX.sub2*scale);
var t = HTMLCSS.TeX.rule_thickness * scale;
@ -2366,8 +2378,8 @@
q = (4/5)*x_height - (u - sup.bbox.d);
if (q > 0) {u += q; v -= q}
}
HTMLCSS.placeBox(sup,base.bbox.w+s,Math.max(u,min.superscriptshift));
HTMLCSS.placeBox(sub,base.bbox.w+s-delta,-Math.max(v,min.subscriptshift));
HTMLCSS.placeBox(sup,base.bbox.w+delta,Math.max(u,min.superscriptshift));
HTMLCSS.placeBox(sub,base.bbox.w,-Math.max(v,min.subscriptshift));
}
}
this.HTMLhandleSpace(span);

View File

@ -220,6 +220,7 @@
} else {
var config = (this.config.showMathMenuMSIE != null ? this : HUB).config;
if (config.showMathMenuMSIE) {this.MSIEoverlay(container)}
else {container.style.position = ""}
}
} else {
container.oncontextmenu = EVENT.Menu;