www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 4a4d88c26f47e0e682fb6e0e1cfbc13986748956
parent 210d336e90edea2c385c02130c1b82ca53aba9e9
Author: Davide P. Cervone <dpvc@union.edu>
Date:   Mon,  1 Sep 2014 14:13:52 -0400

Merge branch 'no-reflows' into develop

Diffstat:
Munpacked/config/default.js | 15+++++++++++++++
Munpacked/jax/output/HTML-CSS/config.js | 1+
Munpacked/jax/output/HTML-CSS/jax.js | 9++++++---
3 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/unpacked/config/default.js b/unpacked/config/default.js @@ -734,11 +734,26 @@ MathJax.Hub.Config({ EqnChunkFactor: 1.5, EqnChunkDelay: 100, + // // This option indicates whether MathJax should try to correct the // x-height of equations to match the size of the surrounding text. + // matchFontHeight: true, // + // When true, MathJax will not measure the widths or heights of the + // subexpressions as it creates its output, but instead will rely on + // its internal calculautions based on teh bounding boxes of the + // characters it uses, and will only take measurements when it + // absolutely has to. Since measurements cause display reflows, they + // slows down MathJax considerably, so without them MathJax runs + // faster, but can produce slightly less accurate character placements, + // especially in width fractions or roots. + // + noReflows: true, + + + // // These settings control automatic line breaking. It is off by // default, so only explicit line breaks are performed (via // linebreak="newline" attributes on <mo> and <mspace> elements). To diff --git a/unpacked/jax/output/HTML-CSS/config.js b/unpacked/jax/output/HTML-CSS/config.js @@ -35,6 +35,7 @@ MathJax.OutputJax["HTML-CSS"] = MathJax.OutputJax({ webfontDir: MathJax.OutputJax.fontDir + "/HTML-CSS", // font name added later config: { + noReflows: true, // true uses internal measurements to avoid browser reflows matchFontHeight: true, // try to match math font height to surrounding font? scale: 100, minScaleAdjust: 50, // global math scaling factor, and minimum adjusted scale factor availableFonts: ["STIX","TeX"], // list of local fonts to check for diff --git a/unpacked/jax/output/HTML-CSS/jax.js b/unpacked/jax/output/HTML-CSS/jax.js @@ -26,7 +26,6 @@ * limitations under the License. */ - (function (AJAX,HUB,HTMLCSS) { var MML, isMobile = HUB.Browser.isMobile; @@ -177,6 +176,7 @@ loadWebFont: function (font) { HUB.Startup.signal.Post("HTML-CSS Jax - Web-Font "+HTMLCSS.fontInUse+"/"+font.directory); var n = MESSAGE(["LoadWebFont","Loading web-font %1",HTMLCSS.fontInUse+"/"+font.directory]); + if (HTMLCSS.noReflows) return; var done = MathJax.Callback({}); // called when font is loaded var callback = MathJax.Callback(["loadComplete",this,font,n,done]); AJAX.timer.start(AJAX,[this.checkWebFont,font,callback],0,this.timeout); @@ -832,6 +832,7 @@ }, getHD: function (span) { + if (span.bbox && this.config.noReflows) {return {h:span.bbox.h, d:span.bbox.d}} var position = span.style.position; span.style.position = "absolute"; this.HDimg.style.height = "0px"; @@ -845,6 +846,7 @@ return HD; }, getW: function (span) { + if (span.bbox && this.config.noReflows) {return span.bbox.w} var W, H, w = (span.bbox||{}).w, start = span; if (span.bbox && span.bbox.exactW) {return w} if ((span.bbox && w >= 0 && !this.initialSkipBug && !this.msieItalicWidthBug) || @@ -886,7 +888,7 @@ for (i = 0, m = SPANS.length; i < m; i++) { span = SPANS[i]; if (!span) continue; bbox = span.bbox; parent = this.parentNode(span); - if (bbox.exactW || bbox.width || bbox.w === 0 || bbox.isMultiline) { + if (bbox.exactW || bbox.width || bbox.w === 0 || bbox.isMultiline || this.config.noReflows) { if (!parent.bbox) {parent.bbox = bbox} continue; } @@ -1077,7 +1079,8 @@ width:0, height:H, verticalAlign:D}, bbox: {h:h, d:d, w:w, rw:w, lw:0, exactW:true}, noAdjust:true, HH:h+d, isMathJax:true }); - if (w > 0 && rule.offsetWidth == 0) {rule.style.width = this.Em(w)} + // ### FIXME: figure out which IE has this bug and make a flag for it + if (w > 0 && !this.noReflows && rule.offsetWidth == 0) {rule.style.width = this.Em(w)} if (span.isBox || span.className == "mspace") {span.bbox = rule.bbox, span.HH = h+d} return rule; },