edbrowse-dev - development list for edbrowse
 help / color / mirror / Atom feed
From: Karl Dahlke <eklhad@comcast.net>
To: Edbrowse-dev@lists.the-brannons.com
Subject: [Edbrowse-dev] Parallel versions of js access functions
Date: Sun, 27 Sep 2015 00:42:53 -0400	[thread overview]
Message-ID: <20150827004253.eklhad@comcast.net> (raw)

As you know, ebjs.c has functions that act as a layer between edbrowse and the js world.
They send requests to edbrowse-js and receive responses,
and pass them back to the calling function.
Here is the flow of events.
Parse the html text courtesy of tidy,
build our own tree of nodes,
decorate that tree by calling functions in ebjs.c
to instantiate objects and create properties etc,
then, eventually, render the tree.
All good, but as mentioned before, we may need to generate and decorate a
subtree from inside javascript at the moment foo.innerHTML is set to a string.
so the same procedure takes place in edbrowse-js under the control of a setter.
To that end, I now have native copies of many of these layer functions.
Most of these functions were there already, I just had to do a little trickery
so they have the same names as those in ebjs.c.
What's the point?
All the code that decorates the html tree can be shared.
It calls set_property_string(inputTag, "value", val)
for example, and in edbrowse,
when decorating the nodes of the original web page,
that function passes the request over to edbrowse-js and receives an ack.
Inside the edbrowse process, when parsing the html assigned to
foo.innerHTML, the function simply runs native code to make the assignment.

This approach assumes we are going to leave the two processes separate,
as they already are.
That allows for separate layer functions with the same arguments and returns.
That's probably the best path.

Course there's more to do here.
render.c has to be separated into two files,
render.c and decorate.c
The first is true to its name, rendering a tree for the text buffer,
the second generates and decorates a tree with js objects.
The second would be included in both processes,
like stringfile.c etc.
html-tidy.c would also be shared in both processes.
And of course both would have to link with the tidy library.
So code might be moving around a bit.
A commit may say I inserted and deleted 500 lines,
but it's not really that drastic; just rearranging things.

Kevin do you think document.write is similar to innerHTML
in that it is suppose to take effect immediately?
html is parsed and js objects created,
and made available by the next line of the running javascript?
I actually hope the answer is yes,
cause if we're going to go through all this redesign
to make it happen for innerHTML, then document.write
may as well go along for the ride.

Karl Dahlke

             reply	other threads:[~2015-09-27  4:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-27  4:42 Karl Dahlke [this message]
2015-09-27 17:18 ` Kevin Carhart
2015-09-27 17:43   ` Karl Dahlke

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150827004253.eklhad@comcast.net \
    --to=eklhad@comcast.net \
    --cc=Edbrowse-dev@lists.the-brannons.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).