Wykres commitów

91 Commity (82dd8dda4527c37046be7f701679cffc0ba972a9)

Autor SHA1 Wiadomość Data
Thomas Buckley-Houston 707a433385 Better rules for finding input boxes
Google maps doesn't use a [type=text], or any kind of type attribute for
its search box. Plus it also has a [aria-hidden=true] input box that
Browsh was detecting and covering the actual active search box.
2018-06-05 15:25:57 +08:00
Thomas Buckley-Houston e937f81a60 Added shortcut to toggle a mobile user agent 2018-06-05 14:40:03 +08:00
Thomas Buckley-Houston 5b575110b1 Include role="textbox" elements as an input boxes
This just about allows you to use Gmail
2018-06-04 21:29:43 +08:00
Thomas Buckley-Houston 07fd062510 Stackoverflow.com-related fixes
Stackoverflow surfaced a few bugs;

1. For some unknown reason it measures the em value of a single
character as having something like 10,000 pixels width. So for now I'm
just hardcoding the standard measurement of 9x15 for unreasonably large
widths.

2. Its cookie banner used `position: fixed !important`, so needed to
update the sticky fix code in case other sites do the same.

3. The cookie banner with the aplied sticky fix meant that the div just
sat staticlly in the middle of the DOM obscuring other text. So I
started a list of site-specific CSS specifics.
2018-06-04 21:01:46 +08:00
Thomas Buckley-Houston eb1176b8c3 Fixes for text that clobbers other text
During the text builder process its possible that a character tries to
fit onto a TTY cell that already has a character. There are multiple
reasons for this, the main one being hidden text. This commit changes
the method for deciding the priority of character to using the
`elementFromPoint(x, y)` method.

This commit also includes a fix to re-parse all text when there's a
mousedown event.
2018-06-04 20:03:59 +08:00
Thomas Buckley-Houston e2d39ba56c Prevent sticky elements from being sticky
Sticky elements are, for example, those headers that follow you
down the page as you scroll. They are annoying even in desktop
browsers, however because of the lower frame rate of Browsh, sticky
elements stutter down the page, so it's even more annoying. Not to
mention the screen real estate that sticky elements take up, which
is even more noticeable on a small TTY screen like Browsh's.
2018-06-04 17:52:00 +08:00
Thomas Buckley-Houston 7232ac120f Bug fix: improved line formatting
There was a long standing problem where random gaps would appear
between lines. The fix was to change a magic number that adds an extra
few pixels to the reported height of the 'em' character dimensions.
Unfortunately I don't know what this magic number actually does. It
might represent the distance between lines?
2018-06-04 17:02:15 +08:00
Thomas Buckley-Houston 72c74f1905 Fixes bug in HTTP Service rendering
I think with the recent change to the method of hiding text by using a
dedicated blank font, the initial page load and parsing (upon which the
HTTP Service very much depends), browser window resizes were causing a
delay in the time taken for text to be properly parsed, resulting in
mostly empty raw text pages.

The fix was to ensure that the BlankMono.ttf font was loaded with the
initial page load, by using the webextensions injected style.css file.
2018-06-04 15:51:47 +08:00
Thomas Buckley-Houston cc23f0ab3e Increased big text frames to size 6
That's that frames 6 times as big as the TTY are passed at once. This
lessens the likelihood of catching a glimpse of unparsed webpage as
you're scrolling down quickly.
2018-06-03 20:06:33 +08:00
Thomas Buckley-Houston 02bc0aad93 Hide/Show text using seperate font
Previously we were using CSS to make the text's colour transparent.
However that proved to cause a lot of problems with pre-existing
transition animations in the host webpage. There didn't seem to be
anyway to disable the transition time for text transitioning to
transparent, without also disabling all transitions.

Also added censorship to password input boxes.
2018-06-03 19:54:38 +08:00
Thomas Buckley-Houston 55c70d9e5e Multiline text input boxes
No doubt a lot of this code is reinventing the wheel, after all this is
basically now a simple text editor. I'm sure there'll be a few bugs to
iron out.
2018-06-02 18:47:37 +08:00
Thomas Buckley-Houston b78abbf26f Overflow scrolling for single line input boxes
Such a basic thing, that we take it for granted. But it's actually a bit
tricky to implement.
2018-05-28 22:03:33 +08:00
Thomas Buckley-Houston 0fc39a51e6 HTTP Server service: fetches URL, returns raw text
Using the `-http-server` argument will now start Browsh in HTTP Server
mode. It will accept request like this:

  `curl brow.sh/http://news.ycombinator.com`

This will return a plain text version of the Hacker News front page,
with a width of 100 characters, with each line separated by a line
break.
2018-05-27 20:45:43 +08:00
Thomas Buckley-Houston 4b84d52ae1 Backspace goes back in history
Also:
  * Use webextension to navigate URLs instead of the DOM. This means
    that crashed pages can still be navigated away from.
  * An attempt to implement mouse dragndrop, but it doesn't work :(
2018-05-25 18:48:57 +08:00
Thomas Buckley-Houston 5c7ff71c79 Input boxes, for searches, logins, writing, etc
Input boxes are currently only one line and to not properly wrap. So
textareas are also one line. TBC...

Also includes:
  * First implementation of the DOM MutationObserver. This needs to have
    an eye kept on it in case some websites trigger too mutatation
    events. For now it doesn't seem too bad. Although strangely it seems
    to stop on Youtube after about 15 seconds.
2018-05-20 21:17:33 +08:00
Thomas Buckley-Houston 9dc0f0a08f Webext: default to hiding text in webext
Text in the real browser only needs to be displayed when parsing with
the Text Builder in order to get the text's colour and z-index. Text
parsing should be done in frequently as it likely doesn't change often.
However graphics building of the current viewport is set to
automatically parse ever 250ms and it doesn't need to know anything
about text. So there's no point defaulting to having text on and hiding
it for every graphics frame.

This tweak has improved the perforance of the graphics parsing for small
frames (the same size as the viewport) from around 100ms to around 4ms!

There are still some curious and inexplicable CPU spikes when
scrolling... TBC
2018-05-08 14:07:54 +08:00
Thomas Buckley-Houston fff7c2e413 Only parse text that is within a sub-frame
This improves the performance of parsing and rendering text
2018-05-08 13:45:22 +08:00
Thomas Buckley-Houston 7a8811c526 Webext can now reconnect to a re-opened TTY
Albeit it is quite slow to notice the re-opened TTY client :/
2018-05-08 13:30:08 +08:00
Thomas Buckley-Houston dd4a29f04a Send 'sub-frames' rather than the whole DOM
Firstly, this improves performance on a larger pages. But it also
prevents browser crashes a very large pages by setting a limit to how
much work is done per frame.

Also includes:
  * Thread safe cell map for simultaneously reading and writing to the
    buffered frame of TTY cells.
  * Improved webext tests so that they programmaticlly build DOM rects
    based off simple text strings.
2018-05-05 16:43:10 +08:00
Thomas Buckley-Houston ae44a18cfc Moved URL bar input and mono mode toggle to CLI
Finally fixes integration tests
2018-04-28 19:02:40 +08:00
Thomas Buckley-Houston b605965e77 Move UI building to CLI
* CLI is now prepared for supporting multiple tabs.
  * Refactored global vars into relevant files
  * Now using real types in JSON sent to CLI
  * Still doesn't fix integration tests
2018-04-28 12:18:34 +08:00
Thomas Buckley-Houston ba5ce3c58b Move frame building from webext to CLI
This offloads significant CPU load from the browser. However it's become
clear that the previous feature of parsing the entire DOM needs to have
an upper limit imposed. For instance large Wikipedia pages still cause
problematic CPU load.

This commit does not fix the broken UI so integration tests fail.
2018-04-22 22:59:00 +08:00
Thomas Buckley-Houston c0f5fcca69 Compose frames of whole DOM, for faster scrolling
Instead of mirroring the browser's viewport, as if we had a camera over
the browser, the entire DOM is now sent in the frame. This means that
the CLI itself can scroll without having to wait for updates from the
webextension screenshotter.
2018-04-18 21:11:04 +08:00
Thomas Buckley-Houston 5b6cc89770 Refactored webext classes to be more SRP
The biggest refactor is separating out the DocumentBuilder from the DOM
Manager.

I also made consistent use of the mixin pattern I'd only half
implemented.
2018-04-09 18:36:46 +08:00
Thomas Buckley-Houston 1acb178fa7 Lots of new integration tests 2018-04-07 11:35:17 +08:00
Thomas Buckley-Houston 8b042b2479 Added PAGEUP and PAGEDOWN key movement 2018-02-17 15:02:50 +08:00
Thomas Buckley-Houston b5a083e929 Replaced Termbox-go with Tcell
This was primarily to get native diff'ed frame rendering.
Termbox-go doesn't support true colours, thus the switch to Tcell, but
as it turns out Tcell claims to have wider platform support, so it looks
like an especially good change.

So now the CLI will only try to update the terminal screen when cells
actually change. This has some significant performant gains, especially
when using Browsh over SSH.

Also note that this required a complete change of the frame data
structure sent over the websocket. Previously it was a little
structured, but now it is just a plain 1 dimensional array of pure
strings, even the RGB components are sent as integers in strings. If I
can find a way to unmarshal mixed arrays in  Golang then it'll be worth
sending a mixed JSON array to save some compute overhead.
2018-02-14 10:33:39 +08:00
Thomas Buckley-Houston bb313f568a Added a monochrome mode: ALT+M to toggle
TODO: Still needs a way to represent clickable text
2018-02-09 11:13:33 +08:00
Thomas Buckley-Houston 819a29c8b6 Mouse wheel scrolling
Also throttle the frame rate to 40ms/ Previously it was redrawing on
every sent STDIN event.
2018-02-09 10:06:54 +08:00
Thomas Buckley-Houston cdab6bde93 Bugfixes to Dockerfile 2018-02-02 17:20:37 +08:00
Thomas Buckley-Houston afca0dd468 Auto-reload a tab if it doesn't connect to webext 2018-02-01 23:15:34 +08:00
Thomas Buckley-Houston 74538fed0e Fix for zero-width chars in page titles
Also removes the Mozilla Cliqz disclaimer tab on first startup.
Interestingly it has a carriage return in its HTML page title, which is
of course zero-width. But also the fact that this tab can sometimes load
before the requested tab at startup is a showstopper for automated
tests.
2018-01-31 15:40:43 +08:00
Thomas Buckley-Houston 0b3ff030cd Release v0.2.3 2018-01-30 17:50:55 +08:00
Thomas Buckley-Houston 318f5c3c34 First draft of integration tests 2018-01-23 20:04:23 +08:00
Thomas Buckley-Houston ef5c683591 Back and stop button 2018-01-17 15:52:52 +08:00
Thomas Buckley-Houston 4177bff127 First draft of mouse down/up/click support 2018-01-17 11:00:37 +08:00
Thomas Buckley-Houston 3fc70e6718 Basic z-layer detection for clobbered characters 2018-01-15 12:06:05 +08:00
Thomas Buckley-Houston 64431be7c3 First pass at supporting wide UTF8 chars like 中文 2018-01-14 22:29:08 +08:00
Thomas Buckley-Houston 97a36b68b4 First drafy of UI: tabs and URL bar 2018-01-12 21:58:32 +08:00
Thomas Buckley-Houston ad59dc3ce4 Basic up/down scrolling 2018-01-11 12:22:27 +08:00
Thomas Buckley-Houston d2aaa33963 Refactored webext background script 2018-01-10 22:54:51 +08:00