From c22d8644cc7f45443c6c0756ab64f2dfc2b454e0 Mon Sep 17 00:00:00 2001 From: Emily Eisenberg Date: Sat, 29 Mar 2014 23:33:05 -0400 Subject: [PATCH] Fix a weird bug with rlap For some reason, when you have a nested elements that look like `display: inline-block; > position: relative; > position: absolute;` then the `position: absolute;` element is shifted down a bunch. If there is anything* else inside either of the other two elements, then this behavior disappears. (This can be seen at [this fiddle](http://jsfiddle.net/qZXRr/). We have this structure when we create `\llap` and `\rlap`s, and this weird behavior So, to fix this I added an empty `display: inline-block;` span inside the llap to fix this. Test plan: - See that the new huxley image looks good - Test this in a bunch of browsers and see they also look good Auditors: alpert --- buildTree.js | 12 ++++++++---- static/katex.less | 10 +++++++--- test/huxley/Huxleyfile | 3 +++ test/huxley/RlapBug.huxley/record.json | 1 + test/huxley/RlapBug.huxley/screenshot0.png | Bin 0 -> 5719 bytes 5 files changed, 19 insertions(+), 7 deletions(-) create mode 100644 test/huxley/RlapBug.huxley/record.json create mode 100644 test/huxley/RlapBug.huxley/screenshot0.png diff --git a/buildTree.js b/buildTree.js index 372283f51..8416cb06d 100644 --- a/buildTree.js +++ b/buildTree.js @@ -339,13 +339,17 @@ var groupTypes = { }, llap: function(group, options, prev) { - var inner = makeSpan([], [buildGroup(group.value, options.reset())]); - return makeSpan(["llap", options.style.cls()], [inner]); + var inner = makeSpan( + ["inner"], [buildGroup(group.value, options.reset())]); + var fix = makeSpan(["fix"], []); + return makeSpan(["llap", options.style.cls()], [inner, fix]); }, rlap: function(group, options, prev) { - var inner = makeSpan([], [buildGroup(group.value, options.reset())]); - return makeSpan(["rlap", options.style.cls()], [inner]); + var inner = makeSpan( + ["inner"], [buildGroup(group.value, options.reset())]); + var fix = makeSpan(["fix"], []); + return makeSpan(["rlap", options.style.cls()], [inner, fix]); }, punct: function(group, options, prev) { diff --git a/static/katex.less b/static/katex.less index fca4e6412..fc716482a 100644 --- a/static/katex.less +++ b/static/katex.less @@ -275,16 +275,20 @@ big parens width: 0; position: relative; - > span { + > .inner { position: absolute; } + + > .fix { + display: inline-block; + } } - .llap > span { + .llap > .inner { right: 0; } - .rlap > span { + .rlap > .inner { left: 0; } diff --git a/test/huxley/Huxleyfile b/test/huxley/Huxleyfile index f486316a1..3d9bbbb2a 100644 --- a/test/huxley/Huxleyfile +++ b/test/huxley/Huxleyfile @@ -39,3 +39,6 @@ url=http://localhost:7936/test/huxley/test.html?m=\frac{a}{b}\text{c~ {ab} \ e}+ [KaTeX] url=http://localhost:7936/test/huxley/test.html?m=\KaTeX + +[RlapBug] +url=http://localhost:7936/test/huxley/test.html?m=\rlap{x} \ No newline at end of file diff --git a/test/huxley/RlapBug.huxley/record.json b/test/huxley/RlapBug.huxley/record.json new file mode 100644 index 000000000..9369c51e8 --- /dev/null +++ b/test/huxley/RlapBug.huxley/record.json @@ -0,0 +1 @@ +{"py/object": "huxley.run.Test", "screen_size": {"py/tuple": [1024, 768]}, "steps": [{"py/object": "huxley.steps.ScreenshotTestStep", "index": 0, "offset_time": 0}]} diff --git a/test/huxley/RlapBug.huxley/screenshot0.png b/test/huxley/RlapBug.huxley/screenshot0.png new file mode 100644 index 0000000000000000000000000000000000000000..dea85a2ab4fdc4a18d04f05e10b662a8913c392a GIT binary patch literal 5719 zcmeHJ`Cn647QX>;hgfM1WecCq)TJok;IIVBcOt$$P$nx38-NSA&?LPA$fD3pZP1={BrNR_nz&YbH3-C zYoA7h+3s}Q2>`GS|2Xu|0BnJuR^M#j3O7!`Cn^B;xrT>+_?MjW#mVT$DO$XUvNdrB za%N=zzxzf#GTx8=x`-1q{@%Yhhmv*<#x(Ca-#ZcY$)S5!&Rn^e_~d%c_rE_`T#fTi z>@9XkDrX9-0^ilry0x^TvK21ifh< zY>Ea3vvG+%{2&rbTk2Tj4@MBuRvU7brxia`RXQ4j?uPIYvoSr3@wQDRV`DBYYaa4x zc!E<_BCUi-JRH-kNynL)ril!(Etf7?mBtYl#s)|jNw87XPZFCi5adbEC-qpIsEI32v6WLWOOvu&MxcCSrjO8D_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