aboutsummaryrefslogtreecommitdiffstats
path: root/content_scripts/scroller.coffee
AgeCommit message (Collapse)Author
2018-09-29Merge pull request #3111 from gdh1995/use-scroll-byStephen Blott
use Element::scrollBy if it exists
2018-09-04Revert "Add special-case rule for GMail."Stephen Blott
This reverts commit aff380669445594e7566a835d4b27f11da26ea6a. This breaks scrolling on Twitter. Needs more thought.
2018-09-04Add special-case rule for GMail.Stephen Blott
This selects the body of a message, if such is displayed.
2018-09-04Tweak #3119.Stephen Blott
1. Use verb phrase for function name. 2. Add `Scroller.reset()` method. This *only* resets the activated element. 3. Reset the scroller only if the URL has changed. (Previously, in #3119, the scroller was also being reset when the tab gained the focus.) Based on a suggestion from @marcotc.
2018-09-04Refactor, part 1Marco Costa
2018-08-31Handle scrolling on Reddit redesignMarco Costa
2018-08-27use Element::scrollBy if it existsgdh1995
2018-08-23Tweak Twitter CSS selector.Stephen Blott
2018-08-23Site-specific hack to make expanded tweets scrollable.Stephen Blott
Twitter is an important site and Vimium's scrolling is currently broken when a tweet is expanded. In my opinion, the existing bahviour is so bad and that a site-specific hack is warranted. Fixes #3045.
2017-11-18Make clear that element need not be provided here.Stephen Blott
2017-11-14Start searching for scrollable elements from <body> whenever possiblemrmr1993
2017-10-25FF: Share |root| global proxy, re-add the globals to window on DOMLoadmrmr1993
This is a workaround for Firefox bug 1408996.
2017-02-11Don't depend on global event for CoreScroller event listeners (FF)mrmr1993
2016-12-26Fix (another) infinite-scroll issue.Stephen Blott
Steps to reproduce: - Press and hold `j`. - Tab `k`. - Release `j`. The tap on `k` is uninstalling the `cancelEventListener` installed by `j`, and because we advance `@time`, the `j` stops scrolling and removes the `cancelEventListener` installed for `k`. So we end up with no `cancelEventListener` installed. The fix is to make the `cancelEventListener` specific to the scroller instance. The more fundamental problem here is that we're mixing dynamic and static state. A better approach would be to have `CoreScroller` as a class, with a new instance created for each scroll instance.
2016-10-15enterNormalMode; new command - implementationStephen Blott
Here's the problem... Many sites define their own keyboard shortcuts, for example Google Play Music defines `gh` for "go home". On such sites, it's natural to set up pass keys for `g` and `h`. But that makes any Vimium key bindings which begin with `g` inaccessible. Here, we add a new command `enterNormalMode` which installs a new normal-mode instance (without any pass keys). This executes a single normal-mode command then exits. Example: map \ enterNormalMode map | enterNormalMode count=999999 Assuming `g` and `o` are pass keys: - `gh` or `o` - use the page's binding - `\gg` - scroll to top - `2\ggo` - scroll to the top and open the Vomnibar - `\g<Escape>o` - open the Vomnibar - `\<Escape>o` - use the page's bindings - `\\\\\\<Escape>o` - use the page's bindings (new normal-mode instances displace previous ones) This required some changes to the scroller. Previously, we only ever had one normal-mode instance, and could arrange statically that the scroller's key listeners were above normal-mode's key listeners in the handler stack. Here, we fix this by adding and removing the scroller's listeners dynamically, so they're always at the top of the handler stack.
2016-09-24Tweak #2168 (scrolling via scrollingElement).Stephen Blott
Instead of setting a property of document for `scrollingElement` (if it is not defined), just use a function and make the decision dynamically instead.
2016-09-22Use document.scrollingElement for scrollingDarryl Pogue
This fixes Vimium with the 'Experimental Web Platform Features' flag enabled, and ensures compatibility across quirks mode scrolling (via document.body) and standards-compliant scrolling (via document.documentElement).
2016-04-13Add <c-y> and <c-e> for visual mode.Stephen Blott
Fixes #2092.
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-03-28Make scrollable elements selectable with hints.Stephen Blott
Fixes #425. Conflicts: content_scripts/scroller.coffee
2016-03-21Rework visual mode.Stephen Blott
- Refactor the three visual-mode modes. - Use the key-handling framework from #2022. - Strip some legacy edit-mode code. - Rename the file (the old file name was misleading). - Add "aw" and "as", previously we had the code for this from edit mode.
2016-03-16Relocate first scrollable element.Stephen Blott
When the scrollers `activatedElement` isn't scrollable, we currently search up the DOM tree for the next scrollable thing, and stop at `document.body`. However, it can be that that isn't scrollable. When that happens, this commit searches for a scrollable element in the same way as it does when the frame initially loads. This makes it possible to restart scrolling on pages like this one: - http://redux.js.org/docs/basics/UsageWithReact.html after clicking one of index links. Inspired by example posted by @marlun in #425.
2015-09-07Traverse shadow DOMs when looking for scrollable elementsmrmr1993
2015-08-22Prevent perpetual scroll.Stephen Blott
If we miss the keyup event while a smooth scroll is active (because the focus changes), then we scroll forever. This stops scrolling on blur. Fixes #1788.
2015-05-31Remove all remaining references to frontend settingsmrmr1993
2015-05-31Replace settings.get with Settings.get in the frontendmrmr1993
2015-04-28Merge pull request #1601 from mrmr1993/fix-scrollIntoViewStephen Blott
Fix bounds and amounts in Scroller.scrollIntoView
2015-04-28Ensure keydown handler returns a truthy value.Stephen Blott
2015-04-28Fix bounds and amounts in scrollIntoViewmrmr1993
2015-04-27Always cancel scrolling after additional (non-repeat) keydownsmrmr1993
This fixes #1596.
2015-04-05Note scrolling issue #1549.Stephen Blott
2015-02-09Merge branch 'visual-and-edit-modes'Stephen Blott
Conflicts: background_scripts/main.coffee content_scripts/vimium_frontend.coffee lib/keyboard_utils.coffee
2015-02-08Temporary fix for obscure scrolling bug.Stephen Blott
I'm seeing a strange scrolling bug on some pages, for example, here: http://www.steephill.tv/tour-of-qatar/. Background: When we scroll, we first have to decide which element to scroll. Because of a chrome bug, we do this by testing candidate elements: scroll the element up by one px, then back down again. If it moved, then it's scrollable, and it's the element we should scroll. Bug: In some cases, the micro-scroll-up succeeds, but the subsequent micro-scroll-down fails. It's not clear how this could happen. It may be a chrome bug. In any case, as a result, we conclude that the element is not scrollable, and proceed to the next candidate. We end up finding no scrollable element, and j/k scrolling is broken. If you press-and-hold "j" or "k", you can see the repeated micro-scroll-ups. Problem: I can't reproduce this in a clean chrome account. I only see it in my live chrome instance. I've tried disabling all extensions, but the problem persists. So there's something else at play, but I haven't yet been able to track it down. Solution: This commit is a temporary workaround. We just default to scrolling document.body if we can't find anything else to scroll. Most of the time, that's the right thing to do. And it's what we would have done prior to implementing smooth scrolling. Nevertheless, it isn't a great solution... Notes: It's possible that this is related to #1117. However, users there have reported *not* seeing the micro-scrolls. So probably not. I'm not posting this as a PR, because I can't reliably reproduce the bug. However, the fix pretty much does what we did before smooth scrolling, it's almost certainly safe. So I'm just pushing this straight into master.
2015-02-06Visual/edit modes: code cleanup.Stephen Blott
- convert getCaretCoordinates from JS to CS - handle x axis in scrollIntoView - better comments throughout.
2015-02-02Visual/edit modes: WIP, scrolling content editable.Stephen Blott
2015-01-31Revert "Fix scrolling issue."Stephen Blott
This reverts commit 90d2addc9b8f95f9272f8c2a77bdaf9dfebc0fa8. Nope. This is bad. It fixes the issue referred to in the commit record, but breaks scrolling out of text areas. With 90d2addc9b8f95f9272f8c2a77bdaf9dfebc0fa8: - Start editing in a text area, add enough text that it scrolls. - `Escape` - `k`, `k`, `k`, ... We expect first the text areas to scroll, then -- when it reaches the top -- the document to scroll. However, with 90d2addc9b8f95f9272f8c2a77bdaf9dfebc0fa8, we get stuck in the text area.
2015-01-31Revert "Fix scrolling issue."Stephen Blott
This reverts commit 90d2addc9b8f95f9272f8c2a77bdaf9dfebc0fa8. Nope. This is bad. It fixes the issue referred to in the commit record, but breaks scrolling out of text areas. With 90d2addc9b8f95f9272f8c2a77bdaf9dfebc0fa8: - Start editing in a text area, add enough text that it scrolls. - `Escape` - `k`, `k`, `k`, ... We expect first the text areas to scroll, then -- when it reaches the top -- the document to scroll. However, with 90d2addc9b8f95f9272f8c2a77bdaf9dfebc0fa8, we get stuck in the text area.
2015-01-31Fix scrolling issue.Stephen Blott
On this page: - http://www.steephill.tv/dubai-tour/ I was seeing a scrolling problem in my live browser (j/k didn't work until I clicked on the page), but couldn't reproduce it directly in my test browser. That's worrying. Nevertheless, what was happening was that we succeeded in scrolling a test amount in one direction, but the scroll to revert failed. The consequence was that we concluded (incorrectly) that the element doesn't scroll. And j/k scrolling is broken as a result. How can it be that a scroll in one direction succeeds, but the reverse does not? This fixes the problem by not checking whether we are able to undo the scroll of our test amount.
2015-01-31Fix scrolling issue.Stephen Blott
On this page: - http://www.steephill.tv/dubai-tour/ I was seeing a scrolling problem in my live browser (j/k didn't work until I clicked on the page), but couldn't reproduce it directly in my test browser. That's worrying. Nevertheless, what was happening was that we succeeded in scrolling a test amount in one direction, but the scroll to revert failed. The consequence was that we concluded (incorrectly) that the element doesn't scroll. And j/k scrolling is broken as a result. How can it be that a scroll in one direction succeeds, but the reverse does not? This fixes the problem by not checking whether we are able to undo the scroll of our test amount.
2015-01-25Visual/edit modes: visual line mode.Stephen Blott
2015-01-24Visual/edit modes: miscellaneous improvements.Stephen Blott
2015-01-23Visual/edit modes: develop edit mode.Stephen Blott
- implement "i", "a". - fix "w" for edit mode. - try out "e" for enter edit mode. - initial implementation "o", "O" - Suppress backspace and delete. - Scroll in text areas.
2015-01-22Visual/edit modes: further development.Stephen Blott
- Better abstraction. - Add HUD message on yank. - Require initial selection for visual mode. - Try to start with a visible selection. - Scroll the active end of the selection into view (with smooth scrolling, if enabled).
2015-01-10Modes; minor changes.Stephen Blott
2015-01-10Modes; instrument for debugging...Stephen Blott
- Set Mode.debug to true to see mode activation/deactivation on the console. - Use Mode.log() to see a list of currently-active modes. - Use handlerStack.debugOn() to enable debugging of the handler stack.
2014-12-29Scroller; check document.body exists.Stephen Blott
2014-12-19Also test negative direction when initializing scroller.Stephen Blott
The right scrollable element to choose may be scrolled to the bottom, so we won't find it if we only test scrolling down. We need to test scrolling up as well.
2014-12-19Delay initialization of activeElement.Stephen Blott
We could incorrectly initialize activeElement to document.body if the scroller is called too early; so delay initialization. It's safe to leave activeElement as null.
2014-12-19Initialize scroller to *largest* visible scrollable element.Stephen Blott
2014-12-19Initialize scroller to first scrollable element.Stephen Blott
See #1358.