зеркало из https://github.com/mozilla/gecko-dev.git
Merge autoland to mozilla-central. a=merge
This commit is contained in:
Коммит
56680c0c2c
|
@ -809,7 +809,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "dwrote"
|
||||
version = "0.6.3"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"lazy_static 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -2987,7 +2987,7 @@ dependencies = [
|
|||
"core-foundation 0.6.3 (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.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"dwrote 0.7.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.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -3017,7 +3017,7 @@ dependencies = [
|
|||
"byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"core-foundation 0.6.3 (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.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"dwrote 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"euclid 0.19.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_bytes 0.10.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -3033,7 +3033,7 @@ dependencies = [
|
|||
"bincode 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"core-foundation 0.6.3 (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.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"dwrote 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"euclid 0.19.4 (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)",
|
||||
|
@ -3252,7 +3252,7 @@ dependencies = [
|
|||
"checksum docopt 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)" = "d8acd393692c503b168471874953a2531df0e9ab77d0b6bbc582395743300a4a"
|
||||
"checksum dtoa 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "09c3753c3db574d215cba4ea76018483895d7bff25a31b49ba45db21c48e50ab"
|
||||
"checksum dtoa-short 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "068d4026697c1a18f0b0bb8cfcad1b0c151b90d8edb9bf4c235ad68128920d1d"
|
||||
"checksum dwrote 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "f0beca78470f26189a662e72afe7a54c625b4feb06b2d36c207ac15319bd57c5"
|
||||
"checksum dwrote 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2d2ea0fd88d96838ce5ed30326338cc04a0eb4cff10e3e15d188d74112777103"
|
||||
"checksum either 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "18785c1ba806c258137c937e44ada9ee7e69a37e3c72077542cd2f069d78562a"
|
||||
"checksum ena 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "88dc8393b3c7352f94092497f6b52019643e493b6b890eb417cdb7c46117e621"
|
||||
"checksum encoding_c 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "769ecb8b33323998e482b218c0d13cd64c267609023b4b7ec3ee740714c318ee"
|
||||
|
|
|
@ -109,7 +109,6 @@
|
|||
<textbox id="calls-searchbox"
|
||||
class="devtools-filterinput"
|
||||
placeholder="&canvasDebuggerUI.searchboxPlaceholder;"
|
||||
type="search"
|
||||
flex="1"/>
|
||||
</toolbar>
|
||||
<vbox id="calls-list" flex="1"/>
|
||||
|
|
|
@ -441,9 +441,8 @@ VariablesView.prototype = {
|
|||
const searchbox = this._searchboxNode = document.createXULElement("textbox");
|
||||
searchbox.className = "variables-view-searchinput devtools-filterinput";
|
||||
searchbox.setAttribute("placeholder", this._searchboxPlaceholder);
|
||||
searchbox.setAttribute("type", "search");
|
||||
searchbox.setAttribute("flex", "1");
|
||||
searchbox.addEventListener("command", this._onSearchboxInput);
|
||||
searchbox.addEventListener("input", this._onSearchboxInput);
|
||||
searchbox.addEventListener("keydown", this._onSearchboxKeyDown);
|
||||
|
||||
container.appendChild(searchbox);
|
||||
|
@ -460,7 +459,7 @@ VariablesView.prototype = {
|
|||
return;
|
||||
}
|
||||
this._searchboxContainer.remove();
|
||||
this._searchboxNode.removeEventListener("command", this._onSearchboxInput);
|
||||
this._searchboxNode.removeEventListener("input", this._onSearchboxInput);
|
||||
this._searchboxNode.removeEventListener("keydown", this._onSearchboxKeyDown);
|
||||
|
||||
this._searchboxContainer = null;
|
||||
|
|
|
@ -52,8 +52,6 @@
|
|||
<spacer flex="1"/>
|
||||
<textbox id="storage-searchbox"
|
||||
class="devtools-filterinput"
|
||||
type="search"
|
||||
timeout="200"
|
||||
placeholder="&searchBox.placeholder;"/>
|
||||
<button class="devtools-button sidebar-toggle" hidden="true"></button>
|
||||
</hbox>
|
||||
|
|
|
@ -265,7 +265,7 @@ class StorageUI {
|
|||
|
||||
setupToolbar() {
|
||||
this.searchBox = this._panelDoc.getElementById("storage-searchbox");
|
||||
this.searchBox.addEventListener("command", this.filterItems);
|
||||
this.searchBox.addEventListener("input", this.filterItems);
|
||||
|
||||
// Setup the sidebar toggle button.
|
||||
this.sidebarToggleBtn = this._panelDoc.querySelector(".sidebar-toggle");
|
||||
|
|
|
@ -497,16 +497,6 @@ checkbox:-moz-focusring {
|
|||
background-position: calc(100% - 8px) center;
|
||||
}
|
||||
|
||||
/* This is needed to remove the default search icon on windows. See bug 1400615. */
|
||||
.devtools-filterinput > .textbox-input-box > .textbox-search-sign {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.devtools-searchinput > .textbox-input-box > .textbox-search-icons > .textbox-search-icon,
|
||||
.devtools-filterinput > .textbox-input-box > .textbox-search-icons > .textbox-search-icon {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
.devtools-searchinput .textbox-input::placeholder,
|
||||
.devtools-filterinput .textbox-input::placeholder {
|
||||
font-style: normal;
|
||||
|
@ -638,28 +628,6 @@ checkbox:-moz-focusring {
|
|||
background-position: -16px 0;
|
||||
}
|
||||
|
||||
.theme-dark .devtools-searchinput > .textbox-input-box > .textbox-search-icons > .textbox-search-clear,
|
||||
.theme-dark .devtools-filterinput > .textbox-input-box > .textbox-search-icons > .textbox-search-clear {
|
||||
list-style-image: url("chrome://devtools/skin/images/search-clear-dark.svg");
|
||||
-moz-image-region: rect(0, 16px, 16px, 0);
|
||||
}
|
||||
|
||||
.theme-light .devtools-searchinput > .textbox-input-box > .textbox-search-icons > .textbox-search-clear,
|
||||
.theme-light .devtools-filterinput > .textbox-input-box > .textbox-search-icons > .textbox-search-clear {
|
||||
list-style-image: url("chrome://devtools/skin/images/search-clear-light.svg");
|
||||
-moz-image-region: rect(0, 16px, 16px, 0);
|
||||
}
|
||||
|
||||
.devtools-searchinput > .textbox-input-box > .textbox-search-icons > .textbox-search-clear,
|
||||
.devtools-filterinput > .textbox-input-box > .textbox-search-icons > .textbox-search-clear {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.devtools-searchinput > .textbox-input-box > .textbox-search-icons > .textbox-search-clear:hover,
|
||||
.devtools-filterinput > .textbox-input-box > .textbox-search-icons > .textbox-search-clear:hover {
|
||||
-moz-image-region: rect(0, 32px, 16px, 16px);
|
||||
}
|
||||
|
||||
/* Twisty and checkbox controls */
|
||||
|
||||
.theme-twisty {
|
||||
|
|
|
@ -23,7 +23,7 @@ default-features = false
|
|||
features = ["capture", "serialize_program"]
|
||||
|
||||
[target.'cfg(target_os = "windows")'.dependencies]
|
||||
dwrote = "0.6.3"
|
||||
dwrote = "0.7"
|
||||
|
||||
[target.'cfg(target_os = "macos")'.dependencies]
|
||||
core-foundation = "0.6"
|
||||
|
|
|
@ -1 +1 @@
|
|||
ff9940fdf95412a3e5d1a70c78defba6e919c170
|
||||
f24d6fbc8598dbaffee70b745e043dd390664f72
|
||||
|
|
|
@ -366,7 +366,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
|
||||
[[package]]
|
||||
name = "dwrote"
|
||||
version = "0.6.3"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -1545,7 +1545,7 @@ dependencies = [
|
|||
"core-foundation 0.6.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.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"dwrote 0.7.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.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -1599,7 +1599,7 @@ dependencies = [
|
|||
"byteorder 1.2.7 (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.17.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"dwrote 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"dwrote 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"euclid 0.19.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ipc-channel 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -1686,7 +1686,7 @@ dependencies = [
|
|||
"core-foundation 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"core-graphics 0.17.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"crossbeam 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"dwrote 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"dwrote 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"env_logger 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"euclid 0.19.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"font-loader 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -1814,7 +1814,7 @@ dependencies = [
|
|||
"checksum dlib 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "77e51249a9d823a4cb79e3eca6dcd756153e8ed0157b6c04775d04bf1b13b76a"
|
||||
"checksum downcast-rs 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "18df8ce4470c189d18aa926022da57544f31e154631eb4cfe796aea97051fe6c"
|
||||
"checksum dtoa 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "09c3753c3db574d215cba4ea76018483895d7bff25a31b49ba45db21c48e50ab"
|
||||
"checksum dwrote 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "f0beca78470f26189a662e72afe7a54c625b4feb06b2d36c207ac15319bd57c5"
|
||||
"checksum dwrote 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2d2ea0fd88d96838ce5ed30326338cc04a0eb4cff10e3e15d188d74112777103"
|
||||
"checksum either 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3be565ca5c557d7f59e7cfcf1844f9e3033650c929c6566f511e8005f205c1d0"
|
||||
"checksum env_logger 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)" = "0e6e40ebb0e66918a37b38c7acab4e10d299e0463fe2af5d29b9cc86710cfd2a"
|
||||
"checksum euclid 0.19.4 (registry+https://github.com/rust-lang/crates.io-index)" = "dbbf962bb6f877239a34491f2e0a12c6b824f389bc789eb90f1d70d4780b0727"
|
||||
|
|
|
@ -79,7 +79,7 @@ freetype = { version = "0.4", default-features = false }
|
|||
libc = "0.2"
|
||||
|
||||
[target.'cfg(target_os = "windows")'.dependencies]
|
||||
dwrote = "0.6.3"
|
||||
dwrote = "0.7"
|
||||
|
||||
[target.'cfg(target_os = "macos")'.dependencies]
|
||||
core-foundation = "0.6"
|
||||
|
|
|
@ -681,11 +681,13 @@ pub(in glyph_rasterizer) struct GlyphRasterJob {
|
|||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub enum GlyphRasterResult {
|
||||
pub enum GlyphRasterError {
|
||||
LoadFailed,
|
||||
Bitmap(RasterizedGlyph),
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub type GlyphRasterResult = Result<RasterizedGlyph, GlyphRasterError>;
|
||||
|
||||
#[derive(Debug, Copy, Clone, Eq, Hash, PartialEq)]
|
||||
#[cfg_attr(feature = "capture", derive(Serialize))]
|
||||
#[cfg_attr(feature = "replay", derive(Deserialize))]
|
||||
|
|
|
@ -13,7 +13,7 @@ use rayon::prelude::*;
|
|||
use std::sync::{Arc, MutexGuard};
|
||||
use platform::font::FontContext;
|
||||
use glyph_rasterizer::{FontInstance, FontContexts, GlyphKey};
|
||||
use glyph_rasterizer::{GlyphRasterizer, GlyphRasterJob, GlyphRasterJobs, GlyphRasterResult};
|
||||
use glyph_rasterizer::{GlyphRasterizer, GlyphRasterJob, GlyphRasterJobs};
|
||||
use glyph_cache::{GlyphCache, CachedGlyphInfo, GlyphCacheEntry};
|
||||
use resource_cache::CachedImageData;
|
||||
use texture_cache::{TextureCache, TextureCacheHandle, Eviction};
|
||||
|
@ -113,7 +113,7 @@ impl GlyphRasterizer {
|
|||
};
|
||||
|
||||
// Sanity check.
|
||||
if let GlyphRasterResult::Bitmap(ref glyph) = job.result {
|
||||
if let Ok(ref glyph) = job.result {
|
||||
let bpp = 4; // We always render glyphs in 32 bits RGBA format.
|
||||
assert_eq!(
|
||||
glyph.bytes.len(),
|
||||
|
@ -161,12 +161,11 @@ impl GlyphRasterizer {
|
|||
|
||||
for GlyphRasterJob { key, result } in jobs {
|
||||
let glyph_info = match result {
|
||||
GlyphRasterResult::LoadFailed => GlyphCacheEntry::Blank,
|
||||
GlyphRasterResult::Bitmap(ref glyph) if glyph.width == 0 ||
|
||||
glyph.height == 0 => {
|
||||
Err(_) => GlyphCacheEntry::Blank,
|
||||
Ok(ref glyph) if glyph.width == 0 || glyph.height == 0 => {
|
||||
GlyphCacheEntry::Blank
|
||||
}
|
||||
GlyphRasterResult::Bitmap(glyph) => {
|
||||
Ok(glyph) => {
|
||||
assert_eq!((glyph.left.fract(), glyph.top.fract()), (0.0, 0.0));
|
||||
let mut texture_cache_handle = TextureCacheHandle::invalid();
|
||||
texture_cache.request(&texture_cache_handle, gpu_cache);
|
||||
|
|
|
@ -30,7 +30,7 @@ use glyph_rasterizer::{FontInstance, FontTransform, GlyphKey};
|
|||
#[cfg(feature = "pathfinder")]
|
||||
use glyph_rasterizer::NativeFontHandleWrapper;
|
||||
#[cfg(not(feature = "pathfinder"))]
|
||||
use glyph_rasterizer::{GlyphFormat, GlyphRasterResult, RasterizedGlyph};
|
||||
use glyph_rasterizer::{GlyphFormat, GlyphRasterError, GlyphRasterResult, RasterizedGlyph};
|
||||
use internal_types::{FastHashMap, ResourceCacheError};
|
||||
use std::collections::hash_map::Entry;
|
||||
use std::sync::Arc;
|
||||
|
@ -500,11 +500,7 @@ impl FontContext {
|
|||
let (x_scale, y_scale) = font.transform.compute_scale().unwrap_or((1.0, 1.0));
|
||||
let scale = font.oversized_scale_factor(x_scale, y_scale);
|
||||
let size = font.size.scale_by((y_scale / scale) as f32);
|
||||
let ct_font = match self.get_ct_font(font.font_key, size, &font.variations) {
|
||||
Some(font) => font,
|
||||
None => return GlyphRasterResult::LoadFailed,
|
||||
};
|
||||
|
||||
let ct_font = self.get_ct_font(font.font_key, size, &font.variations).ok_or(GlyphRasterError::LoadFailed)?;
|
||||
let glyph_type = if is_bitmap_font(&ct_font) {
|
||||
GlyphType::Bitmap
|
||||
} else {
|
||||
|
@ -559,7 +555,7 @@ impl FontContext {
|
|||
extra_strikes as f64 * pixel_step,
|
||||
);
|
||||
if metrics.rasterized_width == 0 || metrics.rasterized_height == 0 {
|
||||
return GlyphRasterResult::LoadFailed
|
||||
return Err(GlyphRasterError::LoadFailed);
|
||||
}
|
||||
|
||||
let raster_size = Size2D::new(
|
||||
|
@ -724,7 +720,7 @@ impl FontContext {
|
|||
}
|
||||
}
|
||||
|
||||
GlyphRasterResult::Bitmap(RasterizedGlyph {
|
||||
Ok(RasterizedGlyph {
|
||||
left: metrics.rasterized_left as f32,
|
||||
top: metrics.rasterized_ascent as f32,
|
||||
width: metrics.rasterized_width,
|
||||
|
|
|
@ -20,7 +20,8 @@ use freetype::freetype::{FT_LOAD_NO_BITMAP, FT_LOAD_NO_HINTING, FT_LOAD_VERTICAL
|
|||
use freetype::freetype::{FT_FACE_FLAG_SCALABLE, FT_FACE_FLAG_FIXED_SIZES};
|
||||
use freetype::freetype::{FT_FACE_FLAG_MULTIPLE_MASTERS};
|
||||
use freetype::succeeded;
|
||||
use glyph_rasterizer::{FontInstance, GlyphFormat, GlyphKey, GlyphRasterResult, RasterizedGlyph};
|
||||
use glyph_rasterizer::{FontInstance, GlyphFormat, GlyphKey};
|
||||
use glyph_rasterizer::{GlyphRasterError, GlyphRasterResult, RasterizedGlyph};
|
||||
#[cfg(feature = "pathfinder")]
|
||||
use glyph_rasterizer::NativeFontHandleWrapper;
|
||||
use internal_types::{FastHashMap, ResourceCacheError};
|
||||
|
@ -754,23 +755,18 @@ impl FontContext {
|
|||
|
||||
#[cfg(not(feature = "pathfinder"))]
|
||||
pub fn rasterize_glyph(&mut self, font: &FontInstance, key: &GlyphKey) -> GlyphRasterResult {
|
||||
let (slot, scale) = match self.load_glyph(font, key) {
|
||||
Some(val) => val,
|
||||
None => return GlyphRasterResult::LoadFailed,
|
||||
};
|
||||
let (slot, scale) = self.load_glyph(font, key).ok_or(GlyphRasterError::LoadFailed)?;
|
||||
|
||||
// Get dimensions of the glyph, to see if we need to rasterize it.
|
||||
// Don't apply scaling to the dimensions, as the glyph cache needs to know the actual
|
||||
// footprint of the glyph.
|
||||
let dimensions = match self.get_glyph_dimensions_impl(slot, font, key, scale, false) {
|
||||
Some(val) => val,
|
||||
None => return GlyphRasterResult::LoadFailed,
|
||||
};
|
||||
let dimensions = self.get_glyph_dimensions_impl(slot, font, key, scale, false)
|
||||
.ok_or(GlyphRasterError::LoadFailed)?;
|
||||
let GlyphDimensions { mut left, mut top, width, height, .. } = dimensions;
|
||||
|
||||
// For spaces and other non-printable characters, early out.
|
||||
if width == 0 || height == 0 {
|
||||
return GlyphRasterResult::LoadFailed;
|
||||
return Err(GlyphRasterError::LoadFailed);
|
||||
}
|
||||
|
||||
let format = unsafe { (*slot).format };
|
||||
|
@ -778,13 +774,13 @@ impl FontContext {
|
|||
FT_Glyph_Format::FT_GLYPH_FORMAT_BITMAP => {}
|
||||
FT_Glyph_Format::FT_GLYPH_FORMAT_OUTLINE => {
|
||||
if !self.rasterize_glyph_outline(slot, font, key, scale) {
|
||||
return GlyphRasterResult::LoadFailed;
|
||||
return Err(GlyphRasterError::LoadFailed);
|
||||
}
|
||||
}
|
||||
_ => {
|
||||
error!("Unsupported format");
|
||||
debug!("format={:?}", format);
|
||||
return GlyphRasterResult::LoadFailed;
|
||||
return Err(GlyphRasterError::LoadFailed);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -943,7 +939,7 @@ impl FontContext {
|
|||
_ => font.get_alpha_glyph_format(),
|
||||
};
|
||||
|
||||
GlyphRasterResult::Bitmap(RasterizedGlyph {
|
||||
Ok(RasterizedGlyph {
|
||||
left: left as f32,
|
||||
top: top as f32,
|
||||
width: actual_width as i32,
|
||||
|
|
|
@ -16,7 +16,7 @@ cfg_if! {
|
|||
use glyph_rasterizer::NativeFontHandleWrapper;
|
||||
} else if #[cfg(not(feature = "pathfinder"))] {
|
||||
use api::FontInstancePlatformOptions;
|
||||
use glyph_rasterizer::{GlyphFormat, GlyphRasterResult, RasterizedGlyph};
|
||||
use glyph_rasterizer::{GlyphFormat, GlyphRasterError, GlyphRasterResult, RasterizedGlyph};
|
||||
use gamma_lut::GammaLut;
|
||||
}
|
||||
}
|
||||
|
@ -253,7 +253,7 @@ impl FontContext {
|
|||
size: f32,
|
||||
transform: Option<dwrote::DWRITE_MATRIX>,
|
||||
bitmaps: bool,
|
||||
) -> (dwrote::GlyphRunAnalysis, dwrote::DWRITE_TEXTURE_TYPE, dwrote::RECT) {
|
||||
) -> Result<(dwrote::GlyphRunAnalysis, dwrote::DWRITE_TEXTURE_TYPE, dwrote::RECT), dwrote::HRESULT> {
|
||||
let face = self.get_font_face(font);
|
||||
let glyph = key.index() as u16;
|
||||
let advance = 0.0f32;
|
||||
|
@ -290,9 +290,9 @@ impl FontContext {
|
|||
dwrite_measure_mode,
|
||||
0.0,
|
||||
0.0,
|
||||
);
|
||||
)?;
|
||||
let texture_type = dwrite_texture_type(font.render_mode);
|
||||
let bounds = analysis.get_alpha_texture_bounds(texture_type);
|
||||
let bounds = analysis.get_alpha_texture_bounds(texture_type)?;
|
||||
// If the bounds are empty, then we might not be able to render the glyph with cleartype.
|
||||
// Try again with aliased rendering to check if that works instead.
|
||||
if font.render_mode != FontRenderMode::Mono &&
|
||||
|
@ -305,13 +305,13 @@ impl FontContext {
|
|||
dwrite_measure_mode,
|
||||
0.0,
|
||||
0.0,
|
||||
);
|
||||
let bounds2 = analysis2.get_alpha_texture_bounds(dwrote::DWRITE_TEXTURE_ALIASED_1x1);
|
||||
)?;
|
||||
let bounds2 = analysis2.get_alpha_texture_bounds(dwrote::DWRITE_TEXTURE_ALIASED_1x1)?;
|
||||
if bounds2.left != bounds2.right && bounds2.top != bounds2.bottom {
|
||||
return (analysis2, dwrote::DWRITE_TEXTURE_ALIASED_1x1, bounds2);
|
||||
return Ok((analysis2, dwrote::DWRITE_TEXTURE_ALIASED_1x1, bounds2));
|
||||
}
|
||||
}
|
||||
(analysis, texture_type, bounds)
|
||||
Ok((analysis, texture_type, bounds))
|
||||
}
|
||||
|
||||
pub fn get_glyph_index(&mut self, font_key: FontKey, ch: char) -> Option<u32> {
|
||||
|
@ -355,7 +355,7 @@ impl FontContext {
|
|||
} else {
|
||||
None
|
||||
};
|
||||
let (_, _, bounds) = self.create_glyph_analysis(font, key, size, transform, bitmaps);
|
||||
let (_, _, bounds) = self.create_glyph_analysis(font, key, size, transform, bitmaps).ok()?;
|
||||
|
||||
let width = (bounds.right - bounds.left) as i32;
|
||||
let height = (bounds.bottom - bounds.top) as i32;
|
||||
|
@ -486,17 +486,17 @@ impl FontContext {
|
|||
None
|
||||
};
|
||||
|
||||
let (analysis, texture_type, bounds) = self.create_glyph_analysis(font, key, size, transform, bitmaps);
|
||||
|
||||
let (analysis, texture_type, bounds) = self.create_glyph_analysis(font, key, size, transform, bitmaps)
|
||||
.or(Err(GlyphRasterError::LoadFailed))?;
|
||||
let width = (bounds.right - bounds.left) as i32;
|
||||
let height = (bounds.bottom - bounds.top) as i32;
|
||||
// Alpha texture bounds can sometimes return an empty rect
|
||||
// Such as for spaces
|
||||
if width == 0 || height == 0 {
|
||||
return GlyphRasterResult::LoadFailed;
|
||||
return Err(GlyphRasterError::LoadFailed);
|
||||
}
|
||||
|
||||
let pixels = analysis.create_alpha_texture(texture_type, bounds);
|
||||
let pixels = analysis.create_alpha_texture(texture_type, bounds).or(Err(GlyphRasterError::LoadFailed))?;
|
||||
let mut bgra_pixels = self.convert_to_bgra(&pixels, texture_type, font.render_mode, bitmaps);
|
||||
|
||||
// These are the default values we use in Gecko.
|
||||
|
@ -532,7 +532,7 @@ impl FontContext {
|
|||
font.get_glyph_format()
|
||||
};
|
||||
|
||||
GlyphRasterResult::Bitmap(RasterizedGlyph {
|
||||
Ok(RasterizedGlyph {
|
||||
left: bounds.left as f32,
|
||||
top: -bounds.top as f32,
|
||||
width,
|
||||
|
|
|
@ -536,6 +536,7 @@ impl Document {
|
|||
&self.clip_scroll_tree,
|
||||
&self.resources.clip_data_store,
|
||||
));
|
||||
self.hit_tester_is_valid = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -817,6 +817,7 @@ impl LowPrioritySceneBuilder {
|
|||
fn process_transaction(&mut self, mut txn: Box<Transaction>) -> Box<Transaction> {
|
||||
let is_low_priority = true;
|
||||
txn.rasterize_blobs(is_low_priority);
|
||||
txn.blob_requests = Vec::new();
|
||||
|
||||
if self.simulate_slow_ms > 0 {
|
||||
thread::sleep(Duration::from_millis(self.simulate_slow_ms as u64));
|
||||
|
|
|
@ -29,4 +29,4 @@ core-foundation = "0.6"
|
|||
core-graphics = "0.17.1"
|
||||
|
||||
[target.'cfg(target_os = "windows")'.dependencies]
|
||||
dwrote = "0.6.3"
|
||||
dwrote = "0.7"
|
||||
|
|
|
@ -39,7 +39,7 @@ headless = [ "osmesa-sys", "osmesa-src" ]
|
|||
pathfinder = [ "webrender/pathfinder" ]
|
||||
|
||||
[target.'cfg(target_os = "windows")'.dependencies]
|
||||
dwrote = "0.6.3"
|
||||
dwrote = "0.7"
|
||||
mozangle = {version = "0.1.5", features = ["egl"]}
|
||||
|
||||
[target.'cfg(all(unix, not(target_os = "android")))'.dependencies]
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"files":{"Cargo.toml":"5f9a26a7a0f3fffc7093b0ac9e2fd84db133ba5516a9bfb53ed4f842b350564f","README.md":"d69d75705e2582721cbfb2d3b4b2af052c71679057a0b2ac53a22c03f1755bba","appveyor.yml":"7c1e0718a363d3567cecd1ef772d4e17c2a17f18906dc464dce8a2411adff6be","src/bitmap_render_target.rs":"fc13525d7459515e4bf9769c8a8961b046b4d1ba4042591aaf0925dd5edebf64","src/com_helpers.rs":"02535b27bfb0cee6e4d8db3abd22f2d2e8137a4ce3ab3504beaf4fa3ca9370df","src/comptr.rs":"84794cf04b772398e75fdb5d55fd8fa015abf26c61b1f9c761a597133682b2e1","src/font.rs":"a79b944f2f5125bbef9e24921355dc6996f073e3742ddd410b8efaa0df3a3ee2","src/font_collection.rs":"67cd566714f4c0a20cba24dd064ba471e75016fa2672b2153a19878e6b71f24d","src/font_collection_impl.rs":"a585a6ce62083b3346d67619ea47fec46423a7fb04cc11372828389ab26c5a05","src/font_face.rs":"7f78c4132df39857d8118ac3eacbb57e11bca1d69f9d7f8e1c1c24b7a2b69749","src/font_family.rs":"4e948542dba0c158187d0cb2d72343c443380480cacd12894070d0ef1351dd0a","src/font_file.rs":"1c012d0b436c2831d31cd76f77a59dab1edc5d63881c495eb486cd4febe23031","src/font_file_loader_impl.rs":"71c4153971dbfc21d42ba2e33f159fcb145f7dcfbd17e856e9fd75f0571d41e0","src/gdi_interop.rs":"04dbef7c34bb0fe62c4f2c2ceca62ca94c75a964d744b29b3322a6c3bbb4eabd","src/geometry_sink_impl.rs":"d615de212e55b8b8d95c8d605fc5d78044b4ae4dfd846f706911a16cc3afc049","src/glyph_run_analysis.rs":"3b2a351422098a19e8f490421e5b19227fc14a41a0df97d488c536fd1d4b552c","src/helpers.rs":"2f3c57642b24b80c45bbd012e7d6ca1fc524b1b42a8be004cb9b52ea13f4166d","src/lib.rs":"d6a109158cb69cf4a113722169ba8b339d9d38eccb2c9d6b2fe68dd40da22814","src/outline_builder.rs":"0f5c842b2ffe75e21d68f93be6a3834c120bd43303d4e490fdfee9f4f964cdc4","src/rendering_params.rs":"850a51143790f5d29422dc49cbceddc232d814ecd0e6933434ad644e6eec539b","src/test.rs":"158aa4d03655f4efef00327fe72a03dfb504659176aa0eef976ca2485b2c1d74","src/types.rs":"587aea2e50720e85b28efe237c8ea10bc45b52049ca724447a0fc9b0e6672b11"},"package":"f0beca78470f26189a662e72afe7a54c625b4feb06b2d36c207ac15319bd57c5"}
|
||||
{"files":{"Cargo.toml":"2456adfd958e59ec20d4c380e7621684d07817fc015c2372d1cb50473499d359","README.md":"d69d75705e2582721cbfb2d3b4b2af052c71679057a0b2ac53a22c03f1755bba","appveyor.yml":"6a91cdfbcc8c363ead82321b3be509bb7bf9cf8b90c63518d6484371abcfed48","src/bitmap_render_target.rs":"fc13525d7459515e4bf9769c8a8961b046b4d1ba4042591aaf0925dd5edebf64","src/com_helpers.rs":"02535b27bfb0cee6e4d8db3abd22f2d2e8137a4ce3ab3504beaf4fa3ca9370df","src/comptr.rs":"84794cf04b772398e75fdb5d55fd8fa015abf26c61b1f9c761a597133682b2e1","src/font.rs":"a79b944f2f5125bbef9e24921355dc6996f073e3742ddd410b8efaa0df3a3ee2","src/font_collection.rs":"67cd566714f4c0a20cba24dd064ba471e75016fa2672b2153a19878e6b71f24d","src/font_collection_impl.rs":"a585a6ce62083b3346d67619ea47fec46423a7fb04cc11372828389ab26c5a05","src/font_face.rs":"7f78c4132df39857d8118ac3eacbb57e11bca1d69f9d7f8e1c1c24b7a2b69749","src/font_family.rs":"4e948542dba0c158187d0cb2d72343c443380480cacd12894070d0ef1351dd0a","src/font_file.rs":"1c012d0b436c2831d31cd76f77a59dab1edc5d63881c495eb486cd4febe23031","src/font_file_loader_impl.rs":"71c4153971dbfc21d42ba2e33f159fcb145f7dcfbd17e856e9fd75f0571d41e0","src/gdi_interop.rs":"04dbef7c34bb0fe62c4f2c2ceca62ca94c75a964d744b29b3322a6c3bbb4eabd","src/geometry_sink_impl.rs":"d615de212e55b8b8d95c8d605fc5d78044b4ae4dfd846f706911a16cc3afc049","src/glyph_run_analysis.rs":"23c674e892287884ad92faf02813397e4347d61d3b363f6acb8d578c14e65051","src/helpers.rs":"2f3c57642b24b80c45bbd012e7d6ca1fc524b1b42a8be004cb9b52ea13f4166d","src/lib.rs":"16cc8c236226047bc5ca65f921d2aebec4a3a6101a2c8f2853f39a5db4639e16","src/outline_builder.rs":"0f5c842b2ffe75e21d68f93be6a3834c120bd43303d4e490fdfee9f4f964cdc4","src/rendering_params.rs":"850a51143790f5d29422dc49cbceddc232d814ecd0e6933434ad644e6eec539b","src/test.rs":"158aa4d03655f4efef00327fe72a03dfb504659176aa0eef976ca2485b2c1d74","src/types.rs":"9374d8c5bac80e5e0b66188c5ff4f5f49264e15db837049932d4fd703c33746e"},"package":"2d2ea0fd88d96838ce5ed30326338cc04a0eb4cff10e3e15d188d74112777103"}
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
[package]
|
||||
name = "dwrote"
|
||||
version = "0.6.3"
|
||||
version = "0.7.0"
|
||||
authors = ["Vladimir Vukicevic <vladimir@pobox.com>"]
|
||||
description = "Lightweight binding to DirectWrite."
|
||||
license = "MPL-2.0"
|
||||
|
@ -28,10 +28,16 @@ version = "0.2"
|
|||
|
||||
[dependencies.serde]
|
||||
version = "1.0"
|
||||
optional = true
|
||||
|
||||
[dependencies.serde_derive]
|
||||
version = "1.0"
|
||||
optional = true
|
||||
|
||||
[dependencies.winapi]
|
||||
version = "0.3.6"
|
||||
features = ["dwrite", "dwrite_1", "dwrite_3", "winnt", "unknwnbase", "libloaderapi", "winnls"]
|
||||
|
||||
[features]
|
||||
default = ["serde_serialization"]
|
||||
serde_serialization = ["serde", "serde_derive"]
|
||||
|
|
|
@ -118,4 +118,5 @@ build: false
|
|||
#directly or perform other testing commands. Rust will automatically be placed in the PATH
|
||||
# environment variable.
|
||||
test_script:
|
||||
- cargo check --no-default-features
|
||||
- cargo test --verbose %cargoflags%
|
||||
|
|
|
@ -12,6 +12,7 @@ use winapi::um::dwrite::{DWRITE_GLYPH_RUN, DWRITE_TEXTURE_ALIASED_1x1, DWRITE_TE
|
|||
use winapi::um::dwrite::DWRITE_TEXTURE_CLEARTYPE_3x1;
|
||||
use winapi::shared::windef::RECT;
|
||||
use winapi::um::dwrite::IDWriteGlyphRunAnalysis;
|
||||
use winapi::um::winnt::HRESULT;
|
||||
use std::mem;
|
||||
use super::DWriteFactory;
|
||||
|
||||
|
@ -26,7 +27,7 @@ impl GlyphRunAnalysis {
|
|||
rendering_mode: DWRITE_RENDERING_MODE,
|
||||
measuring_mode: DWRITE_MEASURING_MODE,
|
||||
baseline_x: f32,
|
||||
baseline_y: f32) -> GlyphRunAnalysis
|
||||
baseline_y: f32) -> Result<GlyphRunAnalysis, HRESULT>
|
||||
{
|
||||
unsafe {
|
||||
let mut native: ComPtr<IDWriteGlyphRunAnalysis> = ComPtr::new();
|
||||
|
@ -36,8 +37,11 @@ impl GlyphRunAnalysis {
|
|||
rendering_mode, measuring_mode,
|
||||
baseline_x, baseline_y,
|
||||
native.getter_addrefs());
|
||||
assert!(hr == 0);
|
||||
GlyphRunAnalysis::take(native)
|
||||
if hr != 0 {
|
||||
Err(hr)
|
||||
} else {
|
||||
Ok(GlyphRunAnalysis::take(native))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -47,18 +51,21 @@ impl GlyphRunAnalysis {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn get_alpha_texture_bounds(&self, texture_type: DWRITE_TEXTURE_TYPE) -> RECT {
|
||||
pub fn get_alpha_texture_bounds(&self, texture_type: DWRITE_TEXTURE_TYPE) -> Result<RECT, HRESULT> {
|
||||
unsafe {
|
||||
let mut rect: RECT = mem::zeroed();
|
||||
rect.left = 1234;
|
||||
rect.top = 1234;
|
||||
let hr = (*self.native.get()).GetAlphaTextureBounds(texture_type, &mut rect);
|
||||
assert!(hr == 0);
|
||||
rect
|
||||
if hr != 0 {
|
||||
Err(hr)
|
||||
} else {
|
||||
Ok(rect)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn create_alpha_texture(&self, texture_type: DWRITE_TEXTURE_TYPE, rect: RECT) -> Vec<u8> {
|
||||
pub fn create_alpha_texture(&self, texture_type: DWRITE_TEXTURE_TYPE, rect: RECT) -> Result<Vec<u8>, HRESULT> {
|
||||
unsafe {
|
||||
let rect_pixels = (rect.right - rect.left) * (rect.bottom - rect.top);
|
||||
let rect_bytes = rect_pixels * match texture_type {
|
||||
|
@ -69,8 +76,11 @@ impl GlyphRunAnalysis {
|
|||
|
||||
let mut out_bytes: Vec<u8> = vec![0; rect_bytes as usize];
|
||||
let hr = (*self.native.get()).CreateAlphaTexture(texture_type, &rect, out_bytes.as_mut_ptr(), out_bytes.len() as u32);
|
||||
assert!(hr == 0);
|
||||
out_bytes
|
||||
if hr != 0 {
|
||||
Err(hr)
|
||||
} else {
|
||||
Ok(out_bytes)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,15 +4,17 @@
|
|||
|
||||
#![allow(non_upper_case_globals)]
|
||||
|
||||
#[macro_use]
|
||||
#[cfg_attr(feature = "serde_serialization", macro_use)]
|
||||
#[cfg(feature = "serde_serialization")]
|
||||
extern crate serde_derive;
|
||||
#[cfg(feature = "serde_serialization")]
|
||||
extern crate serde;
|
||||
|
||||
#[macro_use]
|
||||
extern crate lazy_static;
|
||||
#[macro_use(DEFINE_GUID)]
|
||||
extern crate winapi;
|
||||
extern crate libc;
|
||||
extern crate serde;
|
||||
|
||||
include!("types.rs");
|
||||
|
||||
|
@ -20,7 +22,8 @@ use winapi::Interface;
|
|||
use winapi::um::dwrite::DWRITE_FACTORY_TYPE_SHARED;
|
||||
use winapi::um::dwrite::IDWriteFactory;
|
||||
use winapi::um::dwrite::IDWriteRenderingParams;
|
||||
use winapi::um::winnt::{HRESULT, LPCSTR};
|
||||
pub use winapi::um::winnt::HRESULT;
|
||||
use winapi::um::winnt::LPCSTR;
|
||||
use winapi::shared::guiddef::REFIID;
|
||||
use winapi::um::unknwnbase::IUnknown;
|
||||
use winapi::um::dwrite::DWRITE_FACTORY_TYPE;
|
||||
|
|
|
@ -7,7 +7,8 @@ use std::mem;
|
|||
use winapi::um::dwrite::{DWRITE_FONT_STYLE, DWRITE_FONT_WEIGHT, DWRITE_FONT_STRETCH};
|
||||
|
||||
// mirrors DWRITE_FONT_WEIGHT
|
||||
#[derive(Deserialize, Serialize, PartialEq, Debug, Clone, Copy)]
|
||||
#[cfg_attr(feature = "serde_serialization", derive(Deserialize, Serialize))]
|
||||
#[derive(PartialEq, Debug, Clone, Copy)]
|
||||
pub enum FontWeight {
|
||||
Thin,
|
||||
ExtraLight,
|
||||
|
@ -63,7 +64,8 @@ impl FontWeight {
|
|||
|
||||
// mirrors DWRITE_FONT_STRETCH
|
||||
#[repr(u32)]
|
||||
#[derive(Deserialize, Serialize, PartialEq, Debug, Clone, Copy)]
|
||||
#[cfg_attr(feature = "serde_serialization", derive(Deserialize, Serialize))]
|
||||
#[derive(PartialEq, Debug, Clone, Copy)]
|
||||
pub enum FontStretch {
|
||||
Undefined = 0,
|
||||
UltraCondensed = 1,
|
||||
|
@ -87,7 +89,8 @@ impl FontStretch {
|
|||
|
||||
// mirrors DWRITE_FONT_STYLE
|
||||
#[repr(u32)]
|
||||
#[derive(Deserialize, Serialize, PartialEq, Debug, Clone, Copy)]
|
||||
#[cfg_attr(feature = "serde_serialization", derive(Deserialize, Serialize))]
|
||||
#[derive(PartialEq, Debug, Clone, Copy)]
|
||||
pub enum FontStyle {
|
||||
Normal = 0,
|
||||
Oblique = 1,
|
||||
|
@ -113,7 +116,8 @@ pub enum FontSimulations {
|
|||
winapi::um::dwrite::DWRITE_FONT_SIMULATIONS_OBLIQUE,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize, PartialEq, Debug, Clone)]
|
||||
#[cfg_attr(feature = "serde_serialization", derive(Deserialize, Serialize))]
|
||||
#[derive(PartialEq, Debug, Clone)]
|
||||
pub struct FontDescriptor {
|
||||
pub family_name: String,
|
||||
pub weight: FontWeight,
|
||||
|
|
Загрузка…
Ссылка в новой задаче