Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable font-variant for Layout 2020 (was #4) #6

Closed
wants to merge 16 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 23 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions style/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ lazy_static = "1"
log = { version = "0.4", features = ["std"] }
malloc_size_of = { path = "../malloc_size_of" }
malloc_size_of_derive = "0.1"
matches = "0.1"
mime = "0.3.13"
new_debug_unreachable = "1.0"
num-derive = "0.4"
Expand Down
3 changes: 3 additions & 0 deletions style/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ extern crate log;
extern crate malloc_size_of;
#[macro_use]
extern crate malloc_size_of_derive;
#[allow(unused_extern_crates)]
#[macro_use]
extern crate matches;
#[cfg(feature = "gecko")]
pub use nsstring;
#[cfg(feature = "gecko")]
Expand Down
1 change: 0 additions & 1 deletion style/properties/shorthands/font.mako.rs
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,6 @@

<%helpers:shorthand name="font-variant"
engines="gecko servo"
servo_pref="layout.legacy_layout",
flags="SHORTHAND_IN_GETCS"
sub_properties="font-variant-caps
${'font-variant-alternates' if engine == 'gecko' else ''}
Expand Down
1 change: 1 addition & 0 deletions style/properties_and_values/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ pub struct PropertyRegistration {
/// The script registry of custom properties.
/// <https://drafts.css-houdini.org/css-properties-values-api-1/#dom-window-registeredpropertyset-slot>
#[derive(Default)]
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
pub struct ScriptRegistry {
properties: PrecomputedHashMap<Atom, PropertyRegistration>,
}
Expand Down
4 changes: 2 additions & 2 deletions style/stylesheets/page_rule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ bitflags! {
/// page-rule applies.
///
/// https://drafts.csswg.org/css-page-3/#page-selectors
#[derive(Clone, Copy)]
#[cfg_attr(feature = "gecko", derive(Clone, Copy))]
#[repr(C)]
pub struct PagePseudoClassFlags : u8 {
/// No pseudo-classes
Expand Down Expand Up @@ -218,7 +218,7 @@ impl Parse for PageSelector {
_context: &ParserContext,
input: &mut Parser<'i, 't>,
) -> Result<Self, ParseError<'i>> {
let name = input.try_parse(parse_page_name).unwrap_or(AtomIdent(atom!("")));
let name = input.try_parse(parse_page_name).unwrap_or(AtomIdent::new(atom!("")));
let mut pseudos = PagePseudoClasses::default();
while let Ok(pc) = input.try_parse(PagePseudoClass::parse) {
pseudos.push(pc);
Expand Down
4 changes: 1 addition & 3 deletions style/stylist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ use crate::stylesheets::layer_rule::{LayerName, LayerOrder};
#[cfg(feature = "gecko")]
use crate::stylesheets::{
CounterStyleRule, FontFaceRule, FontFeatureValuesRule, FontPaletteValuesRule,
PagePseudoClassFlags,
};
use crate::stylesheets::{
CssRule, EffectiveRulesIterator, Origin, OriginSet, PageRule, PerOrigin, PerOriginIter,
PagePseudoClassFlags, PageRule,
};
use crate::stylesheets::{StyleRule, StylesheetContents, StylesheetInDocument};
use crate::AllocErr;
Expand Down Expand Up @@ -1586,7 +1586,6 @@ impl<T: 'static> LayerOrderedMap<T> {
fn clear(&mut self) {
self.0.clear();
}
#[cfg(feature = "gecko")]
fn try_insert(&mut self, name: Atom, v: T, id: LayerId) -> Result<(), AllocErr> {
self.try_insert_with(name, v, id, |_, _| Ordering::Equal)
}
Expand All @@ -1610,7 +1609,6 @@ impl<T: 'static> LayerOrderedMap<T> {
vec.push((v, id));
Ok(())
}
#[cfg(feature = "gecko")]
fn sort(&mut self, layers: &[CascadeLayer]) {
self.sort_with(layers, |_, _| Ordering::Equal)
}
Expand Down
1 change: 0 additions & 1 deletion style/values/generics/basic_shape.rs
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,6 @@ pub struct PolygonCoord<LengthPercentage>(pub LengthPercentage, pub LengthPercen
// https://www.w3.org/TR/SVG/painting.html#FillRuleProperty
// says that it can also be `inherit`
#[allow(missing_docs)]
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
#[derive(
Animate,
Clone,
Expand Down
2 changes: 1 addition & 1 deletion style/values/generics/calc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ bitflags! {
/// This is used as a hint for the parser to fast-reject invalid
/// expressions. Numbers are always allowed because they multiply other
/// units.
#[derive(Clone, Copy, PartialEq, Eq)]
#[cfg_attr(feature = "gecko", derive(Clone, Copy, PartialEq, Eq))]
pub struct CalcUnits: u8 {
/// <length>
const LENGTH = 1 << 0;
Expand Down
3 changes: 2 additions & 1 deletion style/values/generics/color.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ pub enum GenericColor<Percentage> {

bitflags! {
/// Flags used to modify the calculation of a color mix result.
#[derive(Clone, Copy, Default, MallocSizeOf, PartialEq, ToShmem)]
#[derive(Default, MallocSizeOf, ToShmem)]
#[cfg_attr(feature = "gecko", derive(Clone, Copy, PartialEq))]
#[repr(C)]
pub struct ColorMixFlags : u8 {
/// Normalize the weights of the mix.
Expand Down
1 change: 0 additions & 1 deletion style/values/generics/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ impl SpecifiedValueInfo for CounterStyle {
}

/// A wrapper of Non-negative values.
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
#[derive(
Animate,
Clone,
Expand Down
2 changes: 1 addition & 1 deletion style/values/specified/basic_shape.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ bitflags! {
/// we use the bitflags to choose the supported basic shapes for each property at the parse
/// time.
/// https://github.com/w3c/csswg-drafts/issues/7390
#[derive(Clone, Copy)]
#[cfg_attr(feature = "gecko", derive(Clone, Copy))]
#[repr(C)]
pub struct AllowedBasicShapes: u8 {
/// inset().
Expand Down
2 changes: 2 additions & 0 deletions style/values/specified/text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,7 @@ impl Parse for TextTransform {
"capitalize" if result.case_ == TextTransformCase::None => {
result.case_ = TextTransformCase::Capitalize
},
#[cfg(feature = "gecko")]
"math-auto" if result.case_ == TextTransformCase::None &&
result.other_.is_empty() => {
result.case_ = TextTransformCase::MathAuto;
Expand Down Expand Up @@ -411,6 +412,7 @@ pub enum TextTransformCase {
/// Capitalize each word.
Capitalize,
/// Automatic italicization of math variables.
#[cfg(feature = "gecko")]
MathAuto,
}

Expand Down
2 changes: 1 addition & 1 deletion style_config/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ pub fn set_i32(key: &str, value: i32) {

#[test]
fn test() {
let mut prefs = Preferences::default();
let prefs = Preferences::default();

// Prefs have default values when unset.
assert_eq!(prefs.get_bool("foo"), false);
Expand Down
15 changes: 15 additions & 0 deletions style_static_prefs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ macro_rules! pref {
("gfx.font_rendering.opentype_svg.enabled") => {
false
};
("layout.css.abs-sign.enabled") => {
true
};
("layout.css.basic-shape-xywh.enabled") => {
true
};
("layout.css.color-mix.enabled") => {
true
};
Expand Down Expand Up @@ -63,6 +69,9 @@ macro_rules! pref {
("layout.css.forced-colors.enabled") => {
false
};
("layout.css.gradient-color-interpolation-method.enabled") => {
false
};
("layout.css.grid-template-masonry-value.enabled") => {
false
};
Expand Down Expand Up @@ -90,6 +99,12 @@ macro_rules! pref {
("layout.css.motion-path-offset-position.enabled") => {
false
};
("layout.css.motion-path-basic-shapes.enabled") => {
false
};
("layout.css.motion-path-coord-box.enabled") => {
false
};
("layout.css.motion-path-ray.enabled") => {
false
};
Expand Down