Update Webrender

Fixes #20609
This commit is contained in:
Bastien Orivel 2018-04-10 15:23:50 +02:00 committed by Anthony Ramine
parent 9c6d9f612e
commit 8bd2e91cdc
20 changed files with 296 additions and 346 deletions

View file

@ -22,7 +22,7 @@ euclid = "0.17"
fnv = "1.0"
fontsan = {git = "https://github.com/servo/fontsan"}
gfx_traits = {path = "../gfx_traits"}
harfbuzz-sys = "0.1"
harfbuzz-sys = "0.2"
ipc-channel = "0.10"
lazy_static = "1"
libc = "0.2"
@ -42,7 +42,7 @@ smallvec = "0.6"
style = {path = "../style"}
time = "0.1.12"
unicode-bidi = {version = "0.3", features = ["with_serde"]}
unicode-script = {version = "0.1", features = ["harfbuzz"]}
unicode-script = {version = "0.2", features = ["harfbuzz"]}
webrender_api = {git = "https://github.com/servo/webrender", features = ["ipc"]}
xi-unicode = "0.1.0"
@ -53,7 +53,7 @@ core-graphics = "0.13"
core-text = "9.0"
[target.'cfg(any(target_os = "linux", target_os = "android"))'.dependencies]
freetype = "0.3"
freetype = "0.4"
servo_allocator = {path = "../allocator"}
[target.'cfg(target_os = "linux")'.dependencies]

View file

@ -38,7 +38,7 @@ extern crate harfbuzz_sys as harfbuzz;
extern crate ipc_channel;
#[macro_use]
extern crate lazy_static;
extern crate libc;
#[cfg(any(target_os = "linux", target_os = "android"))] extern crate libc;
#[macro_use]
extern crate log;
#[cfg_attr(target_os = "windows", macro_use)]

View file

@ -14,6 +14,7 @@ use freetype::freetype::{FT_Int32, FT_Kerning_Mode, FT_STYLE_FLAG_ITALIC};
use freetype::freetype::{FT_Load_Glyph, FT_Set_Char_Size};
use freetype::freetype::{FT_SizeRec, FT_Size_Metrics, FT_UInt, FT_Vector};
use freetype::freetype::FT_Sfnt_Tag;
use freetype::succeeded;
use freetype::tt_os2::TT_OS2;
use platform::font_context::FontContextHandle;
use platform::font_template::FontTemplateData;
@ -78,7 +79,7 @@ impl Drop for FontHandle {
fn drop(&mut self) {
assert!(!self.face.is_null());
unsafe {
if !FT_Done_Face(self.face).succeeded() {
if !succeeded(FT_Done_Face(self.face)) {
panic!("FT_Done_Face failed");
}
}
@ -115,7 +116,7 @@ impl FontHandleMethods for FontHandle {
let result = FT_New_Memory_Face(lib, buffer.as_ptr(), buffer.len() as FT_Long,
face_index, &mut face);
if !result.succeeded() || face.is_null() {
if !succeeded(result) || face.is_null() {
return Err(());
}
if let Some(s) = pt_size {
@ -222,7 +223,7 @@ impl FontHandleMethods for FontHandle {
let res = FT_Load_Glyph(self.face,
glyph as FT_UInt,
GLYPH_LOAD_FLAGS);
if res.succeeded() {
if succeeded(res) {
let void_glyph = (*self.face).glyph;
let slot: FT_GlyphSlot = mem::transmute(void_glyph);
assert!(!slot.is_null());
@ -296,12 +297,12 @@ impl FontHandleMethods for FontHandle {
unsafe {
// Get the length
let mut len = 0;
if !FT_Load_Sfnt_Table(self.face, tag, 0, ptr::null_mut(), &mut len).succeeded() {
if !succeeded(FT_Load_Sfnt_Table(self.face, tag, 0, ptr::null_mut(), &mut len)) {
return None
}
// Get the bytes
let mut buf = vec![0u8; len as usize];
if !FT_Load_Sfnt_Table(self.face, tag, 0, buf.as_mut_ptr(), &mut len).succeeded() {
if !succeeded(FT_Load_Sfnt_Table(self.face, tag, 0, buf.as_mut_ptr(), &mut len)) {
return None
}
Some(FontTable { buffer: buf })
@ -319,13 +320,13 @@ impl<'a> FontHandle {
unsafe {
let result = FT_Set_Char_Size(face, char_size as FT_F26Dot6, 0, 0, 0);
if result.succeeded() { Ok(()) } else { Err(()) }
if succeeded(result) { Ok(()) } else { Err(()) }
}
}
fn has_table(&self, tag: FontTableTag) -> bool {
unsafe {
FT_Load_Sfnt_Table(self.face, tag as FT_ULong, 0, ptr::null_mut(), &mut 0).succeeded()
succeeded(FT_Load_Sfnt_Table(self.face, tag as FT_ULong, 0, ptr::null_mut(), &mut 0))
}
}

View file

@ -8,6 +8,7 @@ use freetype::freetype::FT_Library;
use freetype::freetype::FT_Memory;
use freetype::freetype::FT_MemoryRec_;
use freetype::freetype::FT_New_Library;
use freetype::succeeded;
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
use servo_allocator::libc_compat::{malloc, realloc, free};
use servo_allocator::usable_size;
@ -120,7 +121,7 @@ impl FontContextHandle {
let mut ctx: FT_Library = ptr::null_mut();
let result = FT_New_Library(mem, &mut ctx);
if !result.succeeded() { panic!("Unable to initialize FreeType library"); }
if !succeeded(result) { panic!("Unable to initialize FreeType library"); }
FT_Add_Default_Modules(ctx);

View file

@ -25,17 +25,17 @@ use harfbuzz::hb_face_destroy;
use harfbuzz::hb_feature_t;
use harfbuzz::hb_font_create;
use harfbuzz::hb_font_funcs_create;
use harfbuzz::hb_font_funcs_set_glyph_func;
use harfbuzz::hb_font_funcs_set_glyph_h_advance_func;
use harfbuzz::hb_font_funcs_set_glyph_h_kerning_func;
use harfbuzz::hb_font_funcs_set_nominal_glyph_func;
use harfbuzz::hb_font_set_funcs;
use harfbuzz::hb_font_set_ppem;
use harfbuzz::hb_font_set_scale;
use harfbuzz::hb_glyph_info_t;
use harfbuzz::hb_glyph_position_t;
use libc::{c_char, c_int, c_uint, c_void};
use platform::font::FontTable;
use std::{char, cmp, ptr};
use std::os::raw::{c_char, c_int, c_uint, c_void};
use text::glyph::{ByteIndex, GlyphData, GlyphId, GlyphStore};
use text::shaping::ShaperMethods;
use text::util::{fixed_to_float, float_to_fixed, is_bidi_control};
@ -418,7 +418,7 @@ unsafe impl Sync for FontFuncs {}
lazy_static! {
static ref HB_FONT_FUNCS: FontFuncs = unsafe {
let hb_funcs = hb_font_funcs_create();
hb_font_funcs_set_glyph_func(hb_funcs, Some(glyph_func), ptr::null_mut(), None);
hb_font_funcs_set_nominal_glyph_func(hb_funcs, Some(glyph_func), ptr::null_mut(), None);
hb_font_funcs_set_glyph_h_advance_func(
hb_funcs, Some(glyph_h_advance_func), ptr::null_mut(), None);
hb_font_funcs_set_glyph_h_kerning_func(
@ -431,7 +431,6 @@ lazy_static! {
extern fn glyph_func(_: *mut hb_font_t,
font_data: *mut c_void,
unicode: hb_codepoint_t,
_: hb_codepoint_t,
glyph: *mut hb_codepoint_t,
_: *mut c_void)
-> hb_bool_t {