Bug 1492880. Update Cargo lockfiles and re-vendor rust dependencies
authorJeff Muizelaar <jmuizelaar@mozilla.com>
Thu, 20 Sep 2018 23:29:49 -0400
changeset 437561 4a4ccba9abe32f8dc2ca8eba0da0d064ef7e37cc
parent 437560 d6bea517aec2a034b9eafc31c0934fd57fc2c3f8
child 437562 096b1dc47d712a49daf361f17fa4f569cfae8050
push id108098
push userjmuizelaar@mozilla.com
push dateFri, 21 Sep 2018 03:30:26 +0000
treeherdermozilla-inbound@096b1dc47d71 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1492880
milestone64.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1492880. Update Cargo lockfiles and re-vendor rust dependencies
Cargo.lock
third_party/rust/core-graphics/.cargo-checksum.json
third_party/rust/core-graphics/Cargo.toml
third_party/rust/core-graphics/src/color.rs
third_party/rust/core-graphics/src/color_space.rs
third_party/rust/core-graphics/src/context.rs
third_party/rust/core-graphics/src/data_provider.rs
third_party/rust/core-graphics/src/display.rs
third_party/rust/core-graphics/src/geometry.rs
third_party/rust/core-graphics/src/image.rs
third_party/rust/core-graphics/src/lib.rs
third_party/rust/core-graphics/src/path.rs
third_party/rust/core-graphics/src/sys.rs
third_party/rust/core-text/.cargo-checksum.json
third_party/rust/core-text/Cargo.toml
third_party/rust/core-text/src/font.rs
third_party/rust/core-text/src/font_collection.rs
third_party/rust/core-text/src/font_descriptor.rs
third_party/rust/core-text/src/font_manager.rs
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -354,32 +354,32 @@ dependencies = [
 
 [[package]]
 name = "core-foundation-sys"
 version = "0.6.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 
 [[package]]
 name = "core-graphics"
-version = "0.16.0"
+version = "0.17.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
  "core-foundation 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "foreign-types 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
 name = "core-text"
-version = "11.0.0"
+version = "13.0.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "core-foundation 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "core-graphics 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "core-graphics 0.17.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "foreign-types 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
 name = "cose"
 version = "0.1.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -2636,18 +2636,18 @@ name = "webrender"
 version = "0.57.2"
 dependencies = [
  "app_units 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "bincode 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
  "byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
  "core-foundation 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "core-graphics 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "core-text 11.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "core-graphics 0.17.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "core-text 13.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "dwrote 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
  "euclid 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "freetype 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "gleam 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "lazy_static 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
  "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -2665,33 +2665,33 @@ dependencies = [
 name = "webrender_api"
 version = "0.57.2"
 dependencies = [
  "app_units 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "bincode 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
  "byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "core-foundation 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "core-graphics 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "core-graphics 0.17.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "dwrote 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
  "euclid 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "serde 1.0.66 (registry+https://github.com/rust-lang/crates.io-index)",
  "serde_bytes 0.10.4 (registry+https://github.com/rust-lang/crates.io-index)",
  "serde_derive 1.0.66 (git+https://github.com/servo/serde?branch=deserialize_from_enums8)",
  "time 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
 name = "webrender_bindings"
 version = "0.1.0"
 dependencies = [
  "app_units 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "bincode 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "core-foundation 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "core-graphics 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "core-graphics 0.17.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "dwrote 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
  "euclid 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "foreign-types 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "gleam 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
  "nsstring 0.1.0",
  "rayon 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -2850,18 +2850,18 @@ dependencies = [
 "checksum cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d4c819a1287eb618df47cc647173c5c4c66ba19d888a6e50d605672aed3140de"
 "checksum chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "45912881121cb26fad7c38c17ba7daa18764771836b34fab7d3fbd93ed633878"
 "checksum clang-sys 0.23.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d7f7c04e52c35222fffcc3a115b5daf5f7e2bfb71c13c4e2321afe1fc71859c2"
 "checksum clap 2.31.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f0f16b89cbb9ee36d87483dc939fe9f1e13c05898d56d7b230a0d4dff033a536"
 "checksum cmake 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)" = "56d741ea7a69e577f6d06b36b7dff4738f680593dc27a701ffa8506b73ce28bb"
 "checksum cookie 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1465f8134efa296b4c19db34d909637cb2bf0f7aaf21299e23e18fa29ac557cf"
 "checksum core-foundation 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c7caa6cb9e76ddddbea09a03266d6b3bc98cd41e9fb9b017c473e7cca593ec25"
 "checksum core-foundation-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b2a53cce0ddcf7e7e1f998738d757d5a3bf08bf799a180e50ebe50d298f52f5a"
-"checksum core-graphics 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)" = "92801c908ea6301ae619ed842a72e01098085fc321b9c2f3f833dad555bba055"
-"checksum core-text 11.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "157ff38a92496dc676ce36d9124554e9ac66f1c1039f952690ac64f71cfa5968"
+"checksum core-graphics 0.17.1 (registry+https://github.com/rust-lang/crates.io-index)" = "62ceafe1622ffc9a332199096841d0ff9912ec8cf8f9cde01e254a7d5217cd10"
+"checksum core-text 13.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f3f46450d6f2397261af420b4ccce23807add2e45fa206410a03d66fb7f050ae"
 "checksum cose 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "72fa26cb151d3ae4b70f63d67d0fed57ce04220feafafbae7f503bef7aae590d"
 "checksum cose-c 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "49726015ab0ca765144fcca61e4a7a543a16b795a777fa53f554da2fffff9a94"
 "checksum crc 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bd5d02c0aac6bd68393ed69e00bbc2457f3e89075c6349db7189618dc4ddc1d7"
 "checksum crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f739f8c5363aca78cfb059edf753d8f0d36908c348f3d8d1503f03d8b75d9cf3"
 "checksum crossbeam-deque 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fe8153ef04a7594ded05b427ffad46ddeaf22e63fd48d42b3e1e3bb4db07cae7"
 "checksum crossbeam-epoch 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "927121f5407de9956180ff5e936fe3cf4324279280001cd56b669d28ee7e9150"
 "checksum crossbeam-epoch 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2af0e75710d6181e234c8ecc79f14a97907850a541b13b0be1dd10992f2e4620"
 "checksum crossbeam-utils 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2760899e32a1d58d5abb31129f8fae5de75220bc2176e77ff7c627ae45c918d9"
--- a/third_party/rust/core-graphics/.cargo-checksum.json
+++ b/third_party/rust/core-graphics/.cargo-checksum.json
@@ -1,1 +1,1 @@
-{"files":{".travis.yml":"b71b9a6f84b9263b2b89be6ec90dff5920ee68cf9e5768d73ed71957de2d0670","COPYRIGHT":"ec82b96487e9e778ee610c7ab245162464782cfa1f555c2299333f8dbe5c036a","Cargo.toml":"e191715db0c5bf37d5981f2a3b7ae5d0e53ab9cc39f2438d31e798b1fbf3ddec","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"62065228e42caebca7e7d7db1204cbb867033de5982ca4009928915e4095f3a3","README.md":"4a45abeb1e684e30bb361dfa7db59189423348e18d310cbae694b7c8c57cd86a","src/base.rs":"5faaadaf17d93c370a20f358be6c3f12958ab7d3f99ccc634421e28758fec88b","src/color_space.rs":"bada04ad391869474428070ad9ae5dbb5e7f5e03646226fab0b03e8e84240bfa","src/context.rs":"6cc8d083eea0d73ece30c1c405a74b43ca3f3a8f55917cdcd27c238a393f3de2","src/data_provider.rs":"258fef8d18ba4a79e7dbe7c23a41401924efa0c159e178f0bd9fa7c4ff9f131a","src/display.rs":"3ca38e1ff0200409c95941fcb64afa043310d1c0855c7614fd236c4f83e5a343","src/event.rs":"f2ade1c2c112bae7bc4f5df1eda63c13d1c32e5db255228f139ce17fb37c1a4b","src/event_source.rs":"d55a4f5b5e62789325028febc51bbf54c74b15ab1a4e70c6ad749a2f9753e081","src/font.rs":"63b7e50243a56254c800421df586abee59aead84f735f7df838ae04693aedf4b","src/geometry.rs":"b94e50a16b8540dc6f37bfe4b1549ac68974cd6ba6c0bbd9209559f8a46d86eb","src/image.rs":"40e744f28ef338b4c0138e05e0e191411518611bedb19deea2aa3a6e59f36567","src/lib.rs":"19d5e558cec5596d546f1753529a8e3cf951993f4500ee12fad0d7eb2dc86bc8","src/path.rs":"405032914ef806ac2d2e0ccda5987ed3176bfec0e2e8bd409b176a9c23f49885","src/private.rs":"da3fd61338bab2d8e26aa5433b2e18ecd2a0a408c62e1ac2b33a0f87f2dad88a","src/sys.rs":"27e00f7ad7645af05014f35939128833456cac766a2978c5da295c3757708a86"},"package":"92801c908ea6301ae619ed842a72e01098085fc321b9c2f3f833dad555bba055"}
\ No newline at end of file
+{"files":{".travis.yml":"b71b9a6f84b9263b2b89be6ec90dff5920ee68cf9e5768d73ed71957de2d0670","COPYRIGHT":"ec82b96487e9e778ee610c7ab245162464782cfa1f555c2299333f8dbe5c036a","Cargo.toml":"c30c4f657ed844adb3f412f758ce2bff9c62b83c8ec844cc447e24d785d18dba","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"62065228e42caebca7e7d7db1204cbb867033de5982ca4009928915e4095f3a3","README.md":"4a45abeb1e684e30bb361dfa7db59189423348e18d310cbae694b7c8c57cd86a","src/base.rs":"5faaadaf17d93c370a20f358be6c3f12958ab7d3f99ccc634421e28758fec88b","src/color.rs":"b054b38b507733c8c3f5af981483c54836e8a7499a6d1a22244fb58312824acb","src/color_space.rs":"b3d7ee8a21703c789160867cb8eb2188bd1daa193e3d030f21adb6f1a6f872de","src/context.rs":"6b14ec712e5d0af4af6beb0cb1a998bf1262ec6ab6ad2b3efad9e0362ade83c9","src/data_provider.rs":"22614a6ce7f857dec33e6d2dc01261b71b1bc5d5609a54ee55e04c049670c072","src/display.rs":"5b04d1fded021fc1eecb89b6350a66f6668e802b51e75cf69892ca082257443c","src/event.rs":"f2ade1c2c112bae7bc4f5df1eda63c13d1c32e5db255228f139ce17fb37c1a4b","src/event_source.rs":"d55a4f5b5e62789325028febc51bbf54c74b15ab1a4e70c6ad749a2f9753e081","src/font.rs":"63b7e50243a56254c800421df586abee59aead84f735f7df838ae04693aedf4b","src/geometry.rs":"cdeb9624df601d235bcc34d46e35bea302079ce1e3668253356a618486693a9f","src/image.rs":"0af720ee020fb1c6a2f4b1ce49e3d27f8f21f0be6b81ba4b9c824f87564efa58","src/lib.rs":"03628fc67576f6948bb803a53fb147c520b264eaba684e37d26cd1b0197ebf30","src/path.rs":"c429afeaed999b02ac00f89a867b5fc64f1e223039079a4e0529306b734ff117","src/private.rs":"da3fd61338bab2d8e26aa5433b2e18ecd2a0a408c62e1ac2b33a0f87f2dad88a","src/sys.rs":"cc90b690f172da51a87ffb234f6e74a9f501c4f1630d7b51fa2d5846e80fc164"},"package":"62ceafe1622ffc9a332199096841d0ff9912ec8cf8f9cde01e254a7d5217cd10"}
\ No newline at end of file
--- a/third_party/rust/core-graphics/Cargo.toml
+++ b/third_party/rust/core-graphics/Cargo.toml
@@ -7,17 +7,17 @@
 #
 # If you believe there's an error in this file please file an
 # issue against the rust-lang/cargo repository. If you're
 # editing this file be aware that the upstream Cargo.toml
 # will likely look very different (and much more reasonable)
 
 [package]
 name = "core-graphics"
-version = "0.16.0"
+version = "0.17.1"
 authors = ["The Servo Project Developers"]
 description = "Bindings to Core Graphics for OS X"
 homepage = "https://github.com/servo/core-graphics-rs"
 license = "MIT / Apache-2.0"
 repository = "https://github.com/servo/core-foundation-rs"
 [dependencies.bitflags]
 version = "1.0"
 
new file mode 100644
--- /dev/null
+++ b/third_party/rust/core-graphics/src/color.rs
@@ -0,0 +1,33 @@
+// Copyright 2013 The Servo Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use core_foundation::base::{CFTypeID};
+use base::CGFloat;
+use core_foundation::base::TCFType;
+use super::sys::{CGColorRef};
+
+declare_TCFType!{
+    CGColor, CGColorRef
+}
+impl_TCFType!(CGColor, CGColorRef, CGColorGetTypeID);
+
+impl CGColor {
+    pub fn rgb(red: CGFloat, green: CGFloat, blue: CGFloat, alpha: CGFloat) -> Self {
+        unsafe { 
+            let ptr = CGColorCreateGenericRGB(red, green, blue, alpha);
+            CGColor::wrap_under_create_rule(ptr)
+        }
+    }
+}
+
+#[link(name = "CoreGraphics", kind = "framework")]
+extern {
+    fn CGColorCreateGenericRGB(red: CGFloat, green: CGFloat, blue: CGFloat, alpha: CGFloat) -> ::sys::CGColorRef;
+    fn CGColorGetTypeID() -> CFTypeID;
+}
--- a/third_party/rust/core-graphics/src/color_space.rs
+++ b/third_party/rust/core-graphics/src/color_space.rs
@@ -29,31 +29,41 @@ impl CGColorSpace {
 
     pub fn create_with_name(name: CFStringRef) -> Option<CGColorSpace> {
         unsafe {
             let p = CGColorSpaceCreateWithName(name);
             if !p.is_null() {Some(CGColorSpace::from_ptr(p))} else {None}
         }
     }
 
+    #[inline]
     pub fn create_device_rgb() -> CGColorSpace {
         unsafe {
             let result = CGColorSpaceCreateDeviceRGB();
             CGColorSpace::from_ptr(result)
         }
     }
+
+    #[inline]
+    pub fn create_device_gray() -> CGColorSpace {
+        unsafe {
+            let result = CGColorSpaceCreateDeviceGray();
+            CGColorSpace::from_ptr(result)
+        }
+    }
 }
 
 #[link(name = "CoreGraphics", kind = "framework")]
 extern {
     pub static kCGColorSpaceSRGB: CFStringRef;
     pub static kCGColorSpaceAdobeRGB1998: CFStringRef;
     pub static kCGColorSpaceGenericGray: CFStringRef;
     pub static kCGColorSpaceGenericRGB: CFStringRef;
     pub static kCGColorSpaceGenericCMYK: CFStringRef;
     pub static kCGColorSpaceGenericRGBLinear: CFStringRef;
     pub static kCGColorSpaceGenericGrayGamma2_2: CFStringRef;
 
     fn CGColorSpaceCreateDeviceRGB() -> ::sys::CGColorSpaceRef;
+    fn CGColorSpaceCreateDeviceGray() -> ::sys::CGColorSpaceRef;
     fn CGColorSpaceCreateWithName(name: CFStringRef) -> ::sys::CGColorSpaceRef;
     fn CGColorSpaceGetTypeID() -> CFTypeID;
 }
 
--- a/third_party/rust/core-graphics/src/context.rs
+++ b/third_party/rust/core-graphics/src/context.rs
@@ -4,28 +4,64 @@
 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
 use base::CGFloat;
 use color_space::CGColorSpace;
-use core_foundation::base::{CFRelease, CFRetain, CFTypeID};
+use core_foundation::base::{ToVoid, CFRelease, CFRetain, CFTypeID};
 use font::{CGFont, CGGlyph};
 use geometry::CGPoint;
+use color::CGColor;
+use path::CGPathRef;
 use libc::{c_int, size_t};
 use std::os::raw::c_void;
 
 use std::cmp;
 use std::ptr;
 use std::slice;
 use geometry::{CGAffineTransform, CGRect};
 use image::CGImage;
-use foreign_types::ForeignType;
+use foreign_types::{ForeignType, ForeignTypeRef};
+
+#[repr(C)]
+#[derive(Clone, Copy, Debug)]
+pub enum CGBlendMode {
+    Normal = 0,
+    Multiply,
+    Screen,
+    Overlay,
+    Darken,
+    Lighten,
+    ColorDodge,
+    ColorBurn,
+    SoftLight,
+    HardLight,
+    Difference,
+    Exclusion,
+    Hue,
+    Saturation,
+    Color,
+    Luminosity,
+    // 10.5 and up:
+    Clear,
+    Copy,
+    SourceIn,
+    SourceOut,
+    SourceAtop,
+    DestinationOver,
+    DestinationIn,
+    DestinationOut,
+    DestinationAtop,
+    Xor,
+    PlusDarker,
+    PlusLighter,
+}
 
 #[repr(C)]
 pub enum CGTextDrawingMode {
     CGTextFill,
     CGTextStroke,
     CGTextFillStroke,
     CGTextInvisible,
     CGTextFillClip,
@@ -72,16 +108,24 @@ impl CGContext {
 
     pub fn data(&mut self) -> &mut [u8] {
         unsafe {
             slice::from_raw_parts_mut(
                     CGBitmapContextGetData(self.as_ptr()) as *mut u8,
                     (self.height() * self.bytes_per_row()) as usize)
         }
     }
+}
+
+impl CGContextRef {
+    pub fn flush(&self) {
+        unsafe {
+            CGContextFlush(self.as_ptr())
+        }
+    }
 
     pub fn width(&self) -> size_t {
         unsafe {
             CGBitmapContextGetWidth(self.as_ptr())
         }
     }
 
     pub fn height(&self) -> size_t {
@@ -91,22 +135,40 @@ impl CGContext {
     }
 
     pub fn bytes_per_row(&self) -> size_t {
         unsafe {
             CGBitmapContextGetBytesPerRow(self.as_ptr())
         }
     }
 
+    pub fn set_fill_color(&self, color: &CGColor) {
+        unsafe {
+            CGContextSetFillColorWithColor(self.as_ptr(), color.to_void());
+        }
+    }
+
     pub fn set_rgb_fill_color(&self, red: CGFloat, green: CGFloat, blue: CGFloat, alpha: CGFloat) {
         unsafe {
             CGContextSetRGBFillColor(self.as_ptr(), red, green, blue, alpha)
         }
     }
 
+    pub fn set_gray_fill_color(&self, gray: CGFloat, alpha: CGFloat) {
+        unsafe {
+            CGContextSetGrayFillColor(self.as_ptr(), gray, alpha)
+        }
+    }
+
+    pub fn set_blend_mode(&self, blend_mode: CGBlendMode) {
+        unsafe {
+            CGContextSetBlendMode(self.as_ptr(), blend_mode)
+        }
+    }
+
     pub fn set_allows_font_smoothing(&self, allows_font_smoothing: bool) {
         unsafe {
             CGContextSetAllowsFontSmoothing(self.as_ptr(), allows_font_smoothing)
         }
     }
 
     pub fn set_font_smoothing_style(&self, style: i32) {
         unsafe {
@@ -157,16 +219,34 @@ impl CGContext {
     }
 
     pub fn set_text_drawing_mode(&self, mode: CGTextDrawingMode) {
         unsafe {
             CGContextSetTextDrawingMode(self.as_ptr(), mode)
         }
     }
 
+    pub fn add_path(&self, path: &CGPathRef) {
+        unsafe {
+            CGContextAddPath(self.as_ptr(), path.as_ptr());
+        }
+    }
+
+    pub fn close_path(&self) {
+        unsafe {
+            CGContextClosePath(self.as_ptr());
+        }
+    }
+
+    pub fn fill_path(&self) {
+        unsafe {
+            CGContextFillPath(self.as_ptr());
+        }
+    }
+
     pub fn fill_rect(&self, rect: CGRect) {
         unsafe {
             CGContextFillRect(self.as_ptr(), rect)
         }
     }
 
     pub fn draw_image(&self, rect: CGRect, image: &CGImage) {
         unsafe {
@@ -205,16 +285,40 @@ impl CGContext {
         unsafe {
             let count = cmp::min(glyphs.len(), positions.len());
             CGContextShowGlyphsAtPositions(self.as_ptr(),
                                            glyphs.as_ptr(),
                                            positions.as_ptr(),
                                            count)
         }
     }
+
+    pub fn save(&self) {
+        unsafe {
+            CGContextSaveGState(self.as_ptr());
+        }
+    }
+
+    pub fn restore(&self) {
+        unsafe {
+            CGContextRestoreGState(self.as_ptr());
+        }
+    }
+
+    pub fn translate(&self, tx: CGFloat, ty: CGFloat) {
+        unsafe {
+            CGContextTranslateCTM(self.as_ptr(), tx, ty);
+        }
+    }
+
+    pub fn scale(&self, sx: CGFloat, sy: CGFloat) {
+        unsafe {
+            CGContextScaleCTM(self.as_ptr(), sx, sy);
+        }
+    }
 }
 
 #[test]
 fn create_bitmap_context_test() {
     use geometry::*;
 
     let cs = CGColorSpace::create_device_rgb();
     let ctx = CGContext::create_bitmap_context(None,
@@ -247,39 +351,51 @@ extern {
                              bitmapInfo: u32)
                              -> ::sys::CGContextRef;
     fn CGBitmapContextGetData(context: ::sys::CGContextRef) -> *mut c_void;
     fn CGBitmapContextGetWidth(context: ::sys::CGContextRef) -> size_t;
     fn CGBitmapContextGetHeight(context: ::sys::CGContextRef) -> size_t;
     fn CGBitmapContextGetBytesPerRow(context: ::sys::CGContextRef) -> size_t;
     fn CGBitmapContextCreateImage(context: ::sys::CGContextRef) -> ::sys::CGImageRef;
     fn CGContextGetTypeID() -> CFTypeID;
+    fn CGContextFlush(c: ::sys::CGContextRef);
+    fn CGContextSetBlendMode(c: ::sys::CGContextRef, blendMode: CGBlendMode);
     fn CGContextSetAllowsFontSmoothing(c: ::sys::CGContextRef, allowsFontSmoothing: bool);
     fn CGContextSetShouldSmoothFonts(c: ::sys::CGContextRef, shouldSmoothFonts: bool);
     fn CGContextSetFontSmoothingStyle(c: ::sys::CGContextRef, style: c_int);
     fn CGContextSetAllowsAntialiasing(c: ::sys::CGContextRef, allowsAntialiasing: bool);
     fn CGContextSetShouldAntialias(c: ::sys::CGContextRef, shouldAntialias: bool);
     fn CGContextSetAllowsFontSubpixelQuantization(c: ::sys::CGContextRef,
                                                   allowsFontSubpixelQuantization: bool);
     fn CGContextSetShouldSubpixelQuantizeFonts(c: ::sys::CGContextRef,
                                                shouldSubpixelQuantizeFonts: bool);
     fn CGContextSetAllowsFontSubpixelPositioning(c: ::sys::CGContextRef,
                                                  allowsFontSubpixelPositioning: bool);
     fn CGContextSetShouldSubpixelPositionFonts(c: ::sys::CGContextRef,
                                                shouldSubpixelPositionFonts: bool);
     fn CGContextSetTextDrawingMode(c: ::sys::CGContextRef, mode: CGTextDrawingMode);
+    fn CGContextSetFillColorWithColor(c: ::sys::CGContextRef, color: *const c_void);
+    fn CGContextAddPath(c: ::sys::CGContextRef, path: ::sys::CGPathRef);
+    fn CGContextClosePath(c: ::sys::CGContextRef);
+    fn CGContextFillPath(c: ::sys::CGContextRef);
     fn CGContextSetRGBFillColor(context: ::sys::CGContextRef,
                                 red: CGFloat,
                                 green: CGFloat,
                                 blue: CGFloat,
                                 alpha: CGFloat);
+    fn CGContextSetGrayFillColor(context: ::sys::CGContextRef, gray: CGFloat, alpha: CGFloat);
     fn CGContextFillRect(context: ::sys::CGContextRef,
                          rect: CGRect);
     fn CGContextDrawImage(c: ::sys::CGContextRef, rect: CGRect, image: ::sys::CGImageRef);
     fn CGContextSetFont(c: ::sys::CGContextRef, font: ::sys::CGFontRef);
     fn CGContextSetFontSize(c: ::sys::CGContextRef, size: CGFloat);
     fn CGContextSetTextMatrix(c: ::sys::CGContextRef, t: CGAffineTransform);
     fn CGContextShowGlyphsAtPositions(c: ::sys::CGContextRef,
                                       glyphs: *const CGGlyph,
                                       positions: *const CGPoint,
                                       count: size_t);
+
+    fn CGContextSaveGState(c: ::sys::CGContextRef);
+    fn CGContextRestoreGState(c: ::sys::CGContextRef);
+    fn CGContextTranslateCTM(c: ::sys::CGContextRef, tx: CGFloat, ty: CGFloat);
+    fn CGContextScaleCTM(c: ::sys::CGContextRef, sx: CGFloat, sy: CGFloat);
 }
 
--- a/third_party/rust/core-graphics/src/data_provider.rs
+++ b/third_party/rust/core-graphics/src/data_provider.rs
@@ -67,25 +67,50 @@ impl CGDataProvider {
     /// Creates a data prvider from a given slice. The data provider does not own the slice in this
     /// case, so it's up to the user to ensure the memory safety here.
     pub unsafe fn from_slice(buffer: &[u8]) -> Self {
         let ptr = buffer.as_ptr() as *const c_void;
         let len = buffer.len() as size_t;
         let result = CGDataProviderCreateWithData(ptr::null_mut(), ptr, len, None);
         CGDataProvider::from_ptr(result)
     }
+
+    /// Creates a data provider from the given raw pointer, length, and destructor function.
+    ///
+    /// This is double-boxed because the Core Text API requires that the userdata be a single
+    /// pointer.
+    pub unsafe fn from_custom_data(custom_data: Box<Box<CustomData>>) -> Self {
+        let (ptr, len) = (custom_data.ptr() as *const c_void, custom_data.len());
+        let userdata = mem::transmute::<Box<Box<CustomData>>, &mut c_void>(custom_data);
+        let data_provider = CGDataProviderCreateWithData(userdata, ptr, len, Some(release));
+        return CGDataProvider::from_ptr(data_provider);
+
+        unsafe extern "C" fn release(info: *mut c_void, _: *const c_void, _: size_t) {
+            drop(mem::transmute::<*mut c_void, Box<Box<CustomData>>>(info))
+        }
+    }
 }
 
 impl CGDataProviderRef {
     /// Creates a copy of the data from the underlying `CFDataProviderRef`.
     pub fn copy_data(&self) -> CFData {
         unsafe { CFData::wrap_under_create_rule(CGDataProviderCopyData(self.as_ptr())) }
     }
 }
 
+/// Encapsulates custom data that can be wrapped.
+pub trait CustomData {
+    /// Returns a pointer to the start of the custom data. This pointer *must not change* during
+    /// the lifespan of this CustomData.
+    unsafe fn ptr(&self) -> *const u8;
+    /// Returns the length of this custom data. This value must not change during the lifespan of
+    /// this CustomData.
+    unsafe fn len(&self) -> usize;
+}
+
 #[link(name = "CoreGraphics", kind = "framework")]
 extern {
     fn CGDataProviderCopyData(provider: ::sys::CGDataProviderRef) -> CFDataRef;
     //fn CGDataProviderCreateDirect
     //fn CGDataProviderCreateSequential
     //fn CGDataProviderCreateWithCFData
     fn CGDataProviderCreateWithData(info: *mut c_void,
                                     data: *const c_void,
--- a/third_party/rust/core-graphics/src/display.rs
+++ b/third_party/rust/core-graphics/src/display.rs
@@ -6,19 +6,22 @@
 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
 #![allow(non_upper_case_globals)]
 
 use libc;
 use std::ptr;
+use std::ops::Deref;
+
 pub use base::{CGError, boolean_t};
 pub use geometry::{CGRect, CGPoint, CGSize};
 
+use core_foundation::string::{CFString, CFStringRef};
 use core_foundation::base::{CFRetain, TCFType};
 use image::CGImage;
 use foreign_types::ForeignType;
 
 pub type CGDirectDisplayID = libc::uint32_t;
 pub type CGWindowID        = libc::uint32_t;
 
 pub const kCGNullWindowID: CGWindowID = 0 as CGWindowID;
@@ -37,21 +40,68 @@ pub type CGWindowImageOption = libc::uin
 
 pub const kCGWindowImageDefault: CGWindowImageOption = 0;
 pub const kCGWindowImageBoundsIgnoreFraming: CGWindowImageOption = 1 << 0;
 pub const kCGWindowImageShouldBeOpaque: CGWindowImageOption = 1 << 1;
 pub const kCGWindowImageOnlyShadows: CGWindowImageOption = 1 << 2;
 pub const kCGWindowImageBestResolution: CGWindowImageOption = 1 << 3;
 pub const kCGWindowImageNominalResolution: CGWindowImageOption = 1 << 4;
 
+pub const kDisplayModeValidFlag: u32               = 0x00000001;
+pub const kDisplayModeSafeFlag: u32                = 0x00000002;
+pub const kDisplayModeDefaultFlag: u32             = 0x00000004;
+pub const kDisplayModeAlwaysShowFlag: u32          = 0x00000008;
+pub const kDisplayModeNeverShowFlag: u32           = 0x00000080;
+pub const kDisplayModeNotResizeFlag: u32           = 0x00000010;
+pub const kDisplayModeRequiresPanFlag: u32         = 0x00000020;
+pub const kDisplayModeInterlacedFlag: u32          = 0x00000040;
+pub const kDisplayModeSimulscanFlag: u32           = 0x00000100;
+pub const kDisplayModeBuiltInFlag: u32             = 0x00000400;
+pub const kDisplayModeNotPresetFlag: u32           = 0x00000200;
+pub const kDisplayModeStretchedFlag: u32           = 0x00000800;
+pub const kDisplayModeNotGraphicsQualityFlag: u32  = 0x00001000;
+pub const kDisplayModeValidateAgainstDisplay: u32  = 0x00002000;
+pub const kDisplayModeTelevisionFlag: u32          = 0x00100000;
+pub const kDisplayModeValidForMirroringFlag: u32   = 0x00200000;
+pub const kDisplayModeAcceleratorBackedFlag: u32   = 0x00400000;
+pub const kDisplayModeValidForHiResFlag: u32       = 0x00800000;
+pub const kDisplayModeValidForAirPlayFlag: u32     = 0x01000000;
+pub const kDisplayModeNativeFlag: u32              = 0x02000000;
+
+pub const kDisplayModeSafetyFlags: u32             = 0x00000007;
+
+pub const IO1BitIndexedPixels: &str =     "P";
+pub const IO2BitIndexedPixels: &str =     "PP";
+pub const IO4BitIndexedPixels: &str =     "PPPP";
+pub const IO8BitIndexedPixels: &str =     "PPPPPPPP";
+pub const IO16BitDirectPixels: &str =     "-RRRRRGGGGGBBBBB";
+pub const IO32BitDirectPixels: &str =     "--------RRRRRRRRGGGGGGGGBBBBBBBB";
+pub const kIO30BitDirectPixels: &str =    "--RRRRRRRRRRGGGGGGGGGGBBBBBBBBBB";
+pub const kIO64BitDirectPixels: &str =    "-16R16G16B16";
+pub const kIO16BitFloatPixels: &str =     "-16FR16FG16FB16";
+pub const kIO32BitFloatPixels: &str =     "-32FR32FG32FB32";
+pub const IOYUV422Pixels: &str =          "Y4U2V2";
+pub const IO8BitOverlayPixels: &str =     "O8";
+
+
 pub use core_foundation::dictionary::{ CFDictionary, CFDictionaryRef, CFDictionaryGetValueIfPresent };
 pub use core_foundation::array::{ CFArray, CFArrayRef };
 pub use core_foundation::array::{ CFArrayGetCount, CFArrayGetValueAtIndex };
 pub use core_foundation::base::{  CFIndex, CFRelease, CFTypeRef };
 
+pub type CGDisplayConfigRef = *mut libc::c_void;
+
+#[repr(u32)]
+#[derive(Clone, Copy)]
+pub enum CGConfigureOption {
+    ConfigureForAppOnly = 0,
+    ConfigureForSession = 1,
+    ConfigurePermanently = 2,
+}
+
 #[derive(Copy, Clone, Debug)]
 pub struct CGDisplay {
     pub id: CGDirectDisplayID,
 }
 
 foreign_type! {
     #[doc(hidden)]
     type CType = ::sys::CGDisplayMode;
@@ -87,16 +137,74 @@ impl CGDisplay {
             if !mode_ref.is_null() {
                 Some(CGDisplayMode::from_ptr(mode_ref))
             } else {
                 None
             }
         }
     }
 
+    /// Begins a new set of display configuration changes.
+    pub fn begin_configuration(&self) -> Result<CGDisplayConfigRef, CGError> {
+        unsafe {
+            let mut config_ref: CGDisplayConfigRef = ptr::null_mut();
+            let result = CGBeginDisplayConfiguration(&mut config_ref);
+            if result == 0 {
+                Ok(config_ref)
+            } else {
+                Err(result)
+            }
+        }
+    }
+
+    /// Cancels a set of display configuration changes.
+    pub fn cancel_configuration(&self, config_ref: &CGDisplayConfigRef) -> Result<(), CGError> {
+        let result = unsafe { CGCancelDisplayConfiguration(*config_ref) };
+        if result == 0 {
+            Ok(())
+        } else {
+            Err(result)
+        }
+    }
+
+    /// Completes a set of display configuration changes.
+    pub fn complete_configuration(
+        &self,
+        config_ref: &CGDisplayConfigRef,
+        option: CGConfigureOption,
+    ) -> Result<(), CGError> {
+        let result = unsafe { CGCompleteDisplayConfiguration(*config_ref, option) };
+        if result == 0 {
+            Ok(())
+        } else {
+            Err(result)
+        }
+    }
+
+    /// Configures the display mode of a display.
+    pub fn configure_display_with_display_mode(
+        &self,
+        config_ref: &CGDisplayConfigRef,
+        display_mode: &CGDisplayMode,
+    ) -> Result<(), CGError> {
+        let result = unsafe {
+            CGConfigureDisplayWithDisplayMode(
+                *config_ref,
+                self.id,
+                display_mode.as_ptr(),
+                ptr::null(),
+            )
+        };
+        if result == 0 {
+            Ok(())
+        } else {
+            Err(result)
+        }
+    }
+
     /// Returns an image containing the contents of the specified display.
     #[inline]
     pub fn image(&self) -> Option<CGImage> {
         unsafe {
             let image_ref = CGDisplayCreateImage(self.id);
             if !image_ref.is_null() {
                 Some(CGImage::from_ptr(image_ref))
             } else {
@@ -368,47 +476,116 @@ impl CGDisplay {
             Ok(())
         } else {
             Err(result)
         }
     }
 }
 
 impl CGDisplayMode {
+    /// Returns all display modes for the specified display id.
+    pub fn all_display_modes(
+        display_id: CGDirectDisplayID,
+        options: CFDictionaryRef,
+    ) -> Option<Vec<CGDisplayMode>> {
+        let array_opt: Option<CFArray> = unsafe {
+            let array_ref = CGDisplayCopyAllDisplayModes(display_id, options);
+            if array_ref != ptr::null() {
+                Some(CFArray::wrap_under_create_rule(array_ref))
+            } else {
+                None
+            }
+        };
+        match array_opt {
+            Some(modes) => {
+                let vec: Vec<CGDisplayMode> = modes
+                    .into_iter()
+                    .map(|value0| {
+                        let x = *value0.deref() as *mut ::sys::CGDisplayMode;
+                        unsafe { CGDisplayMode::from_ptr(x) }
+                    }).collect();
+                Some(vec)
+            }
+            None => None,
+        }
+    }
+
+    /// Returns the height of the specified display mode.
     #[inline]
     pub fn height(&self) -> u64 {
         unsafe { CGDisplayModeGetHeight(self.as_ptr()) as u64 }
     }
 
+    /// Returns the width of the specified display mode.
     #[inline]
     pub fn width(&self) -> u64 {
         unsafe { CGDisplayModeGetWidth(self.as_ptr()) as u64 }
     }
 
+    /// Returns the pixel height of the specified display mode.
     #[inline]
     pub fn pixel_height(&self) -> u64 {
         unsafe { CGDisplayModeGetPixelHeight(self.as_ptr()) as u64 }
     }
 
+    /// Returns the pixel width of the specified display mode.
     #[inline]
     pub fn pixel_width(&self) -> u64 {
         unsafe { CGDisplayModeGetPixelWidth(self.as_ptr()) as u64 }
     }
 
     #[inline]
     pub fn refresh_rate(&self) -> f64 {
         unsafe { CGDisplayModeGetRefreshRate(self.as_ptr()) }
     }
+
+    /// Returns the I/O Kit flags of the specified display mode.
+    #[inline]
+    pub fn io_flags(&self) -> u32 {
+        unsafe { CGDisplayModeGetIOFlags(self.as_ptr()) as u32 }
+    }
+
+    /// Returns the pixel encoding of the specified display mode.
+    #[inline]
+    pub fn pixel_encoding(&self) -> CFString {
+        unsafe { CFString::wrap_under_create_rule(CGDisplayModeCopyPixelEncoding(self.as_ptr())) }
+    }
+
+    /// Returns the number of bits per pixel of the specified display mode.
+    pub fn bit_depth(&self) -> usize {
+        let pixel_encoding = self.pixel_encoding().to_string();
+        // my numerical representation for kIO16BitFloatPixels and kIO32bitFloatPixels
+        // are made up and possibly non-sensical
+        if pixel_encoding.eq_ignore_ascii_case(kIO32BitFloatPixels) {
+            96
+        } else if pixel_encoding.eq_ignore_ascii_case(kIO64BitDirectPixels) {
+            64
+        } else if pixel_encoding.eq_ignore_ascii_case(kIO16BitFloatPixels) {
+            48
+        } else if pixel_encoding.eq_ignore_ascii_case(IO32BitDirectPixels) {
+            32
+        } else if pixel_encoding.eq_ignore_ascii_case(kIO30BitDirectPixels) {
+            30
+        } else if pixel_encoding.eq_ignore_ascii_case(IO16BitDirectPixels) {
+            16
+        } else if pixel_encoding.eq_ignore_ascii_case(IO8BitIndexedPixels) {
+            8
+        }else{
+            0
+        }
+    }
 }
 
 #[link(name = "CoreGraphics", kind = "framework")]
 extern "C" {
     pub static CGRectNull: CGRect;
     pub static CGRectInfinite: CGRect;
 
+    pub static kCGDisplayShowDuplicateLowResolutionModes: CFStringRef;
+
     pub fn CGDisplayModeRelease(mode: ::sys::CGDisplayModeRef);
 
     pub fn CGMainDisplayID() -> CGDirectDisplayID;
     pub fn CGDisplayIsActive(display: CGDirectDisplayID) -> boolean_t;
     pub fn CGDisplayIsAlwaysInMirrorSet(display: CGDirectDisplayID) -> boolean_t;
     pub fn CGDisplayIsAsleep(display: CGDirectDisplayID) -> boolean_t;
     pub fn CGDisplayIsBuiltin(display: CGDirectDisplayID) -> boolean_t;
     pub fn CGDisplayIsInHWMirrorSet(display: CGDirectDisplayID) -> boolean_t;
@@ -436,22 +613,42 @@ extern "C" {
         matching_display_count: *mut libc::uint32_t,
     ) -> CGError;
     pub fn CGDisplayModelNumber(display: CGDirectDisplayID) -> libc::uint32_t;
     pub fn CGDisplayPixelsHigh(display: CGDirectDisplayID) -> libc::size_t;
     pub fn CGDisplayPixelsWide(display: CGDirectDisplayID) -> libc::size_t;
     pub fn CGDisplayBounds(display: CGDirectDisplayID) -> CGRect;
     pub fn CGDisplayCreateImage(display: CGDirectDisplayID) -> ::sys::CGImageRef;
 
+    pub fn CGBeginDisplayConfiguration(config: *const CGDisplayConfigRef) -> CGError;
+    pub fn CGCancelDisplayConfiguration(config: CGDisplayConfigRef) -> CGError;
+    pub fn CGCompleteDisplayConfiguration(
+        config: CGDisplayConfigRef,
+        option: CGConfigureOption,
+    ) -> CGError;
+    pub fn CGConfigureDisplayWithDisplayMode(
+        config: CGDisplayConfigRef,
+        display: CGDirectDisplayID,
+        mode: ::sys::CGDisplayModeRef,
+        options: CFDictionaryRef,
+    ) -> CGError;
+
     pub fn CGDisplayCopyDisplayMode(display: CGDirectDisplayID) -> ::sys::CGDisplayModeRef;
     pub fn CGDisplayModeGetHeight(mode: ::sys::CGDisplayModeRef) -> libc::size_t;
     pub fn CGDisplayModeGetWidth(mode: ::sys::CGDisplayModeRef) -> libc::size_t;
     pub fn CGDisplayModeGetPixelHeight(mode: ::sys::CGDisplayModeRef) -> libc::size_t;
     pub fn CGDisplayModeGetPixelWidth(mode: ::sys::CGDisplayModeRef) -> libc::size_t;
     pub fn CGDisplayModeGetRefreshRate(mode: ::sys::CGDisplayModeRef) -> libc::c_double;
+    pub fn CGDisplayModeGetIOFlags(mode: ::sys::CGDisplayModeRef) -> libc::uint32_t;
+    pub fn CGDisplayModeCopyPixelEncoding(mode: ::sys::CGDisplayModeRef) -> CFStringRef;
+
+    pub fn CGDisplayCopyAllDisplayModes(
+        display: CGDirectDisplayID,
+        options: CFDictionaryRef,
+    ) -> CFArrayRef;
 
     // mouse stuff
     pub fn CGDisplayHideCursor(display: CGDirectDisplayID) -> CGError;
     pub fn CGDisplayShowCursor(display: CGDirectDisplayID) -> CGError;
     pub fn CGDisplayMoveCursorToPoint(display: CGDirectDisplayID, point: CGPoint) -> CGError;
     pub fn CGWarpMouseCursorPosition(point: CGPoint) -> CGError;
     pub fn CGAssociateMouseAndMouseCursorPosition(connected: boolean_t) -> CGError;
 
--- a/third_party/rust/core-graphics/src/geometry.rs
+++ b/third_party/rust/core-graphics/src/geometry.rs
@@ -135,16 +135,25 @@ impl CGRect {
     #[inline]
     pub fn apply_transform(&self, t: &CGAffineTransform) -> CGRect {
         unsafe {
             ffi::CGRectApplyAffineTransform(*self, *t)
         }
     }
 }
 
+impl PartialEq for CGRect {
+    #[inline]
+    fn eq(&self, other: &CGRect) -> bool {
+        unsafe {
+            ffi::CGRectEqualToRect(*self, *other) != 0
+        }
+    }
+}
+
 #[repr(C)]
 #[derive(Clone, Copy, Debug, Default)]
 pub struct CGAffineTransform {
     pub a: CGFloat,
     pub b: CGFloat,
     pub c: CGFloat,
     pub d: CGFloat,
     pub tx: CGFloat,
@@ -179,16 +188,17 @@ mod ffi {
 
     #[link(name = "CoreGraphics", kind = "framework")]
     extern {
         pub fn CGRectInset(rect: CGRect, dx: CGFloat, dy: CGFloat) -> CGRect;
         pub fn CGRectMakeWithDictionaryRepresentation(dict: CFDictionaryRef,
                                                       rect: *mut CGRect) -> boolean_t;
         pub fn CGRectIsEmpty(rect: CGRect) -> boolean_t;
         pub fn CGRectIntersectsRect(rect1: CGRect, rect2: CGRect) -> boolean_t;
+        pub fn CGRectEqualToRect(rect1: CGRect, rect2: CGRect) -> boolean_t;
 
         pub fn CGAffineTransformInvert(t: CGAffineTransform) -> CGAffineTransform;
 
         pub fn CGPointApplyAffineTransform(point: CGPoint, t: CGAffineTransform) -> CGPoint;
         pub fn CGRectApplyAffineTransform(rect: CGRect, t: CGAffineTransform) -> CGRect;
         pub fn CGSizeApplyAffineTransform(size: CGSize, t: CGAffineTransform) -> CGSize;
     }
 }
--- a/third_party/rust/core-graphics/src/image.rs
+++ b/third_party/rust/core-graphics/src/image.rs
@@ -1,15 +1,16 @@
 use std::ptr;
 
 use base::CGFloat;
 use core_foundation::base::{CFRetain, CFTypeID};
 use core_foundation::data::CFData;
 use color_space::CGColorSpace;
 use data_provider::{CGDataProviderRef, CGDataProvider};
+use geometry::CGRect;
 use libc::size_t;
 use foreign_types::{ForeignType, ForeignTypeRef};
 
 #[repr(C)]
 pub enum CGImageAlphaInfo {
     CGImageAlphaNone, /* For example, RGB. */
     CGImageAlphaPremultipliedLast, /* For example, premultiplied RGBA */
     CGImageAlphaPremultipliedFirst, /* For example, premultiplied ARGB */
@@ -116,16 +117,27 @@ impl CGImageRef {
     /// Returns the raw image bytes wrapped in `CFData`. Note, the returned `CFData` owns the
     /// underlying buffer.
     pub fn data(&self) -> CFData {
         let data_provider = unsafe {
             CGDataProviderRef::from_ptr(CGImageGetDataProvider(self.as_ptr()))
         };
         data_provider.copy_data()
     }
+
+    /// Returns a cropped image. If the `rect` specifies a rectangle which lies outside of the
+    /// image bounds, the `None` is returned.
+    pub fn cropped(&self, rect: CGRect) -> Option<CGImage> {
+        let image_ptr = unsafe { CGImageCreateWithImageInRect(self.as_ptr(), rect) };
+        if !image_ptr.is_null() {
+            Some(unsafe { CGImage::from_ptr(image_ptr) })
+        } else {
+            None
+        }
+    }
 }
 
 #[link(name = "CoreGraphics", kind = "framework")]
 extern {
     fn CGImageGetTypeID() -> CFTypeID;
     fn CGImageGetWidth(image: ::sys::CGImageRef) -> size_t;
     fn CGImageGetHeight(image: ::sys::CGImageRef) -> size_t;
     fn CGImageGetBitsPerComponent(image: ::sys::CGImageRef) -> size_t;
@@ -141,12 +153,13 @@ extern {
                      bytesPerRow: size_t,
                      space: ::sys::CGColorSpaceRef,
                      bitmapInfo: u32,
                      provider: ::sys::CGDataProviderRef,
                      decode: *const CGFloat,
                      shouldInterpolate: bool,
                      intent: u32)
                      -> ::sys::CGImageRef;
+    fn CGImageCreateWithImageInRect(image: ::sys::CGImageRef, rect: CGRect) -> ::sys::CGImageRef;
 
     //fn CGImageGetAlphaInfo(image: ::sys::CGImageRef) -> CGImageAlphaInfo;
     //fn CGImageCreateCopyWithColorSpace(image: ::sys::CGImageRef, space: ::sys::CGColorSpaceRef) -> ::sys::CGImageRef
 }
--- a/third_party/rust/core-graphics/src/lib.rs
+++ b/third_party/rust/core-graphics/src/lib.rs
@@ -3,26 +3,29 @@
 //
 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
 extern crate libc;
+
+#[macro_use]
 extern crate core_foundation;
 
 #[macro_use]
 #[cfg(target_os = "macos")]
 extern crate bitflags;
 
 #[macro_use]
 extern crate foreign_types;
 
 pub mod base;
+pub mod color;
 pub mod color_space;
 pub mod context;
 pub mod data_provider;
 #[cfg(target_os = "macos")]
 pub mod display;
 #[cfg(target_os = "macos")]
 pub mod event;
 #[cfg(target_os = "macos")]
--- a/third_party/rust/core-graphics/src/path.rs
+++ b/third_party/rust/core-graphics/src/path.rs
@@ -2,35 +2,48 @@
 // file at the top-level directory of this distribution.
 //
 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+pub use sys::CGPathRef as SysCGPathRef;
+
 use core_foundation::base::{CFRelease, CFRetain, CFTypeID};
 use foreign_types::ForeignType;
-use geometry::CGPoint;
-use std::os::raw::c_void;
+use geometry::{CGAffineTransform, CGPoint, CGRect};
+use libc::c_void;
 use std::fmt::{self, Debug, Formatter};
 use std::marker::PhantomData;
 use std::ops::Deref;
+use std::ptr;
 use std::slice;
 
 foreign_type! {
     #[doc(hidden)]
     type CType = ::sys::CGPath;
     fn drop = |p| CFRelease(p as *mut _);
     fn clone = |p| CFRetain(p as *const _) as *mut _;
     pub struct CGPath;
     pub struct CGPathRef;
 }
 
 impl CGPath {
+    pub fn from_rect(rect: CGRect, transform: Option<&CGAffineTransform>) -> CGPath {
+        unsafe {
+            let transform = match transform {
+                None => ptr::null(),
+                Some(transform) => transform as *const CGAffineTransform,
+            };
+            CGPath(CGPathCreateWithRect(rect, transform))
+        }
+    }
+
     pub fn type_id() -> CFTypeID {
         unsafe {
             CGPathGetTypeID()
         }
     }
 
     pub fn apply<'a, F>(&'a self, mut closure: &'a F) where F: FnMut(CGPathElementRef<'a>) {
         unsafe {
@@ -105,11 +118,12 @@ impl CGPathElement {
     }
 }
 
 type CGPathApplierFunction = unsafe extern "C" fn(info: *mut c_void,
                                                   element: *const CGPathElement);
 
 #[link(name = "CoreGraphics", kind = "framework")]
 extern {
+    fn CGPathCreateWithRect(rect: CGRect, transform: *const CGAffineTransform) -> ::sys::CGPathRef;
     fn CGPathApply(path: ::sys::CGPathRef, info: *mut c_void, function: CGPathApplierFunction);
     fn CGPathGetTypeID() -> CFTypeID;
 }
--- a/third_party/rust/core-graphics/src/sys.rs
+++ b/third_party/rust/core-graphics/src/sys.rs
@@ -1,11 +1,18 @@
+use std::os::raw::c_void;
+
 pub enum CGImage {}
 pub type CGImageRef = *mut CGImage;
 
+#[repr(C)]
+pub struct __CGColor(c_void);
+
+pub type CGColorRef = *const __CGColor;
+
 pub enum CGColorSpace {}
 pub type CGColorSpaceRef = *mut CGColorSpace;
 
 pub enum CGPath {}
 pub type CGPathRef = *mut CGPath;
 
 pub enum CGDataProvider {}
 pub type CGDataProviderRef = *mut CGDataProvider;
--- a/third_party/rust/core-text/.cargo-checksum.json
+++ b/third_party/rust/core-text/.cargo-checksum.json
@@ -1,1 +1,1 @@
-{"files":{".travis.yml":"6aad961651169d31d79c0595624d1777b5c4cbb4cf2bed9a126c7e72d29411fd","COPYRIGHT":"ec82b96487e9e778ee610c7ab245162464782cfa1f555c2299333f8dbe5c036a","Cargo.toml":"671ed3c074224599fe05a7ab61a48c305842c9fc60e0dd486f4363bd4521fb8e","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"62065228e42caebca7e7d7db1204cbb867033de5982ca4009928915e4095f3a3","README.md":"0c82015d302c9937e6376debd961350afeaeb6dde228aac95e3a3115c5813613","src/font.rs":"1f747432402a00e7fc70227a5c0c49463638137fc804e2eb3c8fc74908b0875f","src/font_collection.rs":"e7e2facf1f5ec0661d61c230f84d6821e513315d7e311d2077443fb4e83c6f5d","src/font_descriptor.rs":"03439b11628c4aa5b8ac4aa68de25a2dd9da442755c0d91964170aca4a18c6d7","src/font_manager.rs":"de5e22620528322d6811d01f03975c53b676ec743297590de5e17a45393df0f1","src/lib.rs":"bd072cf53ebb643e4d21379d4487e60745999d20eab9caee8e56daa430cb65ca"},"package":"157ff38a92496dc676ce36d9124554e9ac66f1c1039f952690ac64f71cfa5968"}
\ No newline at end of file
+{"files":{".travis.yml":"6aad961651169d31d79c0595624d1777b5c4cbb4cf2bed9a126c7e72d29411fd","COPYRIGHT":"ec82b96487e9e778ee610c7ab245162464782cfa1f555c2299333f8dbe5c036a","Cargo.toml":"73555748fd27f22bd31d4e17f95397ec4120e1a610b0d29333d750d8ecad228d","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"62065228e42caebca7e7d7db1204cbb867033de5982ca4009928915e4095f3a3","README.md":"0c82015d302c9937e6376debd961350afeaeb6dde228aac95e3a3115c5813613","src/font.rs":"f4094760cf28ad8c99a5fa427702008d0638abbc1d0adc02bc7f874744ff00dd","src/font_collection.rs":"02de0ce2a61683314897a521d31ab9cc572a8b10ceda2ac47181fbe18bf4f235","src/font_descriptor.rs":"37b6af08ceaca9f15971ea009805bed00884294a035f152c617b43b333fdb471","src/font_manager.rs":"0abebafad90fc1cc74742493c812ec617a44a80969bab64807d6e32ae70033c0","src/lib.rs":"bd072cf53ebb643e4d21379d4487e60745999d20eab9caee8e56daa430cb65ca"},"package":"f3f46450d6f2397261af420b4ccce23807add2e45fa206410a03d66fb7f050ae"}
\ No newline at end of file
--- a/third_party/rust/core-text/Cargo.toml
+++ b/third_party/rust/core-text/Cargo.toml
@@ -7,26 +7,26 @@
 #
 # If you believe there's an error in this file please file an
 # issue against the rust-lang/cargo repository. If you're
 # editing this file be aware that the upstream Cargo.toml
 # will likely look very different (and much more reasonable)
 
 [package]
 name = "core-text"
-version = "11.0.0"
+version = "13.0.0"
 authors = ["The Servo Project Developers"]
 description = "Bindings to the Core Text framework."
 license = "MIT/Apache-2.0"
 repository = "https://github.com/servo/core-foundation-rs"
 [dependencies.core-foundation]
 version = "0.6"
 
 [dependencies.core-graphics]
-version = "0.16"
+version = "0.17"
 
 [dependencies.foreign-types]
 version = "0.3"
 
 [dependencies.libc]
 version = "0.2"
 
 [features]
--- a/third_party/rust/core-text/src/font.rs
+++ b/third_party/rust/core-text/src/font.rs
@@ -158,16 +158,34 @@ impl CTFont {
             let font_ref = CTFontCreateCopyWithAttributes(self.0,
                                                           size as CGFloat,
                                                           ptr::null(),
                                                           ptr::null());
             CTFont::wrap_under_create_rule(font_ref)
         }
     }
 
+    pub fn clone_with_symbolic_traits(&self,
+                                      trait_value: CTFontSymbolicTraits,
+                                      trait_mask: CTFontSymbolicTraits)
+                                      -> Option<CTFont> {
+        unsafe {
+            let font_ref = CTFontCreateCopyWithSymbolicTraits(self.0,
+                                                              0.0,
+                                                              ptr::null(),
+                                                              trait_value,
+                                                              trait_mask);
+            if font_ref.is_null() {
+                None
+            } else {
+                Some(CTFont::wrap_under_create_rule(font_ref))
+            }
+        }
+    }
+
     // Names
     pub fn family_name(&self) -> String {
         unsafe {
             let value = get_string_by_name_key(self, kCTFontFamilyNameKey);
             value.expect("Fonts should always have a family name.")
         }
     }
 
@@ -187,16 +205,30 @@ impl CTFont {
 
     pub fn postscript_name(&self) -> String {
         unsafe {
             let value = get_string_by_name_key(self, kCTFontPostScriptNameKey);
             value.expect("Fonts should always have a PostScript name.")
         }
     }
 
+    pub fn display_name(&self) -> String {
+        unsafe {
+            let value = get_string_by_name_key(self, kCTFontFullNameKey);
+            value.expect("Fonts should always have a PostScript name.")
+        }
+    }
+
+    pub fn style_name(&self) -> String {
+        unsafe {
+            let value = get_string_by_name_key(self, kCTFontStyleNameKey);
+            value.expect("Fonts should always have a style name.")
+        }
+    }
+
     pub fn all_traits(&self) -> CTFontTraits {
         unsafe {
             CTFontTraits::wrap_under_create_rule(CTFontCopyTraits(self.0))
         }
     }
 
     // Font metrics
     pub fn ascent(&self) -> CGFloat {
@@ -218,16 +250,28 @@ impl CTFont {
     }
 
     pub fn underline_position(&self) -> CGFloat {
         unsafe {
             CTFontGetUnderlinePosition(self.0)
         }
     }
 
+    pub fn slant_angle(&self) -> CGFloat {
+        unsafe {
+            CTFontGetSlantAngle(self.0)
+        }
+    }
+
+    pub fn cap_height(&self) -> CGFloat {
+        unsafe {
+            CTFontGetCapHeight(self.0)
+        }
+    }
+
     pub fn bounding_box(&self) -> CGRect {
         unsafe {
             CTFontGetBoundingBox(self.0)
         }
     }
 
     pub fn leading(&self) -> CGFloat {
         unsafe {
@@ -248,32 +292,43 @@ impl CTFont {
     }
 
     pub fn pt_size(&self) -> CGFloat {
         unsafe {
             CTFontGetSize(self.0)
         }
     }
 
-    pub fn get_glyphs_for_characters(&self, characters: *const UniChar, glyphs: *mut CGGlyph, count: CFIndex)
-                                     -> bool {
-        unsafe {
-            CTFontGetGlyphsForCharacters(self.0, characters, glyphs, count)
-        }
+    pub unsafe fn get_glyphs_for_characters(&self,
+                                            characters: *const UniChar,
+                                            glyphs: *mut CGGlyph,
+                                            count: CFIndex)
+                                            -> bool {
+        CTFontGetGlyphsForCharacters(self.0, characters, glyphs, count)
     }
 
-    pub fn get_advances_for_glyphs(&self,
-                                   orientation: CTFontOrientation,
-                                   glyphs: *const CGGlyph,
-                                   advances: *mut CGSize,
-                                   count: CFIndex)
-                                   -> f64 {
-        unsafe {
-            CTFontGetAdvancesForGlyphs(self.0, orientation, glyphs, advances, count) as f64
-        }
+    pub unsafe fn get_advances_for_glyphs(&self,
+                                          orientation: CTFontOrientation,
+                                          glyphs: *const CGGlyph,
+                                          advances: *mut CGSize,
+                                          count: CFIndex)
+                                          -> f64 {
+        CTFontGetAdvancesForGlyphs(self.0, orientation, glyphs, advances, count) as f64
+    }
+
+    pub unsafe fn get_vertical_translations_for_glyphs(&self,
+                                                       orientation: CTFontOrientation,
+                                                       glyphs: *const CGGlyph,
+                                                       translations: *mut CGSize,
+                                                       count: CFIndex) {
+        CTFontGetVerticalTranslationsForGlyphs(self.0,
+                                               orientation,
+                                               glyphs,
+                                               translations,
+                                               count)
     }
 
     pub fn get_font_table(&self, tag: u32) -> Option<CFData> {
         unsafe {
             let result = CTFontCopyTable(self.0,
                                          tag as CTFontTableTag,
                                          kCTFontTableOptionsExcludeSynthetic);
             if result.is_null() {
@@ -333,16 +388,23 @@ impl CTFont {
             let path = CTFontCreatePathForGlyph(self.0, glyph, matrix);
             if path.is_null() {
                 Err(())
             } else {
                 Ok(CGPath::from_ptr(path))
             }
         }
     }
+
+    #[inline]
+    pub fn glyph_count(&self) -> CFIndex {
+        unsafe {
+            CTFontGetGlyphCount(self.0)
+        }
+    }
 }
 
 // Helper methods
 fn get_string_by_name_key(font: &CTFont, name_key: CFStringRef) -> Option<String> {
     unsafe {
         let result = CTFontCopyName(font.as_concrete_TypeRef(), name_key);
         if result.is_null() {
             None
@@ -372,17 +434,17 @@ pub fn debug_font_traits(font: &CTFont) 
     println!("kCTFontItalicTrait: {}", sym.is_italic());
     println!("kCTFontBoldTrait: {}", sym.is_bold());
     println!("kCTFontExpandedTrait: {}", sym.is_expanded());
     println!("kCTFontCondensedTrait: {}", sym.is_condensed());
     println!("kCTFontMonoSpaceTrait: {}", sym.is_monospace());
 
     let traits = font.all_traits();
     println!("kCTFontWeightTrait: {}", traits.normalized_weight());
-//    println!("kCTFontWidthTrait: {}", traits.normalized_width());
+    println!("kCTFontWidthTrait: {}", traits.normalized_width());
 //    println!("kCTFontSlantTrait: {}", traits.normalized_slant());
 }
 
 #[cfg(feature = "mountainlion")]
 pub fn cascade_list_for_languages(font: &CTFont, language_pref_list: &CFArray<CFString>) -> CFArray<CTFontDescriptor> {
     unsafe {
         let font_collection_ref =
             CTFontCopyDefaultCascadeListForLanguages(font.as_concrete_TypeRef(),
@@ -441,17 +503,22 @@ extern {
     fn CTFontCreateWithName(name: CFStringRef, size: CGFloat, matrix: *const CGAffineTransform) -> CTFontRef;
     //fn CTFontCreateWithNameAndOptions
     fn CTFontCreateWithFontDescriptor(descriptor: CTFontDescriptorRef, size: CGFloat,
                                       matrix: *const CGAffineTransform) -> CTFontRef;
     //fn CTFontCreateWithFontDescriptorAndOptions
     //fn CTFontCreateUIFontForLanguage
     fn CTFontCreateCopyWithAttributes(font: CTFontRef, size: CGFloat, matrix: *const CGAffineTransform,
                                       attributes: CTFontDescriptorRef) -> CTFontRef;
-    //fn CTFontCreateCopyWithSymbolicTraits
+    fn CTFontCreateCopyWithSymbolicTraits(font: CTFontRef,
+                                          size: CGFloat,
+                                          matrix: *const CGAffineTransform,
+                                          symTraitValue: CTFontSymbolicTraits,
+                                          symTraitMask: CTFontSymbolicTraits)
+                                          -> CTFontRef;
     //fn CTFontCreateCopyWithFamily
     //fn CTFontCreateForString
 
     /* Getting Font Data */
     //fn CTFontCopyFontDescriptor(font: CTFontRef) -> CTFontDescriptorRef;
     fn CTFontCopyAttribute(font: CTFontRef, attribute: CFStringRef) -> CFTypeRef;
     fn CTFontGetSize(font: CTFontRef) -> CGFloat;
     //fn CTFontGetMatrix
@@ -475,36 +542,45 @@ extern {
     //fn CTFontGetStringEncoding
     //fn CTFontCopySupportedLanguages
 
     /* Getting Font Metrics */
     fn CTFontGetAscent(font: CTFontRef) -> CGFloat;
     fn CTFontGetDescent(font: CTFontRef) -> CGFloat;
     fn CTFontGetLeading(font: CTFontRef) -> CGFloat;
     fn CTFontGetUnitsPerEm(font: CTFontRef) -> libc::c_uint;
-    //fn CTFontGetGlyphCount
+    fn CTFontGetGlyphCount(font: CTFontRef) -> CFIndex;
     fn CTFontGetBoundingBox(font: CTFontRef) -> CGRect;
     fn CTFontGetUnderlinePosition(font: CTFontRef) -> CGFloat;
     fn CTFontGetUnderlineThickness(font: CTFontRef) -> CGFloat;
-    //fn CTFontGetSlantAngle
-    //fn CTFontGetCapHeight
+    fn CTFontGetSlantAngle(font: CTFontRef) -> CGFloat;
+    fn CTFontGetCapHeight(font: CTFontRef) -> CGFloat;
     fn CTFontGetXHeight(font: CTFontRef) -> CGFloat;
 
     /* Getting Glyph Data */
     fn CTFontCreatePathForGlyph(font: CTFontRef, glyph: CGGlyph, matrix: *const CGAffineTransform)
                                 -> CGPathRef;
     //fn CTFontGetGlyphWithName
     fn CTFontGetBoundingRectsForGlyphs(font: CTFontRef,
                                        orientation: CTFontOrientation,
                                        glyphs: *const CGGlyph,
                                        boundingRects: *mut CGRect,
                                        count: CFIndex)
                                        -> CGRect;
-    fn CTFontGetAdvancesForGlyphs(font: CTFontRef, orientation: CTFontOrientation, glyphs: *const CGGlyph, advances: *mut CGSize, count: CFIndex) -> libc::c_double;
-    //fn CTFontGetVerticalTranslationsForGlyphs
+    fn CTFontGetAdvancesForGlyphs(font: CTFontRef,
+                                  orientation: CTFontOrientation,
+                                  glyphs: *const CGGlyph,
+                                  advances: *mut CGSize,
+                                  count: CFIndex)
+                                  -> libc::c_double;
+    fn CTFontGetVerticalTranslationsForGlyphs(font: CTFontRef,
+                                              orientation: CTFontOrientation,
+                                              glyphs: *const CGGlyph,
+                                              translations: *mut CGSize,
+                                              count: CFIndex);
 
     /* Working With Font Variations */
     fn CTFontCopyVariationAxes(font: CTFontRef) -> CFArrayRef;
     //fn CTFontCopyVariation
 
     /* Getting Font Features */
     //fn CTFontCopyFeatures
     //fn CTFontCopyFeatureSettings
--- a/third_party/rust/core-text/src/font_collection.rs
+++ b/third_party/rust/core-text/src/font_collection.rs
@@ -28,21 +28,27 @@ pub type CTFontCollectionRef = *const __
 declare_TCFType! {
     CTFontCollection, CTFontCollectionRef
 }
 impl_TCFType!(CTFontCollection, CTFontCollectionRef, CTFontCollectionGetTypeID);
 impl_CFTypeDescription!(CTFontCollection);
 
 
 impl CTFontCollection {
-    pub fn get_descriptors(&self) -> CFArray<CTFontDescriptor> {
+    pub fn get_descriptors(&self) -> Option<CFArray<CTFontDescriptor>> {
         // surprise! this function follows the Get rule, despite being named *Create*.
         // So we have to addRef it to avoid CTFontCollection from double freeing it later.
         unsafe {
-            CFArray::wrap_under_get_rule(CTFontCollectionCreateMatchingFontDescriptors(self.0))
+            let font_descriptors = CTFontCollectionCreateMatchingFontDescriptors(self.0);
+            if font_descriptors.is_null() {
+                // This returns null if there are no matching font descriptors.
+                None
+            } else {
+                Some(CFArray::wrap_under_get_rule(font_descriptors))
+            }
         }
     }
 }
 
 pub fn new_from_descriptors(descs: &CFArray<CTFontDescriptor>) -> CTFontCollection {
     unsafe {
         let key = CFString::wrap_under_get_rule(kCTFontCollectionRemoveDuplicatesOption);
         let value = CFNumber::from(1i64);
--- a/third_party/rust/core-text/src/font_descriptor.rs
+++ b/third_party/rust/core-text/src/font_descriptor.rs
@@ -48,24 +48,26 @@ pub const kCTFontColorGlyphsTrait: CTFon
 pub const kCTFontClassMaskTrait: CTFontSymbolicTraits = (15 << kCTFontClassMaskShift );
 
 pub trait SymbolicTraitAccessors {
     fn is_italic(&self) -> bool;
     fn is_bold(&self) -> bool;
     fn is_expanded(&self) -> bool;
     fn is_condensed(&self) -> bool;
     fn is_monospace(&self) -> bool;
+    fn is_vertical(&self) -> bool;
 }
 
 impl SymbolicTraitAccessors for CTFontSymbolicTraits {
     fn is_italic(&self) -> bool { (*self & kCTFontItalicTrait) != 0 }
     fn is_bold(&self) -> bool { (*self & kCTFontBoldTrait) != 0 }
     fn is_expanded(&self) -> bool { (*self & kCTFontExpandedTrait) != 0 }
     fn is_condensed(&self) -> bool { (*self & kCTFontCondensedTrait) != 0 }
     fn is_monospace(&self) -> bool { (*self & kCTFontMonoSpaceTrait) != 0 }
+    fn is_vertical(&self) -> bool { (*self & kCTFontVerticalTrait) != 0 }
 }
 
 pub type CTFontStylisticClass = u32;
 pub const kCTFontUnknownClass: CTFontStylisticClass = (0 << kCTFontClassMaskShift );
 pub const kCTFontOldStyleSerifsClass: CTFontStylisticClass = (1 << kCTFontClassMaskShift );
 pub const kCTFontTransitionalSerifsClass: CTFontStylisticClass = (2 << kCTFontClassMaskShift );
 pub const kCTFontModernSerifsClass: CTFontStylisticClass = (3 << kCTFontClassMaskShift );
 pub const kCTFontClarendonSerifsClass: CTFontStylisticClass = (4 << kCTFontClassMaskShift );
--- a/third_party/rust/core-text/src/font_manager.rs
+++ b/third_party/rust/core-text/src/font_manager.rs
@@ -2,19 +2,27 @@
 // file at the top-level directory of this distribution.
 //
 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use core_foundation::array::CFArrayRef;
+use core_foundation::array::{CFArray, CFArrayRef};
+use core_foundation::base::TCFType;
+use core_foundation::string::CFString;
 use core_foundation::url::CFURLRef;
 
+pub fn copy_available_font_family_names() -> CFArray<CFString> {
+    unsafe {
+        TCFType::wrap_under_create_rule(CTFontManagerCopyAvailableFontFamilyNames())
+    }
+}
+
 extern {
     /*
      * CTFontManager.h
      */
 
     // Incomplete function bindings are mostly related to CoreText font matching, which
     // we implement in a platform-independent manner using FontMatcher.