Commit Graph

11 Commits

Author SHA1 Message Date
Nathan Sobo
22496ceeb1 WIP: Minimize paint when scrolling and composite lines with the GPU 2014-04-22 17:10:22 -06:00
Nathan Sobo
a03f2f46ee Don't assume tokens match text nodes when measuring character widths 2014-04-22 17:10:22 -06:00
Nathan Sobo
fdccc0bcc2 Measure DOM dimensions before rendering elements that depend on them
This commit breaks the initial render of the editor component into two
stages.

The first stage just renders the shell of the editor so the height,
width, line height, and default character width can be measured. Nothing
that depends on these values is rendered on the first render pass.

Once the editor component is mounted, all these values are measured and
we force another update, which fills in the lines, line numbers,
selections, etc.

We also refrain from assigning an explicit height and width on the
model if these values aren't explicitly styled in the DOM, and just
assume the editor will stretch to accommodate its contents.
2014-04-22 17:10:21 -06:00
Nathan Sobo
201e00aa83 Don't measure new lines when scrolling with the mousewheel
It impacts scrolling performance. We can measure when scrolling comes
to a halt.
2014-04-22 17:09:44 -06:00
Nathan Sobo
f02d956362 Preserve the only the target screen row when scrolling via mousewheel
When the target of a mousewheel event is removed, it breaks velocity
scrolling.

Previously, we were preserving the entire screen range when scrolling
with the mouse wheel, which caused a lot of DOM nodes to accumulate. Now
we only preserve the individual line and line number associated with the
target of the mousewheel event, moving them just off screen below all
the on-screen lines and line numbers. This keeps the number of DOM nodes
limited while retaining velocity effects.
2014-04-22 17:09:44 -06:00
Nathan Sobo
216d561c79 Delay creating range and node iterator until we actually need to measure 2014-04-22 17:09:44 -06:00
Nathan Sobo
6607f99c6c Use padding-top/bottom rather than spacer divs in lines and gutter
It creates a simpler DOM structure.
2014-04-22 17:09:44 -06:00
Nathan Sobo
5a9a3c62e1 Implement shouldComponentUpdate for LinesComponent
We accumulate pending changes and pass them to the lines and the gutter
to help them determine whether to update. The lines only update if the
visible row range changed or if there was a change in the visible row
range.
2014-04-22 17:09:44 -06:00
Nathan Sobo
b96abfffb7 Add more displayNames 2014-04-22 17:09:44 -06:00
Nathan Sobo
550a4ce906 Use isEqualForProperties in LinesComponent to decide when to re-measure 2014-04-22 17:09:43 -06:00
Nathan Sobo
e952ab2e02 Extract a LinesComponent 2014-04-22 17:09:42 -06:00