]> git.gir.st - VimFx.git/log
VimFx.git
9 years agoMerge branch 'master' into develop
Simon Lydell [Sun, 14 Dec 2014 20:21:04 +0000 (21:21 +0100)]
Merge branch 'master' into develop

Conflicts:
extension/locale/de/vimfx.properties

9 years agoMerge branch 'develop' of github.com:akhodakivskiy/VimFx into develop
Simon Lydell [Sun, 14 Dec 2014 16:33:32 +0000 (17:33 +0100)]
Merge branch 'develop' of github.com:akhodakivskiy/VimFx into develop

9 years agoRemove legacy tests dir
Simon Lydell [Tue, 9 Dec 2014 18:45:17 +0000 (19:45 +0100)]
Remove legacy tests dir

9 years agoAdd unit tests infrastructure
Simon Lydell [Tue, 9 Dec 2014 18:44:26 +0000 (19:44 +0100)]
Add unit tests infrastructure

9 years agoAlways remove build/ and build from scratch
Simon Lydell [Sun, 7 Dec 2014 10:20:49 +0000 (11:20 +0100)]
Always remove build/ and build from scratch

This is way simpler. The only reason not to do it is speed. But for this project
there was no difference!

9 years agoConfigure coffeelint and fix lint errors
Simon Lydell [Sun, 7 Dec 2014 00:00:32 +0000 (01:00 +0100)]
Configure coffeelint and fix lint errors

9 years agoMake `require` more like Node.js
Simon Lydell [Sat, 6 Dec 2014 22:42:32 +0000 (23:42 +0100)]
Make `require` more like Node.js

- Add support for `module.exports`.
- Add support for npm modules in `require()`. Note the following differences
  with Node’s `require()` though:
  - Only `require(path)` is supported, not `require.resolve()` or related
    `module` properties etc.
  - Absolute paths (`/foo/bar.js`) are not supported.
  - Only JavaScript files may be required (not JSON files, for example). Paths
    must not end with `.js`.

Moreover:

- `module.onShutdown(handler)` is used instead of
  `require('unloader').unloader.add(handler)`.
- bootstrap.coffee has been cleaned up. I had a lot of help from looking at
  <https://github.com/adblockplus/buildtools/blob/7a305df14bf3d26ff559f06082b87ff7cff4b3b8/bootstrap.js.tmpl>
- `extension/packages/` has been renamed to the more Node-style
  `extension/lib/`.
- The huffman module has become its own repository, and is now `npm install`ed.

9 years agoAdd gulp release task
Simon Lydell [Thu, 4 Dec 2014 20:43:02 +0000 (21:43 +0100)]
Add gulp release task

9 years agoReformat changelog
Simon Lydell [Thu, 4 Dec 2014 19:13:29 +0000 (20:13 +0100)]
Reformat changelog

9 years agoCleanup .gitignore
Simon Lydell [Thu, 4 Dec 2014 17:43:11 +0000 (18:43 +0100)]
Cleanup .gitignore

9 years agoGenerate install.rdf and chrome.manifest
Simon Lydell [Wed, 3 Dec 2014 21:33:08 +0000 (22:33 +0100)]
Generate install.rdf and chrome.manifest

9 years agoReplace Makefile with gulp
Simon Lydell [Tue, 2 Dec 2014 17:39:31 +0000 (18:39 +0100)]
Replace Makefile with gulp

9 years agoMerge branch 'master' of github.com:akhodakivskiy/VimFx
Simon Lydell [Thu, 4 Dec 2014 17:39:53 +0000 (18:39 +0100)]
Merge branch 'master' of github.com:akhodakivskiy/VimFx

9 years agoRemove builds/ dir
Simon Lydell [Thu, 4 Dec 2014 17:38:43 +0000 (18:38 +0100)]
Remove builds/ dir

Github releases are used instead. All the XPIs are available at
<https://github.com/akhodakivskiy/VimFx/releases>.

9 years agoMerge pull request #426 from mineo/patch-1
Anton Khodakivskiy [Thu, 4 Dec 2014 00:34:35 +0000 (16:34 -0800)]
Merge pull request #426 from mineo/patch-1

Fix a typo

9 years agoFix a typo
Wieland Hoffmann [Wed, 3 Dec 2014 23:25:11 +0000 (00:25 +0100)]
Fix a typo

9 years agoMerge pull request #415 from mozillazg/zh-CN
Simon Lydell [Thu, 13 Nov 2014 17:02:13 +0000 (18:02 +0100)]
Merge pull request #415 from mozillazg/zh-CN

Update zh-CN localization

9 years agoMerge pull request #417 from ctype/de-locale
Simon Lydell [Thu, 13 Nov 2014 17:02:03 +0000 (18:02 +0100)]
Merge pull request #417 from ctype/de-locale

Update German locale

9 years agoUpdate German locale
Alexander Haeussler [Tue, 11 Nov 2014 17:51:10 +0000 (18:51 +0100)]
Update German locale

9 years agoUpdate zh-CN localization
mozillazg [Wed, 5 Nov 2014 03:10:26 +0000 (11:10 +0800)]
Update zh-CN localization

9 years agoChange license to GPLv3
Simon Lydell [Fri, 10 Oct 2014 16:43:05 +0000 (18:43 +0200)]
Change license to GPLv3

9 years agoMerge pull request #330 from lydell/better-hintmarkers
Simon Lydell [Tue, 7 Oct 2014 19:17:10 +0000 (21:17 +0200)]
Merge pull request #330 from lydell/better-hintmarkers

Better hintmarkers

9 years agoMerge branch 'develop' of github.com:akhodakivskiy/VimFx into develop
Simon Lydell [Tue, 7 Oct 2014 19:12:31 +0000 (21:12 +0200)]
Merge branch 'develop' of github.com:akhodakivskiy/VimFx into develop

9 years agoMerge branch 'master' into develop
Simon Lydell [Tue, 7 Oct 2014 19:11:12 +0000 (21:11 +0200)]
Merge branch 'master' into develop

9 years agoMerge pull request #385 from zhuochun/support-count-commands
Simon Lydell [Tue, 7 Oct 2014 19:09:05 +0000 (21:09 +0200)]
Merge pull request #385 from zhuochun/support-count-commands

Merged manually, in order to do everything requested in
<https://github.com/akhodakivskiy/VimFx/pull/385#issuecomment-57518289>.

9 years agoAdd count support to command_go_up_path
Simon Lydell [Sun, 5 Oct 2014 17:28:00 +0000 (19:28 +0200)]
Add count support to command_go_up_path

9 years agoAdd count support to back/forward commands
Simon Lydell [Sun, 5 Oct 2014 17:19:34 +0000 (19:19 +0200)]
Add count support to back/forward commands

9 years agoAdd count support to tab closing/restoring commands
Wang Zhuochun [Fri, 19 Sep 2014 18:01:20 +0000 (02:01 +0800)]
Add count support to tab closing/restoring commands

The current tab and count-1 tabs to the right are closed. If the current tab is
pinned, no tabs are closed at all.

9 years agoAdd count support to follow link commands
Wang Zhuochun [Mon, 15 Sep 2014 09:53:31 +0000 (17:53 +0800)]
Add count support to follow link commands

9 years agoAdd count support to tab moving commands
Simon Lydell [Sun, 5 Oct 2014 19:00:24 +0000 (21:00 +0200)]
Add count support to tab moving commands

9 years agoAdd count support to tab switching commands
Wang Zhuochun [Thu, 11 Sep 2014 15:33:52 +0000 (23:33 +0800)]
Add count support to tab switching commands

- It wraps when count = 1, the same as the original behaviour.
- It goes to the first or last tab when count exceeds boundary.

9 years agoAdd count support to scrolling commands
Simon Lydell [Tue, 7 Oct 2014 18:15:17 +0000 (20:15 +0200)]
Add count support to scrolling commands

9 years agoFix #385: Support counts
Wang Zhuochun [Wed, 10 Sep 2014 07:19:16 +0000 (15:19 +0800)]
Fix #385: Support counts

9 years agoMerge branch 'develop' of github.com:akhodakivskiy/VimFx into develop
Simon Lydell [Thu, 2 Oct 2014 17:48:50 +0000 (19:48 +0200)]
Merge branch 'develop' of github.com:akhodakivskiy/VimFx into develop

9 years agoFix #308: Don’t use modifiers in default key bindings
Simon Lydell [Thu, 2 Oct 2014 17:48:04 +0000 (19:48 +0200)]
Fix #308: Don’t use modifiers in default key bindings

9 years agoFix #393, #380: Don’t suppress Esc in browser chrome
Simon Lydell [Thu, 2 Oct 2014 17:19:51 +0000 (19:19 +0200)]
Fix #393, #380: Don’t suppress Esc in browser chrome

9 years agoMerge pull request #387 from zhuochun/issue-317-support-first-non-pinned-tab
Simon Lydell [Wed, 1 Oct 2014 19:06:49 +0000 (21:06 +0200)]
Merge pull request #387 from zhuochun/issue-317-support-first-non-pinned-tab

add command_tab_first_non_pinned

9 years agoRefactor commit 6919c1d6c slightly
Simon Lydell [Wed, 1 Oct 2014 18:44:35 +0000 (20:44 +0200)]
Refactor commit 6919c1d6c slightly

9 years agoTry points one pixel into the elements from the edges
Simon Lydell [Tue, 30 Sep 2014 19:17:04 +0000 (21:17 +0200)]
Try points one pixel into the elements from the edges

On newyorker.com, `transform: translate3d(0, 0, 0)` is applied on the
content container, to force hardware acceleration. It seems to move
everything a pixel, causing `document.elementFromPoint` to fail at the
edges of elements. This commit no longer looks exactly at the edges of
elements, but one pixel in, which seems to be a safer strategy. (The
marker is still nicely placed exactly on the edge, though.)

Example page:
http://www.newyorker.com/currency-tag/the-virtual-moleskine

9 years agoImprove markers for inline line-wrapped elements
Simon Lydell [Tue, 30 Sep 2014 18:51:27 +0000 (20:51 +0200)]
Improve markers for inline line-wrapped elements

If an inline line-wrapped element starts with a line break, its first
rect will have an area of almost zero. The marker used to end up on that
rect, seemingly on the line before the actual link, which was very
confusing. Now, such small areas are rounded to zero, and all
`visibleRects` that have a zero area are discarded, solving the problem.

An example can be found at the bottom of this page:
http://swrevisited.wordpress.com/esbr-facts/

9 years agoMerge pull request #384 from zhuochun/issue-348-link-target
Simon Lydell [Sat, 13 Sep 2014 14:46:48 +0000 (16:46 +0200)]
Merge pull request #384 from zhuochun/issue-348-link-target

Make `f` always open links in the same tab

9 years agoswap default shortcuts to match with vim
Wang Zhuochun [Thu, 11 Sep 2014 18:25:15 +0000 (02:25 +0800)]
swap default shortcuts to match with vim

9 years agoFix #348: Make f always open links in the same tab
Wang Zhuochun [Tue, 9 Sep 2014 11:54:19 +0000 (19:54 +0800)]
Fix #348: Make f always open links in the same tab

By temporarily removing `target="_blank"` from links when
simulating clicks on them.

9 years agoadd command_tab_first_non_pinned
Wang Zhuochun [Thu, 11 Sep 2014 17:09:34 +0000 (01:09 +0800)]
add command_tab_first_non_pinned

9 years agoImprove marker placement and fix related bug
Simon Lydell [Wed, 10 Sep 2014 19:01:04 +0000 (21:01 +0200)]
Improve marker placement and fix related bug

Before commit 89e1bc4 we used to recursively search the rect of an
element until it found a non-covered point; after that commit we changed
into only checking 6 simple locations of the element, for performance
reasons. However, this meant two problems:

- It was very confusing when markers ended up to the far right of
  elements. Sometimes it was difficult to understand which element the
  marker actually belonged to. Sometimes a tiny bit of the left side of
  an element was covered (possible by a _transparent_ element!) causing
  the marker to end up on the right instead, seemingly for no reason.
- Some elements are overlapped by one pixel both on the left and right
  side (such as the github pagination links), causing no marker at all
  to appear.

The solution is to use the best of both before the referenced commit and
after it. Now we check 3 (instead of 6) simple places: Only the 3 on the
left side. If the place is covered by another element, we try once to
the right of that element. So in total there may be 6 attempts, just as
before.
Author: Simon Lydell <simon.lydell@gmail.com>
Date:   Sat Aug 2 16:01:36 2014 +0200

    Improve marker generation performance

    `getFirstNonCoveredPoint` used to recursively search the rect of an
    element until it found a non-covered point. This works well most of the
    time, but on some sites (such as prisjakt.se) it took way too much time.

    Moreover, this technique required some CSS to be reset in a few special
    cases, which is very costly performance-wise. It is also brittle and
    makes the code unnecessarily complex.

    Lastly, there was a bug in the algorithm that caused uncaught exceptions
    sometimes (such as on youtube.com).

    Now we use a much simpler approach instead.

    `getFirstNonCoveredPoint` tries 6 different points of the element:

        +-------------------------------+
        |1 left-top          right-top 4|
        |                               |
        |2 left-middle    right-middle 5|
        |                               |
        |3 left-bottom    right-bottom 6|
        +-------------------------------+

    If all of those are covered (or are reported as covered because of one
    of the CSS special cases we used to reset) then the whole element is
    simply considered to be covered. This seems to work really well.

    The above means that the markers can now be placed at any of the points
    in the above figure.

    The result is much faster, simpler and more robust.

9 years agoImprove code style
Simon Lydell [Sun, 7 Sep 2014 18:03:01 +0000 (20:03 +0200)]
Improve code style

- Wrap at 80 chars.
- Comments are whole sentences.

9 years agoMerge branch 'develop' into better-hintmarkers
Simon Lydell [Sun, 7 Sep 2014 17:49:46 +0000 (19:49 +0200)]
Merge branch 'develop' into better-hintmarkers

9 years agoImprove coding style
Simon Lydell [Sun, 7 Sep 2014 17:42:20 +0000 (19:42 +0200)]
Improve coding style

- Almost all code is now wrapped at 80 chars, except a few special cases
  such as the `commands = [...]` block in commands.coffee. I didn’t
  bother to go through help.coffee and window-utils.coffee too much
  since they need rewrites anyway.
- Consistent use of parenthesis when calling functions.
- Consistent use of single quotes over double quotes.
- Consistent spacing.
- Removed unused or unnecessary code.
- Refactored unload.coffee into unloader.coffee, which should be easier
  to understand.
- Comments are now full sentences.
- This also fixes a few very minor bugs.

I’ve deliberately left out mode-hints/{hints,marker}.coffee to avoid
large merge conflicts with #330.

9 years agoAdd missing style rules
Simon Lydell [Sun, 7 Sep 2014 11:09:02 +0000 (13:09 +0200)]
Add missing style rules

9 years agoRe-add `<em:type>` to install.rdf
Simon Lydell [Sun, 7 Sep 2014 11:03:23 +0000 (13:03 +0200)]
Re-add `<em:type>` to install.rdf

It isn’t needed for extensions and themes, but AMO reviews strongly
recommend it anyway.

9 years agoMerge branch 'develop'
Simon Lydell [Sun, 7 Sep 2014 10:56:17 +0000 (12:56 +0200)]
Merge branch 'develop'

9 years agoAdd CONTRIBUTING.md
Simon Lydell [Sun, 7 Sep 2014 10:56:11 +0000 (12:56 +0200)]
Add CONTRIBUTING.md

9 years agoSuppress non-hintchars key presses in hints mode
Simon Lydell [Thu, 21 Aug 2014 15:17:15 +0000 (17:17 +0200)]
Suppress non-hintchars key presses in hints mode

They used to be passed along to the browser, which could confusingly
activate site commands, as described in #371.

9 years agoFix typo in changelog
Simon Lydell [Sat, 16 Aug 2014 16:10:01 +0000 (18:10 +0200)]
Fix typo in changelog

9 years agoEnhance marker frame handling
Simon Lydell [Sat, 16 Aug 2014 15:54:35 +0000 (17:54 +0200)]
Enhance marker frame handling

Previously the frame elements themselves were required to get a marker
in order to make markers for any elements inside the frame, which was
pretty confusing. Now all frames visible in the viewport are gone
through to add markers their elements.

9 years agoRelease v0.5.14 v0.5.14
Simon Lydell [Sat, 16 Aug 2014 14:30:09 +0000 (16:30 +0200)]
Release v0.5.14

9 years agoMerge pull request #367 from lydell/autofocus-tab-switch-back
Simon Lydell [Sat, 16 Aug 2014 14:21:30 +0000 (16:21 +0200)]
Merge pull request #367 from lydell/autofocus-tab-switch-back

Fix #366: Allow autofocus when switching back to a tab

9 years agoMerge pull request #369 from pluser/localize_ja
Simon Lydell [Sat, 16 Aug 2014 11:52:07 +0000 (13:52 +0200)]
Merge pull request #369 from pluser/localize_ja

Add Japanese localization

9 years agoLocalize to ja(Japanese)
Kaoru Esashika [Sat, 16 Aug 2014 09:13:58 +0000 (18:13 +0900)]
Localize to ja(Japanese)

9 years agoMerge branch 'develop' of github.com:akhodakivskiy/VimFx into develop
Simon Lydell [Wed, 13 Aug 2014 19:43:41 +0000 (21:43 +0200)]
Merge branch 'develop' of github.com:akhodakivskiy/VimFx into develop

9 years agoFix #366: Allow autofocus when switching back to a tab
Simon Lydell [Wed, 13 Aug 2014 19:38:36 +0000 (21:38 +0200)]
Fix #366: Allow autofocus when switching back to a tab

If a text input is focused and you switch to another window or tab
Firefox blurs the text input. When you switch back to the tab, Firefox
automatically focuses the text input again. Those focus events should be
allowed.

9 years agoMerge pull request #365 from lydell/refactor-l10n
Simon Lydell [Tue, 5 Aug 2014 03:25:56 +0000 (05:25 +0200)]
Merge pull request #365 from lydell/refactor-l10n

Refactor l10n. Fix #363

9 years agoAdd missing entity in zh-TW locale
Simon Lydell [Mon, 4 Aug 2014 18:17:40 +0000 (20:17 +0200)]
Add missing entity in zh-TW locale

9 years agoRefactor l10n. Fix #363
Simon Lydell [Sun, 3 Aug 2014 18:47:00 +0000 (20:47 +0200)]
Refactor l10n. Fix #363

Helpful links:

- <https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIStringBundleService>
- <https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIStringBundle>
- <https://github.com/adblockplus/adblockplus/blob/03b965c743f7688622b75b0e7525a17913d7e0ea/chrome/content/ui/i18n.js>

9 years agoUpdate install.rdf
Simon Lydell [Sun, 3 Aug 2014 18:12:42 +0000 (20:12 +0200)]
Update install.rdf

9 years agoMerge branch 'master' into develop
Simon Lydell [Sun, 3 Aug 2014 18:04:19 +0000 (20:04 +0200)]
Merge branch 'master' into develop

9 years agoMerge pull request #362 from Kambfhase/update-german-locale
Simon Lydell [Sun, 3 Aug 2014 11:06:43 +0000 (13:06 +0200)]
Merge pull request #362 from Kambfhase/update-german-locale

updates german locale

9 years agoMerge pull request #361 from mozillazg/patch-1
Simon Lydell [Sun, 3 Aug 2014 03:35:59 +0000 (05:35 +0200)]
Merge pull request #361 from mozillazg/patch-1

Update zh-CN localization

9 years agoUpdate zh-CN localization
mozillazg [Sun, 3 Aug 2014 00:06:51 +0000 (08:06 +0800)]
Update zh-CN localization

9 years agoupdates german locale
Kambfhase [Sat, 2 Aug 2014 21:23:59 +0000 (23:23 +0200)]
updates german locale

Localised some more UI strings to german. However, some descriptions are
still in english and not all translations are displayed. The latter will
be investigated separately.

9 years agoImprove marker generation performance
Simon Lydell [Sat, 2 Aug 2014 14:01:36 +0000 (16:01 +0200)]
Improve marker generation performance

`getFirstNonCoveredPoint` used to recursively search the rect of an
element until it found a non-covered point. This works well most of the
time, but on some sites (such as prisjakt.se) it took way too much time.

Moreover, this technique required some CSS to be reset in a few special
cases, which is very costly performance-wise. It is also brittle and
makes the code unnecessarily complex.

Lastly, there was a bug in the algorithm that caused uncaught exceptions
sometimes (such as on youtube.com).

Now we use a much simpler approach instead.

`getFirstNonCoveredPoint` tries 6 different points of the element:

    +-------------------------------+
    |1 left-top          right-top 4|
    |                               |
    |2 left-middle    right-middle 5|
    |                               |
    |3 left-bottom    right-bottom 6|
    +-------------------------------+

If all of those are covered (or are reported as covered because of one
of the CSS special cases we used to reset) then the whole element is
simply considered to be covered. This seems to work really well.

The above means that the markers can now be placed at any of the points
in the above figure.

The result is much faster, simpler and more robust.

9 years agoFix typo in pl locale
Simon Lydell [Sat, 2 Aug 2014 10:35:21 +0000 (12:35 +0200)]
Fix typo in pl locale

9 years agoRelease v0.5.13 v0.5.13
Simon Lydell [Sat, 2 Aug 2014 10:27:37 +0000 (12:27 +0200)]
Release v0.5.13

9 years agoMerge pull request #360 from lydell/last-interaction
Simon Lydell [Sat, 2 Aug 2014 10:04:54 +0000 (12:04 +0200)]
Merge pull request #360 from lydell/last-interaction

Only allow focus events immediately after an interaction

9 years agoDisallow adding conflicting shorcuts
Simon Lydell [Sun, 27 Jul 2014 18:09:20 +0000 (20:09 +0200)]
Disallow adding conflicting shorcuts

This has tripped a lot of users up. See #268, #359, #333, #283.

9 years agoFix #103: Make image zoom toggle keyboard accessible
Simon Lydell [Sun, 27 Jul 2014 10:33:52 +0000 (12:33 +0200)]
Fix #103: Make image zoom toggle keyboard accessible

When navigating directly to an image, and the image does not fit the
screen, it is re-sized so it does. The mouse cursor becomes a magnifying
glass when hovering the image. By clicking you can toggle between native
and re-sized.

As discussed in #355, to keep things simple we now make such images
markable. Using the default mappings and hintchars, the shortcut to
toggle zoom then becomes 'ff'.

This commit is based on #104 by @LordJZ.

Example image:
<http://upload.wikimedia.org/wikipedia/commons/e/e2/Rain_ot_ocean_beach.jpg>

9 years agoRemove invalid/unnecessary option descriptions
Simon Lydell [Sun, 27 Jul 2014 09:53:20 +0000 (11:53 +0200)]
Remove invalid/unnecessary option descriptions

9 years agoOnly allow focus events immediately after an interaction
Simon Lydell [Thu, 19 Jun 2014 21:17:54 +0000 (23:17 +0200)]
Only allow focus events immediately after an interaction

Replace the autofocus prevention with suppressing _all_ focus events
that didn’t happen directly after an interaction (keypress or click)
with the page.

Strictly speaking, autofocus may only happen during page load, which
means that we should only prevent focus events during page load.
However, it is very difficult to reliably determine when the page load
ends. Moreover, a page may load very slowly. Then it is likely that the
user tries to focus something before the page has loaded fully.
Therefore focus events that aren’t reasonably close to a user
interaction (click or key press) are blurred (regardless of whether the
page is loaded or not -- but that isn’t so bad: if the user doesn’t like
autofocus, he doesn’t like any automatic focusing, right? This is
actually useful on devdocs.io). There is a slight risk that the user
presses a key just before an autofocus, causing it not to be blurred,
but that’s not likely. Lastly, the autofocus prevention is restricted to
`<input>` elements, since only such elements are commonly autofocused.
Many sites have buttons which inserts a `<textarea>` when clicked (which
might take up to a second) and then focuses the `<textarea>`. Such focus
events should _not_ be blurred.

9 years agoMerge pull request #343 from lydell/better-find-mode
Simon Lydell [Sun, 27 Jul 2014 09:58:16 +0000 (11:58 +0200)]
Merge pull request #343 from lydell/better-find-mode

Better find mode

9 years agoMerge pull request #354 from sirodoht/greek-locale
Simon Lydell [Fri, 25 Jul 2014 11:31:24 +0000 (13:31 +0200)]
Merge pull request #354 from sirodoht/greek-locale

Update greek translation

9 years agoUpdate greek translation
Theodore Keloglou [Wed, 16 Jul 2014 14:35:55 +0000 (17:35 +0300)]
Update greek translation
Translate prevent_autofocus strings

9 years agoHandle a `line-height` special case
Simon Lydell [Sun, 15 Jun 2014 19:22:41 +0000 (21:22 +0200)]
Handle a `line-height` special case

Consider the following HTML:

    <p><a href=#>Link text</a></p>

And the following CSS:

    p {
      line-height: 20px;
      font-size: 20px;
      overflow: hidden;
    }
    a {
      font-size: 80px;
    }

Result, with the rectangles of the elements drawn:

    +---------+
    |         |
    |---------+-----------+
    |Link text|           |
    |---------------------+
    |         |
    +---------+

The wide rectangle belongs to the `<p>` while the other belongs to the
`<a>`. The top and bottom part of the `<a>` rectangle, outside of the
`<p>` rectangle (because the `font-size` of `<a>` is larger than the
`line-height`), are hidden due to `overflow: hidden;`.
`document.elementFromPoint()` will only return `<a>` in the area covered
by both rectangles. That is a problem since we start looking at the
top-left corner of the `<a>` rectangle, which will return whatever is
behind.

The solution is to add `line-height: normal;` temporarily to `<a>`,
causing the following (with a comparison to the right):

                               /    +---------+
                               /    |         |
    +---------------------+    /    |---------+-----------+
    |Link text            |    /    |Link text|           |
    |                     |    /    |---------------------+
    |                     |    /    |         |
    |                     |    /    +---------+
    |                     |    /
    +---------------------+    /

This way we can get the correct coordinates, but we only do it as a last
resort, since it is a performance expensive operation.

9 years agoBetter handling of pseudo-elements
Simon Lydell [Sun, 15 Jun 2014 17:22:39 +0000 (19:22 +0200)]
Better handling of pseudo-elements

9 years agoUse a `WeakMap` in `utils.Bucket`
Simon Lydell [Sun, 15 Jun 2014 15:30:04 +0000 (17:30 +0200)]
Use a `WeakMap` in `utils.Bucket`

9 years agoImprove find mode. Fix #342. Better Esc handling.
Simon Lydell [Sun, 15 Jun 2014 14:10:52 +0000 (16:10 +0200)]
Improve find mode. Fix #342. Better Esc handling.

Previously, find mode only worked if you used VimFx's shortcuts to enter
it. If you opened the find bar some other way, you weren't able to end
the search using Enter, and the n/N commands wouldn't repeat what you
just searched for.  Now, find mode is entered as soon as the findbar
input gets focused, no matter how it was focused. Find mode is also
exited as soon as the findbar input is blurred. Previously, if you
happened to unfocus the findbar without using Esc or Enter, such as
clicking or tabbing away, then you'd still be in find mode, making all
keypresses focus the findbar input rather than activate commands.

If the active element is editable during a keypress we used to pass that
keypress along to the browser -- regardless of the current mode --
instead of activating commands. The findbar input is also an editable
element, but when it is focused we want Enter to close the findbar.
Therefore we used to not pass along Enter to the browser. If the user
mapped Enter to a command, that meant that it would be impossible to
press enter in an input to type a newline, submit a search query, etc.
Now, we only use this automatic insert mode in normal mode instead.

The above also fixed another problem. We used to always pass Esc to the
browser in normal mode, even if Esc is mapped to a command. Now, that is
not done if we’re blurring an element. That makes it possible to blur an
input inside a custom dialog without closing it (Esc almost always
closes custom dialogs).  This makes it possible to use devdocs.io with
VimFx, which was very difficult before.

9 years agoDocument commit 1b874f1b7b3
Simon Lydell [Sun, 15 Jun 2014 09:20:34 +0000 (11:20 +0200)]
Document commit 1b874f1b7b3

9 years agoMerge pull request #341 from akhodakivskiy/next-prev-matching
Anton Khodakivskiy [Fri, 13 Jun 2014 04:46:34 +0000 (21:46 -0700)]
Merge pull request #341 from akhodakivskiy/next-prev-matching

next/prev commands

9 years agofix recursion in isElementGoogleEditable impl
Anton Khodakivskiy [Thu, 12 Jun 2014 23:40:33 +0000 (16:40 -0700)]
fix recursion in isElementGoogleEditable impl

9 years agoBetter check for Google g_editable in isElementEditable that fixes some issues in...
Anton Khodakivskiy [Thu, 12 Jun 2014 20:16:09 +0000 (13:16 -0700)]
Better check for Google g_editable in isElementEditable that fixes some issues in Gmail

9 years agonext/prev commands - search for patterns in element attributes as well. Currenty...
Anton Khodakivskiy [Wed, 11 Jun 2014 00:17:14 +0000 (17:17 -0700)]
next/prev commands - search for patterns in element attributes as well. Currenty optimized for Gmail

9 years agoFix #334: Make links without `href` markable
Simon Lydell [Wed, 4 Jun 2014 17:43:56 +0000 (19:43 +0200)]
Fix #334: Make links without `href` markable

Commit be94b559b:

> - Only `<a>` elements with a `href` attribute should be matched, since
>   HTML5 allows `<a>` elements to omit `href`:
>
>   > If the a element has no href attribute, then the element represents
>   > a placeholder for where a link might otherwise have been placed, if
>   > it had been relevant, consisting of just the element's contents.
>
>   Reference:
>   <http://developers.whatwg.org/text-level-semantics.html#the-a-element>

That’s the spec. In the reality, people use all sorts of weird markup.
Some sites (such as StackExchange sites) leave out the `href` property
and use the anchor as a JavaScript-powered button (instead of just using
the `button` element).

This commit reverts the change to link matching in be94b559b. A side
effect is that sites using links without `href` in compliance with the
spec will get extranous markers for those links. It’s better to show too
many markers than too few, though.

9 years agoImprove code readability
Simon Lydell [Mon, 2 Jun 2014 19:13:44 +0000 (21:13 +0200)]
Improve code readability

9 years agoBuild 0.5.12 v0.5.12
Simon Lydell [Sun, 1 Jun 2014 19:05:03 +0000 (21:05 +0200)]
Build 0.5.12

9 years agoVersion bump and changelog update
Simon Lydell [Sun, 1 Jun 2014 19:04:09 +0000 (21:04 +0200)]
Version bump and changelog update

9 years agoFix: Autofocus prevention got stuck by navigating the history
Simon Lydell [Sun, 1 Jun 2014 18:59:35 +0000 (20:59 +0200)]
Fix: Autofocus prevention got stuck by navigating the history

Either going forward and backward in the history, or using
`history.pushState()` caused the autofocus prevention to get stuck,
making it impossible to focus inputs.

9 years agoAdd hints to elements with only floated/absolute children
Simon Lydell [Sun, 1 Jun 2014 14:33:56 +0000 (16:33 +0200)]
Add hints to elements with only floated/absolute children

Commit a3cb61bf:

> - We used to take care of the case where markable elements have no area
>   since all of the children are floated and/or absolutely positioned.
>   For performance I’ve removed that. Let’s re-add it if we find some
>   website that needs it. The old implementation used the computed style
>   for this, which has turned out to be really slow.

Since then I _have_ found such cases. A link in a menu could contain a
span of text floated to the left and an icon floated to the right.

So I’ve re-added support. Best of all, with better performance than the
old implementation; computed style is _not_ used.

It turns out that if the width _and_ the height of an element is 0 (thus
making the area 0, too) it is really hidden. But if only one of the
width and height is 0 (also making the area 0), then it is because
everything inside it is floated and/or absolutely positioned (and that
`element` hasn’t been made to “contain” the floats). Then there’s no
need to check any computed style. Just recursively test each child until
a visible one is found and return its shape instead of the parent.

The reasoning behind choosing the first visible child is as follows:

- It’s the best bet for the cases with menu items I found. We want the
  marker at the beginning of the menu item. The text spans, floated to
  the left, are likely the first children.

- We _could_ add the same hint to _all_ the visible children. But that’s
  a bad idea for a couple of reasons:

  - It would be inconsistent with all other elements. Even elements with
    an area can contain floated elements, which are also clickable. But
    those do not get any hints. (It would be too expensive
    performance-wise to give them hints, for no real benefit.) Therefore
    we shouldn’t do it in this case either.
  - In the found cases with menu items we only want _one_ hint, for the
    whole menu item. We should optimize for the likely cases.
  - It would be unnecessarily complex and slow.

9 years agoBuild version 0.5.11 v0.5.11
Simon Lydell [Sun, 1 Jun 2014 11:36:39 +0000 (13:36 +0200)]
Build version 0.5.11

9 years agoVersion bump and changelog update
Simon Lydell [Sun, 1 Jun 2014 11:34:59 +0000 (13:34 +0200)]
Version bump and changelog update

9 years agoMerge pull request #322 from lydell/fix-autofocus
Simon Lydell [Sun, 1 Jun 2014 10:53:51 +0000 (12:53 +0200)]
Merge pull request #322 from lydell/fix-autofocus

Fix autofocus

9 years agoImprove marker generation. Fix #325.
Simon Lydell [Fri, 30 May 2014 09:29:36 +0000 (11:29 +0200)]
Improve marker generation. Fix #325.

- Elements covered by other elements do no longer get hints. This makes
  it easier to use drop-down menus when there are lots of links behind
  it.

- Elements partly outside the screen now get hints, too.

- Partly covered elements get hints, too. The hint is placed in the
  first non-covered point of the element.

- Line-wrapped links now get their hint in a better place. This is
  easiest to explain with a picture. # = old hint location, * = new hint
  location (approximately)

  #---------+
  |   *Line-|
  |wrapped  |
  +---------+

  Such links also used to count the whole of that box as its area. Now
  only the actual text is counted, giving the marker a more fair weight.

- We used to take care of the case where markable elements have no area
  since all of the children are floated and/or absolutely positioned.
  For performance I’ve removed that. Let’s re-add it if we find some
  website that needs it. The old implementation used the computed style
  for this, which has turned out to be really slow.

- We used to check if elements were hidden with CSS (if `opacity: 0;` or
  `visibility: hidden;`), but we don’t anymore, since it noticeably
  slows down the marker creation (checking computed styles is slow). It
  does not appear to be necessary anymore. It was added to fix #164, but
  the problems there now seem fixed even without this check.

- The code should be more documented now than before.

- The performance is better than before. It does not seem like the new
  algorithms are slower. And since I’ve removed two slow areas, it might
  be a little faster.

Imprint / Impressum