aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.cargo/config2
-rw-r--r--.gitmodules3
-rw-r--r--Cargo.lock170
-rw-r--r--Cargo.toml6
-rw-r--r--ORGANIZATION.md2
-rw-r--r--components/canvas/lib.rs3
-rw-r--r--components/compositing/compositor.rs74
-rw-r--r--components/compositing/compositor_layer.rs3
-rw-r--r--components/compositing/constellation.rs37
-rw-r--r--components/compositing/lib.rs5
-rw-r--r--components/compositing/pipeline.rs3
-rw-r--r--components/devtools/actor.rs29
-rw-r--r--components/devtools/actors/console.rs10
-rw-r--r--components/devtools/actors/inspector.rs7
-rw-r--r--components/devtools/lib.rs7
-rw-r--r--components/gfx/buffer_map.rs28
-rw-r--r--components/gfx/display_list/mod.rs5
-rw-r--r--components/gfx/display_list/optimizer.rs3
-rw-r--r--components/gfx/font.rs4
-rw-r--r--components/gfx/font_cache_task.rs12
-rw-r--r--components/gfx/font_context.rs6
-rw-r--r--components/gfx/lib.rs11
-rw-r--r--components/gfx/platform/freetype/font.rs26
-rw-r--r--components/gfx/platform/freetype/font_context.rs2
-rw-r--r--components/gfx/platform/freetype/font_list.rs4
-rw-r--r--components/gfx/platform/macos/font.rs2
-rw-r--r--components/gfx/platform/mod.rs6
-rw-r--r--components/gfx/render_context.rs8
-rw-r--r--components/gfx/render_task.rs15
-rw-r--r--components/gfx/text/glyph.rs30
-rw-r--r--components/gfx/text/shaping/harfbuzz.rs6
-rw-r--r--components/gfx/text/text_run.rs4
-rw-r--r--components/gfx/text/util.rs6
-rw-r--r--components/layout/block.rs34
-rw-r--r--components/layout/construct.rs48
-rw-r--r--components/layout/css/matching.rs2
-rw-r--r--components/layout/display_list_builder.rs10
-rw-r--r--components/layout/floats.rs12
-rw-r--r--components/layout/flow.rs95
-rw-r--r--components/layout/flow_list.rs29
-rw-r--r--components/layout/flow_ref.rs14
-rw-r--r--components/layout/fragment.rs68
-rw-r--r--components/layout/incremental.rs48
-rw-r--r--components/layout/inline.rs24
-rw-r--r--components/layout/layout_debug.rs11
-rw-r--r--components/layout/layout_task.rs35
-rw-r--r--components/layout/lib.rs5
-rw-r--r--components/layout/model.rs4
-rw-r--r--components/layout/parallel.rs4
-rw-r--r--components/layout/table.rs2
-rw-r--r--components/layout/table_caption.rs2
-rw-r--r--components/layout/table_cell.rs2
-rw-r--r--components/layout/table_colgroup.rs4
-rw-r--r--components/layout/table_row.rs2
-rw-r--r--components/layout/table_rowgroup.rs2
-rw-r--r--components/layout/table_wrapper.rs2
-rw-r--r--components/layout/text.rs6
-rw-r--r--components/layout/traversal.rs14
-rw-r--r--components/layout/util.rs2
-rw-r--r--components/layout/wrapper.rs40
-rw-r--r--components/layout_traits/lib.rs3
-rw-r--r--components/msg/compositor_msg.rs9
-rw-r--r--components/msg/constellation_msg.rs8
-rw-r--r--components/msg/lib.rs3
-rw-r--r--components/net/about_loader.rs2
-rw-r--r--components/net/data_loader.rs2
-rw-r--r--components/net/fetch/cors_cache.rs2
-rw-r--r--components/net/fetch/request.rs2
-rw-r--r--components/net/fetch/response.rs2
-rw-r--r--components/net/http_loader.rs8
-rw-r--r--components/net/image_cache_task.rs64
-rw-r--r--components/net/lib.rs4
-rw-r--r--components/net/local_image_cache.rs23
-rw-r--r--components/net/resource_task.rs8
-rw-r--r--components/plugins/lib.rs3
-rw-r--r--components/plugins/lints.rs6
-rw-r--r--components/script/cors.rs5
-rw-r--r--components/script/dom/bindings/callback.rs2
-rw-r--r--components/script/dom/bindings/cell.rs12
-rw-r--r--components/script/dom/bindings/codegen/CodegenRust.py58
-rw-r--r--components/script/dom/bindings/conversions.rs10
-rw-r--r--components/script/dom/bindings/global.rs4
-rw-r--r--components/script/dom/bindings/js.rs14
-rw-r--r--components/script/dom/bindings/str.rs7
-rw-r--r--components/script/dom/bindings/trace.rs2
-rw-r--r--components/script/dom/bindings/utils.rs51
-rw-r--r--components/script/dom/browsercontext.rs4
-rw-r--r--components/script/dom/dedicatedworkerglobalscope.rs6
-rw-r--r--components/script/dom/document.rs33
-rw-r--r--components/script/dom/domexception.rs2
-rw-r--r--components/script/dom/domstringmap.rs4
-rw-r--r--components/script/dom/element.rs10
-rw-r--r--components/script/dom/eventtarget.rs47
-rw-r--r--components/script/dom/formdata.rs19
-rw-r--r--components/script/dom/htmlbodyelement.rs4
-rw-r--r--components/script/dom/htmlbuttonelement.rs2
-rw-r--r--components/script/dom/htmlcanvaselement.rs16
-rw-r--r--components/script/dom/htmlcollection.rs4
-rw-r--r--components/script/dom/htmlfieldsetelement.rs6
-rw-r--r--components/script/dom/htmlformelement.rs19
-rw-r--r--components/script/dom/htmliframeelement.rs2
-rw-r--r--components/script/dom/htmlinputelement.rs9
-rw-r--r--components/script/dom/htmllinkelement.rs4
-rw-r--r--components/script/dom/htmlobjectelement.rs4
-rw-r--r--components/script/dom/htmlserializer.rs20
-rw-r--r--components/script/dom/macros.rs12
-rw-r--r--components/script/dom/node.rs86
-rw-r--r--components/script/dom/servohtmlparser.rs2
-rw-r--r--components/script/dom/treewalker.rs34
-rw-r--r--components/script/dom/urlsearchparams.rs20
-rw-r--r--components/script/dom/window.rs2
-rw-r--r--components/script/dom/xmlhttprequest.rs7
-rw-r--r--components/script/layout_interface.rs2
-rw-r--r--components/script/lib.rs4
-rw-r--r--components/script/page.rs6
-rw-r--r--components/script/parse/html.rs18
-rw-r--r--components/script/script_task.rs58
-rw-r--r--components/script/timers.rs6
-rw-r--r--components/script_traits/lib.rs3
-rw-r--r--components/style/errors.rs2
-rw-r--r--components/style/font_face.rs2
-rw-r--r--components/style/lib.rs5
-rw-r--r--components/style/media_queries.rs24
-rw-r--r--components/style/namespaces.rs4
-rw-r--r--components/style/parsing_utils.rs2
-rw-r--r--components/style/properties/common_types.rs14
-rw-r--r--components/style/properties/mod.rs.mako23
-rw-r--r--components/style/selector_matching.rs27
-rw-r--r--components/style/selectors.rs20
-rw-r--r--components/style/stylesheets.rs4
-rw-r--r--components/util/bloom.rs9
-rw-r--r--components/util/cache.rs18
-rw-r--r--components/util/dlist.rs5
-rw-r--r--components/util/fnv.rs2
-rw-r--r--components/util/geometry.rs10
-rw-r--r--components/util/lib.rs4
-rw-r--r--components/util/logical_geometry.rs20
-rw-r--r--components/util/memory.rs5
-rw-r--r--components/util/rtinstrument.rs4
-rw-r--r--components/util/smallvec.rs6
-rw-r--r--components/util/str.rs4
-rw-r--r--components/util/task_state.rs22
-rw-r--r--components/util/tid.rs2
-rw-r--r--components/util/time.rs4
-rw-r--r--components/util/vec.rs7
-rw-r--r--components/util/workqueue.rs21
-rw-r--r--ports/android/glut_app/Cargo.lock170
-rw-r--r--ports/android/glut_app/lib.rs3
-rw-r--r--ports/android/glut_app/window.rs2
-rw-r--r--ports/cef/Cargo.lock176
-rw-r--r--ports/cef/lib.rs4
-rw-r--r--ports/cef/string.rs2
-rw-r--r--ports/glfw/lib.rs2
-rw-r--r--ports/glfw/window.rs2
-rw-r--r--rust-snapshot-hash2
-rw-r--r--src/lib.rs14
-rw-r--r--src/main.rs26
m---------support/glfw-rs0
-rw-r--r--tests/contenttest.rs13
-rw-r--r--tests/reftest.rs53
160 files changed, 1427 insertions, 1161 deletions
diff --git a/.cargo/config b/.cargo/config
index a4028039d42..c441f661b36 100644
--- a/.cargo/config
+++ b/.cargo/config
@@ -1,5 +1,3 @@
-paths = ["support/glfw-rs"]
-
[target.arm-linux-androideabi]
ar = "arm-linux-androideabi-ar"
linker = "arm-linux-androideabi-g++"
diff --git a/.gitmodules b/.gitmodules
index bb97934e4d8..0b77f02726e 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,6 +1,3 @@
-[submodule "support/glfw-rs"]
- path = support/glfw-rs
- url = https://github.com/servo/glfw-rs.git
[submodule "tests/wpt/web-platform-tests"]
path = tests/wpt/web-platform-tests
url = https://github.com/servo/web-platform-tests.git
diff --git a/Cargo.lock b/Cargo.lock
index 776d48d545a..2f9a83d51b2 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -5,9 +5,11 @@ dependencies = [
"compositing 0.0.1",
"gfx 0.0.1",
"glfw_app 0.0.1",
+ "green 0.0.1 (git+https://github.com/alexcrichton/green-rs)",
"layout 0.0.1",
"msg 0.0.1",
"net 0.0.1",
+ "rustuv 0.0.1 (git+https://github.com/alexcrichton/green-rs)",
"script 0.0.1",
"url 0.1.0 (git+https://github.com/servo/rust-url)",
"util 0.0.1",
@@ -16,16 +18,16 @@ dependencies = [
[[package]]
name = "alert"
version = "0.1.0"
-source = "git+https://github.com/servo/rust-alert#fdc24f13be8d8a2d15214ec228d166b3221b809e"
+source = "git+https://github.com/servo/rust-alert#9bd18fc406683bae448bc6f5d546872970af252e"
dependencies = [
- "cocoa 0.1.0 (git+https://github.com/servo/rust-cocoa)",
+ "cocoa 0.1.1 (git+https://github.com/servo/rust-cocoa)",
"core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation)",
]
[[package]]
name = "azure"
version = "0.1.0"
-source = "git+https://github.com/servo/rust-azure#8e9b6b1fdbbe0386655d61b0f58e1a9910497311"
+source = "git+https://github.com/servo/rust-azure#612ffc4fbf80c1bd5faae4b86dfc539dda06fb0c"
dependencies = [
"core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation)",
"core_graphics 0.1.0 (git+https://github.com/servo/rust-core-graphics)",
@@ -50,15 +52,15 @@ dependencies = [
[[package]]
name = "cgl"
version = "0.0.1"
-source = "git+https://github.com/servo/rust-cgl#698c6c5409c1049ba5a7e0f7bdddf97f91dc4cf5"
+source = "git+https://github.com/servo/rust-cgl#7b7090729f65e2287c3d80651df02e547911b119"
dependencies = [
"gleam 0.0.1 (git+https://github.com/servo/gleam)",
]
[[package]]
name = "cocoa"
-version = "0.1.0"
-source = "git+https://github.com/servo/rust-cocoa#acb9b4efc70c3f285057c2aee774f38f81a1b98d"
+version = "0.1.1"
+source = "git+https://github.com/servo/rust-cocoa#f926323d306401df33f528c9aeca8e582cad063b"
[[package]]
name = "compositing"
@@ -86,12 +88,12 @@ dependencies = [
[[package]]
name = "core_foundation"
version = "0.1.0"
-source = "git+https://github.com/servo/rust-core-foundation#5c3b85b079ab2fe4a046497a84e55386db7598e8"
+source = "git+https://github.com/servo/rust-core-foundation#6fa0b908f3912e20d081193e83bf5a9aa958fb83"
[[package]]
name = "core_graphics"
version = "0.1.0"
-source = "git+https://github.com/servo/rust-core-graphics#6a9919f8a912cc67571b891ba198d5325964a104"
+source = "git+https://github.com/servo/rust-core-graphics#9434e2bda65d259f825104170b5fa6cc6dbaf5a9"
dependencies = [
"core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation)",
]
@@ -99,7 +101,7 @@ dependencies = [
[[package]]
name = "core_text"
version = "0.1.0"
-source = "git+https://github.com/servo/rust-core-text#967a97fa7e9ae47f96aee5e48f5fb0be1345d89e"
+source = "git+https://github.com/servo/rust-core-text#85784007b6fa1b8f9614059edcd0429b2bd69a11"
dependencies = [
"core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation)",
"core_graphics 0.1.0 (git+https://github.com/servo/rust-core-graphics)",
@@ -108,9 +110,9 @@ dependencies = [
[[package]]
name = "cssparser"
version = "0.1.0"
-source = "git+https://github.com/servo/rust-cssparser#7b0549a5d122135848b8813ec401112ab588063c"
+source = "git+https://github.com/servo/rust-cssparser#cbbfd66f794bd019bbdeaefc88b29eff455b62e5"
dependencies = [
- "encoding 0.1.0 (git+https://github.com/lifthrasiir/rust-encoding)",
+ "encoding 0.2.0 (git+https://github.com/lifthrasiir/rust-encoding)",
]
[[package]]
@@ -136,8 +138,40 @@ source = "git+https://github.com/servo/rust-egl#88f2a13812ddbce2bf2317221663a61c
[[package]]
name = "encoding"
-version = "0.1.0"
-source = "git+https://github.com/lifthrasiir/rust-encoding#28eafb604a92c7786685b46c0fc02682ba3ab265"
+version = "0.2.0"
+source = "git+https://github.com/lifthrasiir/rust-encoding#a06637cc6d0da37c12c68661e2ee9ca1999764a4"
+dependencies = [
+ "encoding-index-japanese 1.0.20140915 (git+https://github.com/lifthrasiir/rust-encoding)",
+ "encoding-index-korean 1.0.20140915 (git+https://github.com/lifthrasiir/rust-encoding)",
+ "encoding-index-simpchinese 1.0.20140915 (git+https://github.com/lifthrasiir/rust-encoding)",
+ "encoding-index-singlebyte 1.0.20140915 (git+https://github.com/lifthrasiir/rust-encoding)",
+ "encoding-index-tradchinese 1.0.20140915 (git+https://github.com/lifthrasiir/rust-encoding)",
+]
+
+[[package]]
+name = "encoding-index-japanese"
+version = "1.0.20140915"
+source = "git+https://github.com/lifthrasiir/rust-encoding#a06637cc6d0da37c12c68661e2ee9ca1999764a4"
+
+[[package]]
+name = "encoding-index-korean"
+version = "1.0.20140915"
+source = "git+https://github.com/lifthrasiir/rust-encoding#a06637cc6d0da37c12c68661e2ee9ca1999764a4"
+
+[[package]]
+name = "encoding-index-simpchinese"
+version = "1.0.20140915"
+source = "git+https://github.com/lifthrasiir/rust-encoding#a06637cc6d0da37c12c68661e2ee9ca1999764a4"
+
+[[package]]
+name = "encoding-index-singlebyte"
+version = "1.0.20140915"
+source = "git+https://github.com/lifthrasiir/rust-encoding#a06637cc6d0da37c12c68661e2ee9ca1999764a4"
+
+[[package]]
+name = "encoding-index-tradchinese"
+version = "1.0.20140915"
+source = "git+https://github.com/lifthrasiir/rust-encoding#a06637cc6d0da37c12c68661e2ee9ca1999764a4"
[[package]]
name = "expat-sys"
@@ -147,7 +181,7 @@ source = "git+https://github.com/servo/libexpat#da2ddaf78cbef836b8790807bb76b357
[[package]]
name = "fontconfig"
version = "0.1.0"
-source = "git+https://github.com/servo/rust-fontconfig#b16c1e12ecb74b1e4e9a9b23c2b98580a34cf201"
+source = "git+https://github.com/servo/rust-fontconfig#f42ff5cbd0404fe4d2cd64e8d9bb6307bad8fd7c"
dependencies = [
"fontconfig-sys 2.11.1 (git+https://github.com/servo/libfontconfig)",
]
@@ -164,7 +198,7 @@ dependencies = [
[[package]]
name = "freetype"
version = "0.1.0"
-source = "git+https://github.com/servo/rust-freetype#0b03da276e4bdeae2300596dabc4ccb16733ad70"
+source = "git+https://github.com/servo/rust-freetype#e55b06110fb2d74a2db68ead740db7e98fb98060"
[[package]]
name = "freetype-sys"
@@ -200,10 +234,16 @@ dependencies = [
]
[[package]]
+name = "gl_common"
+version = "0.0.1"
+source = "git+https://github.com/bjz/gl-rs.git#79cd3b3f9f19aa0e39f6af572fc8673a6d9760bc"
+
+[[package]]
name = "gl_generator"
version = "0.0.1"
-source = "git+https://github.com/bjz/gl-rs.git#2857ad712bd443196983ea7c0bd4b6bdcf653e7c"
+source = "git+https://github.com/bjz/gl-rs.git#79cd3b3f9f19aa0e39f6af572fc8673a6d9760bc"
dependencies = [
+ "gl_common 0.0.1 (git+https://github.com/bjz/gl-rs.git)",
"khronos_api 0.0.1 (git+https://github.com/bjz/gl-rs.git)",
"rust-xml 0.1.0 (git+https://github.com/netvl/rust-xml)",
]
@@ -211,7 +251,7 @@ dependencies = [
[[package]]
name = "gleam"
version = "0.0.1"
-source = "git+https://github.com/servo/gleam#5ebe1656d63087c68512c93c6528f9300abcd199"
+source = "git+https://github.com/servo/gleam#8e77178eaebddfeae6557dfec2bcccbefaba93f3"
dependencies = [
"gl_generator 0.0.1 (git+https://github.com/bjz/gl-rs.git)",
]
@@ -219,16 +259,16 @@ dependencies = [
[[package]]
name = "glfw"
version = "0.0.1"
-source = "git+https://github.com/servo/glfw-rs?ref=servo#a15c2d04b8969aea653841d1d79e5fdf68de664b"
+source = "git+https://github.com/servo/glfw-rs?ref=servo#46f82b46589720f202ab2d4a99e4f4fd48df6469"
dependencies = [
"glfw-sys 3.0.4 (git+https://github.com/servo/glfw?ref=cargo-3.0.4)",
- "semver 0.0.1 (git+https://github.com/rust-lang/semver)",
+ "semver 0.1.0 (git+https://github.com/rust-lang/semver)",
]
[[package]]
name = "glfw-sys"
version = "3.0.4"
-source = "git+https://github.com/servo/glfw?ref=cargo-3.0.4#aa8e0d26cccdb4145f34c5a1724d7e48e0399674"
+source = "git+https://github.com/servo/glfw?ref=cargo-3.0.4#765dace7e4125b87c764f5ac0e7a80eae5c550b2"
[[package]]
name = "glfw_app"
@@ -247,20 +287,25 @@ dependencies = [
[[package]]
name = "glx"
version = "0.0.1"
-source = "git+https://github.com/servo/rust-glx#e2ce3d297260ccd23fcb4627f6ed218b68e1095f"
+source = "git+https://github.com/servo/rust-glx#7126ffa09fcfcc9f85f1406f3b5db729f5fdb7c3"
dependencies = [
"gl_generator 0.0.1 (git+https://github.com/bjz/gl-rs.git)",
]
[[package]]
+name = "green"
+version = "0.0.1"
+source = "git+https://github.com/alexcrichton/green-rs#215f3c87bf545b36a90100b7fb209ba640f2f481"
+
+[[package]]
name = "harfbuzz"
version = "0.1.0"
-source = "git+https://github.com/servo/rust-harfbuzz#ad520942cc17232e1a40cdd8a99c2905623d35f6"
+source = "git+https://github.com/servo/rust-harfbuzz#8aab215463214647b7a81f66011da552bbb1121c"
[[package]]
name = "html5ever"
version = "0.0.0"
-source = "git+https://github.com/servo/html5ever?ref=servo#0bdd6087dc8df6a92c96e1859bbb4ebbb0be7c1f"
+source = "git+https://github.com/servo/html5ever?ref=servo#87c7e8b710391338b2463652be835f498923653c"
dependencies = [
"html5ever_macros 0.0.0 (git+https://github.com/servo/html5ever?ref=servo)",
"phf 0.0.0 (git+https://github.com/sfackler/rust-phf)",
@@ -272,12 +317,12 @@ dependencies = [
[[package]]
name = "html5ever_macros"
version = "0.0.0"
-source = "git+https://github.com/servo/html5ever?ref=servo#0bdd6087dc8df6a92c96e1859bbb4ebbb0be7c1f"
+source = "git+https://github.com/servo/html5ever?ref=servo#87c7e8b710391338b2463652be835f498923653c"
[[package]]
name = "http"
version = "0.1.0-pre"
-source = "git+https://github.com/servo/rust-http?ref=servo#5e9b063b36028a5b40a417c661ee5c628b594be9"
+source = "git+https://github.com/servo/rust-http?ref=servo#3597f981aa001c57d3c918eb9f8ab58d3f0bf5a5"
dependencies = [
"openssl 0.0.0 (git+https://github.com/sfackler/rust-openssl.git)",
"url 0.1.0 (git+https://github.com/servo/rust-url)",
@@ -286,7 +331,7 @@ dependencies = [
[[package]]
name = "io_surface"
version = "0.1.0"
-source = "git+https://github.com/servo/rust-io-surface#3f8220ab2e94651ced69b04068c5126b1adadf1f"
+source = "git+https://github.com/servo/rust-io-surface#691cbccc320c4fb9b75e215da9b0b82539d729bd"
dependencies = [
"cgl 0.0.1 (git+https://github.com/servo/rust-cgl)",
"core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation)",
@@ -297,20 +342,22 @@ dependencies = [
[[package]]
name = "js"
version = "0.1.0"
-source = "git+https://github.com/servo/rust-mozjs#1ec216a2577c03738fa11a78958bb2a0fd3f7fbd"
+source = "git+https://github.com/servo/rust-mozjs#b8109aa873d886b6ee295ea17359063da7fd3e2f"
dependencies = [
+ "green 0.0.1 (git+https://github.com/alexcrichton/green-rs)",
"mozjs-sys 0.0.0 (git+https://github.com/servo/mozjs)",
+ "rustuv 0.0.1 (git+https://github.com/alexcrichton/green-rs)",
]
[[package]]
name = "khronos_api"
version = "0.0.1"
-source = "git+https://github.com/bjz/gl-rs.git#2857ad712bd443196983ea7c0bd4b6bdcf653e7c"
+source = "git+https://github.com/bjz/gl-rs.git#79cd3b3f9f19aa0e39f6af572fc8673a6d9760bc"
[[package]]
name = "layers"
version = "0.1.0"
-source = "git+https://github.com/servo/rust-layers#3737b00270644594a95896a2cd37ffca36d5bc5f"
+source = "git+https://github.com/servo/rust-layers#36bcefcdc791bd6fa4ab389f472e449ce2e1e159"
dependencies = [
"cgl 0.0.1 (git+https://github.com/servo/rust-cgl)",
"core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation)",
@@ -326,7 +373,7 @@ dependencies = [
name = "layout"
version = "0.0.1"
dependencies = [
- "encoding 0.1.0 (git+https://github.com/lifthrasiir/rust-encoding)",
+ "encoding 0.2.0 (git+https://github.com/lifthrasiir/rust-encoding)",
"geom 0.1.0 (git+https://github.com/servo/rust-geom)",
"gfx 0.0.1",
"layout_traits 0.0.1",
@@ -355,7 +402,7 @@ dependencies = [
[[package]]
name = "lazy_static"
version = "0.1.0"
-source = "git+https://github.com/Kimundi/lazy-static.rs#e62a65372f1dd9019e37eb9381d819edff80e360"
+source = "git+https://github.com/Kimundi/lazy-static.rs#62976cb611c5396e11315ae64c9c389576240eb7"
[[package]]
name = "mozjs-sys"
@@ -391,17 +438,23 @@ dependencies = [
[[package]]
name = "openssl"
version = "0.0.0"
-source = "git+https://github.com/sfackler/rust-openssl.git#a495465b75ffb18ff2303c5a11a103e00a15a13d"
+source = "git+https://github.com/sfackler/rust-openssl.git#766ce4b7785c0b038bee95b74564e5b9bf7e9a4b"
[[package]]
name = "phf"
version = "0.0.0"
-source = "git+https://github.com/sfackler/rust-phf#06254fdde7708630a6397c41c6c17ef81a4b66a0"
+source = "git+https://github.com/sfackler/rust-phf#18a5ecc028055c3dbd650cc5a064b6fb033d82ef"
+dependencies = [
+ "xxhash 0.0.1 (git+https://github.com/Jurily/rust-xxhash)",
+]
[[package]]
name = "phf_mac"
version = "0.0.0"
-source = "git+https://github.com/sfackler/rust-phf#06254fdde7708630a6397c41c6c17ef81a4b66a0"
+source = "git+https://github.com/sfackler/rust-phf#18a5ecc028055c3dbd650cc5a064b6fb033d82ef"
+dependencies = [
+ "xxhash 0.0.1 (git+https://github.com/Jurily/rust-xxhash)",
+]
[[package]]
name = "plugins"
@@ -410,7 +463,7 @@ version = "0.0.1"
[[package]]
name = "png"
version = "0.1.0"
-source = "git+https://github.com/servo/rust-png#74418ffbf20e94b0d3bed4a9d004062a13342c79"
+source = "git+https://github.com/servo/rust-png#b0b4acde0080dd475dee93615276bfc19207a21e"
dependencies = [
"png-sys 1.6.3 (git+https://github.com/servo/libpng?ref=servo)",
]
@@ -423,7 +476,16 @@ source = "git+https://github.com/servo/libpng?ref=servo#d01f32b4eb86904695efe7fc
[[package]]
name = "rust-xml"
version = "0.1.0"
-source = "git+https://github.com/netvl/rust-xml#fdc021b2bfec7855866b964f459559903c6b7808"
+source = "git+https://github.com/netvl/rust-xml#d6c57380a300b94f7e7881979dbe5459dbe4ca06"
+
+[[package]]
+name = "rustuv"
+version = "0.0.1"
+source = "git+https://github.com/alexcrichton/green-rs#215f3c87bf545b36a90100b7fb209ba640f2f481"
+dependencies = [
+ "green 0.0.1 (git+https://github.com/alexcrichton/green-rs)",
+ "tls 0.0.1 (git+https://github.com/alexcrichton/green-rs)",
+]
[[package]]
name = "script"
@@ -432,7 +494,7 @@ dependencies = [
"canvas 0.0.1",
"cssparser 0.1.0 (git+https://github.com/servo/rust-cssparser)",
"devtools_traits 0.0.1",
- "encoding 0.1.0 (git+https://github.com/lifthrasiir/rust-encoding)",
+ "encoding 0.2.0 (git+https://github.com/lifthrasiir/rust-encoding)",
"geom 0.1.0 (git+https://github.com/servo/rust-geom)",
"gfx 0.0.1",
"html5ever 0.0.0 (git+https://github.com/servo/html5ever?ref=servo)",
@@ -464,13 +526,13 @@ dependencies = [
[[package]]
name = "semver"
-version = "0.0.1"
-source = "git+https://github.com/rust-lang/semver#d04583a173395b76c1eaa15cc630a5f6f8f0ae10"
+version = "0.1.0"
+source = "git+https://github.com/rust-lang/semver#7dca047a9cd40e929a4545b37a1917daff82f156"
[[package]]
name = "skia-sys"
version = "0.0.20130412"
-source = "git+https://github.com/servo/skia#6d696712962fd0d41120b7a414a48417da8e6a92"
+source = "git+https://github.com/servo/skia#d92603043a9b7dd0b25c0b3b562099a0cc32ac6c"
dependencies = [
"expat-sys 2.1.0 (git+https://github.com/servo/libexpat)",
"freetype-sys 2.4.11 (git+https://github.com/servo/libfreetype2)",
@@ -479,22 +541,24 @@ dependencies = [
[[package]]
name = "stb_image"
version = "0.1.0"
-source = "git+https://github.com/servo/rust-stb-image#f5022de4ad6bb474a03493d1f274dde9b0f1af0c"
+source = "git+https://github.com/servo/rust-stb-image#74488fef4740acf287ff5dc248d65cc74033467a"
[[package]]
name = "string_cache"
version = "0.0.0"
-source = "git+https://github.com/servo/string-cache#124b891ebb4564743068f99aaeb0e154de343efb"
+source = "git+https://github.com/servo/string-cache#ae950525434b642eff5f4904f5e0c76cd6ea99b9"
dependencies = [
+ "lazy_static 0.1.0 (git+https://github.com/Kimundi/lazy-static.rs)",
"phf 0.0.0 (git+https://github.com/sfackler/rust-phf)",
"phf_mac 0.0.0 (git+https://github.com/sfackler/rust-phf)",
"string_cache_macros 0.0.0 (git+https://github.com/servo/string-cache)",
+ "xxhash 0.0.1 (git+https://github.com/Jurily/rust-xxhash)",
]
[[package]]
name = "string_cache_macros"
version = "0.0.0"
-source = "git+https://github.com/servo/string-cache#124b891ebb4564743068f99aaeb0e154de343efb"
+source = "git+https://github.com/servo/string-cache#ae950525434b642eff5f4904f5e0c76cd6ea99b9"
dependencies = [
"lazy_static 0.1.0 (git+https://github.com/Kimundi/lazy-static.rs)",
]
@@ -504,7 +568,7 @@ name = "style"
version = "0.0.1"
dependencies = [
"cssparser 0.1.0 (git+https://github.com/servo/rust-cssparser)",
- "encoding 0.1.0 (git+https://github.com/lifthrasiir/rust-encoding)",
+ "encoding 0.2.0 (git+https://github.com/lifthrasiir/rust-encoding)",
"geom 0.1.0 (git+https://github.com/servo/rust-geom)",
"lazy_static 0.1.0 (git+https://github.com/Kimundi/lazy-static.rs)",
"plugins 0.0.1",
@@ -519,11 +583,16 @@ name = "task_info"
version = "0.0.1"
[[package]]
+name = "tls"
+version = "0.0.1"
+source = "git+https://github.com/alexcrichton/green-rs#215f3c87bf545b36a90100b7fb209ba640f2f481"
+
+[[package]]
name = "url"
version = "0.1.0"
-source = "git+https://github.com/servo/rust-url#29f70a47230c2aa736e263977247c786e0b2c243"
+source = "git+https://github.com/servo/rust-url#8a61b7654ab5378b488225a1d8a9cbbbcbd38894"
dependencies = [
- "encoding 0.1.0 (git+https://github.com/lifthrasiir/rust-encoding)",
+ "encoding 0.2.0 (git+https://github.com/lifthrasiir/rust-encoding)",
]
[[package]]
@@ -541,10 +610,15 @@ dependencies = [
[[package]]
name = "uuid"
version = "0.0.1"
-source = "git+https://github.com/rust-lang/uuid#c3041068f413a5e46d795d21a346072794593839"
+source = "git+https://github.com/rust-lang/uuid#7c5af48d4f9074717199e05a1895f42b9fb1c1f0"
[[package]]
name = "xlib"
version = "0.1.0"
-source = "git+https://github.com/servo/rust-xlib#581d4faddec5188d3c3ae5307dbea28aab90644c"
+source = "git+https://github.com/servo/rust-xlib#58ec3847b592aeabdcfeb6a2d02033d3a2c7f427"
+
+[[package]]
+name = "xxhash"
+version = "0.0.1"
+source = "git+https://github.com/Jurily/rust-xxhash#7e4174e780af0cfb29a5e53ede0b987adca16396"
diff --git a/Cargo.toml b/Cargo.toml
index a48a9b7ecd5..64558757e2a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -54,3 +54,9 @@ optional = true
[dependencies.url]
git = "https://github.com/servo/rust-url"
+
+[dependencies.green]
+git = "https://github.com/alexcrichton/green-rs"
+
+[dependencies.rustuv]
+git = "https://github.com/alexcrichton/green-rs"
diff --git a/ORGANIZATION.md b/ORGANIZATION.md
index 661aa9d9f02..a709d07be9b 100644
--- a/ORGANIZATION.md
+++ b/ORGANIZATION.md
@@ -20,8 +20,6 @@
These libraries are either internal but used by Servo or external and need
special integration:
-* `support/glfw-rs`: Wrapping for the GLFW library. Will eventually move to
- being completely out of tree.
* `support/rust-task_info`: A binding to the task_info library on OS X.
## Tests
diff --git a/components/canvas/lib.rs b/components/canvas/lib.rs
index dd10bf89104..3574d657853 100644
--- a/components/canvas/lib.rs
+++ b/components/canvas/lib.rs
@@ -2,7 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-#![deny(unused_imports, unused_variable)]
+#![deny(unused_imports)]
+#![deny(unused_variables)]
extern crate azure;
extern crate geom;
diff --git a/components/compositing/compositor.rs b/components/compositing/compositor.rs
index c55e0193265..95714929ad2 100644
--- a/components/compositing/compositor.rs
+++ b/components/compositing/compositor.rs
@@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use compositor_layer::{CompositorData, CompositorLayer, DoesntWantScrollEvents};
-use compositor_layer::{ScrollPositionChanged, WantsScrollEvents};
+use compositor_layer::WantsScrollEvents;
use compositor_task::{ChangeReadyState, ChangeRenderState, CompositorEventListener};
use compositor_task::{CompositorProxy, CompositorReceiver, CompositorTask};
use compositor_task::{CreateOrUpdateDescendantLayer, CreateOrUpdateRootLayer, Exit};
@@ -50,9 +50,11 @@ use servo_util::memory::MemoryProfilerChan;
use servo_util::opts;
use servo_util::time::{profile, TimeProfilerChan};
use servo_util::{memory, time};
-use std::collections::hashmap::HashMap;
+use std::collections::HashMap;
+use std::collections::hash_map::{Occupied, Vacant};
use std::path::Path;
use std::rc::Rc;
+use std::slice::bytes::copy_memory;
use time::{precise_time_ns, precise_time_s};
use url::Url;
@@ -236,7 +238,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
fn handle_browser_message(&mut self, msg: Msg) -> bool {
match (msg, self.shutdown_state) {
(_, FinishedShuttingDown) =>
- fail!("compositor shouldn't be handling messages after shutting down"),
+ panic!("compositor shouldn't be handling messages after shutting down"),
(Exit(chan), _) => {
debug!("shutting down the constellation");
@@ -332,9 +334,14 @@ impl<Window: WindowMethods> IOCompositor<Window> {
}
fn change_ready_state(&mut self, pipeline_id: PipelineId, ready_state: ReadyState) {
- self.ready_states.insert_or_update_with(pipeline_id,
- ready_state,
- |_key, value| *value = ready_state);
+ match self.ready_states.entry(pipeline_id) {
+ Occupied(entry) => {
+ *entry.into_mut() = ready_state;
+ }
+ Vacant(entry) => {
+ entry.set(ready_state);
+ }
+ }
self.window.set_ready_state(self.get_earliest_pipeline_ready_state());
// If we're rendering in headless mode, schedule a recomposite.
@@ -352,9 +359,15 @@ impl<Window: WindowMethods> IOCompositor<Window> {
}
fn change_render_state(&mut self, pipeline_id: PipelineId, render_state: RenderState) {
- self.render_states.insert_or_update_with(pipeline_id,
- render_state,
- |_key, value| *value = render_state);
+ match self.render_states.entry(pipeline_id) {
+ Occupied(entry) => {
+ *entry.into_mut() = render_state;
+ }
+ Vacant(entry) => {
+ entry.set(render_state);
+ }
+ }
+
self.window.set_render_state(render_state);
}
@@ -486,7 +499,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
fn find_pipeline_root_layer(&self, pipeline_id: PipelineId) -> Rc<Layer<CompositorData>> {
match self.find_layer_with_pipeline_and_layer_id(pipeline_id, LayerId::null()) {
Some(ref layer) => layer.clone(),
- None => fail!("Tried to create or update layer for unknown pipeline"),
+ None => panic!("Tried to create or update layer for unknown pipeline"),
}
}
@@ -578,7 +591,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
match self.fragment_point.take() {
Some(point) => {
if !self.move_layer(pipeline_id, layer_id, Point2D::from_untyped(&point)) {
- fail!("Compositor: Tried to scroll to fragment with unknown layer.");
+ panic!("Compositor: Tried to scroll to fragment with unknown layer.");
}
self.start_scrolling_timer_if_necessary();
@@ -606,7 +619,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
Some(ref layer) => {
layer.bounds.borrow_mut().origin = Point2D::from_untyped(&new_origin)
}
- None => fail!("Compositor received SetLayerOrigin for nonexistent layer"),
+ None => panic!("Compositor received SetLayerOrigin for nonexistent layer"),
};
self.send_buffer_requests_for_all_layers();
@@ -636,7 +649,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
// FIXME: This may potentially be triggered by a race condition where a
// buffers are being rendered but the layer is removed before rendering
// completes.
- fail!("compositor given paint command for non-existent layer");
+ panic!("compositor given paint command for non-existent layer");
}
}
}
@@ -725,7 +738,6 @@ impl<Window: WindowMethods> IOCompositor<Window> {
return;
}
- debug!("osmain: window resized to {:?}", new_size);
self.window_size = new_size;
self.scene.set_root_layer_size(new_size.as_f32());
@@ -737,7 +749,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
self.got_load_complete_message = false;
let root_pipeline_id = match self.scene.root {
Some(ref layer) => layer.extra_data.borrow().pipeline.id.clone(),
- None => fail!("Compositor: Received LoadUrlWindowEvent without initialized compositor \
+ None => panic!("Compositor: Received LoadUrlWindowEvent without initialized compositor \
layers"),
};
@@ -783,12 +795,12 @@ impl<Window: WindowMethods> IOCompositor<Window> {
let delta = scroll_event.delta / self.scene.scale;
let cursor = scroll_event.cursor.as_f32() / self.scene.scale;
- let scrolled = match self.scene.root {
+ match self.scene.root {
Some(ref mut layer) => {
- layer.handle_scroll_event(delta, cursor) == ScrollPositionChanged
+ layer.handle_scroll_event(delta, cursor);
}
- None => false,
- };
+ None => {}
+ }
self.start_scrolling_timer_if_necessary();
self.send_buffer_requests_for_all_layers();
@@ -876,10 +888,17 @@ impl<Window: WindowMethods> IOCompositor<Window> {
HashMap<PipelineId, (RenderChan, Vec<RenderRequest>)> = HashMap::new();
for (layer, mut layer_requests) in requests.into_iter() {
- let pipeline_id = layer.extra_data.borrow().pipeline.id;
- let &(_, ref mut vec) = results.find_or_insert_with(pipeline_id, |_| {
- (layer.extra_data.borrow().pipeline.render_chan.clone(), Vec::new())
- });
+ let &(_, ref mut vec) =
+ match results.entry(layer.extra_data.borrow().pipeline.id) {
+ Occupied(mut entry) => {
+ *entry.get_mut() =
+ (layer.extra_data.borrow().pipeline.render_chan.clone(), vec!());
+ entry.into_mut()
+ }
+ Vacant(entry) => {
+ entry.set((layer.extra_data.borrow().pipeline.render_chan.clone(), vec!()))
+ }
+ };
// All the BufferRequests are in layer/device coordinates, but the render task
// wants to know the page coordinates. We scale them before sending them.
@@ -1045,11 +1064,9 @@ impl<Window: WindowMethods> IOCompositor<Window> {
for y in range(0, height) {
let dst_start = y * stride;
let src_start = (height - y - 1) * stride;
- unsafe {
- let src_slice = orig_pixels.slice(src_start, src_start + stride);
- pixels.slice_mut(dst_start, dst_start + stride)
- .copy_memory(src_slice.slice_to(stride));
- }
+ let src_slice = orig_pixels.slice(src_start, src_start + stride);
+ copy_memory(pixels.slice_mut(dst_start, dst_start + stride),
+ src_slice.slice_to(stride));
}
let mut img = png::Image {
width: width as u32,
@@ -1234,4 +1251,3 @@ impl<Window> CompositorEventListener for IOCompositor<Window> where Window: Wind
self.scrolling_timer.shutdown();
}
}
-
diff --git a/components/compositing/compositor_layer.rs b/components/compositing/compositor_layer.rs
index 2404230e5b5..b830e630f34 100644
--- a/components/compositing/compositor_layer.rs
+++ b/components/compositing/compositor_layer.rs
@@ -189,7 +189,7 @@ impl CompositorLayer for Layer<CompositorData> {
// layer buffer set is consumed, and None is returned.
fn add_buffers(&self, new_buffers: Box<LayerBufferSet>, epoch: Epoch) -> bool {
if self.extra_data.borrow().epoch != epoch {
- debug!("add_buffers: compositor epoch mismatch: {:?} != {:?}, id: {:?}",
+ debug!("add_buffers: compositor epoch mismatch: {} != {}, id: {}",
self.extra_data.borrow().epoch,
epoch,
self.extra_data.borrow().pipeline.id);
@@ -357,4 +357,3 @@ impl CompositorLayer for Layer<CompositorData> {
}
}
-
diff --git a/components/compositing/constellation.rs b/components/compositing/constellation.rs
index 7bbf1ebb5fb..7506d64b870 100644
--- a/components/compositing/constellation.rs
+++ b/components/compositing/constellation.rs
@@ -30,7 +30,7 @@ use servo_util::opts;
use servo_util::task::spawn_named;
use servo_util::time::TimeProfilerChan;
use std::cell::{Cell, RefCell};
-use std::collections::hashmap::{HashMap, HashSet};
+use std::collections::{HashMap, HashSet};
use std::io;
use std::mem::replace;
use std::rc::Rc;
@@ -267,7 +267,7 @@ impl NavigationContext {
/// Loads a new set of page frames, returning all evicted frame trees
fn load(&mut self, frame_tree: Rc<FrameTree>) -> Vec<Rc<FrameTree>> {
- debug!("navigating to {:?}", frame_tree.pipeline.id);
+ debug!("navigating to {}", frame_tree.pipeline.id);
let evicted = replace(&mut self.next, vec!());
if self.current.is_some() {
self.previous.push(self.current.take().unwrap());
@@ -465,7 +465,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
}
fn handle_failure_msg(&mut self, pipeline_id: PipelineId, subpage_id: Option<SubpageId>) {
- debug!("handling failure message from pipeline {:?}, {:?}", pipeline_id, subpage_id);
+ debug!("handling failure message from pipeline {}, {}", pipeline_id, subpage_id);
if opts::get().hard_fail {
// It's quite difficult to make Servo exit cleanly if some tasks have failed.
@@ -476,7 +476,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
unsafe { libc::exit(1); }
}
- let old_pipeline = match self.pipelines.find(&pipeline_id) {
+ let old_pipeline = match self.pipelines.get(&pipeline_id) {
None => {
debug!("no existing pipeline found; bailing out of failure recovery.");
return; // already failed?
@@ -536,7 +536,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
fn handle_frame_rect_msg(&mut self, pipeline_id: PipelineId, subpage_id: SubpageId,
rect: TypedRect<PagePx, f32>) {
- debug!("Received frame rect {:?} from {:?}, {:?}", rect, pipeline_id, subpage_id);
+ debug!("Received frame rect {} from {}, {}", rect, pipeline_id, subpage_id);
let mut already_sent = HashSet::new();
// Returns true if a child frame tree's subpage id matches the given subpage id
@@ -635,16 +635,16 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
// and add the new pipeline to their sub frames.
let frame_trees = self.find_all(source_pipeline_id);
if frame_trees.is_empty() {
- fail!("Constellation: source pipeline id of ScriptLoadedURLInIFrameMsg is not in
- navigation context, nor is it in a pending frame. This should be
- impossible.");
+ panic!("Constellation: source pipeline id of ScriptLoadedURLInIFrameMsg is not in
+ navigation context, nor is it in a pending frame. This should be
+ impossible.");
}
let next_pipeline_id = self.get_next_pipeline_id();
// Compare the pipeline's url to the new url. If the origin is the same,
// then reuse the script task in creating the new pipeline
- let source_pipeline = self.pipelines.find(&source_pipeline_id).expect("Constellation:
+ let source_pipeline = self.pipelines.get(&source_pipeline_id).expect("Constellation:
source Id of ScriptLoadedURLInIFrameMsg does have an associated pipeline in
constellation. This should be impossible.").clone();
@@ -655,10 +655,10 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
// FIXME(tkuehn): Need to follow the standardized spec for checking same-origin
// Reuse the script task if the URL is same-origin
let script_pipeline = if same_script {
- debug!("Constellation: loading same-origin iframe at {:?}", url);
+ debug!("Constellation: loading same-origin iframe at {}", url);
Some(source_pipeline.clone())
} else {
- debug!("Constellation: loading cross-origin iframe at {:?}", url);
+ debug!("Constellation: loading cross-origin iframe at {}", url);
None
};
@@ -669,7 +669,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
LoadData::new(url)
);
- let rect = self.pending_sizes.pop(&(source_pipeline_id, subpage_id));
+ let rect = self.pending_sizes.remove(&(source_pipeline_id, subpage_id));
for frame_tree in frame_trees.iter() {
frame_tree.children.borrow_mut().push(ChildFrameTree::new(
Rc::new(FrameTree::new(pipeline.clone(), Some(source_pipeline.clone()))),
@@ -716,7 +716,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
}
fn handle_navigate_msg(&mut self, direction: constellation_msg::NavigationDirection) {
- debug!("received message to navigate {:?}", direction);
+ debug!("received message to navigate {}", direction);
// TODO(tkuehn): what is the "critical point" beyond which pending frames
// should not be cleared? Currently, the behavior is that forward/back
@@ -762,7 +762,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
}
fn handle_renderer_ready_msg(&mut self, pipeline_id: PipelineId) {
- debug!("Renderer {:?} ready to send paint msg", pipeline_id);
+ debug!("Renderer {} ready to send paint msg", pipeline_id);
// This message could originate from a pipeline in the navigation context or
// from a pending frame. The only time that we will grant paint permission is
// when the message originates from a pending frame or the current frame.
@@ -795,7 +795,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
// If there are frames to revoke permission from, do so now.
match frame_change.before {
Some(revoke_id) if self.current_frame().is_some() => {
- debug!("Constellation: revoking permission from {:?}", revoke_id);
+ debug!("Constellation: revoking permission from {}", revoke_id);
let current_frame = self.current_frame().as_ref().unwrap();
let to_revoke = current_frame.find(revoke_id).expect(
@@ -812,7 +812,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
let mut flag = false;
{
if to_add.parent.borrow().is_some() {
- debug!("Constellation: replacing {:?} with {:?} in {:?}",
+ debug!("Constellation: replacing {} with {} in {}",
revoke_id, to_add.pipeline.id,
next_frame_tree.pipeline.id);
flag = true;
@@ -830,7 +830,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
let subpage_id = to_add.pipeline.subpage_id
.expect("Constellation:
Child frame's subpage id is None. This should be impossible.");
- let rect = self.pending_sizes.pop(&(parent.id, subpage_id));
+ let rect = self.pending_sizes.remove(&(parent.id, subpage_id));
let parent = next_frame_tree.find(parent.id).expect(
"Constellation: pending frame has a parent frame that is not
active. This is a bug.");
@@ -870,7 +870,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
for change in self.pending_frames.iter() {
let frame_tree = &change.after;
if frame_tree.parent.borrow().is_none() {
- debug!("constellation sending resize message to pending outer frame ({:?})",
+ debug!("constellation sending resize message to pending outer frame ({})",
frame_tree.pipeline.id);
let ScriptControlChan(ref chan) = frame_tree.pipeline.script_chan;
let _ = chan.send_opt(ResizeMsg(frame_tree.pipeline.id, new_size));
@@ -990,4 +990,3 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
}
}
}
-
diff --git a/components/compositing/lib.rs b/components/compositing/lib.rs
index 550b079f0f9..ecb25528c6e 100644
--- a/components/compositing/lib.rs
+++ b/components/compositing/lib.rs
@@ -7,13 +7,12 @@
#![feature(globs, phase, macro_rules)]
-#![deny(unused_imports, unused_variable)]
+#![deny(unused_imports)]
+#![deny(unused_variables)]
#[phase(plugin, link)]
extern crate log;
-extern crate debug;
-
extern crate alert;
extern crate azure;
extern crate devtools_traits;
diff --git a/components/compositing/pipeline.rs b/components/compositing/pipeline.rs
index 3fadfd90eaa..b01fa191822 100644
--- a/components/compositing/pipeline.rs
+++ b/components/compositing/pipeline.rs
@@ -168,7 +168,7 @@ impl Pipeline {
}
pub fn exit(&self) {
- debug!("pipeline {:?} exiting", self.id);
+ debug!("pipeline {} exiting", self.id);
// Script task handles shutting down layout, and layout handles shutting down the renderer.
// For now, if the script task has failed, we give up on clean shutdown.
@@ -189,4 +189,3 @@ impl Pipeline {
}
}
}
-
diff --git a/components/devtools/actor.rs b/components/devtools/actor.rs
index 792caa09de1..2d15134ec37 100644
--- a/components/devtools/actor.rs
+++ b/components/devtools/actor.rs
@@ -4,8 +4,8 @@
/// General actor system infrastructure.
-use std::any::{AnyPrivate, AnyRefExt, AnyMutRefExt};
-use std::collections::hashmap::HashMap;
+use std::any::{Any, AnyRefExt, AnyMutRefExt};
+use std::collections::HashMap;
use std::cell::{Cell, RefCell};
use std::intrinsics::TypeId;
use std::io::TcpStream;
@@ -16,7 +16,7 @@ use serialize::json;
/// A common trait for all devtools actors that encompasses an immutable name
/// and the ability to process messages that are directed to particular actors.
/// TODO: ensure the name is immutable
-pub trait Actor: AnyPrivate {
+pub trait Actor {
fn handle_message(&self,
registry: &ActorRegistry,
msg_type: &String,
@@ -45,9 +45,12 @@ impl<'a> AnyRefExt<'a> for &'a Actor + 'a {
fn is<T: 'static>(self) -> bool {
// This implementation is only needed so long as there's a Rust bug that
// prevents downcast_ref from giving realistic return values.
- let t = TypeId::of::<T>();
- let boxed = self.get_type_id();
- t == boxed
+ unsafe {
+ let t = TypeId::of::<T>();
+ let this: &Actor = transmute(self);
+ let boxed: TypeId = this.get_type_id();
+ t == boxed
+ }
}
fn downcast_ref<T: 'static>(self) -> Option<&'a T> {
@@ -94,7 +97,7 @@ impl ActorRegistry {
if script_id.as_slice() == "" {
return "".to_string();
}
- self.script_actors.borrow().find(&script_id).unwrap().to_string()
+ self.script_actors.borrow().get(&script_id).unwrap().to_string()
}
pub fn script_actor_registered(&self, script_id: String) -> bool {
@@ -108,7 +111,7 @@ impl ActorRegistry {
return key.to_string();
}
}
- fail!("couldn't find actor named {:s}", actor)
+ panic!("couldn't find actor named {:s}", actor)
}
/// Create a unique name based on a monotonically increasing suffix
@@ -134,7 +137,7 @@ impl ActorRegistry {
// fails for unknown reasons.
/*let actor: &Actor+Send+Sized = *self.actors.find(&name.to_string()).unwrap();
(actor as &Any).downcast_ref::<T>().unwrap()*/
- self.actors.find(&name.to_string()).unwrap().downcast_ref::<T>().unwrap()
+ self.actors.get(&name.to_string()).unwrap().downcast_ref::<T>().unwrap()
}
/// Find an actor by registered name
@@ -143,17 +146,17 @@ impl ActorRegistry {
// fails for unknown reasons.
/*let actor: &mut Actor+Send+Sized = *self.actors.find_mut(&name.to_string()).unwrap();
(actor as &mut Any).downcast_mut::<T>().unwrap()*/
- self.actors.find_mut(&name.to_string()).unwrap().downcast_mut::<T>().unwrap()
+ self.actors.get_mut(&name.to_string()).unwrap().downcast_mut::<T>().unwrap()
}
/// Attempt to process a message as directed by its `to` property. If the actor is not
/// found or does not indicate that it knew how to process the message, ignore the failure.
pub fn handle_message(&mut self, msg: &json::JsonObject, stream: &mut TcpStream) {
- let to = msg.find(&"to".to_string()).unwrap().as_string().unwrap();
- match self.actors.find(&to.to_string()) {
+ let to = msg.get(&"to".to_string()).unwrap().as_string().unwrap();
+ match self.actors.get(&to.to_string()) {
None => println!("message received for unknown actor \"{:s}\"", to),
Some(actor) => {
- let msg_type = msg.find(&"type".to_string()).unwrap().as_string().unwrap();
+ let msg_type = msg.get(&"type".to_string()).unwrap().as_string().unwrap();
if !actor.handle_message(self, &msg_type.to_string(), msg, stream) {
println!("unexpected message type \"{:s}\" found for actor \"{:s}\"",
msg_type, to);
diff --git a/components/devtools/actors/console.rs b/components/devtools/actors/console.rs
index a52bea0d3ba..dd714d3e220 100644
--- a/components/devtools/actors/console.rs
+++ b/components/devtools/actors/console.rs
@@ -32,11 +32,13 @@ struct StartedListenersReply {
}
#[deriving(Encodable)]
+#[allow(dead_code)]
struct ConsoleAPIMessage {
_type: String, //FIXME: should this be __type__ instead?
}
#[deriving(Encodable)]
+#[allow(dead_code)]
struct PageErrorMessage {
_type: String, //FIXME: should this be __type__ instead?
errorMessage: String,
@@ -54,6 +56,7 @@ struct PageErrorMessage {
}
#[deriving(Encodable)]
+#[allow(dead_code)]
struct LogMessage {
_type: String, //FIXME: should this be __type__ instead?
timeStamp: uint,
@@ -61,6 +64,7 @@ struct LogMessage {
}
#[deriving(Encodable)]
+#[allow(dead_code)]
enum ConsoleMessageType {
ConsoleAPIType(ConsoleAPIMessage),
PageErrorType(PageErrorMessage),
@@ -115,7 +119,7 @@ impl Actor for ConsoleActor {
stream: &mut TcpStream) -> bool {
match msg_type.as_slice() {
"getCachedMessages" => {
- let types = msg.find(&"messageTypes".to_string()).unwrap().as_list().unwrap();
+ let types = msg.get(&"messageTypes".to_string()).unwrap().as_list().unwrap();
let /*mut*/ messages = vec!();
for msg_type in types.iter() {
let msg_type = msg_type.as_string().unwrap();
@@ -187,7 +191,7 @@ impl Actor for ConsoleActor {
//TODO: actually implement listener filters that support starting/stopping
let msg = StopListenersReply {
from: self.name(),
- stoppedListeners: msg.find(&"listeners".to_string())
+ stoppedListeners: msg.get(&"listeners".to_string())
.unwrap()
.as_list()
.unwrap_or(&vec!())
@@ -212,7 +216,7 @@ impl Actor for ConsoleActor {
}
"evaluateJS" => {
- let input = msg.find(&"text".to_string()).unwrap().as_string().unwrap().to_string();
+ let input = msg.get(&"text".to_string()).unwrap().as_string().unwrap().to_string();
let (chan, port) = channel();
self.script_chan.send(EvaluateJS(self.pipeline, input.clone(), chan));
diff --git a/components/devtools/actors/inspector.rs b/components/devtools/actors/inspector.rs
index 9dffef6452d..ef5cc400a33 100644
--- a/components/devtools/actors/inspector.rs
+++ b/components/devtools/actors/inspector.rs
@@ -252,7 +252,7 @@ impl Actor for WalkerActor {
}
"children" => {
- let target = msg.find(&"node".to_string()).unwrap().as_string().unwrap();
+ let target = msg.get(&"node".to_string()).unwrap().as_string().unwrap();
let (tx, rx) = channel();
self.script_chan.send(GetChildren(self.pipeline,
registry.actor_to_script(target.to_string()),
@@ -347,6 +347,7 @@ struct GetLayoutReply {
}
#[deriving(Encodable)]
+#[allow(dead_code)]
struct AutoMargins {
top: String,
bottom: String,
@@ -389,14 +390,14 @@ impl Actor for PageStyleActor {
//TODO: query script for box layout properties of node (msg.node)
"getLayout" => {
- let target = msg.find(&"node".to_string()).unwrap().as_string().unwrap();
+ let target = msg.get(&"node".to_string()).unwrap().as_string().unwrap();
let (tx, rx) = channel();
self.script_chan.send(GetLayout(self.pipeline,
registry.actor_to_script(target.to_string()),
tx));
let (width, height) = rx.recv();
- let auto_margins = msg.find(&"autoMargins".to_string()).unwrap().as_boolean().unwrap();
+ let auto_margins = msg.get(&"autoMargins".to_string()).unwrap().as_boolean().unwrap();
//TODO: the remaining layout properties (margin, border, padding, position)
// as specified in getLayout in http://mxr.mozilla.org/mozilla-central/source/toolkit/devtools/server/actors/styles.js
diff --git a/components/devtools/lib.rs b/components/devtools/lib.rs
index 0afb4f6f9a4..026af7638eb 100644
--- a/components/devtools/lib.rs
+++ b/components/devtools/lib.rs
@@ -23,7 +23,6 @@ extern crate log;
extern crate collections;
extern crate core;
extern crate devtools_traits;
-extern crate debug;
extern crate serialize;
extern crate sync;
extern crate "msg" as servo_msg;
@@ -69,7 +68,7 @@ pub fn start_server(port: u16) -> Sender<DevtoolsControlMsg> {
static POLL_TIMEOUT: u64 = 300;
fn run_server(receiver: Receiver<DevtoolsControlMsg>, port: u16) {
- let listener = TcpListener::bind("127.0.0.1", port);
+ let listener = TcpListener::bind(format!("{}:{}", "127.0.0.1", port).as_slice());
// bind the listener to the specified address
let mut acceptor = listener.listen().unwrap();
@@ -88,9 +87,9 @@ fn run_server(receiver: Receiver<DevtoolsControlMsg>, port: u16) {
/// Process the input from a single devtools client until EOF.
fn handle_client(actors: Arc<Mutex<ActorRegistry>>, mut stream: TcpStream) {
- println!("connection established to {:?}", stream.peer_name().unwrap());
+ println!("connection established to {}", stream.peer_name().unwrap());
{
- let mut actors = actors.lock();
+ let actors = actors.lock();
let msg = actors.find::<RootActor>("root").encodable();
stream.write_json_packet(&msg);
}
diff --git a/components/gfx/buffer_map.rs b/components/gfx/buffer_map.rs
index 79612f6a9bd..04dc2a28f19 100644
--- a/components/gfx/buffer_map.rs
+++ b/components/gfx/buffer_map.rs
@@ -2,7 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-use std::collections::hashmap::HashMap;
+use std::collections::HashMap;
+use std::collections::hash_map::{Occupied, Vacant};
use geom::size::Size2D;
use layers::platform::surface::NativePaintingGraphicsContext;
use layers::layers::LayerBuffer;
@@ -85,10 +86,17 @@ impl BufferMap {
self.mem += new_buffer.get_mem();
// use lazy insertion function to prevent unnecessary allocation
let counter = &self.counter;
- self.map.find_or_insert_with(new_key, |_| BufferValue {
- buffers: vec!(),
- last_action: *counter
- }).buffers.push(new_buffer);
+ match self.map.entry(new_key) {
+ Occupied(entry) => {
+ entry.into_mut().buffers.push(new_buffer);
+ }
+ Vacant(entry) => {
+ entry.set(BufferValue {
+ buffers: vec!(new_buffer),
+ last_action: *counter,
+ });
+ }
+ }
let mut opt_key: Option<BufferKey> = None;
while self.mem > self.max_mem {
@@ -97,19 +105,19 @@ impl BufferMap {
None => {
match self.map.iter().min_by(|&(_, x)| x.last_action) {
Some((k, _)) => *k,
- None => fail!("BufferMap: tried to delete with no elements in map"),
+ None => panic!("BufferMap: tried to delete with no elements in map"),
}
}
};
if {
- let list = &mut self.map.get_mut(&old_key).buffers;
+ let list = &mut self.map[old_key].buffers;
let condemned_buffer = list.pop().take().unwrap();
self.mem -= condemned_buffer.get_mem();
condemned_buffer.destroy(graphics_context);
list.is_empty()
}
{ // then
- self.map.pop(&old_key); // Don't store empty vectors!
+ self.map.remove(&old_key); // Don't store empty vectors!
opt_key = None;
} else {
opt_key = Some(old_key);
@@ -121,7 +129,7 @@ impl BufferMap {
pub fn find(&mut self, size: Size2D<uint>) -> Option<Box<LayerBuffer>> {
let mut flag = false; // True if key needs to be popped after retrieval.
let key = BufferKey::get(size);
- let ret = match self.map.find_mut(&key) {
+ let ret = match self.map.get_mut(&key) {
Some(ref mut buffer_val) => {
buffer_val.last_action = self.counter;
self.counter += 1;
@@ -137,7 +145,7 @@ impl BufferMap {
};
if flag {
- self.map.pop(&key); // Don't store empty vectors!
+ self.map.remove(&key); // Don't store empty vectors!
}
ret
diff --git a/components/gfx/display_list/mod.rs b/components/gfx/display_list/mod.rs
index ef4587a1393..55782463436 100644
--- a/components/gfx/display_list/mod.rs
+++ b/components/gfx/display_list/mod.rs
@@ -20,7 +20,6 @@ use text::glyph::CharIndex;
use text::TextRun;
use azure::azure::AzFloat;
-use collections::Deque;
use collections::dlist::{mod, DList};
use geom::{Point2D, Rect, SideOffsets2D, Size2D, Matrix2D};
use libc::uintptr_t;
@@ -188,7 +187,7 @@ impl DisplayList {
/// Appends the given item to the display list.
#[inline]
pub fn push(&mut self, item: DisplayItem) {
- self.list.push(item);
+ self.list.push_back(item);
}
/// Appends the items in the given display list to this one, removing them in the process.
@@ -476,7 +475,7 @@ impl DisplayItem {
}
ImageDisplayItemClass(ref image_item) => {
- debug!("Drawing image at {:?}.", image_item.base.bounds);
+ debug!("Drawing image at {}.", image_item.base.bounds);
let mut y_offset = Au(0);
while y_offset < image_item.base.bounds.size.height {
diff --git a/components/gfx/display_list/optimizer.rs b/components/gfx/display_list/optimizer.rs
index e508e351010..69cdc469de3 100644
--- a/components/gfx/display_list/optimizer.rs
+++ b/components/gfx/display_list/optimizer.rs
@@ -33,7 +33,7 @@ impl DisplayListOptimizer {
for item in display_list.iter() {
match self.process_display_item(item) {
None => {}
- Some(display_item) => result.push(display_item),
+ Some(display_item) => result.push_back(display_item),
}
}
DisplayList {
@@ -51,4 +51,3 @@ impl DisplayListOptimizer {
}
}
}
-
diff --git a/components/gfx/font.rs b/components/gfx/font.rs
index 489b2a3ef30..d7c28fb1d8c 100644
--- a/components/gfx/font.rs
+++ b/components/gfx/font.rs
@@ -68,7 +68,7 @@ pub trait FontTableMethods {
fn with_buffer(&self, |*const u8, uint|);
}
-#[deriving(Clone)]
+#[deriving(Clone, Show)]
pub struct FontMetrics {
pub underline_size: Au,
pub underline_offset: Au,
@@ -103,7 +103,7 @@ impl Font {
pub fn shape_text(&mut self, text: &str, is_whitespace: bool) -> Arc<GlyphStore> {
self.make_shaper();
let shaper = &self.shaper;
- match self.shape_cache.find_equiv(&text) {
+ match self.shape_cache.find_equiv(text) {
None => {}
Some(glyphs) => return (*glyphs).clone(),
}
diff --git a/components/gfx/font_cache_task.rs b/components/gfx/font_cache_task.rs
index 3941f870f99..1b56a5994a3 100644
--- a/components/gfx/font_cache_task.rs
+++ b/components/gfx/font_cache_task.rs
@@ -133,7 +133,7 @@ impl FontCache {
let maybe_resource = load_whole_resource(&self.resource_task, url.clone());
match maybe_resource {
Ok((_, bytes)) => {
- let family = self.web_families.get_mut(&family_name);
+ let family = &mut self.web_families[family_name];
family.add_template(url.to_string().as_slice(), Some(bytes));
},
Err(_) => {
@@ -142,7 +142,7 @@ impl FontCache {
}
}
LocalSource(ref local_family_name) => {
- let family = self.web_families.get_mut(&family_name);
+ let family = &mut self.web_families[family_name];
get_variations_for_family(local_family_name.as_slice(), |path| {
family.add_template(path.as_slice(), None);
});
@@ -170,7 +170,7 @@ impl FontCache {
}
fn transform_family(&self, family: &LowercaseString) -> LowercaseString {
- match self.generic_fonts.find(family) {
+ match self.generic_fonts.get(family) {
None => family.clone(),
Some(mapped_family) => (*mapped_family).clone()
}
@@ -182,7 +182,7 @@ impl FontCache {
// look up canonical name
if self.local_families.contains_key(family_name) {
debug!("FontList: Found font family with name={:s}", family_name.to_string());
- let s = self.local_families.get_mut(family_name);
+ let s = &mut self.local_families[*family_name];
if s.templates.len() == 0 {
get_variations_for_family(family_name.as_slice(), |path| {
@@ -207,7 +207,7 @@ impl FontCache {
fn find_font_in_web_family<'a>(&'a mut self, family_name: &LowercaseString, desc: &FontTemplateDescriptor)
-> Option<Arc<FontTemplateData>> {
if self.web_families.contains_key(family_name) {
- let family = self.web_families.get_mut(family_name);
+ let family = &mut self.web_families[*family_name];
let maybe_font = family.find_font_for_style(desc, &self.font_context);
maybe_font
} else {
@@ -237,7 +237,7 @@ impl FontCache {
}
}
- fail!("Unable to find any fonts that match (do you have fallback fonts installed?)");
+ panic!("Unable to find any fonts that match (do you have fallback fonts installed?)");
}
}
diff --git a/components/gfx/font_context.rs b/components/gfx/font_context.rs
index 3c701e164e4..87eb7a77833 100644
--- a/components/gfx/font_context.rs
+++ b/components/gfx/font_context.rs
@@ -25,12 +25,10 @@ use azure::AzFloat;
use azure::azure_hl::SkiaBackend;
use azure::scaled_font::ScaledFont;
-#[cfg(target_os="linux")]
-#[cfg(target_os="android")]
+#[cfg(any(target_os="linux", target_os = "android"))]
use azure::scaled_font::FontData;
-#[cfg(target_os="linux")]
-#[cfg(target_os="android")]
+#[cfg(any(target_os="linux", target_os = "android"))]
fn create_scaled_font(template: &Arc<FontTemplateData>, pt_size: Au) -> ScaledFont {
ScaledFont::new(SkiaBackend, FontData(&template.bytes), pt_size.to_subpx() as AzFloat)
}
diff --git a/components/gfx/lib.rs b/components/gfx/lib.rs
index b5f8c3e961d..c267e139fe1 100644
--- a/components/gfx/lib.rs
+++ b/components/gfx/lib.rs
@@ -4,13 +4,13 @@
#![feature(globs, macro_rules, phase, unsafe_destructor)]
-#![deny(unused_imports, unused_variable)]
+#![deny(unused_imports)]
+#![deny(unused_variables)]
#![feature(phase)]
#[phase(plugin, link)]
extern crate log;
-extern crate debug;
extern crate azure;
extern crate collections;
extern crate geom;
@@ -38,8 +38,11 @@ extern crate url;
extern crate harfbuzz;
// Linux and Android-specific library dependencies
-#[cfg(target_os="linux")] #[cfg(target_os="android")] extern crate fontconfig;
-#[cfg(target_os="linux")] #[cfg(target_os="android")] extern crate freetype;
+#[cfg(any(target_os="linux", target_os = "android"))]
+extern crate fontconfig;
+
+#[cfg(any(target_os="linux", target_os = "android"))]
+extern crate freetype;
// Mac OS-specific library dependencies
#[cfg(target_os="macos")] extern crate core_foundation;
diff --git a/components/gfx/platform/freetype/font.rs b/components/gfx/platform/freetype/font.rs
index 4bd5aded06e..475f0eeddb9 100644
--- a/components/gfx/platform/freetype/font.rs
+++ b/components/gfx/platform/freetype/font.rs
@@ -43,7 +43,7 @@ pub struct FontTable;
impl FontTableMethods for FontTable {
fn with_buffer(&self, _blk: |*const u8, uint|) {
- fail!()
+ panic!()
}
}
@@ -61,7 +61,7 @@ impl Drop for FontHandle {
assert!(self.face.is_not_null());
unsafe {
if !FT_Done_Face(self.face).succeeded() {
- fail!("FT_Done_Face failed");
+ panic!("FT_Done_Face failed");
}
}
}
@@ -139,15 +139,15 @@ impl FontHandleMethods for FontHandle {
if valid {
let weight =(*os2).usWeightClass;
match weight {
- 1 | 100..199 => font_weight::Weight100,
- 2 | 200..299 => font_weight::Weight200,
- 3 | 300..399 => font_weight::Weight300,
- 4 | 400..499 => font_weight::Weight400,
- 5 | 500..599 => font_weight::Weight500,
- 6 | 600..699 => font_weight::Weight600,
- 7 | 700..799 => font_weight::Weight700,
- 8 | 800..899 => font_weight::Weight800,
- 9 | 900..999 => font_weight::Weight900,
+ 1 | 100...199 => font_weight::Weight100,
+ 2 | 200...299 => font_weight::Weight200,
+ 3 | 300...399 => font_weight::Weight300,
+ 4 | 400...499 => font_weight::Weight400,
+ 5 | 500...599 => font_weight::Weight500,
+ 6 | 600...699 => font_weight::Weight600,
+ 7 | 700...799 => font_weight::Weight700,
+ 8 | 800...899 => font_weight::Weight800,
+ 9 | 900...999 => font_weight::Weight900,
_ => default_weight
}
} else {
@@ -190,7 +190,6 @@ impl FontHandleMethods for FontHandle {
let void_glyph = (*self.face).glyph;
let slot: FT_GlyphSlot = mem::transmute(void_glyph);
assert!(slot.is_not_null());
- debug!("metrics: {:?}", (*slot).metrics);
let advance = (*slot).metrics.horiAdvance;
debug!("h_advance for {} is {}", glyph, advance);
let advance = advance as i32;
@@ -255,7 +254,7 @@ impl FontHandleMethods for FontHandle {
line_gap: height,
};
- debug!("Font metrics (@{:f} pt): {:?}", geometry::to_pt(em_size), metrics);
+ debug!("Font metrics (@{:f} pt): {}", geometry::to_pt(em_size), metrics);
return metrics;
}
@@ -297,4 +296,3 @@ impl<'a> FontHandle {
return geometry::from_frac_px(value * x_scale);
}
}
-
diff --git a/components/gfx/platform/freetype/font_context.rs b/components/gfx/platform/freetype/font_context.rs
index 39047ac04db..7ff3b136189 100644
--- a/components/gfx/platform/freetype/font_context.rs
+++ b/components/gfx/platform/freetype/font_context.rs
@@ -70,7 +70,7 @@ impl FontContextHandle {
let mut ctx: FT_Library = ptr::null_mut();
let result = FT_New_Library(ptr as FT_Memory, &mut ctx);
- if !result.succeeded() { fail!("Unable to initialize FreeType library"); }
+ if !result.succeeded() { panic!("Unable to initialize FreeType library"); }
FT_Add_Default_Modules(ctx);
diff --git a/components/gfx/platform/freetype/font_list.rs b/components/gfx/platform/freetype/font_list.rs
index 2b6c85a4363..d0cf39fc303 100644
--- a/components/gfx/platform/freetype/font_list.rs
+++ b/components/gfx/platform/freetype/font_list.rs
@@ -75,13 +75,13 @@ pub fn get_variations_for_family(family_name: &str, callback: |String|) {
let file = if FcPatternGetString(*font, FC_FILE.as_ptr() as *mut i8, 0, &mut file) == FcResultMatch {
string::raw::from_buf(file as *const i8 as *const u8)
} else {
- fail!();
+ panic!();
};
let mut index: libc::c_int = 0;
let index = if FcPatternGetInteger(*font, FC_INDEX.as_ptr() as *mut i8, 0, &mut index) == FcResultMatch {
index
} else {
- fail!();
+ panic!();
};
debug!("variation file: {}", file);
diff --git a/components/gfx/platform/macos/font.rs b/components/gfx/platform/macos/font.rs
index b621c2991ce..529bdcf615d 100644
--- a/components/gfx/platform/macos/font.rs
+++ b/components/gfx/platform/macos/font.rs
@@ -178,7 +178,7 @@ impl FontHandleMethods for FontHandle {
average_advance: average_advance,
line_gap: Au::from_frac_px(line_gap),
};
- debug!("Font metrics (@{:f} pt): {:?}", self.ctfont.pt_size() as f64, metrics);
+ debug!("Font metrics (@{:f} pt): {}", self.ctfont.pt_size() as f64, metrics);
return metrics;
}
diff --git a/components/gfx/platform/mod.rs b/components/gfx/platform/mod.rs
index ded6f3888e8..f3bc3f6ec08 100644
--- a/components/gfx/platform/mod.rs
+++ b/components/gfx/platform/mod.rs
@@ -2,15 +2,13 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-#[cfg(target_os="linux")]
-#[cfg(target_os="android")]
+#[cfg(any(target_os="linux", target_os = "android"))]
pub use platform::freetype::{font, font_context, font_list, font_template};
#[cfg(target_os="macos")]
pub use platform::macos::{font, font_context, font_list, font_template};
-#[cfg(target_os="linux")]
-#[cfg(target_os="android")]
+#[cfg(any(target_os="linux", target_os = "android"))]
pub mod freetype {
pub mod font;
pub mod font_context;
diff --git a/components/gfx/render_context.rs b/components/gfx/render_context.rs
index 0a26c4a761f..c8c1df2cc63 100644
--- a/components/gfx/render_context.rs
+++ b/components/gfx/render_context.rs
@@ -114,8 +114,8 @@ impl<'a> RenderContext<'a> {
let (pixel_width, pixels, source_format) = match image.pixels {
RGBA8(ref pixels) => (4, pixels.as_slice(), B8G8R8A8),
K8(ref pixels) => (1, pixels.as_slice(), A8),
- RGB8(_) => fail!("RGB8 color type not supported"),
- KA8(_) => fail!("KA8 color type not supported"),
+ RGB8(_) => panic!("RGB8 color type not supported"),
+ KA8(_) => panic!("KA8 color type not supported"),
};
let stride = image.width * pixel_width;
@@ -366,7 +366,7 @@ impl<'a> RenderContext<'a> {
let is_groove = match style {
border_style::groove => true,
border_style::ridge => false,
- _ => fail!("invalid border style")
+ _ => panic!("invalid border style")
};
let darker_color = self.scale_color(color, if is_groove { 1.0/3.0 } else { 2.0/3.0 });
let (outer_color, inner_color) = match (direction, is_groove) {
@@ -388,7 +388,7 @@ impl<'a> RenderContext<'a> {
let is_inset = match style {
border_style::inset => true,
border_style::outset => false,
- _ => fail!("invalid border style")
+ _ => panic!("invalid border style")
};
// original bounds as a Rect<f32>
let original_bounds = self.get_scaled_bounds(bounds, border, 0.0);
diff --git a/components/gfx/render_task.rs b/components/gfx/render_task.rs
index 9eeeed51000..e1d190ac5fa 100644
--- a/components/gfx/render_task.rs
+++ b/components/gfx/render_task.rs
@@ -152,7 +152,7 @@ impl<C> RenderTask<C> where C: RenderListener + Send {
time_profiler_chan: TimeProfilerChan,
shutdown_chan: Sender<()>) {
let ConstellationChan(c) = constellation_chan.clone();
- spawn_named_with_send_on_failure("RenderTask", task_state::Render, proc() {
+ spawn_named_with_send_on_failure("RenderTask", task_state::RENDER, proc() {
{
// Ensures that the render task and graphics context are destroyed before the
// shutdown message.
@@ -237,7 +237,7 @@ impl<C> RenderTask<C> where C: RenderListener + Send {
if self.epoch == epoch {
self.render(&mut replies, buffer_requests, scale, layer_id);
} else {
- debug!("renderer epoch mismatch: {:?} != {:?}", self.epoch, epoch);
+ debug!("renderer epoch mismatch: {} != {}", self.epoch, epoch);
}
}
@@ -340,14 +340,14 @@ impl<C> RenderTask<C> where C: RenderListener + Send {
for (i, tile) in tiles.into_iter().enumerate() {
let thread_id = i % self.worker_threads.len();
let layer_buffer = self.find_or_create_layer_buffer_for_tile(&tile, scale);
- self.worker_threads.get_mut(thread_id).paint_tile(tile,
- layer_buffer,
- render_layer.clone(),
- scale);
+ self.worker_threads[thread_id].paint_tile(tile,
+ layer_buffer,
+ render_layer.clone(),
+ scale);
}
let new_buffers = Vec::from_fn(tile_count, |i| {
let thread_id = i % self.worker_threads.len();
- self.worker_threads.get_mut(thread_id).get_painted_tile_buffer()
+ self.worker_threads[thread_id].get_painted_tile_buffer()
});
let layer_buffer_set = box LayerBufferSet {
@@ -570,4 +570,3 @@ enum MsgToWorkerThread {
enum MsgFromWorkerThread {
PaintedTileMsgFromWorkerThread(Box<LayerBuffer>),
}
-
diff --git a/components/gfx/text/glyph.rs b/components/gfx/text/glyph.rs
index 4ae1ce13b95..4d68bf89049 100644
--- a/components/gfx/text/glyph.rs
+++ b/components/gfx/text/glyph.rs
@@ -7,7 +7,7 @@ use servo_util::range;
use servo_util::range::{Range, RangeIndex, IntRangeIndex, EachIndex};
use servo_util::geometry::Au;
-use std::cmp::{PartialOrd, PartialEq};
+use std::cmp::PartialOrd;
use std::num::{NumCast, Zero};
use std::mem;
use std::u16;
@@ -22,7 +22,7 @@ use geom::point::Point2D;
/// In the uncommon case (multiple glyphs per unicode character, large glyph index/advance, or
/// glyph offsets), we pack the glyph count into GlyphEntry, and store the other glyph information
/// in DetailedGlyphStore.
-#[deriving(Clone)]
+#[deriving(Clone, Show)]
struct GlyphEntry {
value: u32,
}
@@ -251,7 +251,7 @@ impl GlyphEntry {
// Stores data for a detailed glyph, in the case that several glyphs
// correspond to one character, or the glyph's data couldn't be packed.
-#[deriving(Clone)]
+#[deriving(Clone, Show)]
struct DetailedGlyph {
id: GlyphId,
// glyph's advance, in the text's direction (RTL or RTL)
@@ -270,7 +270,7 @@ impl DetailedGlyph {
}
}
-#[deriving(PartialEq, Clone, Eq)]
+#[deriving(PartialEq, Clone, Eq, Show)]
struct DetailedGlyphRecord {
// source string offset/GlyphEntry offset in the TextRun
entry_offset: CharIndex,
@@ -319,7 +319,7 @@ impl<'a> DetailedGlyphStore {
detail_offset: self.detail_buffer.len() as int,
};
- debug!("Adding entry[off={}] for detailed glyphs: {:?}", entry_offset, glyphs);
+ debug!("Adding entry[off={}] for detailed glyphs: {}", entry_offset, glyphs);
/* TODO: don't actually assert this until asserts are compiled
in/out based on severity, debug/release, etc. This assertion
@@ -563,7 +563,7 @@ impl<'a> GlyphStore {
}
}.adapt_character_flags_of_entry(self.entry_buffer[i.to_uint()]);
- *self.entry_buffer.get_mut(i.to_uint()) = entry;
+ self.entry_buffer[i.to_uint()] = entry;
}
pub fn add_glyphs_for_char_index(&mut self, i: CharIndex, data_for_glyphs: &[GlyphData]) {
@@ -589,9 +589,9 @@ impl<'a> GlyphStore {
}
}.adapt_character_flags_of_entry(self.entry_buffer[i.to_uint()]);
- debug!("Adding multiple glyphs[idx={}, count={}]: {:?}", i, glyph_count, entry);
+ debug!("Adding multiple glyphs[idx={}, count={}]: {}", i, glyph_count, entry);
- *self.entry_buffer.get_mut(i.to_uint()) = entry;
+ self.entry_buffer[i.to_uint()] = entry;
}
// used when a character index has no associated glyph---for example, a ligature continuation.
@@ -601,7 +601,7 @@ impl<'a> GlyphStore {
let entry = GlyphEntry::complex(cluster_start, ligature_start, 0);
debug!("adding spacer for chracter without associated glyph[idx={}]", i);
- *self.entry_buffer.get_mut(i.to_uint()) = entry;
+ self.entry_buffer[i.to_uint()] = entry;
}
pub fn iter_glyphs_for_char_index(&'a self, i: CharIndex) -> GlyphIterator<'a> {
@@ -611,10 +611,10 @@ impl<'a> GlyphStore {
#[inline]
pub fn iter_glyphs_for_char_range(&'a self, rang: &Range<CharIndex>) -> GlyphIterator<'a> {
if rang.begin() >= self.char_len() {
- fail!("iter_glyphs_for_range: range.begin beyond length!");
+ panic!("iter_glyphs_for_range: range.begin beyond length!");
}
if rang.end() > self.char_len() {
- fail!("iter_glyphs_for_range: range.end beyond length!");
+ panic!("iter_glyphs_for_range: range.end beyond length!");
}
GlyphIterator {
@@ -666,25 +666,25 @@ impl<'a> GlyphStore {
pub fn set_char_is_space(&mut self, i: CharIndex) {
assert!(i < self.char_len());
let entry = self.entry_buffer[i.to_uint()];
- *self.entry_buffer.get_mut(i.to_uint()) = entry.set_char_is_space();
+ self.entry_buffer[i.to_uint()] = entry.set_char_is_space();
}
pub fn set_char_is_tab(&mut self, i: CharIndex) {
assert!(i < self.char_len());
let entry = self.entry_buffer[i.to_uint()];
- *self.entry_buffer.get_mut(i.to_uint()) = entry.set_char_is_tab();
+ self.entry_buffer[i.to_uint()] = entry.set_char_is_tab();
}
pub fn set_char_is_newline(&mut self, i: CharIndex) {
assert!(i < self.char_len());
let entry = self.entry_buffer[i.to_uint()];
- *self.entry_buffer.get_mut(i.to_uint()) = entry.set_char_is_newline();
+ self.entry_buffer[i.to_uint()] = entry.set_char_is_newline();
}
pub fn set_can_break_before(&mut self, i: CharIndex, t: BreakType) {
assert!(i < self.char_len());
let entry = self.entry_buffer[i.to_uint()];
- *self.entry_buffer.get_mut(i.to_uint()) = entry.set_can_break_before(t);
+ self.entry_buffer[i.to_uint()] = entry.set_can_break_before(t);
}
}
diff --git a/components/gfx/text/shaping/harfbuzz.rs b/components/gfx/text/shaping/harfbuzz.rs
index a6243b4d481..f097d96722a 100644
--- a/components/gfx/text/shaping/harfbuzz.rs
+++ b/components/gfx/text/shaping/harfbuzz.rs
@@ -249,7 +249,7 @@ impl Shaper {
} else {
byte_to_glyph = Vec::from_elem(byte_max as uint, CONTINUATION_BYTE);
for (i, _) in text.char_indices() {
- *byte_to_glyph.get_mut(i) = NO_GLYPH;
+ byte_to_glyph[i] = NO_GLYPH;
}
}
@@ -259,7 +259,7 @@ impl Shaper {
let loc = glyph_data.byte_offset_of_glyph(i);
if loc < byte_max {
assert!(byte_to_glyph[loc as uint] != CONTINUATION_BYTE);
- *byte_to_glyph.get_mut(loc as uint) = i as i32;
+ byte_to_glyph[loc as uint] = i as i32;
} else {
debug!("ERROR: tried to set out of range byte_to_glyph: idx={}, glyph idx={}",
loc,
@@ -271,7 +271,7 @@ impl Shaper {
debug!("text: {:s}", text);
debug!("(char idx): char->(glyph index):");
for (i, ch) in text.char_indices() {
- debug!("{}: {} --> {:d}", i, ch, *byte_to_glyph.get(i) as int);
+ debug!("{}: {} --> {:d}", i, ch, *byte_to_glyph.get(i).unwrap() as int);
}
// some helpers
diff --git a/components/gfx/text/text_run.rs b/components/gfx/text/text_run.rs
index 0136b848ba5..4bb280ef261 100644
--- a/components/gfx/text/text_run.rs
+++ b/components/gfx/text/text_run.rs
@@ -238,9 +238,9 @@ impl<'a> TextRun {
}
pub fn min_width_for_range(&self, range: &Range<CharIndex>) -> Au {
- debug!("iterating outer range {:?}", range);
+ debug!("iterating outer range {}", range);
self.iter_slices_for_range(range).fold(Au(0), |max_piece_width, (_, offset, slice_range)| {
- debug!("iterated on {:?}[{:?}]", offset, slice_range);
+ debug!("iterated on {}[{}]", offset, slice_range);
Au::max(max_piece_width, self.advance_for_range(&slice_range))
})
}
diff --git a/components/gfx/text/util.rs b/components/gfx/text/util.rs
index 3c43b5d9b0f..05b257688fb 100644
--- a/components/gfx/text/util.rs
+++ b/components/gfx/text/util.rs
@@ -48,7 +48,7 @@ pub fn transform_text(text: &str,
if ch != '\n' {
new_line_index = new_line_index + CharIndex(1);
}
- output_text.push_char(ch);
+ output_text.push(ch);
}
}
text.len() > 0 && is_in_whitespace(text.char_at_reverse(0), mode)
@@ -67,14 +67,14 @@ pub fn transform_text(text: &str,
// TODO: record skipped char
} else {
// TODO: record kept char
- output_text.push_char(ch);
+ output_text.push(ch);
}
} else { /* next_in_whitespace; possibly add a space char */
if in_whitespace {
// TODO: record skipped char
} else {
// TODO: record kept char
- output_text.push_char(' ');
+ output_text.push(' ');
}
}
// save whitespace context for next char
diff --git a/components/layout/block.rs b/components/layout/block.rs
index baf80f6ca3f..9b004bd798c 100644
--- a/components/layout/block.rs
+++ b/components/layout/block.rs
@@ -25,7 +25,7 @@
//!
//! http://dev.w3.org/csswg/css-sizing/
-#![deny(unsafe_block)]
+#![deny(unsafe_blocks)]
use construct::FlowConstructor;
use context::LayoutContext;
@@ -37,7 +37,7 @@ use flow::{MutableFlowUtils, PreorderFlowTraversal, PostorderFlowTraversal, mut_
use flow;
use fragment::{Fragment, ImageFragment, InlineBlockFragment, FragmentBoundsIterator};
use fragment::ScannedTextFragment;
-use incremental::{Reflow, ReflowOutOfFlow};
+use incremental::{REFLOW, REFLOW_OUT_OF_FLOW};
use layout_debug;
use model::{Auto, IntrinsicISizes, MarginCollapseInfo, MarginsCollapse, MarginsCollapseThrough};
use model::{MaybeAuto, NoCollapsibleMargins, Specified, specified, specified_or_none};
@@ -394,7 +394,7 @@ impl Iterator<MaybeAuto> for CandidateBSizeIterator {
Some(Specified(self.min_block_size))
}
FoundCandidateBSizeStatus => None,
- InitialCandidateBSizeStatus => fail!(),
+ InitialCandidateBSizeStatus => panic!(),
}
}
}
@@ -441,7 +441,7 @@ impl<'a> PreorderFlowTraversal for AbsoluteAssignBSizesTraversal<'a> {
}
assert!(block_flow.base.flags.is_absolutely_positioned());
- if !block_flow.base.restyle_damage.intersects(ReflowOutOfFlow | Reflow) {
+ if !block_flow.base.restyle_damage.intersects(REFLOW_OUT_OF_FLOW | REFLOW) {
return
}
@@ -551,7 +551,7 @@ pub struct BlockFlow {
bitflags! {
flags BlockFlowFlags: u8 {
#[doc="If this is set, then this block flow is the root flow."]
- static IsRoot = 0x01,
+ const IS_ROOT = 0x01,
}
}
@@ -787,7 +787,7 @@ impl BlockFlow {
}
let (block_start_margin_value, block_end_margin_value) = match self.base.collapsible_margins {
- MarginsCollapseThrough(_) => fail!("Margins unexpectedly collapsed through root flow."),
+ MarginsCollapseThrough(_) => panic!("Margins unexpectedly collapsed through root flow."),
MarginsCollapse(block_start_margin, block_end_margin) => {
(block_start_margin.collapse(), block_end_margin.collapse())
}
@@ -827,7 +827,7 @@ impl BlockFlow {
margins_may_collapse: MarginsMayCollapseFlag) {
let _scope = layout_debug_scope!("assign_block_size_block_base {:x}", self.base.debug_id());
- if self.base.restyle_damage.contains(Reflow) {
+ if self.base.restyle_damage.contains(REFLOW) {
// Our current border-box position.
let mut cur_b = Au(0);
@@ -1064,7 +1064,7 @@ impl BlockFlow {
// size has not yet been computed. (See `assign_inline_position_for_formatting_context()`.)
if !self.base.flags.is_absolutely_positioned() &&
self.formatting_context_type() == NonformattingContext {
- self.base.restyle_damage.remove(ReflowOutOfFlow | Reflow);
+ self.base.restyle_damage.remove(REFLOW_OUT_OF_FLOW | REFLOW);
}
}
@@ -1213,7 +1213,7 @@ impl BlockFlow {
self.fragment.border_box.size.block = block_size;
self.base.position.size.block = block_size;
- self.base.restyle_damage.remove(ReflowOutOfFlow | Reflow);
+ self.base.restyle_damage.remove(REFLOW_OUT_OF_FLOW | REFLOW);
}
// Our inline-size was set to the inline-size of the containing block by the flow's parent.
@@ -1405,7 +1405,7 @@ impl BlockFlow {
fn assign_inline_position_for_formatting_context(&mut self) {
debug_assert!(self.formatting_context_type() != NonformattingContext);
- if !self.base.restyle_damage.intersects(ReflowOutOfFlow | Reflow) {
+ if !self.base.restyle_damage.intersects(REFLOW_OUT_OF_FLOW | REFLOW) {
return
}
@@ -1538,7 +1538,7 @@ impl Flow for BlockFlow {
fn assign_inline_sizes(&mut self, layout_context: &LayoutContext) {
let _scope = layout_debug_scope!("block::assign_inline_sizes {:x}", self.base.debug_id());
- if !self.base.restyle_damage.intersects(ReflowOutOfFlow | Reflow) {
+ if !self.base.restyle_damage.intersects(REFLOW_OUT_OF_FLOW | REFLOW) {
return
}
@@ -1619,7 +1619,7 @@ impl Flow for BlockFlow {
}
if self.base.flags.impacted_by_floats() {
- if self.base.restyle_damage.intersects(ReflowOutOfFlow | Reflow) {
+ if self.base.restyle_damage.intersects(REFLOW_OUT_OF_FLOW | REFLOW) {
self.assign_block_size(layout_context);
// Don't remove the restyle damage; `assign_block_size` decides whether that is
// appropriate (which in the case of e.g. absolutely-positioned flows, it is not).
@@ -1731,7 +1731,7 @@ impl Flow for BlockFlow {
}
fn mark_as_root(&mut self) {
- self.flags.insert(IsRoot)
+ self.flags.insert(IS_ROOT)
}
/// Return true if store overflow is delayed for this flow.
@@ -1742,7 +1742,7 @@ impl Flow for BlockFlow {
}
fn is_root(&self) -> bool {
- self.flags.contains(IsRoot)
+ self.flags.contains(IS_ROOT)
}
fn is_float(&self) -> bool {
@@ -2325,7 +2325,7 @@ impl ISizeAndMarginsComputer for AbsoluteReplaced {
let inline_size = match computed_inline_size {
Specified(w) => w,
- _ => fail!("{} {}",
+ _ => panic!("{} {}",
"The used value for inline_size for absolute replaced flow",
"should have already been calculated by now.")
};
@@ -2436,7 +2436,7 @@ impl ISizeAndMarginsComputer for BlockReplaced {
-> ISizeConstraintSolution {
match input.computed_inline_size {
Specified(_) => {},
- Auto => fail!("BlockReplaced: inline_size should have been computed by now")
+ Auto => panic!("BlockReplaced: inline_size should have been computed by now")
};
self.solve_block_inline_size_constraints(block, input)
}
@@ -2491,7 +2491,7 @@ impl ISizeAndMarginsComputer for FloatReplaced {
let margin_inline_end = inline_end_margin.specified_or_zero();
let inline_size = match computed_inline_size {
Specified(w) => w,
- Auto => fail!("FloatReplaced: inline_size should have been computed by now")
+ Auto => panic!("FloatReplaced: inline_size should have been computed by now")
};
debug!("assign_inline_sizes_float -- inline_size: {}", inline_size);
ISizeConstraintSolution::new(inline_size, margin_inline_start, margin_inline_end)
diff --git a/components/layout/construct.rs b/components/layout/construct.rs
index 0c866184755..7315d435200 100644
--- a/components/layout/construct.rs
+++ b/components/layout/construct.rs
@@ -11,7 +11,7 @@
//! maybe it's an absolute or fixed position thing that hasn't found its containing block yet.
//! Construction items bubble up the tree from children to parents until they find their homes.
-#![deny(unsafe_block)]
+#![deny(unsafe_blocks)]
use css::node_style::StyledNode;
use block::BlockFlow;
@@ -27,7 +27,7 @@ use fragment::{InlineAbsoluteHypotheticalFragmentInfo, InlineBlockFragment};
use fragment::{InlineBlockFragmentInfo, SpecificFragmentInfo, TableCellFragment};
use fragment::{TableColumnFragment, TableColumnFragmentInfo, TableFragment, TableRowFragment};
use fragment::{TableWrapperFragment, UnscannedTextFragment, UnscannedTextFragmentInfo};
-use incremental::{ReconstructFlow, RestyleDamage};
+use incremental::{RECONSTRUCT_FLOW, RestyleDamage};
use inline::InlineFlow;
use parallel;
use table_wrapper::TableWrapperFlow;
@@ -38,7 +38,7 @@ use table_rowgroup::TableRowGroupFlow;
use table_row::TableRowFlow;
use table_cell::TableCellFlow;
use text::TextRunScanner;
-use util::{HasNewlyConstructedFlow, LayoutDataAccess, OpaqueNodeMethods, LayoutDataWrapper};
+use util::{HAS_NEWLY_CONSTRUCTED_FLOW, LayoutDataAccess, OpaqueNodeMethods, LayoutDataWrapper};
use wrapper::{PostorderNodeMutTraversal, TLayoutNode, ThreadSafeLayoutNode};
use wrapper::{Before, After, Normal};
@@ -53,9 +53,9 @@ use script::dom::node::{DocumentNodeTypeId, ElementNodeTypeId, ProcessingInstruc
use script::dom::node::{TextNodeTypeId};
use script::dom::htmlobjectelement::is_image_data;
use servo_util::opts;
-use std::collections::{DList, Deque};
+use std::collections::DList;
use std::mem;
-use std::sync::atomics::Relaxed;
+use std::sync::atomic::Relaxed;
use style::ComputedValues;
use style::computed_values::{display, position, float};
use sync::Arc;
@@ -193,7 +193,7 @@ impl InlineFragmentsAccumulator {
fn to_dlist(self) -> DList<Fragment> {
let InlineFragmentsAccumulator {
- fragments: mut fragments,
+ mut fragments,
enclosing_style
} = self;
@@ -403,7 +403,7 @@ impl<'a> FlowConstructor<'a> {
}
ConstructionItemConstructionResult(InlineFragmentsConstructionItem(
InlineFragmentsConstructionResult {
- splits: splits,
+ splits,
fragments: successor_fragments,
abs_descendants: kid_abs_descendants,
})) => {
@@ -412,7 +412,7 @@ impl<'a> FlowConstructor<'a> {
// Pull apart the {ib} split object and push its predecessor fragments
// onto the list.
let InlineBlockSplit {
- predecessors: predecessors,
+ predecessors,
flow: kid_flow
} = split;
inline_fragment_accumulator.push_all(predecessors);
@@ -461,7 +461,7 @@ impl<'a> FlowConstructor<'a> {
whitespace_style,
whitespace_damage,
fragment_info);
- inline_fragment_accumulator.fragments.push(fragment);
+ inline_fragment_accumulator.fragments.push_back(fragment);
}
ConstructionItemConstructionResult(TableColumnFragmentConstructionItem(_)) => {
// TODO: Implement anonymous table objects for missing parents
@@ -490,7 +490,7 @@ impl<'a> FlowConstructor<'a> {
node.type_id() == Some(ElementNodeTypeId(HTMLInputElementTypeId)) {
let fragment_info = UnscannedTextFragment(UnscannedTextFragmentInfo::new(node));
let fragment = Fragment::new_from_specific_info(node, fragment_info);
- inline_fragment_accumulator.fragments.push(fragment);
+ inline_fragment_accumulator.fragments.push_back(fragment);
first_fragment = false;
}
@@ -586,12 +586,12 @@ impl<'a> FlowConstructor<'a> {
InlineFragmentsAccumulator::from_inline_node(node)).to_dlist(),
flow: flow,
};
- opt_inline_block_splits.push(split);
+ opt_inline_block_splits.push_back(split);
abs_descendants.push_descendants(kid_abs_descendants);
}
ConstructionItemConstructionResult(InlineFragmentsConstructionItem(
InlineFragmentsConstructionResult {
- splits: splits,
+ splits,
fragments: successors,
abs_descendants: kid_abs_descendants,
})) => {
@@ -599,7 +599,7 @@ impl<'a> FlowConstructor<'a> {
// Bubble up {ib} splits.
for split in splits.into_iter() {
let InlineBlockSplit {
- predecessors: predecessors,
+ predecessors,
flow: kid_flow
} = split;
fragment_accumulator.push_all(predecessors);
@@ -611,7 +611,7 @@ impl<'a> FlowConstructor<'a> {
.to_dlist(),
flow: kid_flow,
};
- opt_inline_block_splits.push(split)
+ opt_inline_block_splits.push_back(split)
}
// Push residual fragments.
@@ -629,7 +629,7 @@ impl<'a> FlowConstructor<'a> {
whitespace_style,
whitespace_damage,
fragment_info);
- fragment_accumulator.fragments.push(fragment)
+ fragment_accumulator.fragments.push_back(fragment)
}
ConstructionItemConstructionResult(TableColumnFragmentConstructionItem(_)) => {
// TODO: Implement anonymous table objects for missing parents
@@ -684,7 +684,7 @@ impl<'a> FlowConstructor<'a> {
};
let mut fragments = DList::new();
- fragments.push(fragment);
+ fragments.push_back(fragment);
let construction_item = InlineFragmentsConstructionItem(InlineFragmentsConstructionResult {
splits: DList::new(),
@@ -706,7 +706,7 @@ impl<'a> FlowConstructor<'a> {
let fragment = Fragment::new_from_specific_info(node, fragment_info);
let mut fragment_accumulator = InlineFragmentsAccumulator::from_inline_node(node);
- fragment_accumulator.fragments.push(fragment);
+ fragment_accumulator.fragments.push_back(fragment);
let construction_item = InlineFragmentsConstructionItem(InlineFragmentsConstructionResult {
splits: DList::new(),
@@ -731,7 +731,7 @@ impl<'a> FlowConstructor<'a> {
let fragment = Fragment::new_from_specific_info(node, fragment_info);
let mut fragment_accumulator = InlineFragmentsAccumulator::from_inline_node(node);
- fragment_accumulator.fragments.push(fragment);
+ fragment_accumulator.fragments.push_back(fragment);
let construction_item = InlineFragmentsConstructionItem(InlineFragmentsConstructionResult {
splits: DList::new(),
@@ -949,14 +949,14 @@ impl<'a> FlowConstructor<'a> {
pub fn repair_if_possible(&mut self, node: &ThreadSafeLayoutNode) -> bool {
// We can skip reconstructing the flow if we don't have to reconstruct and none of our kids
// did either.
- if node.restyle_damage().contains(ReconstructFlow) {
+ if node.restyle_damage().contains(RECONSTRUCT_FLOW) {
return false
}
let mut need_to_reconstruct = false;
for kid in node.children() {
- if kid.flags().contains(HasNewlyConstructedFlow) {
- kid.remove_flags(HasNewlyConstructedFlow);
+ if kid.flags().contains(HAS_NEWLY_CONSTRUCTED_FLOW) {
+ kid.remove_flags(HAS_NEWLY_CONSTRUCTED_FLOW);
need_to_reconstruct = true
}
}
@@ -1020,7 +1020,7 @@ impl<'a> PostorderNodeMutTraversal for FlowConstructor<'a> {
}
};
- debug!("building flow for node: {:?} {:?}", display, float);
+ debug!("building flow for node: {} {}", display, float);
// Switch on display and floatedness.
match (display, float, positioning) {
@@ -1124,7 +1124,7 @@ impl<'a> PostorderNodeMutTraversal for FlowConstructor<'a> {
}
}
- node.insert_flags(HasNewlyConstructedFlow);
+ node.insert_flags(HAS_NEWLY_CONSTRUCTED_FLOW);
true
}
}
@@ -1285,7 +1285,7 @@ pub fn strip_ignorable_whitespace_from_end(this: &mut DList<Fragment>) {
while !this.is_empty() && this.back().as_ref().unwrap().is_ignorable_whitespace() {
debug!("stripping ignorable whitespace from end");
- drop(this.pop());
+ drop(this.pop_back());
}
}
diff --git a/components/layout/css/matching.rs b/components/layout/css/matching.rs
index 62374477181..f1615aa005d 100644
--- a/components/layout/css/matching.rs
+++ b/components/layout/css/matching.rs
@@ -602,7 +602,7 @@ impl<'ln> MatchMethods for LayoutNode<'ln> {
let mut layout_data_ref = self.mutate_layout_data();
match &mut *layout_data_ref {
- &None => fail!("no layout data"),
+ &None => panic!("no layout data"),
&Some(ref mut layout_data) => {
match self.type_id() {
Some(TextNodeTypeId) => {
diff --git a/components/layout/display_list_builder.rs b/components/layout/display_list_builder.rs
index ae2984f8091..2948d678050 100644
--- a/components/layout/display_list_builder.rs
+++ b/components/layout/display_list_builder.rs
@@ -8,7 +8,7 @@
//! list building, as the actual painting does not happen here—only deciding *what* we're going to
//! paint.
-#![deny(unsafe_block)]
+#![deny(unsafe_blocks)]
use block::BlockFlow;
use context::LayoutContext;
@@ -578,8 +578,8 @@ impl FragmentDisplayListBuilding for Fragment {
// Create special per-fragment-type display items.
match self.specific {
- UnscannedTextFragment(_) => fail!("Shouldn't see unscanned fragments here."),
- TableColumnFragment(_) => fail!("Shouldn't see table column fragments here."),
+ UnscannedTextFragment(_) => panic!("Shouldn't see unscanned fragments here."),
+ TableColumnFragment(_) => panic!("Shouldn't see table column fragments here."),
ScannedTextFragment(ref text_fragment) => {
// Create the text display item.
let orientation = if self.style.writing_mode.is_vertical() {
@@ -733,7 +733,7 @@ impl FragmentDisplayListBuilding for Fragment {
Size2D(geometry::to_frac_px(content_size.width) as f32,
geometry::to_frac_px(content_size.height) as f32));
- debug!("finalizing position and size of iframe for {:?},{:?}",
+ debug!("finalizing position and size of iframe for {},{}",
iframe_fragment.pipeline_id,
iframe_fragment.subpage_id);
let ConstellationChan(ref chan) = layout_context.shared.constellation_chan;
@@ -841,7 +841,7 @@ impl BlockFlowDisplayListBuilding for BlockFlow {
background_color: color::rgba(1.0, 1.0, 1.0, 0.0),
scroll_policy: scroll_policy,
};
- self.base.layers.push(new_layer)
+ self.base.layers.push_back(new_layer)
}
fn build_display_list_for_floating_block(&mut self, layout_context: &LayoutContext) {
diff --git a/components/layout/floats.rs b/components/layout/floats.rs
index a72247e0d50..aba36dad080 100644
--- a/components/layout/floats.rs
+++ b/components/layout/floats.rs
@@ -21,7 +21,7 @@ pub enum FloatKind {
impl FloatKind {
pub fn from_property(property: float::T) -> FloatKind {
match property {
- float::none => fail!("can't create a float type from an unfloated property"),
+ float::none => panic!("can't create a float type from an unfloated property"),
float::left => FloatLeft,
float::right => FloatRight,
}
@@ -46,7 +46,7 @@ struct Float {
impl fmt::Show for Float {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- write!(f, "bounds={} kind={:?}", self.bounds, self.kind)
+ write!(f, "bounds={} kind={}", self.bounds, self.kind)
}
}
@@ -95,7 +95,7 @@ pub struct PlacementInfo {
impl fmt::Show for PlacementInfo {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f,
- "size={} ceiling={} max_inline_size={} kind={:?}",
+ "size={} ceiling={} max_inline_size={} kind={}",
self.size,
self.ceiling,
self.max_inline_size,
@@ -232,7 +232,7 @@ impl Floats {
(max(block_start, r_block_start), r_block_end)
}
(None, None, None, None) => return None,
- _ => fail!("Reached unreachable state when computing float area")
+ _ => panic!("Reached unreachable state when computing float area")
};
// FIXME(eatkinson): This assertion is too strong and fails in some cases. It is OK to
@@ -261,7 +261,7 @@ impl Floats {
}
}
- debug!("add_float: added float with info {:?}", new_info);
+ debug!("add_float: added float with info {}", new_info);
let new_float = Float {
bounds: LogicalRect::from_point_size(
@@ -332,7 +332,7 @@ impl Floats {
let maybe_location = self.available_rect(float_b,
info.size.block,
info.max_inline_size);
- debug!("place_float: Got available rect: {:?} for y-pos: {}", maybe_location, float_b);
+ debug!("place_float: Got available rect: {} for y-pos: {}", maybe_location, float_b);
match maybe_location {
// If there are no floats blocking us, return the current location
// TODO(eatkinson): integrate with overflow
diff --git a/components/layout/flow.rs b/components/layout/flow.rs
index 91a16966557..e22ea27c36e 100644
--- a/components/layout/flow.rs
+++ b/components/layout/flow.rs
@@ -32,7 +32,7 @@ use floats::Floats;
use flow_list::{FlowList, FlowListIterator, MutFlowListIterator};
use flow_ref::FlowRef;
use fragment::{Fragment, FragmentBoundsIterator, TableRowFragment, TableCellFragment};
-use incremental::{ReconstructFlow, Reflow, ReflowOutOfFlow, RestyleDamage};
+use incremental::{RECONSTRUCT_FLOW, REFLOW, REFLOW_OUT_OF_FLOW, RestyleDamage};
use inline::InlineFlow;
use model::{CollapsibleMargins, IntrinsicISizes, MarginCollapseInfo};
use parallel::FlowParallelInfo;
@@ -59,7 +59,7 @@ use std::num::Zero;
use std::fmt;
use std::iter::Zip;
use std::raw;
-use std::sync::atomics::{AtomicUint, SeqCst};
+use std::sync::atomic::{AtomicUint, SeqCst};
use std::slice::MutItems;
use style::computed_values::{clear, float, position, text_align};
use style::ComputedValues;
@@ -80,94 +80,94 @@ pub trait Flow: fmt::Show + ToString + Sync {
/// If this is a block flow, returns the underlying object, borrowed immutably. Fails
/// otherwise.
fn as_immutable_block<'a>(&'a self) -> &'a BlockFlow {
- fail!("called as_immutable_block() on a non-block flow")
+ panic!("called as_immutable_block() on a non-block flow")
}
/// If this is a block flow, returns the underlying object. Fails otherwise.
fn as_block<'a>(&'a mut self) -> &'a mut BlockFlow {
debug!("called as_block() on a flow of type {}", self.class());
- fail!("called as_block() on a non-block flow")
+ panic!("called as_block() on a non-block flow")
}
/// If this is an inline flow, returns the underlying object, borrowed immutably. Fails
/// otherwise.
fn as_immutable_inline<'a>(&'a self) -> &'a InlineFlow {
- fail!("called as_immutable_inline() on a non-inline flow")
+ panic!("called as_immutable_inline() on a non-inline flow")
}
/// If this is an inline flow, returns the underlying object. Fails otherwise.
fn as_inline<'a>(&'a mut self) -> &'a mut InlineFlow {
- fail!("called as_inline() on a non-inline flow")
+ panic!("called as_inline() on a non-inline flow")
}
/// If this is a table wrapper flow, returns the underlying object. Fails otherwise.
fn as_table_wrapper<'a>(&'a mut self) -> &'a mut TableWrapperFlow {
- fail!("called as_table_wrapper() on a non-tablewrapper flow")
+ panic!("called as_table_wrapper() on a non-tablewrapper flow")
}
/// If this is a table wrapper flow, returns the underlying object, borrowed immutably. Fails
/// otherwise.
fn as_immutable_table_wrapper<'a>(&'a self) -> &'a TableWrapperFlow {
- fail!("called as_immutable_table_wrapper() on a non-tablewrapper flow")
+ panic!("called as_immutable_table_wrapper() on a non-tablewrapper flow")
}
/// If this is a table flow, returns the underlying object. Fails otherwise.
fn as_table<'a>(&'a mut self) -> &'a mut TableFlow {
- fail!("called as_table() on a non-table flow")
+ panic!("called as_table() on a non-table flow")
}
/// If this is a table flow, returns the underlying object, borrowed immutably. Fails otherwise.
fn as_immutable_table<'a>(&'a self) -> &'a TableFlow {
- fail!("called as_table() on a non-table flow")
+ panic!("called as_table() on a non-table flow")
}
/// If this is a table colgroup flow, returns the underlying object. Fails otherwise.
fn as_table_colgroup<'a>(&'a mut self) -> &'a mut TableColGroupFlow {
- fail!("called as_table_colgroup() on a non-tablecolgroup flow")
+ panic!("called as_table_colgroup() on a non-tablecolgroup flow")
}
/// If this is a table rowgroup flow, returns the underlying object. Fails otherwise.
fn as_table_rowgroup<'a>(&'a mut self) -> &'a mut TableRowGroupFlow {
- fail!("called as_table_rowgroup() on a non-tablerowgroup flow")
+ panic!("called as_table_rowgroup() on a non-tablerowgroup flow")
}
/// If this is a table rowgroup flow, returns the underlying object, borrowed immutably. Fails
/// otherwise.
fn as_immutable_table_rowgroup<'a>(&'a self) -> &'a TableRowGroupFlow {
- fail!("called as_table_rowgroup() on a non-tablerowgroup flow")
+ panic!("called as_table_rowgroup() on a non-tablerowgroup flow")
}
/// If this is a table row flow, returns the underlying object. Fails otherwise.
fn as_table_row<'a>(&'a mut self) -> &'a mut TableRowFlow {
- fail!("called as_table_row() on a non-tablerow flow")
+ panic!("called as_table_row() on a non-tablerow flow")
}
/// If this is a table row flow, returns the underlying object, borrowed immutably. Fails
/// otherwise.
fn as_immutable_table_row<'a>(&'a self) -> &'a TableRowFlow {
- fail!("called as_table_row() on a non-tablerow flow")
+ panic!("called as_table_row() on a non-tablerow flow")
}
/// If this is a table cell flow, returns the underlying object. Fails otherwise.
fn as_table_caption<'a>(&'a mut self) -> &'a mut TableCaptionFlow {
- fail!("called as_table_caption() on a non-tablecaption flow")
+ panic!("called as_table_caption() on a non-tablecaption flow")
}
/// If this is a table cell flow, returns the underlying object. Fails otherwise.
fn as_table_cell<'a>(&'a mut self) -> &'a mut TableCellFlow {
- fail!("called as_table_cell() on a non-tablecell flow")
+ panic!("called as_table_cell() on a non-tablecell flow")
}
/// If this is a table cell flow, returns the underlying object, borrowed immutably. Fails
/// otherwise.
fn as_immutable_table_cell<'a>(&'a self) -> &'a TableCellFlow {
- fail!("called as_table_cell() on a non-tablecell flow")
+ panic!("called as_table_cell() on a non-tablecell flow")
}
/// If this is a table row or table rowgroup or table flow, returns column inline-sizes.
/// Fails otherwise.
fn column_inline_sizes<'a>(&'a mut self) -> &'a mut Vec<ColumnInlineSize> {
- fail!("called column_inline_sizes() on non-table flow")
+ panic!("called column_inline_sizes() on non-table flow")
}
// Main methods
@@ -179,17 +179,17 @@ pub trait Flow: fmt::Show + ToString + Sync {
/// This function must decide minimum/preferred inline-sizes based on its children's inline-
/// sizes and the dimensions of any boxes it is responsible for flowing.
fn bubble_inline_sizes(&mut self) {
- fail!("bubble_inline_sizes not yet implemented")
+ panic!("bubble_inline_sizes not yet implemented")
}
/// Pass 2 of reflow: computes inline-size.
fn assign_inline_sizes(&mut self, _ctx: &LayoutContext) {
- fail!("assign_inline_sizes not yet implemented")
+ panic!("assign_inline_sizes not yet implemented")
}
/// Pass 3a of reflow: computes block-size.
fn assign_block_size<'a>(&mut self, _ctx: &'a LayoutContext<'a>) {
- fail!("assign_block_size not yet implemented")
+ panic!("assign_block_size not yet implemented")
}
/// Assigns block-sizes in-order; or, if this is a float, places the float. The default
@@ -201,7 +201,7 @@ pub trait Flow: fmt::Show + ToString + Sync {
let impacted = base(&*self).flags.impacted_by_floats();
if impacted {
self.assign_block_size(layout_context);
- mut_base(&mut *self).restyle_damage.remove(ReflowOutOfFlow | Reflow);
+ mut_base(&mut *self).restyle_damage.remove(REFLOW_OUT_OF_FLOW | REFLOW);
}
impacted
}
@@ -285,7 +285,7 @@ pub trait Flow: fmt::Show + ToString + Sync {
/// Return the dimensions of the containing block generated by this flow for absolutely-
/// positioned descendants. For block flows, this is the padding box.
fn generated_containing_block_rect(&self) -> LogicalRect<Au> {
- fail!("generated_containing_block_position not yet implemented for this flow")
+ panic!("generated_containing_block_position not yet implemented for this flow")
}
/// Returns a layer ID for the given fragment.
@@ -301,26 +301,6 @@ pub trait Flow: fmt::Show + ToString + Sync {
fn repair_style(&mut self, new_style: &Arc<ComputedValues>);
}
-impl<'a, E, S: Encoder<E>> Encodable<S, E> for &'a Flow + 'a {
- fn encode(&self, e: &mut S) -> Result<(), E> {
- e.emit_struct("flow", 0, |e| {
- try!(e.emit_struct_field("class", 0, |e| self.class().encode(e)))
- e.emit_struct_field("data", 1, |e| {
- match self.class() {
- BlockFlowClass => self.as_immutable_block().encode(e),
- InlineFlowClass => self.as_immutable_inline().encode(e),
- TableFlowClass => self.as_immutable_table().encode(e),
- TableWrapperFlowClass => self.as_immutable_table_wrapper().encode(e),
- TableRowGroupFlowClass => self.as_immutable_table_rowgroup().encode(e),
- TableRowFlowClass => self.as_immutable_table_row().encode(e),
- TableCellFlowClass => self.as_immutable_table_cell().encode(e),
- _ => { Ok(()) } // TODO: Support captions
- }
- })
- })
- }
-}
-
// Base access
#[inline(always)]
@@ -832,7 +812,24 @@ impl<E, S: Encoder<E>> Encodable<S, E> for BaseFlow {
e.emit_struct_field("children", 4, |e| {
e.emit_seq(self.children.len(), |e| {
for (i, c) in self.children.iter().enumerate() {
- try!(e.emit_seq_elt(i, |e| c.encode(e)))
+ try!(e.emit_seq_elt(i, |e| {
+ try!(e.emit_struct("flow", 0, |e| {
+ try!(e.emit_struct_field("class", 0, |e| c.class().encode(e)))
+ e.emit_struct_field("data", 1, |e| {
+ match c.class() {
+ BlockFlowClass => c.as_immutable_block().encode(e),
+ InlineFlowClass => c.as_immutable_inline().encode(e),
+ TableFlowClass => c.as_immutable_table().encode(e),
+ TableWrapperFlowClass => c.as_immutable_table_wrapper().encode(e),
+ TableRowGroupFlowClass => c.as_immutable_table_rowgroup().encode(e),
+ TableRowFlowClass => c.as_immutable_table_row().encode(e),
+ TableCellFlowClass => c.as_immutable_table_cell().encode(e),
+ _ => { Ok(()) } // TODO: Support captions
+ }
+ })
+ }))
+ Ok(())
+ }))
}
Ok(())
})
@@ -846,7 +843,7 @@ impl<E, S: Encoder<E>> Encodable<S, E> for BaseFlow {
impl Drop for BaseFlow {
fn drop(&mut self) {
if self.ref_count.load(SeqCst) != 0 {
- fail!("Flow destroyed before its ref count hit zero—this is unsafe!")
+ panic!("Flow destroyed before its ref count hit zero—this is unsafe!")
}
}
}
@@ -884,7 +881,7 @@ impl BaseFlow {
// New flows start out as fully damaged.
let mut damage = RestyleDamage::all();
- damage.remove(ReconstructFlow);
+ damage.remove(RECONSTRUCT_FLOW);
BaseFlow {
ref_count: AtomicUint::new(1),
@@ -1057,7 +1054,7 @@ impl<'a> ImmutableFlowUtils for &'a Flow + 'a {
box TableCellFlow::from_node_and_fragment(node, fragment) as Box<Flow>
},
_ => {
- fail!("no need to generate a missing child")
+ panic!("no need to generate a missing child")
}
};
FlowRef::new(flow)
@@ -1283,7 +1280,7 @@ impl ContainingBlockLink {
#[inline]
pub fn generated_containing_block_rect(&mut self) -> LogicalRect<Au> {
match self.link {
- None => fail!("haven't done it"),
+ None => panic!("haven't done it"),
Some(ref mut link) => link.generated_containing_block_rect(),
}
}
diff --git a/components/layout/flow_list.rs b/components/layout/flow_list.rs
index 12e909c9c9b..a4b2abe0eb3 100644
--- a/components/layout/flow_list.rs
+++ b/components/layout/flow_list.rs
@@ -5,7 +5,7 @@
use flow::Flow;
use flow_ref::FlowRef;
-use std::collections::{Deque, dlist, DList};
+use std::collections::{dlist, DList};
// This needs to be reworked now that we have dynamically-sized types in Rust.
// Until then, it's just a wrapper around DList.
@@ -22,19 +22,6 @@ pub struct MutFlowListIterator<'a> {
it: dlist::MutItems<'a, FlowRef>,
}
-impl Collection for FlowList {
- /// O(1)
- #[inline]
- fn is_empty(&self) -> bool {
- self.flows.is_empty()
- }
- /// O(1)
- #[inline]
- fn len(&self) -> uint {
- self.flows.len()
- }
-}
-
impl FlowList {
/// Provide a reference to the front element, or None if the list is empty
#[inline]
@@ -78,7 +65,7 @@ impl FlowList {
///
/// O(1)
pub fn push_back(&mut self, new_tail: FlowRef) {
- self.flows.push(new_tail);
+ self.flows.push_back(new_tail);
}
/// Create an empty list
@@ -104,6 +91,18 @@ impl FlowList {
it: self.flows.iter_mut(),
}
}
+
+ /// O(1)
+ #[inline]
+ pub fn is_empty(&self) -> bool {
+ self.flows.is_empty()
+ }
+
+ /// O(1)
+ #[inline]
+ pub fn len(&self) -> uint {
+ self.flows.len()
+ }
}
impl<'a> Iterator<&'a Flow + 'a> for FlowListIterator<'a> {
diff --git a/components/layout/flow_ref.rs b/components/layout/flow_ref.rs
index e61d726707c..eb2b4e03c8d 100644
--- a/components/layout/flow_ref.rs
+++ b/components/layout/flow_ref.rs
@@ -12,7 +12,7 @@ use flow;
use std::mem;
use std::ptr;
use std::raw;
-use std::sync::atomics::SeqCst;
+use std::sync::atomic::SeqCst;
#[unsafe_no_drop_flag]
pub struct FlowRef {
@@ -33,18 +33,18 @@ impl FlowRef {
}
}
-impl Deref<Flow + 'static> for FlowRef {
- fn deref<'a>(&'a self) -> &'a Flow + 'static {
+impl<'a> Deref<Flow + 'a> for FlowRef {
+ fn deref(&self) -> &Flow + 'a {
unsafe {
- mem::transmute_copy::<raw::TraitObject, &'a Flow + 'static>(&self.object)
+ mem::transmute_copy::<raw::TraitObject, &Flow + 'a>(&self.object)
}
}
}
-impl DerefMut<Flow + 'static> for FlowRef {
- fn deref_mut<'a>(&'a mut self) -> &'a mut Flow + 'static {
+impl<'a> DerefMut<Flow + 'a> for FlowRef {
+ fn deref_mut<'a>(&mut self) -> &mut Flow + 'a {
unsafe {
- mem::transmute_copy::<raw::TraitObject, &'a mut Flow + 'static>(&self.object)
+ mem::transmute_copy::<raw::TraitObject, &mut Flow + 'a>(&self.object)
}
}
}
diff --git a/components/layout/fragment.rs b/components/layout/fragment.rs
index aeb48de43c4..d9fd9db4839 100644
--- a/components/layout/fragment.rs
+++ b/components/layout/fragment.rs
@@ -4,7 +4,7 @@
//! The `Fragment` type, which represents the leaves of the layout tree.
-#![deny(unsafe_block)]
+#![deny(unsafe_blocks)]
use css::node_style::StyledNode;
use construct::FlowConstructor;
@@ -639,18 +639,18 @@ impl Fragment {
QuantitiesIncludedInIntrinsicInlineSizes::all()
}
TableFragment | TableCellFragment => {
- IntrinsicInlineSizeIncludesPadding |
- IntrinsicInlineSizeIncludesBorder |
- IntrinsicInlineSizeIncludesSpecified
+ INTRINSIC_INLINE_SIZE_INCLUDES_PADDING |
+ INTRINSIC_INLINE_SIZE_INCLUDES_BORDER |
+ INTRINSIC_INLINE_SIZE_INCLUDES_SPECIFIED
}
TableWrapperFragment => {
- IntrinsicInlineSizeIncludesMargins |
- IntrinsicInlineSizeIncludesBorder |
- IntrinsicInlineSizeIncludesSpecified
+ INTRINSIC_INLINE_SIZE_INCLUDES_MARGINS |
+ INTRINSIC_INLINE_SIZE_INCLUDES_BORDER |
+ INTRINSIC_INLINE_SIZE_INCLUDES_SPECIFIED
}
TableRowFragment => {
- IntrinsicInlineSizeIncludesBorder |
- IntrinsicInlineSizeIncludesSpecified
+ INTRINSIC_INLINE_SIZE_INCLUDES_BORDER |
+ INTRINSIC_INLINE_SIZE_INCLUDES_SPECIFIED
}
ScannedTextFragment(_) | TableColumnFragment(_) | UnscannedTextFragment(_) |
InlineAbsoluteHypotheticalFragment(_) => {
@@ -670,7 +670,7 @@ impl Fragment {
// FIXME(pcwalton): Percentages should be relative to any definite size per CSS-SIZING.
// This will likely need to be done by pushing down definite sizes during selector
// cascading.
- let margin = if flags.contains(IntrinsicInlineSizeIncludesMargins) {
+ let margin = if flags.contains(INTRINSIC_INLINE_SIZE_INCLUDES_MARGINS) {
let margin = style.logical_margin();
(MaybeAuto::from_style(margin.inline_start, Au(0)).specified_or_zero() +
MaybeAuto::from_style(margin.inline_end, Au(0)).specified_or_zero())
@@ -681,7 +681,7 @@ impl Fragment {
// FIXME(pcwalton): Percentages should be relative to any definite size per CSS-SIZING.
// This will likely need to be done by pushing down definite sizes during selector
// cascading.
- let padding = if flags.contains(IntrinsicInlineSizeIncludesPadding) {
+ let padding = if flags.contains(INTRINSIC_INLINE_SIZE_INCLUDES_PADDING) {
let padding = style.logical_padding();
(model::specified(padding.inline_start, Au(0)) +
model::specified(padding.inline_end, Au(0)))
@@ -689,7 +689,7 @@ impl Fragment {
Au(0)
};
- let border = if flags.contains(IntrinsicInlineSizeIncludesBorder) {
+ let border = if flags.contains(INTRINSIC_INLINE_SIZE_INCLUDES_BORDER) {
self.border_width().inline_start_end()
} else {
Au(0)
@@ -703,7 +703,7 @@ impl Fragment {
fn style_specified_intrinsic_inline_size(&self) -> IntrinsicISizesContribution {
let flags = self.quantities_included_in_intrinsic_inline_size();
let style = self.style();
- let specified = if flags.contains(IntrinsicInlineSizeIncludesSpecified) {
+ let specified = if flags.contains(INTRINSIC_INLINE_SIZE_INCLUDES_SPECIFIED) {
MaybeAuto::from_style(style.content_inline_size(), Au(0)).specified_or_zero()
} else {
Au(0)
@@ -983,7 +983,7 @@ impl Fragment {
})
}
UnscannedTextFragment(..) => {
- fail!("Unscanned text fragments should have been scanned by now!")
+ panic!("Unscanned text fragments should have been scanned by now!")
}
};
@@ -1021,8 +1021,8 @@ impl Fragment {
let text_bounds = run.metrics_for_range(range).bounding_box;
text_bounds.size.width
}
- TableColumnFragment(_) => fail!("Table column fragments do not have inline_size"),
- UnscannedTextFragment(_) => fail!("Unscanned text fragments should have been scanned by now!"),
+ TableColumnFragment(_) => panic!("Table column fragments do not have inline_size"),
+ UnscannedTextFragment(_) => panic!("Unscanned text fragments should have been scanned by now!"),
}
}
@@ -1039,8 +1039,8 @@ impl Fragment {
// Compute the block-size based on the line-block-size and font size.
self.calculate_line_height(layout_context)
}
- TableColumnFragment(_) => fail!("Table column fragments do not have block_size"),
- UnscannedTextFragment(_) => fail!("Unscanned text fragments should have been scanned by now!"),
+ TableColumnFragment(_) => panic!("Table column fragments do not have block_size"),
+ UnscannedTextFragment(_) => panic!("Unscanned text fragments should have been scanned by now!"),
}
}
@@ -1066,10 +1066,10 @@ impl Fragment {
match self.specific {
GenericFragment | IframeFragment(_) | ImageFragment(_) | TableFragment | TableCellFragment |
TableRowFragment | TableWrapperFragment => None,
- TableColumnFragment(_) => fail!("Table column fragments do not need to split"),
- UnscannedTextFragment(_) => fail!("Unscanned text fragments should have been scanned by now!"),
+ TableColumnFragment(_) => panic!("Table column fragments do not need to split"),
+ UnscannedTextFragment(_) => panic!("Unscanned text fragments should have been scanned by now!"),
InlineBlockFragment(_) | InlineAbsoluteHypotheticalFragment(_) => {
- fail!("Inline blocks or inline absolute hypothetical fragments do not get split")
+ panic!("Inline blocks or inline absolute hypothetical fragments do not get split")
}
ScannedTextFragment(ref text_fragment_info) => {
let mut new_line_pos = text_fragment_info.new_line_pos.clone();
@@ -1115,9 +1115,9 @@ impl Fragment {
GenericFragment | IframeFragment(_) | ImageFragment(_) | TableFragment |
TableCellFragment | TableRowFragment | TableWrapperFragment | InlineBlockFragment(_) |
InlineAbsoluteHypotheticalFragment(_) => None,
- TableColumnFragment(_) => fail!("Table column fragments do not have inline_size"),
+ TableColumnFragment(_) => panic!("Table column fragments do not have inline_size"),
UnscannedTextFragment(_) => {
- fail!("Unscanned text fragments should have been scanned by now!")
+ panic!("Unscanned text fragments should have been scanned by now!")
}
ScannedTextFragment(ref text_fragment_info) => {
let mut pieces_processed_count: uint = 0;
@@ -1165,7 +1165,7 @@ impl Fragment {
// the inline-end chunk.
let inline_end_range_end = text_fragment_info.range.end() - slice_begin;
inline_end_range = Some(Range::new(slice_begin, inline_end_range_end));
- debug!("split_to_inline_size: case=splitting remainder with inline_end range={:?}",
+ debug!("split_to_inline_size: case=splitting remainder with inline_end range={}",
inline_end_range);
}
}
@@ -1218,9 +1218,9 @@ impl Fragment {
match self.specific {
GenericFragment | IframeFragment(_) | TableFragment | TableCellFragment |
TableRowFragment | TableWrapperFragment => return,
- TableColumnFragment(_) => fail!("Table column fragments do not have inline_size"),
+ TableColumnFragment(_) => panic!("Table column fragments do not have inline_size"),
UnscannedTextFragment(_) => {
- fail!("Unscanned text fragments should have been scanned by now!")
+ panic!("Unscanned text fragments should have been scanned by now!")
}
ImageFragment(_) | ScannedTextFragment(_) | InlineBlockFragment(_) |
InlineAbsoluteHypotheticalFragment(_) => {}
@@ -1299,7 +1299,7 @@ impl Fragment {
self.border_box.size.inline = inline_size + noncontent_inline_size;
image_fragment_info.computed_inline_size = Some(inline_size);
}
- _ => fail!("this case should have been handled above"),
+ _ => panic!("this case should have been handled above"),
}
}
@@ -1311,9 +1311,9 @@ impl Fragment {
match self.specific {
GenericFragment | IframeFragment(_) | TableFragment | TableCellFragment |
TableRowFragment | TableWrapperFragment => return,
- TableColumnFragment(_) => fail!("Table column fragments do not have block_size"),
+ TableColumnFragment(_) => panic!("Table column fragments do not have block_size"),
UnscannedTextFragment(_) => {
- fail!("Unscanned text fragments should have been scanned by now!")
+ panic!("Unscanned text fragments should have been scanned by now!")
}
ImageFragment(_) | ScannedTextFragment(_) | InlineBlockFragment(_) |
InlineAbsoluteHypotheticalFragment(_) => {}
@@ -1368,7 +1368,7 @@ impl Fragment {
let block_flow = info.flow_ref.as_block();
self.border_box.size.block = block_flow.base.position.size.block;
}
- _ => fail!("should have been handled above"),
+ _ => panic!("should have been handled above"),
}
}
@@ -1501,10 +1501,10 @@ impl fmt::Show for Fragment {
bitflags! {
flags QuantitiesIncludedInIntrinsicInlineSizes: u8 {
- static IntrinsicInlineSizeIncludesMargins = 0x01,
- static IntrinsicInlineSizeIncludesPadding = 0x02,
- static IntrinsicInlineSizeIncludesBorder = 0x04,
- static IntrinsicInlineSizeIncludesSpecified = 0x08,
+ const INTRINSIC_INLINE_SIZE_INCLUDES_MARGINS = 0x01,
+ const INTRINSIC_INLINE_SIZE_INCLUDES_PADDING = 0x02,
+ const INTRINSIC_INLINE_SIZE_INCLUDES_BORDER = 0x04,
+ const INTRINSIC_INLINE_SIZE_INCLUDES_SPECIFIED = 0x08,
}
}
diff --git a/components/layout/incremental.rs b/components/layout/incremental.rs
index 6d340991b6c..f332797cbfc 100644
--- a/components/layout/incremental.rs
+++ b/components/layout/incremental.rs
@@ -14,25 +14,25 @@ bitflags! {
flags RestyleDamage: u8 {
#[doc = "Repaint the node itself."]
#[doc = "Currently unused; need to decide how this propagates."]
- static Repaint = 0x01,
+ const REPAINT = 0x01,
#[doc = "Recompute intrinsic inline_sizes (minimum and preferred)."]
#[doc = "Propagates down the flow tree because the computation is"]
#[doc = "bottom-up."]
- static BubbleISizes = 0x02,
+ const BUBBLE_ISIZES = 0x02,
#[doc = "Recompute actual inline-sizes and block-sizes, only taking out-of-flow children \
into account. \
Propagates up the flow tree because the computation is top-down."]
- static ReflowOutOfFlow = 0x04,
+ const REFLOW_OUT_OF_FLOW = 0x04,
#[doc = "Recompute actual inline_sizes and block_sizes."]
#[doc = "Propagates up the flow tree because the computation is"]
#[doc = "top-down."]
- static Reflow = 0x08,
+ const REFLOW = 0x08,
#[doc = "The entire flow needs to be reconstructed."]
- static ReconstructFlow = 0x10
+ const RECONSTRUCT_FLOW = 0x10
}
}
@@ -40,7 +40,7 @@ bitflags! {
flags SpecialRestyleDamage: u8 {
#[doc="If this flag is set, we need to reflow the entire document. This is more or less a \
temporary hack to deal with cases that we don't handle incrementally yet."]
- static ReflowEntireDocument = 0x01,
+ const REFLOW_ENTIRE_DOCUMENT = 0x01,
}
}
@@ -49,9 +49,9 @@ impl RestyleDamage {
/// we should add to the *parent* of this flow.
pub fn damage_for_parent(self, child_is_absolutely_positioned: bool) -> RestyleDamage {
if child_is_absolutely_positioned {
- self & (Repaint | ReflowOutOfFlow)
+ self & (REPAINT | REFLOW_OUT_OF_FLOW)
} else {
- self & (Repaint | Reflow | ReflowOutOfFlow)
+ self & (REPAINT | REFLOW | REFLOW_OUT_OF_FLOW)
}
}
@@ -66,20 +66,20 @@ impl RestyleDamage {
// Absolute children are out-of-flow and therefore insulated from changes.
//
// FIXME(pcwalton): Au contraire, if the containing block dimensions change!
- self & Repaint
+ self & REPAINT
}
(true, false) => {
// Changing the position of an absolutely-positioned block requires us to reflow
// its kids.
- if self.contains(ReflowOutOfFlow) {
- self | Reflow
+ if self.contains(REFLOW_OUT_OF_FLOW) {
+ self | REFLOW
} else {
self
}
}
_ => {
// TODO(pcwalton): Take floatedness into account.
- self & (Repaint | Reflow)
+ self & (REPAINT | REFLOW)
}
}
}
@@ -90,11 +90,11 @@ impl fmt::Show for RestyleDamage {
let mut first_elem = true;
let to_iter =
- [ (Repaint, "Repaint")
- , (BubbleISizes, "BubbleISizes")
- , (ReflowOutOfFlow, "ReflowOutOfFlow")
- , (Reflow, "Reflow")
- , (ReconstructFlow, "ReconstructFlow")
+ [ (REPAINT, "Repaint")
+ , (BUBBLE_ISIZES, "BubbleISizes")
+ , (REFLOW_OUT_OF_FLOW, "ReflowOutOfFlow")
+ , (REFLOW, "Reflow")
+ , (RECONSTRUCT_FLOW, "ReconstructFlow")
];
for &(damage, damage_str) in to_iter.iter() {
@@ -141,20 +141,20 @@ pub fn compute_damage(old: &Option<Arc<ComputedValues>>, new: &ComputedValues) -
// FIXME: We can short-circuit more of this.
add_if_not_equal!(old, new, damage,
- [ Repaint ], [
+ [ REPAINT ], [
get_color.color, get_background.background_color,
get_border.border_top_color, get_border.border_right_color,
get_border.border_bottom_color, get_border.border_left_color
]);
add_if_not_equal!(old, new, damage,
- [ Repaint, ReflowOutOfFlow ], [
+ [ REPAINT, REFLOW_OUT_OF_FLOW ], [
get_positionoffsets.top, get_positionoffsets.left,
get_positionoffsets.right, get_positionoffsets.bottom
]);
add_if_not_equal!(old, new, damage,
- [ Repaint, BubbleISizes, ReflowOutOfFlow, Reflow ], [
+ [ REPAINT, BUBBLE_ISIZES, REFLOW_OUT_OF_FLOW, REFLOW ], [
get_border.border_top_width, get_border.border_right_width,
get_border.border_bottom_width, get_border.border_left_width,
get_margin.margin_top, get_margin.margin_right,
@@ -167,7 +167,7 @@ pub fn compute_damage(old: &Option<Arc<ComputedValues>>, new: &ComputedValues) -
]);
add_if_not_equal!(old, new, damage,
- [ Repaint, BubbleISizes, ReflowOutOfFlow, Reflow, ReconstructFlow ],
+ [ REPAINT, BUBBLE_ISIZES, REFLOW_OUT_OF_FLOW, REFLOW, RECONSTRUCT_FLOW ],
[ get_box.float, get_box.display, get_box.position ]);
// FIXME: test somehow that we checked every CSS property
@@ -203,8 +203,8 @@ impl<'a> LayoutDamageComputation for &'a mut Flow+'a {
let self_base = flow::base(self);
if self_base.flags.float_kind() != float::none &&
- self_base.restyle_damage.intersects(Reflow) {
- special_damage.insert(ReflowEntireDocument);
+ self_base.restyle_damage.intersects(REFLOW) {
+ special_damage.insert(REFLOW_ENTIRE_DOCUMENT);
}
special_damage
@@ -213,7 +213,7 @@ impl<'a> LayoutDamageComputation for &'a mut Flow+'a {
fn reflow_entire_document(self) {
let self_base = flow::mut_base(self);
self_base.restyle_damage.insert(RestyleDamage::all());
- self_base.restyle_damage.remove(ReconstructFlow);
+ self_base.restyle_damage.remove(RECONSTRUCT_FLOW);
for kid in self_base.children.iter_mut() {
kid.reflow_entire_document();
}
diff --git a/components/layout/inline.rs b/components/layout/inline.rs
index 8a4deb386fb..c6ca65fd799 100644
--- a/components/layout/inline.rs
+++ b/components/layout/inline.rs
@@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-#![deny(unsafe_block)]
+#![deny(unsafe_blocks)]
use css::node_style::StyledNode;
use context::LayoutContext;
@@ -13,12 +13,12 @@ use flow;
use fragment::{Fragment, InlineAbsoluteHypotheticalFragment, InlineBlockFragment};
use fragment::{FragmentBoundsIterator, ScannedTextFragment, ScannedTextFragmentInfo};
use fragment::SplitInfo;
-use incremental::{Reflow, ReflowOutOfFlow};
+use incremental::{REFLOW, REFLOW_OUT_OF_FLOW};
use layout_debug;
use model::IntrinsicISizesContribution;
use text;
-use collections::{Deque, RingBuf};
+use collections::{RingBuf};
use geom::{Rect, Size2D};
use gfx::display_list::ContentLevel;
use gfx::font::FontMetrics;
@@ -273,7 +273,7 @@ impl LineBreaker {
}
fn flush_current_line(&mut self) {
- debug!("LineBreaker: Flushing line {:u}: {:?}",
+ debug!("LineBreaker: Flushing line {:u}: {}",
self.lines.len(), self.pending_line);
// clear line and add line mapping
@@ -325,7 +325,7 @@ impl LineBreaker {
let line_bounds = self.floats.place_between_floats(&info);
- debug!("LineBreaker: found position for line: {} using placement_info: {:?}",
+ debug!("LineBreaker: found position for line: {} using placement_info: {}",
line_bounds,
info);
@@ -623,7 +623,7 @@ impl InlineFragments {
/// A convenience function to return a mutable reference to the fragment at a given index.
pub fn get_mut<'a>(&'a mut self, index: uint) -> &'a mut Fragment {
- self.fragments.get_mut(index)
+ &mut self.fragments[index]
}
/// This function merges previously-line-broken fragments back into their
@@ -944,7 +944,7 @@ impl Flow for InlineFlow {
// TODO: Combine this with `LineBreaker`'s walk in the fragment list, or put this into
// `Fragment`.
- debug!("InlineFlow::assign_inline_sizes: floats in: {:?}", self.base.floats);
+ debug!("InlineFlow::assign_inline_sizes: floats in: {}", self.base.floats);
self.base.position.size.inline = self.base.block_container_inline_size;
@@ -984,7 +984,7 @@ impl Flow for InlineFlow {
// element to determine its block-size for computing the line's own block-size.
//
// TODO(pcwalton): Cache the line scanner?
- debug!("assign_block_size_inline: floats in: {:?}", self.base.floats);
+ debug!("assign_block_size_inline: floats in: {}", self.base.floats);
// assign block-size for inline fragments
let containing_block_block_size =
@@ -1028,11 +1028,11 @@ impl Flow for InlineFlow {
mut largest_block_size_for_bottom_fragments) = (Au(0), Au(0));
for fragment_index in range(line.range.begin(), line.range.end()) {
- let fragment = self.fragments.fragments.get_mut(fragment_index.to_uint());
+ let fragment = &mut self.fragments.fragments[fragment_index.to_uint()];
let InlineMetrics {
- block_size_above_baseline: mut block_size_above_baseline,
- depth_below_baseline: mut depth_below_baseline,
+ mut block_size_above_baseline,
+ mut depth_below_baseline,
ascent
} = fragment.inline_metrics(layout_context);
@@ -1131,7 +1131,7 @@ impl Flow for InlineFlow {
Au(0),
-self.base.position.size.block));
- self.base.restyle_damage.remove(ReflowOutOfFlow | Reflow);
+ self.base.restyle_damage.remove(REFLOW_OUT_OF_FLOW | REFLOW);
}
fn compute_absolute_position(&mut self) {
diff --git a/components/layout/layout_debug.rs b/components/layout/layout_debug.rs
index 5f3051a9610..6e00a102bcc 100644
--- a/components/layout/layout_debug.rs
+++ b/components/layout/layout_debug.rs
@@ -8,10 +8,11 @@
#![macro_escape]
use flow_ref::FlowRef;
+use flow;
use serialize::json;
use std::cell::RefCell;
use std::io::File;
-use std::sync::atomics::{AtomicUint, SeqCst, INIT_ATOMIC_UINT};
+use std::sync::atomic::{AtomicUint, SeqCst, INIT_ATOMIC_UINT};
local_data_key!(state_key: RefCell<State>)
@@ -62,7 +63,7 @@ impl Scope {
match maybe_refcell {
Some(refcell) => {
let mut state = refcell.borrow_mut();
- let flow_trace = json::encode(&state.flow_root.deref());
+ let flow_trace = json::encode(&flow::base(state.flow_root.deref()));
let data = box ScopeData::new(name, flow_trace);
state.scope_stack.push(data);
}
@@ -80,7 +81,7 @@ impl Drop for Scope {
Some(refcell) => {
let mut state = refcell.borrow_mut();
let mut current_scope = state.scope_stack.pop().unwrap();
- current_scope.post = json::encode(&state.flow_root.deref());
+ current_scope.post = json::encode(&flow::base(state.flow_root.deref()));
let previous_scope = state.scope_stack.last_mut().unwrap();
previous_scope.children.push(current_scope);
}
@@ -101,7 +102,7 @@ pub fn generate_unique_debug_id() -> u16 {
pub fn begin_trace(flow_root: FlowRef) {
assert!(state_key.get().is_none());
- let flow_trace = json::encode(&flow_root.deref());
+ let flow_trace = json::encode(&flow::base(flow_root.deref()));
let state = State {
scope_stack: vec![box ScopeData::new("root".to_string(), flow_trace)],
flow_root: flow_root,
@@ -117,7 +118,7 @@ pub fn end_trace() {
let mut task_state = task_state_cell.borrow_mut();
assert!(task_state.scope_stack.len() == 1);
let mut root_scope = task_state.scope_stack.pop().unwrap();
- root_scope.post = json::encode(&task_state.flow_root.deref());
+ root_scope.post = json::encode(&flow::base(task_state.flow_root.deref()));
let result = json::encode(&root_scope);
let path = Path::new("layout_trace.json");
diff --git a/components/layout/layout_task.rs b/components/layout/layout_task.rs
index e1e918251cd..15d9daccbc8 100644
--- a/components/layout/layout_task.rs
+++ b/components/layout/layout_task.rs
@@ -11,7 +11,7 @@ use context::SharedLayoutContext;
use flow::{mod, Flow, ImmutableFlowUtils, MutableFlowUtils, MutableOwnedFlowUtils};
use flow_ref::FlowRef;
use fragment::{Fragment, FragmentBoundsIterator};
-use incremental::{LayoutDamageComputation, Reflow, ReflowEntireDocument, Repaint};
+use incremental::{LayoutDamageComputation, REFLOW, REFLOW_ENTIRE_DOCUMENT, REPAINT};
use layout_debug;
use parallel::UnsafeFlow;
use parallel;
@@ -183,7 +183,7 @@ impl LayoutTaskFactory for LayoutTask {
time_profiler_chan: TimeProfilerChan,
shutdown_chan: Sender<()>) {
let ConstellationChan(con_chan) = constellation_chan.clone();
- spawn_named_with_send_on_failure("LayoutTask", task_state::Layout, proc() {
+ spawn_named_with_send_on_failure("LayoutTask", task_state::LAYOUT, proc() {
{ // Ensures layout task is destroyed before we send shutdown message
let sender = chan.sender();
let layout =
@@ -254,7 +254,7 @@ impl LayoutTask {
let screen_size = Size2D(Au(0), Au(0));
let device = Device::new(Screen, opts::get().initial_window_size.as_f32() * ScaleFactor(1.0));
let parallel_traversal = if opts::get().layout_threads != 1 {
- Some(WorkQueue::new("LayoutWorker", task_state::Layout,
+ Some(WorkQueue::new("LayoutWorker", task_state::LAYOUT,
opts::get().layout_threads, ptr::null()))
} else {
None
@@ -339,7 +339,7 @@ impl LayoutTask {
} else if ret == port2.id() {
Pipeline
} else {
- fail!("invalid select result");
+ panic!("invalid select result");
}
};
@@ -443,7 +443,7 @@ impl LayoutTask {
break
}
_ => {
- fail!("layout: message that wasn't `ExitNowMsg` received after \
+ panic!("layout: message that wasn't `ExitNowMsg` received after \
`PrepareToExitMsg`")
}
}
@@ -559,7 +559,7 @@ impl LayoutTask {
let _scope = layout_debug_scope!("solve_constraints_parallel");
match rw_data.parallel_traversal {
- None => fail!("solve_contraints_parallel() called with no parallel traversal ready"),
+ None => panic!("solve_contraints_parallel() called with no parallel traversal ready"),
Some(ref mut traversal) => {
// NOTE: this currently computes borders, so any pruning should separate that
// operation out.
@@ -665,12 +665,11 @@ impl LayoutTask {
.background_color)
.to_gfx_color()
};
- match element_bg_color {
- color::rgba(0., 0., 0., 0.) => {}
- _ => {
- color = element_bg_color;
- break;
- }
+ // FIXME: Add equality operators for azure color type.
+ if element_bg_color.r != 0.0 || element_bg_color.g != 0.0 ||
+ element_bg_color.b != 0.0 || element_bg_color.a != 0.0 {
+ color = element_bg_color;
+ break;
}
}
}
@@ -798,8 +797,8 @@ impl LayoutTask {
self.time_profiler_chan.clone(),
|| {
if opts::get().nonincremental_layout ||
- layout_root.compute_layout_damage().contains(ReflowEntireDocument) {
- layout_root.reflow_entire_document()
+ layout_root.deref_mut().compute_layout_damage().contains(REFLOW_ENTIRE_DOCUMENT) {
+ layout_root.deref_mut().reflow_entire_document()
}
});
@@ -884,7 +883,7 @@ impl LayoutTask {
}
fn reflow_all_nodes(flow: &mut Flow) {
- flow::mut_base(flow).restyle_damage.insert(Reflow | Repaint);
+ flow::mut_base(flow).restyle_damage.insert(REFLOW | REPAINT);
for child in flow::child_iter(flow) {
LayoutTask::reflow_all_nodes(child);
@@ -930,7 +929,7 @@ impl LayoutRPC for LayoutRPCImpl {
/// Requests the dimensions of all the content boxes, as in the `getClientRects()` call.
fn content_boxes(&self) -> ContentBoxesResponse {
let &LayoutRPCImpl(ref rw_data) = self;
- let mut rw_data = rw_data.lock();
+ let rw_data = rw_data.lock();
ContentBoxesResponse(rw_data.content_boxes_response.clone())
}
@@ -953,7 +952,7 @@ impl LayoutRPC for LayoutRPCImpl {
let &LayoutRPCImpl(ref rw_data) = self;
let rw_data = rw_data.lock();
match rw_data.display_list {
- None => fail!("no display list!"),
+ None => panic!("no display list!"),
Some(ref display_list) => hit_test(point, display_list.list.iter().rev()),
}
};
@@ -984,7 +983,7 @@ impl LayoutRPC for LayoutRPCImpl {
let &LayoutRPCImpl(ref rw_data) = self;
let rw_data = rw_data.lock();
match rw_data.display_list {
- None => fail!("no display list!"),
+ None => panic!("no display list!"),
Some(ref display_list) => {
mouse_over_test(point, display_list.list.iter().rev(), &mut mouse_over_list);
}
diff --git a/components/layout/lib.rs b/components/layout/lib.rs
index 7598226e8e3..6489f6fe307 100644
--- a/components/layout/lib.rs
+++ b/components/layout/lib.rs
@@ -7,14 +7,13 @@
#![feature(globs, macro_rules, phase, thread_local, unsafe_destructor)]
-#![deny(unused_imports, unused_variable)]
+#![deny(unused_imports)]
+#![deny(unused_variables)]
#![allow(unrooted_must_root)]
#[phase(plugin, link)]
extern crate log;
-extern crate debug;
-
extern crate geom;
extern crate gfx;
extern crate layout_traits;
diff --git a/components/layout/model.rs b/components/layout/model.rs
index 05a5d589855..49506b43475 100644
--- a/components/layout/model.rs
+++ b/components/layout/model.rs
@@ -4,7 +4,7 @@
//! Borders, padding, and margins.
-#![deny(unsafe_block)]
+#![deny(unsafe_blocks)]
use fragment::Fragment;
@@ -217,7 +217,7 @@ impl MarginCollapseInfo {
(AccumulatingCollapsibleTopMargin, MarginsCollapse(..)) => {
// Can't happen because the state will have been replaced with
// `AccumulatingMarginIn` above.
- fail!("should not be accumulating collapsible block_start margins anymore!")
+ panic!("should not be accumulating collapsible block_start margins anymore!")
}
(AccumulatingCollapsibleTopMargin, MarginsCollapseThrough(margin)) => {
self.block_start_margin.union(margin);
diff --git a/components/layout/parallel.rs b/components/layout/parallel.rs
index 42008396cab..d0dbf469c2b 100644
--- a/components/layout/parallel.rs
+++ b/components/layout/parallel.rs
@@ -25,7 +25,7 @@ use servo_util::time;
use servo_util::workqueue::{WorkQueue, WorkUnit, WorkerProxy};
use std::mem;
use std::ptr;
-use std::sync::atomics::{AtomicInt, Relaxed, SeqCst};
+use std::sync::atomic::{AtomicInt, Relaxed, SeqCst};
#[allow(dead_code)]
fn static_assertion(node: UnsafeLayoutNode) {
@@ -431,7 +431,7 @@ pub fn traverse_flow_tree_preorder(root: &mut FlowRef,
if opts::get().bubble_inline_sizes_separately {
let layout_context = LayoutContext::new(shared_layout_context);
let bubble_inline_sizes = BubbleISizes { layout_context: &layout_context };
- root.traverse_postorder(&bubble_inline_sizes);
+ root.deref_mut().traverse_postorder(&bubble_inline_sizes);
}
queue.data = shared_layout_context as *const _;
diff --git a/components/layout/table.rs b/components/layout/table.rs
index f9264bad334..8be9f9811ab 100644
--- a/components/layout/table.rs
+++ b/components/layout/table.rs
@@ -4,7 +4,7 @@
//! CSS table formatting contexts.
-#![deny(unsafe_block)]
+#![deny(unsafe_blocks)]
use block::{BlockFlow, MarginsMayNotCollapse, ISizeAndMarginsComputer};
use block::{ISizeConstraintInput, ISizeConstraintSolution};
diff --git a/components/layout/table_caption.rs b/components/layout/table_caption.rs
index cffc05dd93b..8a426da962f 100644
--- a/components/layout/table_caption.rs
+++ b/components/layout/table_caption.rs
@@ -4,7 +4,7 @@
//! CSS table formatting contexts.
-#![deny(unsafe_block)]
+#![deny(unsafe_blocks)]
use block::BlockFlow;
use construct::FlowConstructor;
diff --git a/components/layout/table_cell.rs b/components/layout/table_cell.rs
index 4d9677b3c88..9fc6c17b52b 100644
--- a/components/layout/table_cell.rs
+++ b/components/layout/table_cell.rs
@@ -4,7 +4,7 @@
//! CSS table formatting contexts.
-#![deny(unsafe_block)]
+#![deny(unsafe_blocks)]
use block::{BlockFlow, MarginsMayNotCollapse, ISizeAndMarginsComputer};
use context::LayoutContext;
diff --git a/components/layout/table_colgroup.rs b/components/layout/table_colgroup.rs
index a6ea6efdae4..dbc826db9f2 100644
--- a/components/layout/table_colgroup.rs
+++ b/components/layout/table_colgroup.rs
@@ -4,7 +4,7 @@
//! CSS table formatting contexts.
-#![deny(unsafe_block)]
+#![deny(unsafe_blocks)]
use context::LayoutContext;
use css::node_style::StyledNode;
@@ -70,7 +70,7 @@ impl Flow for TableColGroupFlow {
let inline_size = fragment.style().content_inline_size();
let span: int = match fragment.specific {
TableColumnFragment(col_fragment) => max(col_fragment.span, 1),
- _ => fail!("non-table-column fragment inside table column?!"),
+ _ => panic!("non-table-column fragment inside table column?!"),
};
for _ in range(0, span) {
self.inline_sizes.push(inline_size)
diff --git a/components/layout/table_row.rs b/components/layout/table_row.rs
index 10e648a9f24..d834ecd144f 100644
--- a/components/layout/table_row.rs
+++ b/components/layout/table_row.rs
@@ -4,7 +4,7 @@
//! CSS table formatting contexts.
-#![deny(unsafe_block)]
+#![deny(unsafe_blocks)]
use block::BlockFlow;
use block::ISizeAndMarginsComputer;
diff --git a/components/layout/table_rowgroup.rs b/components/layout/table_rowgroup.rs
index 41f585dad0d..50e35e40c73 100644
--- a/components/layout/table_rowgroup.rs
+++ b/components/layout/table_rowgroup.rs
@@ -4,7 +4,7 @@
//! CSS table formatting contexts.
-#![deny(unsafe_block)]
+#![deny(unsafe_blocks)]
use block::BlockFlow;
use block::ISizeAndMarginsComputer;
diff --git a/components/layout/table_wrapper.rs b/components/layout/table_wrapper.rs
index 9314d99e8cc..2902326413c 100644
--- a/components/layout/table_wrapper.rs
+++ b/components/layout/table_wrapper.rs
@@ -11,7 +11,7 @@
//!
//! Hereafter this document is referred to as INTRINSIC.
-#![deny(unsafe_block)]
+#![deny(unsafe_blocks)]
use block::{BlockFlow, BlockNonReplaced, FloatNonReplaced, ISizeAndMarginsComputer};
use block::{MarginsMayNotCollapse};
diff --git a/components/layout/text.rs b/components/layout/text.rs
index bcea931fab6..86f3dd164d5 100644
--- a/components/layout/text.rs
+++ b/components/layout/text.rs
@@ -4,7 +4,7 @@
//! Text layout.
-#![deny(unsafe_block)]
+#![deny(unsafe_blocks)]
use fragment::{Fragment, ScannedTextFragmentInfo, UnscannedTextFragment};
use inline::InlineFragments;
@@ -19,7 +19,7 @@ use servo_util::geometry::Au;
use servo_util::logical_geometry::{LogicalSize, WritingMode};
use servo_util::range::Range;
use servo_util::smallvec::{SmallVec, SmallVec1};
-use std::collections::{DList, Deque};
+use std::collections::DList;
use std::mem;
use style::ComputedValues;
use style::computed_values::{line_height, text_orientation, white_space};
@@ -119,7 +119,7 @@ impl TextRunScanner {
for in_fragment in self.clump.iter() {
let in_fragment = match in_fragment.specific {
UnscannedTextFragment(ref text_fragment_info) => &text_fragment_info.text,
- _ => fail!("Expected an unscanned text fragment!"),
+ _ => panic!("Expected an unscanned text fragment!"),
};
let mut new_line_pos = Vec::new();
diff --git a/components/layout/traversal.rs b/components/layout/traversal.rs
index b4909d3b99a..26036ea4d46 100644
--- a/components/layout/traversal.rs
+++ b/components/layout/traversal.rs
@@ -11,7 +11,7 @@ use context::LayoutContext;
use flow::{Flow, MutableFlowUtils};
use flow::{PreorderFlowTraversal, PostorderFlowTraversal};
use flow;
-use incremental::{RestyleDamage, BubbleISizes, Reflow, ReflowOutOfFlow};
+use incremental::{RestyleDamage, BUBBLE_ISIZES, REFLOW, REFLOW_OUT_OF_FLOW};
use wrapper::{layout_node_to_unsafe_layout_node, LayoutNode};
use wrapper::{PostorderNodeMutTraversal, ThreadSafeLayoutNode, UnsafeLayoutNode};
use wrapper::{PreorderDomTraversal, PostorderDomTraversal};
@@ -88,7 +88,7 @@ fn put_task_local_bloom_filter(bf: Box<BloomFilter>,
layout_context: &LayoutContext) {
match style_bloom.replace(Some((bf, *unsafe_node, layout_context.shared.generation))) {
None => {},
- Some(_) => fail!("Putting into a never-taken task-local bloom filter"),
+ Some(_) => panic!("Putting into a never-taken task-local bloom filter"),
}
}
@@ -272,7 +272,7 @@ impl PreorderFlow for FlowTreeVerification {
if !base.flags.is_leaf() && !base.flags.is_nonleaf() {
println!("flow tree verification failed: flow wasn't a leaf or a nonleaf!");
flow.dump();
- fail!("flow tree verification failed")
+ panic!("flow tree verification failed")
}
}
}
@@ -287,12 +287,12 @@ impl<'a> PostorderFlowTraversal for BubbleISizes<'a> {
#[inline]
fn process(&self, flow: &mut Flow) {
flow.bubble_inline_sizes();
- flow::mut_base(flow).restyle_damage.remove(BubbleISizes);
+ flow::mut_base(flow).restyle_damage.remove(BUBBLE_ISIZES);
}
#[inline]
fn should_process(&self, flow: &mut Flow) -> bool {
- flow::base(flow).restyle_damage.contains(BubbleISizes)
+ flow::base(flow).restyle_damage.contains(BUBBLE_ISIZES)
}
}
@@ -309,7 +309,7 @@ impl<'a> PreorderFlowTraversal for AssignISizes<'a> {
#[inline]
fn should_process(&self, flow: &mut Flow) -> bool {
- flow::base(flow).restyle_damage.intersects(ReflowOutOfFlow | Reflow)
+ flow::base(flow).restyle_damage.intersects(REFLOW_OUT_OF_FLOW | REFLOW)
}
}
@@ -342,7 +342,7 @@ impl<'a> PostorderFlowTraversal for AssignBSizesAndStoreOverflow<'a> {
#[inline]
fn should_process(&self, flow: &mut Flow) -> bool {
- flow::base(flow).restyle_damage.intersects(ReflowOutOfFlow | Reflow)
+ flow::base(flow).restyle_damage.intersects(REFLOW_OUT_OF_FLOW | REFLOW)
}
}
diff --git a/components/layout/util.rs b/components/layout/util.rs
index c7ddbc0c596..2cefcac302b 100644
--- a/components/layout/util.rs
+++ b/components/layout/util.rs
@@ -66,7 +66,7 @@ impl PrivateLayoutData {
bitflags! {
flags LayoutDataFlags: u8 {
#[doc="Whether a flow has been newly constructed."]
- static HasNewlyConstructedFlow = 0x01
+ const HAS_NEWLY_CONSTRUCTED_FLOW = 0x01
}
}
diff --git a/components/layout/wrapper.rs b/components/layout/wrapper.rs
index 865c7c861be..4f5e0e46eea 100644
--- a/components/layout/wrapper.rs
+++ b/components/layout/wrapper.rs
@@ -49,7 +49,7 @@ use script::dom::htmlimageelement::LayoutHTMLImageElementHelpers;
use script::dom::htmlinputelement::LayoutHTMLInputElementHelpers;
use script::dom::node::{DocumentNodeTypeId, ElementNodeTypeId, Node, NodeTypeId};
use script::dom::node::{LayoutNodeHelpers, RawLayoutNodeHelpers, SharedLayoutData};
-use script::dom::node::{HasChanged, IsDirty, HasDirtySiblings, HasDirtyDescendants};
+use script::dom::node::{HAS_CHANGED, IS_DIRTY, HAS_DIRTY_SIBLINGS, HAS_DIRTY_DESCENDANTS};
use script::dom::text::Text;
use script::layout_interface::LayoutChan;
use servo_msg::constellation_msg::{PipelineId, SubpageId};
@@ -102,7 +102,7 @@ pub trait TLayoutNode {
unsafe {
match HTMLImageElementCast::to_js(self.get_jsmanaged()) {
Some(elem) => elem.image().as_ref().map(|url| (*url).clone()),
- None => fail!("not an image!")
+ None => panic!("not an image!")
}
}
}
@@ -114,7 +114,7 @@ pub trait TLayoutNode {
let iframe_element: JS<HTMLIFrameElement> =
match HTMLIFrameElementCast::to_js(self.get_jsmanaged()) {
Some(elem) => elem,
- None => fail!("not an iframe element!")
+ None => panic!("not an iframe element!")
};
let size = (*iframe_element.unsafe_get()).size().unwrap();
(*size.pipeline_id(), *size.subpage_id())
@@ -187,7 +187,7 @@ impl<'ln> TLayoutNode for LayoutNode<'ln> {
Some(text) => (*text.unsafe_get()).characterdata().data_for_layout().to_string(),
None => match HTMLInputElementCast::to_js(self.get_jsmanaged()) {
Some(input) => input.get_value_for_layout(),
- None => fail!("not text!")
+ None => panic!("not text!")
}
}
}
@@ -342,7 +342,7 @@ impl<'ln> TNode<'ln, LayoutElement<'ln>> for LayoutNode<'ln> {
unsafe {
let elem: JS<Element> = match ElementCast::to_js(&self.node) {
Some(elem) => elem,
- None => fail!("not an element")
+ None => panic!("not an element")
};
let element = &*elem.unsafe_get();
@@ -390,35 +390,35 @@ impl<'ln> TNode<'ln, LayoutElement<'ln>> for LayoutNode<'ln> {
}
fn has_changed(self) -> bool {
- unsafe { self.node.get_flag(HasChanged) }
+ unsafe { self.node.get_flag(HAS_CHANGED) }
}
unsafe fn set_changed(self, value: bool) {
- self.node.set_flag(HasChanged, value)
+ self.node.set_flag(HAS_CHANGED, value)
}
fn is_dirty(self) -> bool {
- unsafe { self.node.get_flag(IsDirty) }
+ unsafe { self.node.get_flag(IS_DIRTY) }
}
unsafe fn set_dirty(self, value: bool) {
- self.node.set_flag(IsDirty, value)
+ self.node.set_flag(IS_DIRTY, value)
}
fn has_dirty_siblings(self) -> bool {
- unsafe { self.node.get_flag(HasDirtySiblings) }
+ unsafe { self.node.get_flag(HAS_DIRTY_SIBLINGS) }
}
unsafe fn set_dirty_siblings(self, value: bool) {
- self.node.set_flag(HasDirtySiblings, value);
+ self.node.set_flag(HAS_DIRTY_SIBLINGS, value);
}
fn has_dirty_descendants(self) -> bool {
- unsafe { self.node.get_flag(HasDirtyDescendants) }
+ unsafe { self.node.get_flag(HAS_DIRTY_DESCENDANTS) }
}
unsafe fn set_dirty_descendants(self, value: bool) {
- self.node.set_flag(HasDirtyDescendants, value)
+ self.node.set_flag(HAS_DIRTY_DESCENDANTS, value)
}
}
@@ -752,7 +752,7 @@ impl<'ln> ThreadSafeLayoutNode<'ln> {
unsafe {
let element = match ElementCast::to_js(self.get_jsmanaged()) {
Some(e) => e.unsafe_get(),
- None => fail!("not an element")
+ None => panic!("not an element")
};
// FIXME(pcwalton): Workaround until Rust gets multiple lifetime parameters on
// implementations.
@@ -888,7 +888,7 @@ impl<'ln> ThreadSafeLayoutNode<'ln> {
unsafe {
match HTMLInputElementCast::to_js(self.get_jsmanaged()) {
Some(input) => input.get_value_for_layout(),
- None => fail!("not an input element!")
+ None => panic!("not an input element!")
}
}
}
@@ -897,7 +897,7 @@ impl<'ln> ThreadSafeLayoutNode<'ln> {
unsafe {
match HTMLInputElementCast::to_js(self.get_jsmanaged()) {
Some(input) => input.get_size_for_layout(),
- None => fail!("not an input element!")
+ None => panic!("not an input element!")
}
}
}
@@ -914,7 +914,7 @@ impl<'ln> ThreadSafeLayoutNode<'ln> {
let mut layout_data_ref = self.mutate_layout_data();
match &mut *layout_data_ref {
&Some(ref mut layout_data) => layout_data.data.restyle_damage = damage,
- _ => fail!("no layout data for this node"),
+ _ => panic!("no layout data for this node"),
}
}
@@ -922,7 +922,7 @@ impl<'ln> ThreadSafeLayoutNode<'ln> {
pub fn flags(self) -> LayoutDataFlags {
unsafe {
match *self.borrow_layout_data_unchecked() {
- None => fail!(),
+ None => panic!(),
Some(ref layout_data) => layout_data.data.flags,
}
}
@@ -933,7 +933,7 @@ impl<'ln> ThreadSafeLayoutNode<'ln> {
let mut layout_data_ref = self.mutate_layout_data();
match &mut *layout_data_ref {
&Some(ref mut layout_data) => layout_data.data.flags.insert(new_flags),
- _ => fail!("no layout data for this node"),
+ _ => panic!("no layout data for this node"),
}
}
@@ -942,7 +942,7 @@ impl<'ln> ThreadSafeLayoutNode<'ln> {
let mut layout_data_ref = self.mutate_layout_data();
match &mut *layout_data_ref {
&Some(ref mut layout_data) => layout_data.data.flags.remove(flags),
- _ => fail!("no layout data for this node"),
+ _ => panic!("no layout data for this node"),
}
}
}
diff --git a/components/layout_traits/lib.rs b/components/layout_traits/lib.rs
index f9808f0c2e8..9c662a5c3a5 100644
--- a/components/layout_traits/lib.rs
+++ b/components/layout_traits/lib.rs
@@ -5,7 +5,8 @@
#![comment = "The Servo Parallel Browser Project"]
#![license = "MPL"]
-#![deny(unused_imports, unused_variable)]
+#![deny(unused_imports)]
+#![deny(unused_variables)]
extern crate gfx;
extern crate script_traits;
diff --git a/components/msg/compositor_msg.rs b/components/msg/compositor_msg.rs
index a4cc14a12ea..9c82d790fd2 100644
--- a/components/msg/compositor_msg.rs
+++ b/components/msg/compositor_msg.rs
@@ -7,7 +7,6 @@ use geom::point::Point2D;
use geom::rect::Rect;
use layers::platform::surface::NativeGraphicsMetadata;
use layers::layers::LayerBufferSet;
-use serialize::{Encoder, Encodable};
use std::fmt::{Formatter, Show};
use std::fmt;
@@ -33,7 +32,7 @@ pub enum ReadyState {
}
/// A newtype struct for denoting the age of messages; prevents race conditions.
-#[deriving(PartialEq)]
+#[deriving(PartialEq, Show)]
pub struct Epoch(pub uint);
impl Epoch {
@@ -115,9 +114,3 @@ pub trait ScriptListener {
fn close(&mut self);
fn dup(&mut self) -> Box<ScriptListener+'static>;
}
-
-impl<E, S: Encoder<E>> Encodable<S, E> for Box<ScriptListener+'static> {
- fn encode(&self, _s: &mut S) -> Result<(), E> {
- Ok(())
- }
-}
diff --git a/components/msg/constellation_msg.rs b/components/msg/constellation_msg.rs
index fbdb437327c..e043a04d3fd 100644
--- a/components/msg/constellation_msg.rs
+++ b/components/msg/constellation_msg.rs
@@ -87,20 +87,20 @@ impl LoadData {
}
/// Represents the two different ways to which a page can be navigated
-#[deriving(Clone, PartialEq, Hash)]
+#[deriving(Clone, PartialEq, Hash, Show)]
pub enum NavigationType {
Load, // entered or clicked on a url
Navigate, // browser forward/back buttons
}
-#[deriving(Clone, PartialEq, Hash)]
+#[deriving(Clone, PartialEq, Hash, Show)]
pub enum NavigationDirection {
Forward,
Back,
}
-#[deriving(Clone, PartialEq, Eq, Hash)]
+#[deriving(Clone, PartialEq, Eq, Hash, Show)]
pub struct PipelineId(pub uint);
-#[deriving(Clone, PartialEq, Eq, Hash)]
+#[deriving(Clone, PartialEq, Eq, Hash, Show)]
pub struct SubpageId(pub uint);
diff --git a/components/msg/lib.rs b/components/msg/lib.rs
index 15e06b55060..de89e367e4a 100644
--- a/components/msg/lib.rs
+++ b/components/msg/lib.rs
@@ -2,7 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-#![deny(unused_imports, unused_variable)]
+#![deny(unused_imports)]
+#![deny(unused_variables)]
extern crate azure;
extern crate geom;
diff --git a/components/net/about_loader.rs b/components/net/about_loader.rs
index 55d4bf384ef..4eca1d7819a 100644
--- a/components/net/about_loader.rs
+++ b/components/net/about_loader.rs
@@ -24,7 +24,7 @@ pub fn factory(mut load_data: LoadData, start_chan: Sender<LoadResponse>) {
chan.send(Done(Ok(())));
return
}
- "crash" => fail!("Loading the about:crash URL."),
+ "crash" => panic!("Loading the about:crash URL."),
"failure" => {
let mut path = resources_dir_path();
path.push("failure.html");
diff --git a/components/net/data_loader.rs b/components/net/data_loader.rs
index 8044da5ec1e..90b13762910 100644
--- a/components/net/data_loader.rs
+++ b/components/net/data_loader.rs
@@ -28,7 +28,7 @@ fn load(load_data: LoadData, start_chan: Sender<LoadResponse>) {
// Split out content type and data.
let mut scheme_data = match url.scheme_data {
NonRelativeSchemeData(scheme_data) => scheme_data,
- _ => fail!("Expected a non-relative scheme URL.")
+ _ => panic!("Expected a non-relative scheme URL.")
};
match url.query {
Some(query) => {
diff --git a/components/net/fetch/cors_cache.rs b/components/net/fetch/cors_cache.rs
index d7021cd7a6b..f7b63b3b339 100644
--- a/components/net/fetch/cors_cache.rs
+++ b/components/net/fetch/cors_cache.rs
@@ -10,7 +10,7 @@
//! with CORSRequest being expanded into FetchRequest (etc)
use http::method::Method;
-use std::ascii::StrAsciiExt;
+use std::ascii::AsciiExt;
use std::comm::{Sender, Receiver, channel};
use time;
use time::{now, Timespec};
diff --git a/components/net/fetch/request.rs b/components/net/fetch/request.rs
index da933002fb8..95bdc76ca35 100644
--- a/components/net/fetch/request.rs
+++ b/components/net/fetch/request.rs
@@ -126,7 +126,7 @@ impl Request {
},
"blob" | "data" | "file" | "ftp" => {
// XXXManishearth handle these
- fail!("Unimplemented scheme for Fetch")
+ panic!("Unimplemented scheme for Fetch")
},
_ => Response::network_error()
diff --git a/components/net/fetch/response.rs b/components/net/fetch/response.rs
index 3ccb2ffe521..7b9034166ee 100644
--- a/components/net/fetch/response.rs
+++ b/components/net/fetch/response.rs
@@ -7,7 +7,7 @@ use http::status::{Status, UnregisteredStatus};
use http::status::Ok as StatusOk;
use http::headers::HeaderEnum;
use http::headers::response::HeaderCollection;
-use std::ascii::OwnedStrAsciiExt;
+use std::ascii::OwnedAsciiExt;
use std::comm::Receiver;
/// [Response type](http://fetch.spec.whatwg.org/#concept-response-type)
diff --git a/components/net/http_loader.rs b/components/net/http_loader.rs
index bde8c9d2b53..787375d5306 100644
--- a/components/net/http_loader.rs
+++ b/components/net/http_loader.rs
@@ -4,7 +4,8 @@
use resource_task::{Metadata, Payload, Done, LoadResponse, LoadData, start_sending_opt};
-use std::collections::hashmap::HashSet;
+use log;
+use std::collections::HashSet;
use http::client::{RequestWriter, NetworkStream};
use http::headers::HeaderEnum;
use std::io::Reader;
@@ -98,10 +99,11 @@ fn load(load_data: LoadData, start_chan: Sender<LoadResponse>) {
// Dump headers, but only do the iteration if info!() is enabled.
info!("got HTTP response {:s}, headers:", response.status.to_string());
- info!("{:?}",
+ if log_enabled!(log::INFO) {
for header in response.headers.iter() {
info!(" - {:s}: {:s}", header.header_name(), header.header_value());
- });
+ }
+ }
if 3 == (response.status.code() / 100) {
match response.headers.location {
diff --git a/components/net/image_cache_task.rs b/components/net/image_cache_task.rs
index 6474d8bee72..2f31aac04fc 100644
--- a/components/net/image_cache_task.rs
+++ b/components/net/image_cache_task.rs
@@ -9,7 +9,8 @@ use resource_task::{LoadData, ResourceTask};
use servo_util::task::spawn_named;
use servo_util::taskpool::TaskPool;
use std::comm::{channel, Receiver, Sender};
-use std::collections::hashmap::HashMap;
+use std::collections::HashMap;
+use std::collections::hash_map::{Occupied, Vacant};
use std::mem::replace;
use std::result;
use sync::{Arc, Mutex};
@@ -57,7 +58,7 @@ pub enum ImageResponseMsg {
impl PartialEq for ImageResponseMsg {
fn eq(&self, other: &ImageResponseMsg) -> bool {
match (self, other) {
- (&ImageReady(..), &ImageReady(..)) => fail!("unimplemented comparison"),
+ (&ImageReady(..), &ImageReady(..)) => panic!("unimplemented comparison"),
(&ImageNotReady, &ImageNotReady) => true,
(&ImageFailed, &ImageFailed) => true,
@@ -169,8 +170,6 @@ impl ImageCache {
loop {
let msg = self.port.recv();
- debug!("image_cache_task: received: {:?}", msg);
-
match msg {
Prefetch(url) => self.prefetch(url),
StorePrefetchedImageData(url, data) => {
@@ -231,7 +230,7 @@ impl ImageCache {
}
fn get_state(&self, url: &Url) -> ImageState {
- match self.state_map.find(url) {
+ match self.state_map.get(url) {
Some(state) => state.clone(),
None => Init
}
@@ -289,14 +288,14 @@ impl ImageCache {
| Decoding
| Decoded(..)
| Failed => {
- fail!("wrong state for storing prefetched image")
+ panic!("wrong state for storing prefetched image")
}
}
}
fn decode(&mut self, url: Url) {
match self.get_state(&url) {
- Init => fail!("decoding image before prefetch"),
+ Init => panic!("decoding image before prefetch"),
Prefetching(DoNotDecode) => {
// We don't have the data yet, queue up the decode
@@ -350,16 +349,16 @@ impl ImageCache {
| Prefetched(..)
| Decoded(..)
| Failed => {
- fail!("incorrect state in store_image")
+ panic!("incorrect state in store_image")
}
}
}
fn purge_waiters(&mut self, url: Url, f: || -> ImageResponseMsg) {
- match self.wait_map.pop(&url) {
+ match self.wait_map.remove(&url) {
Some(waiters) => {
- let mut items = waiters.lock();
+ let items = waiters.lock();
for response in items.iter() {
response.send(f());
}
@@ -370,9 +369,9 @@ impl ImageCache {
fn get_image(&self, url: Url, response: Sender<ImageResponseMsg>) {
match self.get_state(&url) {
- Init => fail!("request for image before prefetch"),
+ Init => panic!("request for image before prefetch"),
Prefetching(DoDecode) => response.send(ImageNotReady),
- Prefetching(DoNotDecode) | Prefetched(..) => fail!("request for image before decode"),
+ Prefetching(DoNotDecode) | Prefetched(..) => panic!("request for image before decode"),
Decoding => response.send(ImageNotReady),
Decoded(image) => response.send(ImageReady(image)),
Failed => response.send(ImageFailed),
@@ -381,15 +380,20 @@ impl ImageCache {
fn wait_for_image(&mut self, url: Url, response: Sender<ImageResponseMsg>) {
match self.get_state(&url) {
- Init => fail!("request for image before prefetch"),
+ Init => panic!("request for image before prefetch"),
- Prefetching(DoNotDecode) | Prefetched(..) => fail!("request for image before decode"),
+ Prefetching(DoNotDecode) | Prefetched(..) => panic!("request for image before decode"),
Prefetching(DoDecode) | Decoding => {
// We don't have this image yet
- self.wait_map.find_with_or_insert_with(url, response,
- |_, waiters, response| waiters.lock().push(response),
- |_, response| Arc::new(Mutex::new(vec!(response))));
+ match self.wait_map.entry(url) {
+ Occupied(mut entry) => {
+ entry.get_mut().lock().push(response);
+ }
+ Vacant(entry) => {
+ entry.set(Arc::new(Mutex::new(vec!(response))));
+ }
+ }
}
Decoded(image) => {
@@ -618,7 +622,7 @@ mod tests {
mock_resource_task.send(resource_task::Exit);
match url_requested.try_recv() {
Err(_) => (),
- Ok(_) => fail!(),
+ Ok(_) => panic!(),
};
}
@@ -660,7 +664,7 @@ mod tests {
image_cache_task.send(GetImage(url, response_chan));
match response_port.recv() {
ImageReady(_) => (),
- _ => fail!("bleh")
+ _ => panic!("bleh")
}
image_cache_task.exit();
@@ -687,7 +691,7 @@ mod tests {
image_cache_task.send(GetImage(url.clone(), response_chan));
match response_port.recv() {
ImageReady(_) => (),
- _ => fail!("bleh")
+ _ => panic!("bleh")
}
}
@@ -738,7 +742,7 @@ mod tests {
// because it's already cached
match image_bin_sent.try_recv() {
Err(_) => (),
- Ok(_) => fail!(),
+ Ok(_) => panic!(),
}
}
@@ -787,7 +791,7 @@ mod tests {
// because it's already cached
match image_bin_sent.try_recv() {
Err(_) => (),
- Ok(_) => fail!(),
+ Ok(_) => panic!(),
}
}
@@ -810,7 +814,7 @@ mod tests {
image_cache_task.send(GetImage(url, response_chan));
match response_port.recv() {
ImageFailed => (),
- _ => fail!("bleh")
+ _ => panic!("bleh")
}
image_cache_task.exit();
@@ -836,7 +840,7 @@ mod tests {
image_cache_task.send(GetImage(url.clone(), response_chan));
match response_port.recv() {
ImageFailed => (),
- _ => fail!("bleh")
+ _ => panic!("bleh")
}
// And ask again, we should get the same response
@@ -844,7 +848,7 @@ mod tests {
image_cache_task.send(GetImage(url, response_chan));
match response_port.recv() {
ImageFailed => (),
- _ => fail!("bleh")
+ _ => panic!("bleh")
}
image_cache_task.exit();
@@ -872,7 +876,7 @@ mod tests {
match response_port.recv() {
ImageFailed => (),
- _ => fail!("bleh")
+ _ => panic!("bleh")
}
image_cache_task.exit();
@@ -898,7 +902,7 @@ mod tests {
image_cache_task.send(WaitForImage(url, response_chan));
match response_port.recv() {
ImageReady(..) => (),
- _ => fail!("bleh")
+ _ => panic!("bleh")
}
image_cache_task.exit();
@@ -924,7 +928,7 @@ mod tests {
match response_port.recv() {
ImageReady(..) => (),
- _ => fail!("bleh")
+ _ => panic!("bleh")
}
image_cache_task.exit();
@@ -950,7 +954,7 @@ mod tests {
match response_port.recv() {
ImageFailed => (),
- _ => fail!("bleh")
+ _ => panic!("bleh")
}
image_cache_task.exit();
@@ -971,7 +975,7 @@ mod tests {
image_cache_task.send(GetImage(url, response_chan));
match response_port.recv() {
ImageReady(_) => (),
- _ => fail!("bleh")
+ _ => panic!("bleh")
}
image_cache_task.exit();
diff --git a/components/net/lib.rs b/components/net/lib.rs
index 0a963a8f493..1ada75e5baf 100644
--- a/components/net/lib.rs
+++ b/components/net/lib.rs
@@ -4,9 +4,9 @@
#![feature(default_type_params, globs, phase)]
-#![deny(unused_imports, unused_variable)]
+#![deny(unused_imports)]
+#![deny(unused_variables)]
-extern crate debug;
extern crate collections;
extern crate geom;
extern crate http;
diff --git a/components/net/local_image_cache.rs b/components/net/local_image_cache.rs
index 079bf69b3e8..0227f7fe91f 100644
--- a/components/net/local_image_cache.rs
+++ b/components/net/local_image_cache.rs
@@ -12,7 +12,8 @@ use image_cache_task::{Decode, GetImage, ImageCacheTask, ImageFailed, ImageNotRe
use image_cache_task::{ImageResponseMsg, Prefetch, WaitForImage};
use std::comm::{Receiver, channel};
-use std::collections::hashmap::HashMap;
+use std::collections::HashMap;
+use std::collections::hash_map::{Occupied, Vacant};
use servo_util::task::spawn_named;
use url::Url;
@@ -153,15 +154,15 @@ impl<NodeAddress: Send> LocalImageCache<NodeAddress> {
}
fn get_state<'a>(&'a mut self, url: &Url) -> &'a mut ImageState {
- let state = self.state_map.find_or_insert_with(url.clone(), |_| {
- let new_state = ImageState {
- prefetched: false,
- decoded: false,
- last_request_round: 0,
- last_response: ImageNotReady
- };
- new_state
- });
- state
+ match self.state_map.entry((*url).clone()) {
+ Occupied(entry) => entry.into_mut(),
+ Vacant(entry) =>
+ entry.set(ImageState {
+ prefetched: false,
+ decoded: false,
+ last_request_round: 0,
+ last_response: ImageNotReady,
+ })
+ }
}
}
diff --git a/components/net/resource_task.rs b/components/net/resource_task.rs
index 812b1d5d3d0..86f8a75e98c 100644
--- a/components/net/resource_task.rs
+++ b/components/net/resource_task.rs
@@ -90,9 +90,9 @@ impl Metadata {
pub fn set_content_type(&mut self, content_type: &Option<MediaType>) {
match *content_type {
None => (),
- Some(MediaType { type_: ref type_,
- subtype: ref subtype,
- parameters: ref parameters }) => {
+ Some(MediaType { ref type_,
+ ref subtype,
+ ref parameters }) => {
self.content_type = Some((type_.clone(), subtype.clone()));
for &(ref k, ref v) in parameters.iter() {
if "charset" == k.as_slice() {
@@ -266,7 +266,7 @@ fn test_bad_scheme() {
let response = start.recv();
match response.progress_port.recv() {
Done(result) => { assert!(result.is_err()) }
- _ => fail!("bleh")
+ _ => panic!("bleh")
}
resource_task.send(Exit);
}
diff --git a/components/plugins/lib.rs b/components/plugins/lib.rs
index 2a06fb36f74..a821bcea84b 100644
--- a/components/plugins/lib.rs
+++ b/components/plugins/lib.rs
@@ -14,7 +14,8 @@
#![feature(macro_rules, plugin_registrar, quote, phase)]
-#![deny(unused_imports, unused_variable)]
+#![deny(unused_imports)]
+#![deny(unused_variables)]
#[phase(plugin,link)]
extern crate syntax;
diff --git a/components/plugins/lints.rs b/components/plugins/lints.rs
index aa374cde1d9..f686623d190 100644
--- a/components/plugins/lints.rs
+++ b/components/plugins/lints.rs
@@ -58,7 +58,7 @@ impl LintPass for TransmutePass {
cx.span_lint(TRANSMUTE_TYPE_LINT, ex.span,
format!("Transmute from {} to {} detected",
expr_ty(tcx, ex).repr(tcx),
- expr_ty(tcx, &**args.get(0)).repr(tcx)
+ expr_ty(tcx, &**args.get(0).unwrap()).repr(tcx)
).as_slice());
}
}
@@ -75,7 +75,7 @@ impl LintPass for TransmutePass {
// TODO (#3874, sort of): unwrap other types like Vec/Option/HashMap/etc
fn lint_unrooted_ty(cx: &Context, ty: &ast::Ty, warning: &str) {
match ty.node {
- ast::TyBox(ref t) | ast::TyUniq(ref t) |
+ ast::TyUniq(ref t) |
ast::TyVec(ref t) | ast::TyFixedLengthVec(ref t, _) |
ast::TyPtr(ast::MutTy { ty: ref t, ..}) | ast::TyRptr(_, ast::MutTy { ty: ref t, ..}) => lint_unrooted_ty(cx, &**t, warning),
ast::TyPath(_, _, id) => {
@@ -162,7 +162,7 @@ impl LintPass for UnrootedPass {
// We need not check arms individually since enum/struct fields are already
// linted in `check_struct_def` and `check_variant`
// (so there is no way of destructuring out a `#[must_root]` field)
- ast::ExprMatch(ref e, _) |
+ ast::ExprMatch(ref e, _, _) |
// For loops allow you to bind a return value locally
ast::ExprForLoop(_, ref e, _, _) => &**e,
// XXXManishearth look into `if let` once it lands in our rustc
diff --git a/components/script/cors.rs b/components/script/cors.rs
index 5bcb737a504..50e69ca333f 100644
--- a/components/script/cors.rs
+++ b/components/script/cors.rs
@@ -9,10 +9,9 @@
//! This library will eventually become the core of the Fetch crate
//! with CORSRequest being expanded into FetchRequest (etc)
-use std::ascii::{StrAsciiExt, OwnedStrAsciiExt};
+use std::ascii::{AsciiExt, OwnedAsciiExt};
use std::from_str::FromStr;
use std::io::BufReader;
-use std::str::StrSlice;
use time;
use time::{now, Timespec};
@@ -155,7 +154,7 @@ impl CORSRequest {
// Step 12
match response.status.code() {
- 200 .. 299 => {}
+ 200 ... 299 => {}
_ => return error
}
cors_response.headers = response.headers.clone();
diff --git a/components/script/dom/bindings/callback.rs b/components/script/dom/bindings/callback.rs
index 85421f3f6ad..56690bcfd41 100644
--- a/components/script/dom/bindings/callback.rs
+++ b/components/script/dom/bindings/callback.rs
@@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-#![deny(missing_doc)]
+#![deny(missing_docs)]
//! Base classes to work with IDL callbacks.
diff --git a/components/script/dom/bindings/cell.rs b/components/script/dom/bindings/cell.rs
index 18385b66f39..44acbef710e 100644
--- a/components/script/dom/bindings/cell.rs
+++ b/components/script/dom/bindings/cell.rs
@@ -6,7 +6,7 @@ use dom::bindings::trace::JSTraceable;
use js::jsapi::{JSTracer};
use servo_util::task_state;
-use servo_util::task_state::{Script, InGC};
+use servo_util::task_state::{SCRIPT, IN_GC};
use std::cell::{Cell, UnsafeCell};
use std::kinds::marker;
@@ -39,7 +39,7 @@ impl<T> DOMRefCell<T> {
/// This succeeds even if the object is mutably borrowed,
/// so you have to be careful in trace code!
pub unsafe fn borrow_for_gc_trace<'a>(&'a self) -> &'a T {
- debug_assert!(task_state::get().contains(Script | InGC));
+ debug_assert!(task_state::get().contains(SCRIPT | IN_GC));
&*self.value.get()
}
@@ -87,8 +87,8 @@ impl<T: JSTraceable> JSTraceable for DOMRefCell<T> {
// Values [1, MAX-1] represent the number of `Ref` active
// (will not outgrow its range since `uint` is the size of the address space)
type BorrowFlag = uint;
-static UNUSED: BorrowFlag = 0;
-static WRITING: BorrowFlag = -1;
+const UNUSED: BorrowFlag = 0;
+const WRITING: BorrowFlag = -1;
impl<T> DOMRefCell<T> {
pub fn new(value: T) -> DOMRefCell<T> {
@@ -108,14 +108,14 @@ impl<T> DOMRefCell<T> {
pub fn borrow<'a>(&'a self) -> Ref<'a, T> {
match self.try_borrow() {
Some(ptr) => ptr,
- None => fail!("DOMRefCell<T> already mutably borrowed")
+ None => panic!("DOMRefCell<T> already mutably borrowed")
}
}
pub fn borrow_mut<'a>(&'a self) -> RefMut<'a, T> {
match self.try_borrow_mut() {
Some(ptr) => ptr,
- None => fail!("DOMRefCell<T> already borrowed")
+ None => panic!("DOMRefCell<T> already borrowed")
}
}
}
diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py
index d90c7cc5be9..9ca15459ba1 100644
--- a/components/script/dom/bindings/codegen/CodegenRust.py
+++ b/components/script/dom/bindings/codegen/CodegenRust.py
@@ -183,7 +183,7 @@ class CGMethodCall(CGThing):
nativeMethodName + '_'*signatureIndex,
static, descriptor,
method, argConversionStartsAt)
-
+
signatures = method.signatures()
if len(signatures) == 1:
@@ -203,7 +203,7 @@ class CGMethodCall(CGThing):
"}" % (requiredArgs, methodName))
self.cgRoot.prepend(
CGWrapper(CGGeneric(code), pre="\n", post="\n"))
-
+
return
# Need to find the right overload
@@ -277,7 +277,7 @@ class CGMethodCall(CGThing):
s[1][distinguishingIndex].type.isNonCallbackInterface()) ]
# There might be more than one of these; we need to check
# which ones we unwrap to.
-
+
if len(interfacesSigs) > 0:
# The spec says that we should check for "platform objects
# implementing an interface", but it's enough to guard on these
@@ -381,7 +381,7 @@ class CGMethodCall(CGThing):
"return 0;\n" % methodName)))
#XXXjdm Avoid unreachable statement warnings
#overloadCGThings.append(
- # CGGeneric('fail!("We have an always-returning default case");\n'
+ # CGGeneric('panic!("We have an always-returning default case");\n'
# 'return 0;'))
self.cgRoot = CGWrapper(CGList(overloadCGThings, "\n"),
pre="\n")
@@ -686,7 +686,7 @@ def getJSToNativeConversionTemplate(type, descriptorProvider, failureCode=None,
value = "Some(%s)" % value
default = (
- "static data: [u8, ..%s] = [ %s ];\n"
+ "const data: [u8, ..%s] = [ %s ];\n"
"%s" %
(len(defaultValue.value) + 1,
", ".join(["'" + char + "' as u8" for char in defaultValue.value] + ["0"]),
@@ -724,7 +724,7 @@ def getJSToNativeConversionTemplate(type, descriptorProvider, failureCode=None,
handleInvalidEnumValueCode = exceptionCode
else:
handleInvalidEnumValueCode = "return 1;"
-
+
template = (
"match FindEnumStringIndex(cx, ${val}, %(values)s) {\n"
" Err(_) => { %(exceptionCode)s },\n"
@@ -1146,7 +1146,7 @@ class PropertyDefiner:
if specTerminator:
specs.append(specTerminator)
- return (("static %s: &'static [%s] = &[\n" +
+ return (("const %s: &'static [%s] = &[\n" +
",\n".join(specs) + "\n" +
"];\n\n") % (name, specType))
@@ -1197,9 +1197,9 @@ class MethodDefiner(PropertyDefiner):
return (m["name"], accessor, jitinfo, m["length"], m["flags"])
def stringDecl(m):
- return "static %s_name: [u8, ..%i] = %s;\n" % (m["name"], len(m["name"]) + 1,
+ return "const %s_name: [u8, ..%i] = %s;\n" % (m["name"], len(m["name"]) + 1,
str_to_const_array(m["name"]))
-
+
decls = ''.join([stringDecl(m) for m in array])
return decls + self.generatePrefableArray(
array, name,
@@ -1265,9 +1265,9 @@ class AttrDefiner(PropertyDefiner):
def stringDecl(attr):
name = attr.identifier.name
- return "static %s_name: [u8, ..%i] = %s;\n" % (name, len(name) + 1,
+ return "const %s_name: [u8, ..%i] = %s;\n" % (name, len(name) + 1,
str_to_const_array(name))
-
+
decls = ''.join([stringDecl(m) for m in array])
return decls + self.generatePrefableArray(
@@ -1296,8 +1296,8 @@ class ConstDefiner(PropertyDefiner):
def stringDecl(const):
name = const.identifier.name
- return "static %s_name: &'static [u8] = &%s;\n" % (name, str_to_const_array(name))
-
+ return "const %s_name: &'static [u8] = &%s;\n" % (name, str_to_const_array(name))
+
decls = ''.join([stringDecl(m) for m in array])
return decls + self.generatePrefableArray(
@@ -1362,13 +1362,13 @@ class CGImports(CGWrapper):
# CallbackMember.getArgConversions.
'unreachable_code',
'non_camel_case_types',
- 'non_uppercase_statics',
- 'unnecessary_parens',
+ 'non_upper_case_globals',
+ 'unused_parens',
'unused_imports',
- 'unused_variable',
+ 'unused_variables',
'unused_unsafe',
'unused_mut',
- 'dead_assignment',
+ 'unused_assignments',
'dead_code',
]
@@ -1442,7 +1442,7 @@ class CGDOMJSClass(CGThing):
flags = "0"
slots = "1"
return """
-static Class_name: [u8, ..%i] = %s;
+const Class_name: [u8, ..%i] = %s;
static Class: DOMJSClass = DOMJSClass {
base: js::Class {
name: &Class_name as *const u8 as *const libc::c_char,
@@ -1526,7 +1526,7 @@ class CGPrototypeJSClass(CGThing):
def define(self):
return """
-static PrototypeClassName__: [u8, ..%s] = %s;
+const PrototypeClassName__: [u8, ..%s] = %s;
static PrototypeClass: JSClass = JSClass {
name: &PrototypeClassName__ as *const u8 as *const libc::c_char,
flags: (1 & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT as uint, //JSCLASS_HAS_RESERVED_SLOTS(1)
@@ -1559,7 +1559,7 @@ class CGInterfaceObjectJSClass(CGThing):
ctorname = "0 as *const u8" if not self.descriptor.interface.ctor() else CONSTRUCT_HOOK_NAME
hasinstance = HASINSTANCE_HOOK_NAME
return """
-static InterfaceObjectClass: JSClass = {
+const InterfaceObjectClass: JSClass = {
%s, 0,
JS_PropertyStub,
JS_PropertyStub,
@@ -2192,7 +2192,7 @@ class CGCallGenerator(CGThing):
call = CGGeneric(nativeMethodName)
if static:
call = CGWrapper(call, pre="%s::" % descriptorProvider.interface.identifier.name)
- else:
+ else:
call = CGWrapper(call, pre="%s." % object)
call = CGList([call, CGWrapper(args, pre="(", post=")")])
@@ -2348,7 +2348,7 @@ class CGCase(CGList):
bodyList = CGList([body], "\n")
if fallThrough:
raise TypeError("fall through required but unsupported")
- #bodyList.append(CGGeneric('fail!("fall through unsupported"); /* Fall through */'))
+ #bodyList.append(CGGeneric('panic!("fall through unsupported"); /* Fall through */'))
self.append(CGIndenter(bodyList));
self.append(CGGeneric("}"))
@@ -2683,7 +2683,7 @@ class CGMemberJITInfo(CGThing):
depth = self.descriptor.interface.inheritanceDepth()
failstr = "true" if infallible else "false"
return ("\n"
- "static %s: JSJitInfo = JSJitInfo {\n"
+ "const %s: JSJitInfo = JSJitInfo {\n"
" op: %s as *const u8,\n"
" protoID: %s,\n"
" depth: %s,\n"
@@ -2760,7 +2760,7 @@ pub enum valuelist {
%s
}
-pub static strings: &'static [&'static str] = &[
+pub const strings: &'static [&'static str] = &[
%s,
];
@@ -2806,7 +2806,7 @@ class CGConstant(CGThing):
def stringDecl(const):
name = const.identifier.name
value = convertConstIDLValueToRust(const.value)
- return CGGeneric("pub static %s: %s = %s;\n" % (name, builtinNames[const.value.type.tag()], value))
+ return CGGeneric("pub const %s: %s = %s;\n" % (name, builtinNames[const.value.type.tag()], value))
return CGIndenter(CGList(stringDecl(m) for m in self.constants)).define()
@@ -3889,7 +3889,7 @@ class CGDOMJSProxyHandler_obj_toString(CGAbstractExternMethod):
return call.define() + """
JSString* jsresult;
-return xpc_qsStringToJsstring(cx, result, &jsresult) ? jsresult : NULL;"""
+return xpc_qsStringToJsstring(cx, result, &jsresult) ? jsresult : NULL;"""
return """let s = "%s".to_c_str();
_obj_toString(cx, s.as_ptr())""" % self.descriptor.name
@@ -5166,7 +5166,7 @@ class CallbackMember(CGNativeMember):
if arg.optional and not arg.defaultValue:
argval += ".clone().unwrap()"
- conversion = wrapForType("*argv.get_mut(%s)" % jsvalIndex,
+ conversion = wrapForType("argv[%s]" % jsvalIndex,
result=argval,
successCode="continue;" if arg.variadic else "break;")
if arg.variadic:
@@ -5183,7 +5183,7 @@ class CallbackMember(CGNativeMember):
" // This is our current trailing argument; reduce argc\n"
" argc -= 1;\n"
"} else {\n"
- " *argv.get_mut(%d) = UndefinedValue();\n"
+ " argv[%d] = UndefinedValue();\n"
"}" % (i+1, i))
return conversion
@@ -5397,7 +5397,7 @@ class GlobalGenRoots():
return CGList([
CGGeneric(AUTOGENERATED_WARNING_COMMENT),
- CGGeneric("pub static MAX_PROTO_CHAIN_LENGTH: uint = %d;\n\n" % config.maxProtoChainLength),
+ CGGeneric("pub const MAX_PROTO_CHAIN_LENGTH: uint = %d;\n\n" % config.maxProtoChainLength),
CGNamespacedEnum('id', 'ID', protos, [0], deriving="PartialEq"),
CGNamespacedEnum('proxies', 'Proxy', proxies, [0], deriving="PartialEq"),
])
diff --git a/components/script/dom/bindings/conversions.rs b/components/script/dom/bindings/conversions.rs
index 9cd7684b335..596b722c77d 100644
--- a/components/script/dom/bindings/conversions.rs
+++ b/components/script/dom/bindings/conversions.rs
@@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-#![deny(missing_doc)]
+#![deny(missing_docs)]
//! Conversions of Rust values to and from `JSVal`.
@@ -69,7 +69,7 @@ impl ToJSValConvertible for JSVal {
fn to_jsval(&self, cx: *mut JSContext) -> JSVal {
let mut value = *self;
if unsafe { JS_WrapValue(cx, &mut value) } == 0 {
- fail!("JS_WrapValue failed.");
+ panic!("JS_WrapValue failed.");
}
value
}
@@ -238,7 +238,7 @@ impl ToJSValConvertible for DOMString {
let string_utf16: Vec<u16> = self.as_slice().utf16_units().collect();
let jsstr = JS_NewUCStringCopyN(cx, string_utf16.as_ptr(), string_utf16.len() as libc::size_t);
if jsstr.is_null() {
- fail!("JS_NewUCStringCopyN failed");
+ panic!("JS_NewUCStringCopyN failed");
}
StringValue(&*jsstr)
}
@@ -304,7 +304,7 @@ impl ToJSValConvertible for ByteString {
let jsstr = JS_NewStringCopyN(cx, slice.as_ptr() as *const libc::c_char,
slice.len() as libc::size_t);
if jsstr.is_null() {
- fail!("JS_NewStringCopyN failed");
+ panic!("JS_NewStringCopyN failed");
}
StringValue(&*jsstr)
}
@@ -340,7 +340,7 @@ impl ToJSValConvertible for Reflector {
assert!(obj.is_not_null());
let mut value = ObjectValue(unsafe { &*obj });
if unsafe { JS_WrapValue(cx, &mut value) } == 0 {
- fail!("JS_WrapValue failed.");
+ panic!("JS_WrapValue failed.");
}
value
}
diff --git a/components/script/dom/bindings/global.rs b/components/script/dom/bindings/global.rs
index a1933db4aa5..7f7e225a63b 100644
--- a/components/script/dom/bindings/global.rs
+++ b/components/script/dom/bindings/global.rs
@@ -61,7 +61,7 @@ impl<'a> GlobalRef<'a> {
pub fn as_window<'b>(&'b self) -> JSRef<'b, window::Window> {
match *self {
Window(window) => window,
- Worker(_) => fail!("expected a Window scope"),
+ Worker(_) => panic!("expected a Window scope"),
}
}
@@ -144,6 +144,6 @@ pub fn global_object_for_js_object(obj: *mut JSObject) -> GlobalField {
Err(_) => (),
}
- fail!("found DOM global that doesn't unwrap to Window or WorkerGlobalScope")
+ panic!("found DOM global that doesn't unwrap to Window or WorkerGlobalScope")
}
}
diff --git a/components/script/dom/bindings/js.rs b/components/script/dom/bindings/js.rs
index 2cd327397ad..17853287590 100644
--- a/components/script/dom/bindings/js.rs
+++ b/components/script/dom/bindings/js.rs
@@ -94,7 +94,7 @@ impl<T: Reflectable> Temporary<T> {
pub fn root<'a, 'b>(self) -> Root<'a, 'b, T> {
let collection = StackRoots.get().unwrap();
unsafe {
- (**collection).new_root(&self.inner)
+ Root::new(&**collection, &self.inner)
}
}
@@ -171,7 +171,7 @@ impl<T: Reflectable> JS<T> {
pub fn root<'a, 'b>(&self) -> Root<'a, 'b, T> {
let collection = StackRoots.get().unwrap();
unsafe {
- (**collection).new_root(self)
+ Root::new(&**collection, self)
}
}
}
@@ -431,18 +431,12 @@ impl RootCollection {
}
}
- /// Create a new stack-bounded root that will not outlive this collection
- #[allow(unrooted_must_root)]
- fn new_root<'b, 'a: 'b, T: Reflectable>(&'a self, unrooted: &JS<T>) -> Root<'a, 'b, T> {
- Root::new(self, unrooted)
- }
-
/// Track a stack-based root to ensure LIFO root ordering
fn root<'a, 'b, T: Reflectable>(&self, untracked: &Root<'a, 'b, T>) {
unsafe {
let roots = self.roots.get();
(*roots).push(untracked.js_ptr);
- debug!(" rooting {:?}", untracked.js_ptr);
+ debug!(" rooting {}", untracked.js_ptr);
}
}
@@ -450,7 +444,7 @@ impl RootCollection {
fn unroot<'a, 'b, T: Reflectable>(&self, rooted: &Root<'a, 'b, T>) {
unsafe {
let roots = self.roots.get();
- debug!("unrooting {:?} (expecting {:?}",
+ debug!("unrooting {} (expecting {}",
(*roots).as_slice().last().unwrap(),
rooted.js_ptr);
assert!(*(*roots).as_slice().last().unwrap() == rooted.js_ptr);
diff --git a/components/script/dom/bindings/str.rs b/components/script/dom/bindings/str.rs
index 4ec9e08197b..a06aaed5ec4 100644
--- a/components/script/dom/bindings/str.rs
+++ b/components/script/dom/bindings/str.rs
@@ -6,7 +6,6 @@
use std::from_str::FromStr;
use std::hash::{Hash, sip};
-use std::path::BytesContainer;
use std::str;
/// Encapsulates the IDL `ByteString` type.
@@ -67,7 +66,7 @@ impl ByteString {
vec.iter().all(|&x| {
// http://tools.ietf.org/html/rfc2616#section-2.2
match x {
- 0..31 | 127 => false, // CTLs
+ 0...31 | 127 => false, // CTLs
40 | 41 | 60 | 62 | 64 |
44 | 59 | 58 | 92 | 34 |
47 | 91 | 93 | 63 | 61 |
@@ -132,7 +131,7 @@ impl ByteString {
false
}
},
- 0..31 | 127 => false, // CTLs
+ 0...31 | 127 => false, // CTLs
x if x > 127 => false, // non ASCII
_ if prev == Other || prev == SPHT => {
prev = Other;
@@ -153,6 +152,6 @@ impl Hash for ByteString {
impl FromStr for ByteString {
fn from_str(s: &str) -> Option<ByteString> {
- Some(ByteString::new(s.container_into_owned_bytes()))
+ Some(ByteString::new(s.to_string().into_bytes()))
}
}
diff --git a/components/script/dom/bindings/trace.rs b/components/script/dom/bindings/trace.rs
index 1690cb5ddad..03e37c53a5d 100644
--- a/components/script/dom/bindings/trace.rs
+++ b/components/script/dom/bindings/trace.rs
@@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-#![deny(missing_doc)]
+#![deny(missing_docs)]
//! Utilities for tracing JS-managed values.
//!
diff --git a/components/script/dom/bindings/utils.rs b/components/script/dom/bindings/utils.rs
index f8b497bdcd4..3117fc10f45 100644
--- a/components/script/dom/bindings/utils.rs
+++ b/components/script/dom/bindings/utils.rs
@@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-#![deny(missing_doc)]
+#![deny(missing_docs)]
//! Various utilities to glue JavaScript and the DOM implementation together.
@@ -19,7 +19,6 @@ use libc;
use libc::c_uint;
use std::cell::Cell;
use std::mem;
-use std::cmp::PartialEq;
use std::ptr;
use js::glue::{js_IsObjectProxyClass, js_IsFunctionProxyClass, IsProxyHandlerFamily};
use js::glue::{UnwrapObject, GetProxyHandlerExtra};
@@ -167,23 +166,23 @@ pub unsafe fn squirrel_away_unique<T>(x: Box<T>) -> *const T {
/// stored for non-proxy bindings.
// We use slot 0 for holding the raw object. This is safe for both
// globals and non-globals.
-pub static DOM_OBJECT_SLOT: uint = 0;
-static DOM_PROXY_OBJECT_SLOT: uint = js::JSSLOT_PROXY_PRIVATE as uint;
+pub const DOM_OBJECT_SLOT: uint = 0;
+const DOM_PROXY_OBJECT_SLOT: uint = js::JSSLOT_PROXY_PRIVATE as uint;
// NOTE: This is baked into the Ion JIT as 0 in codegen for LGetDOMProperty and
// LSetDOMProperty. Those constants need to be changed accordingly if this value
// changes.
-static DOM_PROTO_INSTANCE_CLASS_SLOT: u32 = 0;
+const DOM_PROTO_INSTANCE_CLASS_SLOT: u32 = 0;
/// The index of the slot that contains a reference to the ProtoOrIfaceArray.
// All DOM globals must have a slot at DOM_PROTOTYPE_SLOT.
-pub static DOM_PROTOTYPE_SLOT: u32 = js::JSCLASS_GLOBAL_SLOT_COUNT;
+pub const DOM_PROTOTYPE_SLOT: u32 = js::JSCLASS_GLOBAL_SLOT_COUNT;
/// The flag set on the `JSClass`es for DOM global objects.
// NOTE: This is baked into the Ion JIT as 0 in codegen for LGetDOMProperty and
// LSetDOMProperty. Those constants need to be changed accordingly if this value
// changes.
-pub static JSCLASS_DOM_GLOBAL: u32 = js::JSCLASS_USERBIT1;
+pub const JSCLASS_DOM_GLOBAL: u32 = js::JSCLASS_USERBIT1;
/// Representation of an IDL constant value.
#[deriving(Clone)]
@@ -677,7 +676,7 @@ pub unsafe fn delete_property_by_id(cx: *mut JSContext, object: *mut JSObject,
/// Results of `xml_name_type`.
#[deriving(PartialEq)]
-#[allow(missing_doc)]
+#[allow(missing_docs)]
pub enum XMLName {
QName,
Name,
@@ -690,21 +689,21 @@ pub fn xml_name_type(name: &str) -> XMLName {
fn is_valid_start(c: char) -> bool {
match c {
':' |
- 'A' .. 'Z' |
+ 'A' ... 'Z' |
'_' |
- 'a' .. 'z' |
- '\xC0' .. '\xD6' |
- '\xD8' .. '\xF6' |
- '\xF8' .. '\u02FF' |
- '\u0370' .. '\u037D' |
- '\u037F' .. '\u1FFF' |
- '\u200C' .. '\u200D' |
- '\u2070' .. '\u218F' |
- '\u2C00' .. '\u2FEF' |
- '\u3001' .. '\uD7FF' |
- '\uF900' .. '\uFDCF' |
- '\uFDF0' .. '\uFFFD' |
- '\U00010000' .. '\U000EFFFF' => true,
+ 'a' ... 'z' |
+ '\u00C0' ... '\u00D6' |
+ '\u00D8' ... '\u00F6' |
+ '\u00F8' ... '\u02FF' |
+ '\u0370' ... '\u037D' |
+ '\u037F' ... '\u1FFF' |
+ '\u200C' ... '\u200D' |
+ '\u2070' ... '\u218F' |
+ '\u2C00' ... '\u2FEF' |
+ '\u3001' ... '\uD7FF' |
+ '\uF900' ... '\uFDCF' |
+ '\uFDF0' ... '\uFFFD' |
+ '\U00010000' ... '\U000EFFFF' => true,
_ => false,
}
}
@@ -713,10 +712,10 @@ pub fn xml_name_type(name: &str) -> XMLName {
is_valid_start(c) || match c {
'-' |
'.' |
- '0' .. '9' |
- '\xB7' |
- '\u0300' .. '\u036F' |
- '\u203F' .. '\u2040' => true,
+ '0' ... '9' |
+ '\u00B7' |
+ '\u0300' ... '\u036F' |
+ '\u203F' ... '\u2040' => true,
_ => false,
}
}
diff --git a/components/script/dom/browsercontext.rs b/components/script/dom/browsercontext.rs
index b663327d5af..3391da89fea 100644
--- a/components/script/dom/browsercontext.rs
+++ b/components/script/dom/browsercontext.rs
@@ -80,7 +80,7 @@ impl SessionHistoryEntry {
}
}
-static proxy_handler: ProxyTraps = ProxyTraps {
+static PROXY_HANDLER: ProxyTraps = ProxyTraps {
getPropertyDescriptor: None,
getOwnPropertyDescriptor: None,
defineProperty: None,
@@ -114,6 +114,6 @@ static proxy_handler: ProxyTraps = ProxyTraps {
pub fn new_window_proxy_handler() -> WindowProxyHandler {
unsafe {
- WindowProxyHandler(CreateWrapperProxyHandler(&proxy_handler))
+ WindowProxyHandler(CreateWrapperProxyHandler(&PROXY_HANDLER))
}
}
diff --git a/components/script/dom/dedicatedworkerglobalscope.rs b/components/script/dom/dedicatedworkerglobalscope.rs
index 9bf06024dec..1c935bead98 100644
--- a/components/script/dom/dedicatedworkerglobalscope.rs
+++ b/components/script/dom/dedicatedworkerglobalscope.rs
@@ -26,7 +26,7 @@ use script_task::StackRootTLS;
use servo_net::resource_task::{ResourceTask, load_whole_resource};
use servo_util::task::spawn_named_native;
use servo_util::task_state;
-use servo_util::task_state::{Script, InWorker};
+use servo_util::task_state::{SCRIPT, IN_WORKER};
use js::glue::JS_STRUCTURED_CLONE_VERSION;
use js::jsapi::{JSContext, JS_ReadStructuredClone, JS_WriteStructuredClone, JS_ClearPendingException};
@@ -89,7 +89,7 @@ impl DedicatedWorkerGlobalScope {
receiver: Receiver<ScriptMsg>) {
spawn_named_native(format!("WebWorker for {}", worker_url.serialize()), proc() {
- task_state::initialize(Script | InWorker);
+ task_state::initialize(SCRIPT | IN_WORKER);
let roots = RootCollection::new();
let _stack_roots_tls = StackRootTLS::new(&roots);
@@ -148,7 +148,7 @@ impl DedicatedWorkerGlobalScope {
Ok(FireTimerMsg(FromWorker, timer_id)) => {
scope.handle_fire_timer(timer_id, js_context.ptr);
}
- Ok(_) => fail!("Unexpected message"),
+ Ok(_) => panic!("Unexpected message"),
Err(_) => break,
}
}
diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs
index 527622edad2..793bfad38b2 100644
--- a/components/script/dom/document.rs
+++ b/components/script/dom/document.rs
@@ -62,8 +62,9 @@ use html5ever::tree_builder::{QuirksMode, NoQuirks, LimitedQuirks, Quirks};
use string_cache::{Atom, QualName};
use url::Url;
-use std::collections::hashmap::HashMap;
-use std::ascii::StrAsciiExt;
+use std::collections::HashMap;
+use std::collections::hash_map::{Vacant, Occupied};
+use std::ascii::AsciiExt;
use std::cell::Cell;
use std::default::Default;
use time;
@@ -233,7 +234,7 @@ impl<'a> DocumentHelpers<'a> for JSRef<'a, Document> {
to_unregister: JSRef<Element>,
id: Atom) {
let mut idmap = self.idmap.borrow_mut();
- let is_empty = match idmap.find_mut(&id) {
+ let is_empty = match idmap.get_mut(&id) {
None => false,
Some(elements) => {
let position = elements.iter()
@@ -262,29 +263,35 @@ impl<'a> DocumentHelpers<'a> for JSRef<'a, Document> {
let mut idmap = self.idmap.borrow_mut();
let root = self.GetDocumentElement().expect("The element is in the document, so there must be a document element.").root();
- idmap.find_with_or_insert_with(id, element,
- |_key, elements, element| {
+
+ match idmap.entry(id) {
+ Vacant(entry) => {
+ entry.set(vec!(element.unrooted()));
+ }
+ Occupied(entry) => {
+ let elements = entry.into_mut();
+
let new_node: JSRef<Node> = NodeCast::from_ref(element);
- let mut head : uint = 0u;
+ let mut head: uint = 0u;
let root: JSRef<Node> = NodeCast::from_ref(*root);
for node in root.traverse_preorder() {
let elem: Option<JSRef<Element>> = ElementCast::to_ref(node);
match elem {
+ None => {},
Some(elem) => {
if *(*elements)[head].root() == elem {
- head = head + 1;
+ head += 1;
}
if new_node == node || head == elements.len() {
break;
}
}
- None => {}
}
}
+
elements.insert_unrooted(head, &element);
- },
- |_key, element| vec![element.unrooted()]
- );
+ }
+ }
}
fn load_anchor_href(self, href: DOMString) {
@@ -514,7 +521,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
// http://dom.spec.whatwg.org/#dom-nonelementparentnode-getelementbyid
fn GetElementById(self, id: DOMString) -> Option<Temporary<Element>> {
let id = Atom::from_slice(id.as_slice());
- match self.idmap.borrow().find(&id) {
+ match self.idmap.borrow().get(&id) {
None => None,
Some(ref elements) => Some(Temporary::new((*elements)[0].clone())),
}
@@ -660,7 +667,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
fn LastModified(self) -> DOMString {
match *self.last_modified.borrow() {
Some(ref t) => t.clone(),
- None => time::now().strftime("%m/%d/%Y %H:%M:%S"),
+ None => time::now().strftime("%m/%d/%Y %H:%M:%S").unwrap(),
}
}
diff --git a/components/script/dom/domexception.rs b/components/script/dom/domexception.rs
index f3fc0027620..c7eb73ea10a 100644
--- a/components/script/dom/domexception.rs
+++ b/components/script/dom/domexception.rs
@@ -56,7 +56,7 @@ impl DOMErrorName {
error::Abort => AbortError,
error::Timeout => TimeoutError,
error::DataClone => DataCloneError,
- error::FailureUnknown => fail!(),
+ error::FailureUnknown => panic!(),
}
}
}
diff --git a/components/script/dom/domstringmap.rs b/components/script/dom/domstringmap.rs
index 630b33f6a6b..96a822645c6 100644
--- a/components/script/dom/domstringmap.rs
+++ b/components/script/dom/domstringmap.rs
@@ -10,7 +10,7 @@ use dom::bindings::js::{JSRef, Temporary};
use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object};
use servo_util::str::DOMString;
-use std::collections::hashmap::HashMap;
+use std::collections::HashMap;
#[dom_struct]
pub struct DOMStringMap {
@@ -46,7 +46,7 @@ impl<'a> DOMStringMapMethods for JSRef<'a, DOMStringMap> {
}
fn NamedGetter(self, name: DOMString, found: &mut bool) -> DOMString {
- match self.map.borrow().find(&name) {
+ match self.map.borrow().get(&name) {
Some(value) => {
*found = true;
value.clone()
diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs
index 9c02a92d68f..9c2031c79cf 100644
--- a/components/script/dom/element.rs
+++ b/components/script/dom/element.rs
@@ -40,7 +40,7 @@ use style;
use servo_util::namespace;
use servo_util::str::{DOMString, LengthOrPercentageOrAuto};
-use std::ascii::StrAsciiExt;
+use std::ascii::AsciiExt;
use std::default::Default;
use std::mem;
use string_cache::{Atom, Namespace, QualName};
@@ -311,7 +311,7 @@ impl RawLayoutElementHelpers for Element {
match length_attribute {
WidthLengthAttribute => {
if !self.is_htmltablecellelement() {
- fail!("I'm not a table cell!")
+ panic!("I'm not a table cell!")
}
let this: &HTMLTableCellElement = mem::transmute(self);
this.get_width()
@@ -326,7 +326,7 @@ impl RawLayoutElementHelpers for Element {
match integer_attribute {
SizeIntegerAttribute => {
if !self.is_htmlinputelement() {
- fail!("I'm not a form input!")
+ panic!("I'm not a form input!")
}
let this: &HTMLInputElement = mem::transmute(self);
Some(this.get_size_for_layout() as i32)
@@ -624,7 +624,7 @@ impl<'a> AttributeHandlers for JSRef<'a, Element> {
Some(attribute) => {
match *attribute.value() {
UIntAttrValue(_, value) => value,
- _ => fail!("Expected a UIntAttrValue"),
+ _ => panic!("Expected a UIntAttrValue"),
}
}
None => 0,
@@ -1131,7 +1131,7 @@ impl<'a> style::TElement<'a> for JSRef<'a, Element> {
let attr = attr.root();
match *attr.value() {
AtomAttrValue(ref val) => val.clone(),
- _ => fail!("`id` attribute should be AtomAttrValue"),
+ _ => panic!("`id` attribute should be AtomAttrValue"),
}
})
}
diff --git a/components/script/dom/eventtarget.rs b/components/script/dom/eventtarget.rs
index 0ced9c9c41e..19ec8c08251 100644
--- a/components/script/dom/eventtarget.rs
+++ b/components/script/dom/eventtarget.rs
@@ -21,10 +21,11 @@ use js::jsapi::{JSContext, JSObject};
use servo_util::fnv::FnvHasher;
use servo_util::str::DOMString;
use libc::{c_char, size_t};
+use std::collections::hash_map::{Occupied, Vacant};
use std::ptr;
use url::Url;
-use std::collections::hashmap::HashMap;
+use std::collections::HashMap;
#[deriving(PartialEq)]
#[jstraceable]
@@ -83,14 +84,14 @@ impl EventTarget {
}
pub fn get_listeners(&self, type_: &str) -> Option<Vec<EventListener>> {
- self.handlers.borrow().find_equiv(&type_).map(|listeners| {
+ self.handlers.borrow().find_equiv(type_).map(|listeners| {
listeners.iter().map(|entry| entry.listener.get_listener()).collect()
})
}
pub fn get_listeners_for(&self, type_: &str, desired_phase: ListenerPhase)
-> Option<Vec<EventListener>> {
- self.handlers.borrow().find_equiv(&type_).map(|listeners| {
+ self.handlers.borrow().find_equiv(type_).map(|listeners| {
let filtered = listeners.iter().filter(|entry| entry.phase == desired_phase);
filtered.map(|entry| entry.listener.get_listener()).collect()
})
@@ -137,7 +138,11 @@ impl<'a> EventTargetHelpers for JSRef<'a, EventTarget> {
ty: DOMString,
listener: Option<EventListener>) {
let mut handlers = self.handlers.borrow_mut();
- let entries = handlers.find_or_insert_with(ty, |_| vec!());
+ let entries = match handlers.entry(ty) {
+ Occupied(entry) => entry.into_mut(),
+ Vacant(entry) => entry.set(vec!()),
+ };
+
let idx = entries.iter().position(|&entry| {
match entry.listener {
Inline(_) => true,
@@ -148,7 +153,7 @@ impl<'a> EventTargetHelpers for JSRef<'a, EventTarget> {
match idx {
Some(idx) => {
match listener {
- Some(listener) => entries.get_mut(idx).listener = Inline(listener),
+ Some(listener) => entries[idx].listener = Inline(listener),
None => {
entries.remove(idx);
}
@@ -167,7 +172,7 @@ impl<'a> EventTargetHelpers for JSRef<'a, EventTarget> {
fn get_inline_event_listener(self, ty: DOMString) -> Option<EventListener> {
let handlers = self.handlers.borrow();
- let entries = handlers.find(&ty);
+ let entries = handlers.get(&ty);
entries.and_then(|entries| entries.iter().find(|entry| {
match entry.listener {
Inline(_) => true,
@@ -187,21 +192,21 @@ impl<'a> EventTargetHelpers for JSRef<'a, EventTarget> {
let lineno = 0; //XXXjdm need to get a real number here
let nargs = 1; //XXXjdm not true for onerror
- static arg_name: [c_char, ..6] =
+ static ARG_NAME: [c_char, ..6] =
['e' as c_char, 'v' as c_char, 'e' as c_char, 'n' as c_char, 't' as c_char, 0];
- static arg_names: [*const c_char, ..1] = [&arg_name as *const c_char];
+ static ARG_NAMES: [*const c_char, ..1] = [&ARG_NAME as *const c_char];
let source: Vec<u16> = source.as_slice().utf16_units().collect();
let handler = unsafe {
- JS_CompileUCFunction(cx,
- ptr::null_mut(),
- name.as_ptr(),
- nargs,
- &arg_names as *const *const i8 as *mut *const i8,
- source.as_ptr(),
- source.len() as size_t,
- url.as_ptr(),
- lineno)
+ JS_CompileUCFunction(cx,
+ ptr::null_mut(),
+ name.as_ptr(),
+ nargs,
+ &ARG_NAMES as *const *const i8 as *mut *const i8,
+ source.as_ptr(),
+ source.len() as size_t,
+ url.as_ptr(),
+ lineno)
};
if handler.is_null() {
report_pending_exception(cx, self.reflector().get_jsobject());
@@ -241,7 +246,11 @@ impl<'a> EventTargetMethods for JSRef<'a, EventTarget> {
match listener {
Some(listener) => {
let mut handlers = self.handlers.borrow_mut();
- let entry = handlers.find_or_insert_with(ty, |_| vec!());
+ let entry = match handlers.entry(ty) {
+ Occupied(entry) => entry.into_mut(),
+ Vacant(entry) => entry.set(vec!()),
+ };
+
let phase = if capture { Capturing } else { Bubbling };
let new_entry = EventListenerEntry {
phase: phase,
@@ -262,7 +271,7 @@ impl<'a> EventTargetMethods for JSRef<'a, EventTarget> {
match listener {
Some(listener) => {
let mut handlers = self.handlers.borrow_mut();
- let mut entry = handlers.find_mut(&ty);
+ let mut entry = handlers.get_mut(&ty);
for entry in entry.iter_mut() {
let phase = if capture { Capturing } else { Bubbling };
let old_entry = EventListenerEntry {
diff --git a/components/script/dom/formdata.rs b/components/script/dom/formdata.rs
index 7642ebab0d4..9a9bac37f55 100644
--- a/components/script/dom/formdata.rs
+++ b/components/script/dom/formdata.rs
@@ -15,7 +15,8 @@ use dom::blob::Blob;
use dom::file::File;
use dom::htmlformelement::HTMLFormElement;
use servo_util::str::DOMString;
-use std::collections::hashmap::HashMap;
+use std::collections::HashMap;
+use std::collections::hash_map::{Occupied, Vacant};
#[deriving(Clone)]
#[jstraceable]
@@ -57,13 +58,21 @@ impl<'a> FormDataMethods for JSRef<'a, FormData> {
#[allow(unrooted_must_root)]
fn Append(self, name: DOMString, value: JSRef<Blob>, filename: Option<DOMString>) {
let file = FileData(JS::from_rooted(self.get_file_from_blob(value, filename)));
- self.data.borrow_mut().insert_or_update_with(name.clone(), vec!(file.clone()),
- |_k, v| {v.push(file.clone());});
+ let mut data = self.data.borrow_mut();
+ match data.entry(name) {
+ Occupied(entry) => entry.into_mut().push(file),
+ Vacant(entry) => {
+ entry.set(vec!(file));
+ }
+ }
}
fn Append_(self, name: DOMString, value: DOMString) {
- self.data.borrow_mut().insert_or_update_with(name, vec!(StringData(value.clone())),
- |_k, v| {v.push(StringData(value.clone()));});
+ let mut data = self.data.borrow_mut();
+ match data.entry(name) {
+ Occupied(entry) => entry.into_mut().push(StringData(value)),
+ Vacant (entry) => { entry.set(vec!(StringData(value))); },
+ }
}
fn Delete(self, name: DOMString) {
diff --git a/components/script/dom/htmlbodyelement.rs b/components/script/dom/htmlbodyelement.rs
index 4be4c473d01..d088a6b8626 100644
--- a/components/script/dom/htmlbodyelement.rs
+++ b/components/script/dom/htmlbodyelement.rs
@@ -72,7 +72,7 @@ impl<'a> VirtualMethods for JSRef<'a, HTMLBodyElement> {
let name = attr.local_name().as_slice();
if name.starts_with("on") {
- static forwarded_events: &'static [&'static str] =
+ static FORWARDED_EVENTS: &'static [&'static str] =
&["onfocus", "onload", "onscroll", "onafterprint", "onbeforeprint",
"onbeforeunload", "onhashchange", "onlanguagechange", "onmessage",
"onoffline", "ononline", "onpagehide", "onpageshow", "onpopstate",
@@ -82,7 +82,7 @@ impl<'a> VirtualMethods for JSRef<'a, HTMLBodyElement> {
window.get_url(),
window.reflector().get_jsobject());
let evtarget: JSRef<EventTarget> =
- if forwarded_events.iter().any(|&event| name == event) {
+ if FORWARDED_EVENTS.iter().any(|&event| name == event) {
EventTargetCast::from_ref(*window)
} else {
EventTargetCast::from_ref(*self)
diff --git a/components/script/dom/htmlbuttonelement.rs b/components/script/dom/htmlbuttonelement.rs
index 8fde03d3918..58019cbc5f5 100644
--- a/components/script/dom/htmlbuttonelement.rs
+++ b/components/script/dom/htmlbuttonelement.rs
@@ -18,7 +18,7 @@ use dom::node::{DisabledStateHelpers, Node, NodeHelpers, ElementNodeTypeId, wind
use dom::validitystate::ValidityState;
use dom::virtualmethods::VirtualMethods;
-use std::ascii::OwnedStrAsciiExt;
+use std::ascii::OwnedAsciiExt;
use servo_util::str::DOMString;
use string_cache::Atom;
diff --git a/components/script/dom/htmlcanvaselement.rs b/components/script/dom/htmlcanvaselement.rs
index e777401852d..5de1ccd5400 100644
--- a/components/script/dom/htmlcanvaselement.rs
+++ b/components/script/dom/htmlcanvaselement.rs
@@ -26,8 +26,8 @@ use geom::size::Size2D;
use std::cell::Cell;
use std::default::Default;
-static DefaultWidth: u32 = 300;
-static DefaultHeight: u32 = 150;
+const DEFAULT_WIDTH: u32 = 300;
+const DEFAULT_HEIGHT: u32 = 150;
#[dom_struct]
pub struct HTMLCanvasElement {
@@ -48,8 +48,8 @@ impl HTMLCanvasElement {
HTMLCanvasElement {
htmlelement: HTMLElement::new_inherited(HTMLCanvasElementTypeId, localName, prefix, document),
context: Default::default(),
- width: Cell::new(DefaultWidth),
- height: Cell::new(DefaultHeight),
+ width: Cell::new(DEFAULT_WIDTH),
+ height: Cell::new(DEFAULT_HEIGHT),
}
}
@@ -108,11 +108,11 @@ impl<'a> VirtualMethods for JSRef<'a, HTMLCanvasElement> {
let recreate = match attr.local_name() {
&atom!("width") => {
- self.width.set(DefaultWidth);
+ self.width.set(DEFAULT_WIDTH);
true
}
&atom!("height") => {
- self.height.set(DefaultHeight);
+ self.height.set(DEFAULT_HEIGHT);
true
}
_ => false,
@@ -136,11 +136,11 @@ impl<'a> VirtualMethods for JSRef<'a, HTMLCanvasElement> {
let value = attr.value();
let recreate = match attr.local_name() {
&atom!("width") => {
- self.width.set(parse_unsigned_integer(value.as_slice().chars()).unwrap_or(DefaultWidth));
+ self.width.set(parse_unsigned_integer(value.as_slice().chars()).unwrap_or(DEFAULT_WIDTH));
true
}
&atom!("height") => {
- self.height.set(parse_unsigned_integer(value.as_slice().chars()).unwrap_or(DefaultHeight));
+ self.height.set(parse_unsigned_integer(value.as_slice().chars()).unwrap_or(DEFAULT_HEIGHT));
true
}
_ => false,
diff --git a/components/script/dom/htmlcollection.rs b/components/script/dom/htmlcollection.rs
index 6b62904c830..48aa8ab7fe5 100644
--- a/components/script/dom/htmlcollection.rs
+++ b/components/script/dom/htmlcollection.rs
@@ -15,11 +15,11 @@ use dom::window::Window;
use servo_util::namespace;
use servo_util::str::{DOMString, split_html_space_chars};
-use std::ascii::StrAsciiExt;
+use std::ascii::AsciiExt;
use string_cache::{Atom, Namespace};
pub trait CollectionFilter : JSTraceable {
- fn filter(&self, elem: JSRef<Element>, root: JSRef<Node>) -> bool;
+ fn filter<'a>(&self, elem: JSRef<'a, Element>, root: JSRef<'a, Node>) -> bool;
}
#[jstraceable]
diff --git a/components/script/dom/htmlfieldsetelement.rs b/components/script/dom/htmlfieldsetelement.rs
index 59d1bd26871..689f9b498dc 100644
--- a/components/script/dom/htmlfieldsetelement.rs
+++ b/components/script/dom/htmlfieldsetelement.rs
@@ -54,11 +54,11 @@ impl<'a> HTMLFieldSetElementMethods for JSRef<'a, HTMLFieldSetElement> {
#[jstraceable]
struct ElementsFilter;
impl CollectionFilter for ElementsFilter {
- fn filter(&self, elem: JSRef<Element>, root: JSRef<Node>) -> bool {
- static tag_names: StaticStringVec = &["button", "fieldset", "input",
+ fn filter<'a>(&self, elem: JSRef<'a, Element>, root: JSRef<'a, Node>) -> bool {
+ static TAG_NAMES: StaticStringVec = &["button", "fieldset", "input",
"keygen", "object", "output", "select", "textarea"];
let root: JSRef<Element> = ElementCast::to_ref(root).unwrap();
- elem != root && tag_names.iter().any(|&tag_name| tag_name == elem.local_name().as_slice())
+ elem != root && TAG_NAMES.iter().any(|&tag_name| tag_name == elem.local_name().as_slice())
}
}
let node: JSRef<Node> = NodeCast::from_ref(self);
diff --git a/components/script/dom/htmlformelement.rs b/components/script/dom/htmlformelement.rs
index f19649427e4..06d5de694c8 100644
--- a/components/script/dom/htmlformelement.rs
+++ b/components/script/dom/htmlformelement.rs
@@ -24,8 +24,7 @@ use http::method::Post;
use servo_msg::constellation_msg::LoadData;
use servo_util::str::DOMString;
use script_task::{ScriptChan, TriggerLoadMsg};
-use std::ascii::OwnedStrAsciiExt;
-use std::str::StrSlice;
+use std::ascii::OwnedAsciiExt;
use url::UrlParser;
use url::form_urlencoded::serialize;
use string_cache::Atom;
@@ -200,26 +199,26 @@ impl<'a> HTMLFormElementHelpers for JSRef<'a, HTMLFormElement> {
for ch in s.chars() {
match ch {
'\n' if prev != '\r' => {
- buf.push_char('\r');
- buf.push_char('\n');
+ buf.push('\r');
+ buf.push('\n');
},
'\n' => {
- buf.push_char('\n');
+ buf.push('\n');
},
// This character isn't LF but is
// preceded by CR
_ if prev == '\r' => {
- buf.push_char('\r');
- buf.push_char('\n');
- buf.push_char(ch);
+ buf.push('\r');
+ buf.push('\n');
+ buf.push(ch);
},
- _ => buf.push_char(ch)
+ _ => buf.push(ch)
};
prev = ch;
}
// In case the last character was CR
if prev == '\r' {
- buf.push_char('\n');
+ buf.push('\n');
}
buf
}
diff --git a/components/script/dom/htmliframeelement.rs b/components/script/dom/htmliframeelement.rs
index 3312925e2ff..e9e1fae2e27 100644
--- a/components/script/dom/htmliframeelement.rs
+++ b/components/script/dom/htmliframeelement.rs
@@ -25,7 +25,7 @@ use servo_msg::constellation_msg::{IFrameSandboxed, IFrameUnsandboxed};
use servo_msg::constellation_msg::{ConstellationChan, ScriptLoadedURLInIFrameMsg};
use servo_util::str::DOMString;
-use std::ascii::StrAsciiExt;
+use std::ascii::AsciiExt;
use std::cell::Cell;
use url::{Url, UrlParser};
diff --git a/components/script/dom/htmlinputelement.rs b/components/script/dom/htmlinputelement.rs
index b47e3c91098..f12e75db38d 100644
--- a/components/script/dom/htmlinputelement.rs
+++ b/components/script/dom/htmlinputelement.rs
@@ -27,14 +27,15 @@ use dom::virtualmethods::VirtualMethods;
use servo_util::str::DOMString;
use string_cache::Atom;
-use std::ascii::OwnedStrAsciiExt;
+use std::ascii::OwnedAsciiExt;
use std::cell::Cell;
-static DEFAULT_SUBMIT_VALUE: &'static str = "Submit";
-static DEFAULT_RESET_VALUE: &'static str = "Reset";
+const DEFAULT_SUBMIT_VALUE: &'static str = "Submit";
+const DEFAULT_RESET_VALUE: &'static str = "Reset";
#[jstraceable]
#[deriving(PartialEq)]
+#[allow(dead_code)]
enum InputType {
InputButton(Option<&'static str>),
InputText,
@@ -284,7 +285,7 @@ impl<'a> VirtualMethods for JSRef<'a, HTMLInputElement> {
&atom!("size") => {
match *attr.value() {
UIntAttrValue(_, value) => self.size.set(value),
- _ => fail!("Expected a UIntAttrValue"),
+ _ => panic!("Expected a UIntAttrValue"),
}
self.force_relayout();
}
diff --git a/components/script/dom/htmllinkelement.rs b/components/script/dom/htmllinkelement.rs
index 03c2533d5a2..503a2cd14fd 100644
--- a/components/script/dom/htmllinkelement.rs
+++ b/components/script/dom/htmllinkelement.rs
@@ -18,7 +18,7 @@ use dom::virtualmethods::VirtualMethods;
use layout_interface::{LayoutChan, LoadStylesheetMsg};
use servo_util::str::{DOMString, HTML_SPACE_CHARACTERS};
-use std::ascii::StrAsciiExt;
+use std::ascii::AsciiExt;
use url::UrlParser;
use string_cache::Atom;
@@ -121,7 +121,7 @@ impl<'a> PrivateHTMLLinkElementHelpers for JSRef<'a, HTMLLinkElement> {
let LayoutChan(ref layout_chan) = window.page().layout_chan;
layout_chan.send(LoadStylesheetMsg(url));
}
- Err(e) => debug!("Parsing url {:s} failed: {:?}", href, e)
+ Err(e) => debug!("Parsing url {:s} failed: {}", href, e)
}
}
}
diff --git a/components/script/dom/htmlobjectelement.rs b/components/script/dom/htmlobjectelement.rs
index 18fad7a0fcc..009c67ea42e 100644
--- a/components/script/dom/htmlobjectelement.rs
+++ b/components/script/dom/htmlobjectelement.rs
@@ -78,8 +78,8 @@ impl<'a> ProcessDataURL for JSRef<'a, HTMLObjectElement> {
}
pub fn is_image_data(uri: &str) -> bool {
- static types: &'static [&'static str] = &["data:image/png", "data:image/gif", "data:image/jpeg"];
- types.iter().any(|&type_| uri.starts_with(type_))
+ static TYPES: &'static [&'static str] = &["data:image/png", "data:image/gif", "data:image/jpeg"];
+ TYPES.iter().any(|&type_| uri.starts_with(type_))
}
impl<'a> HTMLObjectElementMethods for JSRef<'a, HTMLObjectElement> {
diff --git a/components/script/dom/htmlserializer.rs b/components/script/dom/htmlserializer.rs
index e9de8987ac0..38a56feb23e 100644
--- a/components/script/dom/htmlserializer.rs
+++ b/components/script/dom/htmlserializer.rs
@@ -55,7 +55,7 @@ pub fn serialize(iterator: &mut NodeIterator) -> String {
}
DocumentFragmentNodeTypeId => {}
DocumentNodeTypeId => {
- fail!("It shouldn't be possible to serialize a document node")
+ panic!("It shouldn't be possible to serialize a document node")
}
}
}
@@ -94,7 +94,7 @@ fn serialize_processing_instruction(processing_instruction: JSRef<ProcessingInst
html: &mut String) {
html.push_str("<?");
html.push_str(processing_instruction.target().as_slice());
- html.push_char(' ');
+ html.push(' ');
html.push_str(processing_instruction.characterdata().data().as_slice());
html.push_str("?>");
}
@@ -102,17 +102,17 @@ fn serialize_processing_instruction(processing_instruction: JSRef<ProcessingInst
fn serialize_doctype(doctype: JSRef<DocumentType>, html: &mut String) {
html.push_str("<!DOCTYPE");
html.push_str(doctype.name().as_slice());
- html.push_char('>');
+ html.push('>');
}
fn serialize_elem(elem: JSRef<Element>, open_elements: &mut Vec<String>, html: &mut String) {
- html.push_char('<');
+ html.push('<');
html.push_str(elem.local_name().as_slice());
for attr in elem.attrs().iter() {
let attr = attr.root();
serialize_attr(*attr, html);
};
- html.push_char('>');
+ html.push('>');
match elem.local_name().as_slice() {
"pre" | "listing" | "textarea" if *elem.namespace() == ns!(HTML) => {
@@ -121,7 +121,7 @@ fn serialize_elem(elem: JSRef<Element>, open_elements: &mut Vec<String>, html: &
Some(ref child) if child.is_text() => {
let text: JSRef<CharacterData> = CharacterDataCast::to_ref(**child).unwrap();
if text.data().len() > 0 && text.data().as_slice().char_at(0) == '\n' {
- html.push_char('\x0A');
+ html.push('\x0A');
}
},
_ => {}
@@ -136,7 +136,7 @@ fn serialize_elem(elem: JSRef<Element>, open_elements: &mut Vec<String>, html: &
}
fn serialize_attr(attr: JSRef<Attr>, html: &mut String) {
- html.push_char(' ');
+ html.push(' ');
if *attr.namespace() == ns!(XML) {
html.push_str("xml:");
html.push_str(attr.local_name().as_slice());
@@ -154,18 +154,18 @@ fn serialize_attr(attr: JSRef<Attr>, html: &mut String) {
};
html.push_str("=\"");
escape(attr.value().as_slice(), true, html);
- html.push_char('"');
+ html.push('"');
}
fn escape(string: &str, attr_mode: bool, html: &mut String) {
for c in string.chars() {
match c {
'&' => html.push_str("&amp;"),
- '\xA0' => html.push_str("&nbsp;"),
+ '\u00A0' => html.push_str("&nbsp;"),
'"' if attr_mode => html.push_str("&quot;"),
'<' if !attr_mode => html.push_str("&lt;"),
'>' if !attr_mode => html.push_str("&gt;"),
- c => html.push_char(c),
+ c => html.push(c),
}
}
}
diff --git a/components/script/dom/macros.rs b/components/script/dom/macros.rs
index 540da5efb5f..630a112c032 100644
--- a/components/script/dom/macros.rs
+++ b/components/script/dom/macros.rs
@@ -9,7 +9,7 @@ macro_rules! make_getter(
use dom::element::{Element, AttributeHandlers};
use dom::bindings::codegen::InheritTypes::ElementCast;
#[allow(unused_imports)]
- use std::ascii::StrAsciiExt;
+ use std::ascii::AsciiExt;
let element: JSRef<Element> = ElementCast::from_ref(self);
element.get_string_attribute(&Atom::from_slice($htmlname.to_ascii_lower().as_slice()))
}
@@ -26,7 +26,7 @@ macro_rules! make_bool_getter(
use dom::element::{Element, AttributeHandlers};
use dom::bindings::codegen::InheritTypes::ElementCast;
#[allow(unused_imports)]
- use std::ascii::StrAsciiExt;
+ use std::ascii::AsciiExt;
let element: JSRef<Element> = ElementCast::from_ref(self);
// FIXME(pcwalton): Do this at compile time, not runtime.
element.has_attribute(&Atom::from_slice($htmlname))
@@ -44,7 +44,7 @@ macro_rules! make_uint_getter(
use dom::element::{Element, AttributeHandlers};
use dom::bindings::codegen::InheritTypes::ElementCast;
#[allow(unused_imports)]
- use std::ascii::StrAsciiExt;
+ use std::ascii::AsciiExt;
let element: JSRef<Element> = ElementCast::from_ref(self);
// FIXME(pcwalton): Do this at compile time, not runtime.
element.get_uint_attribute(&Atom::from_slice($htmlname))
@@ -62,7 +62,7 @@ macro_rules! make_url_getter(
use dom::element::{Element, AttributeHandlers};
use dom::bindings::codegen::InheritTypes::ElementCast;
#[allow(unused_imports)]
- use std::ascii::StrAsciiExt;
+ use std::ascii::AsciiExt;
let element: JSRef<Element> = ElementCast::from_ref(self);
// FIXME(pcwalton): Do this at compile time, not runtime.
element.get_url_attribute(&Atom::from_slice($htmlname))
@@ -81,7 +81,7 @@ macro_rules! make_url_or_base_getter(
use dom::element::{Element, AttributeHandlers};
use dom::bindings::codegen::InheritTypes::ElementCast;
#[allow(unused_imports)]
- use std::ascii::StrAsciiExt;
+ use std::ascii::AsciiExt;
let element: JSRef<Element> = ElementCast::from_ref(self);
let url = element.get_url_attribute(&Atom::from_slice($htmlname));
match url.as_slice() {
@@ -105,7 +105,7 @@ macro_rules! make_enumerated_getter(
use dom::element::{Element, AttributeHandlers};
use dom::bindings::codegen::InheritTypes::ElementCast;
#[allow(unused_imports)]
- use std::ascii::StrAsciiExt;
+ use std::ascii::AsciiExt;
let element: JSRef<Element> = ElementCast::from_ref(self);
let val = element.get_string_attribute(&Atom::from_slice($htmlname))
.into_ascii_lower();
diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs
index c1b3ffc7980..4c7d24f8f4f 100644
--- a/components/script/dom/node.rs
+++ b/components/script/dom/node.rs
@@ -126,31 +126,31 @@ bitflags! {
#[jstraceable]
flags NodeFlags: u8 {
#[doc = "Specifies whether this node is in a document."]
- static IsInDoc = 0x01,
+ const IS_IN_DOC = 0x01,
#[doc = "Specifies whether this node is in hover state."]
- static InHoverState = 0x02,
+ const IN_HOVER_STATE = 0x02,
#[doc = "Specifies whether this node is in disabled state."]
- static InDisabledState = 0x04,
+ const IN_DISABLED_STATE = 0x04,
#[doc = "Specifies whether this node is in enabled state."]
- static InEnabledState = 0x08,
+ const IN_ENABLED_STATE = 0x08,
#[doc = "Specifies whether this node _must_ be reflowed regardless of style differences."]
- static HasChanged = 0x10,
+ const HAS_CHANGED = 0x10,
#[doc = "Specifies whether this node needs style recalc on next reflow."]
- static IsDirty = 0x20,
+ const IS_DIRTY = 0x20,
#[doc = "Specifies whether this node has siblings (inclusive of itself) which \
changed since the last reflow."]
- static HasDirtySiblings = 0x40,
+ const HAS_DIRTY_SIBLINGS = 0x40,
#[doc = "Specifies whether this node has descendants (inclusive of itself) which \
have changed since the last reflow."]
- static HasDirtyDescendants = 0x80,
+ const HAS_DIRTY_DESCENDANTS = 0x80,
}
}
impl NodeFlags {
pub fn new(type_id: NodeTypeId) -> NodeFlags {
- let dirty = HasChanged | IsDirty | HasDirtySiblings | HasDirtyDescendants;
+ let dirty = HAS_CHANGED | IS_DIRTY | HAS_DIRTY_SIBLINGS | HAS_DIRTY_DESCENDANTS;
match type_id {
- DocumentNodeTypeId => IsInDoc | dirty,
+ DocumentNodeTypeId => IS_IN_DOC | dirty,
// The following elements are enabled by default.
ElementNodeTypeId(HTMLButtonElementTypeId) |
ElementNodeTypeId(HTMLInputElementTypeId) |
@@ -159,7 +159,7 @@ impl NodeFlags {
ElementNodeTypeId(HTMLOptGroupElementTypeId) |
ElementNodeTypeId(HTMLOptionElementTypeId) |
//ElementNodeTypeId(HTMLMenuItemElementTypeId) |
- ElementNodeTypeId(HTMLFieldSetElementTypeId) => InEnabledState | dirty,
+ ElementNodeTypeId(HTMLFieldSetElementTypeId) => IN_ENABLED_STATE | dirty,
_ => dirty,
}
}
@@ -384,7 +384,7 @@ pub trait NodeHelpers<'a> {
fn child_elements(self) -> ChildElementIterator<'a>;
fn following_siblings(self) -> NodeChildrenIterator<'a>;
fn is_in_doc(self) -> bool;
- fn is_inclusive_ancestor_of(self, parent: JSRef<Node>) -> bool;
+ fn is_inclusive_ancestor_of(self, parent: JSRef<'a, Node>) -> bool; // FIXME: See #3960
fn is_parent_of(self, child: JSRef<Node>) -> bool;
fn type_id(self) -> NodeTypeId;
@@ -431,9 +431,9 @@ pub trait NodeHelpers<'a> {
fn get_has_dirty_descendants(self) -> bool;
fn set_has_dirty_descendants(self, state: bool);
- /// Marks the given node as `IsDirty`, its siblings as `IsDirty` (to deal
- /// with sibling selectors), its ancestors as `HasDirtyDescendants`, and its
- /// descendants as `IsDirty`.
+ /// Marks the given node as `IS_DIRTY`, its siblings as `IS_DIRTY` (to deal
+ /// with sibling selectors), its ancestors as `HAS_DIRTY_DESCENDANTS`, and its
+ /// descendants as `IS_DIRTY`.
fn dirty(self);
fn dump(self);
@@ -482,11 +482,11 @@ impl<'a> NodeHelpers<'a> for JSRef<'a, Node> {
/// Returns a string that describes this node.
fn debug_str(self) -> String {
- format!("{:?}", self.type_id)
+ format!("{}", self.type_id)
}
fn is_in_doc(self) -> bool {
- self.deref().flags.get().contains(IsInDoc)
+ self.deref().flags.get().contains(IS_IN_DOC)
}
/// Returns the type ID of this node. Fails if this node is borrowed mutably.
@@ -561,59 +561,59 @@ impl<'a> NodeHelpers<'a> for JSRef<'a, Node> {
}
fn get_hover_state(self) -> bool {
- self.get_flag(InHoverState)
+ self.get_flag(IN_HOVER_STATE)
}
fn set_hover_state(self, state: bool) {
- self.set_flag(InHoverState, state)
+ self.set_flag(IN_HOVER_STATE, state)
}
fn get_disabled_state(self) -> bool {
- self.get_flag(InDisabledState)
+ self.get_flag(IN_DISABLED_STATE)
}
fn set_disabled_state(self, state: bool) {
- self.set_flag(InDisabledState, state)
+ self.set_flag(IN_DISABLED_STATE, state)
}
fn get_enabled_state(self) -> bool {
- self.get_flag(InEnabledState)
+ self.get_flag(IN_ENABLED_STATE)
}
fn set_enabled_state(self, state: bool) {
- self.set_flag(InEnabledState, state)
+ self.set_flag(IN_ENABLED_STATE, state)
}
fn get_has_changed(self) -> bool {
- self.get_flag(HasChanged)
+ self.get_flag(HAS_CHANGED)
}
fn set_has_changed(self, state: bool) {
- self.set_flag(HasChanged, state)
+ self.set_flag(HAS_CHANGED, state)
}
fn get_is_dirty(self) -> bool {
- self.get_flag(IsDirty)
+ self.get_flag(IS_DIRTY)
}
fn set_is_dirty(self, state: bool) {
- self.set_flag(IsDirty, state)
+ self.set_flag(IS_DIRTY, state)
}
fn get_has_dirty_siblings(self) -> bool {
- self.get_flag(HasDirtySiblings)
+ self.get_flag(HAS_DIRTY_SIBLINGS)
}
fn set_has_dirty_siblings(self, state: bool) {
- self.set_flag(HasDirtySiblings, state)
+ self.set_flag(HAS_DIRTY_SIBLINGS, state)
}
fn get_has_dirty_descendants(self) -> bool {
- self.get_flag(HasDirtyDescendants)
+ self.get_flag(HAS_DIRTY_DESCENDANTS)
}
fn set_has_dirty_descendants(self, state: bool) {
- self.set_flag(HasDirtyDescendants, state)
+ self.set_flag(HAS_DIRTY_DESCENDANTS, state)
}
fn dirty(self) {
@@ -629,7 +629,7 @@ impl<'a> NodeHelpers<'a> for JSRef<'a, Node> {
// Stop if this subtree is already dirty.
if node.get_is_dirty() { return }
- node.set_flag(IsDirty | HasDirtySiblings | HasDirtyDescendants, true);
+ node.set_flag(IS_DIRTY | HAS_DIRTY_SIBLINGS | HAS_DIRTY_DESCENDANTS, true);
for kid in node.children() {
dirty_subtree(kid);
@@ -670,7 +670,7 @@ impl<'a> NodeHelpers<'a> for JSRef<'a, Node> {
}
}
- fn is_inclusive_ancestor_of(self, parent: JSRef<Node>) -> bool {
+ fn is_inclusive_ancestor_of(self, parent: JSRef<'a, Node>) -> bool {
self == parent || parent.ancestors().any(|ancestor| ancestor == self)
}
@@ -840,7 +840,7 @@ pub fn from_untrusted_node_address(runtime: *mut JSRuntime, candidate: Untrusted
let object: *mut JSObject = jsfriendapi::bindgen::JS_GetAddressableObject(runtime,
candidate);
if object.is_null() {
- fail!("Attempted to create a `JS<Node>` from an invalid pointer!")
+ panic!("Attempted to create a `JS<Node>` from an invalid pointer!")
}
let boxed_node: *const Node = utils::unwrap(object);
Temporary::new(JS::from_raw(boxed_node))
@@ -934,15 +934,15 @@ pub trait RawLayoutNodeHelpers {
impl RawLayoutNodeHelpers for Node {
#[inline]
unsafe fn get_hover_state_for_layout(&self) -> bool {
- self.flags.get().contains(InHoverState)
+ self.flags.get().contains(IN_HOVER_STATE)
}
#[inline]
unsafe fn get_disabled_state_for_layout(&self) -> bool {
- self.flags.get().contains(InDisabledState)
+ self.flags.get().contains(IN_DISABLED_STATE)
}
#[inline]
unsafe fn get_enabled_state_for_layout(&self) -> bool {
- self.flags.get().contains(InEnabledState)
+ self.flags.get().contains(IN_ENABLED_STATE)
}
#[inline]
fn type_id_for_layout(&self) -> NodeTypeId {
@@ -1311,7 +1311,7 @@ impl Node {
// Step 7-8.
let referenceChild = match child {
- Some(child) if child == node => node.next_sibling().map(|node| (*node.root()).clone()),
+ Some(child) if child.clone() == node => node.next_sibling().map(|node| (*node.root()).clone()),
_ => child
};
@@ -1337,9 +1337,9 @@ impl Node {
for kid in node.traverse_preorder() {
let mut flags = kid.flags.get();
if is_in_doc {
- flags.insert(IsInDoc);
+ flags.insert(IS_IN_DOC);
} else {
- flags.remove(IsInDoc);
+ flags.remove(IS_IN_DOC);
}
kid.flags.set(flags);
}
@@ -1460,7 +1460,7 @@ impl Node {
// Step 8.
parent.remove_child(node);
- node.set_flag(IsInDoc, false);
+ node.set_flag(IS_IN_DOC, false);
// Step 9.
match suppress_observers {
@@ -1903,7 +1903,7 @@ impl<'a> NodeMethods for JSRef<'a, Node> {
}
// Ok if not caught by previous error checks.
- if node == child {
+ if node.clone() == child {
return Ok(Temporary::from_rooted(child));
}
@@ -2059,7 +2059,7 @@ impl<'a> NodeMethods for JSRef<'a, Node> {
// http://dom.spec.whatwg.org/#dom-node-comparedocumentposition
fn CompareDocumentPosition(self, other: JSRef<Node>) -> u16 {
- if self == other {
+ if self.clone() == other { // FIXME: See issue #3960
// step 2.
0
} else {
diff --git a/components/script/dom/servohtmlparser.rs b/components/script/dom/servohtmlparser.rs
index b16b02cfdcc..5dbd3c9b9ea 100644
--- a/components/script/dom/servohtmlparser.rs
+++ b/components/script/dom/servohtmlparser.rs
@@ -109,7 +109,7 @@ impl JSTraceable for ServoHTMLParser {
unsafe {
// Assertion: If the parser is mutably borrowed, we're in the
// parsing code paths.
- debug_assert!(task_state::get().contains(task_state::InHTMLParser)
+ debug_assert!(task_state::get().contains(task_state::IN_HTML_PARSER)
|| !self.tokenizer.is_mutably_borrowed());
let tokenizer = self.tokenizer.borrow_for_gc_trace();
diff --git a/components/script/dom/treewalker.rs b/components/script/dom/treewalker.rs
index 78d708a4c4b..01e3a7d4351 100644
--- a/components/script/dom/treewalker.rs
+++ b/components/script/dom/treewalker.rs
@@ -78,7 +78,7 @@ impl<'a> TreeWalkerMethods for JSRef<'a, TreeWalker> {
match self.filter {
FilterNone => None,
FilterJS(nf) => Some(nf),
- FilterNative(_) => fail!("Cannot convert native node filter to DOM NodeFilter")
+ FilterNative(_) => panic!("Cannot convert native node filter to DOM NodeFilter")
}
}
@@ -559,20 +559,20 @@ pub enum Filter {
// FIXME: NodeFilterConstants will be defined in NodeFilterBindings.rs
// when codegen supports a callback interface with constants (#3149).
pub mod NodeFilterConstants {
- pub static FILTER_ACCEPT: u16 = 1;
- pub static FILTER_REJECT: u16 = 2;
- pub static FILTER_SKIP: u16 = 3;
- pub static SHOW_ALL: u32 = 4294967295;
- pub static SHOW_ELEMENT: u32 = 1;
- pub static SHOW_ATTRIBUTE: u32 = 2;
- pub static SHOW_TEXT: u32 = 4;
- pub static SHOW_CDATA_SECTION: u32 = 8;
- pub static SHOW_ENTITY_REFERENCE: u32 = 16;
- pub static SHOW_ENTITY: u32 = 32;
- pub static SHOW_PROCESSING_INSTRUCTION: u32 = 64;
- pub static SHOW_COMMENT: u32 = 128;
- pub static SHOW_DOCUMENT: u32 = 256;
- pub static SHOW_DOCUMENT_TYPE: u32 = 512;
- pub static SHOW_DOCUMENT_FRAGMENT: u32 = 1024;
- pub static SHOW_NOTATION: u32 = 2048;
+ pub const FILTER_ACCEPT: u16 = 1;
+ pub const FILTER_REJECT: u16 = 2;
+ pub const FILTER_SKIP: u16 = 3;
+ pub const SHOW_ALL: u32 = 4294967295;
+ pub const SHOW_ELEMENT: u32 = 1;
+ pub const SHOW_ATTRIBUTE: u32 = 2;
+ pub const SHOW_TEXT: u32 = 4;
+ pub const SHOW_CDATA_SECTION: u32 = 8;
+ pub const SHOW_ENTITY_REFERENCE: u32 = 16;
+ pub const SHOW_ENTITY: u32 = 32;
+ pub const SHOW_PROCESSING_INSTRUCTION: u32 = 64;
+ pub const SHOW_COMMENT: u32 = 128;
+ pub const SHOW_DOCUMENT: u32 = 256;
+ pub const SHOW_DOCUMENT_TYPE: u32 = 512;
+ pub const SHOW_DOCUMENT_FRAGMENT: u32 = 1024;
+ pub const SHOW_NOTATION: u32 = 2048;
} // mod NodeFilterConstants
diff --git a/components/script/dom/urlsearchparams.rs b/components/script/dom/urlsearchparams.rs
index bd885dbf4b9..f199b47a568 100644
--- a/components/script/dom/urlsearchparams.rs
+++ b/components/script/dom/urlsearchparams.rs
@@ -16,9 +16,10 @@ use servo_util::str::DOMString;
use encoding::all::UTF_8;
use encoding::types::{EncodingRef, EncodeReplace};
-use std::collections::hashmap::HashMap;
+use std::collections::HashMap;
+use std::collections::hash_map::{Occupied, Vacant};
use std::fmt::radix;
-use std::ascii::OwnedStrAsciiExt;
+use std::ascii::OwnedAsciiExt;
#[dom_struct]
pub struct URLSearchParams {
@@ -60,8 +61,15 @@ impl URLSearchParams {
impl<'a> URLSearchParamsMethods for JSRef<'a, URLSearchParams> {
fn Append(self, name: DOMString, value: DOMString) {
- self.data.borrow_mut().insert_or_update_with(name, vec!(value.clone()),
- |_k, v| v.push(value.clone()));
+ let mut data = self.data.borrow_mut();
+
+ match data.entry(name) {
+ Occupied(entry) => entry.into_mut().push(value),
+ Vacant(entry) => {
+ entry.set(vec!(value));
+ }
+ }
+
self.update_steps();
}
@@ -109,8 +117,8 @@ impl URLSearchParamsHelpers for URLSearchParams {
let append = match *i {
0x20 => vec!(0x2B),
0x2A | 0x2D | 0x2E |
- 0x30 .. 0x39 | 0x41 .. 0x5A |
- 0x5F | 0x61..0x7A => vec!(*i),
+ 0x30 ... 0x39 | 0x41 ... 0x5A |
+ 0x5F | 0x61...0x7A => vec!(*i),
a => {
// http://url.spec.whatwg.org/#percent-encode
let mut encoded = vec!(0x25); // %
diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs
index 90c18f5dca5..b4318b69fa3 100644
--- a/components/script/dom/window.rs
+++ b/components/script/dom/window.rs
@@ -367,7 +367,7 @@ impl<'a> WindowHelpers for JSRef<'a, Window> {
/// Commence a new URL load which will either replace this window or scroll to a fragment.
fn load_url(self, href: DOMString) {
let base_url = self.page().get_url();
- debug!("current page url is {:?}", base_url);
+ debug!("current page url is {}", base_url);
let url = UrlParser::new().base_url(&base_url).parse(href.as_slice());
// FIXME: handle URL parse errors more gracefully.
let url = url.unwrap();
diff --git a/components/script/dom/xmlhttprequest.rs b/components/script/dom/xmlhttprequest.rs
index da3c069c1f4..c40a11c5593 100644
--- a/components/script/dom/xmlhttprequest.rs
+++ b/components/script/dom/xmlhttprequest.rs
@@ -50,13 +50,12 @@ use script_task::{ScriptChan, XHRProgressMsg, XHRReleaseMsg};
use servo_util::str::DOMString;
use servo_util::task::spawn_named;
-use std::ascii::StrAsciiExt;
+use std::ascii::AsciiExt;
use std::cell::Cell;
use std::comm::{Sender, Receiver, channel};
use std::default::Default;
use std::io::{BufReader, MemWriter, Timer};
use std::from_str::FromStr;
-use std::path::BytesContainer;
use std::time::duration::Duration;
use std::num::Zero;
use time;
@@ -454,7 +453,7 @@ impl<'a> XMLHttpRequestMethods for JSRef<'a, XMLHttpRequest> {
let mut buf = h.header_value();
buf.as_mut_vec().push_all(&[0x2C, 0x20]);
buf.as_mut_vec().push_all(value.as_slice());
- value = ByteString::new(buf.container_into_owned_bytes());
+ value = ByteString::new(buf.into_bytes());
}
},
@@ -875,7 +874,7 @@ impl<'a> PrivateXMLHttpRequestHelpers for JSRef<'a, XMLHttpRequest> {
// Part of step 13, send() (processing response)
// XXXManishearth handle errors, if any (substep 1)
// Substep 2
- *self.status_text.borrow_mut() = ByteString::new(status.reason().container_into_owned_bytes());
+ *self.status_text.borrow_mut() = ByteString::new(status.reason().into_bytes());
self.status.set(status.code());
match headers {
Some(ref h) => {
diff --git a/components/script/layout_interface.rs b/components/script/layout_interface.rs
index 95b422e18eb..c3afb15c057 100644
--- a/components/script/layout_interface.rs
+++ b/components/script/layout_interface.rs
@@ -15,7 +15,7 @@ use servo_msg::constellation_msg::WindowSizeData;
use servo_util::geometry::Au;
use std::any::{Any, AnyRefExt};
use std::comm::{channel, Receiver, Sender};
-use std::owned::BoxAny;
+use std::boxed::BoxAny;
use style::Stylesheet;
use url::Url;
diff --git a/components/script/lib.rs b/components/script/lib.rs
index 64fd584c757..1d64397e20e 100644
--- a/components/script/lib.rs
+++ b/components/script/lib.rs
@@ -7,7 +7,8 @@
#![feature(default_type_params, globs, macro_rules, struct_variant, phase, unsafe_destructor)]
-#![deny(unused_imports, unused_variable)]
+#![deny(unused_imports)]
+#![deny(unused_variables)]
#![allow(non_snake_case)]
#![doc="The script crate contains all matters DOM."]
@@ -15,7 +16,6 @@
#[phase(plugin, link)]
extern crate log;
-extern crate debug;
extern crate devtools_traits;
extern crate cssparser;
extern crate collections;
diff --git a/components/script/page.rs b/components/script/page.rs
index b150804b5d3..23e0f0152dd 100644
--- a/components/script/page.rs
+++ b/components/script/page.rs
@@ -357,13 +357,13 @@ impl Page {
}
Ok(_) => {}
Err(Disconnected) => {
- fail!("Layout task failed while script was waiting for a result.");
+ panic!("Layout task failed while script was waiting for a result.");
}
}
debug!("script: layout joined")
}
- None => fail!("reader forked but no join port?"),
+ None => panic!("reader forked but no join port?"),
}
}
}
@@ -393,7 +393,7 @@ impl Page {
debug!("avoided {:d} reflows", self.avoided_reflows.get());
self.avoided_reflows.set(0);
- debug!("script: performing reflow for goal {:?}", goal);
+ debug!("script: performing reflow for goal {}", goal);
// Now, join the layout so that they will see the latest changes we have made.
self.join_layout();
diff --git a/components/script/parse/html.rs b/components/script/parse/html.rs
index d2ab13fbd3e..d647df64d13 100644
--- a/components/script/parse/html.rs
+++ b/components/script/parse/html.rs
@@ -25,8 +25,8 @@ use encoding::types::{Encoding, DecodeReplace};
use servo_net::resource_task::{Load, LoadData, Payload, Done, ResourceTask};
use servo_msg::constellation_msg::LoadData as MsgLoadData;
use servo_util::task_state;
-use servo_util::task_state::InHTMLParser;
-use std::ascii::StrAsciiExt;
+use servo_util::task_state::IN_HTML_PARSER;
+use std::ascii::AsciiExt;
use std::comm::channel;
use std::str::MaybeOwned;
use url::Url;
@@ -48,19 +48,19 @@ fn parse_last_modified(timestamp: &str) -> String {
// RFC 822, updated by RFC 1123
match time::strptime(timestamp, "%a, %d %b %Y %T %Z") {
- Ok(t) => return t.to_local().strftime(format),
+ Ok(t) => return t.to_local().strftime(format).unwrap(),
Err(_) => ()
}
// RFC 850, obsoleted by RFC 1036
match time::strptime(timestamp, "%A, %d-%b-%y %T %Z") {
- Ok(t) => return t.to_local().strftime(format),
+ Ok(t) => return t.to_local().strftime(format).unwrap(),
Err(_) => ()
}
// ANSI C's asctime() format
match time::strptime(timestamp, "%c") {
- Ok(t) => t.to_local().strftime(format),
+ Ok(t) => t.to_local().strftime(format).unwrap(),
Err(_) => String::from_str("")
}
}
@@ -210,8 +210,6 @@ pub fn parse_html(page: &Page,
let load_response = input_port.recv();
- debug!("Fetched page; metadata is {:?}", load_response.metadata);
-
load_response.metadata.headers.as_ref().map(|headers| {
let header = headers.iter().find(|h|
h.header_name().as_slice().to_ascii_lower() == "last-modified".to_string()
@@ -246,7 +244,7 @@ pub fn parse_html(page: &Page,
let parser = ServoHTMLParser::new(base_url.clone(), document).root();
let parser: JSRef<ServoHTMLParser> = *parser;
- task_state::enter(InHTMLParser);
+ task_state::enter(IN_HTML_PARSER);
match input {
InputString(s) => {
@@ -268,7 +266,7 @@ pub fn parse_html(page: &Page,
parser.parse_chunk(data);
}
Done(Err(err)) => {
- fail!("Failed to load page URL {:s}, error: {:s}", url.serialize(), err);
+ panic!("Failed to load page URL {:s}, error: {:s}", url.serialize(), err);
}
Done(Ok(())) => break,
}
@@ -280,7 +278,7 @@ pub fn parse_html(page: &Page,
parser.finish();
- task_state::exit(InHTMLParser);
+ task_state::exit(IN_HTML_PARSER);
debug!("finished parsing");
}
diff --git a/components/script/script_task.rs b/components/script/script_task.rs
index 5630a9763b9..61431f16af5 100644
--- a/components/script/script_task.rs
+++ b/components/script/script_task.rs
@@ -209,7 +209,7 @@ impl<'a> Drop for ScriptMemoryFailsafe<'a> {
fn drop(&mut self) {
match self.owner {
Some(owner) => {
- let mut page = owner.page.borrow_mut();
+ let page = owner.page.borrow_mut();
for page in page.iter() {
*page.mut_js_info() = None;
}
@@ -264,7 +264,7 @@ impl ScriptTaskFactory for ScriptTask {
let ConstellationChan(const_chan) = constellation_chan.clone();
let (script_chan, script_port) = channel();
let layout_chan = LayoutChan(layout_chan.sender());
- spawn_named_with_send_on_failure("ScriptTask", task_state::Script, proc() {
+ spawn_named_with_send_on_failure("ScriptTask", task_state::SCRIPT, proc() {
let script_task = ScriptTask::new(id,
box compositor as Box<ScriptListener>,
layout_chan,
@@ -286,12 +286,10 @@ impl ScriptTaskFactory for ScriptTask {
}
}
-unsafe extern "C" fn debug_gc_callback(rt: *mut JSRuntime, status: JSGCStatus) {
- js::rust::gc_callback(rt, status);
-
+unsafe extern "C" fn debug_gc_callback(_rt: *mut JSRuntime, status: JSGCStatus) {
match status {
- JSGC_BEGIN => task_state::enter(task_state::InGC),
- JSGC_END => task_state::exit(task_state::InGC),
+ JSGC_BEGIN => task_state::enter(task_state::IN_GC),
+ JSGC_END => task_state::exit(task_state::IN_GC),
_ => (),
}
}
@@ -419,7 +417,7 @@ impl ScriptTask {
let mut resizes = vec!();
{
- let mut page = self.page.borrow_mut();
+ let page = self.page.borrow_mut();
for page in page.iter() {
// Only process a resize if layout is idle.
let layout_join_port = page.layout_join_port.borrow();
@@ -468,7 +466,7 @@ impl ScriptTask {
} else if ret == port3.id() {
FromDevtools(self.devtools_port.recv())
} else {
- fail!("unexpected select result")
+ panic!("unexpected select result")
}
};
@@ -484,12 +482,12 @@ impl ScriptTask {
self.handle_new_layout(new_layout_info);
}
FromConstellation(ResizeMsg(id, size)) => {
- let mut page = self.page.borrow_mut();
+ let page = self.page.borrow_mut();
let page = page.find(id).expect("resize sent to nonexistent pipeline");
page.resize_event.set(Some(size));
}
FromConstellation(SendEventMsg(id, ReflowEvent(node_addresses))) => {
- let mut page = self.page.borrow_mut();
+ let page = self.page.borrow_mut();
let inner_page = page.find(id).expect("Reflow sent to nonexistent pipeline");
let mut pending = inner_page.pending_dirty_nodes.borrow_mut();
pending.push_all_move(node_addresses);
@@ -526,23 +524,23 @@ impl ScriptTask {
for msg in sequential.into_iter() {
match msg {
// TODO(tkuehn) need to handle auxiliary layouts for iframes
- FromConstellation(AttachLayoutMsg(_)) => fail!("should have handled AttachLayoutMsg already"),
+ FromConstellation(AttachLayoutMsg(_)) => panic!("should have handled AttachLayoutMsg already"),
FromConstellation(LoadMsg(id, load_data)) => self.load(id, load_data),
FromScript(TriggerLoadMsg(id, load_data)) => self.trigger_load(id, load_data),
FromScript(TriggerFragmentMsg(id, url)) => self.trigger_fragment(id, url),
FromConstellation(SendEventMsg(id, event)) => self.handle_event(id, event),
FromScript(FireTimerMsg(FromWindow(id), timer_id)) => self.handle_fire_timer_msg(id, timer_id),
- FromScript(FireTimerMsg(FromWorker, _)) => fail!("Worker timeouts must not be sent to script task"),
+ FromScript(FireTimerMsg(FromWorker, _)) => panic!("Worker timeouts must not be sent to script task"),
FromScript(NavigateMsg(direction)) => self.handle_navigate_msg(direction),
FromConstellation(ReflowCompleteMsg(id, reflow_id)) => self.handle_reflow_complete_msg(id, reflow_id),
FromConstellation(ResizeInactiveMsg(id, new_size)) => self.handle_resize_inactive_msg(id, new_size),
FromConstellation(ExitPipelineMsg(id)) => if self.handle_exit_pipeline_msg(id) { return false },
FromConstellation(ViewportMsg(..)) => fail!("should have handled ViewportMsg already"),
FromScript(ExitWindowMsg(id)) => self.handle_exit_window_msg(id),
- FromConstellation(ResizeMsg(..)) => fail!("should have handled ResizeMsg already"),
+ FromConstellation(ResizeMsg(..)) => panic!("should have handled ResizeMsg already"),
FromScript(XHRProgressMsg(addr, progress)) => XMLHttpRequest::handle_progress(addr, progress),
FromScript(XHRReleaseMsg(addr)) => XMLHttpRequest::handle_release(addr),
- FromScript(DOMMessage(..)) => fail!("unexpected message"),
+ FromScript(DOMMessage(..)) => panic!("unexpected message"),
FromScript(WorkerPostMessage(addr, data, nbytes)) => Worker::handle_message(addr, data, nbytes),
FromScript(WorkerRelease(addr)) => Worker::handle_release(addr),
FromDevtools(EvaluateJS(id, s, reply)) => self.handle_evaluate_js(id, s, reply),
@@ -580,7 +578,7 @@ impl ScriptTask {
} else {
//FIXME: jsvals don't have an is_int32/is_number yet
assert!(rval.is_object_or_null());
- fail!("object values unimplemented")
+ panic!("object values unimplemented")
});
}
@@ -615,7 +613,7 @@ impl ScriptTask {
}
}
- fail!("couldn't find node with unique id {:s}", node_id)
+ panic!("couldn't find node with unique id {:s}", node_id)
}
fn handle_get_children(&self, pipeline: PipelineId, node_id: String, reply: Sender<Vec<NodeInfo>>) {
@@ -632,7 +630,6 @@ impl ScriptTask {
}
fn handle_new_layout(&self, new_layout_info: NewLayoutInfo) {
- debug!("Script: new layout: {:?}", new_layout_info);
let NewLayoutInfo {
old_pipeline_id,
new_pipeline_id,
@@ -640,7 +637,7 @@ impl ScriptTask {
layout_chan
} = new_layout_info;
- let mut page = self.page.borrow_mut();
+ let page = self.page.borrow_mut();
let parent_page = page.find(old_pipeline_id).expect("ScriptTask: received a layout
whose parent has a PipelineId which does not correspond to a pipeline in the script
task's page tree. This is a bug.");
@@ -658,7 +655,7 @@ impl ScriptTask {
/// Handles a timer that fired.
fn handle_fire_timer_msg(&self, id: PipelineId, timer_id: TimerId) {
- let mut page = self.page.borrow_mut();
+ let page = self.page.borrow_mut();
let page = page.find(id).expect("ScriptTask: received fire timer msg for a
pipeline ID not associated with this script task. This is a bug.");
let frame = page.frame();
@@ -668,8 +665,8 @@ impl ScriptTask {
/// Handles a notification that reflow completed.
fn handle_reflow_complete_msg(&self, pipeline_id: PipelineId, reflow_id: uint) {
- debug!("Script: Reflow {:?} complete for {:?}", reflow_id, pipeline_id);
- let mut page = self.page.borrow_mut();
+ debug!("Script: Reflow {} complete for {}", reflow_id, pipeline_id);
+ let page = self.page.borrow_mut();
let page = page.find(pipeline_id).expect(
"ScriptTask: received a load message for a layout channel that is not associated \
with this script task. This is a bug.");
@@ -696,7 +693,7 @@ impl ScriptTask {
/// Window was resized, but this script was not active, so don't reflow yet
fn handle_resize_inactive_msg(&self, id: PipelineId, new_size: WindowSizeData) {
- let mut page = self.page.borrow_mut();
+ let page = self.page.borrow_mut();
let page = page.find(id).expect("Received resize message for PipelineId not associated
with a page in the page tree. This is a bug.");
page.window_size.set(new_size);
@@ -724,9 +721,9 @@ impl ScriptTask {
/// Returns true if the script task should shut down and false otherwise.
fn handle_exit_pipeline_msg(&self, id: PipelineId) -> bool {
// If root is being exited, shut down all pages
- let mut page = self.page.borrow_mut();
+ let page = self.page.borrow_mut();
if page.id == id {
- debug!("shutting down layout for root page {:?}", id);
+ debug!("shutting down layout for root page {}", id);
*self.js_context.borrow_mut() = None;
shut_down_layout(&*page, (*self.js_runtime).ptr);
return true
@@ -750,9 +747,9 @@ impl ScriptTask {
/// objects, parses HTML and CSS, and kicks off initial layout.
fn load(&self, pipeline_id: PipelineId, load_data: LoadData) {
let url = load_data.url.clone();
- debug!("ScriptTask: loading {} on page {:?}", url, pipeline_id);
+ debug!("ScriptTask: loading {} on page {}", url, pipeline_id);
- let mut page = self.page.borrow_mut();
+ let page = self.page.borrow_mut();
let page = page.find(pipeline_id).expect("ScriptTask: received a load
message for a layout channel that is not associated with this script task. This
is a bug.");
@@ -934,8 +931,6 @@ impl ScriptTask {
fn handle_resize_event(&self, pipeline_id: PipelineId, new_size: WindowSizeData) {
- debug!("script got resize event: {:?}", new_size);
-
let window = {
let page = get_page(&*self.page.borrow(), pipeline_id);
page.window_size.set(new_size);
@@ -992,11 +987,11 @@ impl ScriptTask {
}
fn handle_click_event(&self, pipeline_id: PipelineId, _button: uint, point: Point2D<f32>) {
- debug!("ClickEvent: clicked at {:?}", point);
+ debug!("ClickEvent: clicked at {}", point);
let page = get_page(&*self.page.borrow(), pipeline_id);
match page.hit_test(&point) {
Some(node_address) => {
- debug!("node address is {:?}", node_address);
+ debug!("node address is {}", node_address);
let temp_node =
node::from_untrusted_node_address(
@@ -1144,4 +1139,3 @@ fn get_page(page: &Rc<Page>, pipeline_id: PipelineId) -> Rc<Page> {
message for a layout channel that is not associated with this script task.\
This is a bug.")
}
-
diff --git a/components/script/timers.rs b/components/script/timers.rs
index ba9141aebd1..57480eb1cde 100644
--- a/components/script/timers.rs
+++ b/components/script/timers.rs
@@ -16,7 +16,7 @@ use js::rust::with_compartment;
use std::cell::Cell;
use std::cmp;
-use std::collections::hashmap::HashMap;
+use std::collections::HashMap;
use std::comm::{channel, Sender};
use std::comm::Select;
use std::hash::{Hash, sip};
@@ -149,7 +149,7 @@ impl TimerManager {
}
pub fn clear_timeout_or_interval(&self, handle: i32) {
- let mut timer_handle = self.active_timers.borrow_mut().pop(&TimerId(handle));
+ let mut timer_handle = self.active_timers.borrow_mut().remove(&TimerId(handle));
match timer_handle {
Some(ref mut handle) => handle.cancel(),
None => { }
@@ -158,7 +158,7 @@ impl TimerManager {
pub fn fire_timer(&self, timer_id: TimerId, this: *mut JSObject, cx: *mut JSContext) {
- let data = match self.active_timers.borrow().find(&timer_id) {
+ let data = match self.active_timers.borrow().get(&timer_id) {
None => return,
Some(timer_handle) => timer_handle.data,
};
diff --git a/components/script_traits/lib.rs b/components/script_traits/lib.rs
index 51365f0515f..beedd0895d3 100644
--- a/components/script_traits/lib.rs
+++ b/components/script_traits/lib.rs
@@ -5,7 +5,8 @@
#![comment = "The Servo Parallel Browser Project"]
#![license = "MPL"]
-#![deny(unused_imports, unused_variable)]
+#![deny(unused_imports)]
+#![deny(unused_variables)]
extern crate devtools_traits;
extern crate geom;
diff --git a/components/style/errors.rs b/components/style/errors.rs
index f04f4969293..ae0df3797e9 100644
--- a/components/style/errors.rs
+++ b/components/style/errors.rs
@@ -15,7 +15,7 @@ impl<T, I: Iterator<Result<T, SyntaxError>>> Iterator<T> for ErrorLoggerIterator
match this.next() {
Some(Ok(v)) => return Some(v),
Some(Err(error)) => log_css_error(error.location,
- format!("{:?}", error.reason).as_slice()),
+ format!("{}", error.reason).as_slice()),
None => return None,
}
}
diff --git a/components/style/font_face.rs b/components/style/font_face.rs
index b2d20f52675..ca9110d0603 100644
--- a/components/style/font_face.rs
+++ b/components/style/font_face.rs
@@ -5,7 +5,7 @@
use cssparser::ast::*;
use cssparser::parse_declaration_list;
use errors::{ErrorLoggerIterator, log_css_error};
-use std::ascii::StrAsciiExt;
+use std::ascii::AsciiExt;
use parsing_utils::{BufferedIter, ParserIter, parse_slice_comma_separated};
use properties::longhands::font_family::parse_one_family;
use properties::computed_values::font_family::FamilyName;
diff --git a/components/style/lib.rs b/components/style/lib.rs
index c2af6b6d064..aa9bc551dd3 100644
--- a/components/style/lib.rs
+++ b/components/style/lib.rs
@@ -7,16 +7,15 @@
#![feature(globs, macro_rules)]
-#![deny(unused_imports, unused_variable)]
+#![deny(unused_imports)]
+#![deny(unused_variables)]
#![feature(phase)]
#[phase(plugin, link)] extern crate log;
#[phase(plugin)] extern crate string_cache_macros;
-extern crate debug;
extern crate collections;
extern crate geom;
-extern crate num;
extern crate serialize;
extern crate sync;
extern crate url;
diff --git a/components/style/media_queries.rs b/components/style/media_queries.rs
index 749d7c3d019..6eea2cd3ee9 100644
--- a/components/style/media_queries.rs
+++ b/components/style/media_queries.rs
@@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-use std::ascii::StrAsciiExt;
+use std::ascii::AsciiExt;
use cssparser::parse_rule_list;
use cssparser::ast::*;
@@ -28,7 +28,7 @@ pub struct MediaQueryList {
pub enum Range<T> {
Min(T),
Max(T),
- Eq(T),
+ //Eq(T), // FIXME: Implement parsing support for equality then re-enable this.
}
impl<T: Ord> Range<T> {
@@ -36,7 +36,7 @@ impl<T: Ord> Range<T> {
match *self {
Min(ref width) => { value >= *width },
Max(ref width) => { value <= *width },
- Eq(ref width) => { value == *width },
+ //Eq(ref width) => { value == *width },
}
}
}
@@ -479,7 +479,7 @@ mod tests {
assert!(q.expressions.len() == 1, css.to_string());
match q.expressions[0] {
Width(Min(w)) => assert!(w == Au::from_px(100)),
- _ => fail!("wrong expression type"),
+ _ => panic!("wrong expression type"),
}
});
@@ -491,7 +491,7 @@ mod tests {
assert!(q.expressions.len() == 1, css.to_string());
match q.expressions[0] {
Width(Max(w)) => assert!(w == Au::from_px(43)),
- _ => fail!("wrong expression type"),
+ _ => panic!("wrong expression type"),
}
});
}
@@ -506,7 +506,7 @@ mod tests {
assert!(q.expressions.len() == 1, css.to_string());
match q.expressions[0] {
Width(Min(w)) => assert!(w == Au::from_px(100)),
- _ => fail!("wrong expression type"),
+ _ => panic!("wrong expression type"),
}
});
@@ -518,7 +518,7 @@ mod tests {
assert!(q.expressions.len() == 1, css.to_string());
match q.expressions[0] {
Width(Max(w)) => assert!(w == Au::from_px(43)),
- _ => fail!("wrong expression type"),
+ _ => panic!("wrong expression type"),
}
});
@@ -530,7 +530,7 @@ mod tests {
assert!(q.expressions.len() == 1, css.to_string());
match q.expressions[0] {
Width(Max(w)) => assert!(w == Au::from_px(52)),
- _ => fail!("wrong expression type"),
+ _ => panic!("wrong expression type"),
}
});
}
@@ -545,11 +545,11 @@ mod tests {
assert!(q.expressions.len() == 2, css.to_string());
match q.expressions[0] {
Width(Min(w)) => assert!(w == Au::from_px(100)),
- _ => fail!("wrong expression type"),
+ _ => panic!("wrong expression type"),
}
match q.expressions[1] {
Width(Max(w)) => assert!(w == Au::from_px(200)),
- _ => fail!("wrong expression type"),
+ _ => panic!("wrong expression type"),
}
});
@@ -561,11 +561,11 @@ mod tests {
assert!(q.expressions.len() == 2, css.to_string());
match q.expressions[0] {
Width(Min(w)) => assert!(w == Au::from_px(100)),
- _ => fail!("wrong expression type"),
+ _ => panic!("wrong expression type"),
}
match q.expressions[1] {
Width(Max(w)) => assert!(w == Au::from_px(200)),
- _ => fail!("wrong expression type"),
+ _ => panic!("wrong expression type"),
}
});
}
diff --git a/components/style/namespaces.rs b/components/style/namespaces.rs
index f1b3c7260a6..cfcd3d8615e 100644
--- a/components/style/namespaces.rs
+++ b/components/style/namespaces.rs
@@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use cssparser::ast::*;
-use std::collections::hashmap::HashMap;
+use std::collections::HashMap;
use servo_util::namespace;
use errors::log_css_error;
use string_cache::Namespace;
@@ -50,7 +50,7 @@ pub fn parse_namespace_rule(rule: AtRule, namespaces: &mut NamespaceMap) {
if iter.next().is_some() { syntax_error!() }
match (prefix, ns) {
(Some(prefix), Some(ns)) => {
- if namespaces.prefix_map.swap(prefix, ns).is_some() {
+ if namespaces.prefix_map.insert(prefix, ns).is_some() {
log_css_error(location, "Duplicate @namespace rule");
}
},
diff --git a/components/style/parsing_utils.rs b/components/style/parsing_utils.rs
index c2f6cc04850..204c01a62a9 100644
--- a/components/style/parsing_utils.rs
+++ b/components/style/parsing_utils.rs
@@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-use std::ascii::StrAsciiExt;
+use std::ascii::AsciiExt;
use cssparser::ast::{ComponentValue, Ident, Comma, SkipWhitespaceIterable, SkipWhitespaceIterator};
diff --git a/components/style/properties/common_types.rs b/components/style/properties/common_types.rs
index fd531611692..d527e024929 100644
--- a/components/style/properties/common_types.rs
+++ b/components/style/properties/common_types.rs
@@ -13,7 +13,7 @@ pub type CSSFloat = f64;
pub static DEFAULT_LINE_HEIGHT: CSSFloat = 1.14;
pub mod specified {
- use std::ascii::StrAsciiExt;
+ use std::ascii::AsciiExt;
use std::f64::consts::PI;
use url::Url;
use cssparser::ast;
@@ -42,12 +42,12 @@ pub mod specified {
// Vmin(CSSFloat),
// Vmax(CSSFloat),
}
- static AU_PER_PX: CSSFloat = 60.;
- static AU_PER_IN: CSSFloat = AU_PER_PX * 96.;
- static AU_PER_CM: CSSFloat = AU_PER_IN / 2.54;
- static AU_PER_MM: CSSFloat = AU_PER_IN / 25.4;
- static AU_PER_PT: CSSFloat = AU_PER_IN / 72.;
- static AU_PER_PC: CSSFloat = AU_PER_PT * 12.;
+ const AU_PER_PX: CSSFloat = 60.;
+ const AU_PER_IN: CSSFloat = AU_PER_PX * 96.;
+ const AU_PER_CM: CSSFloat = AU_PER_IN / 2.54;
+ const AU_PER_MM: CSSFloat = AU_PER_IN / 25.4;
+ const AU_PER_PT: CSSFloat = AU_PER_IN / 72.;
+ const AU_PER_PC: CSSFloat = AU_PER_PT * 12.;
impl Length {
#[inline]
fn parse_internal(input: &ComponentValue, negative_ok: bool) -> Result<Length, ()> {
diff --git a/components/style/properties/mod.rs.mako b/components/style/properties/mod.rs.mako
index b7892a9e28e..2511f093e32 100644
--- a/components/style/properties/mod.rs.mako
+++ b/components/style/properties/mod.rs.mako
@@ -4,7 +4,7 @@
// This file is a Mako template: http://www.makotemplates.org/
-pub use std::ascii::StrAsciiExt;
+pub use std::ascii::AsciiExt;
use servo_util::logical_geometry::{WritingMode, LogicalMargin};
use sync::Arc;
@@ -160,7 +160,7 @@ pub mod longhands {
${caller.body()}
pub mod computed_value {
#[allow(non_camel_case_types)]
- #[deriving(PartialEq, Clone, FromPrimitive)]
+ #[deriving(PartialEq, Clone, FromPrimitive, Show)]
pub enum T {
% for value in values.split():
${to_rust_ident(value)},
@@ -942,7 +942,7 @@ pub mod longhands {
use super::super::Au;
pub type T = Au;
}
- static MEDIUM_PX: int = 16;
+ const MEDIUM_PX: int = 16;
#[inline] pub fn get_initial_value() -> computed_value::T {
Au::from_px(MEDIUM_PX)
}
@@ -999,7 +999,8 @@ pub mod longhands {
}
pub mod computed_value {
pub type T = super::SpecifiedValue;
- pub static none: T = super::SpecifiedValue { underline: false, overline: false, line_through: false };
+ #[allow(non_upper_case_globals)]
+ pub const none: T = super::SpecifiedValue { underline: false, overline: false, line_through: false };
}
#[inline] pub fn get_initial_value() -> computed_value::T {
none
@@ -1845,27 +1846,27 @@ fn get_writing_mode(inheritedbox_style: &style_structs::InheritedBox) -> Writing
match inheritedbox_style.direction {
computed_values::direction::ltr => {},
computed_values::direction::rtl => {
- flags.insert(logical_geometry::FlagRTL);
+ flags.insert(logical_geometry::FLAG_RTL);
},
}
match inheritedbox_style.writing_mode {
computed_values::writing_mode::horizontal_tb => {},
computed_values::writing_mode::vertical_rl => {
- flags.insert(logical_geometry::FlagVertical);
+ flags.insert(logical_geometry::FLAG_VERTICAL);
},
computed_values::writing_mode::vertical_lr => {
- flags.insert(logical_geometry::FlagVertical);
- flags.insert(logical_geometry::FlagVerticalLR);
+ flags.insert(logical_geometry::FLAG_VERTICAL);
+ flags.insert(logical_geometry::FLAG_VERTICAL_LR);
},
}
match inheritedbox_style.text_orientation {
computed_values::text_orientation::sideways_right => {},
computed_values::text_orientation::sideways_left => {
- flags.insert(logical_geometry::FlagSidewaysLeft);
+ flags.insert(logical_geometry::FLAG_VERTICAL_LR);
},
computed_values::text_orientation::sideways => {
- if flags.intersects(logical_geometry::FlagVerticalLR) {
- flags.insert(logical_geometry::FlagSidewaysLeft);
+ if flags.intersects(logical_geometry::FLAG_VERTICAL_LR) {
+ flags.insert(logical_geometry::FLAG_SIDEWAYS_LEFT);
}
},
}
diff --git a/components/style/selector_matching.rs b/components/style/selector_matching.rs
index 50a3e7c5221..3ccb21bfeed 100644
--- a/components/style/selector_matching.rs
+++ b/components/style/selector_matching.rs
@@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use std::ascii::AsciiExt;
-use std::collections::hashmap::HashMap;
+use std::collections::HashMap;
use std::hash::Hash;
use std::num::div_rem;
use sync::Arc;
@@ -155,7 +155,7 @@ impl SelectorMap {
where E: TElement<'a> + TElementAttributes,
N: TNode<'a,E>,
V: VecLike<DeclarationBlock> {
- match hash.find(key) {
+ match hash.get(key) {
Some(rules) => {
SelectorMap::get_matching_rules(node,
parent_bf,
@@ -813,11 +813,11 @@ fn matches_compound_selector_internal<'a,E,N>(selector: &CompoundSelector,
bitflags! {
flags CommonStyleAffectingAttributes: u8 {
- static HiddenAttribute = 0x01,
- static NoWrapAttribute = 0x02,
- static AlignLeftAttribute = 0x04,
- static AlignCenterAttribute = 0x08,
- static AlignRightAttribute = 0x10,
+ const HIDDEN_ATTRIBUTE = 0x01,
+ const NO_WRAP_ATTRIBUTE = 0x02,
+ const ALIGN_LEFT_ATTRIBUTE = 0x04,
+ const ALIGN_CENTER_ATTRIBUTE = 0x08,
+ const ALIGN_RIGHT_ATTRIBUTE = 0x10,
}
}
@@ -837,23 +837,23 @@ pub fn common_style_affecting_attributes() -> [CommonStyleAffectingAttributeInfo
[
CommonStyleAffectingAttributeInfo {
atom: atom!("hidden"),
- mode: AttrIsPresentMode(HiddenAttribute),
+ mode: AttrIsPresentMode(HIDDEN_ATTRIBUTE),
},
CommonStyleAffectingAttributeInfo {
atom: atom!("nowrap"),
- mode: AttrIsPresentMode(NoWrapAttribute),
+ mode: AttrIsPresentMode(NO_WRAP_ATTRIBUTE),
},
CommonStyleAffectingAttributeInfo {
atom: atom!("align"),
- mode: AttrIsEqualMode("left", AlignLeftAttribute),
+ mode: AttrIsEqualMode("left", ALIGN_LEFT_ATTRIBUTE),
},
CommonStyleAffectingAttributeInfo {
atom: atom!("align"),
- mode: AttrIsEqualMode("center", AlignCenterAttribute),
+ mode: AttrIsEqualMode("center", ALIGN_CENTER_ATTRIBUTE),
},
CommonStyleAffectingAttributeInfo {
atom: atom!("align"),
- mode: AttrIsEqualMode("right", AlignRightAttribute),
+ mode: AttrIsEqualMode("right", ALIGN_RIGHT_ATTRIBUTE),
}
]
}
@@ -1176,7 +1176,7 @@ trait FindPush<K, V> {
impl<K: Eq + Hash, V> FindPush<K, V> for HashMap<K, Vec<V>> {
fn find_push(&mut self, key: K, value: V) {
- match self.find_mut(&key) {
+ match self.get_mut(&key) {
Some(vec) => {
vec.push(value);
return
@@ -1266,4 +1266,3 @@ mod tests {
assert!(selector_map.class_hash.find(&Atom::from_slice("foo")).is_none());
}
}
-
diff --git a/components/style/selectors.rs b/components/style/selectors.rs
index 8cd5508326a..4a6f5f6cb32 100644
--- a/components/style/selectors.rs
+++ b/components/style/selectors.rs
@@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use std::{cmp, iter};
-use std::ascii::{StrAsciiExt, OwnedStrAsciiExt};
+use std::ascii::{AsciiExt, OwnedAsciiExt};
use sync::Arc;
use cssparser::ast::*;
@@ -14,14 +14,6 @@ use string_cache::{Atom, Namespace};
use namespaces::NamespaceMap;
-// Only used in tests
-impl PartialEq for Arc<CompoundSelector> {
- fn eq(&self, other: &Arc<CompoundSelector>) -> bool {
- **self == **other
- }
-}
-
-
#[deriving(PartialEq, Clone)]
pub struct Selector {
pub compound_selectors: Arc<CompoundSelector>,
@@ -328,7 +320,7 @@ fn parse_one_simple_selector<I: Iterator<ComponentValue>>(
Some(&IDHash(_)) => match iter.next() {
Some(IDHash(id)) => Ok(Some(SimpleSelectorResult(
IDSelector(Atom::from_slice(id.as_slice()))))),
- _ => fail!("Implementation error, this should not happen."),
+ _ => panic!("Implementation error, this should not happen."),
},
Some(&Delim('.')) => {
iter.next();
@@ -341,7 +333,7 @@ fn parse_one_simple_selector<I: Iterator<ComponentValue>>(
Some(&SquareBracketBlock(_)) => match iter.next() {
Some(SquareBracketBlock(content))
=> Ok(Some(SimpleSelectorResult(try!(parse_attribute_selector(content, namespaces))))),
- _ => fail!("Implementation error, this should not happen."),
+ _ => panic!("Implementation error, this should not happen."),
},
Some(&Colon) => {
iter.next();
@@ -413,7 +405,7 @@ fn parse_qualified_name<I: Iterator<ComponentValue>>(
let value = get_next_ident(iter);
match iter.peek() {
Some(&Delim('|')) => {
- let namespace = match namespaces.prefix_map.find(&value) {
+ let namespace = match namespaces.prefix_map.get(&value) {
None => return Err(()), // Undeclared namespace prefix
Some(ref ns) => (*ns).clone(),
};
@@ -445,7 +437,7 @@ fn parse_attribute_selector(content: Vec<ComponentValue>, namespaces: &Namespace
let iter = &mut content.into_iter().peekable();
let attr = match try!(parse_qualified_name(iter, /* in_attr_selector = */ true, namespaces)) {
None => return Err(()),
- Some((_, None)) => fail!("Implementation error, this should not happen."),
+ Some((_, None)) => panic!("Implementation error, this should not happen."),
Some((namespace, Some(local_name))) => AttrSelector {
namespace: namespace,
lower_name: Atom::from_slice(local_name.as_slice().to_ascii_lower().as_slice()),
@@ -578,7 +570,7 @@ fn parse_negation(arguments: Vec<ComponentValue>, namespaces: &NamespaceMap)
fn get_next_ident<I: Iterator<ComponentValue>>(iter: &mut Iter<I>) -> String {
match iter.next() {
Some(Ident(value)) => value,
- _ => fail!("Implementation error, this should not happen."),
+ _ => panic!("Implementation error, this should not happen."),
}
}
diff --git a/components/style/stylesheets.rs b/components/style/stylesheets.rs
index a30c5762a1a..a1ae75520af 100644
--- a/components/style/stylesheets.rs
+++ b/components/style/stylesheets.rs
@@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use std::iter::Iterator;
-use std::ascii::StrAsciiExt;
+use std::ascii::AsciiExt;
use url::Url;
use encoding::EncodingRef;
@@ -131,7 +131,7 @@ impl Stylesheet {
pub fn parse_style_rule(rule: QualifiedRule, parent_rules: &mut Vec<CSSRule>,
namespaces: &NamespaceMap, base_url: &Url) {
- let QualifiedRule{location: location, prelude: prelude, block: block} = rule;
+ let QualifiedRule { location, prelude, block} = rule;
// FIXME: avoid doing this for valid selectors
let serialized = prelude.iter().to_css();
match selectors::parse_selector_list(prelude.into_iter(), namespaces) {
diff --git a/components/util/bloom.rs b/components/util/bloom.rs
index 6795cb889e8..fe56ac2c762 100644
--- a/components/util/bloom.rs
+++ b/components/util/bloom.rs
@@ -6,10 +6,10 @@
use string_cache::{Atom, Namespace};
-static KEY_SIZE: uint = 12;
-static ARRAY_SIZE: uint = 1 << KEY_SIZE;
-static KEY_MASK: u32 = (1 << KEY_SIZE) - 1;
-static KEY_SHIFT: uint = 16;
+const KEY_SIZE: uint = 12;
+const ARRAY_SIZE: uint = 1 << KEY_SIZE;
+const KEY_MASK: u32 = (1 << KEY_SIZE) - 1;
+const KEY_SHIFT: uint = 16;
/// A counting Bloom filter with 8-bit counters. For now we assume
/// that having two hash functions is enough, but we may revisit that
@@ -334,4 +334,3 @@ mod bench {
})
}
}
-
diff --git a/components/util/cache.rs b/components/util/cache.rs
index 19f861a1d3c..2797bc4e6d6 100644
--- a/components/util/cache.rs
+++ b/components/util/cache.rs
@@ -2,7 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-use std::collections::hashmap::HashMap;
+use std::collections::HashMap;
+use std::collections::hash_map::{Occupied, Vacant};
use rand::Rng;
use std::hash::{Hash, sip};
use std::rand::task_rng;
@@ -36,14 +37,21 @@ impl<K: Clone + PartialEq + Eq + Hash, V: Clone> Cache<K,V> for HashCache<K,V> {
}
fn find(&mut self, key: &K) -> Option<V> {
- match self.entries.find(key) {
+ match self.entries.get(key) {
Some(v) => Some(v.clone()),
None => None,
}
}
fn find_or_create(&mut self, key: &K, blk: |&K| -> V) -> V {
- self.entries.find_or_insert_with(key.clone(), blk).clone()
+ match self.entries.entry(key.clone()) {
+ Occupied(occupied) => {
+ (*occupied.get()).clone()
+ }
+ Vacant(vacant) => {
+ (*vacant.set(blk(key))).clone()
+ }
+ }
}
fn evict_all(&mut self) {
@@ -53,7 +61,7 @@ impl<K: Clone + PartialEq + Eq + Hash, V: Clone> Cache<K,V> for HashCache<K,V> {
}
impl<K,V> HashCache<K,V> where K: Clone + PartialEq + Eq + Hash, V: Clone {
- pub fn find_equiv<'a,Q>(&'a self, key: &Q) -> Option<&'a V> where Q: Hash + Equiv<K> {
+ pub fn find_equiv<'a,Sized? Q>(&'a self, key: &Q) -> Option<&'a V> where Q: Hash + Equiv<K> {
self.entries.find_equiv(key)
}
}
@@ -171,7 +179,7 @@ impl<K:Clone+PartialEq+Hash,V:Clone> SimpleHashCache<K,V> {
impl<K:Clone+PartialEq+Hash,V:Clone> Cache<K,V> for SimpleHashCache<K,V> {
fn insert(&mut self, key: K, value: V) {
let bucket_index = self.bucket_for_key(&key);
- *self.entries.get_mut(bucket_index) = Some((key, value));
+ self.entries[bucket_index] = Some((key, value));
}
fn find(&mut self, key: &K) -> Option<V> {
diff --git a/components/util/dlist.rs b/components/util/dlist.rs
index 2abae04b047..52836786de3 100644
--- a/components/util/dlist.rs
+++ b/components/util/dlist.rs
@@ -24,7 +24,7 @@ struct RawNode<T> {
#[unsafe_destructor]
impl<T> Drop for RawDList<T> {
fn drop(&mut self) {
- fail!("shouldn't happen")
+ panic!("shouldn't happen")
}
}
@@ -36,7 +36,7 @@ pub fn split<T>(list: &mut DList<T>) -> DList<T> {
};
if list.length == 0 {
- fail!("split_dlist(): empty list")
+ panic!("split_dlist(): empty list")
}
let head_node = mem::replace(&mut list.head, ptr::null_mut());
let head_list = RawDList {
@@ -96,4 +96,3 @@ pub fn append_from<T>(this: &mut DList<T>, other: &mut DList<T>) {
other.length = 0;
}
}
-
diff --git a/components/util/fnv.rs b/components/util/fnv.rs
index a14f3ea2bec..13c8e1c28ad 100644
--- a/components/util/fnv.rs
+++ b/components/util/fnv.rs
@@ -19,7 +19,7 @@ pub struct FnvHasher;
pub struct FnvState(u64);
impl Hasher<FnvState> for FnvHasher {
- fn hash<T: Hash<FnvState>>(&self, t: &T) -> u64 {
+ fn hash<Sized? T: Hash<FnvState>>(&self, t: &T) -> u64 {
let mut state = FnvState(0xcbf29ce484222325);
t.hash(&mut state);
let FnvState(ret) = state;
diff --git a/components/util/geometry.rs b/components/util/geometry.rs
index 64d779d1f67..8dd6d633da7 100644
--- a/components/util/geometry.rs
+++ b/components/util/geometry.rs
@@ -28,6 +28,7 @@ use std::fmt;
///
/// The ratio between ScreenPx and DevicePixel for a given display be found by calling
/// `servo::windowing::WindowMethods::hidpi_factor`.
+#[deriving(Show)]
pub enum ScreenPx {}
/// One CSS "px" in the coordinate system of the "initial viewport":
@@ -39,7 +40,7 @@ pub enum ScreenPx {}
///
/// At the default zoom level of 100%, one PagePx is equal to one ScreenPx. However, if the
/// document is zoomed in or out then this scale may be larger or smaller.
-#[deriving(Encodable)]
+#[deriving(Encodable, Show)]
pub enum ViewportPx {}
/// One CSS "px" in the root coordinate system for the content document.
@@ -48,7 +49,7 @@ pub enum ViewportPx {}
/// This is the mobile-style "pinch zoom" that enlarges content without reflowing it. When the
/// viewport zoom is not equal to 1.0, then the layout viewport is no longer the same physical size
/// as the viewable area.
-#[deriving(Encodable)]
+#[deriving(Encodable, Show)]
pub enum PagePx {}
// In summary, the hierarchy of pixel units and the factors to convert from one to the next:
@@ -95,8 +96,8 @@ pub static MAX_RECT: Rect<Au> = Rect {
}
};
-pub static MIN_AU: Au = Au(i32::MIN);
-pub static MAX_AU: Au = Au(i32::MAX);
+pub const MIN_AU: Au = Au(i32::MIN);
+pub const MAX_AU: Au = Au(i32::MAX);
impl<E, S: Encoder<E>> Encodable<S, E> for Au {
fn encode(&self, e: &mut S) -> Result<(), E> {
@@ -319,4 +320,3 @@ pub fn f32_rect_to_au_rect(rect: Rect<f32>) -> Rect<Au> {
Rect(Point2D(Au::from_frac32_px(rect.origin.x), Au::from_frac32_px(rect.origin.y)),
Size2D(Au::from_frac32_px(rect.size.width), Au::from_frac32_px(rect.size.height)))
}
-
diff --git a/components/util/lib.rs b/components/util/lib.rs
index 3f4146eedfe..f556dda6eb9 100644
--- a/components/util/lib.rs
+++ b/components/util/lib.rs
@@ -4,13 +4,13 @@
#![feature(default_type_params,macro_rules,unsafe_destructor)]
-#![deny(unused_imports, unused_variable)]
+#![deny(unused_imports)]
+#![deny(unused_variables)]
#![feature(phase)]
#[phase(plugin, link)]
extern crate log;
-extern crate debug;
extern crate alloc;
extern crate collections;
extern crate geom;
diff --git a/components/util/logical_geometry.rs b/components/util/logical_geometry.rs
index 2faa6400e1a..fd30c6c07cb 100644
--- a/components/util/logical_geometry.rs
+++ b/components/util/logical_geometry.rs
@@ -12,39 +12,39 @@ use std::num::Zero;
bitflags!(
#[deriving(Encodable)]
flags WritingMode: u8 {
- static FlagRTL = 1 << 0,
- static FlagVertical = 1 << 1,
- static FlagVerticalLR = 1 << 2,
- static FlagSidewaysLeft = 1 << 3
+ const FLAG_RTL = 1 << 0,
+ const FLAG_VERTICAL = 1 << 1,
+ const FLAG_VERTICAL_LR = 1 << 2,
+ const FLAG_SIDEWAYS_LEFT = 1 << 3
}
)
impl WritingMode {
#[inline]
pub fn is_vertical(&self) -> bool {
- self.intersects(FlagVertical)
+ self.intersects(FLAG_VERTICAL)
}
/// Asuming .is_vertical(), does the block direction go left to right?
#[inline]
pub fn is_vertical_lr(&self) -> bool {
- self.intersects(FlagVerticalLR)
+ self.intersects(FLAG_VERTICAL_LR)
}
/// Asuming .is_vertical(), does the inline direction go top to bottom?
#[inline]
pub fn is_inline_tb(&self) -> bool {
- !(self.intersects(FlagSidewaysLeft) ^ self.intersects(FlagRTL))
+ !(self.intersects(FLAG_SIDEWAYS_LEFT) ^ self.intersects(FLAG_RTL))
}
#[inline]
pub fn is_bidi_ltr(&self) -> bool {
- !self.intersects(FlagRTL)
+ !self.intersects(FLAG_RTL)
}
#[inline]
pub fn is_sideways_left(&self) -> bool {
- self.intersects(FlagSidewaysLeft)
+ self.intersects(FLAG_SIDEWAYS_LEFT)
}
}
@@ -57,7 +57,7 @@ impl Show for WritingMode {
} else {
try!(write!(formatter, " RL"));
}
- if self.intersects(FlagSidewaysLeft) {
+ if self.intersects(FLAG_SIDEWAYS_LEFT) {
try!(write!(formatter, " SidewaysL"));
}
} else {
diff --git a/components/util/memory.rs b/components/util/memory.rs
index 2c3d92fe1d6..3dd894ebcf3 100644
--- a/components/util/memory.rs
+++ b/components/util/memory.rs
@@ -198,13 +198,12 @@ fn get_resident() -> Option<u64> {
resident_size()
}
-#[cfg(not(target_os="linux"), not(target_os = "macos"))]
+#[cfg(not(any(target_os="linux", target_os = "macos")))]
fn get_vsize() -> Option<u64> {
None
}
-#[cfg(not(target_os="linux"), not(target_os = "macos"))]
+#[cfg(not(any(target_os="linux", target_os = "macos")))]
fn get_resident() -> Option<u64> {
None
}
-
diff --git a/components/util/rtinstrument.rs b/components/util/rtinstrument.rs
index f0da89d9c4a..347ed09084a 100644
--- a/components/util/rtinstrument.rs
+++ b/components/util/rtinstrument.rs
@@ -161,6 +161,10 @@ impl InstrumentedRuntime {
}
impl Runtime for InstrumentedRuntime {
+ fn stack_guard(&self) -> Option<uint> {
+ self.inner.as_ref().unwrap().stack_guard()
+ }
+
fn yield_now(mut self: Box<InstrumentedRuntime>, cur_task: Box<Task>) {
self.inner.take().unwrap().yield_now(cur_task);
self.put(None)
diff --git a/components/util/smallvec.rs b/components/util/smallvec.rs
index b8f1e62e0ae..8897ca6b313 100644
--- a/components/util/smallvec.rs
+++ b/components/util/smallvec.rs
@@ -5,7 +5,7 @@
//! Small vectors in various sizes. These store a certain number of elements inline and fall back
//! to the heap for larger allocations.
-use std::mem::init as i;
+use std::mem::zeroed as i;
use std::cmp;
use std::fmt;
use std::intrinsics;
@@ -153,7 +153,7 @@ pub trait SmallVec<T> : SmallVecPrivate<T> {
let last_index = self.len() - 1;
if (last_index as int) < 0 {
- fail!("overflow")
+ panic!("overflow")
}
let end_ptr = self.begin().offset(last_index as int);
@@ -239,7 +239,7 @@ pub trait SmallVec<T> : SmallVecPrivate<T> {
}
fn fail_bounds_check(&self, index: uint) {
- fail!("index {} beyond length ({})", index, self.len())
+ panic!("index {} beyond length ({})", index, self.len())
}
}
diff --git a/components/util/str.rs b/components/util/str.rs
index f08ae1178d9..28aedee4f30 100644
--- a/components/util/str.rs
+++ b/components/util/str.rs
@@ -71,7 +71,7 @@ pub fn split_html_space_chars<'a>(s: &'a str) -> Filter<'a, &'a str, CharSplits<
fn do_parse_integer<T: Iterator<char>>(input: T) -> Option<i64> {
fn is_ascii_digit(c: &char) -> bool {
match *c {
- '0'..'9' => true,
+ '0'...'9' => true,
_ => false,
}
}
@@ -152,7 +152,7 @@ pub fn parse_length(mut value: &str) -> LengthOrPercentageOrAuto {
let (mut found_full_stop, mut found_percent) = (false, false);
for (i, ch) in value.chars().enumerate() {
match ch {
- '0'..'9' => continue,
+ '0'...'9' => continue,
'%' => {
found_percent = true;
end_index = i;
diff --git a/components/util/task_state.rs b/components/util/task_state.rs
index 8ea42949aec..f3f72d33207 100644
--- a/components/util/task_state.rs
+++ b/components/util/task_state.rs
@@ -13,13 +13,13 @@ pub use self::imp::{initialize, get, enter, exit};
bitflags! {
#[deriving(Show)]
flags TaskState: u32 {
- static Script = 0x01,
- static Layout = 0x02,
- static Render = 0x04,
+ const SCRIPT = 0x01,
+ const LAYOUT = 0x02,
+ const RENDER = 0x04,
- static InWorker = 0x0100,
- static InGC = 0x0200,
- static InHTMLParser = 0x0400,
+ const IN_WORKER = 0x0100,
+ const IN_GC = 0x0200,
+ const IN_HTML_PARSER = 0x0400,
}
}
@@ -38,9 +38,9 @@ macro_rules! task_types ( ( $( $fun:ident = $flag:ident ; )* ) => (
))
task_types! {
- is_script = Script;
- is_layout = Layout;
- is_render = Render;
+ is_script = SCRIPT;
+ is_layout = LAYOUT;
+ is_render = RENDER;
}
#[cfg(not(ndebug))]
@@ -52,14 +52,14 @@ mod imp {
pub fn initialize(x: TaskState) {
match STATE.replace(Some(x)) {
None => (),
- Some(s) => fail!("Task state already initialized as {}", s),
+ Some(s) => panic!("Task state already initialized as {}", s),
};
get(); // check the assertion below
}
pub fn get() -> TaskState {
let state = match STATE.get() {
- None => fail!("Task state not initialized"),
+ None => panic!("Task state not initialized"),
Some(s) => *s,
};
diff --git a/components/util/tid.rs b/components/util/tid.rs
index 22fc3402dfb..1e569731ff2 100644
--- a/components/util/tid.rs
+++ b/components/util/tid.rs
@@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-use std::sync::atomics::{AtomicUint, INIT_ATOMIC_UINT, SeqCst};
+use std::sync::atomic::{AtomicUint, INIT_ATOMIC_UINT, SeqCst};
static mut next_tid: AtomicUint = INIT_ATOMIC_UINT;
diff --git a/components/util/time.rs b/components/util/time.rs
index b4a60da36ef..6c244caf141 100644
--- a/components/util/time.rs
+++ b/components/util/time.rs
@@ -4,7 +4,7 @@
//! Timing functions.
-use collections::treemap::TreeMap;
+use collections::TreeMap;
use std::comm::{Sender, channel, Receiver};
use std::f64;
use std::io::timer::sleep;
@@ -196,7 +196,7 @@ impl TimeProfiler {
}
fn find_or_insert(&mut self, k: (TimeProfilerCategory, Option<TimerMetadata>), t: f64) {
- match self.buckets.find_mut(&k) {
+ match self.buckets.get_mut(&k) {
None => {},
Some(v) => { v.push(t); return; },
}
diff --git a/components/util/vec.rs b/components/util/vec.rs
index 61fd05fe0c5..c627448f0fc 100644
--- a/components/util/vec.rs
+++ b/components/util/vec.rs
@@ -4,6 +4,9 @@
use std::cmp::{PartialOrd, PartialEq};
+#[cfg(test)]
+use std::fmt::Show;
+
/// FIXME(pcwalton): Workaround for lack of unboxed closures. This is called in
/// performance-critical code, so a closure is insufficient.
pub trait Comparator<K,T> {
@@ -71,11 +74,11 @@ fn test_find_all_elems<T: PartialEq + PartialOrd + Eq + Ord>(arr: &[T]) {
}
#[cfg(test)]
-fn test_miss_all_elems<T: PartialEq + PartialOrd + Eq + Ord>(arr: &[T], misses: &[T]) {
+fn test_miss_all_elems<T: PartialEq + PartialOrd + Eq + Ord + Show>(arr: &[T], misses: &[T]) {
let mut i = 0;
while i < misses.len() {
let res = arr.binary_search_(&misses[i]);
- debug!("{:?} == {:?} ?", misses[i], res);
+ debug!("{} == {} ?", misses[i], res);
assert!(!test_match(&misses[i], arr.binary_search_(&misses[i])));
i += 1;
}
diff --git a/components/util/workqueue.rs b/components/util/workqueue.rs
index 3a041e8ce37..3420e47345b 100644
--- a/components/util/workqueue.rs
+++ b/components/util/workqueue.rs
@@ -14,7 +14,7 @@ use libc::funcs::posix88::unistd::usleep;
use rand::{Rng, XorShiftRng};
use std::mem;
use std::rand::weak_rng;
-use std::sync::atomics::{AtomicUint, SeqCst};
+use std::sync::atomic::{AtomicUint, SeqCst};
use std::sync::deque::{Abort, BufferPool, Data, Empty, Stealer, Worker};
/// A unit of work.
@@ -82,7 +82,7 @@ impl<QueueData: Send, WorkData: Send> WorkerThread<QueueData, WorkData> {
// Wait for a start message.
let (mut deque, ref_count, queue_data) = match self.port.recv() {
StartMsg(deque, ref_count, queue_data) => (deque, ref_count, queue_data),
- StopMsg => fail!("unexpected stop message"),
+ StopMsg => panic!("unexpected stop message"),
ExitMsg => return,
};
@@ -105,7 +105,7 @@ impl<QueueData: Send, WorkData: Send> WorkerThread<QueueData, WorkData> {
let mut should_continue = true;
loop {
let victim = (self.rng.next_u32() as uint) % self.other_deques.len();
- match self.other_deques.get_mut(victim).steal() {
+ match self.other_deques[victim].steal() {
Empty | Abort => {
// Continue.
}
@@ -130,7 +130,7 @@ impl<QueueData: Send, WorkData: Send> WorkerThread<QueueData, WorkData> {
break
}
Ok(ExitMsg) => return,
- Ok(_) => fail!("unexpected message"),
+ Ok(_) => panic!("unexpected message"),
_ => {}
}
@@ -239,7 +239,7 @@ impl<QueueData: Send, WorkData: Send> WorkQueue<QueueData, WorkData> {
for i in range(0, thread_count) {
for j in range(0, thread_count) {
if i != j {
- threads.get_mut(i).other_deques.push(infos[j].thief.clone())
+ threads[i].other_deques.push(infos[j].thief.clone())
}
}
assert!(threads[i].other_deques.len() == thread_count - 1)
@@ -251,7 +251,7 @@ impl<QueueData: Send, WorkData: Send> WorkQueue<QueueData, WorkData> {
spawn_named_native(
format!("{} worker {}/{}", task_name, i+1, thread_count),
proc() {
- task_state::initialize(state | task_state::InWorker);
+ task_state::initialize(state | task_state::IN_WORKER);
let mut thread = thread;
thread.start()
})
@@ -268,9 +268,10 @@ impl<QueueData: Send, WorkData: Send> WorkQueue<QueueData, WorkData> {
/// Enqueues a block into the work queue.
#[inline]
pub fn push(&mut self, work_unit: WorkUnit<QueueData, WorkData>) {
- match self.workers.get_mut(0).deque {
+ let deque = &mut self.workers[0].deque;
+ match *deque {
None => {
- fail!("tried to push a block but we don't have the deque?!")
+ panic!("tried to push a block but we don't have the deque?!")
}
Some(ref mut deque) => deque.push(work_unit),
}
@@ -297,8 +298,8 @@ impl<QueueData: Send, WorkData: Send> WorkQueue<QueueData, WorkData> {
// Get our deques back.
for _ in range(0, self.workers.len()) {
match self.port.recv() {
- ReturnDequeMsg(index, deque) => self.workers.get_mut(index).deque = Some(deque),
- FinishedMsg => fail!("unexpected finished message!"),
+ ReturnDequeMsg(index, deque) => self.workers[index].deque = Some(deque),
+ FinishedMsg => panic!("unexpected finished message!"),
}
}
}
diff --git a/ports/android/glut_app/Cargo.lock b/ports/android/glut_app/Cargo.lock
index 14919d8fede..18d251cbd8c 100644
--- a/ports/android/glut_app/Cargo.lock
+++ b/ports/android/glut_app/Cargo.lock
@@ -16,16 +16,16 @@ dependencies = [
[[package]]
name = "alert"
version = "0.1.0"
-source = "git+https://github.com/servo/rust-alert#fdc24f13be8d8a2d15214ec228d166b3221b809e"
+source = "git+https://github.com/servo/rust-alert#9bd18fc406683bae448bc6f5d546872970af252e"
dependencies = [
- "cocoa 0.1.0 (git+https://github.com/servo/rust-cocoa)",
+ "cocoa 0.1.1 (git+https://github.com/servo/rust-cocoa)",
"core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation)",
]
[[package]]
name = "azure"
version = "0.1.0"
-source = "git+https://github.com/servo/rust-azure#8e9b6b1fdbbe0386655d61b0f58e1a9910497311"
+source = "git+https://github.com/servo/rust-azure#612ffc4fbf80c1bd5faae4b86dfc539dda06fb0c"
dependencies = [
"core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation)",
"core_graphics 0.1.0 (git+https://github.com/servo/rust-core-graphics)",
@@ -50,15 +50,15 @@ dependencies = [
[[package]]
name = "cgl"
version = "0.0.1"
-source = "git+https://github.com/servo/rust-cgl#698c6c5409c1049ba5a7e0f7bdddf97f91dc4cf5"
+source = "git+https://github.com/servo/rust-cgl#7b7090729f65e2287c3d80651df02e547911b119"
dependencies = [
"gleam 0.0.1 (git+https://github.com/servo/gleam)",
]
[[package]]
name = "cocoa"
-version = "0.1.0"
-source = "git+https://github.com/servo/rust-cocoa#acb9b4efc70c3f285057c2aee774f38f81a1b98d"
+version = "0.1.1"
+source = "git+https://github.com/servo/rust-cocoa#f926323d306401df33f528c9aeca8e582cad063b"
[[package]]
name = "compositing"
@@ -86,12 +86,12 @@ dependencies = [
[[package]]
name = "core_foundation"
version = "0.1.0"
-source = "git+https://github.com/servo/rust-core-foundation#5c3b85b079ab2fe4a046497a84e55386db7598e8"
+source = "git+https://github.com/servo/rust-core-foundation#6fa0b908f3912e20d081193e83bf5a9aa958fb83"
[[package]]
name = "core_graphics"
version = "0.1.0"
-source = "git+https://github.com/servo/rust-core-graphics#6a9919f8a912cc67571b891ba198d5325964a104"
+source = "git+https://github.com/servo/rust-core-graphics#9434e2bda65d259f825104170b5fa6cc6dbaf5a9"
dependencies = [
"core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation)",
]
@@ -99,7 +99,7 @@ dependencies = [
[[package]]
name = "core_text"
version = "0.1.0"
-source = "git+https://github.com/servo/rust-core-text#967a97fa7e9ae47f96aee5e48f5fb0be1345d89e"
+source = "git+https://github.com/servo/rust-core-text#85784007b6fa1b8f9614059edcd0429b2bd69a11"
dependencies = [
"core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation)",
"core_graphics 0.1.0 (git+https://github.com/servo/rust-core-graphics)",
@@ -108,9 +108,9 @@ dependencies = [
[[package]]
name = "cssparser"
version = "0.1.0"
-source = "git+https://github.com/servo/rust-cssparser#7b0549a5d122135848b8813ec401112ab588063c"
+source = "git+https://github.com/servo/rust-cssparser#cbbfd66f794bd019bbdeaefc88b29eff455b62e5"
dependencies = [
- "encoding 0.1.0 (git+https://github.com/lifthrasiir/rust-encoding)",
+ "encoding 0.2.0 (git+https://github.com/lifthrasiir/rust-encoding)",
]
[[package]]
@@ -136,8 +136,40 @@ source = "git+https://github.com/servo/rust-egl#88f2a13812ddbce2bf2317221663a61c
[[package]]
name = "encoding"
-version = "0.1.0"
-source = "git+https://github.com/lifthrasiir/rust-encoding#28eafb604a92c7786685b46c0fc02682ba3ab265"
+version = "0.2.0"
+source = "git+https://github.com/lifthrasiir/rust-encoding#a06637cc6d0da37c12c68661e2ee9ca1999764a4"
+dependencies = [
+ "encoding-index-japanese 1.0.20140915 (git+https://github.com/lifthrasiir/rust-encoding)",
+ "encoding-index-korean 1.0.20140915 (git+https://github.com/lifthrasiir/rust-encoding)",
+ "encoding-index-simpchinese 1.0.20140915 (git+https://github.com/lifthrasiir/rust-encoding)",
+ "encoding-index-singlebyte 1.0.20140915 (git+https://github.com/lifthrasiir/rust-encoding)",
+ "encoding-index-tradchinese 1.0.20140915 (git+https://github.com/lifthrasiir/rust-encoding)",
+]
+
+[[package]]
+name = "encoding-index-japanese"
+version = "1.0.20140915"
+source = "git+https://github.com/lifthrasiir/rust-encoding#a06637cc6d0da37c12c68661e2ee9ca1999764a4"
+
+[[package]]
+name = "encoding-index-korean"
+version = "1.0.20140915"
+source = "git+https://github.com/lifthrasiir/rust-encoding#a06637cc6d0da37c12c68661e2ee9ca1999764a4"
+
+[[package]]
+name = "encoding-index-simpchinese"
+version = "1.0.20140915"
+source = "git+https://github.com/lifthrasiir/rust-encoding#a06637cc6d0da37c12c68661e2ee9ca1999764a4"
+
+[[package]]
+name = "encoding-index-singlebyte"
+version = "1.0.20140915"
+source = "git+https://github.com/lifthrasiir/rust-encoding#a06637cc6d0da37c12c68661e2ee9ca1999764a4"
+
+[[package]]
+name = "encoding-index-tradchinese"
+version = "1.0.20140915"
+source = "git+https://github.com/lifthrasiir/rust-encoding#a06637cc6d0da37c12c68661e2ee9ca1999764a4"
[[package]]
name = "expat-sys"
@@ -147,7 +179,7 @@ source = "git+https://github.com/servo/libexpat#da2ddaf78cbef836b8790807bb76b357
[[package]]
name = "fontconfig"
version = "0.1.0"
-source = "git+https://github.com/servo/rust-fontconfig#b16c1e12ecb74b1e4e9a9b23c2b98580a34cf201"
+source = "git+https://github.com/servo/rust-fontconfig#f42ff5cbd0404fe4d2cd64e8d9bb6307bad8fd7c"
dependencies = [
"fontconfig-sys 2.11.1 (git+https://github.com/servo/libfontconfig)",
]
@@ -164,7 +196,7 @@ dependencies = [
[[package]]
name = "freetype"
version = "0.1.0"
-source = "git+https://github.com/servo/rust-freetype#0b03da276e4bdeae2300596dabc4ccb16733ad70"
+source = "git+https://github.com/servo/rust-freetype#e55b06110fb2d74a2db68ead740db7e98fb98060"
[[package]]
name = "freetype-sys"
@@ -174,7 +206,7 @@ source = "git+https://github.com/servo/libfreetype2#5b6499164106f094937565595c7b
[[package]]
name = "geom"
version = "0.1.0"
-source = "git+https://github.com/servo/rust-geom#b001a76e907befaae1d0d6dd259418a22092da86"
+source = "git+https://github.com/servo/rust-geom#e5e74911ac6d3201009879b72499d6c681302611"
[[package]]
name = "gfx"
@@ -200,10 +232,16 @@ dependencies = [
]
[[package]]
+name = "gl_common"
+version = "0.0.1"
+source = "git+https://github.com/bjz/gl-rs.git#79cd3b3f9f19aa0e39f6af572fc8673a6d9760bc"
+
+[[package]]
name = "gl_generator"
version = "0.0.1"
-source = "git+https://github.com/bjz/gl-rs.git#2857ad712bd443196983ea7c0bd4b6bdcf653e7c"
+source = "git+https://github.com/bjz/gl-rs.git#79cd3b3f9f19aa0e39f6af572fc8673a6d9760bc"
dependencies = [
+ "gl_common 0.0.1 (git+https://github.com/bjz/gl-rs.git)",
"khronos_api 0.0.1 (git+https://github.com/bjz/gl-rs.git)",
"rust-xml 0.1.0 (git+https://github.com/netvl/rust-xml)",
]
@@ -211,7 +249,7 @@ dependencies = [
[[package]]
name = "gleam"
version = "0.0.1"
-source = "git+https://github.com/servo/gleam#5ebe1656d63087c68512c93c6528f9300abcd199"
+source = "git+https://github.com/servo/gleam#8e77178eaebddfeae6557dfec2bcccbefaba93f3"
dependencies = [
"gl_generator 0.0.1 (git+https://github.com/bjz/gl-rs.git)",
]
@@ -227,22 +265,27 @@ dependencies = [
[[package]]
name = "glx"
version = "0.0.1"
-source = "git+https://github.com/servo/rust-glx#e2ce3d297260ccd23fcb4627f6ed218b68e1095f"
+source = "git+https://github.com/servo/rust-glx#7126ffa09fcfcc9f85f1406f3b5db729f5fdb7c3"
dependencies = [
"gl_generator 0.0.1 (git+https://github.com/bjz/gl-rs.git)",
]
[[package]]
+name = "green"
+version = "0.0.1"
+source = "git+https://github.com/alexcrichton/green-rs#215f3c87bf545b36a90100b7fb209ba640f2f481"
+
+[[package]]
name = "harfbuzz"
version = "0.1.0"
-source = "git+https://github.com/servo/rust-harfbuzz#ad520942cc17232e1a40cdd8a99c2905623d35f6"
+source = "git+https://github.com/servo/rust-harfbuzz#8aab215463214647b7a81f66011da552bbb1121c"
[[package]]
name = "html5ever"
version = "0.0.0"
-source = "git+https://github.com/servo/html5ever?ref=servo#0bdd6087dc8df6a92c96e1859bbb4ebbb0be7c1f"
+source = "git+https://github.com/servo/html5ever#49e9da50ed81510b1f44b4033387e6094b169141"
dependencies = [
- "html5ever_macros 0.0.0 (git+https://github.com/servo/html5ever?ref=servo)",
+ "html5ever_macros 0.0.0 (git+https://github.com/servo/html5ever)",
"phf 0.0.0 (git+https://github.com/sfackler/rust-phf)",
"phf_mac 0.0.0 (git+https://github.com/sfackler/rust-phf)",
"string_cache 0.0.0 (git+https://github.com/servo/string-cache)",
@@ -252,12 +295,12 @@ dependencies = [
[[package]]
name = "html5ever_macros"
version = "0.0.0"
-source = "git+https://github.com/servo/html5ever?ref=servo#0bdd6087dc8df6a92c96e1859bbb4ebbb0be7c1f"
+source = "git+https://github.com/servo/html5ever#49e9da50ed81510b1f44b4033387e6094b169141"
[[package]]
name = "http"
version = "0.1.0-pre"
-source = "git+https://github.com/servo/rust-http?ref=servo#5e9b063b36028a5b40a417c661ee5c628b594be9"
+source = "git+https://github.com/servo/rust-http?ref=servo#3597f981aa001c57d3c918eb9f8ab58d3f0bf5a5"
dependencies = [
"openssl 0.0.0 (git+https://github.com/sfackler/rust-openssl.git)",
"url 0.1.0 (git+https://github.com/servo/rust-url)",
@@ -266,7 +309,7 @@ dependencies = [
[[package]]
name = "io_surface"
version = "0.1.0"
-source = "git+https://github.com/servo/rust-io-surface#3f8220ab2e94651ced69b04068c5126b1adadf1f"
+source = "git+https://github.com/servo/rust-io-surface#691cbccc320c4fb9b75e215da9b0b82539d729bd"
dependencies = [
"cgl 0.0.1 (git+https://github.com/servo/rust-cgl)",
"core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation)",
@@ -277,20 +320,22 @@ dependencies = [
[[package]]
name = "js"
version = "0.1.0"
-source = "git+https://github.com/servo/rust-mozjs#1ec216a2577c03738fa11a78958bb2a0fd3f7fbd"
+source = "git+https://github.com/servo/rust-mozjs#b8109aa873d886b6ee295ea17359063da7fd3e2f"
dependencies = [
+ "green 0.0.1 (git+https://github.com/alexcrichton/green-rs)",
"mozjs-sys 0.0.0 (git+https://github.com/servo/mozjs)",
+ "rustuv 0.0.1 (git+https://github.com/alexcrichton/green-rs)",
]
[[package]]
name = "khronos_api"
version = "0.0.1"
-source = "git+https://github.com/bjz/gl-rs.git#2857ad712bd443196983ea7c0bd4b6bdcf653e7c"
+source = "git+https://github.com/bjz/gl-rs.git#79cd3b3f9f19aa0e39f6af572fc8673a6d9760bc"
[[package]]
name = "layers"
version = "0.1.0"
-source = "git+https://github.com/servo/rust-layers#3737b00270644594a95896a2cd37ffca36d5bc5f"
+source = "git+https://github.com/servo/rust-layers#36bcefcdc791bd6fa4ab389f472e449ce2e1e159"
dependencies = [
"cgl 0.0.1 (git+https://github.com/servo/rust-cgl)",
"core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation)",
@@ -306,7 +351,7 @@ dependencies = [
name = "layout"
version = "0.0.1"
dependencies = [
- "encoding 0.1.0 (git+https://github.com/lifthrasiir/rust-encoding)",
+ "encoding 0.2.0 (git+https://github.com/lifthrasiir/rust-encoding)",
"geom 0.1.0 (git+https://github.com/servo/rust-geom)",
"gfx 0.0.1",
"layout_traits 0.0.1",
@@ -335,12 +380,12 @@ dependencies = [
[[package]]
name = "lazy_static"
version = "0.1.0"
-source = "git+https://github.com/Kimundi/lazy-static.rs#e62a65372f1dd9019e37eb9381d819edff80e360"
+source = "git+https://github.com/Kimundi/lazy-static.rs#62976cb611c5396e11315ae64c9c389576240eb7"
[[package]]
name = "mozjs-sys"
version = "0.0.0"
-source = "git+https://github.com/servo/mozjs#47cd6a4e60c75642ba182f0df9a42b71ec7c2c88"
+source = "git+https://github.com/servo/mozjs#0dd618fcc78fe7aa64e4e2a3b0f7f0d8a2f0f08a"
[[package]]
name = "msg"
@@ -371,22 +416,28 @@ dependencies = [
[[package]]
name = "opengles"
version = "0.1.0"
-source = "git+https://github.com/servo/rust-opengles#e308a8672f7d953f6484932b6a4aaae8a0cc2a50"
+source = "git+https://github.com/servo/rust-opengles#7f025f0069fbf6fefef4ed383b9be120584f2ab5"
[[package]]
name = "openssl"
version = "0.0.0"
-source = "git+https://github.com/sfackler/rust-openssl.git#a495465b75ffb18ff2303c5a11a103e00a15a13d"
+source = "git+https://github.com/sfackler/rust-openssl.git#766ce4b7785c0b038bee95b74564e5b9bf7e9a4b"
[[package]]
name = "phf"
version = "0.0.0"
-source = "git+https://github.com/sfackler/rust-phf#06254fdde7708630a6397c41c6c17ef81a4b66a0"
+source = "git+https://github.com/sfackler/rust-phf#18a5ecc028055c3dbd650cc5a064b6fb033d82ef"
+dependencies = [
+ "xxhash 0.0.1 (git+https://github.com/Jurily/rust-xxhash)",
+]
[[package]]
name = "phf_mac"
version = "0.0.0"
-source = "git+https://github.com/sfackler/rust-phf#06254fdde7708630a6397c41c6c17ef81a4b66a0"
+source = "git+https://github.com/sfackler/rust-phf#18a5ecc028055c3dbd650cc5a064b6fb033d82ef"
+dependencies = [
+ "xxhash 0.0.1 (git+https://github.com/Jurily/rust-xxhash)",
+]
[[package]]
name = "plugins"
@@ -395,7 +446,7 @@ version = "0.0.1"
[[package]]
name = "png"
version = "0.1.0"
-source = "git+https://github.com/servo/rust-png#74418ffbf20e94b0d3bed4a9d004062a13342c79"
+source = "git+https://github.com/servo/rust-png#b0b4acde0080dd475dee93615276bfc19207a21e"
dependencies = [
"png-sys 1.6.3 (git+https://github.com/servo/libpng?ref=servo)",
]
@@ -408,7 +459,16 @@ source = "git+https://github.com/servo/libpng?ref=servo#d01f32b4eb86904695efe7fc
[[package]]
name = "rust-xml"
version = "0.1.0"
-source = "git+https://github.com/netvl/rust-xml#fdc021b2bfec7855866b964f459559903c6b7808"
+source = "git+https://github.com/netvl/rust-xml#d6c57380a300b94f7e7881979dbe5459dbe4ca06"
+
+[[package]]
+name = "rustuv"
+version = "0.0.1"
+source = "git+https://github.com/alexcrichton/green-rs#215f3c87bf545b36a90100b7fb209ba640f2f481"
+dependencies = [
+ "green 0.0.1 (git+https://github.com/alexcrichton/green-rs)",
+ "tls 0.0.1 (git+https://github.com/alexcrichton/green-rs)",
+]
[[package]]
name = "script"
@@ -417,10 +477,10 @@ dependencies = [
"canvas 0.0.1",
"cssparser 0.1.0 (git+https://github.com/servo/rust-cssparser)",
"devtools_traits 0.0.1",
- "encoding 0.1.0 (git+https://github.com/lifthrasiir/rust-encoding)",
+ "encoding 0.2.0 (git+https://github.com/lifthrasiir/rust-encoding)",
"geom 0.1.0 (git+https://github.com/servo/rust-geom)",
"gfx 0.0.1",
- "html5ever 0.0.0 (git+https://github.com/servo/html5ever?ref=servo)",
+ "html5ever 0.0.0 (git+https://github.com/servo/html5ever)",
"http 0.1.0-pre (git+https://github.com/servo/rust-http?ref=servo)",
"js 0.1.0 (git+https://github.com/servo/rust-mozjs)",
"msg 0.0.1",
@@ -453,9 +513,11 @@ version = "0.0.1"
dependencies = [
"compositing 0.0.1",
"gfx 0.0.1",
+ "green 0.0.1 (git+https://github.com/alexcrichton/green-rs)",
"layout 0.0.1",
"msg 0.0.1",
"net 0.0.1",
+ "rustuv 0.0.1 (git+https://github.com/alexcrichton/green-rs)",
"script 0.0.1",
"url 0.1.0 (git+https://github.com/servo/rust-url)",
"util 0.0.1",
@@ -464,7 +526,7 @@ dependencies = [
[[package]]
name = "skia-sys"
version = "0.0.20130412"
-source = "git+https://github.com/servo/skia#6d696712962fd0d41120b7a414a48417da8e6a92"
+source = "git+https://github.com/servo/skia#d92603043a9b7dd0b25c0b3b562099a0cc32ac6c"
dependencies = [
"expat-sys 2.1.0 (git+https://github.com/servo/libexpat)",
"freetype-sys 2.4.11 (git+https://github.com/servo/libfreetype2)",
@@ -473,22 +535,24 @@ dependencies = [
[[package]]
name = "stb_image"
version = "0.1.0"
-source = "git+https://github.com/servo/rust-stb-image#f5022de4ad6bb474a03493d1f274dde9b0f1af0c"
+source = "git+https://github.com/servo/rust-stb-image#74488fef4740acf287ff5dc248d65cc74033467a"
[[package]]
name = "string_cache"
version = "0.0.0"
-source = "git+https://github.com/servo/string-cache#97754929f38d93f6728d1f0acce8107648420e98"
+source = "git+https://github.com/servo/string-cache#ae950525434b642eff5f4904f5e0c76cd6ea99b9"
dependencies = [
+ "lazy_static 0.1.0 (git+https://github.com/Kimundi/lazy-static.rs)",
"phf 0.0.0 (git+https://github.com/sfackler/rust-phf)",
"phf_mac 0.0.0 (git+https://github.com/sfackler/rust-phf)",
"string_cache_macros 0.0.0 (git+https://github.com/servo/string-cache)",
+ "xxhash 0.0.1 (git+https://github.com/Jurily/rust-xxhash)",
]
[[package]]
name = "string_cache_macros"
version = "0.0.0"
-source = "git+https://github.com/servo/string-cache#97754929f38d93f6728d1f0acce8107648420e98"
+source = "git+https://github.com/servo/string-cache#ae950525434b642eff5f4904f5e0c76cd6ea99b9"
dependencies = [
"lazy_static 0.1.0 (git+https://github.com/Kimundi/lazy-static.rs)",
]
@@ -498,7 +562,7 @@ name = "style"
version = "0.0.1"
dependencies = [
"cssparser 0.1.0 (git+https://github.com/servo/rust-cssparser)",
- "encoding 0.1.0 (git+https://github.com/lifthrasiir/rust-encoding)",
+ "encoding 0.2.0 (git+https://github.com/lifthrasiir/rust-encoding)",
"geom 0.1.0 (git+https://github.com/servo/rust-geom)",
"lazy_static 0.1.0 (git+https://github.com/Kimundi/lazy-static.rs)",
"plugins 0.0.1",
@@ -513,11 +577,16 @@ name = "task_info"
version = "0.0.1"
[[package]]
+name = "tls"
+version = "0.0.1"
+source = "git+https://github.com/alexcrichton/green-rs#215f3c87bf545b36a90100b7fb209ba640f2f481"
+
+[[package]]
name = "url"
version = "0.1.0"
-source = "git+https://github.com/servo/rust-url#29f70a47230c2aa736e263977247c786e0b2c243"
+source = "git+https://github.com/servo/rust-url#8a61b7654ab5378b488225a1d8a9cbbbcbd38894"
dependencies = [
- "encoding 0.1.0 (git+https://github.com/lifthrasiir/rust-encoding)",
+ "encoding 0.2.0 (git+https://github.com/lifthrasiir/rust-encoding)",
]
[[package]]
@@ -535,10 +604,15 @@ dependencies = [
[[package]]
name = "uuid"
version = "0.0.1"
-source = "git+https://github.com/rust-lang/uuid#c3041068f413a5e46d795d21a346072794593839"
+source = "git+https://github.com/rust-lang/uuid#7c5af48d4f9074717199e05a1895f42b9fb1c1f0"
[[package]]
name = "xlib"
version = "0.1.0"
-source = "git+https://github.com/servo/rust-xlib#581d4faddec5188d3c3ae5307dbea28aab90644c"
+source = "git+https://github.com/servo/rust-xlib#58ec3847b592aeabdcfeb6a2d02033d3a2c7f427"
+
+[[package]]
+name = "xxhash"
+version = "0.0.1"
+source = "git+https://github.com/Jurily/rust-xxhash#7e4174e780af0cfb29a5e53ede0b987adca16396"
diff --git a/ports/android/glut_app/lib.rs b/ports/android/glut_app/lib.rs
index ab032d888e4..66c16b292cd 100644
--- a/ports/android/glut_app/lib.rs
+++ b/ports/android/glut_app/lib.rs
@@ -6,7 +6,8 @@
#![license = "MPL"]
#![feature(macro_rules, phase)]
-#![deny(unused_imports, unused_variable)]
+#![deny(unused_imports)]
+#![deny(unused_variables)]
extern crate alert;
extern crate compositing;
diff --git a/ports/android/glut_app/window.rs b/ports/android/glut_app/window.rs
index d2db495d8f7..48da4eb08c0 100644
--- a/ports/android/glut_app/window.rs
+++ b/ports/android/glut_app/window.rs
@@ -280,7 +280,7 @@ impl Window {
}
MouseWindowMouseUpEvent(button as uint, TypedPoint2D(x as f32, y as f32))
}
- _ => fail!("I cannot recognize the type of mouse action that occured. :-(")
+ _ => panic!("I cannot recognize the type of mouse action that occured. :-(")
};
self.event_queue.borrow_mut().push(MouseWindowEventClass(event));
}
diff --git a/ports/cef/Cargo.lock b/ports/cef/Cargo.lock
index e2afcde210d..121294acba9 100644
--- a/ports/cef/Cargo.lock
+++ b/ports/cef/Cargo.lock
@@ -26,16 +26,16 @@ dependencies = [
[[package]]
name = "alert"
version = "0.1.0"
-source = "git+https://github.com/servo/rust-alert#fdc24f13be8d8a2d15214ec228d166b3221b809e"
+source = "git+https://github.com/servo/rust-alert#9bd18fc406683bae448bc6f5d546872970af252e"
dependencies = [
- "cocoa 0.1.0 (git+https://github.com/servo/rust-cocoa)",
+ "cocoa 0.1.1 (git+https://github.com/servo/rust-cocoa)",
"core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation)",
]
[[package]]
name = "azure"
version = "0.1.0"
-source = "git+https://github.com/servo/rust-azure#8e9b6b1fdbbe0386655d61b0f58e1a9910497311"
+source = "git+https://github.com/servo/rust-azure#612ffc4fbf80c1bd5faae4b86dfc539dda06fb0c"
dependencies = [
"core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation)",
"core_graphics 0.1.0 (git+https://github.com/servo/rust-core-graphics)",
@@ -60,15 +60,15 @@ dependencies = [
[[package]]
name = "cgl"
version = "0.0.1"
-source = "git+https://github.com/servo/rust-cgl#698c6c5409c1049ba5a7e0f7bdddf97f91dc4cf5"
+source = "git+https://github.com/servo/rust-cgl#7b7090729f65e2287c3d80651df02e547911b119"
dependencies = [
"gleam 0.0.1 (git+https://github.com/servo/gleam)",
]
[[package]]
name = "cocoa"
-version = "0.1.0"
-source = "git+https://github.com/servo/rust-cocoa#acb9b4efc70c3f285057c2aee774f38f81a1b98d"
+version = "0.1.1"
+source = "git+https://github.com/servo/rust-cocoa#f926323d306401df33f528c9aeca8e582cad063b"
[[package]]
name = "compositing"
@@ -96,12 +96,12 @@ dependencies = [
[[package]]
name = "core_foundation"
version = "0.1.0"
-source = "git+https://github.com/servo/rust-core-foundation#5c3b85b079ab2fe4a046497a84e55386db7598e8"
+source = "git+https://github.com/servo/rust-core-foundation#6fa0b908f3912e20d081193e83bf5a9aa958fb83"
[[package]]
name = "core_graphics"
version = "0.1.0"
-source = "git+https://github.com/servo/rust-core-graphics#6a9919f8a912cc67571b891ba198d5325964a104"
+source = "git+https://github.com/servo/rust-core-graphics#9434e2bda65d259f825104170b5fa6cc6dbaf5a9"
dependencies = [
"core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation)",
]
@@ -109,7 +109,7 @@ dependencies = [
[[package]]
name = "core_text"
version = "0.1.0"
-source = "git+https://github.com/servo/rust-core-text#967a97fa7e9ae47f96aee5e48f5fb0be1345d89e"
+source = "git+https://github.com/servo/rust-core-text#85784007b6fa1b8f9614059edcd0429b2bd69a11"
dependencies = [
"core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation)",
"core_graphics 0.1.0 (git+https://github.com/servo/rust-core-graphics)",
@@ -118,9 +118,9 @@ dependencies = [
[[package]]
name = "cssparser"
version = "0.1.0"
-source = "git+https://github.com/servo/rust-cssparser#7b0549a5d122135848b8813ec401112ab588063c"
+source = "git+https://github.com/servo/rust-cssparser#cbbfd66f794bd019bbdeaefc88b29eff455b62e5"
dependencies = [
- "encoding 0.1.0 (git+https://github.com/lifthrasiir/rust-encoding)",
+ "encoding 0.2.0 (git+https://github.com/lifthrasiir/rust-encoding)",
]
[[package]]
@@ -146,8 +146,40 @@ source = "git+https://github.com/servo/rust-egl#88f2a13812ddbce2bf2317221663a61c
[[package]]
name = "encoding"
-version = "0.1.0"
-source = "git+https://github.com/lifthrasiir/rust-encoding#28eafb604a92c7786685b46c0fc02682ba3ab265"
+version = "0.2.0"
+source = "git+https://github.com/lifthrasiir/rust-encoding#a06637cc6d0da37c12c68661e2ee9ca1999764a4"
+dependencies = [
+ "encoding-index-japanese 1.0.20140915 (git+https://github.com/lifthrasiir/rust-encoding)",
+ "encoding-index-korean 1.0.20140915 (git+https://github.com/lifthrasiir/rust-encoding)",
+ "encoding-index-simpchinese 1.0.20140915 (git+https://github.com/lifthrasiir/rust-encoding)",
+ "encoding-index-singlebyte 1.0.20140915 (git+https://github.com/lifthrasiir/rust-encoding)",
+ "encoding-index-tradchinese 1.0.20140915 (git+https://github.com/lifthrasiir/rust-encoding)",
+]
+
+[[package]]
+name = "encoding-index-japanese"
+version = "1.0.20140915"
+source = "git+https://github.com/lifthrasiir/rust-encoding#a06637cc6d0da37c12c68661e2ee9ca1999764a4"
+
+[[package]]
+name = "encoding-index-korean"
+version = "1.0.20140915"
+source = "git+https://github.com/lifthrasiir/rust-encoding#a06637cc6d0da37c12c68661e2ee9ca1999764a4"
+
+[[package]]
+name = "encoding-index-simpchinese"
+version = "1.0.20140915"
+source = "git+https://github.com/lifthrasiir/rust-encoding#a06637cc6d0da37c12c68661e2ee9ca1999764a4"
+
+[[package]]
+name = "encoding-index-singlebyte"
+version = "1.0.20140915"
+source = "git+https://github.com/lifthrasiir/rust-encoding#a06637cc6d0da37c12c68661e2ee9ca1999764a4"
+
+[[package]]
+name = "encoding-index-tradchinese"
+version = "1.0.20140915"
+source = "git+https://github.com/lifthrasiir/rust-encoding#a06637cc6d0da37c12c68661e2ee9ca1999764a4"
[[package]]
name = "expat-sys"
@@ -157,7 +189,7 @@ source = "git+https://github.com/servo/libexpat#da2ddaf78cbef836b8790807bb76b357
[[package]]
name = "fontconfig"
version = "0.1.0"
-source = "git+https://github.com/servo/rust-fontconfig#b16c1e12ecb74b1e4e9a9b23c2b98580a34cf201"
+source = "git+https://github.com/servo/rust-fontconfig#f42ff5cbd0404fe4d2cd64e8d9bb6307bad8fd7c"
dependencies = [
"fontconfig-sys 2.11.1 (git+https://github.com/servo/libfontconfig)",
]
@@ -174,7 +206,7 @@ dependencies = [
[[package]]
name = "freetype"
version = "0.1.0"
-source = "git+https://github.com/servo/rust-freetype#0b03da276e4bdeae2300596dabc4ccb16733ad70"
+source = "git+https://github.com/servo/rust-freetype#e55b06110fb2d74a2db68ead740db7e98fb98060"
[[package]]
name = "freetype-sys"
@@ -210,10 +242,16 @@ dependencies = [
]
[[package]]
+name = "gl_common"
+version = "0.0.1"
+source = "git+https://github.com/bjz/gl-rs.git#79cd3b3f9f19aa0e39f6af572fc8673a6d9760bc"
+
+[[package]]
name = "gl_generator"
version = "0.0.1"
-source = "git+https://github.com/bjz/gl-rs.git#2857ad712bd443196983ea7c0bd4b6bdcf653e7c"
+source = "git+https://github.com/bjz/gl-rs.git#79cd3b3f9f19aa0e39f6af572fc8673a6d9760bc"
dependencies = [
+ "gl_common 0.0.1 (git+https://github.com/bjz/gl-rs.git)",
"khronos_api 0.0.1 (git+https://github.com/bjz/gl-rs.git)",
"rust-xml 0.1.0 (git+https://github.com/netvl/rust-xml)",
]
@@ -221,7 +259,7 @@ dependencies = [
[[package]]
name = "gleam"
version = "0.0.1"
-source = "git+https://github.com/servo/gleam#5ebe1656d63087c68512c93c6528f9300abcd199"
+source = "git+https://github.com/servo/gleam#8e77178eaebddfeae6557dfec2bcccbefaba93f3"
dependencies = [
"gl_generator 0.0.1 (git+https://github.com/bjz/gl-rs.git)",
]
@@ -229,16 +267,16 @@ dependencies = [
[[package]]
name = "glfw"
version = "0.0.1"
-source = "git+https://github.com/servo/glfw-rs?ref=servo#cec2861dd75eb721694b3176f94a276d77018bde"
+source = "git+https://github.com/servo/glfw-rs?ref=servo#46f82b46589720f202ab2d4a99e4f4fd48df6469"
dependencies = [
"glfw-sys 3.0.4 (git+https://github.com/servo/glfw?ref=cargo-3.0.4)",
- "semver 0.0.1 (git+https://github.com/rust-lang/semver)",
+ "semver 0.1.0 (git+https://github.com/rust-lang/semver)",
]
[[package]]
name = "glfw-sys"
version = "3.0.4"
-source = "git+https://github.com/servo/glfw?ref=cargo-3.0.4#aa8e0d26cccdb4145f34c5a1724d7e48e0399674"
+source = "git+https://github.com/servo/glfw?ref=cargo-3.0.4#765dace7e4125b87c764f5ac0e7a80eae5c550b2"
[[package]]
name = "glfw_app"
@@ -257,22 +295,27 @@ dependencies = [
[[package]]
name = "glx"
version = "0.0.1"
-source = "git+https://github.com/servo/rust-glx#e2ce3d297260ccd23fcb4627f6ed218b68e1095f"
+source = "git+https://github.com/servo/rust-glx#7126ffa09fcfcc9f85f1406f3b5db729f5fdb7c3"
dependencies = [
"gl_generator 0.0.1 (git+https://github.com/bjz/gl-rs.git)",
]
[[package]]
+name = "green"
+version = "0.0.1"
+source = "git+https://github.com/alexcrichton/green-rs#215f3c87bf545b36a90100b7fb209ba640f2f481"
+
+[[package]]
name = "harfbuzz"
version = "0.1.0"
-source = "git+https://github.com/servo/rust-harfbuzz#ad520942cc17232e1a40cdd8a99c2905623d35f6"
+source = "git+https://github.com/servo/rust-harfbuzz#8aab215463214647b7a81f66011da552bbb1121c"
[[package]]
name = "html5ever"
version = "0.0.0"
-source = "git+https://github.com/servo/html5ever?ref=servo#0bdd6087dc8df6a92c96e1859bbb4ebbb0be7c1f"
+source = "git+https://github.com/servo/html5ever#49e9da50ed81510b1f44b4033387e6094b169141"
dependencies = [
- "html5ever_macros 0.0.0 (git+https://github.com/servo/html5ever?ref=servo)",
+ "html5ever_macros 0.0.0 (git+https://github.com/servo/html5ever)",
"phf 0.0.0 (git+https://github.com/sfackler/rust-phf)",
"phf_mac 0.0.0 (git+https://github.com/sfackler/rust-phf)",
"string_cache 0.0.0 (git+https://github.com/servo/string-cache)",
@@ -282,12 +325,12 @@ dependencies = [
[[package]]
name = "html5ever_macros"
version = "0.0.0"
-source = "git+https://github.com/servo/html5ever?ref=servo#0bdd6087dc8df6a92c96e1859bbb4ebbb0be7c1f"
+source = "git+https://github.com/servo/html5ever#49e9da50ed81510b1f44b4033387e6094b169141"
[[package]]
name = "http"
version = "0.1.0-pre"
-source = "git+https://github.com/servo/rust-http?ref=servo#5e9b063b36028a5b40a417c661ee5c628b594be9"
+source = "git+https://github.com/servo/rust-http?ref=servo#3597f981aa001c57d3c918eb9f8ab58d3f0bf5a5"
dependencies = [
"openssl 0.0.0 (git+https://github.com/sfackler/rust-openssl.git)",
"url 0.1.0 (git+https://github.com/servo/rust-url)",
@@ -296,7 +339,7 @@ dependencies = [
[[package]]
name = "io_surface"
version = "0.1.0"
-source = "git+https://github.com/servo/rust-io-surface#3f8220ab2e94651ced69b04068c5126b1adadf1f"
+source = "git+https://github.com/servo/rust-io-surface#691cbccc320c4fb9b75e215da9b0b82539d729bd"
dependencies = [
"cgl 0.0.1 (git+https://github.com/servo/rust-cgl)",
"core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation)",
@@ -307,20 +350,22 @@ dependencies = [
[[package]]
name = "js"
version = "0.1.0"
-source = "git+https://github.com/servo/rust-mozjs#1ec216a2577c03738fa11a78958bb2a0fd3f7fbd"
+source = "git+https://github.com/servo/rust-mozjs#b8109aa873d886b6ee295ea17359063da7fd3e2f"
dependencies = [
+ "green 0.0.1 (git+https://github.com/alexcrichton/green-rs)",
"mozjs-sys 0.0.0 (git+https://github.com/servo/mozjs)",
+ "rustuv 0.0.1 (git+https://github.com/alexcrichton/green-rs)",
]
[[package]]
name = "khronos_api"
version = "0.0.1"
-source = "git+https://github.com/bjz/gl-rs.git#2857ad712bd443196983ea7c0bd4b6bdcf653e7c"
+source = "git+https://github.com/bjz/gl-rs.git#79cd3b3f9f19aa0e39f6af572fc8673a6d9760bc"
[[package]]
name = "layers"
version = "0.1.0"
-source = "git+https://github.com/servo/rust-layers#3737b00270644594a95896a2cd37ffca36d5bc5f"
+source = "git+https://github.com/servo/rust-layers#36bcefcdc791bd6fa4ab389f472e449ce2e1e159"
dependencies = [
"cgl 0.0.1 (git+https://github.com/servo/rust-cgl)",
"core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation)",
@@ -336,7 +381,7 @@ dependencies = [
name = "layout"
version = "0.0.1"
dependencies = [
- "encoding 0.1.0 (git+https://github.com/lifthrasiir/rust-encoding)",
+ "encoding 0.2.0 (git+https://github.com/lifthrasiir/rust-encoding)",
"geom 0.1.0 (git+https://github.com/servo/rust-geom)",
"gfx 0.0.1",
"layout_traits 0.0.1",
@@ -365,12 +410,12 @@ dependencies = [
[[package]]
name = "lazy_static"
version = "0.1.0"
-source = "git+https://github.com/Kimundi/lazy-static.rs#e62a65372f1dd9019e37eb9381d819edff80e360"
+source = "git+https://github.com/Kimundi/lazy-static.rs#62976cb611c5396e11315ae64c9c389576240eb7"
[[package]]
name = "mozjs-sys"
version = "0.0.0"
-source = "git+https://github.com/servo/mozjs#47cd6a4e60c75642ba182f0df9a42b71ec7c2c88"
+source = "git+https://github.com/servo/mozjs#0dd618fcc78fe7aa64e4e2a3b0f7f0d8a2f0f08a"
[[package]]
name = "msg"
@@ -401,17 +446,23 @@ dependencies = [
[[package]]
name = "openssl"
version = "0.0.0"
-source = "git+https://github.com/sfackler/rust-openssl.git#a495465b75ffb18ff2303c5a11a103e00a15a13d"
+source = "git+https://github.com/sfackler/rust-openssl.git#766ce4b7785c0b038bee95b74564e5b9bf7e9a4b"
[[package]]
name = "phf"
version = "0.0.0"
-source = "git+https://github.com/sfackler/rust-phf#06254fdde7708630a6397c41c6c17ef81a4b66a0"
+source = "git+https://github.com/sfackler/rust-phf#18a5ecc028055c3dbd650cc5a064b6fb033d82ef"
+dependencies = [
+ "xxhash 0.0.1 (git+https://github.com/Jurily/rust-xxhash)",
+]
[[package]]
name = "phf_mac"
version = "0.0.0"
-source = "git+https://github.com/sfackler/rust-phf#06254fdde7708630a6397c41c6c17ef81a4b66a0"
+source = "git+https://github.com/sfackler/rust-phf#18a5ecc028055c3dbd650cc5a064b6fb033d82ef"
+dependencies = [
+ "xxhash 0.0.1 (git+https://github.com/Jurily/rust-xxhash)",
+]
[[package]]
name = "plugins"
@@ -420,7 +471,7 @@ version = "0.0.1"
[[package]]
name = "png"
version = "0.1.0"
-source = "git+https://github.com/servo/rust-png#74418ffbf20e94b0d3bed4a9d004062a13342c79"
+source = "git+https://github.com/servo/rust-png#b0b4acde0080dd475dee93615276bfc19207a21e"
dependencies = [
"png-sys 1.6.3 (git+https://github.com/servo/libpng?ref=servo)",
]
@@ -433,7 +484,16 @@ source = "git+https://github.com/servo/libpng?ref=servo#d01f32b4eb86904695efe7fc
[[package]]
name = "rust-xml"
version = "0.1.0"
-source = "git+https://github.com/netvl/rust-xml#fdc021b2bfec7855866b964f459559903c6b7808"
+source = "git+https://github.com/netvl/rust-xml#d6c57380a300b94f7e7881979dbe5459dbe4ca06"
+
+[[package]]
+name = "rustuv"
+version = "0.0.1"
+source = "git+https://github.com/alexcrichton/green-rs#215f3c87bf545b36a90100b7fb209ba640f2f481"
+dependencies = [
+ "green 0.0.1 (git+https://github.com/alexcrichton/green-rs)",
+ "tls 0.0.1 (git+https://github.com/alexcrichton/green-rs)",
+]
[[package]]
name = "script"
@@ -442,10 +502,10 @@ dependencies = [
"canvas 0.0.1",
"cssparser 0.1.0 (git+https://github.com/servo/rust-cssparser)",
"devtools_traits 0.0.1",
- "encoding 0.1.0 (git+https://github.com/lifthrasiir/rust-encoding)",
+ "encoding 0.2.0 (git+https://github.com/lifthrasiir/rust-encoding)",
"geom 0.1.0 (git+https://github.com/servo/rust-geom)",
"gfx 0.0.1",
- "html5ever 0.0.0 (git+https://github.com/servo/html5ever?ref=servo)",
+ "html5ever 0.0.0 (git+https://github.com/servo/html5ever)",
"http 0.1.0-pre (git+https://github.com/servo/rust-http?ref=servo)",
"js 0.1.0 (git+https://github.com/servo/rust-mozjs)",
"msg 0.0.1",
@@ -474,8 +534,8 @@ dependencies = [
[[package]]
name = "semver"
-version = "0.0.1"
-source = "git+https://github.com/rust-lang/semver#d04583a173395b76c1eaa15cc630a5f6f8f0ae10"
+version = "0.1.0"
+source = "git+https://github.com/rust-lang/semver#7dca047a9cd40e929a4545b37a1917daff82f156"
[[package]]
name = "servo"
@@ -484,9 +544,11 @@ dependencies = [
"compositing 0.0.1",
"gfx 0.0.1",
"glfw_app 0.0.1",
+ "green 0.0.1 (git+https://github.com/alexcrichton/green-rs)",
"layout 0.0.1",
"msg 0.0.1",
"net 0.0.1",
+ "rustuv 0.0.1 (git+https://github.com/alexcrichton/green-rs)",
"script 0.0.1",
"url 0.1.0 (git+https://github.com/servo/rust-url)",
"util 0.0.1",
@@ -495,7 +557,7 @@ dependencies = [
[[package]]
name = "skia-sys"
version = "0.0.20130412"
-source = "git+https://github.com/servo/skia#6d696712962fd0d41120b7a414a48417da8e6a92"
+source = "git+https://github.com/servo/skia#d92603043a9b7dd0b25c0b3b562099a0cc32ac6c"
dependencies = [
"expat-sys 2.1.0 (git+https://github.com/servo/libexpat)",
"freetype-sys 2.4.11 (git+https://github.com/servo/libfreetype2)",
@@ -504,22 +566,24 @@ dependencies = [
[[package]]
name = "stb_image"
version = "0.1.0"
-source = "git+https://github.com/servo/rust-stb-image#f5022de4ad6bb474a03493d1f274dde9b0f1af0c"
+source = "git+https://github.com/servo/rust-stb-image#74488fef4740acf287ff5dc248d65cc74033467a"
[[package]]
name = "string_cache"
version = "0.0.0"
-source = "git+https://github.com/servo/string-cache#97754929f38d93f6728d1f0acce8107648420e98"
+source = "git+https://github.com/servo/string-cache#ae950525434b642eff5f4904f5e0c76cd6ea99b9"
dependencies = [
+ "lazy_static 0.1.0 (git+https://github.com/Kimundi/lazy-static.rs)",
"phf 0.0.0 (git+https://github.com/sfackler/rust-phf)",
"phf_mac 0.0.0 (git+https://github.com/sfackler/rust-phf)",
"string_cache_macros 0.0.0 (git+https://github.com/servo/string-cache)",
+ "xxhash 0.0.1 (git+https://github.com/Jurily/rust-xxhash)",
]
[[package]]
name = "string_cache_macros"
version = "0.0.0"
-source = "git+https://github.com/servo/string-cache#97754929f38d93f6728d1f0acce8107648420e98"
+source = "git+https://github.com/servo/string-cache#ae950525434b642eff5f4904f5e0c76cd6ea99b9"
dependencies = [
"lazy_static 0.1.0 (git+https://github.com/Kimundi/lazy-static.rs)",
]
@@ -529,7 +593,7 @@ name = "style"
version = "0.0.1"
dependencies = [
"cssparser 0.1.0 (git+https://github.com/servo/rust-cssparser)",
- "encoding 0.1.0 (git+https://github.com/lifthrasiir/rust-encoding)",
+ "encoding 0.2.0 (git+https://github.com/lifthrasiir/rust-encoding)",
"geom 0.1.0 (git+https://github.com/servo/rust-geom)",
"lazy_static 0.1.0 (git+https://github.com/Kimundi/lazy-static.rs)",
"plugins 0.0.1",
@@ -544,11 +608,16 @@ name = "task_info"
version = "0.0.1"
[[package]]
+name = "tls"
+version = "0.0.1"
+source = "git+https://github.com/alexcrichton/green-rs#215f3c87bf545b36a90100b7fb209ba640f2f481"
+
+[[package]]
name = "url"
version = "0.1.0"
-source = "git+https://github.com/servo/rust-url#29f70a47230c2aa736e263977247c786e0b2c243"
+source = "git+https://github.com/servo/rust-url#8a61b7654ab5378b488225a1d8a9cbbbcbd38894"
dependencies = [
- "encoding 0.1.0 (git+https://github.com/lifthrasiir/rust-encoding)",
+ "encoding 0.2.0 (git+https://github.com/lifthrasiir/rust-encoding)",
]
[[package]]
@@ -566,10 +635,15 @@ dependencies = [
[[package]]
name = "uuid"
version = "0.0.1"
-source = "git+https://github.com/rust-lang/uuid#c3041068f413a5e46d795d21a346072794593839"
+source = "git+https://github.com/rust-lang/uuid#7c5af48d4f9074717199e05a1895f42b9fb1c1f0"
[[package]]
name = "xlib"
version = "0.1.0"
-source = "git+https://github.com/servo/rust-xlib#581d4faddec5188d3c3ae5307dbea28aab90644c"
+source = "git+https://github.com/servo/rust-xlib#58ec3847b592aeabdcfeb6a2d02033d3a2c7f427"
+
+[[package]]
+name = "xxhash"
+version = "0.0.1"
+source = "git+https://github.com/Jurily/rust-xxhash#7e4174e780af0cfb29a5e53ede0b987adca16396"
diff --git a/ports/cef/lib.rs b/ports/cef/lib.rs
index a13c489b790..82949696abb 100644
--- a/ports/cef/lib.rs
+++ b/ports/cef/lib.rs
@@ -5,7 +5,7 @@
#![feature(globs, macro_rules, phase, thread_local, link_args)]
#![allow(experimental, non_camel_case_types)]
-#![deny(unused_imports, unused_variable, unused_mut)]
+#![deny(unused_imports, unused_variables, unused_mut)]
#![feature(phase)]
#[phase(plugin, link)]
@@ -46,7 +46,7 @@ pub mod browser;
pub mod command_line;
pub mod core;
pub mod eutil;
-#[cfg(target_os="linux")] #[cfg(target_os="macos")]
+#[cfg(any(target_os="linux",target_os="macos"))]
pub mod mem;
pub mod request;
pub mod string;
diff --git a/ports/cef/string.rs b/ports/cef/string.rs
index d8cf7d97531..dc12ae9d8f1 100644
--- a/ports/cef/string.rs
+++ b/ports/cef/string.rs
@@ -172,7 +172,7 @@ pub extern "C" fn cef_string_utf16_cmp(a: *const cef_string_utf16_t, b: *const c
unsafe {
slice::raw::buf_as_slice(mem::transmute((*a).str), (*a).length as uint, |astr:&[u16]| {
slice::raw::buf_as_slice(mem::transmute((*b).str), (*b).length as uint, |bstr:&[u16]| {
- match astr.cmp(&bstr) {
+ match astr.cmp(bstr) {
Less => -1,
Equal => 0,
Greater => 1
diff --git a/ports/glfw/lib.rs b/ports/glfw/lib.rs
index 34476aa58fb..13babca7462 100644
--- a/ports/glfw/lib.rs
+++ b/ports/glfw/lib.rs
@@ -6,7 +6,7 @@
#![license = "MPL"]
#![feature(macro_rules)]
-#![deny(unused_imports, unused_variable)]
+#![deny(unused_imports, unused_variables)]
extern crate alert;
#[cfg(target_os="macos")]
diff --git a/ports/glfw/window.rs b/ports/glfw/window.rs
index 69f5dd1a83f..ffc2a08497e 100644
--- a/ports/glfw/window.rs
+++ b/ports/glfw/window.rs
@@ -367,7 +367,7 @@ impl Window {
}
MouseWindowMouseUpEvent(button as uint, TypedPoint2D(x as f32, y as f32))
}
- _ => fail!("I cannot recognize the type of mouse action that occured. :-(")
+ _ => panic!("I cannot recognize the type of mouse action that occured. :-(")
};
self.event_queue.borrow_mut().push(MouseWindowEventClass(event));
}
diff --git a/rust-snapshot-hash b/rust-snapshot-hash
index 15ca0275e8f..3098d8fa57d 100644
--- a/rust-snapshot-hash
+++ b/rust-snapshot-hash
@@ -1 +1 @@
-d2b30f7d3883a9f5d2e419d3d2c86cb66e9d3410/rust-0.12.0-pre
+b03a2755193cd756583bcf5831cf4545d75ecb8a/rust-0.13.0-dev
diff --git a/src/lib.rs b/src/lib.rs
index 9ad58e1a71a..51297269a9b 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -7,13 +7,12 @@
#![feature(globs, macro_rules, phase, thread_local)]
-#![deny(unused_imports, unused_variable)]
+#![deny(unused_imports)]
+#![deny(unused_variables)]
#[phase(plugin, link)]
extern crate log;
-extern crate debug;
-
extern crate compositing;
extern crate devtools;
extern crate rustuv;
@@ -72,12 +71,17 @@ pub struct Browser<Window> {
impl<Window> Browser<Window> where Window: WindowMethods + 'static {
#[cfg(not(test))]
pub fn new(window: Option<Rc<Window>>) -> Browser<Window> {
+ use rustuv::EventLoop;
+ fn event_loop() -> Box<green::EventLoop + Send> {
+ box EventLoop::new().unwrap() as Box<green::EventLoop + Send>
+ }
+
::servo_util::opts::set_experimental_enabled(opts::get().enable_experimental);
let opts = opts::get();
RegisterBindings::RegisterProxyHandlers();
let mut pool_config = green::PoolConfig::new();
- pool_config.event_loop_factory = rustuv::event_loop;
+ pool_config.event_loop_factory = event_loop;
let mut pool = green::SchedPool::new(pool_config);
let shared_task_pool = TaskPool::new(8);
@@ -125,7 +129,7 @@ impl<Window> Browser<Window> where Window: WindowMethods + 'static {
Ok(url) => url,
Err(url::RelativeUrlWithoutBase)
=> url::Url::from_file_path(&cwd.join(url.as_slice())).unwrap(),
- Err(_) => fail!("URL parsing failed"),
+ Err(_) => panic!("URL parsing failed"),
};
let ConstellationChan(ref chan) = constellation_chan;
diff --git a/src/main.rs b/src/main.rs
index bd0fc1b8662..34c4d195000 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -5,38 +5,39 @@
#![comment = "The Servo Parallel Browser Project"]
#![license = "MPL"]
-#![deny(unused_imports, unused_variable)]
+#![deny(unused_imports)]
+#![deny(unused_variables)]
extern crate servo;
extern crate native;
extern crate time;
extern crate "util" as servo_util;
-#[cfg(not(test),not(target_os="android"))]
+#[cfg(not(any(test,target_os="android")))]
extern crate glfw_app;
-#[cfg(not(test),not(target_os="android"))]
+#[cfg(not(any(test,target_os="android")))]
extern crate compositing;
-#[cfg(not(test),not(target_os="android"))]
+#[cfg(not(any(test,target_os="android")))]
use servo_util::opts;
-#[cfg(not(test),not(target_os="android"))]
+#[cfg(not(any(test,target_os="android")))]
use servo_util::rtinstrument;
-#[cfg(not(test),not(target_os="android"))]
+#[cfg(not(any(test,target_os="android")))]
use servo::Browser;
-#[cfg(not(test),not(target_os="android"))]
+#[cfg(not(any(test,target_os="android")))]
use compositing::windowing::{IdleWindowEvent, ResizeWindowEvent, WindowEvent};
-#[cfg(not(test),not(target_os="android"))]
+#[cfg(not(any(test,target_os="android")))]
use std::os;
-#[cfg(not(test),not(target_os="android"))]
+#[cfg(not(any(test,target_os="android")))]
struct BrowserWrapper {
browser: Browser<glfw_app::window::Window>,
}
-#[cfg(not(test), not(target_os="android"))]
+#[cfg(not(any(test,target_os="android")))]
#[start]
#[allow(dead_code)]
fn start(argc: int, argv: *const *const u8) -> int {
@@ -93,10 +94,7 @@ fn start(argc: int, argv: *const *const u8) -> int {
})
}
-#[cfg(not(test), target_os="android")]
-fn main() {}
-
-#[cfg(not(test),not(target_os="android"))]
+#[cfg(not(any(test,target_os="android")))]
impl glfw_app::NestedEventLoopListener for BrowserWrapper {
fn handle_event_from_nested_event_loop(&mut self, event: WindowEvent) -> bool {
let is_resize = match event {
diff --git a/support/glfw-rs b/support/glfw-rs
deleted file mode 160000
-Subproject 8edf667fbf289d909c7d1bdde03acf6d7816867
diff --git a/tests/contenttest.rs b/tests/contenttest.rs
index 9c04851bb87..d166934a82f 100644
--- a/tests/contenttest.rs
+++ b/tests/contenttest.rs
@@ -7,7 +7,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-#![deny(unused_imports, unused_variable)]
+#![deny(unused_imports)]
+#![deny(unused_variables)]
extern crate getopts;
extern crate regex;
@@ -44,7 +45,7 @@ fn parse_config(args: Vec<String>) -> Config {
let opts = vec!(reqopt("s", "source-dir", "source-dir", "source-dir"));
let matches = match getopts(args, opts.as_slice()) {
Ok(m) => m,
- Err(f) => fail!(format!("{}", f))
+ Err(f) => panic!(format!("{}", f))
};
Config {
@@ -73,7 +74,7 @@ fn find_tests(config: Config) -> Vec<TestDescAndFn> {
let files_res = fs::readdir(&Path::new(config.source_dir));
let mut files = match files_res {
Ok(files) => files,
- _ => fail!("Error reading directory."),
+ _ => panic!("Error reading directory."),
};
files.retain(|file| file.extension_str() == Some("html") );
return files.iter().map(|file| make_test(format!("{}", file.display()))).collect();
@@ -106,7 +107,7 @@ fn run_test(file: String) {
.spawn()
{
Ok(p) => p,
- _ => fail!("Unable to spawn process."),
+ _ => panic!("Unable to spawn process."),
};
let mut output = Vec::new();
loop {
@@ -124,12 +125,12 @@ fn run_test(file: String) {
let lines: Vec<&str> = out.unwrap().split('\n').collect();
for &line in lines.iter() {
if line.contains("TEST-UNEXPECTED-FAIL") {
- fail!(line.to_string());
+ panic!(line.to_string());
}
}
let retval = prc.wait();
if retval != Ok(ExitStatus(0)) {
- fail!("Servo exited with non-zero status {}", retval);
+ panic!("Servo exited with non-zero status {}", retval);
}
}
diff --git a/tests/reftest.rs b/tests/reftest.rs
index 490fa1a2374..c7bd88fcbbb 100644
--- a/tests/reftest.rs
+++ b/tests/reftest.rs
@@ -7,14 +7,15 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-#![deny(unused_imports, unused_variable)]
+#![deny(unused_imports)]
+#![deny(unused_variables)]
extern crate png;
extern crate test;
extern crate regex;
extern crate url;
-use std::ascii::StrAsciiExt;
+use std::ascii::AsciiExt;
use std::io;
use std::io::{File, Reader, Command};
use std::io::process::ExitStatus;
@@ -29,11 +30,11 @@ use url::Url;
bitflags!(
flags RenderMode: u32 {
- static CpuRendering = 0x00000001,
- static GpuRendering = 0x00000010,
- static LinuxTarget = 0x00000100,
- static MacOsTarget = 0x00001000,
- static AndroidTarget = 0x00010000
+ const CPU_RENDERING = 0x00000001,
+ const GPU_RENDERING = 0x00000010,
+ const LINUX_TARGET = 0x00000100,
+ const MACOS_TARGET = 0x00001000,
+ const ANDROID_TARGET = 0x00010000
}
)
@@ -46,24 +47,24 @@ fn main() {
let servo_args = parts.next().unwrap_or(&[]);
let (render_mode_string, base_path, testname) = match harness_args {
- [] | [_] => fail!("USAGE: cpu|gpu base_path [testname regex]"),
+ [] | [_] => panic!("USAGE: cpu|gpu base_path [testname regex]"),
[ref render_mode_string, ref base_path] => (render_mode_string, base_path, None),
[ref render_mode_string, ref base_path, ref testname, ..] => (render_mode_string, base_path, Some(Regex::new(testname.as_slice()).unwrap())),
};
let mut render_mode = match render_mode_string.as_slice() {
- "cpu" => CpuRendering,
- "gpu" => GpuRendering,
- _ => fail!("First argument must specify cpu or gpu as rendering mode")
+ "cpu" => CPU_RENDERING,
+ "gpu" => GPU_RENDERING,
+ _ => panic!("First argument must specify cpu or gpu as rendering mode")
};
if cfg!(target_os = "linux") {
- render_mode.insert(LinuxTarget);
+ render_mode.insert(LINUX_TARGET);
}
if cfg!(target_os = "macos") {
- render_mode.insert(MacOsTarget);
+ render_mode.insert(MACOS_TARGET);
}
if cfg!(target_os = "android") {
- render_mode.insert(AndroidTarget);
+ render_mode.insert(ANDROID_TARGET);
}
let mut all_tests = vec!();
@@ -156,13 +157,13 @@ fn parse_lists(file: &Path, servo_args: &[String], render_mode: RenderMode, id_o
file_left: parts[2],
file_right: parts[3],
},
- _ => fail!("reftest line: '{:s}' doesn't match '[CONDITIONS] KIND LEFT RIGHT'", line),
+ _ => panic!("reftest line: '{:s}' doesn't match '[CONDITIONS] KIND LEFT RIGHT'", line),
};
let kind = match test_line.kind {
"==" => Same,
"!=" => Different,
- part => fail!("reftest line: '{:s}' has invalid kind '{:s}'", line, part)
+ part => panic!("reftest line: '{:s}' has invalid kind '{:s}'", line, part)
};
let base = file.dir_path();
let file_left = base.join(test_line.file_left);
@@ -174,10 +175,10 @@ fn parse_lists(file: &Path, servo_args: &[String], render_mode: RenderMode, id_o
let mut fragment_identifier = None;
for condition in conditions_list {
match condition {
- "flaky_cpu" => flakiness.insert(CpuRendering),
- "flaky_gpu" => flakiness.insert(GpuRendering),
- "flaky_linux" => flakiness.insert(LinuxTarget),
- "flaky_macos" => flakiness.insert(MacOsTarget),
+ "flaky_cpu" => flakiness.insert(CPU_RENDERING),
+ "flaky_gpu" => flakiness.insert(GPU_RENDERING),
+ "flaky_linux" => flakiness.insert(LINUX_TARGET),
+ "flaky_macos" => flakiness.insert(MACOS_TARGET),
"experimental" => experimental = true,
_ => (),
}
@@ -233,10 +234,10 @@ fn capture(reftest: &Reftest, side: uint) -> (u32, u32, Vec<u8>) {
url.to_string()
});
// CPU rendering is the default
- if reftest.render_mode.contains(CpuRendering) {
+ if reftest.render_mode.contains(CPU_RENDERING) {
command.arg("-c");
}
- if reftest.render_mode.contains(GpuRendering) {
+ if reftest.render_mode.contains(GPU_RENDERING) {
command.arg("-g");
}
if reftest.experimental {
@@ -244,14 +245,14 @@ fn capture(reftest: &Reftest, side: uint) -> (u32, u32, Vec<u8>) {
}
let retval = match command.status() {
Ok(status) => status,
- Err(e) => fail!("failed to execute process: {}", e),
+ Err(e) => panic!("failed to execute process: {}", e),
};
assert_eq!(retval, ExitStatus(0));
let image = png::load_png(&from_str::<Path>(png_filename.as_slice()).unwrap()).unwrap();
let rgba8_bytes = match image.pixels {
png::RGBA8(pixels) => pixels,
- _ => fail!(),
+ _ => panic!(),
};
(image.width, image.height, rgba8_bytes)
}
@@ -267,7 +268,7 @@ fn check_reftest(reftest: Reftest) {
let right_all_white = right_bytes.iter().all(|&p| p == 255);
if left_all_white && right_all_white {
- fail!("Both renderings are empty")
+ panic!("Both renderings are empty")
}
let pixels = left_bytes.iter().zip(right_bytes.iter()).map(|(&a, &b)| {
@@ -297,7 +298,7 @@ fn check_reftest(reftest: Reftest) {
match (reftest.kind, reftest.is_flaky) {
(Same, true) => println!("flaky test - rendering difference: {}", output_str),
- (Same, false) => fail!("rendering difference: {}", output_str),
+ (Same, false) => panic!("rendering difference: {}", output_str),
(Different, _) => {} // Result was different and that's what was expected
}
} else {