gtk-webkit-ruby 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +2 -2
- data/ext/webkit/extconf.rb +38 -1
- data/ext/webkit/javascript-type-convert.h +152 -0
- data/ext/webkit/javascript.h +284 -114
- data/ext/webkit/webkit.c +400 -35
- data/ext/webkit/webkit.cr +112 -2
- data/ext/webkit/webkit.rd +61 -0
- metadata +55 -63
data/ext/webkit/webkit.cr
CHANGED
@@ -2,9 +2,17 @@
|
|
2
2
|
%pkg-config webkit-1.0
|
3
3
|
%name webkit
|
4
4
|
|
5
|
+
%lib dl
|
6
|
+
%lib ffi
|
7
|
+
%include dlfcn.h
|
8
|
+
%include errno.h
|
9
|
+
%include ffi.h
|
10
|
+
%include rbgobject.h
|
11
|
+
%include sys/mman.h
|
12
|
+
%include intern.h
|
13
|
+
|
5
14
|
%{
|
6
15
|
#include <intern.h>
|
7
|
-
|
8
16
|
#include "javascript.h"
|
9
17
|
|
10
18
|
static inline VALUE strOrNil(const char *str) {
|
@@ -16,15 +24,21 @@ static inline VALUE strOrNil(const char *str) {
|
|
16
24
|
}
|
17
25
|
|
18
26
|
%}
|
19
|
-
|
27
|
+
|
20
28
|
%include webkit/webkit.h
|
29
|
+
%include webkit/webkitenumtypes.h
|
21
30
|
%include JavaScriptCore/JavaScript.h
|
22
31
|
|
23
32
|
%map strOrNil > VALUE : strOrNil(%%)
|
24
33
|
|
34
|
+
%map SoupMessage* > VALUE : GOBJ2RVAL(SOUP_MESSAGE(%%))
|
35
|
+
|
25
36
|
module WebKit
|
26
37
|
gcpool RubyFunc
|
27
38
|
|
39
|
+
class JsPtr
|
40
|
+
end
|
41
|
+
|
28
42
|
class JavascriptError < StandardError
|
29
43
|
end
|
30
44
|
|
@@ -45,11 +59,27 @@ module WebKit
|
|
45
59
|
end
|
46
60
|
end
|
47
61
|
|
62
|
+
gobject WebPolicyDecision < WEBKIT_TYPE_WEB_POLICY_DECISION
|
63
|
+
@type WebKitWebPolicyDecision
|
64
|
+
def download
|
65
|
+
webkit_web_policy_decision_download(_self);
|
66
|
+
end
|
67
|
+
def use
|
68
|
+
webkit_web_policy_decision_use(_self);
|
69
|
+
end
|
70
|
+
def ignore
|
71
|
+
webkit_web_policy_decision_ignore(_self);
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
48
75
|
gobject WebFrame < WEBKIT_TYPE_WEB_FRAME
|
49
76
|
@type WebKitWebFrame
|
50
77
|
def exec_js(char *js)
|
51
78
|
return javascript_exec(webkit_web_frame_get_global_context(_self), js);
|
52
79
|
end
|
80
|
+
def add_ruby_class(char *name, T_CLASS|T_MODULE klass)
|
81
|
+
javascript_add_class(webkit_web_frame_get_global_context(_self), name, klass);
|
82
|
+
end
|
53
83
|
def add_ruby_eval()
|
54
84
|
javascript_add_ruby_eval(webkit_web_frame_get_global_context(_self));
|
55
85
|
end
|
@@ -62,6 +92,7 @@ module WebKit
|
|
62
92
|
end
|
63
93
|
gobject WebView < WEBKIT_TYPE_WEB_VIEW
|
64
94
|
@type WebKitWebView
|
95
|
+
|
65
96
|
def initialize()
|
66
97
|
RBGTK_INITIALIZE(self, webkit_web_view_new());
|
67
98
|
end
|
@@ -107,6 +138,31 @@ module WebKit
|
|
107
138
|
def stop_loading
|
108
139
|
webkit_web_view_stop_loading(_self);
|
109
140
|
end
|
141
|
+
def bool:has_selection?
|
142
|
+
return webkit_web_view_has_selection(_self);
|
143
|
+
end
|
144
|
+
def WebKitWebInspector*:inspector
|
145
|
+
return webkit_web_view_get_inspector(_self);
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
gobject WebInspector < WEBKIT_TYPE_WEB_INSPECTOR
|
150
|
+
@type WebKitWebInspector
|
151
|
+
def inspect_coordinates(double x, double y)
|
152
|
+
webkit_web_inspector_inspect_coordinates(_self, x, y);
|
153
|
+
end
|
154
|
+
def strOrNil:uri
|
155
|
+
return webkit_web_inspector_get_inspected_uri(_self);
|
156
|
+
end
|
157
|
+
def show
|
158
|
+
webkit_web_inspector_show(_self);
|
159
|
+
end
|
160
|
+
def close
|
161
|
+
webkit_web_inspector_close(_self);
|
162
|
+
end
|
163
|
+
def WebKitWebView*:view
|
164
|
+
return webkit_web_inspector_get_web_view(_self);
|
165
|
+
end
|
110
166
|
end
|
111
167
|
|
112
168
|
gobject WebResource < WEBKIT_TYPE_WEB_RESOURCE
|
@@ -145,6 +201,9 @@ module WebKit
|
|
145
201
|
def uri=(char *uri)
|
146
202
|
webkit_network_request_set_uri(_self, uri);
|
147
203
|
end
|
204
|
+
def SoupMessage*:message
|
205
|
+
return webkit_network_request_get_message(_self);
|
206
|
+
end
|
148
207
|
end
|
149
208
|
|
150
209
|
gobject WebNetworkResponse < WEBKIT_TYPE_NETWORK_RESPONSE
|
@@ -155,6 +214,57 @@ module WebKit
|
|
155
214
|
def uri=(char *uri)
|
156
215
|
webkit_network_response_set_uri(_self, uri);
|
157
216
|
end
|
217
|
+
def SoupMessage*:message
|
218
|
+
return webkit_network_response_get_message(_self);
|
219
|
+
end
|
220
|
+
end
|
221
|
+
|
222
|
+
gobject Download < WEBKIT_TYPE_DOWNLOAD
|
223
|
+
@type WebKitDownload
|
224
|
+
def initialize(WebKitNetworkRequest *request)
|
225
|
+
RBGTK_INITIALIZE(self, webkit_download_new(request));
|
226
|
+
end
|
227
|
+
def start
|
228
|
+
webkit_download_start(_self);
|
229
|
+
end
|
230
|
+
def cancel
|
231
|
+
webkit_download_cancel(_self);
|
232
|
+
end
|
233
|
+
def double:progress
|
234
|
+
return webkit_download_get_progress(_self);
|
235
|
+
end
|
236
|
+
def guint64:current_size
|
237
|
+
return webkit_download_get_current_size(_self);
|
238
|
+
end
|
239
|
+
def guint64:total_size
|
240
|
+
return webkit_download_get_total_size(_self);
|
241
|
+
end
|
242
|
+
def char*:uri
|
243
|
+
return webkit_download_get_uri(_self);
|
244
|
+
end
|
245
|
+
def char*:suggested_filename
|
246
|
+
return webkit_download_get_suggested_filename(_self);
|
247
|
+
end
|
158
248
|
end
|
249
|
+
|
250
|
+
genum TargetInfo WEBKIT_TYPE_WEB_VIEW_TARGET_INFO WEBKIT_;
|
251
|
+
|
252
|
+
genum DownloadStatus WEBKIT_TYPE_DOWNLOAD_STATUS WEBKIT_;
|
253
|
+
genum DownloadError WEBKIT_TYPE_DOWNLOAD_ERROR WEBKIT_;
|
254
|
+
genum NetworkError WEBKIT_TYPE_NETWORK_ERROR WEBKIT_;
|
255
|
+
genum PolicyError WEBKIT_TYPE_POLICY_ERROR WEBKIT_;
|
256
|
+
genum PluginError WEBKIT_TYPE_PLUGIN_ERROR WEBKIT_;
|
257
|
+
|
258
|
+
genum CacheModel WEBKIT_TYPE_CACHE_MODEL WEBKIT_;
|
259
|
+
genum LoadStatus WEBKIT_TYPE_LOAD_STATUS WEBKIT_;
|
260
|
+
|
261
|
+
genum NavigationReason WEBKIT_TYPE_WEB_NAVIGATION_REASON WEBKIT_;
|
262
|
+
genum HitTestResultContext WEBKIT_TYPE_HIT_TEST_RESULT_CONTEXT WEBKIT_;
|
263
|
+
genum EditingBehavior WEBKIT_TYPE_EDITING_BEHAVIOR WEBKIT_;
|
264
|
+
genum NavigationResponse WEBKIT_TYPE_NAVIGATION_RESPONSE WEBKIT_;
|
265
|
+
|
266
|
+
# genum ViewMode WEBKIT_TYPE_WEB_VIEW_VIEW_MODE WEBKIT_;
|
267
|
+
# genum SelectionAffinity WEBKIT_TYPE_SELECTION_AFFINITY WEBKIT_;
|
268
|
+
# genum InsertAction WEBKIT_TYPE_INSERT_ACTION WEBKIT_;
|
159
269
|
end
|
160
270
|
|
data/ext/webkit/webkit.rd
CHANGED
@@ -8,14 +8,25 @@
|
|
8
8
|
--- WebKit.set_default_web_database_quota(guint64 quota)
|
9
9
|
|
10
10
|
|
11
|
+
== class WebKit::JsPtr
|
11
12
|
== class WebKit::JavascriptError < StandardError
|
12
13
|
== class WebKit::WebSettings
|
13
14
|
--- WebKit::WebSettings.new
|
14
15
|
|
16
|
+
== class WebKit::WebPolicyDecision
|
17
|
+
--- WebKit::WebPolicyDecision#download
|
18
|
+
|
19
|
+
--- WebKit::WebPolicyDecision#use
|
20
|
+
|
21
|
+
--- WebKit::WebPolicyDecision#ignore
|
22
|
+
|
15
23
|
== class WebKit::WebFrame
|
16
24
|
--- WebKit::WebFrame#exec_js(String js)
|
17
25
|
|
18
26
|
|
27
|
+
--- WebKit::WebFrame#add_ruby_class(String name, Class or Module klass)
|
28
|
+
|
29
|
+
|
19
30
|
--- WebKit::WebFrame#add_ruby_eval
|
20
31
|
|
21
32
|
--- WebKit::WebFrame#add_js_api(String name, block)
|
@@ -61,6 +72,22 @@
|
|
61
72
|
|
62
73
|
--- WebKit::WebView#stop_loading
|
63
74
|
|
75
|
+
--- WebKit::WebView#has_selection?
|
76
|
+
|
77
|
+
--- WebKit::WebView#inspector
|
78
|
+
|
79
|
+
== class WebKit::WebInspector
|
80
|
+
--- WebKit::WebInspector#inspect_coordinates(double x, double y)
|
81
|
+
|
82
|
+
|
83
|
+
--- WebKit::WebInspector#uri
|
84
|
+
|
85
|
+
--- WebKit::WebInspector#show
|
86
|
+
|
87
|
+
--- WebKit::WebInspector#close
|
88
|
+
|
89
|
+
--- WebKit::WebInspector#view
|
90
|
+
|
64
91
|
== class WebKit::WebResource
|
65
92
|
--- WebKit::WebResource#encoding
|
66
93
|
|
@@ -81,9 +108,43 @@
|
|
81
108
|
--- WebKit::WebNetworkRequest#uri=(String uri)
|
82
109
|
|
83
110
|
|
111
|
+
--- WebKit::WebNetworkRequest#message
|
112
|
+
|
84
113
|
== class WebKit::WebNetworkResponse
|
85
114
|
--- WebKit::WebNetworkResponse#uri
|
86
115
|
|
87
116
|
--- WebKit::WebNetworkResponse#uri=(String uri)
|
88
117
|
|
89
118
|
|
119
|
+
--- WebKit::WebNetworkResponse#message
|
120
|
+
|
121
|
+
== class WebKit::Download
|
122
|
+
--- WebKit::Download.new(WebKitNetworkRequest* request)
|
123
|
+
|
124
|
+
|
125
|
+
--- WebKit::Download#start
|
126
|
+
|
127
|
+
--- WebKit::Download#cancel
|
128
|
+
|
129
|
+
--- WebKit::Download#progress
|
130
|
+
|
131
|
+
--- WebKit::Download#current_size
|
132
|
+
|
133
|
+
--- WebKit::Download#total_size
|
134
|
+
|
135
|
+
--- WebKit::Download#uri
|
136
|
+
|
137
|
+
--- WebKit::Download#suggested_filename
|
138
|
+
|
139
|
+
== enum WebKit::TargetInfo
|
140
|
+
== enum WebKit::DownloadStatus
|
141
|
+
== enum WebKit::DownloadError
|
142
|
+
== enum WebKit::NetworkError
|
143
|
+
== enum WebKit::PolicyError
|
144
|
+
== enum WebKit::PluginError
|
145
|
+
== enum WebKit::CacheModel
|
146
|
+
== enum WebKit::LoadStatus
|
147
|
+
== enum WebKit::NavigationReason
|
148
|
+
== enum WebKit::HitTestResultContext
|
149
|
+
== enum WebKit::EditingBehavior
|
150
|
+
== enum WebKit::NavigationResponse
|
metadata
CHANGED
@@ -1,102 +1,94 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: gtk-webkit-ruby
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 0
|
9
|
-
- 3
|
10
|
-
version: 0.0.3
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.4
|
5
|
+
prerelease:
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Geoff Youngs
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
dependencies:
|
21
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2012-11-16 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
22
15
|
name: rubber-generate
|
23
|
-
|
24
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
25
17
|
none: false
|
26
|
-
requirements:
|
27
|
-
- -
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
|
30
|
-
segments:
|
31
|
-
- 0
|
32
|
-
- 0
|
33
|
-
- 12
|
34
|
-
version: 0.0.12
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 0.0.17
|
35
22
|
type: :runtime
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 0.0.17
|
30
|
+
description: ! 'Gtk Webkit bindings for ruby. Partial coverage sufficient to embed
|
31
|
+
a webview in a Ruby-GNOME2 application.
|
32
|
+
|
33
|
+
|
34
|
+
Also initial/experimental support for allowing ruby code to be called by javascript
|
35
|
+
& executing javascript
|
36
|
+
|
41
37
|
from ruby.
|
42
|
-
|
38
|
+
|
39
|
+
|
43
40
|
e.g
|
44
|
-
|
45
|
-
require '
|
46
|
-
|
41
|
+
|
42
|
+
require ''gtk2''
|
43
|
+
|
44
|
+
require ''webkit''
|
45
|
+
|
46
|
+
|
47
47
|
v = WebKit::WebView.new
|
48
|
+
|
48
49
|
v.main_frame.setup_ruby
|
49
|
-
|
50
|
+
|
51
|
+
puts v.main_frame.exec_js("ruby_eval(''RUBY_DESCRIPTION'')")
|
52
|
+
|
50
53
|
puts v.main_frame.exec_js("document.root.innerHTML")
|
51
54
|
|
55
|
+
'
|
52
56
|
email: git@intersect-uk.co.uk
|
53
57
|
executables: []
|
54
|
-
|
55
|
-
extensions:
|
58
|
+
extensions:
|
56
59
|
- ext/webkit/extconf.rb
|
57
60
|
extra_rdoc_files: []
|
58
|
-
|
59
|
-
files:
|
61
|
+
files:
|
60
62
|
- ext/webkit/webkit.c
|
61
63
|
- ext/webkit/javascript.h
|
64
|
+
- ext/webkit/javascript-type-convert.h
|
62
65
|
- ext/webkit/webkit.cr
|
63
66
|
- ext/webkit/webkit.rd
|
64
67
|
- Rakefile
|
65
68
|
- README.md
|
66
69
|
- ext/webkit/extconf.rb
|
67
|
-
has_rdoc: true
|
68
70
|
homepage: http://github.com/geoffyoungs/gtk-webkit-ruby
|
69
71
|
licenses: []
|
70
|
-
|
71
72
|
post_install_message:
|
72
73
|
rdoc_options: []
|
73
|
-
|
74
|
-
require_paths:
|
74
|
+
require_paths:
|
75
75
|
- lib
|
76
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
76
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
77
77
|
none: false
|
78
|
-
requirements:
|
79
|
-
- -
|
80
|
-
- !ruby/object:Gem::Version
|
81
|
-
|
82
|
-
|
83
|
-
- 0
|
84
|
-
version: "0"
|
85
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - ! '>='
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '0'
|
82
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
86
83
|
none: false
|
87
|
-
requirements:
|
88
|
-
- -
|
89
|
-
- !ruby/object:Gem::Version
|
90
|
-
|
91
|
-
segments:
|
92
|
-
- 0
|
93
|
-
version: "0"
|
84
|
+
requirements:
|
85
|
+
- - ! '>='
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
94
88
|
requirements: []
|
95
|
-
|
96
89
|
rubyforge_project:
|
97
|
-
rubygems_version: 1.
|
90
|
+
rubygems_version: 1.8.24
|
98
91
|
signing_key:
|
99
92
|
specification_version: 3
|
100
93
|
summary: Webkit bindings using rubber-generate
|
101
94
|
test_files: []
|
102
|
-
|