aboutsummaryrefslogtreecommitdiffstats
path: root/content_scripts
AgeCommit message (Collapse)Author
2016-04-08Trim linkText when it's collected, not repreatedly.Stephen Blott
There's no need to repeatedly trim linkText. Instead, just trim it when it's first collected, then we can assume from there on that it's trimmed.
2016-04-08Filtered hints; do not accept split characters.Stephen Blott
There is no point accepting characters which are used for splitting the link text in the query string, since such characters cannot appear in link text words.
2016-04-08Simplify filtered hint matching.Stephen Blott
- Reduce the number of passes over hint markers from two to one. - Filter out non-matching hints before sorting. - Do not trim the search string twice.
2016-04-08Merge pull request #2088 from ↵Stephen Blott
smblott-github/filtered-hints-better-typed-text-matching Filtered hints: better typed text handling.
2016-04-08Refactor setModeIndicator().Stephen Blott
Previously this had two independent functions: set the @mode and update the indicator. We don't always do those two things at the same time. So this refactors things into two separate functions.
2016-04-08Show filtered characters in mode indicator.Stephen Blott
2016-04-08Filtered hints; ignore unmatched text.Stephen Blott
When the user is typing a link's text, any mistyped character exits link hints mode. This makes little sense. In practice, this usually happens because the user mis-typed something. Here, we ignore typed characters which do not match any hints. (Also, add a test for this.)
2016-04-08Do not post hint descriptors back to the frame itself.Stephen Blott
When distributing hint descriptors, do not post a frame's own hint descriptors back to the frame itself. It already has them. With regard to the message-passing cost only, this represents a speedup of approximately 3/2 for link-busy sites like reddit -- several tens of milliseconds for me. There are other costs too (such as processing the hint descriptors) bu these are not affected.
2016-04-05Better close-down for global link hints.Stephen Blott
- Unregister frames with the background-page hint coordinator. - Better page cleanup in the content scripts. - Require documentReady before harvesting hints. There is still an issue in some cases when link-hints are activated as a page is transitioning, but that problem case seems to have existed in 1.54. I'll continue to investigate.
2016-04-05Unregister frame on "unload".Stephen Blott
It seems we cannot rely on the port being disconnected to unregister a frame. So we need to unregister it on "unload".
2016-04-04Remove keyboard-suppressing mode when necessary.Stephen Blott
2016-04-04Better indicator message.Stephen Blott
2016-04-04Shorten link text.Stephen Blott
When a link's text is particularly long, displaying all of its text makes the hint look weird - so shorten it. We still use the full text for matching.
2016-04-04Do not offer activated element as scrollable.Stephen Blott
Scrollable divs are offered via link hints. It makes no sense to offer the current activated element for selection - so don't. On a "normal" page where there's just one scrollable thing, document.body, this means that we no longer offer the unnecessary "Scroll." hint.
2016-04-04Handle requireHref for link hints locally.Stephen Blott
The check that an element as an href (for certain hint modes) can be done earlier, thereby avoid the need to pass that information between frames.
2016-04-04Document hint descriptors.Stephen Blott
2016-04-04Keep showLinkText local for link hints.Stephen Blott
We only need showLinkText in the hint's local frame, so do not transmit it to remote frames.
2016-04-04Keep reason local for link hints.Stephen Blott
The "reason" a hint is available is only ever needed in the hint's own frame, so there's no need to pass it to other frames.
2016-04-04Keep rects local for link hints.Stephen Blott
Previously, we passed each hints rect to every other frame. However, the rect is only actually needed in its own frame. Here, we instead keep (and use) each hint's rect locally only.
2016-04-04Do not render link hints in remote frames.Stephen Blott
Previously, we were rendering hints in all frames, but displaying only in their own frame With n frames and m hints, we rendered n*m hints. With this, hints are only rendered in their own frame, so we only render m hints.
2016-04-03Freeze frame state on link-hint activation.Stephen Blott
We take a copy of the frame Ids and ports at the point which link-hints mode is launched, and use that subsequently. Therefore, a newly created frame cannot cause the hint coordinator to become confused. Also: add debugging code.
2016-04-03Remove blocking mode when no hints found.Stephen Blott
This fixes an error in 39adee9090fc5aadfd5dd681f91b80025084858a. Specifically, if there are no hints to select from, or no documentElement, then link-hints mode exits without initiating an actual mode (i.e. without calling its super() constructor). With 39adee9090fc5aadfd5dd681f91b80025084858a, that leaves a mode in place which blocks all keyboard events, thereby rendering Vimium entirely hung. See this line: https://github.com/philc/vimium/commit/39adee9090fc5aadfd5dd681f91b80025084858a#diff-e9abcb9ebcdb5af8e9f33651364673a1R59. Here: - we explicitly remove the keyboard-blocking mode - we add exitOnEscape (so that the situation is at least recoverable), and - we add an indicator (so that we can see what's going on). It is proposed that the indicator is a temporary feature, while the global link hints feature is in shake down.
2016-04-02Simplify UI component initialisation.Stephen Blott
There's no need for the previous complicated approach to UI component initialialisation, in particular for the Vomnibar. We only initialise the Vomnibar in the top frame. However, if for some reason it hasn't been initialised by the time it's needed, then we can just initialise it then. We are only initialising it early to avoid flicker, so it's not a correctness issue. And the only reason it wouldn't be initialised is if Vimium is disabled in the top frame, but enabled in some other frame -- which is not a common case.
2016-04-02Revert previous tweak.Stephen Blott
We need to wait for documentReady() here to ensure that the document is ready in the top frame.
2016-04-02Make stableSortCount per instance.Stephen Blott
I've not observed this, but it could possily happen... If the stableSortCount gets out of sync in different frames, then different frames might make different decisions about the ordering of the hints. Ti avoid this potentially happening, we initialise the stableSortCount every time link-hints mode is activated.
2016-04-02Make document.body selectable as scrollable.Stephen Blott
Previously, we could select divs, uls, and ols for scrolling, but we couldn't get back to scrolling the document body. This makes it possible to select document.body for scrolling. Unfortunately, sometimes the hint appears in a rather odd place (because it's "on top of" something else which is clickable.
2016-04-02Rework DomUtils.documentReady().Stephen Blott
There seems to be an issue on this page: - http://i.imgur.com/PdmUjij.jpg whereby "DOMContentLoaded" isn't firing. The page structure is unusual (involving a shadow-DOM element), which might be the source of the problem. What happens is that the "DOMContentLoaded" event fires as required, but the document state is still "loading". Here, we just say that if the "DOMContentLoaded" handler has fired once, then we're good to go.
2016-04-02Do not register tiny frames.Stephen Blott
This affects focusFrame and link hints. We do not register tiny frames. The reason for doing this is that link hints messages all (registered) frames to collect their hint descriptors. On some sites (e.g. Google Inbox and other Google properties), there are many tiny iframes (on the order of 12 or 15 or so). Those frames cannot provide useful hints, so -- by not registering them -- we don't ask them for hints. The intention is to speed up the link-hints activation sequence.
2016-04-02Move the test for small windows to DomUtils.Stephen Blott
The reason for doing this is that we will be using the same test to decide whether or not to register a frame.
2016-04-02Separate registerFrame from port initialization.Stephen Blott
This is a no-op. It separates the process of registering a frame with the background page from the port initialization. The idea is that -- soon -- we will only register some frames; in particular, we should not register the many tiny iframes on pages like GMail. The eventual goal is to speed up the global link-hints initialisation sequence.
2016-04-02Use ports for all link-hint messages.Stephen Blott
This seems to be considerably faster than using sendMessage().
2016-04-02Use port for frame-to-background messages.Stephen Blott
Without considering the size of the data passed, ports seem to be about 5 times fast than sendMessage(), so we use ports of link-hint messages wherever possible.
2016-04-02Wait for docomentReady to generate hints.Stephen Blott
If document.documentElement isn't ready, then we can'r generate hints. Moreover, this would crash -- thereby hanging global link hints.
2016-04-01Tweak hel dialog height.Stephen Blott
2016-04-01Fix height of help dialog.Stephen Blott
Following on from f0911e52f0e71c6d2539bdc74a09ff2dbd5ab125, I omitted to verify that the height of the dialog was correct on taller screens.
2016-04-01Ensure settings are loaded.Stephen Blott
With global link hints, hints might be launched in one frame when the settings are not yet loaded in another. This could lead to one frame using one settings value, and another another value. (Because we use the default value if the settings are not yet loaded.) And this in turn could cause link hints to crash if filetered hints are used (because, in that case, we would not calculate hint.linkText in one frame, but then try to use that value later in another frame).
2016-03-31Use @suppressEvent instead of false.Stephen Blott
2016-03-30Tweak 21da3fcafbb29540788037dbcdbdce79ad14e650.Stephen Blott
2016-03-30Rename handlerStack constants.Stephen Blott
Problems: - The meanings of some of the Mode/handlerStack constant names is far from obvious. - The same thing is named different things in different places. This changes various constant names such that: - the names used in the handler stack and in the modes are the same. - ditto vis-a-vis DomUtils. Also, break out the core of the handler stacks' `bubbleEvent` method into a switch statements. This makes it more obvious that the cases are mutually exclusive.
2016-03-30Add test for SuppressAllKeyboardEvents.Stephen Blott
Which: - uncovered a typo in 39adee9090fc5aadfd5dd681f91b80025084858a. Also: - make Mode.debug a class variable, which is more helpful while trying to debug. Specifically, you can turn debugging on or off from within the tests, for example.
2016-03-30Fix link-hints race condition.Stephen Blott
Because there is a small amount of time between link-hints mode being requested and it being activated, it was possible to launch other Vimium commands (e.g. the Vomnibar) after requesting link-hints mode, and before link-hints mode starts. This prevents that.
2016-03-30Minor refactor of link-hints exit sequence.Stephen Blott
The exit sequence is clearer like this.
2016-03-29Fix typo in debugging code.Stephen Blott
2016-03-29Fix race condition in grab-back-focus.Stephen Blott
See the newly-added comment.
2016-03-29Add tests for WaitForEnter.Stephen Blott
2016-03-29Escape to exit WaitForEnter.Stephen Blott
Context: filtered link hints with wait-for-enter enabled. Once a link is selected, it is highlighted. We then consume all keyboard events until the user hits enter, at which point the link is activated. Problem: When we're waiting, the link is highlighted. It looks to the user like `Escape` should cancel. This implements escape to cancel at that point in the exit sequence.
2016-03-28Disable Ctrl modifier for filtered hints.Stephen Blott
2016-03-28Change hintMarkers to @hintMarkers.Stephen Blott
hintMarkers was previously passed around (within the link-hints mode class) from function to function. With #2048 (global link hints), it is better if this becomes @hintMarkers (that is, is available directly to all methods within the class. With #2048, we used bind to avoid having to do this - to keep the diff clearer. Here, we do it directly.
2016-03-28Better names for variables.Stephen Blott
These variable names are misleading. The things being manipulated are actually hint descriptors. So this renames the variables accordingly.
2016-03-28Move LocalHints out of link-hints mode.Stephen Blott
This code (LocalHints) has been embedded into the middle of the link-hints mode class. And it shouldn't be. This moves it out, and allows us to unwind some of the gymnastics #2048 (global link hints) introduced to avoid having an incomprehensible diff.