Backed out changeset ea6696688123 (bug 1738909) for causing build bustages. CLOSED TREE

This commit is contained in:
Sandor Molnar 2021-11-02 21:56:00 +02:00
Родитель dd9d805fa5
Коммит b1852a9b5e
3 изменённых файлов: 55 добавлений и 11 удалений

18
gfx/wr/Cargo.lock сгенерированный
Просмотреть файл

@ -303,9 +303,9 @@ dependencies = [
[[package]]
name = "core-foundation"
version = "0.9.2"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6888e10551bb93e424d8df1d07f1a8b4fceb0001a3a4b048bfc47554946f47b3"
checksum = "3b5ed8e7e76c45974e15e41bfa8d5b0483cd90191639e01d8f5f1e606299d3fb"
dependencies = [
"core-foundation-sys 0.8.2",
"libc",
@ -348,7 +348,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f6082396a349fa49674ba1bda4077332a18bf150e8fa75745ece07085e29a113"
dependencies = [
"bitflags",
"core-foundation 0.9.2",
"core-foundation 0.9.0",
"core-graphics-types",
"foreign-types",
"libc",
@ -361,7 +361,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e92f5d519093a4178296707dbaa3880eae85a5ef5386675f361a1cf25376e93c"
dependencies = [
"bitflags",
"core-foundation 0.9.2",
"core-foundation 0.9.0",
"foreign-types",
"libc",
]
@ -372,7 +372,7 @@ version = "19.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "04dfae50af11e72657fe7174cddb1ecddc5398037f7f6f39533ad69207c9a4e2"
dependencies = [
"core-foundation 0.9.2",
"core-foundation 0.9.0",
"core-graphics 0.22.0",
"foreign-types",
"libc",
@ -545,7 +545,7 @@ version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c49d6b4c11dca1a1dd931a34a9f397e2da91abe3de4110505f3530a80e560b52"
dependencies = [
"core-foundation 0.9.2",
"core-foundation 0.9.0",
"core-text",
"libc",
"servo-fontconfig",
@ -1674,7 +1674,7 @@ dependencies = [
"bitflags",
"build-parallel",
"byteorder",
"core-foundation 0.9.2",
"core-foundation 0.9.0",
"core-graphics 0.22.0",
"core-text",
"derive_more",
@ -1731,7 +1731,7 @@ dependencies = [
"app_units",
"bitflags",
"byteorder",
"core-foundation 0.9.2",
"core-foundation 0.9.0",
"core-graphics 0.22.0",
"crossbeam-channel",
"derive_more",
@ -1833,7 +1833,7 @@ dependencies = [
"base64",
"chrono",
"clap",
"core-foundation 0.9.2",
"core-foundation 0.9.0",
"core-graphics 0.22.0",
"crossbeam",
"dwrote",

Просмотреть файл

@ -65,7 +65,7 @@ libc = "0.2"
dwrote = "0.11"
[target.'cfg(target_os = "macos")'.dependencies]
core-foundation = "0.9.2"
core-foundation = "0.9"
core-graphics = "0.22"
core-text = { version = "19", default-features = false }
objc = "0.2"

Просмотреть файл

@ -437,7 +437,7 @@ impl FontContext {
}
assert_eq!(index, 0);
let data = CFData::from_arc(bytes);
let data = CFData_wrapping_arc_vec(bytes);
let ct_font_desc = match create_font_descriptor(data) {
Err(_) => return,
Ok(desc) => desc,
@ -1029,6 +1029,50 @@ enum GlyphType {
Bitmap,
}
// This stuff should eventually migrate to upstream core-foundation
#[allow(non_snake_case)]
fn CFData_wrapping_arc_vec(buffer: Arc<Vec<u8>>) -> CFData {
use core_foundation::base::*;
use core_foundation::data::CFDataRef;
use std::os::raw::c_void;
extern "C" {
pub fn CFDataCreateWithBytesNoCopy(
allocator: CFAllocatorRef,
bytes: *const u8,
length: CFIndex,
allocator: CFAllocatorRef,
) -> CFDataRef;
}
unsafe {
let ptr = (*buffer).as_ptr() as *const _;
let len = buffer.len().to_CFIndex();
let info = Arc::into_raw(buffer) as *mut c_void;
extern "C" fn deallocate(_: *mut c_void, info: *mut c_void) {
unsafe {
drop(Arc::from_raw(info as *mut Vec<u8>));
}
}
// CFAllocatorContext doesn't have nullable members so we transmute
let allocator = CFAllocator::new(CFAllocatorContext {
info: info,
version: 0,
retain: None,
reallocate: None,
release: None,
copyDescription: None,
allocate: None,
deallocate: Some(deallocate),
preferredSize: None,
});
let data_ref =
CFDataCreateWithBytesNoCopy(kCFAllocatorDefault, ptr, len, allocator.as_CFTypeRef());
TCFType::wrap_under_create_rule(data_ref)
}
}
fn create_font_descriptor(cf_data: CFData) -> Result<CTFontDescriptor, ()> {
use core_foundation::data::CFDataRef;
extern {