]> git.gir.st - VimFx.git/commit
Group all hint injection code in hints.coffee
authorSimon Lydell <simon.lydell@gmail.com>
Tue, 30 Jul 2013 12:47:26 +0000 (14:47 +0200)
committerSimon Lydell <simon.lydell@gmail.com>
Tue, 30 Jul 2013 12:47:26 +0000 (14:47 +0200)
commit515f0a4bb9153019d556ef6ffd9cdd0e6453530b
tree4186beac5a8ab25317e1208725b51aab52d22078
parent0c16de0a6f845d44e9ef1a97614604e09d1bb822
Group all hint injection code in hints.coffee

Before, the hint/marker injection code was spread out in both hints.coffee
and marker.coffee. Creation and injection of markers does not really
belong to the Marker class. It is just a wrapper around a single markable
element.

Now, all hint/marker creation and injection is done in hints.coffee. This
has several benefits: The code is a lot easier to understand, and the
number of loops over arrays of markers could be reduced a lot, enhancing
performance.

I've also cleaned the code up, as well as removed code that was totally
useless: Before, `element.getClientRects()` was scanned for rectangles
matching the `isRectOk()` test. However, none of them could ever pass,
since `isRectOk()` looks for width and height properties on the
rectangles, which do not even exist (however, they do on the rectangle
returned by `element.getBoundingClientRect()`). This also fixes the uncaught
ReferenceErrors complaining about undefined width and height properties.
This also removed unnecessary loops, which enhances performance even more.

Some of these changes could have been made outside the huffman branch, I
realize now. However, it would take some work, and I'm not sure it is
worth it.

An improvement I noticed with this patch: It is now possible to click the
green, hidden until hover install buttons on AMO:
https://addons.mozilla.org/firefox/addon/VimFx/versions/
extension/packages/hints.coffee
extension/packages/marker.coffee
Imprint / Impressum