mirror of
https://github.com/servo/servo.git
synced 2025-07-03 05:23:38 +01:00
Auto merge of #19500 - emilio:camel-case-all-the-way, r=nox
style: Make all keywords CamelCase for consistency. <!-- 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/19500) <!-- Reviewable:end -->
This commit is contained in:
commit
b24778202a
61 changed files with 922 additions and 837 deletions
|
@ -261,8 +261,8 @@ impl Font {
|
|||
#[inline]
|
||||
pub fn glyph_index(&self, codepoint: char) -> Option<GlyphId> {
|
||||
let codepoint = match self.variant {
|
||||
font_variant_caps::T::small_caps => codepoint.to_uppercase().next().unwrap(), //FIXME: #5938
|
||||
font_variant_caps::T::normal => codepoint,
|
||||
font_variant_caps::T::SmallCaps => codepoint.to_uppercase().next().unwrap(), //FIXME: #5938
|
||||
font_variant_caps::T::Normal => codepoint,
|
||||
};
|
||||
self.handle.glyph_index(codepoint)
|
||||
}
|
||||
|
|
|
@ -20,7 +20,8 @@ use std::hash::{BuildHasherDefault, Hash, Hasher};
|
|||
use std::rc::Rc;
|
||||
use std::sync::Arc;
|
||||
use std::sync::atomic::{AtomicUsize, Ordering, ATOMIC_USIZE_INIT};
|
||||
use style::computed_values::{font_style, font_variant_caps};
|
||||
use style::computed_values::font_style::T as FontStyle;
|
||||
use style::computed_values::font_variant_caps::T as FontVariantCaps;
|
||||
use style::properties::style_structs;
|
||||
use webrender_api;
|
||||
|
||||
|
@ -78,14 +79,14 @@ impl FontContext {
|
|||
template: Arc<FontTemplateData>,
|
||||
descriptor: FontTemplateDescriptor,
|
||||
pt_size: Au,
|
||||
variant: font_variant_caps::T,
|
||||
variant: FontVariantCaps,
|
||||
font_key: webrender_api::FontKey) -> Result<Font, ()> {
|
||||
// TODO: (Bug #3463): Currently we only support fake small-caps
|
||||
// painting. We should also support true small-caps (where the
|
||||
// font supports it) in the future.
|
||||
let actual_pt_size = match variant {
|
||||
font_variant_caps::T::small_caps => pt_size.scale_by(SMALL_CAPS_SCALE_FACTOR),
|
||||
font_variant_caps::T::normal => pt_size,
|
||||
FontVariantCaps::SmallCaps => pt_size.scale_by(SMALL_CAPS_SCALE_FACTOR),
|
||||
FontVariantCaps::Normal => pt_size,
|
||||
};
|
||||
|
||||
let handle = FontHandle::new_from_template(&self.platform_handle,
|
||||
|
@ -130,8 +131,8 @@ impl FontContext {
|
|||
|
||||
let desc = FontTemplateDescriptor::new(style.font_weight,
|
||||
style.font_stretch,
|
||||
style.font_style == font_style::T::italic ||
|
||||
style.font_style == font_style::T::oblique);
|
||||
style.font_style == FontStyle::Italic ||
|
||||
style.font_style == FontStyle::Oblique);
|
||||
|
||||
let mut fonts: SmallVec<[Rc<RefCell<Font>>; 8]> = SmallVec::new();
|
||||
|
||||
|
|
|
@ -20,7 +20,8 @@ use platform::font_template::FontTemplateData;
|
|||
use std::{mem, ptr};
|
||||
use std::os::raw::{c_char, c_long};
|
||||
use std::sync::Arc;
|
||||
use style::computed_values::{font_stretch, font_weight};
|
||||
use style::computed_values::font_stretch::T as FontStretch;
|
||||
use style::computed_values::font_weight::T as FontWeight;
|
||||
use super::c_str_to_string;
|
||||
use text::glyph::GlyphId;
|
||||
use text::util::fixed_to_float;
|
||||
|
@ -134,8 +135,8 @@ impl FontHandleMethods for FontHandle {
|
|||
fn is_italic(&self) -> bool {
|
||||
unsafe { (*self.face).style_flags & FT_STYLE_FLAG_ITALIC as c_long != 0 }
|
||||
}
|
||||
fn boldness(&self) -> font_weight::T {
|
||||
let default_weight = font_weight::T::normal();
|
||||
fn boldness(&self) -> FontWeight {
|
||||
let default_weight = FontWeight::normal();
|
||||
if unsafe { (*self.face).style_flags & FT_STYLE_FLAG_BOLD as c_long == 0 } {
|
||||
default_weight
|
||||
} else {
|
||||
|
@ -145,9 +146,9 @@ impl FontHandleMethods for FontHandle {
|
|||
if valid {
|
||||
let weight =(*os2).usWeightClass as i32;
|
||||
if weight < 10 {
|
||||
font_weight::T::from_int(weight * 100).unwrap()
|
||||
FontWeight::from_int(weight * 100).unwrap()
|
||||
} else if weight >= 100 && weight < 1000 {
|
||||
font_weight::T::from_int(weight / 100 * 100).unwrap()
|
||||
FontWeight::from_int(weight / 100 * 100).unwrap()
|
||||
} else {
|
||||
default_weight
|
||||
}
|
||||
|
@ -157,9 +158,9 @@ impl FontHandleMethods for FontHandle {
|
|||
}
|
||||
}
|
||||
}
|
||||
fn stretchiness(&self) -> font_stretch::T {
|
||||
fn stretchiness(&self) -> FontStretch {
|
||||
// TODO(pcwalton): Implement this.
|
||||
font_stretch::T::normal
|
||||
FontStretch::Normal
|
||||
}
|
||||
|
||||
fn glyph_index(&self, codepoint: char) -> Option<GlyphId> {
|
||||
|
|
|
@ -21,7 +21,8 @@ use platform::macos::font_context::FontContextHandle;
|
|||
use std::{fmt, ptr};
|
||||
use std::ops::Range;
|
||||
use std::sync::Arc;
|
||||
use style::computed_values::{font_stretch, font_weight};
|
||||
use style::computed_values::font_stretch::T as FontStretch;
|
||||
use style::computed_values::font_weight::T as FontWeight;
|
||||
use text::glyph::GlyphId;
|
||||
|
||||
const KERN_PAIR_LEN: usize = 6;
|
||||
|
@ -210,29 +211,29 @@ impl FontHandleMethods for FontHandle {
|
|||
self.ctfont.symbolic_traits().is_italic()
|
||||
}
|
||||
|
||||
fn boldness(&self) -> font_weight::T {
|
||||
fn boldness(&self) -> FontWeight {
|
||||
let normalized = self.ctfont.all_traits().normalized_weight(); // [-1.0, 1.0]
|
||||
let normalized = if normalized <= 0.0 {
|
||||
4.0 + normalized * 3.0 // [1.0, 4.0]
|
||||
} else {
|
||||
4.0 + normalized * 5.0 // [4.0, 9.0]
|
||||
}; // [1.0, 9.0], centered on 4.0
|
||||
font_weight::T::from_int(normalized.round() as i32 * 100).unwrap()
|
||||
FontWeight::from_int(normalized.round() as i32 * 100).unwrap()
|
||||
}
|
||||
|
||||
fn stretchiness(&self) -> font_stretch::T {
|
||||
fn stretchiness(&self) -> FontStretch {
|
||||
let normalized = self.ctfont.all_traits().normalized_width(); // [-1.0, 1.0]
|
||||
let normalized = (normalized + 1.0) / 2.0 * 9.0; // [0.0, 9.0]
|
||||
match normalized {
|
||||
v if v < 1.0 => font_stretch::T::ultra_condensed,
|
||||
v if v < 2.0 => font_stretch::T::extra_condensed,
|
||||
v if v < 3.0 => font_stretch::T::condensed,
|
||||
v if v < 4.0 => font_stretch::T::semi_condensed,
|
||||
v if v < 5.0 => font_stretch::T::normal,
|
||||
v if v < 6.0 => font_stretch::T::semi_expanded,
|
||||
v if v < 7.0 => font_stretch::T::expanded,
|
||||
v if v < 8.0 => font_stretch::T::extra_expanded,
|
||||
_ => font_stretch::T::ultra_expanded,
|
||||
v if v < 1.0 => FontStretch::UltraCondensed,
|
||||
v if v < 2.0 => FontStretch::ExtraCondensed,
|
||||
v if v < 3.0 => FontStretch::Condensed,
|
||||
v if v < 4.0 => FontStretch::SemiCondensed,
|
||||
v if v < 5.0 => FontStretch::Normal,
|
||||
v if v < 6.0 => FontStretch::SemiExpanded,
|
||||
v if v < 7.0 => FontStretch::Expanded,
|
||||
v if v < 8.0 => FontStretch::ExtraExpanded,
|
||||
_ => FontStretch::UltraExpanded,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,8 @@ use platform::font_template::FontTemplateData;
|
|||
use platform::windows::font_context::FontContextHandle;
|
||||
use platform::windows::font_list::font_from_atom;
|
||||
use std::sync::Arc;
|
||||
use style::computed_values::{font_stretch, font_weight};
|
||||
use style::computed_values::font_stretch::T as StyleFontStretch;
|
||||
use style::computed_values::font_weight::T as StyleFontWeight;
|
||||
use text::glyph::GlyphId;
|
||||
use truetype;
|
||||
|
||||
|
@ -94,8 +95,8 @@ fn get_family_face_indices(records: &[truetype::naming_table::Record]) -> Option
|
|||
struct FontInfo {
|
||||
family_name: String,
|
||||
face_name: String,
|
||||
weight: font_weight::T,
|
||||
stretch: font_stretch::T,
|
||||
weight: StyleFontWeight,
|
||||
stretch: StyleFontStretch,
|
||||
style: FontStyle,
|
||||
}
|
||||
|
||||
|
@ -155,19 +156,21 @@ impl FontInfo {
|
|||
},
|
||||
};
|
||||
|
||||
let weight = font_weight::T::
|
||||
from_int(min(9, max(1, weight_val as i32 / 100)) * 100).unwrap();
|
||||
let weight =
|
||||
StyleFontWeight::from_int(
|
||||
min(9, max(1, weight_val as i32 / 100)) * 100
|
||||
).unwrap();
|
||||
|
||||
let stretch = match min(9, max(1, width_val)) {
|
||||
1 => font_stretch::T::ultra_condensed,
|
||||
2 => font_stretch::T::extra_condensed,
|
||||
3 => font_stretch::T::condensed,
|
||||
4 => font_stretch::T::semi_condensed,
|
||||
5 => font_stretch::T::normal,
|
||||
6 => font_stretch::T::semi_expanded,
|
||||
7 => font_stretch::T::expanded,
|
||||
8 => font_stretch::T::extra_expanded,
|
||||
9 => font_stretch::T::ultra_expanded,
|
||||
1 => StyleFontStretch::UltraCondensed,
|
||||
2 => StyleFontStretch::ExtraCondensed,
|
||||
3 => StyleFontStretch::Condensed,
|
||||
4 => StyleFontStretch::SemiCondensed,
|
||||
5 => StyleFontStretch::Normal,
|
||||
6 => StyleFontStretch::SemiExpanded,
|
||||
7 => StyleFontStretch::Expanded,
|
||||
8 => StyleFontStretch::ExtraExpanded,
|
||||
9 => StyleFontStretch::UltraExpanded,
|
||||
_ => return Err(()),
|
||||
};
|
||||
|
||||
|
@ -188,7 +191,7 @@ impl FontInfo {
|
|||
|
||||
fn new_from_font(font: &Font) -> Result<FontInfo, ()> {
|
||||
let style = font.style();
|
||||
let weight = font_weight::T(match font.weight() {
|
||||
let weight = StyleFontWeight(match font.weight() {
|
||||
FontWeight::Thin => 100,
|
||||
FontWeight::ExtraLight => 200,
|
||||
FontWeight::Light => 300,
|
||||
|
@ -204,16 +207,16 @@ impl FontInfo {
|
|||
FontWeight::ExtraBlack => 900,
|
||||
});
|
||||
let stretch = match font.stretch() {
|
||||
FontStretch::Undefined => font_stretch::T::normal,
|
||||
FontStretch::UltraCondensed => font_stretch::T::ultra_condensed,
|
||||
FontStretch::ExtraCondensed => font_stretch::T::extra_condensed,
|
||||
FontStretch::Condensed => font_stretch::T::condensed,
|
||||
FontStretch::SemiCondensed => font_stretch::T::semi_condensed,
|
||||
FontStretch::Normal => font_stretch::T::normal,
|
||||
FontStretch::SemiExpanded => font_stretch::T::semi_expanded,
|
||||
FontStretch::Expanded => font_stretch::T::expanded,
|
||||
FontStretch::ExtraExpanded => font_stretch::T::extra_expanded,
|
||||
FontStretch::UltraExpanded => font_stretch::T::ultra_expanded,
|
||||
FontStretch::Undefined => StyleFontStretch::Normal,
|
||||
FontStretch::UltraCondensed => StyleFontStretch::UltraCondensed,
|
||||
FontStretch::ExtraCondensed => StyleFontStretch::ExtraCondensed,
|
||||
FontStretch::Condensed => StyleFontStretch::Condensed,
|
||||
FontStretch::SemiCondensed => StyleFontStretch::SemiCondensed,
|
||||
FontStretch::Normal => StyleFontStretch::Normal,
|
||||
FontStretch::SemiExpanded => StyleFontStretch::SemiExpanded,
|
||||
FontStretch::Expanded => StyleFontStretch::Expanded,
|
||||
FontStretch::ExtraExpanded => StyleFontStretch::ExtraExpanded,
|
||||
FontStretch::UltraExpanded => StyleFontStretch::UltraExpanded,
|
||||
};
|
||||
|
||||
Ok(FontInfo {
|
||||
|
@ -300,11 +303,11 @@ impl FontHandleMethods for FontHandle {
|
|||
}
|
||||
}
|
||||
|
||||
fn boldness(&self) -> font_weight::T {
|
||||
fn boldness(&self) -> StyleFontWeight {
|
||||
self.info.weight
|
||||
}
|
||||
|
||||
fn stretchiness(&self) -> font_stretch::T {
|
||||
fn stretchiness(&self) -> StyleFontStretch {
|
||||
self.info.stretch
|
||||
}
|
||||
|
||||
|
|
|
@ -48,8 +48,12 @@ use servo_geometry::max_rect;
|
|||
use std::cmp::{max, min};
|
||||
use std::fmt;
|
||||
use std::sync::Arc;
|
||||
use style::computed_values::{box_sizing, display, float, overflow_x};
|
||||
use style::computed_values::{position, text_align};
|
||||
use style::computed_values::box_sizing::T as BoxSizing;
|
||||
use style::computed_values::display::T as Display;
|
||||
use style::computed_values::float::T as Float;
|
||||
use style::computed_values::overflow_x::T as StyleOverflow;
|
||||
use style::computed_values::position::T as Position;
|
||||
use style::computed_values::text_align::T as TextAlign;
|
||||
use style::context::SharedStyleContext;
|
||||
use style::logical_geometry::{LogicalMargin, LogicalPoint, LogicalRect, LogicalSize, WritingMode};
|
||||
use style::properties::ComputedValues;
|
||||
|
@ -352,8 +356,8 @@ impl CandidateBSizeIterator {
|
|||
|
||||
// If the style includes `box-sizing: border-box`, subtract the border and padding.
|
||||
let adjustment_for_box_sizing = match fragment.style.get_position().box_sizing {
|
||||
box_sizing::T::border_box => fragment.border_padding.block_start_end(),
|
||||
box_sizing::T::content_box => Au(0),
|
||||
BoxSizing::BorderBox => fragment.border_padding.block_start_end(),
|
||||
BoxSizing::ContentBox => Au(0),
|
||||
};
|
||||
|
||||
return CandidateBSizeIterator {
|
||||
|
@ -1344,8 +1348,8 @@ impl BlockFlow {
|
|||
|
||||
// Calculate non-auto block size to pass to children.
|
||||
let box_border = match self.fragment.style().get_position().box_sizing {
|
||||
box_sizing::T::border_box => self.fragment.border_padding.block_start_end(),
|
||||
box_sizing::T::content_box => Au(0),
|
||||
BoxSizing::BorderBox => self.fragment.border_padding.block_start_end(),
|
||||
BoxSizing::ContentBox => Au(0),
|
||||
};
|
||||
let parent_container_size = self.explicit_block_containing_size(shared_context);
|
||||
// https://drafts.csswg.org/css-ui-3/#box-sizing
|
||||
|
@ -1434,20 +1438,20 @@ impl BlockFlow {
|
|||
return FormattingContextType::Other
|
||||
}
|
||||
let style = self.fragment.style();
|
||||
if style.get_box().float != float::T::none {
|
||||
if style.get_box().float != Float::None {
|
||||
return FormattingContextType::Other
|
||||
}
|
||||
match style.get_box().display {
|
||||
display::T::table_cell |
|
||||
display::T::table_caption |
|
||||
display::T::table_row_group |
|
||||
display::T::table |
|
||||
display::T::inline_block |
|
||||
display::T::flex => {
|
||||
Display::TableCell |
|
||||
Display::TableCaption |
|
||||
Display::TableRowGroup |
|
||||
Display::Table |
|
||||
Display::InlineBlock |
|
||||
Display::Flex => {
|
||||
FormattingContextType::Other
|
||||
}
|
||||
_ if style.get_box().overflow_x != overflow_x::T::visible ||
|
||||
style.get_box().overflow_y != overflow_x::T::visible ||
|
||||
_ if style.get_box().overflow_x != StyleOverflow::Visible ||
|
||||
style.get_box().overflow_y != StyleOverflow::Visible ||
|
||||
style.is_multicol() => {
|
||||
FormattingContextType::Block
|
||||
}
|
||||
|
@ -1531,8 +1535,8 @@ impl BlockFlow {
|
|||
if let MaybeAuto::Specified(size) = MaybeAuto::from_style(specified_inline_size,
|
||||
container_size) {
|
||||
match self.fragment.style().get_position().box_sizing {
|
||||
box_sizing::T::border_box => size,
|
||||
box_sizing::T::content_box =>
|
||||
BoxSizing::BorderBox => size,
|
||||
BoxSizing::ContentBox =>
|
||||
size + self.fragment.border_padding.inline_start_end(),
|
||||
}
|
||||
} else {
|
||||
|
@ -1561,8 +1565,8 @@ impl BlockFlow {
|
|||
}
|
||||
|
||||
fn is_inline_block_or_inline_flex(&self) -> bool {
|
||||
self.fragment.style().get_box().display == display::T::inline_block ||
|
||||
self.fragment.style().get_box().display == display::T::inline_flex
|
||||
self.fragment.style().get_box().display == Display::InlineBlock ||
|
||||
self.fragment.style().get_box().display == Display::InlineFlex
|
||||
}
|
||||
|
||||
/// Computes the content portion (only) of the intrinsic inline sizes of this flow. This is
|
||||
|
@ -1631,21 +1635,21 @@ impl BlockFlow {
|
|||
}
|
||||
|
||||
match (float_kind, child_base.flags.contains(FlowFlags::CONTAINS_TEXT_OR_REPLACED_FRAGMENTS)) {
|
||||
(float::T::none, true) => {
|
||||
(Float::None, true) => {
|
||||
computation.content_intrinsic_sizes.preferred_inline_size =
|
||||
max(computation.content_intrinsic_sizes.preferred_inline_size,
|
||||
child_base.intrinsic_inline_sizes.preferred_inline_size);
|
||||
}
|
||||
(float::T::none, false) => {
|
||||
(Float::None, false) => {
|
||||
preferred_inline_size_of_children_without_text_or_replaced_fragments = max(
|
||||
preferred_inline_size_of_children_without_text_or_replaced_fragments,
|
||||
child_base.intrinsic_inline_sizes.preferred_inline_size)
|
||||
}
|
||||
(float::T::left, _) => {
|
||||
(Float::Left, _) => {
|
||||
left_float_width_accumulator = left_float_width_accumulator +
|
||||
child_base.intrinsic_inline_sizes.preferred_inline_size;
|
||||
}
|
||||
(float::T::right, _) => {
|
||||
(Float::Right, _) => {
|
||||
right_float_width_accumulator = right_float_width_accumulator +
|
||||
child_base.intrinsic_inline_sizes.preferred_inline_size;
|
||||
}
|
||||
|
@ -1669,8 +1673,8 @@ impl BlockFlow {
|
|||
pub fn overflow_style_may_require_clip_scroll_node(&self) -> bool {
|
||||
match (self.fragment.style().get_box().overflow_x,
|
||||
self.fragment.style().get_box().overflow_y) {
|
||||
(overflow_x::T::auto, _) | (overflow_x::T::scroll, _) | (overflow_x::T::hidden, _) |
|
||||
(_, overflow_x::T::auto) | (_, overflow_x::T::scroll) | (_, overflow_x::T::hidden) =>
|
||||
(StyleOverflow::Auto, _) | (StyleOverflow::Scroll, _) | (StyleOverflow::Hidden, _) |
|
||||
(_, StyleOverflow::Auto) | (_, StyleOverflow::Scroll) | (_, StyleOverflow::Hidden) =>
|
||||
true,
|
||||
(_, _) => false,
|
||||
}
|
||||
|
@ -2098,7 +2102,7 @@ impl Flow for BlockFlow {
|
|||
}
|
||||
|
||||
/// The 'position' property of this flow.
|
||||
fn positioning(&self) -> position::T {
|
||||
fn positioning(&self) -> Position {
|
||||
self.fragment.style.get_box().position
|
||||
}
|
||||
|
||||
|
@ -2209,7 +2213,7 @@ pub struct ISizeConstraintInput {
|
|||
pub inline_end_margin: MaybeAuto,
|
||||
pub inline_start: MaybeAuto,
|
||||
pub inline_end: MaybeAuto,
|
||||
pub text_align: text_align::T,
|
||||
pub text_align: TextAlign,
|
||||
pub available_inline_size: Au,
|
||||
}
|
||||
|
||||
|
@ -2219,7 +2223,7 @@ impl ISizeConstraintInput {
|
|||
inline_end_margin: MaybeAuto,
|
||||
inline_start: MaybeAuto,
|
||||
inline_end: MaybeAuto,
|
||||
text_align: text_align::T,
|
||||
text_align: TextAlign,
|
||||
available_inline_size: Au)
|
||||
-> ISizeConstraintInput {
|
||||
ISizeConstraintInput {
|
||||
|
@ -2298,12 +2302,12 @@ pub trait ISizeAndMarginsComputer {
|
|||
shared_context);
|
||||
let style = block.fragment.style();
|
||||
match (computed_inline_size, style.get_position().box_sizing) {
|
||||
(MaybeAuto::Specified(size), box_sizing::T::border_box) => {
|
||||
(MaybeAuto::Specified(size), BoxSizing::BorderBox) => {
|
||||
computed_inline_size =
|
||||
MaybeAuto::Specified(size - block.fragment.border_padding.inline_start_end())
|
||||
}
|
||||
(MaybeAuto::Auto, box_sizing::T::border_box) |
|
||||
(_, box_sizing::T::content_box) => {}
|
||||
(MaybeAuto::Auto, BoxSizing::BorderBox) |
|
||||
(_, BoxSizing::ContentBox) => {}
|
||||
}
|
||||
|
||||
let margin = style.logical_margin();
|
||||
|
@ -2499,15 +2503,15 @@ pub trait ISizeAndMarginsComputer {
|
|||
MaybeAuto::Specified(margin_end)) => {
|
||||
// servo_left, servo_right, and servo_center are used to implement
|
||||
// the "align descendants" rule in HTML5 § 14.2.
|
||||
if block_align == text_align::T::servo_center {
|
||||
if block_align == TextAlign::ServoCenter {
|
||||
// Ignore any existing margins, and make the inline-start and
|
||||
// inline-end margins equal.
|
||||
let margin = (available_inline_size - inline_size).scale_by(0.5);
|
||||
(margin, inline_size, margin)
|
||||
} else {
|
||||
let ignore_end_margin = match block_align {
|
||||
text_align::T::servo_left => block_mode.is_bidi_ltr(),
|
||||
text_align::T::servo_right => !block_mode.is_bidi_ltr(),
|
||||
TextAlign::ServoLeft => block_mode.is_bidi_ltr(),
|
||||
TextAlign::ServoRight => !block_mode.is_bidi_ltr(),
|
||||
_ => parent_has_same_direction,
|
||||
};
|
||||
if ignore_end_margin {
|
||||
|
|
|
@ -43,9 +43,13 @@ use std::marker::PhantomData;
|
|||
use std::mem;
|
||||
use std::sync::Arc;
|
||||
use std::sync::atomic::Ordering;
|
||||
use style::computed_values::{caption_side, display, empty_cells, float, list_style_position};
|
||||
use style::computed_values::caption_side::T as CaptionSide;
|
||||
use style::computed_values::content::ContentItem;
|
||||
use style::computed_values::position;
|
||||
use style::computed_values::display::T as Display;
|
||||
use style::computed_values::empty_cells::T as EmptyCells;
|
||||
use style::computed_values::float::T as Float;
|
||||
use style::computed_values::list_style_position::T as ListStylePosition;
|
||||
use style::computed_values::position::T as Position;
|
||||
use style::context::SharedStyleContext;
|
||||
use style::logical_geometry::Direction;
|
||||
use style::properties::ComputedValues;
|
||||
|
@ -862,7 +866,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
|||
|
||||
// If the node is positioned, then it's the containing block for all absolutely-
|
||||
// positioned descendants.
|
||||
if node_style.get_box().position != position::T::static_ {
|
||||
if node_style.get_box().position != Position::Static {
|
||||
fragment_accumulator.fragments
|
||||
.absolute_descendants
|
||||
.mark_as_having_reached_containing_block();
|
||||
|
@ -925,11 +929,14 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
|||
}
|
||||
|
||||
/// Build the fragment for an inline-block or inline-flex, based on the `display` flag
|
||||
fn build_fragment_for_inline_block_or_inline_flex(&mut self, node: &ConcreteThreadSafeLayoutNode,
|
||||
display: display::T) -> ConstructionResult {
|
||||
fn build_fragment_for_inline_block_or_inline_flex(
|
||||
&mut self,
|
||||
node: &ConcreteThreadSafeLayoutNode,
|
||||
display: Display,
|
||||
) -> ConstructionResult {
|
||||
let block_flow_result = match display {
|
||||
display::T::inline_block => self.build_flow_for_block(node, None),
|
||||
display::T::inline_flex => self.build_flow_for_flex(node, None),
|
||||
Display::InlineBlock => self.build_flow_for_block(node, None),
|
||||
Display::InlineFlex => self.build_flow_for_flex(node, None),
|
||||
_ => panic!("The flag should be inline-block or inline-flex")
|
||||
};
|
||||
let (block_flow, abs_descendants) = match block_flow_result {
|
||||
|
@ -1017,7 +1024,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
|||
fn place_table_caption_under_table_wrapper_on_side(&mut self,
|
||||
table_wrapper_flow: &mut FlowRef,
|
||||
node: &ConcreteThreadSafeLayoutNode,
|
||||
side: caption_side::T) {
|
||||
side: CaptionSide) {
|
||||
// Only flows that are table captions are matched here.
|
||||
for kid in node.children() {
|
||||
match kid.get_construction_result() {
|
||||
|
@ -1078,7 +1085,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
|||
|
||||
/// Builds a flow for a node with `display: table`. This yields a `TableWrapperFlow` with
|
||||
/// possibly other `TableCaptionFlow`s or `TableFlow`s underneath it.
|
||||
fn build_flow_for_table(&mut self, node: &ConcreteThreadSafeLayoutNode, float_value: float::T)
|
||||
fn build_flow_for_table(&mut self, node: &ConcreteThreadSafeLayoutNode, float_value: Float)
|
||||
-> ConstructionResult {
|
||||
let mut legalizer = Legalizer::new();
|
||||
|
||||
|
@ -1115,7 +1122,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
|||
// value of `caption-side`.
|
||||
self.place_table_caption_under_table_wrapper_on_side(&mut wrapper_flow,
|
||||
node,
|
||||
caption_side::T::top);
|
||||
CaptionSide::Top);
|
||||
|
||||
if let ConstructionResult::Flow(table_flow, table_abs_descendants) = construction_result {
|
||||
legalizer.add_child(self.style_context(), &mut wrapper_flow, table_flow);
|
||||
|
@ -1125,7 +1132,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
|||
// If the value of `caption-side` is `bottom`, place it now.
|
||||
self.place_table_caption_under_table_wrapper_on_side(&mut wrapper_flow,
|
||||
node,
|
||||
caption_side::T::bottom);
|
||||
CaptionSide::Bottom);
|
||||
|
||||
// The flow is done.
|
||||
legalizer.finish(&mut wrapper_flow);
|
||||
|
@ -1180,12 +1187,12 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
|||
// Determine if the table cell should be hidden. Per CSS 2.1 § 17.6.1.1, this will be true
|
||||
// if the cell has any in-flow elements (even empty ones!) and has `empty-cells` set to
|
||||
// `hide`.
|
||||
let hide = node.style(self.style_context()).get_inheritedtable().empty_cells == empty_cells::T::hide &&
|
||||
let hide = node.style(self.style_context()).get_inheritedtable().empty_cells == EmptyCells::Hide &&
|
||||
node.children().all(|kid| {
|
||||
let position = kid.style(self.style_context()).get_box().position;
|
||||
!kid.is_content() ||
|
||||
position == position::T::absolute ||
|
||||
position == position::T::fixed
|
||||
position == Position::Absolute ||
|
||||
position == Position::Fixed
|
||||
});
|
||||
|
||||
let flow = FlowRef::new(Arc::new(
|
||||
|
@ -1197,7 +1204,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
|||
/// possibly other `BlockFlow`s or `InlineFlow`s underneath it.
|
||||
fn build_flow_for_list_item(&mut self,
|
||||
node: &ConcreteThreadSafeLayoutNode,
|
||||
flotation: float::T)
|
||||
flotation: Float)
|
||||
-> ConstructionResult {
|
||||
let flotation = FloatKind::from_property(flotation);
|
||||
let marker_fragments = match node.style(self.style_context()).get_list().list_style_image {
|
||||
|
@ -1243,11 +1250,11 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
|||
let mut initial_fragments = IntermediateInlineFragments::new();
|
||||
let main_fragment = self.build_fragment_for_block(node);
|
||||
let flow = match node.style(self.style_context()).get_list().list_style_position {
|
||||
list_style_position::T::outside => {
|
||||
ListStylePosition::Outside => {
|
||||
Arc::new(ListItemFlow::from_fragments_and_flotation(
|
||||
main_fragment, marker_fragments, flotation))
|
||||
}
|
||||
list_style_position::T::inside => {
|
||||
ListStylePosition::Inside => {
|
||||
for marker_fragment in marker_fragments {
|
||||
initial_fragments.fragments.push_back(marker_fragment)
|
||||
}
|
||||
|
@ -1327,7 +1334,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
|||
|
||||
// If the node has display: none, it's possible that we haven't even
|
||||
// styled the children once, so we need to bailout early here.
|
||||
if node.style(self.style_context()).get_box().clone_display() == display::T::none {
|
||||
if node.style(self.style_context()).get_box().clone_display() == Display::None {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1466,8 +1473,7 @@ impl<'a, ConcreteThreadSafeLayoutNode> PostorderNodeMutTraversal<ConcreteThreadS
|
|||
// Pseudo-element.
|
||||
let style = node.style(self.style_context());
|
||||
let display = match node.get_pseudo_element_type() {
|
||||
PseudoElementType::Normal
|
||||
=> display::T::inline,
|
||||
PseudoElementType::Normal => Display::Inline,
|
||||
PseudoElementType::Before(maybe_display) |
|
||||
PseudoElementType::After(maybe_display) |
|
||||
PseudoElementType::DetailsContent(maybe_display) |
|
||||
|
@ -1480,13 +1486,13 @@ impl<'a, ConcreteThreadSafeLayoutNode> PostorderNodeMutTraversal<ConcreteThreadS
|
|||
let style = node.style(self.style_context());
|
||||
let original_display = style.get_box()._servo_display_for_hypothetical_box;
|
||||
let munged_display = match original_display {
|
||||
display::T::inline | display::T::inline_block => original_display,
|
||||
Display::Inline | Display::InlineBlock => original_display,
|
||||
_ => style.get_box().display,
|
||||
};
|
||||
(munged_display, style.get_box().float, style.get_box().position)
|
||||
}
|
||||
Some(LayoutNodeType::Text) =>
|
||||
(display::T::inline, float::T::none, position::T::static_),
|
||||
(Display::Inline, Float::None, Position::Static),
|
||||
};
|
||||
|
||||
debug!("building flow for node: {:?} {:?} {:?} {:?}", display, float, positioning, node.type_id());
|
||||
|
@ -1494,12 +1500,12 @@ impl<'a, ConcreteThreadSafeLayoutNode> PostorderNodeMutTraversal<ConcreteThreadS
|
|||
// Switch on display and floatedness.
|
||||
match (display, float, positioning) {
|
||||
// `display: none` contributes no flow construction result.
|
||||
(display::T::none, _, _) => {
|
||||
(Display::None, _, _) => {
|
||||
self.set_flow_construction_result(node, ConstructionResult::None);
|
||||
}
|
||||
|
||||
// Table items contribute table flow construction results.
|
||||
(display::T::table, float_value, _) => {
|
||||
(Display::Table, float_value, _) => {
|
||||
let construction_result = self.build_flow_for_table(node, float_value);
|
||||
self.set_flow_construction_result(node, construction_result)
|
||||
}
|
||||
|
@ -1510,22 +1516,22 @@ impl<'a, ConcreteThreadSafeLayoutNode> PostorderNodeMutTraversal<ConcreteThreadS
|
|||
// positioned, but inline we shouldn't try to construct a block
|
||||
// flow here - instead, let it match the inline case
|
||||
// below.
|
||||
(display::T::block, _, position::T::absolute) |
|
||||
(display::T::block, _, position::T::fixed) => {
|
||||
(Display::Block, _, Position::Absolute) |
|
||||
(Display::Block, _, Position::Fixed) => {
|
||||
let construction_result = self.build_flow_for_block(node, None);
|
||||
self.set_flow_construction_result(node, construction_result)
|
||||
}
|
||||
|
||||
// List items contribute their own special flows.
|
||||
(display::T::list_item, float_value, _) => {
|
||||
(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::T::inline, _, position::T::absolute) |
|
||||
(display::T::inline_block, _, position::T::absolute) => {
|
||||
(Display::Inline, _, Position::Absolute) |
|
||||
(Display::InlineBlock, _, Position::Absolute) => {
|
||||
let construction_result =
|
||||
self.build_fragment_for_absolutely_positioned_inline(node);
|
||||
self.set_flow_construction_result(node, construction_result)
|
||||
|
@ -1534,66 +1540,66 @@ impl<'a, ConcreteThreadSafeLayoutNode> PostorderNodeMutTraversal<ConcreteThreadS
|
|||
// Inline items contribute inline fragment construction results.
|
||||
//
|
||||
// FIXME(pcwalton, #3307): This is not sufficient to handle floated generated content.
|
||||
(display::T::inline, float::T::none, _) => {
|
||||
(Display::Inline, Float::None, _) => {
|
||||
let construction_result = self.build_fragments_for_inline(node);
|
||||
self.set_flow_construction_result(node, construction_result)
|
||||
}
|
||||
|
||||
// Inline-block items contribute inline fragment construction results.
|
||||
(display::T::inline_block, float::T::none, _) => {
|
||||
(Display::InlineBlock, Float::None, _) => {
|
||||
let construction_result = self.build_fragment_for_inline_block_or_inline_flex(node,
|
||||
display::T::inline_block);
|
||||
Display::InlineBlock);
|
||||
self.set_flow_construction_result(node, construction_result)
|
||||
}
|
||||
|
||||
// Table items contribute table flow construction results.
|
||||
(display::T::table_caption, _, _) => {
|
||||
(Display::TableCaption, _, _) => {
|
||||
let construction_result = self.build_flow_for_table_caption(node);
|
||||
self.set_flow_construction_result(node, construction_result)
|
||||
}
|
||||
|
||||
// Table items contribute table flow construction results.
|
||||
(display::T::table_column_group, _, _) => {
|
||||
(Display::TableColumnGroup, _, _) => {
|
||||
let construction_result = self.build_flow_for_table_colgroup(node);
|
||||
self.set_flow_construction_result(node, construction_result)
|
||||
}
|
||||
|
||||
// Table items contribute table flow construction results.
|
||||
(display::T::table_column, _, _) => {
|
||||
(Display::TableColumn, _, _) => {
|
||||
let construction_result = self.build_fragments_for_table_column(node);
|
||||
self.set_flow_construction_result(node, construction_result)
|
||||
}
|
||||
|
||||
// Table items contribute table flow construction results.
|
||||
(display::T::table_row_group, _, _) |
|
||||
(display::T::table_header_group, _, _) |
|
||||
(display::T::table_footer_group, _, _) => {
|
||||
(Display::TableRowGroup, _, _) |
|
||||
(Display::TableHeaderGroup, _, _) |
|
||||
(Display::TableFooterGroup, _, _) => {
|
||||
let construction_result = self.build_flow_for_table_rowgroup(node);
|
||||
self.set_flow_construction_result(node, construction_result)
|
||||
}
|
||||
|
||||
// Table items contribute table flow construction results.
|
||||
(display::T::table_row, _, _) => {
|
||||
(Display::TableRow, _, _) => {
|
||||
let construction_result = self.build_flow_for_table_row(node);
|
||||
self.set_flow_construction_result(node, construction_result)
|
||||
}
|
||||
|
||||
// Table items contribute table flow construction results.
|
||||
(display::T::table_cell, _, _) => {
|
||||
(Display::TableCell, _, _) => {
|
||||
let construction_result = self.build_flow_for_table_cell(node);
|
||||
self.set_flow_construction_result(node, construction_result)
|
||||
}
|
||||
|
||||
// Flex items contribute flex flow construction results.
|
||||
(display::T::flex, float_value, _) => {
|
||||
(Display::Flex, float_value, _) => {
|
||||
let float_kind = FloatKind::from_property(float_value);
|
||||
let construction_result = self.build_flow_for_flex(node, float_kind);
|
||||
self.set_flow_construction_result(node, construction_result)
|
||||
}
|
||||
|
||||
(display::T::inline_flex, _, _) => {
|
||||
(Display::InlineFlex, _, _) => {
|
||||
let construction_result = self.build_fragment_for_inline_block_or_inline_flex(node,
|
||||
display::T::inline_flex);
|
||||
Display::InlineFlex);
|
||||
self.set_flow_construction_result(node, construction_result)
|
||||
}
|
||||
|
||||
|
@ -1810,16 +1816,16 @@ fn bidi_control_chars(style: &ServoArc<ComputedValues>) -> Option<(&'static str,
|
|||
|
||||
// See the table in http://dev.w3.org/csswg/css-writing-modes/#unicode-bidi
|
||||
match (unicode_bidi, direction) {
|
||||
(normal, _) => None,
|
||||
(embed, ltr) => Some(("\u{202A}", "\u{202C}")),
|
||||
(embed, rtl) => Some(("\u{202B}", "\u{202C}")),
|
||||
(isolate, ltr) => Some(("\u{2066}", "\u{2069}")),
|
||||
(isolate, rtl) => Some(("\u{2067}", "\u{2069}")),
|
||||
(bidi_override, ltr) => Some(("\u{202D}", "\u{202C}")),
|
||||
(bidi_override, rtl) => Some(("\u{202E}", "\u{202C}")),
|
||||
(isolate_override, ltr) => Some(("\u{2068}\u{202D}", "\u{202C}\u{2069}")),
|
||||
(isolate_override, rtl) => Some(("\u{2068}\u{202E}", "\u{202C}\u{2069}")),
|
||||
(plaintext, _) => Some(("\u{2068}", "\u{2069}")),
|
||||
(Normal, _) => None,
|
||||
(Embed, Ltr) => Some(("\u{202A}", "\u{202C}")),
|
||||
(Embed, Rtl) => Some(("\u{202B}", "\u{202C}")),
|
||||
(Isolate, Ltr) => Some(("\u{2066}", "\u{2069}")),
|
||||
(Isolate, Rtl) => Some(("\u{2067}", "\u{2069}")),
|
||||
(BidiOverride, Ltr) => Some(("\u{202D}", "\u{202C}")),
|
||||
(BidiOverride, Rtl) => Some(("\u{202E}", "\u{202C}")),
|
||||
(IsolateOverride, Ltr) => Some(("\u{2068}\u{202D}", "\u{202C}\u{2069}")),
|
||||
(IsolateOverride, Rtl) => Some(("\u{2068}\u{202E}", "\u{202C}\u{2069}")),
|
||||
(Plaintext, _) => Some(("\u{2068}", "\u{2069}")),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -49,8 +49,13 @@ use std::default::Default;
|
|||
use std::mem;
|
||||
use std::sync::Arc;
|
||||
use style::computed_values::{background_attachment, background_clip, background_origin};
|
||||
use style::computed_values::{border_style, cursor};
|
||||
use style::computed_values::{image_rendering, overflow_x, pointer_events, position, visibility};
|
||||
use style::computed_values::border_style::T as BorderStyle;
|
||||
use style::computed_values::cursor;
|
||||
use style::computed_values::image_rendering::T as ImageRendering;
|
||||
use style::computed_values::overflow_x::T as StyleOverflow;
|
||||
use style::computed_values::pointer_events::T as PointerEvents;
|
||||
use style::computed_values::position::T as StylePosition;
|
||||
use style::computed_values::visibility::T as Visibility;
|
||||
use style::logical_geometry::{LogicalMargin, LogicalPoint, LogicalRect, LogicalSize, WritingMode};
|
||||
use style::properties::ComputedValues;
|
||||
use style::properties::longhands::border_image_repeat::computed_value::RepeatKeyword;
|
||||
|
@ -104,10 +109,10 @@ fn convert_repeat_mode(from: RepeatKeyword) -> RepeatMode {
|
|||
}
|
||||
|
||||
fn establishes_containing_block_for_absolute(flags: StackingContextCollectionFlags,
|
||||
positioning: position::T)
|
||||
positioning: StylePosition)
|
||||
-> bool {
|
||||
!flags.contains(StackingContextCollectionFlags::NEVER_CREATES_CONTAINING_BLOCK) &&
|
||||
position::T::static_ != positioning
|
||||
StylePosition::Static != positioning
|
||||
}
|
||||
|
||||
trait RgbColor {
|
||||
|
@ -967,15 +972,15 @@ impl FragmentDisplayListBuilding for Fragment {
|
|||
background.background_image.0.len() - 1);
|
||||
|
||||
match *color_clip {
|
||||
background_clip::single_value::T::border_box => {}
|
||||
background_clip::single_value::T::padding_box => {
|
||||
background_clip::single_value::T::BorderBox => {}
|
||||
background_clip::single_value::T::PaddingBox => {
|
||||
let border = style.logical_border_width().to_physical(style.writing_mode);
|
||||
bounds.origin.x = bounds.origin.x + border.left;
|
||||
bounds.origin.y = bounds.origin.y + border.top;
|
||||
bounds.size.width = bounds.size.width - border.horizontal();
|
||||
bounds.size.height = bounds.size.height - border.vertical();
|
||||
}
|
||||
background_clip::single_value::T::content_box => {
|
||||
background_clip::single_value::T::ContentBox => {
|
||||
let border_padding = self.border_padding.to_physical(style.writing_mode);
|
||||
bounds.origin.x = bounds.origin.x + border_padding.left;
|
||||
bounds.origin.y = bounds.origin.y + border_padding.top;
|
||||
|
@ -1144,13 +1149,13 @@ impl FragmentDisplayListBuilding for Fragment {
|
|||
// Use 'background-origin' to get the origin value.
|
||||
let origin = get_cyclic(&background.background_origin.0, index);
|
||||
let (mut origin_x, mut origin_y) = match *origin {
|
||||
background_origin::single_value::T::padding_box => {
|
||||
background_origin::single_value::T::PaddingBox => {
|
||||
(Au(0), Au(0))
|
||||
}
|
||||
background_origin::single_value::T::border_box => {
|
||||
background_origin::single_value::T::BorderBox => {
|
||||
(-border.left, -border.top)
|
||||
}
|
||||
background_origin::single_value::T::content_box => {
|
||||
background_origin::single_value::T::ContentBox => {
|
||||
let border_padding = self.border_padding.to_physical(self.style.writing_mode);
|
||||
(border_padding.left - border.left, border_padding.top - border.top)
|
||||
}
|
||||
|
@ -1159,10 +1164,10 @@ impl FragmentDisplayListBuilding for Fragment {
|
|||
// Use `background-attachment` to get the initial virtual origin
|
||||
let attachment = get_cyclic(&background.background_attachment.0, index);
|
||||
let (virtual_origin_x, virtual_origin_y) = match *attachment {
|
||||
background_attachment::single_value::T::scroll => {
|
||||
background_attachment::single_value::T::Scroll => {
|
||||
(absolute_bounds.origin.x, absolute_bounds.origin.y)
|
||||
}
|
||||
background_attachment::single_value::T::fixed => {
|
||||
background_attachment::single_value::T::Fixed => {
|
||||
// If the ‘background-attachment’ value for this image is ‘fixed’, then
|
||||
// 'background-origin' has no effect.
|
||||
origin_x = Au(0);
|
||||
|
@ -1703,8 +1708,8 @@ impl FragmentDisplayListBuilding for Fragment {
|
|||
}
|
||||
|
||||
let outline_style = match style.get_outline().outline_style {
|
||||
Either::First(_auto) => border_style::T::solid,
|
||||
Either::Second(border_style::T::none) => return,
|
||||
Either::First(_auto) => BorderStyle::Solid,
|
||||
Either::Second(BorderStyle::None) => return,
|
||||
Either::Second(border_style) => border_style
|
||||
};
|
||||
|
||||
|
@ -1756,7 +1761,7 @@ impl FragmentDisplayListBuilding for Fragment {
|
|||
border_widths: SideOffsets2D::new_all_same(Au::from_px(1)),
|
||||
details: BorderDetails::Normal(NormalBorder {
|
||||
color: SideOffsets2D::new_all_same(ColorF::rgb(0, 0, 200)),
|
||||
style: SideOffsets2D::new_all_same(border_style::T::solid),
|
||||
style: SideOffsets2D::new_all_same(BorderStyle::Solid),
|
||||
radius: Default::default(),
|
||||
}),
|
||||
})));
|
||||
|
@ -1796,7 +1801,7 @@ impl FragmentDisplayListBuilding for Fragment {
|
|||
border_widths: SideOffsets2D::new_all_same(Au::from_px(1)),
|
||||
details: BorderDetails::Normal(NormalBorder {
|
||||
color: SideOffsets2D::new_all_same(ColorF::rgb(0, 0, 200)),
|
||||
style: SideOffsets2D::new_all_same(border_style::T::solid),
|
||||
style: SideOffsets2D::new_all_same(BorderStyle::Solid),
|
||||
radius: Default::default(),
|
||||
}),
|
||||
})));
|
||||
|
@ -1880,7 +1885,7 @@ impl FragmentDisplayListBuilding for Fragment {
|
|||
display_list_section: DisplayListSection,
|
||||
clip: &Rect<Au>) {
|
||||
self.restyle_damage.remove(ServoRestyleDamage::REPAINT);
|
||||
if self.style().get_inheritedbox().visibility != visibility::T::visible {
|
||||
if self.style().get_inheritedbox().visibility != Visibility::Visible {
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -2174,7 +2179,7 @@ impl FragmentDisplayListBuilding for Fragment {
|
|||
image_data: None,
|
||||
stretch_size: stacking_relative_content_box.size,
|
||||
tile_spacing: Size2D::zero(),
|
||||
image_rendering: image_rendering::T::auto,
|
||||
image_rendering: ImageRendering::Auto,
|
||||
}));
|
||||
|
||||
state.add_display_item(display_item);
|
||||
|
@ -2518,9 +2523,9 @@ impl SavedStackingContextCollectionState {
|
|||
fn push_clip(&mut self,
|
||||
state: &mut StackingContextCollectionState,
|
||||
clip: &Rect<Au>,
|
||||
positioning: position::T) {
|
||||
positioning: StylePosition) {
|
||||
let mut clip = *clip;
|
||||
if positioning != position::T::fixed {
|
||||
if positioning != StylePosition::Fixed {
|
||||
if let Some(old_clip) = state.clip_stack.last() {
|
||||
clip = old_clip.intersection(&clip).unwrap_or_else(Rect::zero);
|
||||
}
|
||||
|
@ -2529,7 +2534,7 @@ impl SavedStackingContextCollectionState {
|
|||
state.clip_stack.push(clip);
|
||||
self.clips_pushed += 1;
|
||||
|
||||
if position::T::absolute == positioning {
|
||||
if StylePosition::Absolute == positioning {
|
||||
state.containing_block_clip_stack.push(clip);
|
||||
self.containing_block_clips_pushed += 1;
|
||||
}
|
||||
|
@ -2659,13 +2664,13 @@ impl BlockFlowDisplayListBuilding for BlockFlow {
|
|||
// If this block is absolutely positioned, we should be clipped and positioned by
|
||||
// the scroll root of our nearest ancestor that establishes a containing block.
|
||||
let containing_clipping_and_scrolling = match self.positioning() {
|
||||
position::T::absolute => {
|
||||
StylePosition::Absolute => {
|
||||
preserved_state.switch_to_containing_block_clip(state);
|
||||
state.current_clipping_and_scrolling = state.containing_block_clipping_and_scrolling;
|
||||
state.containing_block_clipping_and_scrolling
|
||||
}
|
||||
position::T::fixed => {
|
||||
preserved_state.push_clip(state, &max_rect(), position::T::fixed);
|
||||
StylePosition::Fixed => {
|
||||
preserved_state.push_clip(state, &max_rect(), StylePosition::Fixed);
|
||||
state.current_clipping_and_scrolling
|
||||
}
|
||||
_ => state.current_clipping_and_scrolling,
|
||||
|
@ -2703,7 +2708,7 @@ impl BlockFlowDisplayListBuilding for BlockFlow {
|
|||
}
|
||||
|
||||
match self.positioning() {
|
||||
position::T::absolute | position::T::relative | position::T::fixed =>
|
||||
StylePosition::Absolute | StylePosition::Relative | StylePosition::Fixed =>
|
||||
state.containing_block_clipping_and_scrolling = state.current_clipping_and_scrolling,
|
||||
_ => {}
|
||||
}
|
||||
|
@ -2714,7 +2719,7 @@ impl BlockFlowDisplayListBuilding for BlockFlow {
|
|||
fn setup_clip_scroll_node_for_position(&mut self,
|
||||
state: &mut StackingContextCollectionState,
|
||||
border_box: &Rect<Au>) {
|
||||
if self.positioning() != position::T::sticky {
|
||||
if self.positioning() != StylePosition::Sticky {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2791,8 +2796,8 @@ impl BlockFlowDisplayListBuilding for BlockFlow {
|
|||
self.base.overflow.scroll.origin != Point2D::zero() ||
|
||||
self.base.overflow.scroll.size.width > content_box.size.width ||
|
||||
self.base.overflow.scroll.size.height > content_box.size.height ||
|
||||
overflow_x::T::hidden == self.fragment.style.get_box().overflow_x ||
|
||||
overflow_x::T::hidden == self.fragment.style.get_box().overflow_y;
|
||||
StyleOverflow::Hidden == self.fragment.style.get_box().overflow_x ||
|
||||
StyleOverflow::Hidden == self.fragment.style.get_box().overflow_y;
|
||||
|
||||
self.mark_scrolling_overflow(has_scrolling_overflow);
|
||||
if !has_scrolling_overflow {
|
||||
|
@ -2805,8 +2810,8 @@ impl BlockFlowDisplayListBuilding for BlockFlow {
|
|||
let new_clip_scroll_node_id = ClipId::new(self.fragment.unique_id(IdType::OverflowClip),
|
||||
state.pipeline_id.to_webrender());
|
||||
|
||||
let sensitivity = if overflow_x::T::hidden == self.fragment.style.get_box().overflow_x &&
|
||||
overflow_x::T::hidden == self.fragment.style.get_box().overflow_y {
|
||||
let sensitivity = if StyleOverflow::Hidden == self.fragment.style.get_box().overflow_x &&
|
||||
StyleOverflow::Hidden == self.fragment.style.get_box().overflow_y {
|
||||
ScrollSensitivity::Script
|
||||
} else {
|
||||
ScrollSensitivity::ScriptAndInputEvents
|
||||
|
@ -2852,7 +2857,7 @@ impl BlockFlowDisplayListBuilding for BlockFlow {
|
|||
// CSS `clip` should only apply to position:absolute or positione:fixed elements.
|
||||
// CSS Masking Appendix A: "Applies to: Absolutely positioned elements."
|
||||
match self.positioning() {
|
||||
position::T::absolute | position::T::fixed => {}
|
||||
StylePosition::Absolute | StylePosition::Fixed => {}
|
||||
_ => return,
|
||||
}
|
||||
|
||||
|
@ -2891,7 +2896,7 @@ impl BlockFlowDisplayListBuilding for BlockFlow {
|
|||
state: &mut StackingContextCollectionState
|
||||
) {
|
||||
let creation_mode = if self.base.flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) ||
|
||||
self.fragment.style.get_box().position != position::T::static_ {
|
||||
self.fragment.style.get_box().position != StylePosition::Static {
|
||||
StackingContextType::PseudoPositioned
|
||||
} else {
|
||||
assert!(self.base.flags.is_float());
|
||||
|
@ -2997,7 +3002,7 @@ impl BlockFlowDisplayListBuilding for BlockFlow {
|
|||
return BlockStackingContextType::PseudoStackingContext
|
||||
}
|
||||
|
||||
if self.fragment.style.get_box().position != position::T::static_ {
|
||||
if self.fragment.style.get_box().position != StylePosition::Static {
|
||||
return BlockStackingContextType::PseudoStackingContext
|
||||
}
|
||||
|
||||
|
@ -3176,7 +3181,7 @@ impl BaseFlowDisplayListBuilding for BaseFlow {
|
|||
border_widths: SideOffsets2D::new_all_same(Au::from_px(2)),
|
||||
details: BorderDetails::Normal(NormalBorder {
|
||||
color: SideOffsets2D::new_all_same(color),
|
||||
style: SideOffsets2D::new_all_same(border_style::T::solid),
|
||||
style: SideOffsets2D::new_all_same(BorderStyle::Solid),
|
||||
radius: BorderRadii::all_same(Au(0)),
|
||||
}),
|
||||
})));
|
||||
|
@ -3194,9 +3199,9 @@ impl ComputedValuesCursorUtility for ComputedValues {
|
|||
#[inline]
|
||||
fn get_cursor(&self, default_cursor: Cursor) -> Option<Cursor> {
|
||||
match (self.get_pointing().pointer_events, self.get_pointing().cursor) {
|
||||
(pointer_events::T::none, _) => None,
|
||||
(pointer_events::T::auto, cursor::Keyword::Auto) => Some(default_cursor),
|
||||
(pointer_events::T::auto, cursor::Keyword::Cursor(cursor)) => Some(cursor),
|
||||
(PointerEvents::None, _) => None,
|
||||
(PointerEvents::Auto, cursor::Keyword::Auto) => Some(default_cursor),
|
||||
(PointerEvents::Auto, cursor::Keyword::Cursor(cursor)) => Some(cursor),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,11 @@ use model::{AdjoiningMargins, CollapsibleMargins};
|
|||
use model::{IntrinsicISizes, MaybeAuto, SizeConstraint};
|
||||
use std::cmp::{max, min};
|
||||
use std::ops::Range;
|
||||
use style::computed_values::{align_content, align_self, flex_direction, flex_wrap, justify_content};
|
||||
use style::computed_values::align_content::T as AlignContent;
|
||||
use style::computed_values::align_self::T as AlignSelf;
|
||||
use style::computed_values::flex_direction::T as FlexDirection;
|
||||
use style::computed_values::flex_wrap::T as FlexWrap;
|
||||
use style::computed_values::justify_content::T as JustifyContent;
|
||||
use style::logical_geometry::{Direction, LogicalSize};
|
||||
use style::properties::ComputedValues;
|
||||
use style::servo::restyle_damage::ServoRestyleDamage;
|
||||
|
@ -366,18 +370,18 @@ impl FlexFlow {
|
|||
{
|
||||
let style = fragment.style();
|
||||
let (mode, reverse) = match style.get_position().flex_direction {
|
||||
flex_direction::T::row => (Direction::Inline, false),
|
||||
flex_direction::T::row_reverse => (Direction::Inline, true),
|
||||
flex_direction::T::column => (Direction::Block, false),
|
||||
flex_direction::T::column_reverse => (Direction::Block, true),
|
||||
FlexDirection::Row => (Direction::Inline, false),
|
||||
FlexDirection::RowReverse => (Direction::Inline, true),
|
||||
FlexDirection::Column => (Direction::Block, false),
|
||||
FlexDirection::ColumnReverse => (Direction::Block, true),
|
||||
};
|
||||
main_mode = mode;
|
||||
main_reverse =
|
||||
reverse == style.writing_mode.is_bidi_ltr();
|
||||
let (wrappable, reverse) = match fragment.style.get_position().flex_wrap {
|
||||
flex_wrap::T::nowrap => (false, false),
|
||||
flex_wrap::T::wrap => (true, false),
|
||||
flex_wrap::T::wrap_reverse => (true, true),
|
||||
FlexWrap::Nowrap => (false, false),
|
||||
FlexWrap::Wrap => (true, false),
|
||||
FlexWrap::WrapReverse => (true, true),
|
||||
};
|
||||
is_wrappable = wrappable;
|
||||
// TODO(stshine): Handle vertical writing mode.
|
||||
|
@ -582,14 +586,14 @@ impl FlexFlow {
|
|||
let mut cur_i = inline_start_content_edge;
|
||||
let item_interval = if line.free_space >= Au(0) && line.auto_margin_count == 0 {
|
||||
match self.block_flow.fragment.style().get_position().justify_content {
|
||||
justify_content::T::space_between => {
|
||||
JustifyContent::SpaceBetween => {
|
||||
if item_count == 1 {
|
||||
Au(0)
|
||||
} else {
|
||||
line.free_space / (item_count - 1)
|
||||
}
|
||||
}
|
||||
justify_content::T::space_around => {
|
||||
JustifyContent::SpaceAround => {
|
||||
line.free_space / item_count
|
||||
}
|
||||
_ => Au(0),
|
||||
|
@ -600,10 +604,10 @@ impl FlexFlow {
|
|||
|
||||
match self.block_flow.fragment.style().get_position().justify_content {
|
||||
// Overflow equally in both ends of line.
|
||||
justify_content::T::center | justify_content::T::space_around => {
|
||||
JustifyContent::Center | JustifyContent::SpaceAround => {
|
||||
cur_i += (line.free_space - item_interval * (item_count - 1)) / 2;
|
||||
}
|
||||
justify_content::T::flex_end => {
|
||||
JustifyContent::FlexEnd => {
|
||||
cur_i += line.free_space;
|
||||
}
|
||||
_ => {}
|
||||
|
@ -709,21 +713,21 @@ impl FlexFlow {
|
|||
let free_space = container_block_size - total_cross_size;
|
||||
total_cross_size = container_block_size;
|
||||
|
||||
if line_align == align_content::T::stretch && free_space > Au(0) {
|
||||
if line_align == AlignContent::Stretch && free_space > Au(0) {
|
||||
for line in self.lines.iter_mut() {
|
||||
line.cross_size += free_space / line_count;
|
||||
}
|
||||
}
|
||||
|
||||
line_interval = match line_align {
|
||||
align_content::T::space_between => {
|
||||
AlignContent::SpaceBetween => {
|
||||
if line_count <= 1 {
|
||||
Au(0)
|
||||
} else {
|
||||
free_space / (line_count - 1)
|
||||
}
|
||||
}
|
||||
align_content::T::space_around => {
|
||||
AlignContent::SpaceAround => {
|
||||
if line_count == 0 {
|
||||
Au(0)
|
||||
} else {
|
||||
|
@ -734,10 +738,10 @@ impl FlexFlow {
|
|||
};
|
||||
|
||||
match line_align {
|
||||
align_content::T::center | align_content::T::space_around => {
|
||||
AlignContent::Center | AlignContent::SpaceAround => {
|
||||
cur_b += (free_space - line_interval * (line_count - 1)) / 2;
|
||||
}
|
||||
align_content::T::flex_end => {
|
||||
AlignContent::FlexEnd => {
|
||||
cur_b += free_space;
|
||||
}
|
||||
_ => {}
|
||||
|
@ -772,7 +776,7 @@ impl FlexFlow {
|
|||
}
|
||||
|
||||
let self_align = block.fragment.style().get_position().align_self;
|
||||
if self_align == align_self::T::stretch &&
|
||||
if self_align == AlignSelf::Stretch &&
|
||||
block.fragment.style().content_block_size() == LengthOrPercentageOrAuto::Auto {
|
||||
free_space = Au(0);
|
||||
block.base.block_container_explicit_block_size = Some(line.cross_size);
|
||||
|
@ -793,8 +797,8 @@ impl FlexFlow {
|
|||
// TODO(stshine): support baseline alignment.
|
||||
if free_space != Au(0) {
|
||||
let flex_cross = match self_align {
|
||||
align_self::T::flex_end => free_space,
|
||||
align_self::T::center => free_space / 2,
|
||||
AlignSelf::FlexEnd => free_space,
|
||||
AlignSelf::Center => free_space / 2,
|
||||
_ => Au(0),
|
||||
};
|
||||
block.base.position.start.b +=
|
||||
|
|
|
@ -8,7 +8,7 @@ use flow::{self, Flow, FlowFlags, ImmutableFlowUtils};
|
|||
use persistent_list::PersistentList;
|
||||
use std::cmp::{max, min};
|
||||
use std::fmt;
|
||||
use style::computed_values::float;
|
||||
use style::computed_values::float::T as StyleFloat;
|
||||
use style::logical_geometry::{LogicalRect, LogicalSize, WritingMode};
|
||||
use style::values::computed::LengthOrPercentageOrAuto;
|
||||
|
||||
|
@ -20,11 +20,11 @@ pub enum FloatKind {
|
|||
}
|
||||
|
||||
impl FloatKind {
|
||||
pub fn from_property(property: float::T) -> Option<FloatKind> {
|
||||
pub fn from_property(property: StyleFloat) -> Option<FloatKind> {
|
||||
match property {
|
||||
float::T::none => None,
|
||||
float::T::left => Some(FloatKind::Left),
|
||||
float::T::right => Some(FloatKind::Right),
|
||||
StyleFloat::None => None,
|
||||
StyleFloat::Left => Some(FloatKind::Left),
|
||||
StyleFloat::Right => Some(FloatKind::Right),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -513,9 +513,9 @@ impl SpeculatedFloatPlacement {
|
|||
}
|
||||
|
||||
match base_flow.flags.float_kind() {
|
||||
float::T::none => {}
|
||||
float::T::left => self.left = self.left + float_inline_size,
|
||||
float::T::right => self.right = self.right + float_inline_size,
|
||||
StyleFloat::None => {}
|
||||
StyleFloat::Left => self.left = self.left + float_inline_size,
|
||||
StyleFloat::Right => self.right = self.right + float_inline_size,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -49,7 +49,11 @@ use std::iter::Zip;
|
|||
use std::slice::IterMut;
|
||||
use std::sync::Arc;
|
||||
use std::sync::atomic::Ordering;
|
||||
use style::computed_values::{clear, float, overflow_x, position, text_align};
|
||||
use style::computed_values::clear::T as Clear;
|
||||
use style::computed_values::float::T as Float;
|
||||
use style::computed_values::overflow_x::T as StyleOverflow;
|
||||
use style::computed_values::position::T as Position;
|
||||
use style::computed_values::text_align::T as TextAlign;
|
||||
use style::context::SharedStyleContext;
|
||||
use style::logical_geometry::{LogicalRect, LogicalSize, WritingMode};
|
||||
use style::properties::ComputedValues;
|
||||
|
@ -277,13 +281,13 @@ pub trait Flow: HasBaseFlow + fmt::Debug + Sync + Send + 'static {
|
|||
&base(self).early_absolute_position_info.relative_containing_block_size,
|
||||
base(self).early_absolute_position_info.relative_containing_block_mode,
|
||||
CoordinateSystem::Own);
|
||||
if overflow_x::T::visible != self.as_block().fragment.style.get_box().overflow_x {
|
||||
if StyleOverflow::Visible != self.as_block().fragment.style.get_box().overflow_x {
|
||||
overflow.paint.origin.x = Au(0);
|
||||
overflow.paint.size.width = border_box.size.width;
|
||||
overflow.scroll.origin.x = Au(0);
|
||||
overflow.scroll.size.width = border_box.size.width;
|
||||
}
|
||||
if overflow_x::T::visible != self.as_block().fragment.style.get_box().overflow_y {
|
||||
if StyleOverflow::Visible != self.as_block().fragment.style.get_box().overflow_y {
|
||||
overflow.paint.origin.y = Au(0);
|
||||
overflow.paint.size.height = border_box.size.height;
|
||||
overflow.scroll.origin.y = Au(0);
|
||||
|
@ -391,13 +395,13 @@ pub trait Flow: HasBaseFlow + fmt::Debug + Sync + Send + 'static {
|
|||
}
|
||||
|
||||
/// The 'position' property of this flow.
|
||||
fn positioning(&self) -> position::T {
|
||||
position::T::static_
|
||||
fn positioning(&self) -> Position {
|
||||
Position::Static
|
||||
}
|
||||
|
||||
/// Return true if this flow has position 'fixed'.
|
||||
fn is_fixed(&self) -> bool {
|
||||
self.positioning() == position::T::fixed
|
||||
self.positioning() == Position::Fixed
|
||||
}
|
||||
|
||||
fn contains_positioned_fragments(&self) -> bool {
|
||||
|
@ -406,7 +410,7 @@ pub trait Flow: HasBaseFlow + fmt::Debug + Sync + Send + 'static {
|
|||
}
|
||||
|
||||
fn contains_relatively_positioned_fragments(&self) -> bool {
|
||||
self.positioning() == position::T::relative
|
||||
self.positioning() == Position::Relative
|
||||
}
|
||||
|
||||
/// Returns true if this is an absolute containing block.
|
||||
|
@ -647,24 +651,24 @@ static TEXT_ALIGN_SHIFT: usize = 11;
|
|||
|
||||
impl FlowFlags {
|
||||
#[inline]
|
||||
pub fn text_align(self) -> text_align::T {
|
||||
text_align::T::from_u32((self & FlowFlags::TEXT_ALIGN).bits() >> TEXT_ALIGN_SHIFT).unwrap()
|
||||
pub fn text_align(self) -> TextAlign {
|
||||
TextAlign::from_u32((self & FlowFlags::TEXT_ALIGN).bits() >> TEXT_ALIGN_SHIFT).unwrap()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn set_text_align(&mut self, value: text_align::T) {
|
||||
pub fn set_text_align(&mut self, value: TextAlign) {
|
||||
*self = (*self & !FlowFlags::TEXT_ALIGN) |
|
||||
FlowFlags::from_bits(value.to_u32() << TEXT_ALIGN_SHIFT).unwrap();
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn float_kind(&self) -> float::T {
|
||||
pub fn float_kind(&self) -> Float {
|
||||
if self.contains(FlowFlags::FLOATS_LEFT) {
|
||||
float::T::left
|
||||
Float::Left
|
||||
} else if self.contains(FlowFlags::FLOATS_RIGHT) {
|
||||
float::T::right
|
||||
Float::Right
|
||||
} else {
|
||||
float::T::none
|
||||
Float::None
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -990,7 +994,7 @@ impl BaseFlow {
|
|||
match style {
|
||||
Some(style) => {
|
||||
match style.get_box().position {
|
||||
position::T::absolute | position::T::fixed => {
|
||||
Position::Absolute | Position::Fixed => {
|
||||
flags.insert(FlowFlags::IS_ABSOLUTELY_POSITIONED);
|
||||
|
||||
let logical_position = style.logical_position();
|
||||
|
@ -1008,17 +1012,17 @@ impl BaseFlow {
|
|||
|
||||
if force_nonfloated == ForceNonfloatedFlag::FloatIfNecessary {
|
||||
match style.get_box().float {
|
||||
float::T::none => {}
|
||||
float::T::left => flags.insert(FlowFlags::FLOATS_LEFT),
|
||||
float::T::right => flags.insert(FlowFlags::FLOATS_RIGHT),
|
||||
Float::None => {}
|
||||
Float::Left => flags.insert(FlowFlags::FLOATS_LEFT),
|
||||
Float::Right => flags.insert(FlowFlags::FLOATS_RIGHT),
|
||||
}
|
||||
}
|
||||
|
||||
match style.get_box().clear {
|
||||
clear::T::none => {}
|
||||
clear::T::left => flags.insert(FlowFlags::CLEARS_LEFT),
|
||||
clear::T::right => flags.insert(FlowFlags::CLEARS_RIGHT),
|
||||
clear::T::both => {
|
||||
Clear::None => {}
|
||||
Clear::Left => flags.insert(FlowFlags::CLEARS_LEFT),
|
||||
Clear::Right => flags.insert(FlowFlags::CLEARS_RIGHT),
|
||||
Clear::Both => {
|
||||
flags.insert(FlowFlags::CLEARS_LEFT);
|
||||
flags.insert(FlowFlags::CLEARS_RIGHT);
|
||||
}
|
||||
|
|
|
@ -40,10 +40,20 @@ use std::borrow::ToOwned;
|
|||
use std::cmp::{Ordering, max, min};
|
||||
use std::collections::LinkedList;
|
||||
use std::sync::{Arc, Mutex};
|
||||
use style::computed_values::{border_collapse, box_sizing, clear, color, display, mix_blend_mode};
|
||||
use style::computed_values::{overflow_wrap, overflow_x, position, text_decoration_line};
|
||||
use style::computed_values::{transform_style, white_space, word_break};
|
||||
use style::computed_values::border_collapse::T as BorderCollapse;
|
||||
use style::computed_values::box_sizing::T as BoxSizing;
|
||||
use style::computed_values::clear::T as Clear;
|
||||
use style::computed_values::color::T as Color;
|
||||
use style::computed_values::content::ContentItem;
|
||||
use style::computed_values::display::T as Display;
|
||||
use style::computed_values::mix_blend_mode::T as MixBlendMode;
|
||||
use style::computed_values::overflow_wrap::T as OverflowWrap;
|
||||
use style::computed_values::overflow_x::T as StyleOverflow;
|
||||
use style::computed_values::position::T as Position;
|
||||
use style::computed_values::text_decoration_line::T as TextDecorationLine;
|
||||
use style::computed_values::transform_style::T as TransformStyle;
|
||||
use style::computed_values::white_space::T as WhiteSpace;
|
||||
use style::computed_values::word_break::T as WordBreak;
|
||||
use style::logical_geometry::{Direction, LogicalMargin, LogicalRect, LogicalSize, WritingMode};
|
||||
use style::properties::ComputedValues;
|
||||
use style::selector_parser::RestyleDamage;
|
||||
|
@ -866,7 +876,7 @@ impl Fragment {
|
|||
let base_quantities = QuantitiesIncludedInIntrinsicInlineSizes::INTRINSIC_INLINE_SIZE_INCLUDES_PADDING |
|
||||
QuantitiesIncludedInIntrinsicInlineSizes::INTRINSIC_INLINE_SIZE_INCLUDES_SPECIFIED;
|
||||
if self.style.get_inheritedtable().border_collapse ==
|
||||
border_collapse::T::separate {
|
||||
BorderCollapse::Separate {
|
||||
base_quantities | QuantitiesIncludedInIntrinsicInlineSizes::INTRINSIC_INLINE_SIZE_INCLUDES_BORDER
|
||||
} else {
|
||||
base_quantities
|
||||
|
@ -876,7 +886,7 @@ impl Fragment {
|
|||
let base_quantities = QuantitiesIncludedInIntrinsicInlineSizes::INTRINSIC_INLINE_SIZE_INCLUDES_MARGINS |
|
||||
QuantitiesIncludedInIntrinsicInlineSizes::INTRINSIC_INLINE_SIZE_INCLUDES_SPECIFIED;
|
||||
if self.style.get_inheritedtable().border_collapse ==
|
||||
border_collapse::T::separate {
|
||||
BorderCollapse::Separate {
|
||||
base_quantities | QuantitiesIncludedInIntrinsicInlineSizes::INTRINSIC_INLINE_SIZE_INCLUDES_BORDER
|
||||
} else {
|
||||
base_quantities
|
||||
|
@ -886,7 +896,7 @@ impl Fragment {
|
|||
let base_quantities =
|
||||
QuantitiesIncludedInIntrinsicInlineSizes::INTRINSIC_INLINE_SIZE_INCLUDES_SPECIFIED;
|
||||
if self.style.get_inheritedtable().border_collapse ==
|
||||
border_collapse::T::separate {
|
||||
BorderCollapse::Separate {
|
||||
base_quantities | QuantitiesIncludedInIntrinsicInlineSizes::INTRINSIC_INLINE_SIZE_INCLUDES_BORDER
|
||||
} else {
|
||||
base_quantities
|
||||
|
@ -964,7 +974,7 @@ impl Fragment {
|
|||
specified = min(specified, max)
|
||||
}
|
||||
|
||||
if self.style.get_position().box_sizing == box_sizing::T::border_box {
|
||||
if self.style.get_position().box_sizing == BoxSizing::BorderBox {
|
||||
specified = max(Au(0), specified - border_padding);
|
||||
}
|
||||
}
|
||||
|
@ -1164,7 +1174,7 @@ impl Fragment {
|
|||
Direction::Block => (self.style.min_block_size(), self.style.max_block_size())
|
||||
};
|
||||
|
||||
let border = if self.style().get_position().box_sizing == box_sizing::T::border_box {
|
||||
let border = if self.style().get_position().box_sizing == BoxSizing::BorderBox {
|
||||
Some(self.border_padding.start_end(direction))
|
||||
} else {
|
||||
None
|
||||
|
@ -1224,10 +1234,10 @@ impl Fragment {
|
|||
/// 'box-sizing: border-box'. The `border_padding` field must have been initialized.
|
||||
pub fn box_sizing_boundary(&self, direction: Direction) -> Au {
|
||||
match (self.style().get_position().box_sizing, direction) {
|
||||
(box_sizing::T::border_box, Direction::Inline) => {
|
||||
(BoxSizing::BorderBox, Direction::Inline) => {
|
||||
self.border_padding.inline_start_end()
|
||||
}
|
||||
(box_sizing::T::border_box, Direction::Block) => {
|
||||
(BoxSizing::BorderBox, Direction::Block) => {
|
||||
self.border_padding.block_start_end()
|
||||
}
|
||||
_ => Au(0)
|
||||
|
@ -1320,8 +1330,8 @@ impl Fragment {
|
|||
containing_block_inline_size: Au) {
|
||||
// Compute border.
|
||||
let border = match self.style.get_inheritedtable().border_collapse {
|
||||
border_collapse::T::separate => self.border_width(),
|
||||
border_collapse::T::collapse => LogicalMargin::zero(self.style.writing_mode),
|
||||
BorderCollapse::Separate => self.border_width(),
|
||||
BorderCollapse::Collapse => LogicalMargin::zero(self.style.writing_mode),
|
||||
};
|
||||
|
||||
// Compute padding from the fragment's style.
|
||||
|
@ -1382,7 +1392,7 @@ impl Fragment {
|
|||
}
|
||||
|
||||
// Go over the ancestor fragments and add all relative offsets (if any).
|
||||
let mut rel_pos = if self.style().get_box().position == position::T::relative {
|
||||
let mut rel_pos = if self.style().get_box().position == Position::Relative {
|
||||
from_style(self.style(), containing_block_size)
|
||||
} else {
|
||||
LogicalSize::zero(self.style.writing_mode)
|
||||
|
@ -1390,7 +1400,7 @@ impl Fragment {
|
|||
|
||||
if let Some(ref inline_fragment_context) = self.inline_context {
|
||||
for node in &inline_fragment_context.nodes {
|
||||
if node.style.get_box().position == position::T::relative {
|
||||
if node.style.get_box().position == Position::Relative {
|
||||
rel_pos = rel_pos + from_style(&*node.style, containing_block_size);
|
||||
}
|
||||
}
|
||||
|
@ -1406,10 +1416,10 @@ impl Fragment {
|
|||
pub fn clear(&self) -> Option<ClearType> {
|
||||
let style = self.style();
|
||||
match style.get_box().clear {
|
||||
clear::T::none => None,
|
||||
clear::T::left => Some(ClearType::Left),
|
||||
clear::T::right => Some(ClearType::Right),
|
||||
clear::T::both => Some(ClearType::Both),
|
||||
Clear::None => None,
|
||||
Clear::Left => Some(ClearType::Left),
|
||||
Clear::Right => Some(ClearType::Right),
|
||||
Clear::Both => Some(ClearType::Both),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1423,11 +1433,11 @@ impl Fragment {
|
|||
&*self.selected_style
|
||||
}
|
||||
|
||||
pub fn white_space(&self) -> white_space::T {
|
||||
pub fn white_space(&self) -> WhiteSpace {
|
||||
self.style().get_inheritedtext().white_space
|
||||
}
|
||||
|
||||
pub fn color(&self) -> color::T {
|
||||
pub fn color(&self) -> Color {
|
||||
self.style().get_color().color
|
||||
}
|
||||
|
||||
|
@ -1438,7 +1448,7 @@ impl Fragment {
|
|||
/// CSS 2.1 § 16.3.1. Unfortunately, computing this properly doesn't really fit into Servo's
|
||||
/// model. Therefore, this is a best lower bound approximation, but the end result may actually
|
||||
/// have the various decoration flags turned on afterward.
|
||||
pub fn text_decoration_line(&self) -> text_decoration_line::T {
|
||||
pub fn text_decoration_line(&self) -> TextDecorationLine {
|
||||
self.style().get_text().text_decoration_line
|
||||
}
|
||||
|
||||
|
@ -1654,13 +1664,13 @@ impl Fragment {
|
|||
let mut flags = SplitOptions::empty();
|
||||
if starts_line {
|
||||
flags.insert(SplitOptions::STARTS_LINE);
|
||||
if self.style().get_inheritedtext().overflow_wrap == overflow_wrap::T::break_word {
|
||||
if self.style().get_inheritedtext().overflow_wrap == OverflowWrap::BreakWord {
|
||||
flags.insert(SplitOptions::RETRY_AT_CHARACTER_BOUNDARIES)
|
||||
}
|
||||
}
|
||||
|
||||
match self.style().get_inheritedtext().word_break {
|
||||
word_break::T::normal | word_break::T::keep_all => {
|
||||
WordBreak::Normal | WordBreak::KeepAll => {
|
||||
// Break at normal word boundaries. keep-all forbids soft wrap opportunities.
|
||||
let natural_word_breaking_strategy =
|
||||
text_fragment_info.run.natural_word_slices_in_range(&text_fragment_info.range);
|
||||
|
@ -1669,7 +1679,7 @@ impl Fragment {
|
|||
max_inline_size,
|
||||
flags)
|
||||
}
|
||||
word_break::T::break_all => {
|
||||
WordBreak::BreakAll => {
|
||||
// Break at character boundaries.
|
||||
let character_breaking_strategy =
|
||||
text_fragment_info.run.character_slices_in_range(&text_fragment_info.range);
|
||||
|
@ -2205,7 +2215,7 @@ impl Fragment {
|
|||
match (flow.baseline_offset_of_last_line_box_in_flow(),
|
||||
style.get_box().overflow_y) {
|
||||
// Case A
|
||||
(Some(baseline_offset), overflow_x::T::visible) => baseline_offset,
|
||||
(Some(baseline_offset), StyleOverflow::Visible) => baseline_offset,
|
||||
// Case B
|
||||
_ => border_box_block_size + end_margin,
|
||||
};
|
||||
|
@ -2519,7 +2529,7 @@ impl Fragment {
|
|||
return true
|
||||
}
|
||||
|
||||
if self.style().get_effects().mix_blend_mode != mix_blend_mode::T::normal {
|
||||
if self.style().get_effects().mix_blend_mode != MixBlendMode::Normal {
|
||||
return true
|
||||
}
|
||||
|
||||
|
@ -2527,21 +2537,21 @@ impl Fragment {
|
|||
return true;
|
||||
}
|
||||
|
||||
if self.style().get_box().transform_style == transform_style::T::preserve_3d ||
|
||||
if self.style().get_box().transform_style == TransformStyle::Preserve3d ||
|
||||
self.style().overrides_transform_style() {
|
||||
return true
|
||||
}
|
||||
|
||||
// Fixed position and sticky position always create stacking contexts.
|
||||
if self.style().get_box().position == position::T::fixed ||
|
||||
self.style().get_box().position == position::T::sticky {
|
||||
if self.style().get_box().position == Position::Fixed ||
|
||||
self.style().get_box().position == Position::Sticky {
|
||||
return true
|
||||
}
|
||||
|
||||
// Statically positioned fragments don't establish stacking contexts if the previous
|
||||
// conditions are not fulfilled. Furthermore, z-index doesn't apply to statically
|
||||
// positioned fragments.
|
||||
if self.style().get_box().position == position::T::static_ {
|
||||
if self.style().get_box().position == Position::Static {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -2556,7 +2566,7 @@ impl Fragment {
|
|||
// from the value specified in the style.
|
||||
pub fn effective_z_index(&self) -> i32 {
|
||||
match self.style().get_box().position {
|
||||
position::T::static_ => {},
|
||||
Position::Static => {},
|
||||
_ => return self.style().get_position().z_index.integer_or(0),
|
||||
}
|
||||
|
||||
|
@ -2565,7 +2575,7 @@ impl Fragment {
|
|||
}
|
||||
|
||||
match self.style().get_box().display {
|
||||
display::T::flex => self.style().get_position().z_index.integer_or(0),
|
||||
Display::Flex => self.style().get_position().z_index.integer_or(0),
|
||||
_ => 0,
|
||||
}
|
||||
}
|
||||
|
@ -2779,12 +2789,12 @@ impl Fragment {
|
|||
/// Returns true if this node *or any of the nodes within its inline fragment context* have
|
||||
/// non-`static` `position`.
|
||||
pub fn is_positioned(&self) -> bool {
|
||||
if self.style.get_box().position != position::T::static_ {
|
||||
if self.style.get_box().position != Position::Static {
|
||||
return true
|
||||
}
|
||||
if let Some(ref inline_context) = self.inline_context {
|
||||
for node in inline_context.nodes.iter() {
|
||||
if node.style.get_box().position != position::T::static_ {
|
||||
if node.style.get_box().position != Position::Static {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
@ -2794,7 +2804,7 @@ impl Fragment {
|
|||
|
||||
/// Returns true if this node is absolutely positioned.
|
||||
pub fn is_absolutely_positioned(&self) -> bool {
|
||||
self.style.get_box().position == position::T::absolute
|
||||
self.style.get_box().position == Position::Absolute
|
||||
}
|
||||
|
||||
pub fn is_inline_absolute(&self) -> bool {
|
||||
|
|
|
@ -15,8 +15,9 @@ use gfx::display_list::OpaqueNode;
|
|||
use script_layout_interface::wrapper_traits::PseudoElementType;
|
||||
use smallvec::SmallVec;
|
||||
use std::collections::{HashMap, LinkedList};
|
||||
use style::computed_values::{display, list_style_type};
|
||||
use style::computed_values::content::ContentItem;
|
||||
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;
|
||||
use style::servo::restyle_damage::ServoRestyleDamage;
|
||||
|
@ -157,8 +158,8 @@ 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::T::list_item {
|
||||
list_style_type = list_style_type::T::none
|
||||
if fragment.style().get_box().display != Display::ListItem {
|
||||
list_style_type = ListStyleType::None
|
||||
}
|
||||
|
||||
let mut new_info = None;
|
||||
|
@ -254,14 +255,14 @@ 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::T::list_item {
|
||||
list_style_type = list_style_type::T::none
|
||||
if !self.is_block || fragment.style().get_box().display != Display::ListItem {
|
||||
list_style_type = ListStyleType::None
|
||||
}
|
||||
|
||||
match list_style_type {
|
||||
list_style_type::T::disc | list_style_type::T::none | list_style_type::T::circle |
|
||||
list_style_type::T::square | list_style_type::T::disclosure_open |
|
||||
list_style_type::T::disclosure_closed => {}
|
||||
ListStyleType::Disc | ListStyleType::None | ListStyleType::Circle |
|
||||
ListStyleType::Square | ListStyleType::DisclosureOpen |
|
||||
ListStyleType::DisclosureClosed => {}
|
||||
_ => self.traversal.list_item.increment(self.level, 1),
|
||||
}
|
||||
|
||||
|
@ -369,7 +370,7 @@ impl Counter {
|
|||
node: OpaqueNode,
|
||||
pseudo: PseudoElementType<()>,
|
||||
style: ::ServoArc<ComputedValues>,
|
||||
list_style_type: list_style_type::T,
|
||||
list_style_type: ListStyleType,
|
||||
mode: RenderingMode)
|
||||
-> Option<SpecificFragmentInfo> {
|
||||
let mut string = String::new();
|
||||
|
@ -458,71 +459,72 @@ fn render_text(layout_context: &LayoutContext,
|
|||
|
||||
/// Appends string that represents the value rendered using the system appropriate for the given
|
||||
/// `list-style-type` onto the given string.
|
||||
fn push_representation(value: i32, list_style_type: list_style_type::T, accumulator: &mut String) {
|
||||
fn push_representation(value: i32, list_style_type: ListStyleType, accumulator: &mut String) {
|
||||
match list_style_type {
|
||||
list_style_type::T::none => {}
|
||||
list_style_type::T::disc |
|
||||
list_style_type::T::circle |
|
||||
list_style_type::T::square |
|
||||
list_style_type::T::disclosure_open |
|
||||
list_style_type::T::disclosure_closed => {
|
||||
ListStyleType::None => {}
|
||||
ListStyleType::Disc |
|
||||
ListStyleType::Circle |
|
||||
ListStyleType::Square |
|
||||
ListStyleType::DisclosureOpen |
|
||||
ListStyleType::DisclosureClosed => {
|
||||
accumulator.push(static_representation(list_style_type))
|
||||
}
|
||||
list_style_type::T::decimal => push_numeric_representation(value, &DECIMAL, accumulator),
|
||||
list_style_type::T::arabic_indic => {
|
||||
ListStyleType::Decimal => push_numeric_representation(value, &DECIMAL, accumulator),
|
||||
ListStyleType::ArabicIndic => {
|
||||
push_numeric_representation(value, &ARABIC_INDIC, accumulator)
|
||||
}
|
||||
list_style_type::T::bengali => push_numeric_representation(value, &BENGALI, accumulator),
|
||||
list_style_type::T::cambodian | list_style_type::T::khmer => {
|
||||
ListStyleType::Bengali => push_numeric_representation(value, &BENGALI, accumulator),
|
||||
ListStyleType::Cambodian |
|
||||
ListStyleType::Khmer => {
|
||||
push_numeric_representation(value, &CAMBODIAN, accumulator)
|
||||
}
|
||||
list_style_type::T::cjk_decimal => {
|
||||
ListStyleType::CjkDecimal => {
|
||||
push_numeric_representation(value, &CJK_DECIMAL, accumulator)
|
||||
}
|
||||
list_style_type::T::devanagari => {
|
||||
ListStyleType::Devanagari => {
|
||||
push_numeric_representation(value, &DEVANAGARI, accumulator)
|
||||
}
|
||||
list_style_type::T::gujarati => push_numeric_representation(value, &GUJARATI, accumulator),
|
||||
list_style_type::T::gurmukhi => push_numeric_representation(value, &GURMUKHI, accumulator),
|
||||
list_style_type::T::kannada => push_numeric_representation(value, &KANNADA, accumulator),
|
||||
list_style_type::T::lao => push_numeric_representation(value, &LAO, accumulator),
|
||||
list_style_type::T::malayalam => {
|
||||
ListStyleType::Gujarati => push_numeric_representation(value, &GUJARATI, accumulator),
|
||||
ListStyleType::Gurmukhi => push_numeric_representation(value, &GURMUKHI, accumulator),
|
||||
ListStyleType::Kannada => push_numeric_representation(value, &KANNADA, accumulator),
|
||||
ListStyleType::Lao => push_numeric_representation(value, &LAO, accumulator),
|
||||
ListStyleType::Malayalam => {
|
||||
push_numeric_representation(value, &MALAYALAM, accumulator)
|
||||
}
|
||||
list_style_type::T::mongolian => {
|
||||
ListStyleType::Mongolian => {
|
||||
push_numeric_representation(value, &MONGOLIAN, accumulator)
|
||||
}
|
||||
list_style_type::T::myanmar => push_numeric_representation(value, &MYANMAR, accumulator),
|
||||
list_style_type::T::oriya => push_numeric_representation(value, &ORIYA, accumulator),
|
||||
list_style_type::T::persian => push_numeric_representation(value, &PERSIAN, accumulator),
|
||||
list_style_type::T::telugu => push_numeric_representation(value, &TELUGU, accumulator),
|
||||
list_style_type::T::thai => push_numeric_representation(value, &THAI, accumulator),
|
||||
list_style_type::T::tibetan => push_numeric_representation(value, &TIBETAN, accumulator),
|
||||
list_style_type::T::lower_alpha => {
|
||||
ListStyleType::Myanmar => push_numeric_representation(value, &MYANMAR, accumulator),
|
||||
ListStyleType::Oriya => push_numeric_representation(value, &ORIYA, accumulator),
|
||||
ListStyleType::Persian => push_numeric_representation(value, &PERSIAN, accumulator),
|
||||
ListStyleType::Telugu => push_numeric_representation(value, &TELUGU, accumulator),
|
||||
ListStyleType::Thai => push_numeric_representation(value, &THAI, accumulator),
|
||||
ListStyleType::Tibetan => push_numeric_representation(value, &TIBETAN, accumulator),
|
||||
ListStyleType::LowerAlpha => {
|
||||
push_alphabetic_representation(value, &LOWER_ALPHA, accumulator)
|
||||
}
|
||||
list_style_type::T::upper_alpha => {
|
||||
ListStyleType::UpperAlpha => {
|
||||
push_alphabetic_representation(value, &UPPER_ALPHA, accumulator)
|
||||
}
|
||||
list_style_type::T::cjk_earthly_branch => {
|
||||
ListStyleType::CjkEarthlyBranch => {
|
||||
push_alphabetic_representation(value, &CJK_EARTHLY_BRANCH, accumulator)
|
||||
}
|
||||
list_style_type::T::cjk_heavenly_stem => {
|
||||
ListStyleType::CjkHeavenlyStem => {
|
||||
push_alphabetic_representation(value, &CJK_HEAVENLY_STEM, accumulator)
|
||||
}
|
||||
list_style_type::T::lower_greek => {
|
||||
ListStyleType::LowerGreek => {
|
||||
push_alphabetic_representation(value, &LOWER_GREEK, accumulator)
|
||||
}
|
||||
list_style_type::T::hiragana => {
|
||||
ListStyleType::Hiragana => {
|
||||
push_alphabetic_representation(value, &HIRAGANA, accumulator)
|
||||
}
|
||||
list_style_type::T::hiragana_iroha => {
|
||||
ListStyleType::HiraganaIroha => {
|
||||
push_alphabetic_representation(value, &HIRAGANA_IROHA, accumulator)
|
||||
}
|
||||
list_style_type::T::katakana => {
|
||||
ListStyleType::Katakana => {
|
||||
push_alphabetic_representation(value, &KATAKANA, accumulator)
|
||||
}
|
||||
list_style_type::T::katakana_iroha => {
|
||||
ListStyleType::KatakanaIroha => {
|
||||
push_alphabetic_representation(value, &KATAKANA_IROHA, accumulator)
|
||||
}
|
||||
}
|
||||
|
@ -530,13 +532,13 @@ fn push_representation(value: i32, list_style_type: list_style_type::T, accumula
|
|||
|
||||
/// Returns the static character that represents the value rendered using the given list-style, if
|
||||
/// possible.
|
||||
pub fn static_representation(list_style_type: list_style_type::T) -> char {
|
||||
pub fn static_representation(list_style_type: ListStyleType) -> char {
|
||||
match list_style_type {
|
||||
list_style_type::T::disc => '•',
|
||||
list_style_type::T::circle => '◦',
|
||||
list_style_type::T::square => '▪',
|
||||
list_style_type::T::disclosure_open => '▾',
|
||||
list_style_type::T::disclosure_closed => '‣',
|
||||
ListStyleType::Disc => '•',
|
||||
ListStyleType::Circle => '◦',
|
||||
ListStyleType::Square => '▪',
|
||||
ListStyleType::DisclosureOpen => '▾',
|
||||
ListStyleType::DisclosureClosed => '‣',
|
||||
_ => panic!("No static representation for this list-style-type!"),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use flow::{self, FlowFlags, Flow};
|
||||
use style::computed_values::float;
|
||||
use style::computed_values::float::T as Float;
|
||||
use style::selector_parser::RestyleDamage;
|
||||
use style::servo::restyle_damage::ServoRestyleDamage;
|
||||
|
||||
|
@ -61,7 +61,7 @@ impl<'a> LayoutDamageComputation for &'a mut Flow {
|
|||
}
|
||||
|
||||
let self_base = flow::mut_base(self);
|
||||
if self_base.flags.float_kind() != float::T::none &&
|
||||
if self_base.flags.float_kind() != Float::None &&
|
||||
self_base.restyle_damage.intersects(ServoRestyleDamage::REFLOW) {
|
||||
special_damage.insert(SpecialRestyleDamage::REFLOW_ENTIRE_DOCUMENT);
|
||||
}
|
||||
|
|
|
@ -30,12 +30,17 @@ use std::{fmt, i32, isize, mem};
|
|||
use std::cmp::max;
|
||||
use std::collections::VecDeque;
|
||||
use std::sync::Arc;
|
||||
use style::computed_values::{display, overflow_x, position, text_align, text_justify};
|
||||
use style::computed_values::{vertical_align, white_space};
|
||||
use style::computed_values::display::T as Display;
|
||||
use style::computed_values::overflow_x::T as StyleOverflow;
|
||||
use style::computed_values::position::T as Position;
|
||||
use style::computed_values::text_align::T as TextAlign;
|
||||
use style::computed_values::text_justify::T as TextJustify;
|
||||
use style::computed_values::white_space::T as WhiteSpace;
|
||||
use style::logical_geometry::{LogicalRect, LogicalSize, WritingMode};
|
||||
use style::properties::ComputedValues;
|
||||
use style::servo::restyle_damage::ServoRestyleDamage;
|
||||
use style::values::generics::box_::VerticalAlign;
|
||||
use style::values::computed::box_::VerticalAlign;
|
||||
use style::values::generics::box_::VerticalAlign as GenericVerticalAlign;
|
||||
use style::values::specified::text::TextOverflowSide;
|
||||
use text;
|
||||
use traversal::PreorderFlowTraversal;
|
||||
|
@ -715,7 +720,7 @@ impl LineBreaker {
|
|||
|
||||
let ellipsis = match (&fragment.style().get_text().text_overflow.second,
|
||||
fragment.style().get_box().overflow_x) {
|
||||
(&TextOverflowSide::Clip, _) | (_, overflow_x::T::visible) => None,
|
||||
(&TextOverflowSide::Clip, _) | (_, StyleOverflow::Visible) => None,
|
||||
(&TextOverflowSide::Ellipsis, _) => {
|
||||
if fragment.margin_box_inline_size() > available_inline_size {
|
||||
Some("…".to_string())
|
||||
|
@ -907,7 +912,7 @@ impl InlineFlow {
|
|||
/// performs text justification if mandated by the style.
|
||||
fn set_inline_fragment_positions(fragments: &mut InlineFragments,
|
||||
line: &Line,
|
||||
line_align: text_align::T,
|
||||
line_align: TextAlign,
|
||||
indentation: Au,
|
||||
is_last_line: bool) {
|
||||
// Figure out how much inline-size we have.
|
||||
|
@ -922,14 +927,14 @@ impl InlineFlow {
|
|||
// Translate `left` and `right` to logical directions.
|
||||
let is_ltr = fragments.fragments[0].style().writing_mode.is_bidi_ltr();
|
||||
let line_align = match (line_align, is_ltr) {
|
||||
(text_align::T::left, true) |
|
||||
(text_align::T::servo_left, true) |
|
||||
(text_align::T::right, false) |
|
||||
(text_align::T::servo_right, false) => text_align::T::start,
|
||||
(text_align::T::left, false) |
|
||||
(text_align::T::servo_left, false) |
|
||||
(text_align::T::right, true) |
|
||||
(text_align::T::servo_right, true) => text_align::T::end,
|
||||
(TextAlign::Left, true) |
|
||||
(TextAlign::ServoLeft, true) |
|
||||
(TextAlign::Right, false) |
|
||||
(TextAlign::ServoRight, false) => TextAlign::Start,
|
||||
(TextAlign::Left, false) |
|
||||
(TextAlign::ServoLeft, false) |
|
||||
(TextAlign::Right, true) |
|
||||
(TextAlign::ServoRight, true) => TextAlign::End,
|
||||
_ => line_align
|
||||
};
|
||||
|
||||
|
@ -937,22 +942,22 @@ impl InlineFlow {
|
|||
// necessary.
|
||||
let mut inline_start_position_for_fragment = line.bounds.start.i + indentation;
|
||||
match line_align {
|
||||
text_align::T::justify if !is_last_line && text_justify != text_justify::T::none => {
|
||||
TextAlign::Justify if !is_last_line && text_justify != TextJustify::None => {
|
||||
InlineFlow::justify_inline_fragments(fragments, line, slack_inline_size)
|
||||
}
|
||||
text_align::T::justify | text_align::T::start => {}
|
||||
text_align::T::center | text_align::T::servo_center => {
|
||||
TextAlign::Justify | TextAlign::Start => {}
|
||||
TextAlign::Center | TextAlign::ServoCenter => {
|
||||
inline_start_position_for_fragment = inline_start_position_for_fragment +
|
||||
slack_inline_size.scale_by(0.5)
|
||||
}
|
||||
text_align::T::end => {
|
||||
TextAlign::End => {
|
||||
inline_start_position_for_fragment = inline_start_position_for_fragment +
|
||||
slack_inline_size
|
||||
}
|
||||
text_align::T::left |
|
||||
text_align::T::servo_left |
|
||||
text_align::T::right |
|
||||
text_align::T::servo_right => unreachable!()
|
||||
TextAlign::Left |
|
||||
TextAlign::ServoLeft |
|
||||
TextAlign::Right |
|
||||
TextAlign::ServoRight => unreachable!()
|
||||
}
|
||||
|
||||
// Lay out the fragments in visual order.
|
||||
|
@ -1149,7 +1154,7 @@ impl InlineFlow {
|
|||
update_line_metrics_for_fragment(&mut line_metrics,
|
||||
&inline_metrics,
|
||||
style.get_box().display,
|
||||
VerticalAlign::Baseline,
|
||||
GenericVerticalAlign::Baseline,
|
||||
&mut largest_block_size_for_top_fragments,
|
||||
&mut largest_block_size_for_bottom_fragments);
|
||||
|
||||
|
@ -1185,24 +1190,24 @@ impl InlineFlow {
|
|||
|
||||
fn update_line_metrics_for_fragment(line_metrics: &mut LineMetrics,
|
||||
inline_metrics: &InlineMetrics,
|
||||
display_value: display::T,
|
||||
vertical_align_value: vertical_align::T,
|
||||
display_value: Display,
|
||||
vertical_align_value: VerticalAlign,
|
||||
largest_block_size_for_top_fragments: &mut Au,
|
||||
largest_block_size_for_bottom_fragments: &mut Au) {
|
||||
match (display_value, vertical_align_value) {
|
||||
(display::T::inline, VerticalAlign::Top) |
|
||||
(display::T::block, VerticalAlign::Top) |
|
||||
(display::T::inline_flex, VerticalAlign::Top) |
|
||||
(display::T::inline_block, VerticalAlign::Top) if
|
||||
(Display::Inline, GenericVerticalAlign::Top) |
|
||||
(Display::Block, GenericVerticalAlign::Top) |
|
||||
(Display::InlineFlex, GenericVerticalAlign::Top) |
|
||||
(Display::InlineBlock, GenericVerticalAlign::Top) if
|
||||
inline_metrics.space_above_baseline >= Au(0) => {
|
||||
*largest_block_size_for_top_fragments = max(
|
||||
*largest_block_size_for_top_fragments,
|
||||
inline_metrics.space_above_baseline + inline_metrics.space_below_baseline)
|
||||
}
|
||||
(display::T::inline, VerticalAlign::Bottom) |
|
||||
(display::T::block, VerticalAlign::Bottom) |
|
||||
(display::T::inline_flex, VerticalAlign::Bottom) |
|
||||
(display::T::inline_block, VerticalAlign::Bottom) if
|
||||
(Display::Inline, GenericVerticalAlign::Bottom) |
|
||||
(Display::Block, GenericVerticalAlign::Bottom) |
|
||||
(Display::InlineFlex, GenericVerticalAlign::Bottom) |
|
||||
(Display::InlineBlock, GenericVerticalAlign::Bottom) if
|
||||
inline_metrics.space_below_baseline >= Au(0) => {
|
||||
*largest_block_size_for_bottom_fragments = max(
|
||||
*largest_block_size_for_bottom_fragments,
|
||||
|
@ -1321,11 +1326,11 @@ impl Flow for InlineFlow {
|
|||
for fragment in &mut self.fragments.fragments {
|
||||
let intrinsic_sizes_for_fragment = fragment.compute_intrinsic_inline_sizes().finish();
|
||||
match fragment.style.get_inheritedtext().white_space {
|
||||
white_space::T::nowrap => {
|
||||
WhiteSpace::Nowrap => {
|
||||
intrinsic_sizes_for_nonbroken_run.union_nonbreaking_inline(
|
||||
&intrinsic_sizes_for_fragment)
|
||||
}
|
||||
white_space::T::pre => {
|
||||
WhiteSpace::Pre => {
|
||||
intrinsic_sizes_for_nonbroken_run.union_nonbreaking_inline(
|
||||
&intrinsic_sizes_for_fragment);
|
||||
|
||||
|
@ -1340,8 +1345,8 @@ impl Flow for InlineFlow {
|
|||
intrinsic_sizes_for_inline_run = IntrinsicISizesContribution::new();
|
||||
}
|
||||
}
|
||||
white_space::T::pre_wrap |
|
||||
white_space::T::pre_line => {
|
||||
WhiteSpace::PreWrap |
|
||||
WhiteSpace::PreLine => {
|
||||
// Flush the intrinsic sizes we were gathering up for the nonbroken run, if
|
||||
// necessary.
|
||||
intrinsic_sizes_for_inline_run.union_inline(
|
||||
|
@ -1361,7 +1366,7 @@ impl Flow for InlineFlow {
|
|||
intrinsic_sizes_for_inline_run = IntrinsicISizesContribution::new();
|
||||
}
|
||||
}
|
||||
white_space::T::normal => {
|
||||
WhiteSpace::Normal => {
|
||||
// Flush the intrinsic sizes we were gathering up for the nonbroken run, if
|
||||
// necessary.
|
||||
intrinsic_sizes_for_inline_run.union_inline(
|
||||
|
@ -1720,7 +1725,7 @@ impl Flow for InlineFlow {
|
|||
|
||||
fn contains_relatively_positioned_fragments(&self) -> bool {
|
||||
self.fragments.fragments.iter().any(|fragment| {
|
||||
fragment.style.get_box().position == position::T::relative
|
||||
fragment.style.get_box().position == Position::Relative
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,8 @@ use fragment::{CoordinateSystem, Fragment, FragmentBorderBoxIterator, GeneratedC
|
|||
use fragment::Overflow;
|
||||
use generated_content;
|
||||
use inline::InlineFlow;
|
||||
use style::computed_values::{list_style_type, position};
|
||||
use style::computed_values::list_style_type::T as ListStyleType;
|
||||
use style::computed_values::position::T as Position;
|
||||
use style::logical_geometry::LogicalSize;
|
||||
use style::properties::ComputedValues;
|
||||
use style::servo::restyle_damage::ServoRestyleDamage;
|
||||
|
@ -50,12 +51,12 @@ impl ListItemFlow {
|
|||
|
||||
if let Some(ref marker) = this.marker_fragments.first() {
|
||||
match marker.style().get_list().list_style_type {
|
||||
list_style_type::T::disc |
|
||||
list_style_type::T::none |
|
||||
list_style_type::T::circle |
|
||||
list_style_type::T::square |
|
||||
list_style_type::T::disclosure_open |
|
||||
list_style_type::T::disclosure_closed => {}
|
||||
ListStyleType::Disc |
|
||||
ListStyleType::None |
|
||||
ListStyleType::Circle |
|
||||
ListStyleType::Square |
|
||||
ListStyleType::DisclosureOpen |
|
||||
ListStyleType::DisclosureClosed => {}
|
||||
_ => this.block_flow.base.restyle_damage.insert(ServoRestyleDamage::RESOLVE_GENERATED_CONTENT),
|
||||
}
|
||||
}
|
||||
|
@ -177,7 +178,7 @@ impl Flow for ListItemFlow {
|
|||
}
|
||||
|
||||
/// The 'position' property of this flow.
|
||||
fn positioning(&self) -> position::T {
|
||||
fn positioning(&self) -> Position {
|
||||
self.block_flow.positioning()
|
||||
}
|
||||
|
||||
|
@ -229,13 +230,16 @@ pub enum ListStyleTypeContent {
|
|||
|
||||
impl ListStyleTypeContent {
|
||||
/// Returns the content to be used for the given value of the `list-style-type` property.
|
||||
pub fn from_list_style_type(list_style_type: list_style_type::T) -> ListStyleTypeContent {
|
||||
pub fn from_list_style_type(list_style_type: ListStyleType) -> ListStyleTypeContent {
|
||||
// Just to keep things simple, use a nonbreaking space (Unicode 0xa0) to provide the marker
|
||||
// separation.
|
||||
match list_style_type {
|
||||
list_style_type::T::none => ListStyleTypeContent::None,
|
||||
list_style_type::T::disc | list_style_type::T::circle | list_style_type::T::square |
|
||||
list_style_type::T::disclosure_open | list_style_type::T::disclosure_closed => {
|
||||
ListStyleType::None => ListStyleTypeContent::None,
|
||||
ListStyleType::Disc |
|
||||
ListStyleType::Circle |
|
||||
ListStyleType::Square |
|
||||
ListStyleType::DisclosureOpen |
|
||||
ListStyleType::DisclosureClosed => {
|
||||
let text = generated_content::static_representation(list_style_type);
|
||||
ListStyleTypeContent::StaticText(text)
|
||||
}
|
||||
|
|
|
@ -26,12 +26,12 @@ use sequential;
|
|||
use std::cmp::{min, max};
|
||||
use std::ops::Deref;
|
||||
use std::sync::{Arc, Mutex};
|
||||
use style::computed_values;
|
||||
use style::computed_values::display::T as Display;
|
||||
use style::computed_values::position::T as Position;
|
||||
use style::context::{StyleContext, ThreadLocalStyleContext};
|
||||
use style::dom::TElement;
|
||||
use style::logical_geometry::{WritingMode, BlockFlowDirection, InlineBaseDirection};
|
||||
use style::properties::{style_structs, PropertyId, PropertyDeclarationId, LonghandId};
|
||||
use style::properties::longhands::{display, position};
|
||||
use style::selector_parser::PseudoElement;
|
||||
use style_traits::ToCss;
|
||||
use webrender_api::ClipId;
|
||||
|
@ -531,7 +531,7 @@ impl FragmentBorderBoxIterator for ParentOffsetBorderBoxIterator {
|
|||
});
|
||||
|
||||
// offsetParent returns null if the node is fixed.
|
||||
if fragment.style.get_box().position == computed_values::position::T::fixed {
|
||||
if fragment.style.get_box().position == Position::Fixed {
|
||||
self.parent_nodes.clear();
|
||||
}
|
||||
} else if let Some(node) = fragment.inline_context.as_ref().and_then(|inline_context| {
|
||||
|
@ -579,15 +579,15 @@ impl FragmentBorderBoxIterator for ParentOffsetBorderBoxIterator {
|
|||
// 2) Is static position *and* is a table or table cell
|
||||
// 3) Is not static position
|
||||
(true, _, _) |
|
||||
(false, computed_values::position::T::static_, &SpecificFragmentInfo::Table) |
|
||||
(false, computed_values::position::T::static_, &SpecificFragmentInfo::TableCell) |
|
||||
(false, computed_values::position::T::sticky, _) |
|
||||
(false, computed_values::position::T::absolute, _) |
|
||||
(false, computed_values::position::T::relative, _) |
|
||||
(false, computed_values::position::T::fixed, _) => true,
|
||||
(false, Position::Static, &SpecificFragmentInfo::Table) |
|
||||
(false, Position::Static, &SpecificFragmentInfo::TableCell) |
|
||||
(false, Position::Sticky, _) |
|
||||
(false, Position::Absolute, _) |
|
||||
(false, Position::Relative, _) |
|
||||
(false, Position::Fixed, _) => true,
|
||||
|
||||
// Otherwise, it's not a valid parent
|
||||
(false, computed_values::position::T::static_, _) => false,
|
||||
(false, Position::Static, _) => false,
|
||||
};
|
||||
|
||||
let parent_info = if is_valid_parent {
|
||||
|
@ -751,10 +751,10 @@ where
|
|||
};
|
||||
|
||||
let positioned = match style.get_box().position {
|
||||
position::computed_value::T::relative |
|
||||
position::computed_value::T::sticky |
|
||||
position::computed_value::T::fixed |
|
||||
position::computed_value::T::absolute => true,
|
||||
Position::Relative |
|
||||
Position::Sticky |
|
||||
Position::Fixed |
|
||||
Position::Absolute => true,
|
||||
_ => false
|
||||
};
|
||||
|
||||
|
@ -804,7 +804,7 @@ where
|
|||
LonghandId::MarginLeft | LonghandId::MarginRight |
|
||||
LonghandId::PaddingBottom | LonghandId::PaddingTop |
|
||||
LonghandId::PaddingLeft | LonghandId::PaddingRight
|
||||
if applies && style.get_box().display != display::computed_value::T::none => {
|
||||
if applies && style.get_box().display != Display::None => {
|
||||
let (margin_padding, side) = match longhand_id {
|
||||
LonghandId::MarginBottom => (MarginPadding::Margin, Side::Bottom),
|
||||
LonghandId::MarginTop => (MarginPadding::Margin, Side::Top),
|
||||
|
@ -827,13 +827,11 @@ where
|
|||
},
|
||||
|
||||
LonghandId::Bottom | LonghandId::Top | LonghandId::Right | LonghandId::Left
|
||||
if applies && positioned && style.get_box().display !=
|
||||
display::computed_value::T::none => {
|
||||
if applies && positioned && style.get_box().display != Display::None => {
|
||||
used_value_for_position_property(layout_el, layout_root, requested_node, longhand_id)
|
||||
}
|
||||
LonghandId::Width | LonghandId::Height
|
||||
if applies && style.get_box().display !=
|
||||
display::computed_value::T::none => {
|
||||
if applies && style.get_box().display != Display::None => {
|
||||
used_value_for_position_property(layout_el, layout_root, requested_node, longhand_id)
|
||||
}
|
||||
// FIXME: implement used value computation for line-height
|
||||
|
|
|
@ -68,7 +68,7 @@ impl TableFlow {
|
|||
pub fn from_fragment(fragment: Fragment) -> TableFlow {
|
||||
let mut block_flow = BlockFlow::from_fragment(fragment);
|
||||
let table_layout =
|
||||
if block_flow.fragment().style().get_table().table_layout == table_layout::T::fixed {
|
||||
if block_flow.fragment().style().get_table().table_layout == table_layout::T::Fixed {
|
||||
TableLayout::Fixed
|
||||
} else {
|
||||
TableLayout::Auto
|
||||
|
@ -192,8 +192,8 @@ impl TableFlow {
|
|||
pub fn spacing(&self) -> border_spacing::T {
|
||||
let style = self.block_flow.fragment.style();
|
||||
match style.get_inheritedtable().border_collapse {
|
||||
border_collapse::T::separate => style.get_inheritedtable().border_spacing,
|
||||
border_collapse::T::collapse => border_spacing::T::zero(),
|
||||
border_collapse::T::Separate => style.get_inheritedtable().border_spacing,
|
||||
border_collapse::T::Collapse => border_spacing::T::zero(),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -268,7 +268,7 @@ impl Flow for TableFlow {
|
|||
.fragment
|
||||
.style
|
||||
.get_inheritedtable()
|
||||
.border_collapse == border_collapse::T::collapse;
|
||||
.border_collapse == border_collapse::T::Collapse;
|
||||
let table_inline_collapsed_borders = if collapsing_borders {
|
||||
Some(TableInlineCollapsedBorders {
|
||||
start: CollapsedBorder::inline_start(&*self.block_flow.fragment.style,
|
||||
|
@ -495,8 +495,8 @@ impl Flow for TableFlow {
|
|||
.style
|
||||
.get_inheritedtable()
|
||||
.border_collapse {
|
||||
border_collapse::T::separate => BorderPaintingMode::Separate,
|
||||
border_collapse::T::collapse => BorderPaintingMode::Hidden,
|
||||
border_collapse::T::Separate => BorderPaintingMode::Separate,
|
||||
border_collapse::T::Collapse => BorderPaintingMode::Hidden,
|
||||
};
|
||||
|
||||
self.block_flow.build_display_list_for_block(state, border_painting_mode);
|
||||
|
@ -733,7 +733,7 @@ pub trait TableLikeFlow {
|
|||
impl TableLikeFlow for BlockFlow {
|
||||
fn assign_block_size_for_table_like_flow(&mut self, block_direction_spacing: Au) {
|
||||
debug_assert!(self.fragment.style.get_inheritedtable().border_collapse ==
|
||||
border_collapse::T::separate || block_direction_spacing == Au(0));
|
||||
border_collapse::T::Separate || block_direction_spacing == Au(0));
|
||||
|
||||
if self.base.restyle_damage.contains(ServoRestyleDamage::REFLOW) {
|
||||
// Our current border-box position.
|
||||
|
@ -750,8 +750,8 @@ impl TableLikeFlow for BlockFlow {
|
|||
let child_table_row = kid.as_table_row();
|
||||
current_block_offset = current_block_offset +
|
||||
match self.fragment.style.get_inheritedtable().border_collapse {
|
||||
border_collapse::T::separate => block_direction_spacing,
|
||||
border_collapse::T::collapse => {
|
||||
border_collapse::T::Separate => block_direction_spacing,
|
||||
border_collapse::T::Collapse => {
|
||||
child_table_row.collapsed_border_spacing.block_start
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,11 +20,12 @@ use layout_debug;
|
|||
use model::MaybeAuto;
|
||||
use script_layout_interface::wrapper_traits::ThreadSafeLayoutNode;
|
||||
use std::fmt;
|
||||
use style::computed_values::{border_collapse, border_top_style};
|
||||
use style::computed_values::border_collapse::T as BorderCollapse;
|
||||
use style::logical_geometry::{LogicalMargin, LogicalRect, LogicalSize, WritingMode};
|
||||
use style::properties::ComputedValues;
|
||||
use style::values::computed::Color;
|
||||
use style::values::generics::box_::VerticalAlign;
|
||||
use style::values::specified::BorderStyle;
|
||||
use table::InternalTable;
|
||||
use table_row::{CollapsedBorder, CollapsedBorderProvenance};
|
||||
|
||||
|
@ -259,8 +260,8 @@ impl Flow for TableCellFlow {
|
|||
.style
|
||||
.get_inheritedtable()
|
||||
.border_collapse {
|
||||
border_collapse::T::separate => BorderPaintingMode::Separate,
|
||||
border_collapse::T::collapse => BorderPaintingMode::Collapse(&self.collapsed_borders),
|
||||
BorderCollapse::Separate => BorderPaintingMode::Separate,
|
||||
BorderCollapse::Collapse => BorderPaintingMode::Collapse(&self.collapsed_borders),
|
||||
};
|
||||
|
||||
self.block_flow.build_display_list_for_block(state, border_painting_mode)
|
||||
|
@ -425,7 +426,7 @@ impl CollapsedBordersForCell {
|
|||
pub fn adjust_border_colors_and_styles_for_painting(
|
||||
&self,
|
||||
border_colors: &mut SideOffsets2D<Color>,
|
||||
border_styles: &mut SideOffsets2D<border_top_style::T>,
|
||||
border_styles: &mut SideOffsets2D<BorderStyle>,
|
||||
writing_mode: WritingMode) {
|
||||
let logical_border_colors = LogicalMargin::new(writing_mode,
|
||||
self.block_start_border.color,
|
||||
|
|
|
@ -23,7 +23,9 @@ use serde::{Serialize, Serializer};
|
|||
use std::cmp::max;
|
||||
use std::fmt;
|
||||
use std::iter::{Enumerate, IntoIterator, Peekable};
|
||||
use style::computed_values::{border_collapse, border_spacing, border_top_style};
|
||||
use style::computed_values::border_collapse::T as BorderCollapse;
|
||||
use style::computed_values::border_spacing::T as BorderSpacing;
|
||||
use style::computed_values::border_top_style::T as BorderStyle;
|
||||
use style::logical_geometry::{LogicalSize, PhysicalSide, WritingMode};
|
||||
use style::properties::ComputedValues;
|
||||
use style::servo::restyle_damage::ServoRestyleDamage;
|
||||
|
@ -54,7 +56,7 @@ pub struct TableRowFlow {
|
|||
|
||||
/// The spacing for this row, propagated down from the table during the inline-size assignment
|
||||
/// phase.
|
||||
pub spacing: border_spacing::T,
|
||||
pub spacing: BorderSpacing,
|
||||
|
||||
/// The direction of the columns, propagated down from the table during the inline-size
|
||||
/// assignment phase.
|
||||
|
@ -98,7 +100,7 @@ impl TableRowFlow {
|
|||
cell_intrinsic_inline_sizes: Vec::new(),
|
||||
column_computed_inline_sizes: Vec::new(),
|
||||
incoming_rowspan: Vec::new(),
|
||||
spacing: border_spacing::T::zero(),
|
||||
spacing: BorderSpacing::zero(),
|
||||
table_writing_mode: writing_mode,
|
||||
preliminary_collapsed_borders: CollapsedBordersForRow::new(),
|
||||
final_collapsed_borders: CollapsedBordersForRow::new(),
|
||||
|
@ -259,7 +261,7 @@ impl Flow for TableRowFlow {
|
|||
.fragment
|
||||
.style()
|
||||
.get_inheritedtable()
|
||||
.border_collapse == border_collapse::T::collapse;
|
||||
.border_collapse == BorderCollapse::Collapse;
|
||||
let row_style = &*self.block_flow.fragment.style;
|
||||
self.preliminary_collapsed_borders.reset(
|
||||
CollapsedBorder::inline_start(&row_style,
|
||||
|
@ -408,13 +410,13 @@ impl Flow for TableRowFlow {
|
|||
// Set up border collapse info.
|
||||
let border_collapse_info =
|
||||
match self.block_flow.fragment.style().get_inheritedtable().border_collapse {
|
||||
border_collapse::T::collapse => {
|
||||
BorderCollapse::Collapse => {
|
||||
Some(BorderCollapseInfoForChildTableCell {
|
||||
collapsed_borders_for_row: &self.final_collapsed_borders,
|
||||
collapsed_border_spacing_for_row: &self.collapsed_border_spacing,
|
||||
})
|
||||
}
|
||||
border_collapse::T::separate => None,
|
||||
BorderCollapse::Separate => None,
|
||||
};
|
||||
|
||||
// Push those inline sizes down to the cells.
|
||||
|
@ -473,8 +475,8 @@ impl Flow for TableRowFlow {
|
|||
.style
|
||||
.get_inheritedtable()
|
||||
.border_collapse {
|
||||
border_collapse::T::separate => BorderPaintingMode::Separate,
|
||||
border_collapse::T::collapse => BorderPaintingMode::Hidden,
|
||||
BorderCollapse::Separate => BorderPaintingMode::Separate,
|
||||
BorderCollapse::Collapse => BorderPaintingMode::Hidden,
|
||||
};
|
||||
|
||||
self.block_flow.build_display_list_for_block(state, border_painting_mode);
|
||||
|
@ -578,7 +580,7 @@ impl CollapsedBorderSpacingForRow {
|
|||
#[derive(Clone, Copy, Debug)]
|
||||
pub struct CollapsedBorder {
|
||||
/// The style of the border.
|
||||
pub style: border_top_style::T,
|
||||
pub style: BorderStyle,
|
||||
/// The width of the border.
|
||||
pub width: Au,
|
||||
/// The color of the border.
|
||||
|
@ -615,7 +617,7 @@ impl CollapsedBorder {
|
|||
/// Creates a collapsible border style for no border.
|
||||
pub fn new() -> CollapsedBorder {
|
||||
CollapsedBorder {
|
||||
style: border_top_style::T::none,
|
||||
style: BorderStyle::None,
|
||||
width: Au(0),
|
||||
color: Color::transparent(),
|
||||
provenance: CollapsedBorderProvenance::FromTable,
|
||||
|
@ -723,11 +725,11 @@ impl CollapsedBorder {
|
|||
pub fn combine(&mut self, other: &CollapsedBorder) {
|
||||
match (self.style, other.style) {
|
||||
// Step 1.
|
||||
(border_top_style::T::hidden, _) => {}
|
||||
(_, border_top_style::T::hidden) => *self = *other,
|
||||
(BorderStyle::Hidden, _) => {}
|
||||
(_, BorderStyle::Hidden) => *self = *other,
|
||||
// Step 2.
|
||||
(border_top_style::T::none, _) => *self = *other,
|
||||
(_, border_top_style::T::none) => {}
|
||||
(BorderStyle::None, _) => *self = *other,
|
||||
(_, BorderStyle::None) => {}
|
||||
// Step 3.
|
||||
_ if self.width > other.width => {}
|
||||
_ if self.width < other.width => *self = *other,
|
||||
|
@ -745,7 +747,7 @@ pub fn propagate_column_inline_sizes_to_child(
|
|||
child_flow: &mut Flow,
|
||||
table_writing_mode: WritingMode,
|
||||
column_computed_inline_sizes: &[ColumnComputedInlineSize],
|
||||
border_spacing: &border_spacing::T,
|
||||
border_spacing: &BorderSpacing,
|
||||
incoming_rowspan: &mut Vec<u32>) {
|
||||
// If the child is a row group or a row, the column inline-size and rowspan info should be copied from its
|
||||
// parent.
|
||||
|
@ -814,7 +816,7 @@ fn set_inline_position_of_child_flow(
|
|||
row_writing_mode: WritingMode,
|
||||
table_writing_mode: WritingMode,
|
||||
column_computed_inline_sizes: &[ColumnComputedInlineSize],
|
||||
border_spacing: &border_spacing::T,
|
||||
border_spacing: &BorderSpacing,
|
||||
border_collapse_info: &Option<BorderCollapseInfoForChildTableCell>,
|
||||
parent_content_inline_size: Au,
|
||||
inline_start_margin_edge: &mut Au,
|
||||
|
|
|
@ -152,7 +152,7 @@ impl Flow for TableRowGroupFlow {
|
|||
_writing_mode,
|
||||
_inline_start_margin_edge,
|
||||
_inline_end_margin_edge| {
|
||||
if border_collapse == border_collapse::T::collapse {
|
||||
if border_collapse == border_collapse::T::Collapse {
|
||||
let child_table_row = child_flow.as_mut_table_row();
|
||||
child_table_row.populate_collapsed_border_spacing(
|
||||
collapsed_inline_direction_border_widths_for_table,
|
||||
|
|
|
@ -67,7 +67,7 @@ impl TableWrapperFlow {
|
|||
-> TableWrapperFlow {
|
||||
let mut block_flow = BlockFlow::from_fragment_and_float_kind(fragment, float_kind);
|
||||
let table_layout = if block_flow.fragment().style().get_table().table_layout ==
|
||||
table_layout::T::fixed {
|
||||
table_layout::T::Fixed {
|
||||
TableLayout::Fixed
|
||||
} else {
|
||||
TableLayout::Auto
|
||||
|
|
|
@ -22,8 +22,10 @@ use std::borrow::ToOwned;
|
|||
use std::collections::LinkedList;
|
||||
use std::mem;
|
||||
use std::sync::Arc;
|
||||
use style::computed_values::{text_rendering, text_transform};
|
||||
use style::computed_values::{word_break, white_space};
|
||||
use style::computed_values::text_rendering::T as TextRendering;
|
||||
use style::computed_values::text_transform::T as TextTransform;
|
||||
use style::computed_values::white_space::T as WhiteSpace;
|
||||
use style::computed_values::word_break::T as WordBreak;
|
||||
use style::logical_geometry::{LogicalSize, WritingMode};
|
||||
use style::properties::ComputedValues;
|
||||
use style::properties::style_structs;
|
||||
|
@ -158,11 +160,11 @@ impl TextRunScanner {
|
|||
let inherited_text_style = in_fragment.style().get_inheritedtext();
|
||||
fontgroup = font_context.layout_font_group_for_style(font_style);
|
||||
compression = match in_fragment.white_space() {
|
||||
white_space::T::normal |
|
||||
white_space::T::nowrap => CompressionMode::CompressWhitespaceNewline,
|
||||
white_space::T::pre |
|
||||
white_space::T::pre_wrap => CompressionMode::CompressNone,
|
||||
white_space::T::pre_line => CompressionMode::CompressWhitespace,
|
||||
WhiteSpace::Normal |
|
||||
WhiteSpace::Nowrap => CompressionMode::CompressWhitespaceNewline,
|
||||
WhiteSpace::Pre |
|
||||
WhiteSpace::PreWrap => CompressionMode::CompressNone,
|
||||
WhiteSpace::PreLine => CompressionMode::CompressWhitespace,
|
||||
};
|
||||
text_transform = inherited_text_style.text_transform;
|
||||
letter_spacing = inherited_text_style.letter_spacing;
|
||||
|
@ -293,11 +295,11 @@ impl TextRunScanner {
|
|||
flags.insert(ShapingFlags::IGNORE_LIGATURES_SHAPING_FLAG);
|
||||
}
|
||||
}
|
||||
if text_rendering == text_rendering::T::optimizespeed {
|
||||
if text_rendering == TextRendering::Optimizespeed {
|
||||
flags.insert(ShapingFlags::IGNORE_LIGATURES_SHAPING_FLAG);
|
||||
flags.insert(ShapingFlags::DISABLE_KERNING_SHAPING_FLAG)
|
||||
}
|
||||
if word_break == word_break::T::keep_all {
|
||||
if word_break == WordBreak::KeepAll {
|
||||
flags.insert(ShapingFlags::KEEP_ALL_FLAG);
|
||||
}
|
||||
let options = ShapingOptions {
|
||||
|
@ -597,7 +599,7 @@ impl RunMapping {
|
|||
run_info: &mut RunInfo,
|
||||
text: &str,
|
||||
compression: CompressionMode,
|
||||
text_transform: text_transform::T,
|
||||
text_transform: TextTransform,
|
||||
last_whitespace: &mut bool,
|
||||
start_position: &mut usize,
|
||||
end_position: usize) {
|
||||
|
@ -650,26 +652,26 @@ impl RunMapping {
|
|||
/// use graphemes instead of characters.
|
||||
fn apply_style_transform_if_necessary(string: &mut String,
|
||||
first_character_position: usize,
|
||||
text_transform: text_transform::T,
|
||||
text_transform: TextTransform,
|
||||
last_whitespace: bool,
|
||||
is_first_run: bool) {
|
||||
match text_transform {
|
||||
text_transform::T::none => {}
|
||||
text_transform::T::uppercase => {
|
||||
TextTransform::None => {}
|
||||
TextTransform::Uppercase => {
|
||||
let original = string[first_character_position..].to_owned();
|
||||
string.truncate(first_character_position);
|
||||
for ch in original.chars().flat_map(|ch| ch.to_uppercase()) {
|
||||
string.push(ch);
|
||||
}
|
||||
}
|
||||
text_transform::T::lowercase => {
|
||||
TextTransform::Lowercase => {
|
||||
let original = string[first_character_position..].to_owned();
|
||||
string.truncate(first_character_position);
|
||||
for ch in original.chars().flat_map(|ch| ch.to_lowercase()) {
|
||||
string.push(ch);
|
||||
}
|
||||
}
|
||||
text_transform::T::capitalize => {
|
||||
TextTransform::Capitalize => {
|
||||
let original = string[first_character_position..].to_owned();
|
||||
string.truncate(first_character_position);
|
||||
|
||||
|
|
|
@ -13,7 +13,9 @@ use gfx::display_list::{BorderDetails, BorderRadii, BoxShadowClipMode, ClipScrol
|
|||
use gfx::display_list::{ClipScrollNodeIndex, ClipScrollNodeType, ClippingRegion, DisplayItem};
|
||||
use gfx::display_list::{DisplayList, StackingContextType};
|
||||
use msg::constellation_msg::PipelineId;
|
||||
use style::computed_values::{image_rendering, mix_blend_mode, transform_style};
|
||||
use style::computed_values::image_rendering::T as ImageRendering;
|
||||
use style::computed_values::mix_blend_mode::T as MixBlendMode;
|
||||
use style::computed_values::transform_style::T as TransformStyle;
|
||||
use style::values::computed::{BorderStyle, Filter};
|
||||
use style::values::generics::effects::Filter as GenericFilter;
|
||||
use webrender_api::{self, ClipAndScrollInfo, ClipId, ClipMode, ComplexClipRegion};
|
||||
|
@ -41,16 +43,16 @@ trait ToBorderStyle {
|
|||
impl ToBorderStyle for BorderStyle {
|
||||
fn to_border_style(&self) -> webrender_api::BorderStyle {
|
||||
match *self {
|
||||
BorderStyle::none => webrender_api::BorderStyle::None,
|
||||
BorderStyle::solid => webrender_api::BorderStyle::Solid,
|
||||
BorderStyle::double => webrender_api::BorderStyle::Double,
|
||||
BorderStyle::dotted => webrender_api::BorderStyle::Dotted,
|
||||
BorderStyle::dashed => webrender_api::BorderStyle::Dashed,
|
||||
BorderStyle::hidden => webrender_api::BorderStyle::Hidden,
|
||||
BorderStyle::groove => webrender_api::BorderStyle::Groove,
|
||||
BorderStyle::ridge => webrender_api::BorderStyle::Ridge,
|
||||
BorderStyle::inset => webrender_api::BorderStyle::Inset,
|
||||
BorderStyle::outset => webrender_api::BorderStyle::Outset,
|
||||
BorderStyle::None => webrender_api::BorderStyle::None,
|
||||
BorderStyle::Solid => webrender_api::BorderStyle::Solid,
|
||||
BorderStyle::Double => webrender_api::BorderStyle::Double,
|
||||
BorderStyle::Dotted => webrender_api::BorderStyle::Dotted,
|
||||
BorderStyle::Dashed => webrender_api::BorderStyle::Dashed,
|
||||
BorderStyle::Hidden => webrender_api::BorderStyle::Hidden,
|
||||
BorderStyle::Groove => webrender_api::BorderStyle::Groove,
|
||||
BorderStyle::Ridge => webrender_api::BorderStyle::Ridge,
|
||||
BorderStyle::Inset => webrender_api::BorderStyle::Inset,
|
||||
BorderStyle::Outset => webrender_api::BorderStyle::Outset,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -148,25 +150,25 @@ pub trait ToMixBlendMode {
|
|||
fn to_mix_blend_mode(&self) -> webrender_api::MixBlendMode;
|
||||
}
|
||||
|
||||
impl ToMixBlendMode for mix_blend_mode::T {
|
||||
impl ToMixBlendMode for MixBlendMode {
|
||||
fn to_mix_blend_mode(&self) -> webrender_api::MixBlendMode {
|
||||
match *self {
|
||||
mix_blend_mode::T::normal => webrender_api::MixBlendMode::Normal,
|
||||
mix_blend_mode::T::multiply => webrender_api::MixBlendMode::Multiply,
|
||||
mix_blend_mode::T::screen => webrender_api::MixBlendMode::Screen,
|
||||
mix_blend_mode::T::overlay => webrender_api::MixBlendMode::Overlay,
|
||||
mix_blend_mode::T::darken => webrender_api::MixBlendMode::Darken,
|
||||
mix_blend_mode::T::lighten => webrender_api::MixBlendMode::Lighten,
|
||||
mix_blend_mode::T::color_dodge => webrender_api::MixBlendMode::ColorDodge,
|
||||
mix_blend_mode::T::color_burn => webrender_api::MixBlendMode::ColorBurn,
|
||||
mix_blend_mode::T::hard_light => webrender_api::MixBlendMode::HardLight,
|
||||
mix_blend_mode::T::soft_light => webrender_api::MixBlendMode::SoftLight,
|
||||
mix_blend_mode::T::difference => webrender_api::MixBlendMode::Difference,
|
||||
mix_blend_mode::T::exclusion => webrender_api::MixBlendMode::Exclusion,
|
||||
mix_blend_mode::T::hue => webrender_api::MixBlendMode::Hue,
|
||||
mix_blend_mode::T::saturation => webrender_api::MixBlendMode::Saturation,
|
||||
mix_blend_mode::T::color => webrender_api::MixBlendMode::Color,
|
||||
mix_blend_mode::T::luminosity => webrender_api::MixBlendMode::Luminosity,
|
||||
MixBlendMode::Normal => webrender_api::MixBlendMode::Normal,
|
||||
MixBlendMode::Multiply => webrender_api::MixBlendMode::Multiply,
|
||||
MixBlendMode::Screen => webrender_api::MixBlendMode::Screen,
|
||||
MixBlendMode::Overlay => webrender_api::MixBlendMode::Overlay,
|
||||
MixBlendMode::Darken => webrender_api::MixBlendMode::Darken,
|
||||
MixBlendMode::Lighten => webrender_api::MixBlendMode::Lighten,
|
||||
MixBlendMode::ColorDodge => webrender_api::MixBlendMode::ColorDodge,
|
||||
MixBlendMode::ColorBurn => webrender_api::MixBlendMode::ColorBurn,
|
||||
MixBlendMode::HardLight => webrender_api::MixBlendMode::HardLight,
|
||||
MixBlendMode::SoftLight => webrender_api::MixBlendMode::SoftLight,
|
||||
MixBlendMode::Difference => webrender_api::MixBlendMode::Difference,
|
||||
MixBlendMode::Exclusion => webrender_api::MixBlendMode::Exclusion,
|
||||
MixBlendMode::Hue => webrender_api::MixBlendMode::Hue,
|
||||
MixBlendMode::Saturation => webrender_api::MixBlendMode::Saturation,
|
||||
MixBlendMode::Color => webrender_api::MixBlendMode::Color,
|
||||
MixBlendMode::Luminosity => webrender_api::MixBlendMode::Luminosity,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -175,12 +177,12 @@ trait ToImageRendering {
|
|||
fn to_image_rendering(&self) -> webrender_api::ImageRendering;
|
||||
}
|
||||
|
||||
impl ToImageRendering for image_rendering::T {
|
||||
impl ToImageRendering for ImageRendering {
|
||||
fn to_image_rendering(&self) -> webrender_api::ImageRendering {
|
||||
match *self {
|
||||
image_rendering::T::crisp_edges => webrender_api::ImageRendering::CrispEdges,
|
||||
image_rendering::T::auto => webrender_api::ImageRendering::Auto,
|
||||
image_rendering::T::pixelated => webrender_api::ImageRendering::Pixelated,
|
||||
ImageRendering::CrispEdges => webrender_api::ImageRendering::CrispEdges,
|
||||
ImageRendering::Auto => webrender_api::ImageRendering::Auto,
|
||||
ImageRendering::Pixelated => webrender_api::ImageRendering::Pixelated,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -216,11 +218,11 @@ pub trait ToTransformStyle {
|
|||
fn to_transform_style(&self) -> webrender_api::TransformStyle;
|
||||
}
|
||||
|
||||
impl ToTransformStyle for transform_style::T {
|
||||
impl ToTransformStyle for TransformStyle {
|
||||
fn to_transform_style(&self) -> webrender_api::TransformStyle {
|
||||
match *self {
|
||||
transform_style::T::auto | transform_style::T::flat => webrender_api::TransformStyle::Flat,
|
||||
transform_style::T::preserve_3d => webrender_api::TransformStyle::Preserve3D,
|
||||
TransformStyle::Auto | TransformStyle::Flat => webrender_api::TransformStyle::Flat,
|
||||
TransformStyle::Preserve3d => webrender_api::TransformStyle::Preserve3D,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -379,28 +379,28 @@ impl Element {
|
|||
fn overflow_x_is_visible(&self) -> bool {
|
||||
let window = window_from_node(self);
|
||||
let overflow_pair = window.overflow_query(self.upcast::<Node>().to_trusted_node_address());
|
||||
overflow_pair.x == overflow_x::computed_value::T::visible
|
||||
overflow_pair.x == overflow_x::computed_value::T::Visible
|
||||
}
|
||||
|
||||
// used value of overflow-y is "visible"
|
||||
fn overflow_y_is_visible(&self) -> bool {
|
||||
let window = window_from_node(self);
|
||||
let overflow_pair = window.overflow_query(self.upcast::<Node>().to_trusted_node_address());
|
||||
overflow_pair.y == overflow_y::computed_value::T::visible
|
||||
overflow_pair.y == overflow_y::computed_value::T::Visible
|
||||
}
|
||||
|
||||
// used value of overflow-x is "hidden"
|
||||
fn overflow_x_is_hidden(&self) -> bool {
|
||||
let window = window_from_node(self);
|
||||
let overflow_pair = window.overflow_query(self.upcast::<Node>().to_trusted_node_address());
|
||||
overflow_pair.x == overflow_x::computed_value::T::hidden
|
||||
overflow_pair.x == overflow_x::computed_value::T::Hidden
|
||||
}
|
||||
|
||||
// used value of overflow-y is "hidden"
|
||||
fn overflow_y_is_hidden(&self) -> bool {
|
||||
let window = window_from_node(self);
|
||||
let overflow_pair = window.overflow_query(self.upcast::<Node>().to_trusted_node_address());
|
||||
overflow_pair.y == overflow_y::computed_value::T::hidden
|
||||
overflow_pair.y == overflow_y::computed_value::T::Hidden
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ use servo_arc::Arc;
|
|||
use servo_url::ServoUrl;
|
||||
use std::fmt::Debug;
|
||||
use style::attr::AttrValue;
|
||||
use style::computed_values::display;
|
||||
use style::computed_values::display::T as Display;
|
||||
use style::context::SharedStyleContext;
|
||||
use style::data::ElementData;
|
||||
use style::dom::{LayoutIterator, NodeInfo, TNode};
|
||||
|
@ -197,7 +197,7 @@ pub trait ThreadSafeLayoutNode: Clone + Copy + Debug + GetLayoutData + NodeInfo
|
|||
fn as_element(&self) -> Option<Self::ConcreteThreadSafeLayoutElement>;
|
||||
|
||||
#[inline]
|
||||
fn get_pseudo_element_type(&self) -> PseudoElementType<Option<display::T>> {
|
||||
fn get_pseudo_element_type(&self) -> PseudoElementType<Option<Display>> {
|
||||
self.as_element().map_or(PseudoElementType::Normal, |el| el.get_pseudo_element_type())
|
||||
}
|
||||
|
||||
|
@ -304,7 +304,7 @@ pub trait ThreadSafeLayoutElement
|
|||
|
||||
/// Creates a new `ThreadSafeLayoutElement` for the same `LayoutElement`
|
||||
/// with a different pseudo-element type.
|
||||
fn with_pseudo(&self, pseudo: PseudoElementType<Option<display::T>>) -> Self;
|
||||
fn with_pseudo(&self, pseudo: PseudoElementType<Option<Display>>) -> Self;
|
||||
|
||||
/// Returns the type ID of this node.
|
||||
/// Returns `None` if this is a pseudo-element; otherwise, returns `Some`.
|
||||
|
@ -327,7 +327,7 @@ pub trait ThreadSafeLayoutElement
|
|||
fn style_data(&self) -> AtomicRef<ElementData>;
|
||||
|
||||
#[inline]
|
||||
fn get_pseudo_element_type(&self) -> PseudoElementType<Option<display::T>>;
|
||||
fn get_pseudo_element_type(&self) -> PseudoElementType<Option<Display>>;
|
||||
|
||||
#[inline]
|
||||
fn get_before_pseudo(&self) -> Option<Self> {
|
||||
|
@ -364,7 +364,7 @@ pub trait ThreadSafeLayoutElement
|
|||
let display = if self.get_attr(&ns!(), &local_name!("open")).is_some() {
|
||||
None // Specified by the stylesheet
|
||||
} else {
|
||||
Some(display::T::none)
|
||||
Some(Display::None)
|
||||
};
|
||||
Some(self.with_pseudo(PseudoElementType::DetailsContent(display)))
|
||||
} else {
|
||||
|
|
|
@ -103,11 +103,11 @@ impl KeyframesAnimationState {
|
|||
|
||||
// Update the next iteration direction if applicable.
|
||||
match self.direction {
|
||||
AnimationDirection::alternate |
|
||||
AnimationDirection::alternate_reverse => {
|
||||
AnimationDirection::Alternate |
|
||||
AnimationDirection::AlternateReverse => {
|
||||
self.current_direction = match self.current_direction {
|
||||
AnimationDirection::normal => AnimationDirection::reverse,
|
||||
AnimationDirection::reverse => AnimationDirection::normal,
|
||||
AnimationDirection::Normal => AnimationDirection::Reverse,
|
||||
AnimationDirection::Reverse => AnimationDirection::Normal,
|
||||
_ => unreachable!(),
|
||||
};
|
||||
}
|
||||
|
@ -551,15 +551,15 @@ pub fn maybe_start_animations(context: &SharedStyleContext,
|
|||
let animation_direction = box_style.animation_direction_mod(i);
|
||||
|
||||
let initial_direction = match animation_direction {
|
||||
AnimationDirection::normal |
|
||||
AnimationDirection::alternate => AnimationDirection::normal,
|
||||
AnimationDirection::reverse |
|
||||
AnimationDirection::alternate_reverse => AnimationDirection::reverse,
|
||||
AnimationDirection::Normal |
|
||||
AnimationDirection::Alternate => AnimationDirection::Normal,
|
||||
AnimationDirection::Reverse |
|
||||
AnimationDirection::AlternateReverse => AnimationDirection::Reverse,
|
||||
};
|
||||
|
||||
let running_state = match box_style.animation_play_state_mod(i) {
|
||||
AnimationPlayState::paused => KeyframesRunningState::Paused(0.),
|
||||
AnimationPlayState::running => KeyframesRunningState::Running,
|
||||
AnimationPlayState::Paused => KeyframesRunningState::Paused(0.),
|
||||
AnimationPlayState::Running => KeyframesRunningState::Running,
|
||||
};
|
||||
|
||||
|
||||
|
@ -677,7 +677,7 @@ pub fn update_style_for_animation(context: &SharedStyleContext,
|
|||
let last_keyframe_position;
|
||||
let target_keyframe_position;
|
||||
match state.current_direction {
|
||||
AnimationDirection::normal => {
|
||||
AnimationDirection::Normal => {
|
||||
target_keyframe_position =
|
||||
animation.steps.iter().position(|step| {
|
||||
total_progress as f32 <= step.start_percentage.0
|
||||
|
@ -687,7 +687,7 @@ pub fn update_style_for_animation(context: &SharedStyleContext,
|
|||
if pos != 0 { Some(pos - 1) } else { None }
|
||||
}).unwrap_or(0);
|
||||
}
|
||||
AnimationDirection::reverse => {
|
||||
AnimationDirection::Reverse => {
|
||||
target_keyframe_position =
|
||||
animation.steps.iter().rev().position(|step| {
|
||||
total_progress as f32 <= 1. - step.start_percentage.0
|
||||
|
@ -717,10 +717,10 @@ pub fn update_style_for_animation(context: &SharedStyleContext,
|
|||
let relative_timespan = (target_keyframe.start_percentage.0 - last_keyframe.start_percentage.0).abs();
|
||||
let relative_duration = relative_timespan as f64 * duration;
|
||||
let last_keyframe_ended_at = match state.current_direction {
|
||||
AnimationDirection::normal => {
|
||||
AnimationDirection::Normal => {
|
||||
state.started_at + (total_duration * last_keyframe.start_percentage.0 as f64)
|
||||
}
|
||||
AnimationDirection::reverse => {
|
||||
AnimationDirection::Reverse => {
|
||||
state.started_at + (total_duration * (1. - last_keyframe.start_percentage.0 as f64))
|
||||
}
|
||||
_ => unreachable!(),
|
||||
|
|
|
@ -11,7 +11,7 @@ use invalidation::element::restyle_hints::RestyleHint;
|
|||
#[cfg(feature = "gecko")]
|
||||
use malloc_size_of::MallocSizeOfOps;
|
||||
use properties::ComputedValues;
|
||||
use properties::longhands::display::computed_value as display;
|
||||
use properties::longhands::display::computed_value::T as Display;
|
||||
use rule_tree::StrongRuleNode;
|
||||
use selector_parser::{EAGER_PSEUDO_COUNT, PseudoElement, RestyleDamage};
|
||||
use selectors::NthIndexCache;
|
||||
|
@ -169,7 +169,7 @@ impl ElementStyles {
|
|||
|
||||
/// Whether this element `display` value is `none`.
|
||||
pub fn is_display_none(&self) -> bool {
|
||||
self.primary().get_box().clone_display() == display::T::none
|
||||
self.primary().get_box().clone_display() == Display::None
|
||||
}
|
||||
|
||||
#[cfg(feature = "gecko")]
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
use cssparser::{ToCss, serialize_identifier};
|
||||
use gecko_bindings::structs::{self, CSSPseudoElementType};
|
||||
use properties::{ComputedValues, PropertyFlags};
|
||||
use properties::longhands::display::computed_value as display;
|
||||
use properties::longhands::display::computed_value::T as Display;
|
||||
use selector_parser::{NonTSPseudoClass, PseudoElementCascadeType, SelectorImpl};
|
||||
use std::fmt;
|
||||
use string_cache::Atom;
|
||||
|
@ -161,7 +161,7 @@ impl PseudoElement {
|
|||
/// Whether this pseudo-element should actually exist if it has
|
||||
/// the given styles.
|
||||
pub fn should_exist(&self, style: &ComputedValues) -> bool {
|
||||
if style.get_box().clone_display() == display::T::none {
|
||||
if style.get_box().clone_display() == Display::None {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -102,21 +102,21 @@ macro_rules! map_enum {
|
|||
|
||||
map_enum! {
|
||||
font_style {
|
||||
normal => NS_FONT_STYLE_NORMAL,
|
||||
italic => NS_FONT_STYLE_ITALIC,
|
||||
oblique => NS_FONT_STYLE_OBLIQUE,
|
||||
Normal => NS_FONT_STYLE_NORMAL,
|
||||
Italic => NS_FONT_STYLE_ITALIC,
|
||||
Oblique => NS_FONT_STYLE_OBLIQUE,
|
||||
}
|
||||
|
||||
font_stretch {
|
||||
normal => NS_FONT_STRETCH_NORMAL,
|
||||
ultra_condensed => NS_FONT_STRETCH_ULTRA_CONDENSED,
|
||||
extra_condensed => NS_FONT_STRETCH_EXTRA_CONDENSED,
|
||||
condensed => NS_FONT_STRETCH_CONDENSED,
|
||||
semi_condensed => NS_FONT_STRETCH_SEMI_CONDENSED,
|
||||
semi_expanded => NS_FONT_STRETCH_SEMI_EXPANDED,
|
||||
expanded => NS_FONT_STRETCH_EXPANDED,
|
||||
extra_expanded => NS_FONT_STRETCH_EXTRA_EXPANDED,
|
||||
ultra_expanded => NS_FONT_STRETCH_ULTRA_EXPANDED,
|
||||
Normal => NS_FONT_STRETCH_NORMAL,
|
||||
UltraCondensed => NS_FONT_STRETCH_ULTRA_CONDENSED,
|
||||
ExtraCondensed => NS_FONT_STRETCH_EXTRA_CONDENSED,
|
||||
Condensed => NS_FONT_STRETCH_CONDENSED,
|
||||
SemiCondensed => NS_FONT_STRETCH_SEMI_CONDENSED,
|
||||
SemiExpanded => NS_FONT_STRETCH_SEMI_EXPANDED,
|
||||
Expanded => NS_FONT_STRETCH_EXPANDED,
|
||||
ExtraExpanded => NS_FONT_STRETCH_EXTRA_EXPANDED,
|
||||
UltraExpanded => NS_FONT_STRETCH_ULTRA_EXPANDED,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1446,7 +1446,7 @@ impl<'le> TElement for GeckoElement<'le> {
|
|||
old_values: Option<&ComputedValues>,
|
||||
new_values: &ComputedValues,
|
||||
) -> bool {
|
||||
use properties::longhands::display::computed_value as display;
|
||||
use properties::longhands::display::computed_value::T as Display;
|
||||
|
||||
let old_values = match old_values {
|
||||
Some(v) => v,
|
||||
|
@ -1462,8 +1462,8 @@ impl<'le> TElement for GeckoElement<'le> {
|
|||
|
||||
new_box_style.transition_property_count() > 0 &&
|
||||
!transition_not_running &&
|
||||
(new_display_style != display::T::none &&
|
||||
old_display_style != display::T::none)
|
||||
(new_display_style != Display::None &&
|
||||
old_display_style != Display::None)
|
||||
}
|
||||
|
||||
// Detect if there are any changes that require us to update transitions.
|
||||
|
|
|
@ -42,34 +42,34 @@ bitflags!(
|
|||
impl WritingMode {
|
||||
/// Return a WritingMode bitflags from the relevant CSS properties.
|
||||
pub fn new(inheritedbox_style: &style_structs::InheritedBox) -> Self {
|
||||
use properties::longhands::direction::computed_value::T as direction;
|
||||
use properties::longhands::writing_mode::computed_value::T as writing_mode;
|
||||
use properties::longhands::direction::computed_value::T as Direction;
|
||||
use properties::longhands::writing_mode::computed_value::T as SpecifiedWritingMode;
|
||||
|
||||
let mut flags = WritingMode::empty();
|
||||
|
||||
match inheritedbox_style.clone_direction() {
|
||||
direction::ltr => {},
|
||||
direction::rtl => {
|
||||
Direction::Ltr => {},
|
||||
Direction::Rtl => {
|
||||
flags.insert(WritingMode::RTL);
|
||||
},
|
||||
}
|
||||
|
||||
match inheritedbox_style.clone_writing_mode() {
|
||||
writing_mode::horizontal_tb => {},
|
||||
writing_mode::vertical_rl => {
|
||||
SpecifiedWritingMode::HorizontalTb => {},
|
||||
SpecifiedWritingMode::VerticalRl => {
|
||||
flags.insert(WritingMode::VERTICAL);
|
||||
},
|
||||
writing_mode::vertical_lr => {
|
||||
SpecifiedWritingMode::VerticalLr => {
|
||||
flags.insert(WritingMode::VERTICAL);
|
||||
flags.insert(WritingMode::VERTICAL_LR);
|
||||
},
|
||||
#[cfg(feature = "gecko")]
|
||||
writing_mode::sideways_rl => {
|
||||
SpecifiedWritingMode::SidewaysRl => {
|
||||
flags.insert(WritingMode::VERTICAL);
|
||||
flags.insert(WritingMode::SIDEWAYS);
|
||||
},
|
||||
#[cfg(feature = "gecko")]
|
||||
writing_mode::sideways_lr => {
|
||||
SpecifiedWritingMode::SidewaysLr => {
|
||||
flags.insert(WritingMode::VERTICAL);
|
||||
flags.insert(WritingMode::VERTICAL_LR);
|
||||
flags.insert(WritingMode::LINE_INVERTED);
|
||||
|
@ -79,18 +79,18 @@ impl WritingMode {
|
|||
|
||||
#[cfg(feature = "gecko")]
|
||||
{
|
||||
use properties::longhands::text_orientation::computed_value::T as text_orientation;
|
||||
use properties::longhands::text_orientation::computed_value::T as TextOrientation;
|
||||
|
||||
// If FLAG_SIDEWAYS is already set, this means writing-mode is
|
||||
// either sideways-rl or sideways-lr, and for both of these values,
|
||||
// text-orientation has no effect.
|
||||
if !flags.intersects(WritingMode::SIDEWAYS) {
|
||||
match inheritedbox_style.clone_text_orientation() {
|
||||
text_orientation::mixed => {},
|
||||
text_orientation::upright => {
|
||||
TextOrientation::Mixed => {},
|
||||
TextOrientation::Upright => {
|
||||
flags.insert(WritingMode::UPRIGHT);
|
||||
},
|
||||
text_orientation::sideways => {
|
||||
TextOrientation::Sideways => {
|
||||
flags.insert(WritingMode::SIDEWAYS);
|
||||
},
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ use data::ElementData;
|
|||
use dom::TElement;
|
||||
use invalidation::element::restyle_hints::RestyleHint;
|
||||
use properties::ComputedValues;
|
||||
use properties::longhands::display::computed_value as display;
|
||||
use properties::longhands::display::computed_value::T as Display;
|
||||
use rule_tree::{CascadeLevel, StrongRuleNode};
|
||||
use selector_parser::{PseudoElement, RestyleDamage};
|
||||
use selectors::matching::ElementSelectorFlags;
|
||||
|
@ -151,11 +151,11 @@ trait PrivateMatchMethods: TElement {
|
|||
(context.shared.traversal_flags.contains(TraversalFlags::ForCSSRuleChanges) &&
|
||||
(has_new_animation_style || has_animations)) ||
|
||||
!old_box_style.animations_equals(new_box_style) ||
|
||||
(old_display_style == display::T::none &&
|
||||
new_display_style != display::T::none &&
|
||||
(old_display_style == Display::None &&
|
||||
new_display_style != Display::None &&
|
||||
has_new_animation_style) ||
|
||||
(old_display_style != display::T::none &&
|
||||
new_display_style == display::T::none &&
|
||||
(old_display_style != Display::None &&
|
||||
new_display_style == Display::None &&
|
||||
has_animations)
|
||||
})
|
||||
}
|
||||
|
@ -179,8 +179,8 @@ trait PrivateMatchMethods: TElement {
|
|||
let display_changed_from_none = old_values.map_or(false, |old| {
|
||||
let old_display_style = old.get_box().clone_display();
|
||||
let new_display_style = new_values.get_box().clone_display();
|
||||
old_display_style == display::T::none &&
|
||||
new_display_style != display::T::none
|
||||
old_display_style == Display::None &&
|
||||
new_display_style != Display::None
|
||||
});
|
||||
|
||||
if display_changed_from_none {
|
||||
|
@ -363,7 +363,7 @@ trait PrivateMatchMethods: TElement {
|
|||
// NOTE(emilio): Gecko has the special-case of -moz-binding, but
|
||||
// that gets handled on the frame constructor when processing
|
||||
// the reframe, so no need to handle that here.
|
||||
if old_display == display::T::none && old_display != new_display {
|
||||
if old_display == Display::None && old_display != new_display {
|
||||
return ChildCascadeRequirement::MustCascadeChildren
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ def to_rust_ident(name):
|
|||
|
||||
|
||||
def to_camel_case(ident):
|
||||
return re.sub("(^|_|-)([a-z])", lambda m: m.group(2).upper(), ident.strip("_").strip("-"))
|
||||
return re.sub("(^|_|-)([a-z0-9])", lambda m: m.group(2).upper(), ident.strip("_").strip("-"))
|
||||
|
||||
|
||||
def to_camel_case_lower(ident):
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
// `data` comes from components/style/properties.mako.rs; see build.rs for more details.
|
||||
|
||||
<%!
|
||||
from data import to_rust_ident, to_camel_case, to_camel_case_lower
|
||||
from data import to_camel_case, to_camel_case_lower
|
||||
from data import Keyword
|
||||
%>
|
||||
<%namespace name="helpers" file="/helpers.mako.rs" />
|
||||
|
@ -258,7 +258,7 @@ impl ComputedValuesInner {
|
|||
|
||||
#[inline]
|
||||
pub fn is_display_contents(&self) -> bool {
|
||||
self.get_box().clone_display() == longhands::display::computed_value::T::contents
|
||||
self.get_box().clone_display() == longhands::display::computed_value::T::Contents
|
||||
}
|
||||
|
||||
/// Returns true if the value of the `content` property would make a
|
||||
|
@ -404,7 +404,7 @@ def set_gecko_property(ffi_name, expr):
|
|||
// FIXME(bholley): Align binary representations and ditch |match| for cast + static_asserts
|
||||
let result = match v {
|
||||
% for value in keyword.values_for('gecko'):
|
||||
Keyword::${to_rust_ident(value)} =>
|
||||
Keyword::${to_camel_case(value)} =>
|
||||
structs::${keyword.gecko_constant(value)} ${keyword.maybe_cast(cast_type)},
|
||||
% endfor
|
||||
};
|
||||
|
@ -437,7 +437,7 @@ def set_gecko_property(ffi_name, expr):
|
|||
|
||||
match ${get_gecko_property(gecko_ffi_name)} as ${cast_type} {
|
||||
% for value in keyword.values_for('gecko'):
|
||||
${keyword.casted_constant_name(value, cast_type)} => Keyword::${to_rust_ident(value)},
|
||||
${keyword.casted_constant_name(value, cast_type)} => Keyword::${to_camel_case(value)},
|
||||
% endfor
|
||||
% if keyword.gecko_inexhaustive:
|
||||
x => panic!("Found unexpected value in style struct for ${ident} property: {:?}", x),
|
||||
|
@ -446,7 +446,7 @@ def set_gecko_property(ffi_name, expr):
|
|||
% else:
|
||||
match ${get_gecko_property(gecko_ffi_name)} {
|
||||
% for value in keyword.values_for('gecko'):
|
||||
structs::${keyword.gecko_constant(value)} => Keyword::${to_rust_ident(value)},
|
||||
structs::${keyword.gecko_constant(value)} => Keyword::${to_camel_case(value)},
|
||||
% endfor
|
||||
% if keyword.gecko_inexhaustive:
|
||||
x => panic!("Found unexpected value in style struct for ${ident} property: {:?}", x),
|
||||
|
@ -2348,7 +2348,7 @@ fn static_assert() {
|
|||
// cast + static_asserts
|
||||
let result = match v {
|
||||
% for value in border_style_keyword.values_for('gecko'):
|
||||
Either::Second(border_style::T::${to_rust_ident(value)}) =>
|
||||
Either::Second(border_style::T::${to_camel_case(value)}) =>
|
||||
structs::${border_style_keyword.gecko_constant(value)} ${border_style_keyword.maybe_cast("u8")},
|
||||
% endfor
|
||||
Either::First(Auto) =>
|
||||
|
@ -2377,7 +2377,9 @@ fn static_assert() {
|
|||
// FIXME(bholley): Align binary representations and ditch |match| for cast + static_asserts
|
||||
match ${get_gecko_property("mOutlineStyle")} ${border_style_keyword.maybe_cast("u32")} {
|
||||
% for value in border_style_keyword.values_for('gecko'):
|
||||
structs::${border_style_keyword.gecko_constant(value)} => Either::Second(border_style::T::${value}),
|
||||
structs::${border_style_keyword.gecko_constant(value)} => {
|
||||
Either::Second(border_style::T::${to_camel_case(value)})
|
||||
},
|
||||
% endfor
|
||||
structs::${border_style_keyword.gecko_constant('auto')} => Either::First(Auto),
|
||||
% if border_style_keyword.gecko_inexhaustive:
|
||||
|
@ -3065,7 +3067,7 @@ fn static_assert() {
|
|||
for (gecko, servo) in self.gecko.mAnimations.iter_mut().zip(v.cycle()) {
|
||||
let result = match servo {
|
||||
% for value in keyword.gecko_values():
|
||||
Keyword::${to_rust_ident(value)} =>
|
||||
Keyword::${to_camel_case(value)} =>
|
||||
structs::${keyword.gecko_constant(value)} ${keyword.maybe_cast(cast_type)},
|
||||
% endfor
|
||||
};
|
||||
|
@ -3078,7 +3080,7 @@ fn static_assert() {
|
|||
use properties::longhands::animation_${ident}::single_value::computed_value::T as Keyword;
|
||||
match self.gecko.mAnimations[index].m${gecko_ffi_name} ${keyword.maybe_cast("u32")} {
|
||||
% for value in keyword.gecko_values():
|
||||
structs::${keyword.gecko_constant(value)} => Keyword::${to_rust_ident(value)},
|
||||
structs::${keyword.gecko_constant(value)} => Keyword::${to_camel_case(value)},
|
||||
% endfor
|
||||
x => panic!("Found unexpected value for animation-${ident}: {:?}", x),
|
||||
}
|
||||
|
@ -3121,7 +3123,7 @@ fn static_assert() {
|
|||
// FIXME(bholley): Align binary representations and ditch |match| for cast + static_asserts
|
||||
let result = match v {
|
||||
% for value in display_keyword.values_for('gecko'):
|
||||
Keyword::${to_rust_ident(value)} =>
|
||||
Keyword::${to_camel_case(value)} =>
|
||||
structs::${display_keyword.gecko_constant(value)},
|
||||
% endfor
|
||||
};
|
||||
|
@ -3138,7 +3140,7 @@ fn static_assert() {
|
|||
use properties::longhands::display::computed_value::T as Keyword;
|
||||
let result = match v {
|
||||
% for value in display_keyword.values_for('gecko'):
|
||||
Keyword::${to_rust_ident(value)} =>
|
||||
Keyword::${to_camel_case(value)} =>
|
||||
structs::${display_keyword.gecko_constant(value)},
|
||||
% endfor
|
||||
};
|
||||
|
@ -3162,7 +3164,7 @@ fn static_assert() {
|
|||
// FIXME(bholley): Align binary representations and ditch |match| for cast + static_asserts
|
||||
self.gecko.mOverflowY = match v {
|
||||
% for value in overflow_x.keyword.values_for('gecko'):
|
||||
BaseType::${to_rust_ident(value)} => structs::${overflow_x.keyword.gecko_constant(value)} as u8,
|
||||
BaseType::${to_camel_case(value)} => structs::${overflow_x.keyword.gecko_constant(value)} as u8,
|
||||
% endfor
|
||||
};
|
||||
}
|
||||
|
@ -3172,7 +3174,7 @@ fn static_assert() {
|
|||
// FIXME(bholley): Align binary representations and ditch |match| for cast + static_asserts
|
||||
match self.gecko.mOverflowY as u32 {
|
||||
% for value in overflow_x.keyword.values_for('gecko'):
|
||||
structs::${overflow_x.keyword.gecko_constant(value)} => BaseType::${to_rust_ident(value)},
|
||||
structs::${overflow_x.keyword.gecko_constant(value)} => BaseType::${to_camel_case(value)},
|
||||
% endfor
|
||||
x => panic!("Found unexpected value in style struct for overflow_y property: {}", x),
|
||||
}
|
||||
|
@ -3228,11 +3230,11 @@ fn static_assert() {
|
|||
use computed_values::page_break_${kind}::T;
|
||||
|
||||
let result = match v {
|
||||
T::auto => false,
|
||||
T::always => true,
|
||||
T::avoid => false,
|
||||
T::left => true,
|
||||
T::right => true
|
||||
T::Auto => false,
|
||||
T::Always => true,
|
||||
T::Avoid => false,
|
||||
T::Left => true,
|
||||
T::Right => true
|
||||
};
|
||||
self.gecko.mBreak${kind.title()} = result;
|
||||
}
|
||||
|
@ -3244,10 +3246,7 @@ fn static_assert() {
|
|||
pub fn clone_page_break_${kind}(&self) -> longhands::page_break_${kind}::computed_value::T {
|
||||
use computed_values::page_break_${kind}::T;
|
||||
|
||||
match self.gecko.mBreak${kind.title()} {
|
||||
true => T::always,
|
||||
false => T::auto,
|
||||
}
|
||||
if self.gecko.mBreak${kind.title()} { T::Always } else { T::Auto }
|
||||
}
|
||||
% endfor
|
||||
|
||||
|
@ -3776,7 +3775,7 @@ fn static_assert() {
|
|||
geckolayer.${field_name} = {
|
||||
match servo {
|
||||
% for value in keyword.values_for("gecko"):
|
||||
Keyword::${to_rust_ident(value)} =>
|
||||
Keyword::${to_camel_case(value)} =>
|
||||
structs::${keyword.gecko_constant(value)} ${keyword.maybe_cast('u8')},
|
||||
% endfor
|
||||
}
|
||||
|
@ -3805,7 +3804,7 @@ fn static_assert() {
|
|||
% else:
|
||||
structs::${keyword.gecko_constant(value)}
|
||||
% endif
|
||||
=> Keyword::${to_rust_ident(value)},
|
||||
=> Keyword::${to_camel_case(value)},
|
||||
% endfor
|
||||
x => panic!("Found unexpected value in style struct for ${ident} property: {:?}", x),
|
||||
}
|
||||
|
|
|
@ -441,7 +441,7 @@
|
|||
use style_traits::ParseError;
|
||||
define_css_keyword_enum! { T:
|
||||
% for value in keyword.values_for(product):
|
||||
"${value}" => ${to_rust_ident(value)},
|
||||
"${value}" => ${to_camel_case(value)},
|
||||
% endfor
|
||||
}
|
||||
|
||||
|
@ -486,11 +486,11 @@
|
|||
|
||||
#[inline]
|
||||
pub fn get_initial_value() -> computed_value::T {
|
||||
computed_value::T::${to_rust_ident(values.split()[0])}
|
||||
computed_value::T::${to_camel_case(values.split()[0])}
|
||||
}
|
||||
#[inline]
|
||||
pub fn get_initial_specified_value() -> SpecifiedValue {
|
||||
SpecifiedValue::Keyword(computed_value::T::${to_rust_ident(values.split()[0])})
|
||||
SpecifiedValue::Keyword(computed_value::T::${to_camel_case(values.split()[0])})
|
||||
}
|
||||
|
||||
impl SpecifiedValue {
|
||||
|
@ -510,6 +510,8 @@
|
|||
|
||||
<%def name="single_keyword(name, values, vector=False, **kwargs)">
|
||||
<%call expr="single_keyword_computed(name, values, vector, **kwargs)">
|
||||
// FIXME(emilio): WTF is this even trying to do? Those are no-ops,
|
||||
// should be derived instead!
|
||||
impl ToComputedValue for SpecifiedValue {
|
||||
type ComputedValue = computed_value::T;
|
||||
|
||||
|
@ -517,7 +519,7 @@
|
|||
fn to_computed_value(&self, _context: &Context) -> computed_value::T {
|
||||
match *self {
|
||||
% for value in data.longhands_by_name[name].keyword.values_for(product):
|
||||
SpecifiedValue::${to_rust_ident(value)} => computed_value::T::${to_rust_ident(value)},
|
||||
SpecifiedValue::${to_camel_case(value)} => computed_value::T::${to_camel_case(value)},
|
||||
% endfor
|
||||
}
|
||||
}
|
||||
|
@ -525,7 +527,7 @@
|
|||
fn from_computed_value(computed: &computed_value::T) -> Self {
|
||||
match *computed {
|
||||
% for value in data.longhands_by_name[name].keyword.values_for(product):
|
||||
computed_value::T::${to_rust_ident(value)} => SpecifiedValue::${to_rust_ident(value)},
|
||||
computed_value::T::${to_camel_case(value)} => SpecifiedValue::${to_camel_case(value)},
|
||||
% endfor
|
||||
}
|
||||
}
|
||||
|
@ -554,7 +556,7 @@
|
|||
% endfor
|
||||
match kw ${maybe_cast} {
|
||||
% for value in values:
|
||||
${to_rust_ident(value).upper()} => ${type}::${to_rust_ident(value)},
|
||||
${to_rust_ident(value).upper()} => ${type}::${to_camel_case(value)},
|
||||
% endfor
|
||||
x => panic!("Found unexpected value in style struct for ${keyword.name} property: {:?}", x),
|
||||
}
|
||||
|
@ -616,12 +618,12 @@
|
|||
define_css_keyword_enum! { SpecifiedValue:
|
||||
values {
|
||||
% for value in keyword.values_for(product) + (extra_specified or "").split():
|
||||
"${value}" => ${to_rust_ident(value)},
|
||||
"${value}" => ${to_camel_case(value)},
|
||||
% endfor
|
||||
}
|
||||
aliases {
|
||||
% for alias, value in keyword.aliases_for(product).iteritems():
|
||||
"${alias}" => ${to_rust_ident(value)},
|
||||
"${alias}" => ${to_camel_case(value)},
|
||||
% endfor
|
||||
}
|
||||
}
|
||||
|
@ -631,17 +633,17 @@
|
|||
pub mod computed_value {
|
||||
define_css_keyword_enum! { T:
|
||||
% for value in data.longhands_by_name[name].keyword.values_for(product):
|
||||
"${value}" => ${to_rust_ident(value)},
|
||||
"${value}" => ${to_camel_case(value)},
|
||||
% endfor
|
||||
}
|
||||
}
|
||||
#[inline]
|
||||
pub fn get_initial_value() -> computed_value::T {
|
||||
computed_value::T::${to_rust_ident(values.split()[0])}
|
||||
computed_value::T::${to_camel_case(values.split()[0])}
|
||||
}
|
||||
#[inline]
|
||||
pub fn get_initial_specified_value() -> SpecifiedValue {
|
||||
SpecifiedValue::${to_rust_ident(values.split()[0])}
|
||||
SpecifiedValue::${to_camel_case(values.split()[0])}
|
||||
}
|
||||
#[inline]
|
||||
pub fn parse<'i, 't>(_context: &ParserContext, input: &mut Parser<'i, 't>)
|
||||
|
|
|
@ -658,10 +658,10 @@ impl Animate for Visibility {
|
|||
fn animate(&self, other: &Self, procedure: Procedure) -> Result<Self, ()> {
|
||||
let (this_weight, other_weight) = procedure.weights();
|
||||
match (*self, *other) {
|
||||
(Visibility::visible, _) => {
|
||||
(Visibility::Visible, _) => {
|
||||
Ok(if this_weight > 0.0 { *self } else { *other })
|
||||
},
|
||||
(_, Visibility::visible) => {
|
||||
(_, Visibility::Visible) => {
|
||||
Ok(if other_weight > 0.0 { *other } else { *self })
|
||||
},
|
||||
_ => Err(()),
|
||||
|
@ -763,7 +763,7 @@ impl Animate for FontStretch {
|
|||
{
|
||||
let from = f64::from(*self);
|
||||
let to = f64::from(*other);
|
||||
let normal = f64::from(FontStretch::normal);
|
||||
let normal = f64::from(FontStretch::Normal);
|
||||
let (this_weight, other_weight) = procedure.weights();
|
||||
let result = (from - normal) * this_weight + (to - normal) * other_weight + normal;
|
||||
Ok(result.into())
|
||||
|
@ -788,15 +788,15 @@ impl From<FontStretch> for f64 {
|
|||
fn from(stretch: FontStretch) -> f64 {
|
||||
use self::FontStretch::*;
|
||||
match stretch {
|
||||
ultra_condensed => 1.0,
|
||||
extra_condensed => 2.0,
|
||||
condensed => 3.0,
|
||||
semi_condensed => 4.0,
|
||||
normal => 5.0,
|
||||
semi_expanded => 6.0,
|
||||
expanded => 7.0,
|
||||
extra_expanded => 8.0,
|
||||
ultra_expanded => 9.0,
|
||||
UltraCondensed => 1.0,
|
||||
ExtraCondensed => 2.0,
|
||||
Condensed => 3.0,
|
||||
SemiCondensed => 4.0,
|
||||
Normal => 5.0,
|
||||
SemiExpanded => 6.0,
|
||||
Expanded => 7.0,
|
||||
ExtraExpanded => 8.0,
|
||||
UltraExpanded => 9.0,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -806,8 +806,8 @@ impl Into<FontStretch> for f64 {
|
|||
use properties::longhands::font_stretch::computed_value::T::*;
|
||||
let index = (self + 0.5).floor().min(9.0).max(1.0);
|
||||
static FONT_STRETCH_ENUM_MAP: [FontStretch; 9] =
|
||||
[ ultra_condensed, extra_condensed, condensed, semi_condensed, normal,
|
||||
semi_expanded, expanded, extra_expanded, ultra_expanded ];
|
||||
[ UltraCondensed, ExtraCondensed, Condensed, SemiCondensed, Normal,
|
||||
SemiExpanded, Expanded, ExtraExpanded, UltraExpanded ];
|
||||
FONT_STRETCH_ENUM_MAP[(index - 1.0) as usize]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
)}
|
||||
|
||||
${helpers.predefined_type("border-%s-style" % side_name, "BorderStyle",
|
||||
"specified::BorderStyle::none",
|
||||
"specified::BorderStyle::None",
|
||||
alias=maybe_moz_logical_alias(product, side, "-moz-border-%s-style"),
|
||||
spec=maybe_logical_spec(side, "style"),
|
||||
flags="APPLIES_TO_FIRST_LETTER",
|
||||
|
|
|
@ -37,19 +37,20 @@
|
|||
|
||||
pub mod computed_value {
|
||||
pub use super::SpecifiedValue as T;
|
||||
use super::SpecifiedValue as Display;
|
||||
|
||||
impl T {
|
||||
impl Display {
|
||||
/// Returns whether this "display" value is the display of a flex or
|
||||
/// grid container.
|
||||
///
|
||||
/// This is used to implement various style fixups.
|
||||
pub fn is_item_container(&self) -> bool {
|
||||
matches!(*self,
|
||||
T::flex
|
||||
| T::inline_flex
|
||||
Display::Flex
|
||||
| Display::InlineFlex
|
||||
% if product == "gecko":
|
||||
| T::grid
|
||||
| T::inline_grid
|
||||
| Display::Grid
|
||||
| Display::InlineGrid
|
||||
% endif
|
||||
)
|
||||
}
|
||||
|
@ -59,11 +60,11 @@
|
|||
/// line as itself.
|
||||
pub fn is_line_participant(&self) -> bool {
|
||||
matches!(*self,
|
||||
T::inline
|
||||
Display::Inline
|
||||
% if product == "gecko":
|
||||
| T::contents
|
||||
| T::ruby
|
||||
| T::ruby_base_container
|
||||
| Display::Contents
|
||||
| Display::Ruby
|
||||
| Display::RubyBaseContainer
|
||||
% endif
|
||||
)
|
||||
}
|
||||
|
@ -84,8 +85,8 @@
|
|||
#[cfg(feature = "gecko")]
|
||||
{
|
||||
match (_old_display, _new_display) {
|
||||
(T::_webkit_box, T::_moz_box) |
|
||||
(T::_webkit_inline_box, T::_moz_inline_box) => {
|
||||
(Display::WebkitBox, Display::MozBox) |
|
||||
(Display::WebkitInlineBox, Display::MozInlineBox) => {
|
||||
return true;
|
||||
}
|
||||
_ => {},
|
||||
|
@ -99,14 +100,20 @@
|
|||
/// ruby.
|
||||
#[cfg(feature = "gecko")]
|
||||
pub fn is_ruby_type(&self) -> bool {
|
||||
matches!(*self, T::ruby | T::ruby_base | T::ruby_text |
|
||||
T::ruby_base_container | T::ruby_text_container)
|
||||
matches!(*self,
|
||||
Display::Ruby |
|
||||
Display::RubyBase |
|
||||
Display::RubyText |
|
||||
Display::RubyBaseContainer |
|
||||
Display::RubyTextContainer)
|
||||
}
|
||||
|
||||
/// Returns whether this "display" value is a ruby level container.
|
||||
#[cfg(feature = "gecko")]
|
||||
pub fn is_ruby_level_container(&self) -> bool {
|
||||
matches!(*self, T::ruby_base_container | T::ruby_text_container)
|
||||
matches!(*self,
|
||||
Display::RubyBaseContainer |
|
||||
Display::RubyTextContainer)
|
||||
}
|
||||
|
||||
/// Convert this display into an equivalent block display.
|
||||
|
@ -115,28 +122,36 @@
|
|||
pub fn equivalent_block_display(&self, _is_root_element: bool) -> Self {
|
||||
match *self {
|
||||
// Values that have a corresponding block-outside version.
|
||||
T::inline_table => T::table,
|
||||
T::inline_flex => T::flex,
|
||||
Display::InlineTable => Display::Table,
|
||||
Display::InlineFlex => Display::Flex,
|
||||
|
||||
% if product == "gecko":
|
||||
T::inline_grid => T::grid,
|
||||
T::_webkit_inline_box => T::_webkit_box,
|
||||
Display::InlineGrid => Display::Grid,
|
||||
Display::WebkitInlineBox => Display::WebkitBox,
|
||||
% endif
|
||||
|
||||
// Special handling for contents and list-item on the root
|
||||
// element for Gecko.
|
||||
% if product == "gecko":
|
||||
T::contents | T::list_item if _is_root_element => T::block,
|
||||
Display::Contents | Display::ListItem if _is_root_element => Display::Block,
|
||||
% endif
|
||||
|
||||
// These are not changed by blockification.
|
||||
T::none | T::block | T::flex | T::list_item | T::table => *self,
|
||||
Display::None |
|
||||
Display::Block |
|
||||
Display::Flex |
|
||||
Display::ListItem |
|
||||
Display::Table => *self,
|
||||
|
||||
% if product == "gecko":
|
||||
T::contents | T::flow_root | T::grid | T::_webkit_box => *self,
|
||||
Display::Contents |
|
||||
Display::FlowRoot |
|
||||
Display::Grid |
|
||||
Display::WebkitBox => *self,
|
||||
% endif
|
||||
|
||||
// Everything else becomes block.
|
||||
_ => T::block,
|
||||
_ => Display::Block,
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -148,35 +163,38 @@
|
|||
#[cfg(feature = "gecko")]
|
||||
pub fn inlinify(&self) -> Self {
|
||||
match *self {
|
||||
T::block | T::flow_root => T::inline_block,
|
||||
T::table => T::inline_table,
|
||||
T::flex => T::inline_flex,
|
||||
T::grid => T::inline_grid,
|
||||
T::_moz_box => T::_moz_inline_box,
|
||||
T::_moz_stack => T::_moz_inline_stack,
|
||||
T::_webkit_box => T::_webkit_inline_box,
|
||||
Display::Block |
|
||||
Display::FlowRoot => Display::InlineBlock,
|
||||
Display::Table => Display::InlineTable,
|
||||
Display::Flex => Display::InlineFlex,
|
||||
Display::Grid => Display::InlineGrid,
|
||||
Display::MozBox => Display::MozInlineBox,
|
||||
Display::MozStack => Display::MozInlineStack,
|
||||
Display::WebkitBox => Display::WebkitInlineBox,
|
||||
other => other,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME(emilio): Why does this reinvent the wheel, again?
|
||||
#[allow(non_camel_case_types)]
|
||||
#[derive(Clone, Copy, Debug, Eq, Hash, MallocSizeOf, PartialEq, ToComputedValue)]
|
||||
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
|
||||
pub enum SpecifiedValue {
|
||||
% for value in values:
|
||||
${to_rust_ident(value)},
|
||||
${to_camel_case(value)},
|
||||
% endfor
|
||||
}
|
||||
|
||||
// TODO(emilio): derive.
|
||||
impl ToCss for SpecifiedValue {
|
||||
fn to_css<W>(&self, dest: &mut W) -> ::std::fmt::Result
|
||||
where W: ::std::fmt::Write,
|
||||
{
|
||||
match *self {
|
||||
% for value in values:
|
||||
SpecifiedValue::${to_rust_ident(value)} => dest.write_str("${value}"),
|
||||
SpecifiedValue::${to_camel_case(value)} => dest.write_str("${value}"),
|
||||
% endfor
|
||||
}
|
||||
}
|
||||
|
@ -185,7 +203,7 @@
|
|||
/// The initial display value.
|
||||
#[inline]
|
||||
pub fn get_initial_value() -> computed_value::T {
|
||||
computed_value::T::${to_rust_ident(values[0])}
|
||||
computed_value::T::${to_camel_case(values[0])}
|
||||
}
|
||||
|
||||
/// Parse a display value.
|
||||
|
@ -194,12 +212,12 @@
|
|||
try_match_ident_ignore_ascii_case! { input,
|
||||
% for value in values:
|
||||
"${value}" => {
|
||||
Ok(computed_value::T::${to_rust_ident(value)})
|
||||
Ok(computed_value::T::${to_camel_case(value)})
|
||||
},
|
||||
% endfor
|
||||
% for value in webkit_prefixed_values:
|
||||
"-webkit-${value}" => {
|
||||
Ok(computed_value::T::${to_rust_ident(value)})
|
||||
Ok(computed_value::T::${to_camel_case(value)})
|
||||
},
|
||||
% endfor
|
||||
}
|
||||
|
@ -250,25 +268,25 @@ ${helpers.single_keyword("position", "static absolute relative fixed sticky",
|
|||
let ltr = context.style().writing_mode.is_bidi_ltr();
|
||||
// https://drafts.csswg.org/css-logical-props/#float-clear
|
||||
match *self {
|
||||
SpecifiedValue::inline_start => {
|
||||
SpecifiedValue::InlineStart => {
|
||||
context.rule_cache_conditions.borrow_mut()
|
||||
.set_writing_mode_dependency(context.builder.writing_mode);
|
||||
if ltr {
|
||||
computed_value::T::left
|
||||
computed_value::T::Left
|
||||
} else {
|
||||
computed_value::T::right
|
||||
computed_value::T::Right
|
||||
}
|
||||
}
|
||||
SpecifiedValue::inline_end => {
|
||||
SpecifiedValue::InlineEnd => {
|
||||
context.rule_cache_conditions.borrow_mut()
|
||||
.set_writing_mode_dependency(context.builder.writing_mode);
|
||||
if ltr {
|
||||
computed_value::T::right
|
||||
computed_value::T::Right
|
||||
} else {
|
||||
computed_value::T::left
|
||||
computed_value::T::Left
|
||||
}
|
||||
}
|
||||
% for value in "none left right".split():
|
||||
% for value in "None Left Right".split():
|
||||
SpecifiedValue::${value} => computed_value::T::${value},
|
||||
% endfor
|
||||
}
|
||||
|
@ -276,7 +294,7 @@ ${helpers.single_keyword("position", "static absolute relative fixed sticky",
|
|||
#[inline]
|
||||
fn from_computed_value(computed: &computed_value::T) -> SpecifiedValue {
|
||||
match *computed {
|
||||
% for value in "none left right".split():
|
||||
% for value in "None Left Right".split():
|
||||
computed_value::T::${value} => SpecifiedValue::${value},
|
||||
% endfor
|
||||
}
|
||||
|
@ -302,25 +320,25 @@ ${helpers.single_keyword("position", "static absolute relative fixed sticky",
|
|||
let ltr = context.style().writing_mode.is_bidi_ltr();
|
||||
// https://drafts.csswg.org/css-logical-props/#float-clear
|
||||
match *self {
|
||||
SpecifiedValue::inline_start => {
|
||||
SpecifiedValue::InlineStart => {
|
||||
context.rule_cache_conditions.borrow_mut()
|
||||
.set_writing_mode_dependency(context.builder.writing_mode);
|
||||
if ltr {
|
||||
computed_value::T::left
|
||||
computed_value::T::Left
|
||||
} else {
|
||||
computed_value::T::right
|
||||
computed_value::T::Right
|
||||
}
|
||||
}
|
||||
SpecifiedValue::inline_end => {
|
||||
SpecifiedValue::InlineEnd => {
|
||||
context.rule_cache_conditions.borrow_mut()
|
||||
.set_writing_mode_dependency(context.builder.writing_mode);
|
||||
if ltr {
|
||||
computed_value::T::right
|
||||
computed_value::T::Right
|
||||
} else {
|
||||
computed_value::T::left
|
||||
computed_value::T::Left
|
||||
}
|
||||
}
|
||||
% for value in "none left right both".split():
|
||||
% for value in "None Left Right Both".split():
|
||||
SpecifiedValue::${value} => computed_value::T::${value},
|
||||
% endfor
|
||||
}
|
||||
|
@ -328,7 +346,7 @@ ${helpers.single_keyword("position", "static absolute relative fixed sticky",
|
|||
#[inline]
|
||||
fn from_computed_value(computed: &computed_value::T) -> SpecifiedValue {
|
||||
match *computed {
|
||||
% for value in "none left right both".split():
|
||||
% for value in "None Left Right Both".split():
|
||||
computed_value::T::${value} => SpecifiedValue::${value},
|
||||
% endfor
|
||||
}
|
||||
|
@ -377,7 +395,7 @@ ${helpers.single_keyword("-servo-overflow-clip-box", "padding-box content-box",
|
|||
${helpers.predefined_type(
|
||||
"overflow-clip-box-" + direction,
|
||||
"OverflowClipBox",
|
||||
"computed::OverflowClipBox::padding_box",
|
||||
"computed::OverflowClipBox::PaddingBox",
|
||||
products="gecko",
|
||||
enabled_in="ua",
|
||||
needs_context=False,
|
||||
|
|
|
@ -136,7 +136,7 @@
|
|||
input.try(|input| {
|
||||
input.expect_comma()?;
|
||||
list_style_type::parse(context, input)
|
||||
}).unwrap_or(list_style_type::computed_value::T::decimal)
|
||||
}).unwrap_or(list_style_type::computed_value::T::Decimal)
|
||||
}
|
||||
|
||||
#[cfg(feature = "gecko")]
|
||||
|
|
|
@ -76,13 +76,13 @@ ${helpers.single_keyword("word-break",
|
|||
#[inline]
|
||||
fn to_computed_value(&self, _: &Context) -> computed_value::T {
|
||||
match *self {
|
||||
% for value in "auto none inter_word".split():
|
||||
% for value in "Auto None InterWord".split():
|
||||
SpecifiedValue::${value} => computed_value::T::${value},
|
||||
% endfor
|
||||
% if product == "gecko":
|
||||
SpecifiedValue::inter_character => computed_value::T::inter_character,
|
||||
SpecifiedValue::InterCharacter => computed_value::T::InterCharacter,
|
||||
// https://drafts.csswg.org/css-text-3/#valdef-text-justify-distribute
|
||||
SpecifiedValue::distribute => computed_value::T::inter_character,
|
||||
SpecifiedValue::Distribute => computed_value::T::InterCharacter,
|
||||
% endif
|
||||
}
|
||||
}
|
||||
|
@ -90,11 +90,11 @@ ${helpers.single_keyword("word-break",
|
|||
#[inline]
|
||||
fn from_computed_value(computed: &computed_value::T) -> SpecifiedValue {
|
||||
match *computed {
|
||||
% for value in "auto none inter_word".split():
|
||||
% for value in "Auto None InterWord".split():
|
||||
computed_value::T::${value} => SpecifiedValue::${value},
|
||||
% endfor
|
||||
% if product == "gecko":
|
||||
computed_value::T::inter_character => SpecifiedValue::inter_character,
|
||||
computed_value::T::InterCharacter => SpecifiedValue::InterCharacter,
|
||||
% endif
|
||||
}
|
||||
}
|
||||
|
@ -109,18 +109,25 @@ ${helpers.single_keyword("text-align-last",
|
|||
spec="https://drafts.csswg.org/css-text/#propdef-text-align-last")}
|
||||
|
||||
// TODO make this a shorthand and implement text-align-last/text-align-all
|
||||
//
|
||||
// FIXME(emilio): This can't really be that complicated.
|
||||
<%helpers:longhand name="text-align" animation_value_type="discrete"
|
||||
flags="APPLIES_TO_PLACEHOLDER"
|
||||
spec="https://drafts.csswg.org/css-text/#propdef-text-align">
|
||||
pub use self::computed_value::TextAlign;
|
||||
|
||||
pub mod computed_value {
|
||||
pub use self::TextAlign as T;
|
||||
|
||||
macro_rules! define_text_align {
|
||||
( $( $name: ident ( $string: expr ) => $discriminant: expr, )+ ) => {
|
||||
define_css_keyword_enum! { T:
|
||||
define_css_keyword_enum! { TextAlign:
|
||||
$(
|
||||
$string => $name,
|
||||
)+
|
||||
}
|
||||
impl T {
|
||||
|
||||
impl TextAlign {
|
||||
pub fn to_u32(self) -> u32 {
|
||||
match self {
|
||||
$(
|
||||
|
@ -139,22 +146,23 @@ ${helpers.single_keyword("text-align-last",
|
|||
}
|
||||
}
|
||||
}
|
||||
// FIXME(emilio): Why reinventing the world?
|
||||
define_text_align! {
|
||||
start("start") => 0,
|
||||
end("end") => 1,
|
||||
left("left") => 2,
|
||||
right("right") => 3,
|
||||
center("center") => 4,
|
||||
justify("justify") => 5,
|
||||
Start("start") => 0,
|
||||
End("end") => 1,
|
||||
Left("left") => 2,
|
||||
Right("right") => 3,
|
||||
Center("center") => 4,
|
||||
Justify("justify") => 5,
|
||||
% if product == "servo":
|
||||
servo_center("-servo-center") => 6,
|
||||
servo_left("-servo-left") => 7,
|
||||
servo_right("-servo-right") => 8,
|
||||
ServoCenter("-servo-center") => 6,
|
||||
ServoLeft("-servo-left") => 7,
|
||||
ServoRight("-servo-right") => 8,
|
||||
% else:
|
||||
_moz_center("-moz-center") => 6,
|
||||
_moz_left("-moz-left") => 7,
|
||||
_moz_right("-moz-right") => 8,
|
||||
char("char") => 10,
|
||||
MozCenter("-moz-center") => 6,
|
||||
MozLeft("-moz-left") => 7,
|
||||
MozRight("-moz-right") => 8,
|
||||
Char("char") => 10,
|
||||
% endif
|
||||
}
|
||||
|
||||
|
@ -164,8 +172,8 @@ ${helpers.single_keyword("text-align-last",
|
|||
gecko_strip_moz_prefix=False), type="T")}
|
||||
}
|
||||
|
||||
#[inline] pub fn get_initial_value() -> computed_value::T {
|
||||
computed_value::T::start
|
||||
#[inline] pub fn get_initial_value() -> TextAlign {
|
||||
TextAlign::Start
|
||||
}
|
||||
|
||||
|
||||
|
@ -176,14 +184,14 @@ ${helpers.single_keyword("text-align-last",
|
|||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
|
||||
pub enum SpecifiedValue {
|
||||
Keyword(computed_value::T),
|
||||
Keyword(TextAlign),
|
||||
MatchParent,
|
||||
MozCenterOrInherit,
|
||||
}
|
||||
pub fn parse<'i, 't>(_context: &ParserContext, input: &mut Parser<'i, 't>)
|
||||
-> Result<SpecifiedValue, ParseError<'i>> {
|
||||
// MozCenterOrInherit cannot be parsed, only set directly on th elements
|
||||
if let Ok(key) = input.try(computed_value::T::parse) {
|
||||
if let Ok(key) = input.try(TextAlign::parse) {
|
||||
Ok(SpecifiedValue::Keyword(key))
|
||||
} else {
|
||||
input.expect_ident_matching("match-parent")?;
|
||||
|
@ -211,10 +219,10 @@ ${helpers.single_keyword("text-align-last",
|
|||
}
|
||||
}
|
||||
impl ToComputedValue for SpecifiedValue {
|
||||
type ComputedValue = computed_value::T;
|
||||
type ComputedValue = TextAlign;
|
||||
|
||||
#[inline]
|
||||
fn to_computed_value(&self, context: &Context) -> computed_value::T {
|
||||
fn to_computed_value(&self, context: &Context) -> TextAlign {
|
||||
match *self {
|
||||
SpecifiedValue::Keyword(key) => key,
|
||||
SpecifiedValue::MatchParent => {
|
||||
|
@ -230,17 +238,17 @@ ${helpers.single_keyword("text-align-last",
|
|||
let parent = context.builder.get_parent_inheritedtext().clone_text_align();
|
||||
let ltr = context.builder.inherited_writing_mode().is_bidi_ltr();
|
||||
match (parent, ltr) {
|
||||
(computed_value::T::start, true) => computed_value::T::left,
|
||||
(computed_value::T::start, false) => computed_value::T::right,
|
||||
(computed_value::T::end, true) => computed_value::T::right,
|
||||
(computed_value::T::end, false) => computed_value::T::left,
|
||||
(TextAlign::Start, true) => TextAlign::Left,
|
||||
(TextAlign::Start, false) => TextAlign::Right,
|
||||
(TextAlign::End, true) => TextAlign::Right,
|
||||
(TextAlign::End, false) => TextAlign::Left,
|
||||
_ => parent
|
||||
}
|
||||
}
|
||||
SpecifiedValue::MozCenterOrInherit => {
|
||||
let parent = context.builder.get_parent_inheritedtext().clone_text_align();
|
||||
if parent == computed_value::T::start {
|
||||
computed_value::T::center
|
||||
if parent == TextAlign::Start {
|
||||
TextAlign::Center
|
||||
} else {
|
||||
parent
|
||||
}
|
||||
|
@ -314,8 +322,8 @@ ${helpers.predefined_type("word-spacing",
|
|||
// Start with no declarations if this is an atomic inline-level box; otherwise, start with the
|
||||
// declarations in effect and add in the text decorations that this block specifies.
|
||||
let mut result = match context.style().get_box().clone_display() {
|
||||
super::display::computed_value::T::inline_block |
|
||||
super::display::computed_value::T::inline_table => get_initial_value(),
|
||||
super::display::computed_value::T::InlineBlock |
|
||||
super::display::computed_value::T::InlineTable => get_initial_value(),
|
||||
_ => context.builder.get_parent_inheritedtext().clone__servo_text_decorations_in_effect()
|
||||
};
|
||||
|
||||
|
@ -354,31 +362,31 @@ ${helpers.predefined_type("word-spacing",
|
|||
impl SpecifiedValue {
|
||||
pub fn allow_wrap(&self) -> bool {
|
||||
match *self {
|
||||
SpecifiedValue::nowrap |
|
||||
SpecifiedValue::pre => false,
|
||||
SpecifiedValue::normal |
|
||||
SpecifiedValue::pre_wrap |
|
||||
SpecifiedValue::pre_line => true,
|
||||
SpecifiedValue::Nowrap |
|
||||
SpecifiedValue::Pre => false,
|
||||
SpecifiedValue::Normal |
|
||||
SpecifiedValue::PreWrap |
|
||||
SpecifiedValue::PreLine => true,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn preserve_newlines(&self) -> bool {
|
||||
match *self {
|
||||
SpecifiedValue::normal |
|
||||
SpecifiedValue::nowrap => false,
|
||||
SpecifiedValue::pre |
|
||||
SpecifiedValue::pre_wrap |
|
||||
SpecifiedValue::pre_line => true,
|
||||
SpecifiedValue::Normal |
|
||||
SpecifiedValue::Nowrap => false,
|
||||
SpecifiedValue::Pre |
|
||||
SpecifiedValue::PreWrap |
|
||||
SpecifiedValue::PreLine => true,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn preserve_spaces(&self) -> bool {
|
||||
match *self {
|
||||
SpecifiedValue::normal |
|
||||
SpecifiedValue::nowrap |
|
||||
SpecifiedValue::pre_line => false,
|
||||
SpecifiedValue::pre |
|
||||
SpecifiedValue::pre_wrap => true,
|
||||
SpecifiedValue::Normal |
|
||||
SpecifiedValue::Nowrap |
|
||||
SpecifiedValue::PreLine => false,
|
||||
SpecifiedValue::Pre |
|
||||
SpecifiedValue::PreWrap => true,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -399,7 +407,7 @@ ${helpers.predefined_type(
|
|||
<%helpers:longhand name="text-emphasis-style" products="gecko" boxed="True"
|
||||
animation_value_type="discrete"
|
||||
spec="https://drafts.csswg.org/css-text-decor/#propdef-text-emphasis-style">
|
||||
use computed_values::writing_mode::T as writing_mode;
|
||||
use computed_values::writing_mode::T as WritingMode;
|
||||
use std::fmt;
|
||||
use style_traits::ToCss;
|
||||
use unicode_segmentation::UnicodeSegmentation;
|
||||
|
@ -519,7 +527,7 @@ ${helpers.predefined_type(
|
|||
match *self {
|
||||
SpecifiedValue::Keyword(ref keyword) => {
|
||||
let default_shape = if context.style().get_inheritedbox()
|
||||
.clone_writing_mode() == writing_mode::horizontal_tb {
|
||||
.clone_writing_mode() == WritingMode::HorizontalTb {
|
||||
ShapeKeyword::Circle
|
||||
} else {
|
||||
ShapeKeyword::Sesame
|
||||
|
|
|
@ -38,12 +38,12 @@ ${helpers.predefined_type(
|
|||
|
||||
#[inline]
|
||||
pub fn get_initial_value() -> computed_value::T {
|
||||
Either::Second(BorderStyle::none)
|
||||
Either::Second(BorderStyle::None)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn get_initial_specified_value() -> SpecifiedValue {
|
||||
Either::Second(BorderStyle::none)
|
||||
Either::Second(BorderStyle::None)
|
||||
}
|
||||
|
||||
pub mod computed_value {
|
||||
|
@ -54,7 +54,7 @@ ${helpers.predefined_type(
|
|||
-> Result<SpecifiedValue, ParseError<'i>> {
|
||||
SpecifiedValue::parse(context, input)
|
||||
.and_then(|result| {
|
||||
if let Either::Second(BorderStyle::hidden) = result {
|
||||
if let Either::Second(BorderStyle::Hidden) = result {
|
||||
// The outline-style property accepts the same values as
|
||||
// border-style, except that 'hidden' is not a legal outline
|
||||
// style.
|
||||
|
|
|
@ -2396,24 +2396,24 @@ impl ComputedValuesInner {
|
|||
|
||||
/// Return true if the effects force the transform style to be Flat
|
||||
pub fn overrides_transform_style(&self) -> bool {
|
||||
use computed_values::mix_blend_mode;
|
||||
use computed_values::mix_blend_mode::T as MixBlendMode;
|
||||
|
||||
let effects = self.get_effects();
|
||||
// TODO(gw): Add clip-path, isolation, mask-image, mask-border-source when supported.
|
||||
effects.opacity < 1.0 ||
|
||||
!effects.filter.0.is_empty() ||
|
||||
!effects.clip.is_auto() ||
|
||||
effects.mix_blend_mode != mix_blend_mode::T::normal
|
||||
effects.mix_blend_mode != MixBlendMode::Normal
|
||||
}
|
||||
|
||||
/// <https://drafts.csswg.org/css-transforms/#grouping-property-values>
|
||||
pub fn get_used_transform_style(&self) -> computed_values::transform_style::T {
|
||||
use computed_values::transform_style;
|
||||
use computed_values::transform_style::T as TransformStyle;
|
||||
|
||||
let box_ = self.get_box();
|
||||
|
||||
if self.overrides_transform_style() {
|
||||
transform_style::T::flat
|
||||
TransformStyle::Flat
|
||||
} else {
|
||||
// Return the computed value if not overridden by the above exceptions
|
||||
box_.transform_style
|
||||
|
@ -2913,15 +2913,15 @@ impl<'a> StyleBuilder<'a> {
|
|||
|
||||
/// Returns whether this computed style represents a floated object.
|
||||
pub fn floated(&self) -> bool {
|
||||
self.get_box().clone_float() != longhands::float::computed_value::T::none
|
||||
self.get_box().clone_float() != longhands::float::computed_value::T::None
|
||||
}
|
||||
|
||||
/// Returns whether this computed style represents an out of flow-positioned
|
||||
/// object.
|
||||
pub fn out_of_flow_positioned(&self) -> bool {
|
||||
use properties::longhands::position::computed_value::T as position;
|
||||
use properties::longhands::position::computed_value::T as Position;
|
||||
matches!(self.get_box().clone_position(),
|
||||
position::absolute | position::fixed)
|
||||
Position::Absolute | Position::Fixed)
|
||||
}
|
||||
|
||||
/// Whether this style has a top-layer style. That's implemented in Gecko
|
||||
|
@ -2934,7 +2934,7 @@ impl<'a> StyleBuilder<'a> {
|
|||
#[cfg(feature = "gecko")]
|
||||
pub fn in_top_layer(&self) -> bool {
|
||||
matches!(self.get_box().clone__moz_top_layer(),
|
||||
longhands::_moz_top_layer::computed_value::T::top)
|
||||
longhands::_moz_top_layer::computed_value::T::Top)
|
||||
}
|
||||
|
||||
/// Clears the "have any reset structs been modified" flag.
|
||||
|
|
|
@ -18,16 +18,17 @@
|
|||
use values::specified::{Color, Position, PositionComponent};
|
||||
use parser::Parse;
|
||||
|
||||
// FIXME(emilio): Should be the same type!
|
||||
impl From<background_origin::single_value::SpecifiedValue> for background_clip::single_value::SpecifiedValue {
|
||||
fn from(origin: background_origin::single_value::SpecifiedValue) ->
|
||||
background_clip::single_value::SpecifiedValue {
|
||||
match origin {
|
||||
background_origin::single_value::SpecifiedValue::content_box =>
|
||||
background_clip::single_value::SpecifiedValue::content_box,
|
||||
background_origin::single_value::SpecifiedValue::padding_box =>
|
||||
background_clip::single_value::SpecifiedValue::padding_box,
|
||||
background_origin::single_value::SpecifiedValue::border_box =>
|
||||
background_clip::single_value::SpecifiedValue::border_box,
|
||||
background_origin::single_value::SpecifiedValue::ContentBox =>
|
||||
background_clip::single_value::SpecifiedValue::ContentBox,
|
||||
background_origin::single_value::SpecifiedValue::PaddingBox =>
|
||||
background_clip::single_value::SpecifiedValue::PaddingBox,
|
||||
background_origin::single_value::SpecifiedValue::BorderBox =>
|
||||
background_clip::single_value::SpecifiedValue::BorderBox,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -177,7 +178,7 @@
|
|||
size.to_css(dest)?;
|
||||
}
|
||||
|
||||
if *origin != Origin::padding_box || *clip != Clip::border_box {
|
||||
if *origin != Origin::PaddingBox || *clip != Clip::BorderBox {
|
||||
dest.write_str(" ")?;
|
||||
origin.to_css(dest)?;
|
||||
if *clip != From::from(*origin) {
|
||||
|
|
|
@ -80,7 +80,7 @@ pub fn parse_border<'i, 't>(context: &ParserContext, input: &mut Parser<'i, 't>)
|
|||
}
|
||||
if any {
|
||||
Ok((color.unwrap_or_else(|| Color::currentcolor()),
|
||||
style.unwrap_or(BorderStyle::none),
|
||||
style.unwrap_or(BorderStyle::None),
|
||||
width.unwrap_or(BorderSideWidth::Medium)))
|
||||
} else {
|
||||
Err(input.new_custom_error(StyleParseErrorKind::UnspecifiedError))
|
||||
|
|
|
@ -18,20 +18,20 @@
|
|||
try_match_ident_ignore_ascii_case! { input,
|
||||
"-moz-scrollbars-horizontal" => {
|
||||
Ok(expanded! {
|
||||
overflow_x: SpecifiedValue::scroll,
|
||||
overflow_y: SpecifiedValue::hidden,
|
||||
overflow_x: SpecifiedValue::Scroll,
|
||||
overflow_y: SpecifiedValue::Hidden,
|
||||
})
|
||||
}
|
||||
"-moz-scrollbars-vertical" => {
|
||||
Ok(expanded! {
|
||||
overflow_x: SpecifiedValue::hidden,
|
||||
overflow_y: SpecifiedValue::scroll,
|
||||
overflow_x: SpecifiedValue::Hidden,
|
||||
overflow_y: SpecifiedValue::Scroll,
|
||||
})
|
||||
}
|
||||
"-moz-scrollbars-none" => {
|
||||
Ok(expanded! {
|
||||
overflow_x: SpecifiedValue::hidden,
|
||||
overflow_y: SpecifiedValue::hidden,
|
||||
overflow_x: SpecifiedValue::Hidden,
|
||||
overflow_y: SpecifiedValue::Hidden,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@
|
|||
|
||||
fn list_style_type_none() -> list_style_type::SpecifiedValue {
|
||||
% if product == "servo":
|
||||
list_style_type::SpecifiedValue::none
|
||||
list_style_type::SpecifiedValue::None
|
||||
% else:
|
||||
use values::generics::CounterStyleOrNone;
|
||||
list_style_type::SpecifiedValue::CounterStyle(CounterStyleOrNone::None)
|
||||
|
|
|
@ -14,22 +14,23 @@
|
|||
use values::specified::{Position, PositionComponent};
|
||||
use parser::Parse;
|
||||
|
||||
// FIXME(emilio): These two mask types should be the same!
|
||||
impl From<mask_origin::single_value::SpecifiedValue> for mask_clip::single_value::SpecifiedValue {
|
||||
fn from(origin: mask_origin::single_value::SpecifiedValue) -> mask_clip::single_value::SpecifiedValue {
|
||||
match origin {
|
||||
mask_origin::single_value::SpecifiedValue::content_box =>
|
||||
mask_clip::single_value::SpecifiedValue::content_box,
|
||||
mask_origin::single_value::SpecifiedValue::padding_box =>
|
||||
mask_clip::single_value::SpecifiedValue::padding_box,
|
||||
mask_origin::single_value::SpecifiedValue::border_box =>
|
||||
mask_clip::single_value::SpecifiedValue::border_box,
|
||||
mask_origin::single_value::SpecifiedValue::ContentBox =>
|
||||
mask_clip::single_value::SpecifiedValue::ContentBox,
|
||||
mask_origin::single_value::SpecifiedValue::PaddingBox =>
|
||||
mask_clip::single_value::SpecifiedValue::PaddingBox ,
|
||||
mask_origin::single_value::SpecifiedValue::BorderBox =>
|
||||
mask_clip::single_value::SpecifiedValue::BorderBox,
|
||||
% if product == "gecko":
|
||||
mask_origin::single_value::SpecifiedValue::fill_box =>
|
||||
mask_clip::single_value::SpecifiedValue::fill_box,
|
||||
mask_origin::single_value::SpecifiedValue::stroke_box =>
|
||||
mask_clip::single_value::SpecifiedValue::stroke_box,
|
||||
mask_origin::single_value::SpecifiedValue::view_box =>
|
||||
mask_clip::single_value::SpecifiedValue::view_box,
|
||||
mask_origin::single_value::SpecifiedValue::FillBox =>
|
||||
mask_clip::single_value::SpecifiedValue::FillBox ,
|
||||
mask_origin::single_value::SpecifiedValue::StrokeBox =>
|
||||
mask_clip::single_value::SpecifiedValue::StrokeBox,
|
||||
mask_origin::single_value::SpecifiedValue::ViewBox=>
|
||||
mask_clip::single_value::SpecifiedValue::ViewBox,
|
||||
% endif
|
||||
}
|
||||
}
|
||||
|
@ -160,7 +161,7 @@
|
|||
dest.write_str(" ")?;
|
||||
repeat.to_css(dest)?;
|
||||
|
||||
if *origin != Origin::border_box || *clip != Clip::border_box {
|
||||
if *origin != Origin::BorderBox || *clip != Clip::BorderBox {
|
||||
dest.write_str(" ")?;
|
||||
origin.to_css(dest)?;
|
||||
if *clip != From::from(*origin) {
|
||||
|
|
|
@ -66,7 +66,7 @@
|
|||
self.text_decoration_line.to_css(dest)?;
|
||||
|
||||
% if product == "gecko":
|
||||
if self.text_decoration_style != &text_decoration_style::SpecifiedValue::solid {
|
||||
if *self.text_decoration_style != text_decoration_style::SpecifiedValue::Solid {
|
||||
dest.write_str(" ")?;
|
||||
self.text_decoration_style.to_css(dest)?;
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
//! The restyle damage is a hint that tells layout which kind of operations may
|
||||
//! be needed in presence of incremental style changes.
|
||||
|
||||
use computed_values::display;
|
||||
use computed_values::display::T as Display;
|
||||
use matching::{StyleChange, StyleDifference};
|
||||
use properties::ComputedValues;
|
||||
use std::fmt;
|
||||
|
@ -219,7 +219,7 @@ fn compute_damage(old: &ComputedValues, new: &ComputedValues) -> ServoRestyleDam
|
|||
get_text.text_decoration_line, get_text.unicode_bidi,
|
||||
get_inheritedtable.empty_cells, get_inheritedtable.caption_side,
|
||||
get_column.column_width, get_column.column_count
|
||||
]) || (new.get_box().display == display::T::inline &&
|
||||
]) || (new.get_box().display == Display::Inline &&
|
||||
add_if_not_equal!(old, new, damage,
|
||||
[ServoRestyleDamage::REPAINT, ServoRestyleDamage::REPOSITION,
|
||||
ServoRestyleDamage::STORE_OVERFLOW, ServoRestyleDamage::BUBBLE_ISIZES,
|
||||
|
|
|
@ -15,7 +15,7 @@ use fnv::FnvHashMap;
|
|||
use invalidation::element::element_wrapper::ElementSnapshot;
|
||||
use properties::ComputedValues;
|
||||
use properties::PropertyFlags;
|
||||
use properties::longhands::display::computed_value as display;
|
||||
use properties::longhands::display::computed_value::T as Display;
|
||||
use selector_parser::{AttrValue as SelectorAttrValue, PseudoElementCascadeType, SelectorParser};
|
||||
use selectors::attr::{AttrSelectorOperation, NamespaceConstraint, CaseSensitivity};
|
||||
use selectors::parser::{SelectorMethods, SelectorParseErrorKind};
|
||||
|
@ -229,10 +229,9 @@ impl PseudoElement {
|
|||
|
||||
/// Whether this pseudo-element should actually exist if it has
|
||||
/// the given styles.
|
||||
pub fn should_exist(&self, style: &ComputedValues) -> bool
|
||||
{
|
||||
pub fn should_exist(&self, style: &ComputedValues) -> bool {
|
||||
let display = style.get_box().clone_display();
|
||||
if display == display::T::none {
|
||||
if display == Display::None {
|
||||
return false;
|
||||
}
|
||||
if self.is_before_or_after() && style.ineffective_content_property() {
|
||||
|
|
|
@ -7,10 +7,10 @@
|
|||
|
||||
use app_units::Au;
|
||||
use properties::{self, CascadeFlags, ComputedValues, StyleBuilder};
|
||||
use properties::longhands::display::computed_value::T as display;
|
||||
use properties::longhands::float::computed_value::T as float;
|
||||
use properties::longhands::overflow_x::computed_value::T as overflow;
|
||||
use properties::longhands::position::computed_value::T as position;
|
||||
use properties::longhands::display::computed_value::T as Display;
|
||||
use properties::longhands::float::computed_value::T as Float;
|
||||
use properties::longhands::overflow_x::computed_value::T as Overflow;
|
||||
use properties::longhands::position::computed_value::T as Position;
|
||||
|
||||
/// A struct that implements all the adjustment methods.
|
||||
///
|
||||
|
@ -23,10 +23,9 @@ pub struct StyleAdjuster<'a, 'b: 'a> {
|
|||
|
||||
impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
|
||||
/// Trivially constructs a new StyleAdjuster.
|
||||
#[inline]
|
||||
pub fn new(style: &'a mut StyleBuilder<'b>) -> Self {
|
||||
StyleAdjuster {
|
||||
style: style,
|
||||
}
|
||||
StyleAdjuster { style }
|
||||
}
|
||||
|
||||
/// <https://fullscreen.spec.whatwg.org/#new-stacking-layer>
|
||||
|
@ -36,7 +35,7 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
|
|||
///
|
||||
fn adjust_for_top_layer(&mut self) {
|
||||
if !self.style.out_of_flow_positioned() && self.style.in_top_layer() {
|
||||
self.style.mutate_box().set_position(position::absolute);
|
||||
self.style.mutate_box().set_position(Position::Absolute);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -47,7 +46,7 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
|
|||
///
|
||||
fn adjust_for_position(&mut self) {
|
||||
if self.style.out_of_flow_positioned() && self.style.floated() {
|
||||
self.style.mutate_box().set_float(float::none);
|
||||
self.style.mutate_box().set_float(Float::None);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -97,7 +96,7 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
|
|||
use properties::computed_value_flags::ComputedValueFlags;
|
||||
|
||||
if self.style.inherited_flags().contains(ComputedValueFlags::IS_IN_DISPLAY_NONE_SUBTREE) ||
|
||||
self.style.get_box().clone_display() == display::none {
|
||||
self.style.get_box().clone_display() == Display::None {
|
||||
self.style.flags.insert(ComputedValueFlags::IS_IN_DISPLAY_NONE_SUBTREE);
|
||||
}
|
||||
|
||||
|
@ -127,10 +126,13 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
|
|||
///
|
||||
/// TODO(emilio): we should (Gecko too) revise these adjustments in presence
|
||||
/// of display: contents.
|
||||
///
|
||||
/// FIXME(emilio): How does this play with logical properties? Doesn't
|
||||
/// mutating writing-mode change the potential physical sides chosen?
|
||||
#[cfg(feature = "gecko")]
|
||||
fn adjust_for_text_combine_upright(&mut self) {
|
||||
use computed_values::text_combine_upright::T as text_combine_upright;
|
||||
use computed_values::writing_mode::T as writing_mode;
|
||||
use computed_values::text_combine_upright::T as TextCombineUpright;
|
||||
use computed_values::writing_mode::T as WritingMode;
|
||||
use properties::computed_value_flags::ComputedValueFlags;
|
||||
|
||||
let writing_mode =
|
||||
|
@ -138,10 +140,10 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
|
|||
let text_combine_upright =
|
||||
self.style.get_inheritedtext().clone_text_combine_upright();
|
||||
|
||||
if writing_mode != writing_mode::horizontal_tb &&
|
||||
text_combine_upright == text_combine_upright::all {
|
||||
if writing_mode != WritingMode::HorizontalTb &&
|
||||
text_combine_upright == TextCombineUpright::All {
|
||||
self.style.flags.insert(ComputedValueFlags::IS_TEXT_COMBINED);
|
||||
self.style.mutate_inheritedbox().set_writing_mode(writing_mode::horizontal_tb);
|
||||
self.style.mutate_inheritedbox().set_writing_mode(WritingMode::HorizontalTb);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -181,8 +183,8 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
|
|||
layout_parent_style.get_inheritedbox().clone_writing_mode();
|
||||
|
||||
if our_writing_mode != parent_writing_mode &&
|
||||
self.style.get_box().clone_display() == display::inline {
|
||||
self.style.mutate_box().set_display(display::inline_block);
|
||||
self.style.get_box().clone_display() == Display::Inline {
|
||||
self.style.mutate_box().set_display(Display::InlineBlock);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -199,18 +201,18 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
|
|||
return;
|
||||
}
|
||||
|
||||
if self.style.get_box().clone_display() == display::inline {
|
||||
self.style.mutate_box().set_adjusted_display(display::inline_block,
|
||||
if self.style.get_box().clone_display() == Display::Inline {
|
||||
self.style.mutate_box().set_adjusted_display(Display::InlineBlock,
|
||||
false);
|
||||
}
|
||||
|
||||
|
||||
// When 'contain: paint', update overflow from 'visible' to 'clip'.
|
||||
if self.style.get_box().clone_contain().contains(SpecifiedValue::PAINT) {
|
||||
if self.style.get_box().clone_overflow_x() == overflow::visible {
|
||||
if self.style.get_box().clone_overflow_x() == Overflow::Visible {
|
||||
let box_style = self.style.mutate_box();
|
||||
box_style.set_overflow_x(overflow::_moz_hidden_unscrollable);
|
||||
box_style.set_overflow_y(overflow::_moz_hidden_unscrollable);
|
||||
box_style.set_overflow_x(Overflow::MozHiddenUnscrollable);
|
||||
box_style.set_overflow_y(Overflow::MozHiddenUnscrollable);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -219,15 +221,15 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
|
|||
/// both forced to "normal".
|
||||
#[cfg(feature = "gecko")]
|
||||
fn adjust_for_mathvariant(&mut self) {
|
||||
use properties::longhands::_moz_math_variant::computed_value::T as moz_math_variant;
|
||||
use properties::longhands::font_style::computed_value::T as font_style;
|
||||
use properties::longhands::font_weight::computed_value::T as font_weight;
|
||||
if self.style.get_font().clone__moz_math_variant() != moz_math_variant::none {
|
||||
use properties::longhands::_moz_math_variant::computed_value::T as MozMathVariant;
|
||||
use properties::longhands::font_style::computed_value::T as FontStyle;
|
||||
use properties::longhands::font_weight::computed_value::T as FontWeight;
|
||||
if self.style.get_font().clone__moz_math_variant() != MozMathVariant::None {
|
||||
let font_style = self.style.mutate_font();
|
||||
// Sadly we don't have a nice name for the computed value
|
||||
// of "font-weight: normal".
|
||||
font_style.set_font_weight(font_weight::normal());
|
||||
font_style.set_font_style(font_style::normal);
|
||||
font_style.set_font_weight(FontWeight::normal());
|
||||
font_style.set_font_style(FontStyle::Normal);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -237,18 +239,18 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
|
|||
/// See https://github.com/servo/servo/issues/15229
|
||||
#[cfg(feature = "servo")]
|
||||
fn adjust_for_alignment(&mut self, layout_parent_style: &ComputedValues) {
|
||||
use computed_values::align_items::T as align_items;
|
||||
use computed_values::align_self::T as align_self;
|
||||
use computed_values::align_items::T as AlignItems;
|
||||
use computed_values::align_self::T as AlignSelf;
|
||||
|
||||
if self.style.get_position().clone_align_self() == align_self::auto &&
|
||||
if self.style.get_position().clone_align_self() == AlignSelf::Auto &&
|
||||
!self.style.out_of_flow_positioned() {
|
||||
let self_align =
|
||||
match layout_parent_style.get_position().clone_align_items() {
|
||||
align_items::stretch => align_self::stretch,
|
||||
align_items::baseline => align_self::baseline,
|
||||
align_items::flex_start => align_self::flex_start,
|
||||
align_items::flex_end => align_self::flex_end,
|
||||
align_items::center => align_self::center,
|
||||
AlignItems::Stretch => AlignSelf::Stretch,
|
||||
AlignItems::Baseline => AlignSelf::Baseline,
|
||||
AlignItems::FlexStart => AlignSelf::FlexStart,
|
||||
AlignItems::FlexEnd => AlignSelf::FlexEnd,
|
||||
AlignItems::Center => AlignSelf::Center,
|
||||
};
|
||||
self.style.mutate_position().set_align_self(self_align);
|
||||
}
|
||||
|
@ -288,23 +290,23 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
|
|||
|
||||
// If 'visible' is specified but doesn't match the other dimension,
|
||||
// it turns into 'auto'.
|
||||
if overflow_x == overflow::visible {
|
||||
overflow_x = overflow::auto;
|
||||
if overflow_x == Overflow::Visible {
|
||||
overflow_x = Overflow::Auto;
|
||||
}
|
||||
|
||||
if overflow_y == overflow::visible {
|
||||
overflow_y = overflow::auto;
|
||||
if overflow_y == Overflow::Visible {
|
||||
overflow_y = Overflow::Auto;
|
||||
}
|
||||
|
||||
#[cfg(feature = "gecko")]
|
||||
{
|
||||
// overflow: clip is deprecated, so convert to hidden if it's
|
||||
// specified in only one dimension.
|
||||
if overflow_x == overflow::_moz_hidden_unscrollable {
|
||||
overflow_x = overflow::hidden;
|
||||
if overflow_x == Overflow::MozHiddenUnscrollable {
|
||||
overflow_x = Overflow::Hidden;
|
||||
}
|
||||
if overflow_y == overflow::_moz_hidden_unscrollable {
|
||||
overflow_y = overflow::hidden;
|
||||
if overflow_y == Overflow::MozHiddenUnscrollable {
|
||||
overflow_y = Overflow::Hidden;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -324,11 +326,11 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
|
|||
// TODO: We should probably convert display:contents into display:none
|
||||
// in some cases too: https://drafts.csswg.org/css-display/#unbox
|
||||
if !flags.contains(CascadeFlags::PROHIBIT_DISPLAY_CONTENTS) ||
|
||||
self.style.get_box().clone_display() != display::contents {
|
||||
self.style.get_box().clone_display() != Display::Contents {
|
||||
return;
|
||||
}
|
||||
|
||||
self.style.mutate_box().set_display(display::inline);
|
||||
self.style.mutate_box().set_display(Display::Inline);
|
||||
}
|
||||
|
||||
/// If a <fieldset> has grid/flex display type, we need to inherit
|
||||
|
@ -347,16 +349,16 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
|
|||
if !flags.contains(CascadeFlags::IS_FIELDSET_CONTENT) {
|
||||
return;
|
||||
}
|
||||
debug_assert_eq!(self.style.get_box().clone_display(), display::block);
|
||||
debug_assert_eq!(self.style.get_box().clone_display(), Display::Block);
|
||||
// TODO We actually want style from parent rather than layout
|
||||
// parent, so that this fixup doesn't happen incorrectly when
|
||||
// when <fieldset> has "display: contents".
|
||||
let parent_display = layout_parent_style.get_box().clone_display();
|
||||
let new_display = match parent_display {
|
||||
display::flex |
|
||||
display::inline_flex => Some(display::flex),
|
||||
display::grid |
|
||||
display::inline_grid => Some(display::grid),
|
||||
Display::Flex |
|
||||
Display::InlineFlex => Some(Display::Flex),
|
||||
Display::Grid |
|
||||
Display::InlineGrid => Some(Display::Grid),
|
||||
_ => None,
|
||||
};
|
||||
if let Some(new_display) = new_display {
|
||||
|
@ -372,19 +374,19 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
|
|||
/// table.
|
||||
#[cfg(feature = "gecko")]
|
||||
fn adjust_for_table_text_align(&mut self) {
|
||||
use properties::longhands::text_align::computed_value::T as text_align;
|
||||
if self.style.get_box().clone_display() != display::table {
|
||||
use properties::longhands::text_align::computed_value::T as TextAlign;
|
||||
if self.style.get_box().clone_display() != Display::Table {
|
||||
return;
|
||||
}
|
||||
|
||||
match self.style.get_inheritedtext().clone_text_align() {
|
||||
text_align::_moz_left |
|
||||
text_align::_moz_center |
|
||||
text_align::_moz_right => {},
|
||||
TextAlign::MozLeft |
|
||||
TextAlign::MozCenter |
|
||||
TextAlign::MozRight => {},
|
||||
_ => return,
|
||||
}
|
||||
|
||||
self.style.mutate_inheritedtext().set_text_align(text_align::start)
|
||||
self.style.mutate_inheritedtext().set_text_align(TextAlign::Start)
|
||||
}
|
||||
|
||||
/// Set the HAS_TEXT_DECORATION_LINES flag based on parent style.
|
||||
|
@ -419,15 +421,15 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
|
|||
}
|
||||
match self.style.get_box().clone_display() {
|
||||
// Ruby base and text are always non-breakable.
|
||||
display::ruby_base |
|
||||
display::ruby_text => true,
|
||||
Display::RubyBase |
|
||||
Display::RubyText => true,
|
||||
// Ruby base container and text container are breakable.
|
||||
// Note that, when certain HTML tags, e.g. form controls, have ruby
|
||||
// level container display type, they could also escape from the
|
||||
// line break suppression flag while they shouldn't. However, it is
|
||||
// generally fine since they themselves are non-breakable.
|
||||
display::ruby_base_container |
|
||||
display::ruby_text_container => false,
|
||||
Display::RubyBaseContainer |
|
||||
Display::RubyTextContainer => false,
|
||||
// Anything else is non-breakable if and only if its layout parent
|
||||
// has a ruby display type, because any of the ruby boxes can be
|
||||
// anonymous.
|
||||
|
@ -448,7 +450,7 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
|
|||
) {
|
||||
use properties::CascadeFlags;
|
||||
use properties::computed_value_flags::ComputedValueFlags;
|
||||
use properties::longhands::unicode_bidi::computed_value::T as unicode_bidi;
|
||||
use properties::longhands::unicode_bidi::computed_value::T as UnicodeBidi;
|
||||
|
||||
let self_display = self.style.get_box().clone_display();
|
||||
// Check whether line break should be suppressed for this element.
|
||||
|
@ -475,9 +477,9 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
|
|||
// per spec https://drafts.csswg.org/css-ruby-1/#bidi
|
||||
if self_display.is_ruby_type() {
|
||||
let new_value = match self.style.get_text().clone_unicode_bidi() {
|
||||
unicode_bidi::normal |
|
||||
unicode_bidi::embed => Some(unicode_bidi::isolate),
|
||||
unicode_bidi::bidi_override => Some(unicode_bidi::isolate_override),
|
||||
UnicodeBidi::Normal |
|
||||
UnicodeBidi::Embed => Some(UnicodeBidi::Isolate),
|
||||
UnicodeBidi::BidiOverride => Some(UnicodeBidi::IsolateOverride),
|
||||
_ => None,
|
||||
};
|
||||
if let Some(new_value) = new_value {
|
||||
|
|
|
@ -12,7 +12,7 @@ use log::LogLevel::Trace;
|
|||
use matching::{CascadeVisitedMode, MatchMethods};
|
||||
use properties::{AnimationRules, CascadeFlags, ComputedValues};
|
||||
use properties::cascade;
|
||||
use properties::longhands::display::computed_value::T as display;
|
||||
use properties::longhands::display::computed_value::T as Display;
|
||||
use rule_tree::StrongRuleNode;
|
||||
use selector_parser::{PseudoElement, SelectorImpl};
|
||||
use selectors::matching::{ElementSelectorFlags, MatchingContext, MatchingMode, VisitedHandlingMode};
|
||||
|
@ -115,7 +115,7 @@ fn eager_pseudo_is_definitely_not_generated(
|
|||
}
|
||||
|
||||
if !style.flags.intersects(ComputedValueFlags::INHERITS_DISPLAY) &&
|
||||
style.get_box().clone_display() == display::none {
|
||||
style.get_box().clone_display() == Display::None {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -803,7 +803,7 @@ impl ToComputedValue for specified::MozScriptLevel {
|
|||
specified::MozScriptLevel::Auto => {
|
||||
let parent = cx.builder.get_parent_font().clone__moz_script_level() as i32;
|
||||
let display = cx.builder.get_parent_font().clone__moz_math_display();
|
||||
if display == DisplayValue::inline {
|
||||
if display == DisplayValue::Inline {
|
||||
parent + 1
|
||||
} else {
|
||||
parent
|
||||
|
|
|
@ -125,9 +125,8 @@ define_css_keyword_enum! { OverscrollBehavior:
|
|||
}
|
||||
add_impls_for_keyword_enum!(OverscrollBehavior);
|
||||
|
||||
// FIXME(emilio): Make all keywords CamelCase.
|
||||
define_css_keyword_enum! { OverflowClipBox:
|
||||
"padding-box" => padding_box,
|
||||
"content-box" => content_box,
|
||||
"padding-box" => PaddingBox,
|
||||
"content-box" => ContentBox,
|
||||
}
|
||||
add_impls_for_keyword_enum!(OverflowClipBox);
|
||||
|
|
|
@ -141,24 +141,26 @@ fn parse_number_with_clamping_mode<'i, 't>(
|
|||
|
||||
// The integer values here correspond to the border conflict resolution rules in CSS 2.1 §
|
||||
// 17.6.2.1. Higher values override lower values.
|
||||
//
|
||||
// FIXME(emilio): Should move to border.rs
|
||||
define_numbered_css_keyword_enum! { BorderStyle:
|
||||
"none" => none = -1,
|
||||
"solid" => solid = 6,
|
||||
"double" => double = 7,
|
||||
"dotted" => dotted = 4,
|
||||
"dashed" => dashed = 5,
|
||||
"hidden" => hidden = -2,
|
||||
"groove" => groove = 1,
|
||||
"ridge" => ridge = 3,
|
||||
"inset" => inset = 0,
|
||||
"outset" => outset = 2,
|
||||
"none" => None = -1,
|
||||
"solid" => Solid = 6,
|
||||
"double" => Double = 7,
|
||||
"dotted" => Dotted = 4,
|
||||
"dashed" => Dashed = 5,
|
||||
"hidden" => Hidden = -2,
|
||||
"groove" => Groove = 1,
|
||||
"ridge" => Ridge = 3,
|
||||
"inset" => Inset = 0,
|
||||
"outset" => Outset = 2,
|
||||
}
|
||||
|
||||
|
||||
impl BorderStyle {
|
||||
/// Whether this border style is either none or hidden.
|
||||
pub fn none_or_hidden(&self) -> bool {
|
||||
matches!(*self, BorderStyle::none | BorderStyle::hidden)
|
||||
matches!(*self, BorderStyle::None | BorderStyle::Hidden)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ use metrics::{PaintTimeMetrics, ProfilerMetadataFactory, ProgressiveWebMetric};
|
|||
use msg::constellation_msg::TEST_PIPELINE_ID;
|
||||
use net_traits::image::base::PixelFormat;
|
||||
use profile_traits::time::{ProfilerChan, TimerMetadata};
|
||||
use style::computed_values::image_rendering;
|
||||
use style::computed_values::image_rendering::T as ImageRendering;
|
||||
use time;
|
||||
|
||||
struct DummyProfilerMetadataFactory {}
|
||||
|
@ -127,7 +127,7 @@ fn test_first_contentful_paint_setter() {
|
|||
image_data: None,
|
||||
stretch_size: Size2D::zero(),
|
||||
tile_spacing: Size2D::zero(),
|
||||
image_rendering: image_rendering::T::auto,
|
||||
image_rendering: ImageRendering::Auto,
|
||||
}));
|
||||
let display_list = DisplayList {
|
||||
list: vec![image],
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use properties::{parse, parse_input};
|
||||
use style::computed_values::display::T::inline_block;
|
||||
use style::computed_values::display::T as Display;
|
||||
use style::properties::{PropertyDeclaration, Importance};
|
||||
use style::properties::parse_property_declaration_list;
|
||||
use style::values::{CustomIdent, RGBA, Auto};
|
||||
|
@ -32,16 +32,15 @@ fn property_declaration_block_should_serialize_correctly() {
|
|||
LengthOrPercentageOrAuto::Length(NoCalcLength::from_px(20f32))),
|
||||
Importance::Important),
|
||||
|
||||
(PropertyDeclaration::Display(
|
||||
inline_block),
|
||||
(PropertyDeclaration::Display(Display::InlineBlock),
|
||||
Importance::Normal),
|
||||
|
||||
(PropertyDeclaration::OverflowX(
|
||||
OverflowValue::auto),
|
||||
OverflowValue::Auto),
|
||||
Importance::Normal),
|
||||
|
||||
(PropertyDeclaration::OverflowY(
|
||||
OverflowValue::auto),
|
||||
OverflowValue::Auto),
|
||||
Importance::Normal),
|
||||
];
|
||||
|
||||
|
@ -74,7 +73,7 @@ mod shorthand_serialization {
|
|||
fn equal_overflow_properties_should_serialize_to_single_value() {
|
||||
let mut properties = Vec::new();
|
||||
|
||||
let overflow = OverflowValue::auto;
|
||||
let overflow = OverflowValue::Auto;
|
||||
properties.push(PropertyDeclaration::OverflowX(overflow));
|
||||
properties.push(PropertyDeclaration::OverflowY(overflow));
|
||||
|
||||
|
@ -86,10 +85,10 @@ mod shorthand_serialization {
|
|||
fn different_overflow_properties_should_serialize_to_two_values() {
|
||||
let mut properties = Vec::new();
|
||||
|
||||
let overflow_x = OverflowValue::scroll;
|
||||
let overflow_x = OverflowValue::Scroll;
|
||||
properties.push(PropertyDeclaration::OverflowX(overflow_x));
|
||||
|
||||
let overflow_y = OverflowValue::auto;
|
||||
let overflow_y = OverflowValue::Auto;
|
||||
properties.push(PropertyDeclaration::OverflowY(overflow_y));
|
||||
|
||||
let serialization = shorthand_properties_to_string(properties);
|
||||
|
@ -171,7 +170,7 @@ mod shorthand_serialization {
|
|||
fn different_longhands_should_serialize_to_long_form() {
|
||||
let mut properties = Vec::new();
|
||||
|
||||
let solid = BorderStyle::solid;
|
||||
let solid = BorderStyle::Solid;
|
||||
|
||||
properties.push(PropertyDeclaration::BorderTopStyle(solid.clone()));
|
||||
properties.push(PropertyDeclaration::BorderRightStyle(solid.clone()));
|
||||
|
@ -202,7 +201,7 @@ mod shorthand_serialization {
|
|||
fn same_longhands_should_serialize_correctly() {
|
||||
let mut properties = Vec::new();
|
||||
|
||||
let solid = BorderStyle::solid;
|
||||
let solid = BorderStyle::Solid;
|
||||
|
||||
properties.push(PropertyDeclaration::BorderTopStyle(solid.clone()));
|
||||
properties.push(PropertyDeclaration::BorderRightStyle(solid.clone()));
|
||||
|
@ -303,8 +302,8 @@ mod shorthand_serialization {
|
|||
fn border_style_should_serialize_correctly() {
|
||||
let mut properties = Vec::new();
|
||||
|
||||
let solid = BorderStyle::solid;
|
||||
let dotted = BorderStyle::dotted;
|
||||
let solid = BorderStyle::Solid;
|
||||
let dotted = BorderStyle::Dotted;
|
||||
properties.push(PropertyDeclaration::BorderTopStyle(solid.clone()));
|
||||
properties.push(PropertyDeclaration::BorderRightStyle(dotted.clone()));
|
||||
properties.push(PropertyDeclaration::BorderBottomStyle(solid));
|
||||
|
@ -345,7 +344,7 @@ mod shorthand_serialization {
|
|||
fn border_top_and_color() {
|
||||
let mut properties = Vec::new();
|
||||
properties.push(PropertyDeclaration::BorderTopWidth(BorderSideWidth::Length(Length::from_px(1.))));
|
||||
properties.push(PropertyDeclaration::BorderTopStyle(BorderStyle::solid));
|
||||
properties.push(PropertyDeclaration::BorderTopStyle(BorderStyle::Solid));
|
||||
let c = Color::Numeric {
|
||||
parsed: RGBA::new(255, 0, 0, 255),
|
||||
authored: Some("green".to_string().into_boxed_str())
|
||||
|
@ -377,7 +376,7 @@ mod shorthand_serialization {
|
|||
properties.push(PropertyDeclaration::BorderRightColor(c.clone()));
|
||||
|
||||
properties.push(PropertyDeclaration::BorderTopWidth(BorderSideWidth::Length(Length::from_px(1.))));
|
||||
properties.push(PropertyDeclaration::BorderTopStyle(BorderStyle::solid));
|
||||
properties.push(PropertyDeclaration::BorderTopStyle(BorderStyle::Solid));
|
||||
let c = Color::Numeric {
|
||||
parsed: RGBA::new(255, 0, 0, 255),
|
||||
authored: Some("green".to_string().into_boxed_str())
|
||||
|
@ -396,7 +395,7 @@ mod shorthand_serialization {
|
|||
let mut properties = Vec::new();
|
||||
|
||||
let width = BorderSideWidth::Length(Length::from_px(4f32));
|
||||
let style = BorderStyle::solid;
|
||||
let style = BorderStyle::Solid;
|
||||
let color = RGBA::new(255, 0, 0, 255).into();
|
||||
|
||||
properties.push(PropertyDeclaration::BorderTopWidth(width));
|
||||
|
@ -409,7 +408,7 @@ mod shorthand_serialization {
|
|||
|
||||
fn get_border_property_values() -> (BorderSideWidth, BorderStyle, Color) {
|
||||
(BorderSideWidth::Length(Length::from_px(4f32)),
|
||||
BorderStyle::solid,
|
||||
BorderStyle::Solid,
|
||||
Color::currentcolor())
|
||||
}
|
||||
|
||||
|
@ -492,10 +491,10 @@ mod shorthand_serialization {
|
|||
fn list_style_should_show_all_properties_when_values_are_set() {
|
||||
let mut properties = Vec::new();
|
||||
|
||||
let position = ListStylePosition::inside;
|
||||
let position = ListStylePosition::Inside;
|
||||
let image =
|
||||
ListStyleImage(Either::First(SpecifiedUrl::new_for_testing("http://servo/test.png")));
|
||||
let style_type = ListStyleType::disc;
|
||||
let style_type = ListStyleType::Disc;
|
||||
|
||||
properties.push(PropertyDeclaration::ListStylePosition(position));
|
||||
|
||||
|
@ -520,7 +519,7 @@ mod shorthand_serialization {
|
|||
let mut properties = Vec::new();
|
||||
|
||||
let width = BorderSideWidth::Length(Length::from_px(4f32));
|
||||
let style = Either::Second(BorderStyle::solid);
|
||||
let style = Either::Second(BorderStyle::Solid);
|
||||
let color = RGBA::new(255, 0, 0, 255).into();
|
||||
|
||||
properties.push(PropertyDeclaration::OutlineWidth(width));
|
||||
|
@ -589,8 +588,8 @@ mod shorthand_serialization {
|
|||
|
||||
let mut properties = Vec::new();
|
||||
|
||||
let direction = FlexDirection::row;
|
||||
let wrap = FlexWrap::wrap;
|
||||
let direction = FlexDirection::Row;
|
||||
let wrap = FlexWrap::Wrap;
|
||||
|
||||
properties.push(PropertyDeclaration::FlexDirection(direction));
|
||||
properties.push(PropertyDeclaration::FlexWrap(wrap));
|
||||
|
|
|
@ -80,7 +80,7 @@ fn test_insertion_style_attribute(rule_tree: &RuleTree, rules: &[(StyleSource, C
|
|||
let mut rules = rules.to_vec();
|
||||
rules.push((StyleSource::Declarations(Arc::new(shared_lock.wrap(PropertyDeclarationBlock::with_one(
|
||||
PropertyDeclaration::Display(
|
||||
longhands::display::SpecifiedValue::block),
|
||||
longhands::display::SpecifiedValue::Block),
|
||||
Importance::Normal
|
||||
)))), CascadeLevel::UserNormal));
|
||||
test_insertion(rule_tree, rules)
|
||||
|
|
|
@ -108,7 +108,7 @@ fn test_parse_stylesheet() {
|
|||
), (0 << 20) + (1 << 10) + (1 << 0))
|
||||
)),
|
||||
block: Arc::new(stylesheet.shared_lock.wrap(block_from(vec![
|
||||
(PropertyDeclaration::Display(longhands::display::SpecifiedValue::none),
|
||||
(PropertyDeclaration::Display(longhands::display::SpecifiedValue::None),
|
||||
Importance::Important),
|
||||
(PropertyDeclaration::Custom(Atom::from("a"),
|
||||
DeclaredValueOwned::CSSWideKeyword(CSSWideKeyword::Inherit)),
|
||||
|
@ -138,7 +138,7 @@ fn test_parse_stylesheet() {
|
|||
),
|
||||
)),
|
||||
block: Arc::new(stylesheet.shared_lock.wrap(block_from(vec![
|
||||
(PropertyDeclaration::Display(longhands::display::SpecifiedValue::block),
|
||||
(PropertyDeclaration::Display(longhands::display::SpecifiedValue::Block),
|
||||
Importance::Normal),
|
||||
]))),
|
||||
source_location: SourceLocation {
|
||||
|
|
|
@ -31,7 +31,7 @@ fn get_mock_rules(css_selectors: &[&str]) -> (Vec<Vec<Rule>>, SharedRwLock) {
|
|||
selectors: selectors,
|
||||
block: Arc::new(shared_lock.wrap(PropertyDeclarationBlock::with_one(
|
||||
PropertyDeclaration::Display(
|
||||
longhands::display::SpecifiedValue::block),
|
||||
longhands::display::SpecifiedValue::Block),
|
||||
Importance::Normal
|
||||
))),
|
||||
source_location: SourceLocation {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue