Auto merge of #19377 - moz-servo-sync:gecko-backout, r=moz-servo-sync

Multiple gecko backouts

Backed out changeset 1fdcd69d2524 for Build Bustage. r=backout on a CLOSED TREE

Backs out https://github.com/servo/servo/pull/19376

<!-- 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/19377)
<!-- Reviewable:end -->

---

Backed out changeset 077ce85c466b for failing devtools webconsole/test/browser_webconsole_bug_595934_message_categories.js on Windows 7 debug without e10s. r=backout on a CLOSED TREE

Backs out https://github.com/servo/servo/pull/19374
This commit is contained in:
bors-servo 2017-11-26 08:22:12 -06:00 committed by GitHub
commit 0df51515c3
8 changed files with 272 additions and 921 deletions

View file

@ -596,7 +596,7 @@ pub mod basic_shape {
use gecko_bindings::sugar::ns_style_coord::{CoordDataMut, CoordDataValue};
use std::borrow::Borrow;
use values::computed::ComputedUrl;
use values::computed::basic_shape::{BasicShape, ClippingShape, FloatAreaShape, ShapeRadius};
use values::computed::basic_shape::{BasicShape, ShapeRadius};
use values::computed::border::{BorderCornerRadius, BorderRadius};
use values::computed::length::LengthOrPercentage;
use values::computed::position;
@ -606,68 +606,32 @@ pub mod basic_shape {
use values::generics::border::BorderRadius as GenericBorderRadius;
use values::generics::rect::Rect;
impl StyleShapeSource {
/// Convert StyleShapeSource to ShapeSource except URL and Image
/// types.
fn into_shape_source<ReferenceBox, ImageOrUrl>(
&self
) -> Option<ShapeSource<BasicShape, ReferenceBox, ImageOrUrl>>
where
ReferenceBox: From<StyleGeometryBox>
{
match self.mType {
StyleShapeSourceType::None => Some(ShapeSource::None),
StyleShapeSourceType::Box => Some(ShapeSource::Box(self.mReferenceBox.into())),
StyleShapeSourceType::Shape => {
let other_shape = unsafe { &*self.mBasicShape.mPtr };
let shape = other_shape.into();
let reference_box = if self.mReferenceBox == StyleGeometryBox::NoBox {
None
} else {
Some(self.mReferenceBox.into())
};
Some(ShapeSource::Shape(shape, reference_box))
},
StyleShapeSourceType::URL | StyleShapeSourceType::Image => None,
}
}
}
impl<'a> From<&'a StyleShapeSource> for ClippingShape
impl<'a, ReferenceBox> From<&'a StyleShapeSource> for ShapeSource<BasicShape, ReferenceBox, ComputedUrl>
where
ReferenceBox: From<StyleGeometryBox>,
{
fn from(other: &'a StyleShapeSource) -> Self {
match other.mType {
StyleShapeSourceType::None => ShapeSource::None,
StyleShapeSourceType::Box => ShapeSource::Box(other.mReferenceBox.into()),
StyleShapeSourceType::URL => {
unsafe {
let shape_image = &*other.mShapeImage.mPtr;
let other_url = &(**shape_image.__bindgen_anon_1.mURLValue.as_ref());
let url = ComputedUrl::from_url_value_data(&other_url._base).unwrap();
ShapeSource::ImageOrUrl(url)
ShapeSource::Url(url)
}
},
StyleShapeSourceType::Image => {
unreachable!("ClippingShape doesn't support Image!");
StyleShapeSourceType::Shape => {
let other_shape = unsafe { &*other.mBasicShape.mPtr };
let shape = other_shape.into();
let reference_box = if other.mReferenceBox == StyleGeometryBox::NoBox {
None
} else {
Some(other.mReferenceBox.into())
};
ShapeSource::Shape(shape, reference_box)
}
_ => other.into_shape_source().expect("Couldn't convert to StyleSource!")
}
}
}
impl<'a> From<&'a StyleShapeSource> for FloatAreaShape
{
fn from(other: &'a StyleShapeSource) -> Self {
match other.mType {
StyleShapeSourceType::URL => {
unreachable!("FloatAreaShape doesn't support URL!");
},
StyleShapeSourceType::Image => {
unsafe {
let shape_image = &*other.mShapeImage.mPtr;
let image = shape_image.into_image().expect("Cannot convert to Image");
ShapeSource::ImageOrUrl(image)
}
}
_ => other.into_shape_source().expect("Couldn't convert to StyleSource!")
}
}
}

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

View file

@ -5008,32 +5008,18 @@ fn static_assert() {
use gecko::conversions::basic_shape::set_corners_from_radius;
use gecko::values::GeckoStyleCoordConvertible;
use values::generics::basic_shape::{BasicShape, FillRule, ShapeSource};
let ref mut ${ident} = self.gecko.${gecko_ffi_name};
// clean up existing struct
unsafe { Gecko_DestroyShapeSource(${ident}) };
${ident}.mType = StyleShapeSourceType::None;
match v {
% if ident == "clip_path":
ShapeSource::ImageOrUrl(ref url) => {
ShapeSource::Url(ref url) => {
unsafe {
bindings::Gecko_StyleShapeSource_SetURLValue(${ident}, url.for_ffi())
}
}
% elif ident == "shape_outside":
ShapeSource::ImageOrUrl(image) => {
unsafe {
bindings::Gecko_NewShapeImage(${ident});
let style_image = &mut *${ident}.mShapeImage.mPtr;
style_image.set(image);
}
}
% else:
<% raise Exception("Unknown property: %s" % ident) %>
}
% endif
ShapeSource::None => {} // don't change the type
ShapeSource::Box(reference) => {
${ident}.mReferenceBox = reference.into();

View file

@ -9,7 +9,7 @@
use std::fmt;
use style_traits::ToCss;
use values::computed::{LengthOrPercentage, ComputedUrl, Image};
use values::computed::{LengthOrPercentage, ComputedUrl};
use values::generics::basic_shape::{BasicShape as GenericBasicShape};
use values::generics::basic_shape::{Circle as GenericCircle, ClippingShape as GenericClippingShape};
use values::generics::basic_shape::{Ellipse as GenericEllipse, FloatAreaShape as GenericFloatAreaShape};
@ -19,7 +19,7 @@ use values::generics::basic_shape::{InsetRect as GenericInsetRect, ShapeRadius a
pub type ClippingShape = GenericClippingShape<BasicShape, ComputedUrl>;
/// A computed float area shape.
pub type FloatAreaShape = GenericFloatAreaShape<BasicShape, Image>;
pub type FloatAreaShape = GenericFloatAreaShape<BasicShape, ComputedUrl>;
/// A computed basic shape.
pub type BasicShape = GenericBasicShape<LengthOrPercentage, LengthOrPercentage, LengthOrPercentage>;

View file

@ -27,7 +27,7 @@ pub enum GeometryBox {
}
/// A float area shape, for `shape-outside`.
pub type FloatAreaShape<BasicShape, Image> = ShapeSource<BasicShape, ShapeBox, Image>;
pub type FloatAreaShape<BasicShape, Url> = ShapeSource<BasicShape, ShapeBox, Url>;
// https://drafts.csswg.org/css-shapes-1/#typedef-shape-box
define_css_keyword_enum!(ShapeBox:
@ -41,9 +41,9 @@ add_impls_for_keyword_enum!(ShapeBox);
/// A shape source, for some reference box.
#[allow(missing_docs)]
#[derive(Animate, Clone, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToCss)]
pub enum ShapeSource<BasicShape, ReferenceBox, ImageOrUrl> {
pub enum ShapeSource<BasicShape, ReferenceBox, Url> {
#[animation(error)]
ImageOrUrl(ImageOrUrl),
Url(Url),
Shape(
BasicShape,
#[animation(constant)]

View file

@ -22,7 +22,6 @@ use values::generics::basic_shape::{Polygon as GenericPolygon, ShapeRadius as Ge
use values::generics::rect::Rect;
use values::specified::LengthOrPercentage;
use values::specified::border::BorderRadius;
use values::specified::image::Image;
use values::specified::position::{HorizontalPosition, Position, PositionComponent, Side, VerticalPosition};
use values::specified::url::SpecifiedUrl;
@ -30,7 +29,7 @@ use values::specified::url::SpecifiedUrl;
pub type ClippingShape = GenericClippingShape<BasicShape, SpecifiedUrl>;
/// A specified float area shape.
pub type FloatAreaShape = GenericFloatAreaShape<BasicShape, Image>;
pub type FloatAreaShape = GenericFloatAreaShape<BasicShape, SpecifiedUrl>;
/// A specified basic shape.
pub type BasicShape = GenericBasicShape<HorizontalPosition, VerticalPosition, LengthOrPercentage>;
@ -50,18 +49,14 @@ pub type ShapeRadius = GenericShapeRadius<LengthOrPercentage>;
/// The specified value of `Polygon`
pub type Polygon = GenericPolygon<LengthOrPercentage>;
impl<ReferenceBox, ImageOrUrl> Parse for ShapeSource<BasicShape, ReferenceBox, ImageOrUrl>
where
ReferenceBox: Parse,
ImageOrUrl: Parse,
{
impl<ReferenceBox: Parse> Parse for ShapeSource<BasicShape, ReferenceBox, SpecifiedUrl> {
fn parse<'i, 't>(context: &ParserContext, input: &mut Parser<'i, 't>) -> Result<Self, ParseError<'i>> {
if input.try(|i| i.expect_ident_matching("none")).is_ok() {
return Ok(ShapeSource::None)
}
if let Ok(image_or_url) = input.try(|i| ImageOrUrl::parse(context, i)) {
return Ok(ShapeSource::ImageOrUrl(image_or_url))
if let Ok(url) = input.try(|i| SpecifiedUrl::parse(context, i)) {
return Ok(ShapeSource::Url(url))
}
fn parse_component<U: Parse>(context: &ParserContext, input: &mut Parser,

View file

@ -4559,7 +4559,6 @@ pub extern "C" fn Servo_ComputeColor(
current_color: structs::nscolor,
value: *const nsAString,
result_color: *mut structs::nscolor,
was_current_color: *mut bool,
) -> bool {
use style::gecko;
@ -4594,11 +4593,6 @@ pub extern "C" fn Servo_ComputeColor(
Some(computed_color) => {
let rgba = computed_color.to_rgba(current_color);
*result_color = gecko::values::convert_rgba_to_nscolor(&rgba);
if !was_current_color.is_null() {
unsafe {
*was_current_color = computed_color.is_currentcolor();
}
}
true
}
None => false,