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. #22641

Merged
merged 27 commits into from Jan 7, 2019
Merged
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
4799e83
style: Enable CSS containment for frontend code.
dholbert Dec 15, 2018
31838b1
style: The 'all' property is not animatable.
emilio Dec 15, 2018
b59ec2e
style: Make <use> shadow trees lookup keyframe rules in the containin…
emilio Dec 17, 2018
1903559
style: Cleanup some conversion code dealing with NonNegative.
emilio Dec 16, 2018
ca1ad00
style: Use NonNegative more in the border code.
emilio Dec 17, 2018
3ed525f
style: Use cbindgen for ExtremumLength.
BorisChiou Dec 18, 2018
b7e728a
style: Support unprefixed min-content and max-content.
BorisChiou Dec 18, 2018
6275595
style: Let logical height, block-size, accept keywords.
BorisChiou Dec 18, 2018
f0f3eb3
style: Clamp to non-negative value after doing interpolation for circ…
BorisChiou Dec 19, 2018
7b44418
style: Bump smallvec and smallbitvec.
heycam Dec 20, 2018
8a6230e
style: changes to implement enum class for #define NS_STYLE_COLOR_ADJ…
sharath29 Dec 24, 2018
8929087
style: Update the Rust target version for bindgen.
emilio Dec 25, 2018
81a07b4
style: Implement the 'overflow-block' media query.
quasicomputational Dec 27, 2018
274845f
style: Implement the 'overflow-inline' media query.
quasicomputational Dec 22, 2018
a454f62
Rename nsIDocument to mozilla::dom::Document.
emilio Jan 2, 2019
d5bee57
style: Drop layout.css.box-decoration-break.enabled pref.
Jan 4, 2019
529ff36
style: Drop layout.css.color-adjust.enabled pref.
Jan 4, 2019
d862dae
style: Drop layout.css.image-orientation.enabled pref.
Jan 4, 2019
0488f81
style: Drop layout.css.isolation.enabled pref.
Jan 4, 2019
a0d1a03
style: Drop layout.css.mix-blend-mode.enabled pref.
Jan 4, 2019
48e4433
style: Drop layout.css.scroll-behavior.property-enabled pref.
Jan 4, 2019
152ef2e
style: Drop layout.css.background-blend-mode.enabled pref.
Jan 4, 2019
5f173c4
style: Rustfmt recent changes.
emilio Jan 6, 2019
d0eb20c
Update lockfile.
emilio Jan 6, 2019
4c1076a
style: Fix gecko build.
emilio Jan 6, 2019
97bd8fc
Fix Servo build.
emilio Jan 6, 2019
ecd9794
style: Remove a bunch of unit tests that are not very useful.
emilio Jan 7, 2019
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Some generated files are not rendered by default. Learn more.

@@ -14,6 +14,7 @@ use style::values::computed::{BorderCornerRadius, BorderImageWidth};
use style::values::computed::{BorderImageSideWidth, LengthOrNumber};
use style::values::generics::border::BorderImageSideWidth as GenericBorderImageSideWidth;
use style::values::generics::rect::Rect as StyleRect;
use style::values::generics::NonNegative;
use style::values::Either;
use webrender_api::{BorderRadius, BorderSide, BorderStyle, ColorF};
use webrender_api::{LayoutSideOffsets, LayoutSize, NormalBorder};
@@ -163,7 +164,7 @@ fn side_image_width(
) -> f32 {
match border_image_width {
GenericBorderImageSideWidth::Length(v) => v.to_used_value(total_length).to_f32_px(),
GenericBorderImageSideWidth::Number(x) => border_width * x,
GenericBorderImageSideWidth::Number(x) => border_width * x.0,
GenericBorderImageSideWidth::Auto => border_width,
}
}
@@ -181,15 +182,15 @@ pub fn image_width(
)
}

fn resolve_percentage(value: NumberOrPercentage, length: i32) -> i32 {
match value {
fn resolve_percentage(value: NonNegative<NumberOrPercentage>, length: i32) -> i32 {
match value.0 {
NumberOrPercentage::Percentage(p) => (p.0 * length as f32).round() as i32,
NumberOrPercentage::Number(n) => n.round() as i32,
}
}

pub fn image_slice(
border_image_slice: &StyleRect<NumberOrPercentage>,
border_image_slice: &StyleRect<NonNegative<NumberOrPercentage>>,
width: i32,
height: i32,
) -> SideOffsets2D<i32> {
@@ -37,7 +37,7 @@ selectors = { path = "../selectors" }
serde = { version = "1.0.27", optional = true }
serde_bytes = { version = "0.10", optional = true }
servo_arc = { path = "../servo_arc" }
smallbitvec = "2.1.0"
smallbitvec = "2.3.0"
smallvec = "0.6"
string_cache = { version = "0.7", optional = true }
thin-slice = "0.1.0"
@@ -128,6 +128,7 @@ use style::selector_parser::{
};
use style::shared_lock::{Locked, SharedRwLock};
use style::thread_state;
use style::values::generics::NonNegative;
use style::values::{computed, specified};
use style::values::{CSSFloat, Either};
use style::CaseSensitivityExt;
@@ -847,8 +848,9 @@ impl LayoutElementHelpers for LayoutDom<Element> {
};

if let Some(border) = border {
let width_value =
specified::BorderSideWidth::Length(specified::Length::from_px(border as f32));
let width_value = specified::BorderSideWidth::Length(NonNegative(
specified::Length::from_px(border as f32),
));
hints.push(from_declaration(
shared_lock,
PropertyDeclaration::BorderTopWidth(width_value.clone()),
@@ -60,8 +60,8 @@ serde = {version = "1.0", optional = true, features = ["derive"]}
servo_arc = { path = "../servo_arc" }
servo_atoms = {path = "../atoms", optional = true}
servo_config = {path = "../config", optional = true}
smallbitvec = "2.1.1"
smallvec = "0.6"
smallbitvec = "2.3.0"
smallvec = "0.6.6"
string_cache = { version = "0.7", optional = true }
style_derive = {path = "../style_derive"}
style_traits = {path = "../style_traits"}
@@ -139,7 +139,9 @@ mod bindings {

// Disable rust unions, because we replace some types inside of
// them.
let mut builder = Builder::default().rust_target(RustTarget::Stable_1_0);
let mut builder = Builder::default()
.rust_target(RustTarget::Stable_1_25)
.disable_untagged_union();

let rustfmt_path = env::var_os("RUSTFMT")
// This can be replaced with
@@ -50,6 +50,7 @@ include = [
"ComputedTimingFunction",
"Display",
"DisplayMode",
"ExtremumLength",
"FillRule",
"FontDisplay",
"FontFaceSourceListComponent",
@@ -144,7 +144,7 @@ bitflags! {
/// Event-based document states.
///
/// NB: Is important for this to remain in sync with Gecko's
/// dom/base/nsIDocument.h.
/// dom/base/Document.h.
#[derive(MallocSizeOf)]
pub struct DocumentState: u64 {
/// RTL locale: specific to the XUL localedir attribute
@@ -5,6 +5,8 @@
//! This module contains conversion helpers between Servo and Gecko types
//! Ideally, it would be in geckolib itself, but coherence
//! forces us to keep the traits and implementations here
//!
//! FIXME(emilio): This file should generally just die.

#![allow(unsafe_code)]

@@ -26,6 +28,7 @@ use crate::values::generics::box_::VerticalAlign;
use crate::values::generics::grid::{TrackListValue, TrackSize};
use crate::values::generics::image::{CompatMode, GradientItem, Image as GenericImage};
use crate::values::generics::rect::Rect;
use crate::values::generics::NonNegative;
use app_units::Au;
use std::f32::consts::PI;

@@ -113,7 +116,6 @@ impl From<nsStyleCoord_CalcValue> for LengthOrPercentageOrAuto {
// disappear as we move more stuff to cbindgen.
impl From<nsStyleCoord_CalcValue> for NonNegativeLengthOrPercentageOrAuto {
fn from(other: nsStyleCoord_CalcValue) -> Self {
use crate::values::generics::NonNegative;
use style_traits::values::specified::AllowedNumericType;
NonNegative(if other.mLength < 0 || other.mPercent < 0. {
LengthOrPercentageOrAuto::Calc(CalcLengthOrPercentage::with_clamping_mode(
@@ -679,6 +681,7 @@ pub mod basic_shape {
use crate::values::generics::basic_shape::{GeometryBox, ShapeBox, ShapeSource};
use crate::values::generics::border::BorderRadius as GenericBorderRadius;
use crate::values::generics::rect::Rect;
use crate::values::generics::NonNegative;
use crate::values::specified::SVGPathData;
use std::borrow::Borrow;

@@ -838,10 +841,17 @@ pub mod basic_shape {
fn from(other: &'a nsStyleCorners) -> Self {
let get_corner = |index| {
BorderCornerRadius::new(
LengthOrPercentage::from_gecko_style_coord(&other.data_at(index))
.expect("<border-radius> should be a length, percentage, or calc value"),
LengthOrPercentage::from_gecko_style_coord(&other.data_at(index + 1))
.expect("<border-radius> should be a length, percentage, or calc value"),
NonNegative(
LengthOrPercentage::from_gecko_style_coord(&other.data_at(index)).expect(
"<border-radius> should be a length, percentage, or calc value",
),
),
NonNegative(
LengthOrPercentage::from_gecko_style_coord(&other.data_at(index + 1))
.expect(
"<border-radius> should be a length, percentage, or calc value",
),
),
)
};

@@ -7,9 +7,8 @@
use crate::context::QuirksMode;
use crate::dom::TElement;
use crate::gecko_bindings::bindings::{self, RawServoStyleSet};
use crate::gecko_bindings::structs::StyleSheet as DomStyleSheet;
use crate::gecko_bindings::structs::{nsIDocument, StyleSheetInfo};
use crate::gecko_bindings::structs::{RawGeckoPresContextBorrowed, ServoStyleSetSizes};
use crate::gecko_bindings::structs::{StyleSheet as DomStyleSheet, StyleSheetInfo};
use crate::gecko_bindings::sugar::ownership::{HasArcFFI, HasBoxFFI, HasFFI, HasSimpleFFI};
use crate::invalidation::media_queries::{MediaListKey, ToMediaListKey};
use crate::media_queries::{Device, MediaList};
@@ -151,8 +150,7 @@ impl PerDocumentStyleData {
// right now not always honored, see bug 1405543...
//
// Should we just force XBL Stylists to be NoQuirks?
let quirks_mode =
unsafe { (*device.pres_context().mDocument.raw::<nsIDocument>()).mCompatMode };
let quirks_mode = unsafe { (*device.pres_context().mDocument.mRawPtr).mCompatMode };

PerDocumentStyleData(AtomicRefCell::new(PerDocumentStyleDataImpl {
stylist: Stylist::new(device, quirks_mode.into()),
@@ -193,12 +191,7 @@ impl PerDocumentStyleDataImpl {
/// Returns whether visited styles are enabled.
#[inline]
pub fn visited_styles_enabled(&self) -> bool {
let doc = self
.stylist
.device()
.pres_context()
.mDocument
.raw::<nsIDocument>();
let doc = self.stylist.device().pres_context().mDocument.mRawPtr;
unsafe { bindings::Gecko_VisitedStylesEnabled(doc) }
}

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.