servo: Merge #18002 - Update WR (text optimizations, Linux subpixel positioning / rasterization) (from glennw:update-wr-linux-subpx); r=emilio

Source-Repo: https://github.com/servo/servo
Source-Revision: 31582a487437f599005bb96bf94a1942b8e46d24

--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : 99de154135f2cea70619c0400e1c0e1fdb05f68c
This commit is contained in:
Glenn Watson 2017-08-08 16:05:54 -05:00
Родитель 42c8241ce0
Коммит 60b7df739c
9 изменённых файлов: 74 добавлений и 48 удалений

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

@ -108,15 +108,15 @@ dependencies = [
[[package]]
name = "azure"
version = "0.20.0"
source = "git+https://github.com/servo/rust-azure#71de5aa53e7c6faf10ceadce6538856649099263"
version = "0.20.1"
source = "git+https://github.com/servo/rust-azure#ca851788b3bc1f1034d4d899da66faf78e420c5e"
dependencies = [
"cmake 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)",
"core-foundation 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"core-graphics 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
"core-text 6.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.15.1 (registry+https://github.com/rust-lang/crates.io-index)",
"freetype 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"freetype 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)",
"servo-egl 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"servo-freetype-sys 4.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
@ -323,7 +323,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
name = "canvas"
version = "0.0.1"
dependencies = [
"azure 0.20.0 (git+https://github.com/servo/rust-azure)",
"azure 0.20.1 (git+https://github.com/servo/rust-azure)",
"canvas_traits 0.0.1",
"cssparser 0.18.0 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.15.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -960,7 +960,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "freetype"
version = "0.2.0"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1058,9 +1058,9 @@ dependencies = [
"euclid 0.15.1 (registry+https://github.com/rust-lang/crates.io-index)",
"fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
"fontsan 0.3.2 (git+https://github.com/servo/fontsan)",
"freetype 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"freetype 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gfx_traits 0.0.1",
"harfbuzz-sys 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
"harfbuzz-sys 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_derive 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1188,11 +1188,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "harfbuzz-sys"
version = "0.1.10"
version = "0.1.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cmake 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)",
"freetype 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"freetype 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -3335,7 +3335,7 @@ name = "unicode-script"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"harfbuzz-sys 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
"harfbuzz-sys 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -3478,7 +3478,7 @@ dependencies = [
[[package]]
name = "webrender"
version = "0.48.0"
source = "git+https://github.com/servo/webrender#6dd3ddb0453697d3271f52133d88c182aa2f3b08"
source = "git+https://github.com/servo/webrender#b13a3b8f776b2ef4d5672173c9a3aa77c7b87936"
dependencies = [
"app_units 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
"bincode 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -3489,7 +3489,7 @@ dependencies = [
"core-text 6.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"dwrote 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.15.1 (registry+https://github.com/rust-lang/crates.io-index)",
"freetype 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"freetype 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)",
"gamma-lut 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)",
@ -3507,7 +3507,7 @@ dependencies = [
[[package]]
name = "webrender_api"
version = "0.48.0"
source = "git+https://github.com/servo/webrender#6dd3ddb0453697d3271f52133d88c182aa2f3b08"
source = "git+https://github.com/servo/webrender#b13a3b8f776b2ef4d5672173c9a3aa77c7b87936"
dependencies = [
"app_units 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
"bincode 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -3516,6 +3516,7 @@ dependencies = [
"core-graphics 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
"dwrote 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.15.1 (registry+https://github.com/rust-lang/crates.io-index)",
"fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -3652,7 +3653,7 @@ dependencies = [
"checksum aster 0.41.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4ccfdf7355d9db158df68f976ed030ab0f6578af811f5a7bb6dcf221ec24e0e0"
"checksum atomic_refcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fb2dcb6e6d35f20276943cc04bb98e538b348d525a04ac79c10021561d202f21"
"checksum audio-video-metadata 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3b6ef29ee98ad95a37f34547fd7fb40724772294110ed6ca0445fc2e964c29d1"
"checksum azure 0.20.0 (git+https://github.com/servo/rust-azure)" = "<none>"
"checksum azure 0.20.1 (git+https://github.com/servo/rust-azure)" = "<none>"
"checksum backtrace 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "72f9b4182546f4b04ebc4ab7f84948953a118bd6021a1b6a6c909e3e94f6be76"
"checksum backtrace-sys 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "3a0d842ea781ce92be2bf78a9b38883948542749640b8378b3b2f03d1fd9f1ff"
"checksum base64 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "30e93c03064e7590d0466209155251b90c22e37fab1daf2771582598b5827557"
@ -3728,7 +3729,7 @@ dependencies = [
"checksum fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6cc484842f1e2884faf56f529f960cc12ad8c71ce96cc7abba0a067c98fee344"
"checksum fontsan 0.3.2 (git+https://github.com/servo/fontsan)" = "<none>"
"checksum foreign-types 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3e4056b9bd47f8ac5ba12be771f77a0dae796d1bbaaf5fd0b9c2d38b69b8a29d"
"checksum freetype 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fde23272c687e4570aefec06cb71174ec0f5284b725deac4e77ba2665d635faf"
"checksum freetype 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "398b8a11884898184d55aca9806f002b3cf68f0e860e0cbb4586f834ee39b0e7"
"checksum futf 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "51f93f3de6ba1794dcd5810b3546d004600a59a98266487c8407bc4b24e398f3"
"checksum futures 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "55f0008e13fc853f79ea8fc86e931486860d4c4c156cdffb59fa5f7fa833660a"
"checksum fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c"
@ -3743,7 +3744,7 @@ dependencies = [
"checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb"
"checksum glx 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b280007fa9c7442cfd1e0b1addb8d1a59240267110e8705f8f7e2c7bfb7e2f72"
"checksum half 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "63d68db75012a85555434ee079e7e6337931f87a087ab2988becbadf64673a7f"
"checksum harfbuzz-sys 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "3072efe30deebdda55fcbe7c74c6d42f546fd8533488e43a692ea940ecface11"
"checksum harfbuzz-sys 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "61e6e99c20fe855e4d3836d037e252a1b7755ef99d00126071c68604b87bd29a"
"checksum heapsize 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4c7593b1522161003928c959c20a2ca421c68e940d63d75573316a009e48a6d4"
"checksum heapsize_derive 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "46f96d52fb1564059fc97b85ef6165728cc30198ab60073bf114c66c4c89bb5d"
"checksum heartbeats-simple 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9ad003ce233955e9d95f2c69cde84e68302ba9ba4a673d351c9bff93c738aadc"

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

@ -585,28 +585,32 @@ impl<'a> CanvasPaintThread<'a> {
};
let data = webrender_api::ImageData::Raw(Arc::new(element.into()));
let mut updates = webrender_api::ResourceUpdates::new();
match self.image_key {
Some(image_key) => {
debug!("Updating image {:?}.", image_key);
self.webrender_api.update_image(image_key,
descriptor,
data,
None);
updates.update_image(image_key,
descriptor,
data,
None);
}
None => {
self.image_key = Some(self.webrender_api.generate_image_key());
debug!("New image {:?}.", self.image_key);
self.webrender_api.add_image(self.image_key.unwrap(),
descriptor,
data,
None);
updates.add_image(self.image_key.unwrap(),
descriptor,
data,
None);
}
}
if let Some(image_key) = mem::replace(&mut self.very_old_image_key, self.old_image_key.take()) {
self.webrender_api.delete_image(image_key);
updates.delete_image(image_key);
}
self.webrender_api.update_resources(updates);
let data = CanvasImageData {
image_key: self.image_key.unwrap(),
};
@ -764,12 +768,16 @@ impl<'a> CanvasPaintThread<'a> {
impl<'a> Drop for CanvasPaintThread<'a> {
fn drop(&mut self) {
let mut updates = webrender_api::ResourceUpdates::new();
if let Some(image_key) = self.old_image_key.take() {
self.webrender_api.delete_image(image_key);
updates.delete_image(image_key);
}
if let Some(image_key) = self.very_old_image_key.take() {
self.webrender_api.delete_image(image_key);
updates.delete_image(image_key);
}
self.webrender_api.update_resources(updates);
}
}

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

@ -281,26 +281,30 @@ impl WebGLPaintThread {
};
let data = webrender_api::ImageData::Raw(Arc::new(pixels));
let mut updates = webrender_api::ResourceUpdates::new();
match *image_key {
Some(image_key) => {
webrender_api.update_image(image_key,
descriptor,
data,
None);
updates.update_image(image_key,
descriptor,
data,
None);
}
None => {
*image_key = Some(webrender_api.generate_image_key());
webrender_api.add_image(image_key.unwrap(),
descriptor,
data,
None);
updates.add_image(image_key.unwrap(),
descriptor,
data,
None);
}
}
if let Some(image_key) = mem::replace(very_old_image_key, old_image_key.take()) {
webrender_api.delete_image(image_key);
updates.delete_image(image_key);
}
webrender_api.update_resources(updates);
let image_data = CanvasImageData {
image_key: image_key.unwrap(),
};
@ -357,15 +361,19 @@ impl Drop for WebGLPaintThread {
very_old_image_key,
..
} = self.data {
let mut updates = webrender_api::ResourceUpdates::new();
if let Some(image_key) = image_key {
webrender_api.delete_image(image_key);
updates.delete_image(image_key);
}
if let Some(image_key) = old_image_key {
webrender_api.delete_image(image_key);
updates.delete_image(image_key);
}
if let Some(image_key) = very_old_image_key {
webrender_api.delete_image(image_key);
updates.delete_image(image_key);
}
webrender_api.update_resources(updates);
}
}
}

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

@ -819,8 +819,9 @@ impl<Window: WindowMethods> IOCompositor<Window> {
}
WindowEvent::ToggleWebRenderProfiler => {
let profiler_enabled = self.webrender.get_profiler_enabled();
self.webrender.set_profiler_enabled(!profiler_enabled);
let mut flags = self.webrender.get_debug_flags();
flags.toggle(webrender::renderer::PROFILER_DBG);
self.webrender.set_debug_flags(flags);
self.webrender_api.generate_frame(self.webrender_document, None);
}
}

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

@ -49,7 +49,7 @@ core-graphics = "0.8"
core-text = "6.0"
[target.'cfg(any(target_os = "linux", target_os = "android"))'.dependencies]
freetype = "0.2"
freetype = "0.3"
[target.'cfg(target_os = "linux")'.dependencies]
servo-fontconfig = "0.2.1"

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

@ -348,11 +348,13 @@ impl FontCache {
let webrender_fonts = &mut self.webrender_fonts;
font_key = Some(*webrender_fonts.entry(template.identifier.clone()).or_insert_with(|| {
let font_key = webrender_api.generate_font_key();
let mut updates = webrender_api::ResourceUpdates::new();
match (template.bytes_if_in_memory(), template.native_font()) {
(Some(bytes), _) => webrender_api.add_raw_font(font_key, bytes, 0),
(None, Some(native_font)) => webrender_api.add_native_font(font_key, native_font),
(None, None) => webrender_api.add_raw_font(font_key, template.bytes().clone(), 0),
(Some(bytes), _) => updates.add_raw_font(font_key, bytes, 0),
(None, Some(native_font)) => updates.add_native_font(font_key, native_font),
(None, None) => updates.add_raw_font(font_key, template.bytes().clone(), 0),
}
webrender_api.update_resources(updates);
font_key
}));
}

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

@ -1064,7 +1064,8 @@ impl LayoutThread {
Some(get_root_flow_background_color(layout_root)),
viewport_size,
builder.finalize(),
true);
true,
webrender_api::ResourceUpdates::new());
self.webrender_api.generate_frame(self.webrender_document, None);
});
}

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

@ -79,7 +79,9 @@ fn set_webrender_image_key(webrender_api: &webrender_api::RenderApi, image: &mut
};
let data = webrender_api::ImageData::new(bytes);
let image_key = webrender_api.generate_image_key();
webrender_api.add_image(image_key, descriptor, data, None);
let mut updates = webrender_api::ResourceUpdates::new();
updates.add_image(image_key, descriptor, data, None);
webrender_api.update_resources(updates);
image.id = Some(image_key);
}

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

@ -174,11 +174,14 @@ impl<Window> Browser<Window> where Window: WindowMethods + 'static {
None
};
let mut debug_flags = webrender::renderer::DebugFlags::empty();
debug_flags.set(webrender::renderer::PROFILER_DBG, opts.webrender_stats);
webrender::Renderer::new(window.gl(), webrender::RendererOptions {
device_pixel_ratio: device_pixel_ratio,
resource_override_path: Some(resource_path),
enable_aa: opts.enable_text_antialiasing,
enable_profiler: opts.webrender_stats,
debug_flags: debug_flags,
enable_batcher: opts.webrender_batch,
debug: opts.webrender_debug,
recorder: recorder,