mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Auto merge of #21725 - pyfisch:update-wr, r=jdm
Update Webrender New version is 9156a4465f6ad715a0206cdd9a7e9a6f0385fbd6 --- - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes do not require tests because just updating WR <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/21725) <!-- Reviewable:end -->
This commit is contained in:
commit
7e78edcff9
29 changed files with 184 additions and 151 deletions
|
@ -635,7 +635,8 @@ impl<T: WebGLExternalImageApi> webrender::ExternalImageHandler for WebGLExternal
|
|||
/// The WR client should not change the image content until the unlock() call.
|
||||
fn lock(&mut self,
|
||||
key: webrender_api::ExternalImageId,
|
||||
_channel_index: u8) -> webrender::ExternalImage {
|
||||
_channel_index: u8,
|
||||
_rendering: webrender_api::ImageRendering) -> webrender::ExternalImage {
|
||||
let ctx_id = WebGLContextId(key.0 as _);
|
||||
let (texture_id, size) = self.handler.lock(ctx_id);
|
||||
|
||||
|
|
|
@ -48,8 +48,8 @@ ucd = "0.1.1"
|
|||
[target.'cfg(target_os = "macos")'.dependencies]
|
||||
byteorder = "1.0"
|
||||
core-foundation = "0.6"
|
||||
core-graphics = "0.16"
|
||||
core-text = "11.0"
|
||||
core-graphics = "0.17"
|
||||
core-text = "13.0"
|
||||
|
||||
[target.'cfg(any(target_os = "linux", target_os = "android"))'.dependencies]
|
||||
freetype = "0.4"
|
||||
|
@ -62,5 +62,5 @@ servo-fontconfig = "0.2.1"
|
|||
xml5ever = {version = "0.12"}
|
||||
|
||||
[target.'cfg(target_os = "windows")'.dependencies]
|
||||
dwrote = "0.4"
|
||||
dwrote = "0.5"
|
||||
truetype = "0.26"
|
||||
|
|
|
@ -235,9 +235,11 @@ impl FontHandleMethods for FontHandle {
|
|||
let mut glyphs: [CGGlyph; 1] = [0 as CGGlyph];
|
||||
let count: CFIndex = 1;
|
||||
|
||||
let result = self
|
||||
.ctfont
|
||||
.get_glyphs_for_characters(&characters[0], &mut glyphs[0], count);
|
||||
let result = unsafe {
|
||||
self
|
||||
.ctfont
|
||||
.get_glyphs_for_characters(&characters[0], &mut glyphs[0], count)
|
||||
};
|
||||
|
||||
if !result {
|
||||
// No glyph for this character
|
||||
|
@ -263,12 +265,14 @@ impl FontHandleMethods for FontHandle {
|
|||
|
||||
fn glyph_h_advance(&self, glyph: GlyphId) -> Option<FractionalPixel> {
|
||||
let glyphs = [glyph as CGGlyph];
|
||||
let advance = self.ctfont.get_advances_for_glyphs(
|
||||
kCTFontDefaultOrientation,
|
||||
&glyphs[0],
|
||||
ptr::null_mut(),
|
||||
1,
|
||||
);
|
||||
let advance = unsafe {
|
||||
self.ctfont.get_advances_for_glyphs(
|
||||
kCTFontDefaultOrientation,
|
||||
&glyphs[0],
|
||||
ptr::null_mut(),
|
||||
1,
|
||||
)
|
||||
};
|
||||
Some(advance as FractionalPixel)
|
||||
}
|
||||
|
||||
|
|
|
@ -24,9 +24,10 @@ where
|
|||
|
||||
let family_collection = core_text::font_collection::create_for_family(family_name);
|
||||
if let Some(family_collection) = family_collection {
|
||||
let family_descriptors = family_collection.get_descriptors();
|
||||
for family_descriptor in family_descriptors.iter() {
|
||||
callback(family_descriptor.font_name());
|
||||
if let Some(family_descriptors) = family_collection.get_descriptors() {
|
||||
for family_descriptor in family_descriptors.iter() {
|
||||
callback(family_descriptor.font_name());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,13 +9,15 @@
|
|||
use app_units::Au;
|
||||
use dwrote;
|
||||
use dwrote::{Font, FontFace, FontFile};
|
||||
use dwrote::{FontWeight, FontStretch, FontStyle};
|
||||
use dwrote::{FontStretch, FontStyle};
|
||||
use font::{FontHandleMethods, FontMetrics, FontTableMethods};
|
||||
use font::{FontTableTag, FractionalPixel};
|
||||
use platform::font_template::FontTemplateData;
|
||||
use platform::windows::font_context::FontContextHandle;
|
||||
use platform::windows::font_list::font_from_atom;
|
||||
use servo_atoms::Atom;
|
||||
use std::fmt;
|
||||
use std::ops::Deref;
|
||||
use std::sync::Arc;
|
||||
use style::computed_values::font_stretch::T as StyleFontStretch;
|
||||
use style::computed_values::font_weight::T as StyleFontWeight;
|
||||
|
@ -209,21 +211,7 @@ impl FontInfo {
|
|||
FontStyle::Oblique => GenericFontStyle::Oblique(StyleFontStyle::default_angle()),
|
||||
FontStyle::Italic => GenericFontStyle::Italic,
|
||||
};
|
||||
let weight = StyleFontWeight(match font.weight() {
|
||||
FontWeight::Thin => 100.,
|
||||
FontWeight::ExtraLight => 200.,
|
||||
FontWeight::Light => 300.,
|
||||
// slightly grayer gray
|
||||
FontWeight::SemiLight => 300.,
|
||||
FontWeight::Regular => 400.,
|
||||
FontWeight::Medium => 500.,
|
||||
FontWeight::SemiBold => 600.,
|
||||
FontWeight::Bold => 700.,
|
||||
FontWeight::ExtraBold => 800.,
|
||||
FontWeight::Black => 900.,
|
||||
// slightly blacker black
|
||||
FontWeight::ExtraBlack => 1000.,
|
||||
});
|
||||
let weight = StyleFontWeight(font.weight().to_u32() as f32);
|
||||
let stretch = StyleFontStretch(NonNegative(
|
||||
match font.stretch() {
|
||||
FontStretch::Undefined => FontStretchKeyword::Normal,
|
||||
|
@ -252,7 +240,7 @@ impl FontInfo {
|
|||
#[derive(Debug)]
|
||||
pub struct FontHandle {
|
||||
font_data: Arc<FontTemplateData>,
|
||||
face: FontFace,
|
||||
face: Nondebug<FontFace>,
|
||||
info: FontInfo,
|
||||
em_size: f32,
|
||||
du_per_em: f32,
|
||||
|
@ -260,6 +248,21 @@ pub struct FontHandle {
|
|||
scaled_du_to_px: f32,
|
||||
}
|
||||
|
||||
struct Nondebug<T>(T);
|
||||
|
||||
impl<T> fmt::Debug for Nondebug<T> {
|
||||
fn fmt(&self, _f: &mut fmt::Formatter) -> fmt::Result {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> Deref for Nondebug<T> {
|
||||
type Target = T;
|
||||
fn deref(&self) -> &T {
|
||||
&self.0
|
||||
}
|
||||
}
|
||||
|
||||
impl FontHandle {}
|
||||
|
||||
impl FontHandleMethods for FontHandle {
|
||||
|
@ -298,7 +301,7 @@ impl FontHandleMethods for FontHandle {
|
|||
|
||||
Ok(FontHandle {
|
||||
font_data: template.clone(),
|
||||
face: face,
|
||||
face: Nondebug(face),
|
||||
info: info,
|
||||
em_size: em_size,
|
||||
du_per_em: du_per_em,
|
||||
|
|
|
@ -36,8 +36,8 @@ use style::values::generics::image::EndingShape as GenericEndingShape;
|
|||
use style::values::generics::image::GradientItem as GenericGradientItem;
|
||||
use style::values::specified::background::BackgroundRepeatKeyword;
|
||||
use style::values::specified::position::{X, Y};
|
||||
use webrender_api::{BorderRadius, BorderSide, BorderStyle, BorderWidths, ColorF};
|
||||
use webrender_api::{ExtendMode, Gradient, GradientStop, LayoutSize};
|
||||
use webrender_api::{BorderRadius, BorderSide, BorderStyle, ColorF};
|
||||
use webrender_api::{ExtendMode, Gradient, GradientStop, LayoutSize, LayoutSideOffsets};
|
||||
use webrender_api::{NormalBorder, RadialGradient};
|
||||
|
||||
/// A helper data structure for gradients.
|
||||
|
@ -771,6 +771,7 @@ pub fn simple_normal_border(color: ColorF, style: BorderStyle) -> NormalBorder {
|
|||
top: side,
|
||||
bottom: side,
|
||||
radius: BorderRadius::zero(),
|
||||
do_aa: true,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -834,13 +835,13 @@ fn calculate_border_image_width_side(
|
|||
|
||||
pub fn calculate_border_image_width(
|
||||
width: &BorderImageWidth,
|
||||
border: BorderWidths,
|
||||
border: LayoutSideOffsets,
|
||||
border_area: Size2D<Au>,
|
||||
) -> BorderWidths {
|
||||
BorderWidths {
|
||||
left: calculate_border_image_width_side(width.3, border.left, border_area.width),
|
||||
top: calculate_border_image_width_side(width.0, border.top, border_area.height),
|
||||
right: calculate_border_image_width_side(width.1, border.right, border_area.width),
|
||||
bottom: calculate_border_image_width_side(width.2, border.bottom, border_area.height),
|
||||
}
|
||||
) -> LayoutSideOffsets {
|
||||
LayoutSideOffsets::new(
|
||||
calculate_border_image_width_side(width.0, border.top, border_area.height),
|
||||
calculate_border_image_width_side(width.1, border.right, border_area.width),
|
||||
calculate_border_image_width_side(width.2, border.bottom, border_area.height),
|
||||
calculate_border_image_width_side(width.3, border.left, border_area.width),
|
||||
)
|
||||
}
|
||||
|
|
|
@ -1081,6 +1081,7 @@ impl FragmentDisplayListBuilding for Fragment {
|
|||
tile_spacing: placement.tile_spacing.to_layout(),
|
||||
image_rendering: style.get_inherited_box().image_rendering.to_layout(),
|
||||
alpha_type: webrender_api::AlphaType::PremultipliedAlpha,
|
||||
color: webrender_api::ColorF::WHITE,
|
||||
},
|
||||
);
|
||||
});
|
||||
|
@ -1366,6 +1367,7 @@ impl FragmentDisplayListBuilding for Fragment {
|
|||
style: border_style.bottom.to_layout(),
|
||||
},
|
||||
radius: border_radius,
|
||||
do_aa: true,
|
||||
});
|
||||
state.add_display_item(DisplayItem::Border(CommonDisplayItem::with_data(
|
||||
base,
|
||||
|
@ -1994,6 +1996,7 @@ impl FragmentDisplayListBuilding for Fragment {
|
|||
.image_rendering
|
||||
.to_layout(),
|
||||
alpha_type: webrender_api::AlphaType::PremultipliedAlpha,
|
||||
color: webrender_api::ColorF::WHITE,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
@ -2011,6 +2014,7 @@ impl FragmentDisplayListBuilding for Fragment {
|
|||
tile_spacing: LayoutSize::zero(),
|
||||
image_rendering: ImageRendering::Auto,
|
||||
alpha_type: webrender_api::AlphaType::PremultipliedAlpha,
|
||||
color: webrender_api::ColorF::WHITE,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
@ -2040,6 +2044,7 @@ impl FragmentDisplayListBuilding for Fragment {
|
|||
tile_spacing: LayoutSize::zero(),
|
||||
image_rendering: ImageRendering::Auto,
|
||||
alpha_type: webrender_api::AlphaType::PremultipliedAlpha,
|
||||
color: webrender_api::ColorF::WHITE,
|
||||
};
|
||||
|
||||
state.add_image_item(base, display_item);
|
||||
|
|
|
@ -129,14 +129,14 @@ impl ToLayout for Rect<Au> {
|
|||
}
|
||||
|
||||
impl ToLayout for SideOffsets2D<Au> {
|
||||
type Type = wr::BorderWidths;
|
||||
type Type = wr::LayoutSideOffsets;
|
||||
fn to_layout(&self) -> Self::Type {
|
||||
wr::BorderWidths {
|
||||
left: self.left.to_f32_px(),
|
||||
top: self.top.to_f32_px(),
|
||||
right: self.right.to_f32_px(),
|
||||
bottom: self.bottom.to_f32_px(),
|
||||
}
|
||||
wr::LayoutSideOffsets::new(
|
||||
self.top.to_f32_px(),
|
||||
self.right.to_f32_px(),
|
||||
self.bottom.to_f32_px(),
|
||||
self.left.to_f32_px(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
use display_list::items::{ClipScrollNode, ClipScrollNodeIndex, ClipScrollNodeType};
|
||||
use display_list::items::{DisplayItem, DisplayList, StackingContextType};
|
||||
use msg::constellation_msg::PipelineId;
|
||||
use webrender_api::{self, ClipAndScrollInfo, ClipId, DisplayListBuilder, GlyphRasterSpace};
|
||||
use webrender_api::{self, ClipAndScrollInfo, ClipId, DisplayListBuilder, RasterSpace};
|
||||
use webrender_api::LayoutPoint;
|
||||
|
||||
pub trait WebRenderDisplayListConverter {
|
||||
|
@ -123,6 +123,7 @@ impl WebRenderDisplayItemConverter for DisplayItem {
|
|||
item.item.image_rendering,
|
||||
item.item.alpha_type,
|
||||
item.item.image_key,
|
||||
item.item.color,
|
||||
);
|
||||
},
|
||||
DisplayItem::Border(ref item) => {
|
||||
|
@ -252,7 +253,7 @@ impl WebRenderDisplayItemConverter for DisplayItem {
|
|||
stacking_context.transform_style,
|
||||
stacking_context.mix_blend_mode,
|
||||
stacking_context.filters.clone(),
|
||||
GlyphRasterSpace::Screen,
|
||||
RasterSpace::Screen,
|
||||
);
|
||||
|
||||
if stacking_context.established_reference_frame.is_some() {
|
||||
|
|
|
@ -915,8 +915,6 @@ malloc_size_of_is_0!(webrender_api::BorderRadius);
|
|||
#[cfg(feature = "webrender_api")]
|
||||
malloc_size_of_is_0!(webrender_api::BorderStyle);
|
||||
#[cfg(feature = "webrender_api")]
|
||||
malloc_size_of_is_0!(webrender_api::BorderWidths);
|
||||
#[cfg(feature = "webrender_api")]
|
||||
malloc_size_of_is_0!(webrender_api::BoxShadowClipMode);
|
||||
#[cfg(feature = "webrender_api")]
|
||||
malloc_size_of_is_0!(webrender_api::ClipAndScrollInfo);
|
||||
|
|
|
@ -103,7 +103,7 @@ use std::borrow::Cow;
|
|||
use std::cmp::max;
|
||||
use std::path::PathBuf;
|
||||
use std::rc::Rc;
|
||||
use webrender::RendererKind;
|
||||
use webrender::{RendererKind, ShaderPrecacheFlags};
|
||||
use webvr::{WebVRThread, WebVRCompositorHandler};
|
||||
|
||||
pub use gleam::gl;
|
||||
|
@ -190,12 +190,16 @@ where
|
|||
enable_aa: opts.enable_text_antialiasing,
|
||||
debug_flags: debug_flags,
|
||||
recorder: recorder,
|
||||
precache_shaders: opts.precache_shaders,
|
||||
enable_scrollbars: opts.output_file.is_none(),
|
||||
precache_flags: if opts.precache_shaders {
|
||||
ShaderPrecacheFlags::FULL_COMPILE
|
||||
} else {
|
||||
ShaderPrecacheFlags::empty()
|
||||
},
|
||||
renderer_kind: renderer_kind,
|
||||
enable_subpixel_aa: opts.enable_subpixel_text_antialiasing,
|
||||
..Default::default()
|
||||
},
|
||||
None,
|
||||
).expect("Unable to initialize webrender!")
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue