[webkit-dev] Curses port?

Alp Toker alp at nuanti.com
Sun Jan 19 11:18:59 PST 2014


On 19/01/2014 18:51, Shea Levy wrote:
> Hi Alp,
>
> On Sun, Jan 19, 2014 at 06:43:10PM +0000, Alp Toker wrote:
>> On 19/01/2014 18:34, Shea Levy wrote:
>>> Hi all,
>>>
>>> I'd like to have a browser that can be used from the terminal but
>>> actually supports modern HTML, js, etc. to the extent that is reasonable
>>> for a console. It seems no such browser currently exists, so I was
>>> thinking about trying to port webkit to use a curses backend. Is such a
>>> thing a reasonable project? Ideally I'd just be able to plug some
>>> rendering logic on top of an unmodified webkit core...
>> HI Shea,
>>
>> It is possible as a full-blown port, but moreover would be straightforward
>> to get done using just the standard API and DOM binding of any existing port
>> that supports operation without an on-screen view.
>>
> Ah, great! Can you give me a pointer to how to get started with such
> existing ports? Particularly interested in running on Linux,

A simple implementation would use the ordinary ordinary load 
WebView/WebFrame resource load functions (load_uri), then access the DOM 
(get_dom_document) and iterate through nodes, converting them to text 
and hyperlinks to be represented in your curses UI. Hook into ordinary 
DOM mutation events to update the text UI if the port doesn't have more 
suitable callbacks.

If you want something like classic 'lynx' you're basically already there 
at that point. If you want to get layout like 'w3m' that's obviously 
more work but you can still get there using layout positions from the DOM.

The best way to think about this assuming you're more familiar with web 
programming is "How would I implement this in JavaScript using the W3 
DOM?" -- then port the logic to native code.

> ideally without bringing in dependencies on gtk or qt.

As for dependencies, it's a cost/benefit weigh-off and the cost of 
maintaining a port is very high.

There's very little runtime overhead to having something like GTK+ in 
the background, or even Mac WebView with a hidden view. There are also 
some out-of-tree ports focusing on headless operation -- I'm sure 
someone will be able to advise if you go that route.

Alp.


>
>> Alp.
>>
> Cheers,
> Shea
>
>>> Cheers,
>>> Shea Levy
>>> _______________________________________________
>>> webkit-dev mailing list
>>> webkit-dev at lists.webkit.org
>>> https://lists.webkit.org/mailman/listinfo/webkit-dev
>> -- 
>> http://www.nuanti.com
>> the browser experts
>>

-- 
http://www.nuanti.com
the browser experts



More information about the webkit-dev mailing list