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

style: Sync changes from mozilla-central. #25299

Merged
merged 28 commits into from Dec 17, 2019
Merged
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
519a0e7
style: convert NS_STYLE_TOP_LAYER_* to an enum class in nsStyleConsts.h
jeffin143 Dec 1, 2019
5cc4394
style: convert NS_STYLE_RUBY_ALIGN_* to an enum class in nsStyleConsts.h
jeffin143 Dec 1, 2019
24f21f3
style: convert NS_STYLE_TEXT_SIZE_ADJUST_* to an enum class in nsStyl…
jeffin143 Dec 2, 2019
7e3e8e1
style: convert NS_STYLE_RUBY_POSITION_* to an enum class in nsStyleCo…
jeffin143 Dec 2, 2019
3bd62cf
style: Check for border-image-* initial specified values when seriali…
nordzilla Dec 3, 2019
51c1dfe
style: Add support for parsing of the CSS text-underline-position pro…
jfkthame Dec 4, 2019
5e7d429
style: Refactor InvalidationMap flags to use bitflags.
nordzilla Dec 5, 2019
f89c311
style: Remove layout.css.xul-box-display-values.survive-blockificatio…
emilio Dec 5, 2019
80ac4d2
style: Avoid writing into the empty array header.
emilio Dec 16, 2019
baa9ac1
style: Update derive_more.
emilio Dec 5, 2019
e944962
style: convert NS_STYLE_ISOLATION_* to an enum class in nsStyleConsts.h.
jeffin143 Dec 6, 2019
6973317
style: Correctly style dark scrollbars in tree components.
heycam Dec 9, 2019
7cd59da
style: Invalidate shadow part pseudo-class styles correctly.
emilio Dec 9, 2019
d954f51
style: Fix serialization of @namespace rule.
emilio Nov 25, 2019
e8a3a71
style: convert NS_STYLE_POINTER_EVENTS_* to an enum class in nsStyleC…
jeffin143 Dec 12, 2019
02c30bc
style: Preserve CSS input exactly during sanitization.
emilio Dec 12, 2019
4b62e9f
style: convert NS_STYLE_VISIBILITY_* to an enum class in nsStyleConsts.h
jeffin143 Dec 13, 2019
4cd8813
style: Remove full-screen-api.unprefix.enabled.
emilio Dec 13, 2019
a541046
style: Use less Au in font code.
emilio Dec 15, 2019
789ddd9
style: Make LengthPercentage not copy.
emilio Dec 15, 2019
ad61cae
style: Update smallvec to 1.0.
emilio Dec 15, 2019
c1c2b74
Update Cargo.lock.
emilio Dec 15, 2019
7d30a7d
Servo build fixes.
emilio Dec 15, 2019
e885ccb
layout-2020: build fixes.
emilio Dec 15, 2019
ef16c58
Rustfmt recent changes.
emilio Dec 15, 2019
75a05f0
Appease tidy.
emilio Dec 15, 2019
f7c5df5
Update WPT expectations.
emilio Dec 16, 2019
7513bc2
Cherry-pick some parts of the cssparser update.
emilio Dec 16, 2019
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Rustfmt recent changes.

  • Loading branch information
emilio committed Dec 16, 2019
commit ef16c5844fbfb34366e103acf58395ae56d21a37
@@ -2548,8 +2548,16 @@ impl Flow for BlockFlow {
.base
.flags
.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) &&
self.fragment.style().logical_position().inline_start.is_auto() &&
self.fragment.style().logical_position().inline_end.is_auto()
self.fragment
.style()
.logical_position()
.inline_start
.is_auto() &&
self.fragment
.style()
.logical_position()
.inline_end
.is_auto()
{
self.base.position.start.i = inline_position
}
@@ -2560,7 +2568,11 @@ impl Flow for BlockFlow {
.base
.flags
.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) &&
self.fragment.style().logical_position().block_start.is_auto() &&
self.fragment
.style()
.logical_position()
.block_start
.is_auto() &&
self.fragment.style().logical_position().block_end.is_auto()
{
self.base.position.start.b = block_position
@@ -2848,11 +2860,8 @@ pub trait ISizeAndMarginsComputer {
parent_flow_inline_size: Au,
shared_context: &SharedStyleContext,
) -> MaybeAuto {
let inline_size = self.containing_block_inline_size(
block,
parent_flow_inline_size,
shared_context,
);
let inline_size =
self.containing_block_inline_size(block, parent_flow_inline_size, shared_context);

MaybeAuto::from_option(
block
@@ -91,7 +91,10 @@ fn convert_gradient_stops(
color,
position: None,
}),
GradientItem::ComplexColorStop { color, ref position } => Some(ColorStop {
GradientItem::ComplexColorStop {
color,
ref position,
} => Some(ColorStop {
color,
position: Some(position.clone()),
}),
@@ -125,7 +128,13 @@ fn convert_gradient_stops(
//
// FIXME(emilio): Once we know the offsets, it seems like converting the
// positions to absolute at once then process that would be cheaper.
let mut last_stop_position = stop_items.first().unwrap().position.as_ref().unwrap().clone();
let mut last_stop_position = stop_items
.first()
.unwrap()
.position
.as_ref()
.unwrap()
.clone();
for stop in stop_items.iter_mut().skip(1) {
if let Some(ref pos) = stop.position {
if position_to_offset(&last_stop_position, total_length) >
@@ -147,16 +156,19 @@ fn convert_gradient_stops(
// Initialize a new stop run.
// `unwrap()` here should never fail because this is the beginning of
// a stop run, which is always bounded by a length or percentage.
let start_offset =
position_to_offset(stop_items[i - 1].position.as_ref().unwrap(), total_length);
let start_offset = position_to_offset(
stop_items[i - 1].position.as_ref().unwrap(),
total_length,
);
// `unwrap()` here should never fail because this is the end of
// a stop run, which is always bounded by a length or percentage.
let (end_index, end_stop) = stop_items[(i + 1)..]
.iter()
.enumerate()
.find(|&(_, ref stop)| stop.position.is_some())
.unwrap();
let end_offset = position_to_offset(end_stop.position.as_ref().unwrap(), total_length);
let end_offset =
position_to_offset(end_stop.position.as_ref().unwrap(), total_length);
stop_run = Some(StopRun {
start_offset,
end_offset,
@@ -1113,12 +1113,11 @@ impl BaseFlow {
self.flags.set(
FlowFlags::INLINE_POSITION_IS_STATIC,
logical_position.inline_start.is_auto() &&
logical_position.inline_end.is_auto()
logical_position.inline_end.is_auto(),
);
self.flags.set(
FlowFlags::BLOCK_POSITION_IS_STATIC,
logical_position.block_start.is_auto() &&
logical_position.block_end.is_auto()
logical_position.block_start.is_auto() && logical_position.block_end.is_auto(),
);
}
}
@@ -2527,10 +2527,20 @@ impl Fragment {
{
continue;
}
if !inline_context_node.style.logical_margin().inline_end.is_definitely_zero() {
if !inline_context_node
.style
.logical_margin()
.inline_end
.is_definitely_zero()
{
return false;
}
if !inline_context_node.style.logical_padding().inline_end.is_definitely_zero() {
if !inline_context_node
.style
.logical_padding()
.inline_end
.is_definitely_zero()
{
return false;
}
if inline_context_node.style.logical_border_width().inline_end != Au(0) {
@@ -2549,10 +2559,20 @@ impl Fragment {
{
continue;
}
if !inline_context_node.style.logical_margin().inline_start.is_definitely_zero() {
if !inline_context_node
.style
.logical_margin()
.inline_start
.is_definitely_zero()
{
return false;
}
if !inline_context_node.style.logical_padding().inline_start.is_definitely_zero() {
if !inline_context_node
.style
.logical_padding()
.inline_start
.is_definitely_zero()
{
return false;
}
if inline_context_node
@@ -177,11 +177,15 @@ impl flow_relative::Vec2<MaxSize<LengthPercentage>> {
flow_relative::Vec2 {
inline: match self.inline {
MaxSize::None => None,
MaxSize::LengthPercentage(ref lp) => Some(lp.percentage_relative_to(containing_block.inline_size)),
MaxSize::LengthPercentage(ref lp) => {
Some(lp.percentage_relative_to(containing_block.inline_size))
},
},
block: match self.block {
MaxSize::None => None,
MaxSize::LengthPercentage(ref lp) => lp.maybe_percentage_relative_to(containing_block.block_size.non_auto()),
MaxSize::LengthPercentage(ref lp) => {
lp.maybe_percentage_relative_to(containing_block.block_size.non_auto())
},
},
}
}
@@ -180,7 +180,9 @@ impl From<stylo::Display> for Display {

fn size_to_length(size: Size) -> LengthPercentageOrAuto {
match size {
Size::LengthPercentage(length) => LengthPercentageOrAuto::LengthPercentage(length.0.clone()),
Size::LengthPercentage(length) => {
LengthPercentageOrAuto::LengthPercentage(length.0.clone())
},
Size::Auto => LengthPercentageOrAuto::Auto,
}
}
@@ -324,7 +324,7 @@ where
Component::LastOfType |
Component::OnlyOfType => {
specificity.class_like_selectors += 1;
}
},
Component::NonTSPseudoClass(ref pseudo) => {
if !pseudo.has_zero_specificity() {
specificity.class_like_selectors += 1;
@@ -867,14 +867,14 @@ pub trait TElement:
break;
}
inner_shadow = shadow;
}
},
None => {
// TODO(emilio): Should probably distinguish with
// MatchesDocumentRules::{No,Yes,IfPart} or
// something so that we could skip some work.
doc_rules_apply = true;
break;
}
},
}
}
}
@@ -7,8 +7,8 @@
#![deny(missing_docs)]

use crate::context::SharedStyleContext;
use crate::Atom;
use crate::values::computed::Length;
use crate::Atom;

/// Represents the font metrics that style needs from a font to compute the
/// value of certain CSS units like `ex`.
@@ -138,7 +138,8 @@ impl Device {

/// Set the font size of the root element (for rem)
pub fn set_root_font_size(&self, size: Au) {
self.root_font_size.store(size.0 as isize, Ordering::Relaxed)
self.root_font_size
.store(size.0 as isize, Ordering::Relaxed)
}

/// Sets the body text color for the "inherit color from body" quirk.
@@ -1000,7 +1000,8 @@ impl structs::FontSizePrefs {
GenericFontFamily::MozEmoji => unreachable!(
"Should never get here, since this doesn't (yet) appear on font family"
),
}).into()
})
.into()
}
}

@@ -2131,7 +2132,9 @@ impl<'le> ::selectors::Element for GeckoElement<'le> {
true
},
NonTSPseudoClass::MozNativeAnonymous |
NonTSPseudoClass::MozNativeAnonymousNoSpecificity => self.is_in_native_anonymous_subtree(),
NonTSPseudoClass::MozNativeAnonymousNoSpecificity => {
self.is_in_native_anonymous_subtree()
},
NonTSPseudoClass::MozUseShadowTreeRoot => self.is_root_of_use_element_shadow_tree(),
NonTSPseudoClass::MozTableBorderNonzero => unsafe {
bindings::Gecko_IsTableBorderNonzero(self.0)
@@ -396,9 +396,11 @@ impl<'a> SelectorVisitor for CompoundSelectorDependencyCollector<'a> {

if may_match_in_no_namespace {
if *local_name_lower == local_name!("id") {
self.flags.insert(InvalidationMapFlags::HAS_ID_ATTR_SELECTOR)
self.flags
.insert(InvalidationMapFlags::HAS_ID_ATTR_SELECTOR)
} else if *local_name_lower == local_name!("class") {
self.flags.insert(InvalidationMapFlags::HAS_CLASS_ATTR_SELECTOR)
self.flags
.insert(InvalidationMapFlags::HAS_CLASS_ATTR_SELECTOR)
}
}

@@ -204,7 +204,10 @@ where
}

if log_enabled!(::log::Level::Debug) {
debug!("Collecting changes for: {:?}, flags {:?}", element, attr_selector_flags);
debug!(
"Collecting changes for: {:?}, flags {:?}",
element, attr_selector_flags
);
if !state_changes.is_empty() {
debug!(" > state: {:?}", state_changes);
}
@@ -362,8 +365,8 @@ where
}
}

let should_examine_attribute_selector_map = self.snapshot.other_attr_changed() ||
map.flags.intersects(self.attr_selector_flags);
let should_examine_attribute_selector_map =
self.snapshot.other_attr_changed() || map.flags.intersects(self.attr_selector_flags);

if should_examine_attribute_selector_map {
self.collect_dependencies_in_map(&map.other_attribute_affecting_selectors)
@@ -916,7 +916,6 @@ impl<T> LogicalMargin<T> {
}
}


impl<T: Copy> LogicalMargin<T> {
#[inline]
pub fn new_all_same(mode: WritingMode, value: T) -> LogicalMargin<T> {
@@ -348,7 +348,6 @@ where
return;
}


let inner_shadow_host = inner_shadow.host();
let outer_shadow = inner_shadow_host.containing_shadow();
let part_rules = match outer_shadow {
@@ -592,8 +592,8 @@ impl RuleTree {
last = node;
}

let rule =
self.insert_ordered_rules_from(last.parent().unwrap().clone(), children.drain(..).rev());
let rule = self
.insert_ordered_rules_from(last.parent().unwrap().clone(), children.drain(..).rev());
rule
}

@@ -11,8 +11,8 @@ use crate::media_queries::media_feature_expression::RangeOrOperator;
use crate::media_queries::MediaType;
use crate::properties::ComputedValues;
use crate::values::computed::CSSPixelLength;
use crate::values::KeyframesName;
use crate::values::specified::font::FONT_MEDIUM_PX;
use crate::values::KeyframesName;
use app_units::Au;
use cssparser::RGBA;
use euclid::default::Size2D as UntypedSize2D;
@@ -59,8 +59,8 @@ pub use self::rules_iterator::{AllRules, EffectiveRules};
pub use self::rules_iterator::{NestedRuleIterationCondition, RulesIterator};
pub use self::style_rule::StyleRule;
pub use self::stylesheet::{DocumentStyleSheet, Namespaces, Stylesheet};
pub use self::stylesheet::{StylesheetContents, StylesheetInDocument, UserAgentStylesheets};
pub use self::stylesheet::{SanitizationData, SanitizationKind};
pub use self::stylesheet::{StylesheetContents, StylesheetInDocument, UserAgentStylesheets};
pub use self::supports_rule::SupportsRule;
pub use self::viewport_rule::ViewportRule;

@@ -368,9 +368,7 @@ impl SanitizationKind {
CssRule::Supports(..) |
CssRule::Import(..) => false,

CssRule::FontFace(..) |
CssRule::Namespace(..) |
CssRule::Style(..) => true,
CssRule::FontFace(..) | CssRule::Namespace(..) | CssRule::Style(..) => true,

CssRule::Keyframes(..) |
CssRule::Page(..) |
@@ -1373,11 +1373,7 @@ impl ComputedTranslate {
LengthPercentage::zero(),
Length::zero(),
),
Translate::Translate(ref tx, ref ty, ref tz) => (
tx.clone(),
ty.clone(),
tz.clone(),
),
Translate::Translate(ref tx, ref ty, ref tz) => (tx.clone(), ty.clone(), tz.clone()),
}
}
}
@@ -75,9 +75,7 @@ impl ToComputedValue for specified::Length {
///
/// https://drafts.csswg.org/css-values-4/#typedef-length-percentage
#[allow(missing_docs)]
#[derive(
Clone, Debug, Deserialize, MallocSizeOf, Serialize, ToAnimatedZero, ToResolvedValue,
)]
#[derive(Clone, Debug, Deserialize, MallocSizeOf, Serialize, ToAnimatedZero, ToResolvedValue)]
#[repr(C)]
pub struct LengthPercentage {
length: Length,
@@ -75,11 +75,11 @@ pub use self::resolution::Resolution;
pub use self::svg::MozContextProperties;
pub use self::svg::{SVGLength, SVGOpacity, SVGPaint, SVGPaintKind};
pub use self::svg::{SVGPaintOrder, SVGStrokeDashArray, SVGWidth};
pub use self::text::TextUnderlinePosition;
pub use self::text::{InitialLetter, LetterSpacing, LineBreak, LineHeight};
pub use self::text::{OverflowWrap, TextOverflow, WordBreak, WordSpacing};
pub use self::text::{TextAlign, TextEmphasisPosition, TextEmphasisStyle};
pub use self::text::{TextDecorationLength, TextDecorationSkipInk};
pub use self::text::TextUnderlinePosition;
pub use self::time::Time;
pub use self::transform::{Rotate, Scale, Transform, TransformOperation};
pub use self::transform::{TransformOrigin, TransformStyle, Translate};
@@ -19,10 +19,10 @@ use std::fmt::{self, Write};
use style_traits::{CssWriter, ToCss};

pub use crate::values::specified::TextAlignKeyword as TextAlign;
pub use crate::values::specified::TextUnderlinePosition;
pub use crate::values::specified::{LineBreak, OverflowWrap, WordBreak};
pub use crate::values::specified::{TextDecorationLine, TextEmphasisPosition};
pub use crate::values::specified::{TextDecorationSkipInk, TextTransform};
pub use crate::values::specified::TextUnderlinePosition;

/// A computed value for the `initial-letter` property.
pub type InitialLetter = GenericInitialLetter<CSSFloat, CSSInteger>;
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.