Respect horizontal scrollbar when rendering the vertical, and vice versa

We set overflow to hidden in the opposite scroll direction only if we
can't actually scroll in that direction, causing the white square where
neither scrollbar overlaps to appear at the lower right corner.
This commit is contained in:
Nathan Sobo
2014-04-23 18:10:26 -06:00
parent d9ba9262bf
commit e6df30e94c
7 changed files with 56 additions and 13 deletions

View File

@@ -547,6 +547,26 @@ describe "EditorComponent", ->
bottomOfEditor = node.getBoundingClientRect().bottom
expect(bottomOfLastLine).toBe bottomOfEditor
it "assigns the overflow to 'hidden' in the opposite direction unless the editor scrollable in that direction", ->
expect(verticalScrollbarNode.style.overflowX).toBe 'hidden'
expect(horizontalScrollbarNode.style.overflowY).toBe 'hidden'
return
node.style.height = 4.5 * lineHeightInPixels + 'px'
component.measureHeightAndWidth()
expect(verticalScrollbarNode.style.overflowX).toBe 'hidden'
expect(horizontalScrollbarNode.style.overflowY).toBe ''
node.style.width = 10 * charWidth + 'px'
component.measureHeightAndWidth()
expect(verticalScrollbarNode.style.overflowX).toBe ''
expect(horizontalScrollbarNode.style.overflowY).toBe ''
node.style.height = 20 * lineHeightInPixels + 'px'
component.measureHeightAndWidth()
expect(verticalScrollbarNode.style.overflowX).toBe ''
expect(horizontalScrollbarNode.style.overflowY).toBe 'hidden'
describe "when a mousewheel event occurs on the editor", ->
it "updates the horizontal or vertical scrollbar depending on which delta is greater (x or y)", ->
node.style.height = 4.5 * lineHeightInPixels + 'px'