Commit graph

4 commits

Author SHA1 Message Date
Michael James Gratton
8d13bf1922 Enable accessing javascriptcore objects from web extensions.
* src/CMakeLists.txt: Also generate a custom Also generate a custom
  webkit2gtk-web-extension-4.0 VAPI that re-includes javascriptcore
  objects, so they can be access from the web extension.

* bindings/metadata/WebKit2WebExtension-4.0-custom.vala,
  bindings/metadata/WebKit2WebExtension-4.0.metadata: Include in-tree
  metadata for web extension VAPI, update to all access to JS obejcts.

* bindings/vapi/javascriptcore-4.0.vapi: Add a bunch of useful additional
  objects and method.
2017-02-01 00:41:43 +11:00
Michael James Gratton
3a3b5d0bff Rename some JS methods to be more vala-esque. 2017-02-01 00:41:43 +11:00
Michael James Gratton
26fe139e97 Initial pass at getting the HTML document's height from the web process.
* bindings/vapi/javascriptcore-4.0.vapi: Add some methods to
  GlobalContext for accessing JSValues as ints.

* src/client/components/client-web-view.vala
  (ClientWebView): Hook up UserContentManager script messages handler and
  handler implementation for "preferredHeightChanged", update the new
  preferred_height prop on the class, and queue a resize. Hook those
  values up to the GTK allocation machinery.
  (ClientWebView::get_int_result): Convenience method for getting an int
  from a JavascriptResult.
  (ClientWebView::get_preferred_height): Report back values as reported
  by messages from the script handler.
  (ClientWebView::register_message_handler): Convenience method for
  registering script messages handlers.

* src/client/conversation-viewer/conversation-web-view.vala
  (ConversationWebView): Remove now-redundant GTK allocation machinery.

* ui/client-web-view.js: Post a message to preferredHeightChanged when
  the page is sorta-kinda loaded.
2017-02-01 00:41:43 +11:00
Michael James Gratton
f51f55cd78 Depend on javascriptcore, generate webkit2 VAPI that uses it.
This gives us a means of using JS objects returned by UserContentManager
script messages directly from Vala.

* bindings/metadata/WebKit2-4.0.metadata: Tweak standard webkit2 VAPI to
  re-include methods that return javascriptcore objects.

* bindings/vapi/javascriptcore-4.0.vapi: Copy generated VAPI file into
  the tree, customise it so that it actually works.

* src/CMakeLists.txt: Generate the custom webkit2 VAPI, depend on
  javascriptcore and include in-tree javascriptcore VAPI in the client
  build.

* bindings/metadata/JSCore-3.0.metadata: Remove obsolete file.
2017-02-01 00:41:43 +11:00