Skip to content

Commit

Permalink
Auto merge of #23973 - emilio:gecko-sync, r=emilio,jdm
Browse files Browse the repository at this point in the history
style: Sync changes from mozilla-central.

See each individual commit for details.

<!-- 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/23973)
<!-- Reviewable:end -->
  • Loading branch information
bors-servo committed Aug 16, 2019
2 parents ff3f3d3 + d935232 commit aa60077
Show file tree
Hide file tree
Showing 50 changed files with 1,035 additions and 1,076 deletions.
17 changes: 10 additions & 7 deletions components/layout/construct.rs
Expand Up @@ -1847,6 +1847,10 @@ where
node.type_id()
);

// FIXME(emilio): This should look at display-outside and
// display-inside, but there's so much stuff that goes through the
// generic "block" codepath (wrongly).
//
// Switch on display and floatedness.
match (display, float, positioning) {
// `display: none` contributes no flow construction result.
Expand All @@ -1871,12 +1875,6 @@ where
self.set_flow_construction_result(node, construction_result)
},

// List items contribute their own special flows.
(Display::ListItem, float_value, _) => {
let construction_result = self.build_flow_for_list_item(node, float_value);
self.set_flow_construction_result(node, construction_result)
},

// Inline items that are absolutely-positioned contribute inline fragment construction
// results with a hypothetical fragment.
(Display::Inline, _, Position::Absolute) |
Expand Down Expand Up @@ -1958,7 +1956,12 @@ where
// properties separately.
(_, float_value, _) => {
let float_kind = FloatKind::from_property(float_value);
let construction_result = self.build_flow_for_block(node, float_kind);
// List items contribute their own special flows.
let construction_result = if display.is_list_item() {
self.build_flow_for_list_item(node, float_value)
} else {
self.build_flow_for_block(node, float_kind)
};
self.set_flow_construction_result(node, construction_result)
},
}
Expand Down
5 changes: 2 additions & 3 deletions components/layout/generated_content.rs
Expand Up @@ -19,7 +19,6 @@ use crate::traversal::InorderFlowTraversal;
use script_layout_interface::wrapper_traits::PseudoElementType;
use smallvec::SmallVec;
use std::collections::{HashMap, LinkedList};
use style::computed_values::display::T as Display;
use style::computed_values::list_style_type::T as ListStyleType;
use style::properties::ComputedValues;
use style::selector_parser::RestyleDamage;
Expand Down Expand Up @@ -175,7 +174,7 @@ impl<'a, 'b> ResolveGeneratedContentFragmentMutator<'a, 'b> {
}

let mut list_style_type = fragment.style().get_list().list_style_type;
if fragment.style().get_box().display != Display::ListItem {
if !fragment.style().get_box().display.is_list_item() {
list_style_type = ListStyleType::None
}

Expand Down Expand Up @@ -291,7 +290,7 @@ impl<'a, 'b> ResolveGeneratedContentFragmentMutator<'a, 'b> {

fn reset_and_increment_counters_as_necessary(&mut self, fragment: &mut Fragment) {
let mut list_style_type = fragment.style().get_list().list_style_type;
if !self.is_block || fragment.style().get_box().display != Display::ListItem {
if !self.is_block || !fragment.style().get_box().display.is_list_item() {
list_style_type = ListStyleType::None
}

Expand Down
10 changes: 2 additions & 8 deletions components/style/font_face.rs
Expand Up @@ -414,16 +414,10 @@ impl Parse for Source {

macro_rules! is_descriptor_enabled {
("font-display") => {
unsafe {
use crate::gecko_bindings::structs::mozilla;
mozilla::StaticPrefs::sVarCache_layout_css_font_display_enabled
}
static_prefs::pref!("layout.css.font-display.enabled")
};
("font-variation-settings") => {
unsafe {
use crate::gecko_bindings::structs::mozilla;
mozilla::StaticPrefs::sVarCache_layout_css_font_variations_enabled != 0
}
static_prefs::pref!("layout.css.font-variations.enabled")
};
($name:tt) => {
true
Expand Down
17 changes: 7 additions & 10 deletions components/style/gecko/media_queries.rs
Expand Up @@ -213,12 +213,11 @@ impl Device {
None => return MediaType::screen(),
};

// Gecko allows emulating random media with mIsEmulatingMedia and
// mMediaEmulated.
let medium_to_use = if pc.mIsEmulatingMedia() != 0 {
pc.mMediaEmulated.mRawPtr
// Gecko allows emulating random media with mMediaEmulationData.mMedium.
let medium_to_use = if !pc.mMediaEmulationData.mMedium.mRawPtr.is_null() {
pc.mMediaEmulationData.mMedium.mRawPtr
} else {
pc.mMedium
pc.mMedium as *const structs::nsAtom as *mut _
};

MediaType(CustomIdent(unsafe { Atom::from_raw(medium_to_use) }))
Expand Down Expand Up @@ -253,9 +252,8 @@ impl Device {
None => return Scale::new(1.),
};

let override_dppx = pc.mOverrideDPPX;
if override_dppx > 0.0 {
return Scale::new(override_dppx);
if pc.mMediaEmulationData.mDPPX > 0.0 {
return Scale::new(pc.mMediaEmulationData.mDPPX);
}

let au_per_dpx = pc.mCurAppUnitsPerDevPixel as f32;
Expand All @@ -270,8 +268,7 @@ impl Device {
if doc.mIsBeingUsedAsImage() {
return true;
}
let document_color_use =
unsafe { structs::StaticPrefs::sVarCache_browser_display_document_color_use };
let document_color_use = static_prefs::pref!("browser.display.document_color_use");
let prefs = self.pref_sheet_prefs();
match document_color_use {
1 => true,
Expand Down
4 changes: 1 addition & 3 deletions components/style/gecko/pseudo_element.rs
Expand Up @@ -187,9 +187,7 @@ impl PseudoElement {
PseudoElement::FirstLine => PropertyFlags::APPLIES_TO_FIRST_LINE,
PseudoElement::Placeholder => PropertyFlags::APPLIES_TO_PLACEHOLDER,
PseudoElement::Cue => PropertyFlags::APPLIES_TO_CUE,
PseudoElement::Marker
if unsafe { structs::StaticPrefs::sVarCache_layout_css_marker_restricted } =>
{
PseudoElement::Marker if static_prefs::pref!("layout.css.marker.restricted") => {
PropertyFlags::APPLIES_TO_MARKER
},
_ => return None,
Expand Down
6 changes: 2 additions & 4 deletions components/style/gecko/pseudo_element_definition.mako.rs
Expand Up @@ -112,7 +112,7 @@ impl PseudoElement {
% for pseudo in PSEUDOS:
${pseudo_element_variant(pseudo)} =>
% if pseudo.is_tree_pseudo_element():
if unsafe { structs::StaticPrefs::sVarCache_layout_css_xul_tree_pseudos_content_enabled } {
if static_prefs::pref!("layout.css.xul-tree-pseudos.content.enabled") {
0
} else {
structs::CSS_PSEUDO_ELEMENT_ENABLED_IN_UA_SHEETS_AND_CHROME
Expand Down Expand Up @@ -209,9 +209,7 @@ impl PseudoElement {
if starts_with_ignore_ascii_case(name, "-moz-tree-") {
return PseudoElement::tree_pseudo_element(name, Box::new([]))
}
if unsafe {
structs::StaticPrefs::sVarCache_layout_css_unknown_webkit_pseudo_element
} {
if static_prefs::pref!("layout.css.unknown-webkit-pseudo-element") {
const WEBKIT_PREFIX: &str = "-webkit-";
if starts_with_ignore_ascii_case(name, WEBKIT_PREFIX) {
let part = string_as_ascii_lowercase(&name[WEBKIT_PREFIX.len()..]);
Expand Down
10 changes: 3 additions & 7 deletions components/style/gecko/selector_parser.rs
Expand Up @@ -5,7 +5,7 @@
//! Gecko-specific bits for selector-parsing.

use crate::element_state::{DocumentState, ElementState};
use crate::gecko_bindings::structs::{self, RawServoSelectorList};
use crate::gecko_bindings::structs::RawServoSelectorList;
use crate::gecko_bindings::sugar::ownership::{HasBoxFFI, HasFFI, HasSimpleFFI};
use crate::invalidation::element::document_state::InvalidationMatchingData;
use crate::selector_parser::{Direction, SelectorParser};
Expand Down Expand Up @@ -170,13 +170,10 @@ impl NonTSPseudoClass {

/// Returns whether the pseudo-class is enabled in content sheets.
fn is_enabled_in_content(&self) -> bool {
use crate::gecko_bindings::structs::mozilla;
match *self {
// For pseudo-classes with pref, the availability in content
// depends on the pref.
NonTSPseudoClass::Fullscreen => unsafe {
mozilla::StaticPrefs::sVarCache_full_screen_api_unprefix_enabled
},
NonTSPseudoClass::Fullscreen => static_prefs::pref!("full-screen-api.unprefix.enabled"),
// Otherwise, a pseudo-class is enabled in content when it
// doesn't have any enabled flag.
_ => !self
Expand Down Expand Up @@ -354,8 +351,7 @@ impl<'a, 'i> ::selectors::Parser<'i> for SelectorParser<'a> {

#[inline]
fn parse_part(&self) -> bool {
self.chrome_rules_enabled() ||
unsafe { structs::StaticPrefs::sVarCache_layout_css_shadow_parts_enabled }
self.chrome_rules_enabled() || static_prefs::pref!("layout.css.shadow-parts.enabled")
}

fn parse_non_ts_pseudo_class(
Expand Down
2 changes: 2 additions & 0 deletions components/style/lib.rs
Expand Up @@ -91,6 +91,8 @@ extern crate servo_config;
extern crate servo_url;
extern crate smallbitvec;
extern crate smallvec;
#[cfg(feature = "gecko")]
extern crate static_prefs;
#[cfg(feature = "servo")]
extern crate string_cache;
#[macro_use]
Expand Down
6 changes: 1 addition & 5 deletions components/style/media_queries/media_feature_expression.rs
Expand Up @@ -11,8 +11,6 @@ use super::Device;
use crate::context::QuirksMode;
#[cfg(feature = "gecko")]
use crate::gecko::media_features::MEDIA_FEATURES;
#[cfg(feature = "gecko")]
use crate::gecko_bindings::structs;
use crate::parser::{Parse, ParserContext};
#[cfg(feature = "servo")]
use crate::servo::media_queries::MEDIA_FEATURES;
Expand Down Expand Up @@ -301,9 +299,7 @@ impl MediaFeatureExpression {
if starts_with_ignore_ascii_case(feature_name, "-webkit-") {
feature_name = &feature_name[8..];
requirements.insert(ParsingRequirements::WEBKIT_PREFIX);
if unsafe {
structs::StaticPrefs::sVarCache_layout_css_prefixes_device_pixel_ratio_webkit
} {
if static_prefs::pref!("layout.css.prefixes.device-pixel-ratio-webkit") {
requirements.insert(
ParsingRequirements::WEBKIT_DEVICE_PIXEL_RATIO_PREF_ENABLED,
);
Expand Down
4 changes: 2 additions & 2 deletions components/style/properties/cascade.rs
Expand Up @@ -673,15 +673,15 @@ impl<'a, 'b: 'a> Cascade<'a, 'b> {
#[inline]
#[cfg(feature = "gecko")]
fn recompute_default_font_family_type_if_needed(&mut self) {
use crate::gecko_bindings::{bindings, structs};
use crate::gecko_bindings::bindings;
use crate::values::computed::font::GenericFontFamily;

if !self.seen.contains(LonghandId::XLang) &&
!self.seen.contains(LonghandId::FontFamily) {
return;
}

let use_document_fonts = unsafe { structs::StaticPrefs::sVarCache_browser_display_use_document_fonts != 0 };
let use_document_fonts = static_prefs::pref!("browser.display.use_document_fonts") != 0;
let builder = &mut self.context.builder;
let (default_font_type, prioritize_user_fonts) = {
let font = builder.get_font().gecko();
Expand Down
3 changes: 0 additions & 3 deletions components/style/properties/data.py
Expand Up @@ -652,9 +652,6 @@ def _remove_common_first_line_and_first_letter_properties(props, engine):
props.remove("text-emphasis-position")
props.remove("text-emphasis-style")
props.remove("text-emphasis-color")
props.remove("text-decoration-skip-ink")
props.remove("text-decoration-thickness")
props.remove("text-underline-offset")

props.remove("overflow-wrap")
props.remove("text-align")
Expand Down

0 comments on commit aa60077

Please sign in to comment.