mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
style: Make all keywords CamelCase for consistency.
This prevents confusion and paves the ground for derive(Parse) of them.
This commit is contained in:
parent
37cd870a9e
commit
af879523ea
60 changed files with 921 additions and 836 deletions
|
@ -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,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue