Commit Graph

9 Commits

Author SHA1 Message Date
Ben Alpert
99e7710020 Don't change global prototype: local utils.indexOf
Auditors: eater
2014-01-14 19:52:53 -08:00
Ben Eater
ee58c126fb Add an Array.indexOf polyfill and don't depend on underscore.js
Auditors: alpert
2014-01-14 17:40:21 -08:00
Emily Eisenberg
0a3a2271f4 Add ability to calculate heights/depths
Summary:
This diff does a couple different things:

 - There is now a metrics/ folder, which contains the property files describing
   the metrics if the fonts, as well as a script for reading and printing the
   metrics in javascript.
 - Fractions and superscripts/subscripts are now rendered in slightly different
   ways now (notably, no use of inline-table). This allows for much more precise
   positioning of the superscripts, subscripts, numerators, and denominators,
   while still having an appropriate baseline. Also, there is no longer a
   sup/sub/supsub distinction, there are only supsubs with null sup/sub.
 - Using the new font metrics and by implementing the formulas found in The TeX
   Book, Appendix G, the heights and depths of all of the sub-expressions in a
   formula are now calculated. These are currently used to:
    - Correctly position superscripts, subscripts, numerators, and denominators
    - Adjust the height and depth of the overall expression so it takes up the
      appropriate space
 - Because we have to add attributes (height and depth) to every attribute, I
   have changed the way DOM nodes are assembled. Now, instead of assembling the
   DOM elements inline (which is a problem because we need to track
   height/depth, and we shouldn't (and can't in IE 8) attach raw attributes to DOM
   nodes), we assemble a pseudo-DOM structure with the extra information, and
   then actually assemble it at the very end.

The main page also now has an updated expression to show off and test the new
and improved parsing.

Test Plan:
View the main page, make sure that the expression renders. Make sure
that the tests pass. Make sure that expressions have the correct calculated
height (this is most easily tested by viewing them on the main page and making
sure that the top of the expression lines up with the bottom of the input box).

Reviewers: alpert

Reviewed By: alpert

Differential Revision: http://phabricator.khanacademy.org/D3442
2013-08-13 18:16:43 -07:00
Emily Eisenberg
cfb9f2b31b Refactor some stuff
Summary:
Pull node making into a separate module, make an "options" param for
the make_ functions, and pull the different types of groups into separate
functions.

Test Plan: Open the homepage, make sure everything still works.

Reviewers: alpert

Reviewed By: alpert

Differential Revision: http://phabricator.khanacademy.org/D3368
2013-08-06 14:12:06 -07:00
Ben Alpert
6883017bc4 Look at WebKit version instead of checking Safari
Reviewers: emily

Reviewed By: emily

Differential Revision: http://phabricator.khanacademy.org/D3317
2013-08-01 17:43:06 -07:00
Emily Eisenberg
905fb7fb71 Don't run in Safari
Summary: Safari has weird bugs associated with inline-table and
vertical-align, so we just won't render in Safari.

Auditors: alpert
2013-07-25 18:59:20 -07:00
Emily Eisenberg
79a50b3abe Make the linter happy
Auditors: alpert
2013-07-24 20:37:56 -07:00
Ben Alpert
c774b69de8 Make contains() actually work in IE8
Summary: IE8 doesn't have indexOf on arrays!

Reviewers: emily

Reviewed By: emily

Differential Revision: http://phabricator.khanacademy.org/D3052
2013-07-14 22:46:00 -07:00
Emily Eisenberg
a831e94a51 Remove dependency on underscore
Summary:
Remove all uses of underscore. For the things we actually need, make a
"util" file and put them in there.

Test Plan:
Make sure the test still succeed, and that the main page still
works.

Reviewers: alpert

Reviewed By: alpert

Differential Revision: http://phabricator.khanacademy.org/D3043
2013-07-13 20:42:19 -07:00