webkit2-gtk 3.1.6 → 3.1.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ce720995e08f70f3aca1f40c56c73185fdf82246
4
- data.tar.gz: 0de49a7af386acbcb727a000b3328e96bb0ef448
3
+ metadata.gz: ad6e75e4540a71f86964688580bb87ca11e3f30f
4
+ data.tar.gz: 26e1e8bc4831d425b16a641b214f9c532fc51375
5
5
  SHA512:
6
- metadata.gz: 16dda65d7bb5ff105f2eb04cf9ede10555b7dc79986a50ce7dcd587e00e89012e4dca5e55a5e74efd315825c214c06e9d64337f81bb54148fd724ea4af1e0cf1
7
- data.tar.gz: a5c8fcb1ff8c7d433169a0515c64105e2863692ca2c2c0902af49ed3d6f9c414bb8e2e3956a4106069c4e00ebe67d37c88339d3680266b100a42246d751c6a99
6
+ metadata.gz: 31152a358af578a991b7da25686a35089fc7bbe2002b4c2f050244d6b7d7973347bb74ec5ae537827a100cfeb849e9ab250b45fe5508d348b364b27836d2ca87
7
+ data.tar.gz: 0b53a475012eadc90683cb1463a2178e9406c8249aec9cd770187eb67b9392aca41746544631e714df5d52c15b2ac39f288ef231946a547d3bb55f69037087b7
data/Rakefile CHANGED
@@ -81,7 +81,7 @@ package_task = GNOME2::Rake::PackageTask.new do |package|
81
81
  :name => "webkitgtk",
82
82
  :download_site => :webkitgtk,
83
83
  :label => "WebKitGTK+",
84
- :version => "2.16.1",
84
+ :version => "2.17.4",
85
85
  :compression_method => "xz",
86
86
  :windows => {
87
87
  :build_concurrently => false,
@@ -39,6 +39,7 @@ module WebKit2Gtk
39
39
  def require_libraries
40
40
  require "webkit2-gtk/version" if @version_module.const_defined?(:MAJOR)
41
41
 
42
+ require "webkit2-gtk/web-context"
42
43
  require "webkit2-gtk/web-view"
43
44
  end
44
45
 
@@ -0,0 +1,34 @@
1
+ # Copyright (C) 2017 Ruby-GNOME2 Project Team
2
+ #
3
+ # This library is free software; you can redistribute it and/or
4
+ # modify it under the terms of the GNU Lesser General Public
5
+ # License as published by the Free Software Foundation; either
6
+ # version 2.1 of the License, or (at your option) any later version.
7
+ #
8
+ # This library is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
+ # Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
+
17
+ module WebKit2Gtk
18
+ class WebContext
19
+ alias_method :initialize_raw, :initialize
20
+ def initialize(*args)
21
+ if args.size == 1 and args[0].is_a?(Hash)
22
+ options = args[0]
23
+ ephemeral = options[:ephemeral]
24
+ if ephemeral
25
+ initialize_new_ephemeral
26
+ else
27
+ initialize_raw
28
+ end
29
+ else
30
+ initialize_raw(*args)
31
+ end
32
+ end
33
+ end
34
+ end
data/sample/browser.rb CHANGED
@@ -14,15 +14,33 @@
14
14
  # License along with this library; if not, write to the Free Software
15
15
  # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
+ require "uri"
17
18
  require "webkit2-gtk"
18
19
 
20
+ uri = URI.parse(ARGV.shift || "https://webkitgtk.org/")
21
+
19
22
  window = Gtk::Window.new
23
+ window.set_default_size(800, 600)
20
24
  window.signal_connect("destroy") do
21
25
  Gtk.main_quit
22
26
  end
23
27
 
24
28
  view = WebKit2Gtk::WebView.new
25
- view.load_uri("http://webkitgtk.org/")
29
+ view.signal_connect("load-changed") do |_, load_event|
30
+ p [:load_changed, view.uri, load_event]
31
+ end
32
+ view.signal_connect("load-failed") do |_, _, failed_uri, error|
33
+ message = "failed to load URI: #{failed_uri}: "
34
+ message << "#{error.class}(#{error.code}): #{error.message}"
35
+ puts(message)
36
+ true
37
+ end
38
+
39
+ if uri.class == URI::Generic
40
+ view.load_html(File.read(uri.path), uri.to_s)
41
+ else
42
+ view.load_uri(uri.to_s)
43
+ end
26
44
 
27
45
  window.add(view)
28
46
  window.show_all
@@ -0,0 +1,70 @@
1
+ # Copyright (C) 2017 Ruby-GNOME2 Project Team
2
+ #
3
+ # This library is free software; you can redistribute it and/or
4
+ # modify it under the terms of the GNU Lesser General Public
5
+ # License as published by the Free Software Foundation; either
6
+ # version 2.1 of the License, or (at your option) any later version.
7
+ #
8
+ # This library is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
+ # Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
+
17
+ require "cgi/util"
18
+ require "webkit2-gtk"
19
+
20
+ if ARGV.empty?
21
+ puts("Usage: #{$0} URL...")
22
+ puts(" e.g.: #{$0} https://webkitgtk.org/ https://www.gtk.org/")
23
+ exit(false)
24
+ end
25
+
26
+ main_context = GLib::MainContext.default
27
+
28
+ view_context = WebKit2Gtk::WebContext.new(ephemeral: true)
29
+ view = WebKit2Gtk::WebView.new(context: view_context)
30
+ window = Gtk::OffscreenWindow.new
31
+ window.add(view)
32
+ window.set_default_size(800, 600)
33
+ window.show_all
34
+ ARGV.each do |uri|
35
+ view.load_uri(uri)
36
+ finished = false
37
+ view.signal_connect("load-changed") do |_, load_event|
38
+ case load_event
39
+ when WebKit2Gtk::LoadEvent::FINISHED
40
+ view.get_snapshot(:full_document, :none) do |_, result|
41
+ finished = true
42
+ snapshot_surface = view.get_snapshot_finish(result)
43
+ base_path = CGI.escape(uri)
44
+ snapshot_surface.write_to_png("#{base_path}.png")
45
+
46
+ width = 200
47
+ height = 200
48
+ thumbnail_surface = Cairo::ImageSurface.new(:argb32, width, height)
49
+ context = Cairo::Context.new(thumbnail_surface)
50
+ context.set_source_color(:white)
51
+ context.paint
52
+ ratio = width.to_f / snapshot_surface.width
53
+ context.scale(ratio, ratio)
54
+ context.set_source(snapshot_surface)
55
+ context.paint
56
+ thumbnail_surface.write_to_png("#{base_path}.thumbnail.png")
57
+ end
58
+ end
59
+ end
60
+ view.signal_connect("load-failed") do |_, _, failed_uri, error|
61
+ finished = true
62
+ message = "failed to load URI: #{failed_uri}: "
63
+ message << "#{error.class}(#{error.code}): #{error.message}"
64
+ puts(message)
65
+ true
66
+ end
67
+ until finished
68
+ main_context.iteration(true)
69
+ end
70
+ end
@@ -0,0 +1,41 @@
1
+ # Copyright (C) 2017 Ruby-GNOME2 Project Team
2
+ #
3
+ # This library is free software; you can redistribute it and/or
4
+ # modify it under the terms of the GNU Lesser General Public
5
+ # License as published by the Free Software Foundation; either
6
+ # version 2.1 of the License, or (at your option) any later version.
7
+ #
8
+ # This library is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
+ # Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
+
17
+ class TestWebKit2GtkWebContext < Test::Unit::TestCase
18
+ include WebKit2GtkTestUtils
19
+
20
+ sub_test_case(".new") do
21
+ sub_test_case("Hash form") do
22
+ setup do
23
+ only_webkit2_gtk_version(2, 16)
24
+ end
25
+
26
+ test "ephemeral: true" do
27
+ context = WebKit2Gtk::WebContext.new(ephemeral: true)
28
+ assert do
29
+ context.ephemeral?
30
+ end
31
+ end
32
+
33
+ test "ephemeral: false" do
34
+ context = WebKit2Gtk::WebContext.new(ephemeral: false)
35
+ assert do
36
+ not context.ephemeral?
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webkit2-gtk
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.6
4
+ version: 3.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - The Ruby-GNOME2 Project Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-03 00:00:00.000000000 Z
11
+ date: 2017-07-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gobject-introspection
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 3.1.6
19
+ version: 3.1.7
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 3.1.6
26
+ version: 3.1.7
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: gtk3
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 3.1.6
33
+ version: 3.1.7
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 3.1.6
40
+ version: 3.1.7
41
41
  description: Ruby/WebKit2GTK is a Ruby binding of WebKit2GTK+.
42
42
  email: ruby-gnome2-devel-en@lists.sourceforge.net
43
43
  executables: []
@@ -50,10 +50,13 @@ files:
50
50
  - lib/webkit2-gtk.rb
51
51
  - lib/webkit2-gtk/loader.rb
52
52
  - lib/webkit2-gtk/version.rb
53
+ - lib/webkit2-gtk/web-context.rb
53
54
  - lib/webkit2-gtk/web-view.rb
54
55
  - sample/browser.rb
56
+ - sample/screenshot.rb
55
57
  - test/run-test.rb
56
- - test/test-webkit2-gtk-webview.rb
58
+ - test/test-webkit2-gtk-web-context.rb
59
+ - test/test-webkit2-gtk-web-view.rb
57
60
  - test/webkit2-gtk-test-utils.rb
58
61
  homepage: http://ruby-gnome2.sourceforge.jp/
59
62
  licenses: