Bug 1485044: Remove useless StyleDisplay conversion. r=heycam

Differential Revision: https://phabricator.services.mozilla.com/D3896
This commit is contained in:
Emilio Cobos Álvarez 2018-08-21 17:34:21 +02:00
Родитель b974be2748
Коммит 3ef3f33868
6 изменённых файлов: 8 добавлений и 21 удалений

1
Cargo.lock сгенерированный
Просмотреть файл

@ -832,6 +832,7 @@ dependencies = [
"log 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"malloc_size_of 0.0.1",
"nsstring 0.1.0",
"num-traits 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"parking_lot 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.19.0",
"servo_arc 0.1.1",

Просмотреть файл

@ -23,24 +23,6 @@ ${helpers.predefined_type(
needs_context=product == "gecko"
)}
// FIXME(emilio): Listing all the display values here is very unfortunate, we should teach C++ to use the
// Rust enum directly, or generate the conversions to `StyleDisplay`.
${helpers.gecko_keyword_conversion(
Keyword('display', """
inline block inline-block
table inline-table table-row-group table-header-group table-footer-group
table-row table-column-group table-column table-cell table-caption
list-item none flex inline-flex grid inline-grid ruby ruby-base ruby-base-container
ruby-text ruby-text-container contents flow-root -webkit-box
-webkit-inline-box -moz-box -moz-inline-box -moz-grid -moz-inline-grid
-moz-grid-group -moz-grid-line -moz-stack -moz-inline-stack -moz-deck
-moz-popup -moz-groupbox
""",
gecko_enum_prefix='StyleDisplay',
gecko_strip_moz_prefix=False),
type="::values::specified::Display"
)}
${helpers.single_keyword(
"-moz-top-layer",
"none top",

Просмотреть файл

@ -57,8 +57,8 @@ fn moz_box_display_values_enabled(context: &ParserContext) -> bool {
/// Also, when you change this from Gecko you may need to regenerate the
/// C++-side bindings (see components/style/cbindgen.toml).
#[allow(missing_docs)]
#[derive(Clone, Copy, Debug, Eq, Hash, MallocSizeOf, Parse, PartialEq,
SpecifiedValueInfo, ToComputedValue, ToCss)]
#[derive(Clone, Copy, Debug, Eq, FromPrimitive, Hash, MallocSizeOf, Parse,
PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss)]
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
#[repr(u8)]
pub enum Display {

Просмотреть файл

@ -21,6 +21,7 @@ libc = "0.2"
log = {version = "0.4", features = ["release_max_level_info"]}
malloc_size_of = {path = "../../components/malloc_size_of"}
nsstring = {path = "../../support/gecko/nsstring"}
num-traits = "0.2"
parking_lot = "0.6"
selectors = {path = "../../components/selectors"}
servo_arc = {path = "../../components/servo_arc"}

Просмотреть файл

@ -3962,9 +3962,11 @@ pub extern "C" fn Servo_DeclarationBlock_SetKeywordValue(
property: nsCSSPropertyID,
value: i32
) {
use num_traits::FromPrimitive;
use style::properties::{PropertyDeclaration, LonghandId};
use style::properties::longhands;
use style::values::specified::BorderStyle;
use style::values::specified::Display;
use style::values::specified::{Clear, Float};
use style::values::generics::font::FontStyle;
@ -3974,7 +3976,7 @@ pub extern "C" fn Servo_DeclarationBlock_SetKeywordValue(
let prop = match_wrap_declared! { long,
MozUserModify => longhands::_moz_user_modify::SpecifiedValue::from_gecko_keyword(value),
Direction => longhands::direction::SpecifiedValue::from_gecko_keyword(value),
Display => longhands::display::SpecifiedValue::from_gecko_keyword(value),
Display => Display::from_u32(value).unwrap(),
Float => {
const LEFT: u32 = structs::StyleFloat::Left as u32;
const RIGHT: u32 = structs::StyleFloat::Right as u32;

Просмотреть файл

@ -9,6 +9,7 @@ extern crate libc;
#[macro_use] extern crate log;
extern crate malloc_size_of;
extern crate nsstring;
extern crate num_traits;
extern crate selectors;
extern crate servo_arc;
extern crate smallvec;