mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Auto merge of #10815 - emilio:anonbox-gcs, r=SimonSapin,bholley
style: Support anonymous box pseudo-elements This is a work-in-progress that: * Adds support for some pseudo-elements to skip the cascade entirely, in an analogous way to Gecko's anonymous box pseudo-elements. * Takes rid of `StylistWrapper`, and uses `Arc::get_mut` instead. * Uses the first bullet to precompute the `-servo-details-content` pseudo's style. I'd like @bholley to take a look before following, do you think that the aproach is the correct? Also, @SimonSapin could want to put some eyes on it. Depends on https://github.com/servo/rust-selectors/pull/81 <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10815) <!-- Reviewable:end -->
This commit is contained in:
commit
407f991c8a
33 changed files with 762 additions and 336 deletions
|
@ -47,6 +47,7 @@ use style::computed_values::content::ContentItem;
|
||||||
use style::computed_values::{caption_side, display, empty_cells, float, list_style_position};
|
use style::computed_values::{caption_side, display, empty_cells, float, list_style_position};
|
||||||
use style::computed_values::{position};
|
use style::computed_values::{position};
|
||||||
use style::properties::{self, ComputedValues, ServoComputedValues};
|
use style::properties::{self, ComputedValues, ServoComputedValues};
|
||||||
|
use style::servo::SharedStyleContext;
|
||||||
use table::TableFlow;
|
use table::TableFlow;
|
||||||
use table_caption::TableCaptionFlow;
|
use table_caption::TableCaptionFlow;
|
||||||
use table_cell::TableCellFlow;
|
use table_cell::TableCellFlow;
|
||||||
|
@ -210,15 +211,15 @@ impl InlineFragmentsAccumulator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn from_inline_node<N>(node: &N) -> InlineFragmentsAccumulator
|
fn from_inline_node<N>(node: &N, style_context: &SharedStyleContext) -> InlineFragmentsAccumulator
|
||||||
where N: ThreadSafeLayoutNode {
|
where N: ThreadSafeLayoutNode {
|
||||||
InlineFragmentsAccumulator {
|
InlineFragmentsAccumulator {
|
||||||
fragments: IntermediateInlineFragments::new(),
|
fragments: IntermediateInlineFragments::new(),
|
||||||
enclosing_node: Some(InlineFragmentNodeInfo {
|
enclosing_node: Some(InlineFragmentNodeInfo {
|
||||||
address: node.opaque(),
|
address: node.opaque(),
|
||||||
pseudo: node.get_pseudo_element_type().strip(),
|
pseudo: node.get_pseudo_element_type().strip(),
|
||||||
style: node.style().clone(),
|
style: node.style(style_context).clone(),
|
||||||
selected_style: node.selected_style().clone(),
|
selected_style: node.selected_style(style_context).clone(),
|
||||||
flags: InlineFragmentNodeFlags::empty(),
|
flags: InlineFragmentNodeFlags::empty(),
|
||||||
}),
|
}),
|
||||||
bidi_control_chars: None,
|
bidi_control_chars: None,
|
||||||
|
@ -287,6 +288,11 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
fn style_context(&self) -> &SharedStyleContext {
|
||||||
|
self.layout_context.style_context()
|
||||||
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn set_flow_construction_result(&self,
|
fn set_flow_construction_result(&self,
|
||||||
node: &ConcreteThreadSafeLayoutNode,
|
node: &ConcreteThreadSafeLayoutNode,
|
||||||
|
@ -336,7 +342,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
||||||
Some(NodeTypeId::Element(ElementTypeId::HTMLElement(
|
Some(NodeTypeId::Element(ElementTypeId::HTMLElement(
|
||||||
HTMLElementTypeId::HTMLCanvasElement))) => {
|
HTMLElementTypeId::HTMLCanvasElement))) => {
|
||||||
let data = node.canvas_data().unwrap();
|
let data = node.canvas_data().unwrap();
|
||||||
SpecificFragmentInfo::Canvas(box CanvasFragmentInfo::new(node, data))
|
SpecificFragmentInfo::Canvas(box CanvasFragmentInfo::new(node, data, self.layout_context))
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
// This includes pseudo-elements.
|
// This includes pseudo-elements.
|
||||||
|
@ -344,7 +350,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Fragment::new(node, specific_fragment_info)
|
Fragment::new(node, specific_fragment_info, self.layout_context)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Generates anonymous table objects per CSS 2.1 § 17.2.1.
|
/// Generates anonymous table objects per CSS 2.1 § 17.2.1.
|
||||||
|
@ -356,13 +362,14 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let style_context = self.style_context();
|
||||||
if child.is_table_cell() {
|
if child.is_table_cell() {
|
||||||
let mut style = child_node.style().clone();
|
let mut style = child_node.style(style_context).clone();
|
||||||
properties::modify_style_for_anonymous_table_object(&mut style, display::T::table_row);
|
properties::modify_style_for_anonymous_table_object(&mut style, display::T::table_row);
|
||||||
let fragment = Fragment::from_opaque_node_and_style(child_node.opaque(),
|
let fragment = Fragment::from_opaque_node_and_style(child_node.opaque(),
|
||||||
PseudoElementType::Normal,
|
PseudoElementType::Normal,
|
||||||
style,
|
style,
|
||||||
child_node.selected_style().clone(),
|
child_node.selected_style(style_context).clone(),
|
||||||
child_node.restyle_damage(),
|
child_node.restyle_damage(),
|
||||||
SpecificFragmentInfo::TableRow);
|
SpecificFragmentInfo::TableRow);
|
||||||
let mut new_child: FlowRef = Arc::new(TableRowFlow::from_fragment(fragment));
|
let mut new_child: FlowRef = Arc::new(TableRowFlow::from_fragment(fragment));
|
||||||
|
@ -371,12 +378,12 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
||||||
*child = new_child
|
*child = new_child
|
||||||
}
|
}
|
||||||
if child.is_table_row() || child.is_table_rowgroup() {
|
if child.is_table_row() || child.is_table_rowgroup() {
|
||||||
let mut style = child_node.style().clone();
|
let mut style = child_node.style(style_context).clone();
|
||||||
properties::modify_style_for_anonymous_table_object(&mut style, display::T::table);
|
properties::modify_style_for_anonymous_table_object(&mut style, display::T::table);
|
||||||
let fragment = Fragment::from_opaque_node_and_style(child_node.opaque(),
|
let fragment = Fragment::from_opaque_node_and_style(child_node.opaque(),
|
||||||
PseudoElementType::Normal,
|
PseudoElementType::Normal,
|
||||||
style,
|
style,
|
||||||
child_node.selected_style().clone(),
|
child_node.selected_style(style_context).clone(),
|
||||||
child_node.restyle_damage(),
|
child_node.restyle_damage(),
|
||||||
SpecificFragmentInfo::Table);
|
SpecificFragmentInfo::Table);
|
||||||
let mut new_child: FlowRef = Arc::new(TableFlow::from_fragment(fragment));
|
let mut new_child: FlowRef = Arc::new(TableFlow::from_fragment(fragment));
|
||||||
|
@ -385,13 +392,13 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
||||||
*child = new_child
|
*child = new_child
|
||||||
}
|
}
|
||||||
if child.is_table() {
|
if child.is_table() {
|
||||||
let mut style = child_node.style().clone();
|
let mut style = child_node.style(style_context).clone();
|
||||||
properties::modify_style_for_anonymous_table_object(&mut style, display::T::table);
|
properties::modify_style_for_anonymous_table_object(&mut style, display::T::table);
|
||||||
let fragment =
|
let fragment =
|
||||||
Fragment::from_opaque_node_and_style(child_node.opaque(),
|
Fragment::from_opaque_node_and_style(child_node.opaque(),
|
||||||
PseudoElementType::Normal,
|
PseudoElementType::Normal,
|
||||||
style,
|
style,
|
||||||
child_node.selected_style().clone(),
|
child_node.selected_style(style_context).clone(),
|
||||||
child_node.restyle_damage(),
|
child_node.restyle_damage(),
|
||||||
SpecificFragmentInfo::TableWrapper);
|
SpecificFragmentInfo::TableWrapper);
|
||||||
let mut new_child: FlowRef = Arc::new(TableWrapperFlow::from_fragment(fragment, None));
|
let mut new_child: FlowRef = Arc::new(TableWrapperFlow::from_fragment(fragment, None));
|
||||||
|
@ -449,7 +456,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
||||||
TextRunScanner::new().scan_for_runs(&mut self.layout_context.font_context(),
|
TextRunScanner::new().scan_for_runs(&mut self.layout_context.font_context(),
|
||||||
fragments.fragments);
|
fragments.fragments);
|
||||||
let mut inline_flow_ref: FlowRef = Arc::new(
|
let mut inline_flow_ref: FlowRef = Arc::new(
|
||||||
InlineFlow::from_fragments(scanned_fragments, node.style().writing_mode));
|
InlineFlow::from_fragments(scanned_fragments, node.style(self.style_context()).writing_mode));
|
||||||
|
|
||||||
// Add all the inline-block fragments as children of the inline flow.
|
// Add all the inline-block fragments as children of the inline flow.
|
||||||
for inline_block_flow in &inline_block_flows {
|
for inline_block_flow in &inline_block_flows {
|
||||||
|
@ -479,7 +486,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
||||||
let (ascent, descent) =
|
let (ascent, descent) =
|
||||||
inline_flow.compute_minimum_ascent_and_descent(&mut self.layout_context
|
inline_flow.compute_minimum_ascent_and_descent(&mut self.layout_context
|
||||||
.font_context(),
|
.font_context(),
|
||||||
&**node.style());
|
&**node.style(self.style_context()));
|
||||||
inline_flow.minimum_block_size_above_baseline = ascent;
|
inline_flow.minimum_block_size_above_baseline = ascent;
|
||||||
inline_flow.minimum_depth_below_baseline = descent;
|
inline_flow.minimum_depth_below_baseline = descent;
|
||||||
}
|
}
|
||||||
|
@ -587,10 +594,11 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
||||||
box UnscannedTextFragmentInfo::new(" ".to_owned(), None));
|
box UnscannedTextFragmentInfo::new(" ".to_owned(), None));
|
||||||
properties::modify_style_for_replaced_content(&mut whitespace_style);
|
properties::modify_style_for_replaced_content(&mut whitespace_style);
|
||||||
properties::modify_style_for_text(&mut whitespace_style);
|
properties::modify_style_for_text(&mut whitespace_style);
|
||||||
|
let style_context = self.style_context();
|
||||||
let fragment = Fragment::from_opaque_node_and_style(whitespace_node,
|
let fragment = Fragment::from_opaque_node_and_style(whitespace_node,
|
||||||
whitespace_pseudo,
|
whitespace_pseudo,
|
||||||
whitespace_style,
|
whitespace_style,
|
||||||
node.selected_style().clone(),
|
node.selected_style(style_context).clone(),
|
||||||
whitespace_damage,
|
whitespace_damage,
|
||||||
fragment_info);
|
fragment_info);
|
||||||
inline_fragment_accumulator.fragments.fragments.push_back(fragment);
|
inline_fragment_accumulator.fragments.fragments.push_back(fragment);
|
||||||
|
@ -696,7 +704,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut style = node.style().clone();
|
let mut style = node.style(self.style_context()).clone();
|
||||||
if node_is_input_or_text_area {
|
if node_is_input_or_text_area {
|
||||||
properties::modify_style_for_input_text(&mut style);
|
properties::modify_style_for_input_text(&mut style);
|
||||||
}
|
}
|
||||||
|
@ -722,7 +730,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
||||||
let mut style = (*style).clone();
|
let mut style = (*style).clone();
|
||||||
properties::modify_style_for_text(&mut style);
|
properties::modify_style_for_text(&mut style);
|
||||||
|
|
||||||
let selected_style = node.selected_style();
|
let selected_style = node.selected_style(self.style_context());
|
||||||
|
|
||||||
match text_content {
|
match text_content {
|
||||||
TextContent::Text(string) => {
|
TextContent::Text(string) => {
|
||||||
|
@ -765,7 +773,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
||||||
/// to happen.
|
/// to happen.
|
||||||
fn build_flow_for_block(&mut self, node: &ConcreteThreadSafeLayoutNode, float_kind: Option<FloatKind>)
|
fn build_flow_for_block(&mut self, node: &ConcreteThreadSafeLayoutNode, float_kind: Option<FloatKind>)
|
||||||
-> ConstructionResult {
|
-> ConstructionResult {
|
||||||
if node.style().is_multicol() {
|
if node.style(self.style_context()).is_multicol() {
|
||||||
return self.build_flow_for_multicol(node, float_kind)
|
return self.build_flow_for_multicol(node, float_kind)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -791,7 +799,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
||||||
predecessors: mem::replace(
|
predecessors: mem::replace(
|
||||||
fragment_accumulator,
|
fragment_accumulator,
|
||||||
InlineFragmentsAccumulator::from_inline_node(
|
InlineFragmentsAccumulator::from_inline_node(
|
||||||
node)).to_intermediate_inline_fragments(),
|
node, self.style_context())).to_intermediate_inline_fragments(),
|
||||||
flow: kid_flow,
|
flow: kid_flow,
|
||||||
};
|
};
|
||||||
opt_inline_block_splits.push_back(split)
|
opt_inline_block_splits.push_back(split)
|
||||||
|
@ -805,8 +813,8 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
||||||
fn build_fragments_for_nonreplaced_inline_content(&mut self, node: &ConcreteThreadSafeLayoutNode)
|
fn build_fragments_for_nonreplaced_inline_content(&mut self, node: &ConcreteThreadSafeLayoutNode)
|
||||||
-> ConstructionResult {
|
-> ConstructionResult {
|
||||||
let mut opt_inline_block_splits: LinkedList<InlineBlockSplit> = LinkedList::new();
|
let mut opt_inline_block_splits: LinkedList<InlineBlockSplit> = LinkedList::new();
|
||||||
let mut fragment_accumulator = InlineFragmentsAccumulator::from_inline_node(node);
|
let mut fragment_accumulator = InlineFragmentsAccumulator::from_inline_node(node, self.style_context());
|
||||||
fragment_accumulator.bidi_control_chars = bidi_control_chars(&*node.style());
|
fragment_accumulator.bidi_control_chars = bidi_control_chars(&*node.style(self.style_context()));
|
||||||
|
|
||||||
let mut abs_descendants = AbsoluteDescendants::new();
|
let mut abs_descendants = AbsoluteDescendants::new();
|
||||||
|
|
||||||
|
@ -828,7 +836,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
||||||
mem::replace(
|
mem::replace(
|
||||||
&mut fragment_accumulator,
|
&mut fragment_accumulator,
|
||||||
InlineFragmentsAccumulator::from_inline_node(
|
InlineFragmentsAccumulator::from_inline_node(
|
||||||
node)).to_intermediate_inline_fragments(),
|
node, self.style_context())).to_intermediate_inline_fragments(),
|
||||||
flow: flow,
|
flow: flow,
|
||||||
};
|
};
|
||||||
opt_inline_block_splits.push_back(split);
|
opt_inline_block_splits.push_back(split);
|
||||||
|
@ -879,10 +887,11 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
||||||
box UnscannedTextFragmentInfo::new(" ".to_owned(), None));
|
box UnscannedTextFragmentInfo::new(" ".to_owned(), None));
|
||||||
properties::modify_style_for_replaced_content(&mut whitespace_style);
|
properties::modify_style_for_replaced_content(&mut whitespace_style);
|
||||||
properties::modify_style_for_text(&mut whitespace_style);
|
properties::modify_style_for_text(&mut whitespace_style);
|
||||||
let fragment = Fragment::from_opaque_node_and_style(whitespace_node,
|
let fragment =
|
||||||
|
Fragment::from_opaque_node_and_style(whitespace_node,
|
||||||
whitespace_pseudo,
|
whitespace_pseudo,
|
||||||
whitespace_style,
|
whitespace_style,
|
||||||
node.selected_style().clone(),
|
node.selected_style(self.style_context()).clone(),
|
||||||
whitespace_damage,
|
whitespace_damage,
|
||||||
fragment_info);
|
fragment_info);
|
||||||
fragment_accumulator.fragments.fragments.push_back(fragment)
|
fragment_accumulator.fragments.fragments.push_back(fragment)
|
||||||
|
@ -894,17 +903,18 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if is_empty && node.style().has_padding_or_border() {
|
let node_style = node.style(self.style_context());
|
||||||
|
if is_empty && node_style.has_padding_or_border() {
|
||||||
// An empty inline box needs at least one fragment to draw its background and borders.
|
// An empty inline box needs at least one fragment to draw its background and borders.
|
||||||
let info = SpecificFragmentInfo::UnscannedText(
|
let info = SpecificFragmentInfo::UnscannedText(
|
||||||
box UnscannedTextFragmentInfo::new(String::new(), None));
|
box UnscannedTextFragmentInfo::new(String::new(), None));
|
||||||
let mut modified_style = node.style().clone();
|
let mut modified_style = node_style.clone();
|
||||||
properties::modify_style_for_replaced_content(&mut modified_style);
|
properties::modify_style_for_replaced_content(&mut modified_style);
|
||||||
properties::modify_style_for_text(&mut modified_style);
|
properties::modify_style_for_text(&mut modified_style);
|
||||||
let fragment = Fragment::from_opaque_node_and_style(node.opaque(),
|
let fragment = Fragment::from_opaque_node_and_style(node.opaque(),
|
||||||
node.get_pseudo_element_type().strip(),
|
node.get_pseudo_element_type().strip(),
|
||||||
modified_style,
|
modified_style,
|
||||||
node.selected_style().clone(),
|
node.selected_style(self.style_context()).clone(),
|
||||||
node.restyle_damage(),
|
node.restyle_damage(),
|
||||||
info);
|
info);
|
||||||
fragment_accumulator.fragments.fragments.push_back(fragment)
|
fragment_accumulator.fragments.fragments.push_back(fragment)
|
||||||
|
@ -917,7 +927,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
||||||
|
|
||||||
// If the node is positioned, then it's the containing block for all absolutely-
|
// If the node is positioned, then it's the containing block for all absolutely-
|
||||||
// positioned descendants.
|
// positioned descendants.
|
||||||
if node.style().get_box().position != position::T::static_ {
|
if node_style.get_box().position != position::T::static_ {
|
||||||
fragment_accumulator.fragments
|
fragment_accumulator.fragments
|
||||||
.absolute_descendants
|
.absolute_descendants
|
||||||
.mark_as_having_reached_containing_block();
|
.mark_as_having_reached_containing_block();
|
||||||
|
@ -944,17 +954,17 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
||||||
}
|
}
|
||||||
|
|
||||||
// If this node is ignorable whitespace, bail out now.
|
// If this node is ignorable whitespace, bail out now.
|
||||||
if node.is_ignorable_whitespace() {
|
if node.is_ignorable_whitespace(self.style_context()) {
|
||||||
return ConstructionResult::ConstructionItem(ConstructionItem::Whitespace(
|
return ConstructionResult::ConstructionItem(ConstructionItem::Whitespace(
|
||||||
node.opaque(),
|
node.opaque(),
|
||||||
node.get_pseudo_element_type().strip(),
|
node.get_pseudo_element_type().strip(),
|
||||||
node.style().clone(),
|
node.style(self.style_context()).clone(),
|
||||||
node.restyle_damage()))
|
node.restyle_damage()))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Modify the style as necessary. (See the comment in
|
// Modify the style as necessary. (See the comment in
|
||||||
// `properties::modify_style_for_replaced_content()`.)
|
// `properties::modify_style_for_replaced_content()`.)
|
||||||
let mut style = (*node.style()).clone();
|
let mut style = (*node.style(self.style_context())).clone();
|
||||||
properties::modify_style_for_replaced_content(&mut style);
|
properties::modify_style_for_replaced_content(&mut style);
|
||||||
|
|
||||||
// If this is generated content, then we need to initialize the accumulator with the
|
// If this is generated content, then we need to initialize the accumulator with the
|
||||||
|
@ -987,14 +997,15 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
||||||
_ => unreachable!()
|
_ => unreachable!()
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut modified_style = (*node.style()).clone();
|
let style_context = self.style_context();
|
||||||
|
let mut modified_style = (*node.style(self.style_context())).clone();
|
||||||
properties::modify_style_for_outer_inline_block_fragment(&mut modified_style);
|
properties::modify_style_for_outer_inline_block_fragment(&mut modified_style);
|
||||||
let fragment_info = SpecificFragmentInfo::InlineBlock(InlineBlockFragmentInfo::new(
|
let fragment_info = SpecificFragmentInfo::InlineBlock(InlineBlockFragmentInfo::new(
|
||||||
block_flow));
|
block_flow));
|
||||||
let fragment = Fragment::from_opaque_node_and_style(node.opaque(),
|
let fragment = Fragment::from_opaque_node_and_style(node.opaque(),
|
||||||
node.get_pseudo_element_type().strip(),
|
node.get_pseudo_element_type().strip(),
|
||||||
modified_style,
|
modified_style,
|
||||||
node.selected_style().clone(),
|
node.selected_style(style_context).clone(),
|
||||||
node.restyle_damage(),
|
node.restyle_damage(),
|
||||||
fragment_info);
|
fragment_info);
|
||||||
|
|
||||||
|
@ -1022,16 +1033,17 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
||||||
|
|
||||||
let fragment_info = SpecificFragmentInfo::InlineAbsoluteHypothetical(
|
let fragment_info = SpecificFragmentInfo::InlineAbsoluteHypothetical(
|
||||||
InlineAbsoluteHypotheticalFragmentInfo::new(block_flow));
|
InlineAbsoluteHypotheticalFragmentInfo::new(block_flow));
|
||||||
let mut style = node.style().clone();
|
let style_context = self.style_context();
|
||||||
|
let mut style = node.style(style_context).clone();
|
||||||
properties::modify_style_for_inline_absolute_hypothetical_fragment(&mut style);
|
properties::modify_style_for_inline_absolute_hypothetical_fragment(&mut style);
|
||||||
let fragment = Fragment::from_opaque_node_and_style(node.opaque(),
|
let fragment = Fragment::from_opaque_node_and_style(node.opaque(),
|
||||||
PseudoElementType::Normal,
|
PseudoElementType::Normal,
|
||||||
style,
|
style,
|
||||||
node.selected_style().clone(),
|
node.selected_style(style_context).clone(),
|
||||||
node.restyle_damage(),
|
node.restyle_damage(),
|
||||||
fragment_info);
|
fragment_info);
|
||||||
|
|
||||||
let mut fragment_accumulator = InlineFragmentsAccumulator::from_inline_node(node);
|
let mut fragment_accumulator = InlineFragmentsAccumulator::from_inline_node(node, self.style_context());
|
||||||
fragment_accumulator.fragments.fragments.push_back(fragment);
|
fragment_accumulator.fragments.fragments.push_back(fragment);
|
||||||
fragment_accumulator.fragments.absolute_descendants.push_descendants(abs_descendants);
|
fragment_accumulator.fragments.absolute_descendants.push_descendants(abs_descendants);
|
||||||
|
|
||||||
|
@ -1087,7 +1099,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
||||||
child_flows: Vec<FlowRef>,
|
child_flows: Vec<FlowRef>,
|
||||||
flow: &mut FlowRef,
|
flow: &mut FlowRef,
|
||||||
node: &ConcreteThreadSafeLayoutNode) {
|
node: &ConcreteThreadSafeLayoutNode) {
|
||||||
let mut anonymous_flow = flow.generate_missing_child_flow(node);
|
let mut anonymous_flow = flow.generate_missing_child_flow(node, self.layout_context);
|
||||||
let mut consecutive_siblings = vec!();
|
let mut consecutive_siblings = vec!();
|
||||||
for kid_flow in child_flows {
|
for kid_flow in child_flows {
|
||||||
if anonymous_flow.need_anonymous_flow(&*kid_flow) {
|
if anonymous_flow.need_anonymous_flow(&*kid_flow) {
|
||||||
|
@ -1115,10 +1127,10 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
||||||
fn build_flow_for_multicol(&mut self, node: &ConcreteThreadSafeLayoutNode,
|
fn build_flow_for_multicol(&mut self, node: &ConcreteThreadSafeLayoutNode,
|
||||||
float_kind: Option<FloatKind>)
|
float_kind: Option<FloatKind>)
|
||||||
-> ConstructionResult {
|
-> ConstructionResult {
|
||||||
let fragment = Fragment::new(node, SpecificFragmentInfo::Multicol);
|
let fragment = Fragment::new(node, SpecificFragmentInfo::Multicol, self.layout_context);
|
||||||
let mut flow: FlowRef = Arc::new(MulticolFlow::from_fragment(fragment, float_kind));
|
let mut flow: FlowRef = Arc::new(MulticolFlow::from_fragment(fragment, float_kind));
|
||||||
|
|
||||||
let column_fragment = Fragment::new(node, SpecificFragmentInfo::MulticolColumn);
|
let column_fragment = Fragment::new(node, SpecificFragmentInfo::MulticolColumn, self.layout_context);
|
||||||
let column_flow = Arc::new(MulticolColumnFlow::from_fragment(column_fragment));
|
let column_flow = Arc::new(MulticolColumnFlow::from_fragment(column_fragment));
|
||||||
|
|
||||||
// First populate the column flow with its children.
|
// First populate the column flow with its children.
|
||||||
|
@ -1156,11 +1168,11 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
||||||
/// possibly other `TableCaptionFlow`s or `TableFlow`s underneath it.
|
/// possibly other `TableCaptionFlow`s or `TableFlow`s underneath it.
|
||||||
fn build_flow_for_table_wrapper(&mut self, node: &ConcreteThreadSafeLayoutNode, float_value: float::T)
|
fn build_flow_for_table_wrapper(&mut self, node: &ConcreteThreadSafeLayoutNode, float_value: float::T)
|
||||||
-> ConstructionResult {
|
-> ConstructionResult {
|
||||||
let fragment = Fragment::new(node, SpecificFragmentInfo::TableWrapper);
|
let fragment = Fragment::new(node, SpecificFragmentInfo::TableWrapper, self.layout_context);
|
||||||
let mut wrapper_flow: FlowRef = Arc::new(
|
let mut wrapper_flow: FlowRef = Arc::new(
|
||||||
TableWrapperFlow::from_fragment(fragment, FloatKind::from_property(float_value)));
|
TableWrapperFlow::from_fragment(fragment, FloatKind::from_property(float_value)));
|
||||||
|
|
||||||
let table_fragment = Fragment::new(node, SpecificFragmentInfo::Table);
|
let table_fragment = Fragment::new(node, SpecificFragmentInfo::Table, self.layout_context);
|
||||||
let table_flow = Arc::new(TableFlow::from_fragment(table_fragment));
|
let table_flow = Arc::new(TableFlow::from_fragment(table_fragment));
|
||||||
|
|
||||||
// First populate the table flow with its children.
|
// First populate the table flow with its children.
|
||||||
|
@ -1218,7 +1230,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
||||||
/// with possibly other `TableRowFlow`s underneath it.
|
/// with possibly other `TableRowFlow`s underneath it.
|
||||||
fn build_flow_for_table_rowgroup(&mut self, node: &ConcreteThreadSafeLayoutNode)
|
fn build_flow_for_table_rowgroup(&mut self, node: &ConcreteThreadSafeLayoutNode)
|
||||||
-> ConstructionResult {
|
-> ConstructionResult {
|
||||||
let fragment = Fragment::new(node, SpecificFragmentInfo::TableRow);
|
let fragment = Fragment::new(node, SpecificFragmentInfo::TableRow, self.layout_context);
|
||||||
let flow = Arc::new(TableRowGroupFlow::from_fragment(fragment));
|
let flow = Arc::new(TableRowGroupFlow::from_fragment(fragment));
|
||||||
self.build_flow_for_block_like(flow, node)
|
self.build_flow_for_block_like(flow, node)
|
||||||
}
|
}
|
||||||
|
@ -1226,7 +1238,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
||||||
/// Builds a flow for a node with `display: table-row`. This yields a `TableRowFlow` with
|
/// Builds a flow for a node with `display: table-row`. This yields a `TableRowFlow` with
|
||||||
/// possibly other `TableCellFlow`s underneath it.
|
/// possibly other `TableCellFlow`s underneath it.
|
||||||
fn build_flow_for_table_row(&mut self, node: &ConcreteThreadSafeLayoutNode) -> ConstructionResult {
|
fn build_flow_for_table_row(&mut self, node: &ConcreteThreadSafeLayoutNode) -> ConstructionResult {
|
||||||
let fragment = Fragment::new(node, SpecificFragmentInfo::TableRow);
|
let fragment = Fragment::new(node, SpecificFragmentInfo::TableRow, self.layout_context);
|
||||||
let flow = Arc::new(TableRowFlow::from_fragment(fragment));
|
let flow = Arc::new(TableRowFlow::from_fragment(fragment));
|
||||||
self.build_flow_for_block_like(flow, node)
|
self.build_flow_for_block_like(flow, node)
|
||||||
}
|
}
|
||||||
|
@ -1234,14 +1246,14 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
||||||
/// Builds a flow for a node with `display: table-cell`. This yields a `TableCellFlow` with
|
/// Builds a flow for a node with `display: table-cell`. This yields a `TableCellFlow` with
|
||||||
/// possibly other `BlockFlow`s or `InlineFlow`s underneath it.
|
/// possibly other `BlockFlow`s or `InlineFlow`s underneath it.
|
||||||
fn build_flow_for_table_cell(&mut self, node: &ConcreteThreadSafeLayoutNode) -> ConstructionResult {
|
fn build_flow_for_table_cell(&mut self, node: &ConcreteThreadSafeLayoutNode) -> ConstructionResult {
|
||||||
let fragment = Fragment::new(node, SpecificFragmentInfo::TableCell);
|
let fragment = Fragment::new(node, SpecificFragmentInfo::TableCell, self.layout_context);
|
||||||
|
|
||||||
// Determine if the table cell should be hidden. Per CSS 2.1 § 17.6.1.1, this will be true
|
// 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
|
// if the cell has any in-flow elements (even empty ones!) and has `empty-cells` set to
|
||||||
// `hide`.
|
// `hide`.
|
||||||
let hide = node.style().get_inheritedtable().empty_cells == empty_cells::T::hide &&
|
let hide = node.style(self.style_context()).get_inheritedtable().empty_cells == empty_cells::T::hide &&
|
||||||
node.children().all(|kid| {
|
node.children().all(|kid| {
|
||||||
let position = kid.style().get_box().position;
|
let position = kid.style(self.style_context()).get_box().position;
|
||||||
!kid.is_content() ||
|
!kid.is_content() ||
|
||||||
position == position::T::absolute ||
|
position == position::T::absolute ||
|
||||||
position == position::T::fixed
|
position == position::T::fixed
|
||||||
|
@ -1257,15 +1269,15 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
||||||
fn build_flow_for_list_item(&mut self, node: &ConcreteThreadSafeLayoutNode, flotation: float::T)
|
fn build_flow_for_list_item(&mut self, node: &ConcreteThreadSafeLayoutNode, flotation: float::T)
|
||||||
-> ConstructionResult {
|
-> ConstructionResult {
|
||||||
let flotation = FloatKind::from_property(flotation);
|
let flotation = FloatKind::from_property(flotation);
|
||||||
let marker_fragments = match node.style().get_list().list_style_image.0 {
|
let marker_fragments = match node.style(self.style_context()).get_list().list_style_image.0 {
|
||||||
Some(ref url) => {
|
Some(ref url) => {
|
||||||
let image_info = box ImageFragmentInfo::new(node,
|
let image_info = box ImageFragmentInfo::new(node,
|
||||||
Some((*url).clone()),
|
Some((*url).clone()),
|
||||||
&self.layout_context);
|
&self.layout_context);
|
||||||
vec![Fragment::new(node, SpecificFragmentInfo::Image(image_info))]
|
vec![Fragment::new(node, SpecificFragmentInfo::Image(image_info), self.layout_context)]
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
match ListStyleTypeContent::from_list_style_type(node.style()
|
match ListStyleTypeContent::from_list_style_type(node.style(self.style_context())
|
||||||
.get_list()
|
.get_list()
|
||||||
.list_style_type) {
|
.list_style_type) {
|
||||||
ListStyleTypeContent::None => Vec::new(),
|
ListStyleTypeContent::None => Vec::new(),
|
||||||
|
@ -1275,14 +1287,15 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
||||||
unscanned_marker_fragments.push_back(Fragment::new(
|
unscanned_marker_fragments.push_back(Fragment::new(
|
||||||
node,
|
node,
|
||||||
SpecificFragmentInfo::UnscannedText(
|
SpecificFragmentInfo::UnscannedText(
|
||||||
box UnscannedTextFragmentInfo::new(text, None))));
|
box UnscannedTextFragmentInfo::new(text, None)),
|
||||||
|
self.layout_context));
|
||||||
let marker_fragments = TextRunScanner::new().scan_for_runs(
|
let marker_fragments = TextRunScanner::new().scan_for_runs(
|
||||||
&mut self.layout_context.font_context(),
|
&mut self.layout_context.font_context(),
|
||||||
unscanned_marker_fragments);
|
unscanned_marker_fragments);
|
||||||
marker_fragments.fragments
|
marker_fragments.fragments
|
||||||
}
|
}
|
||||||
ListStyleTypeContent::GeneratedContent(info) => {
|
ListStyleTypeContent::GeneratedContent(info) => {
|
||||||
vec![Fragment::new(node, SpecificFragmentInfo::GeneratedContent(info))]
|
vec![Fragment::new(node, SpecificFragmentInfo::GeneratedContent(info), self.layout_context)]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1295,7 +1308,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
||||||
// there.
|
// there.
|
||||||
let mut initial_fragments = IntermediateInlineFragments::new();
|
let mut initial_fragments = IntermediateInlineFragments::new();
|
||||||
let main_fragment = self.build_fragment_for_block(node);
|
let main_fragment = self.build_fragment_for_block(node);
|
||||||
let flow = match node.style().get_list().list_style_position {
|
let flow = match node.style(self.style_context()).get_list().list_style_position {
|
||||||
list_style_position::T::outside => {
|
list_style_position::T::outside => {
|
||||||
Arc::new(ListItemFlow::from_fragments_and_flotation(
|
Arc::new(ListItemFlow::from_fragments_and_flotation(
|
||||||
main_fragment, marker_fragments, flotation))
|
main_fragment, marker_fragments, flotation))
|
||||||
|
@ -1322,7 +1335,8 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
||||||
|
|
||||||
let specific = SpecificFragmentInfo::TableColumn(TableColumnFragmentInfo::new(node));
|
let specific = SpecificFragmentInfo::TableColumn(TableColumnFragmentInfo::new(node));
|
||||||
let construction_item = ConstructionItem::TableColumnFragment(Fragment::new(node,
|
let construction_item = ConstructionItem::TableColumnFragment(Fragment::new(node,
|
||||||
specific));
|
specific,
|
||||||
|
self.layout_context));
|
||||||
ConstructionResult::ConstructionItem(construction_item)
|
ConstructionResult::ConstructionItem(construction_item)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1332,7 +1346,8 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
||||||
-> ConstructionResult {
|
-> ConstructionResult {
|
||||||
let fragment =
|
let fragment =
|
||||||
Fragment::new(node,
|
Fragment::new(node,
|
||||||
SpecificFragmentInfo::TableColumn(TableColumnFragmentInfo::new(node)));
|
SpecificFragmentInfo::TableColumn(TableColumnFragmentInfo::new(node)),
|
||||||
|
self.layout_context);
|
||||||
let mut col_fragments = vec!();
|
let mut col_fragments = vec!();
|
||||||
for kid in node.children() {
|
for kid in node.children() {
|
||||||
// CSS 2.1 § 17.2.1. Treat all non-column child fragments of `table-column-group`
|
// CSS 2.1 § 17.2.1. Treat all non-column child fragments of `table-column-group`
|
||||||
|
@ -1345,7 +1360,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
||||||
if col_fragments.is_empty() {
|
if col_fragments.is_empty() {
|
||||||
debug!("add SpecificFragmentInfo::TableColumn for empty colgroup");
|
debug!("add SpecificFragmentInfo::TableColumn for empty colgroup");
|
||||||
let specific = SpecificFragmentInfo::TableColumn(TableColumnFragmentInfo::new(node));
|
let specific = SpecificFragmentInfo::TableColumn(TableColumnFragmentInfo::new(node));
|
||||||
col_fragments.push(Fragment::new(node, specific));
|
col_fragments.push(Fragment::new(node, specific, self.layout_context));
|
||||||
}
|
}
|
||||||
let mut flow: FlowRef = Arc::new(TableColGroupFlow::from_fragments(fragment, col_fragments));
|
let mut flow: FlowRef = Arc::new(TableColGroupFlow::from_fragments(fragment, col_fragments));
|
||||||
flow.finish();
|
flow.finish();
|
||||||
|
@ -1387,11 +1402,11 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
if node.can_be_fragmented() || node.style().is_multicol() {
|
if node.can_be_fragmented() || node.style(self.style_context()).is_multicol() {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut style = node.style().clone();
|
let mut style = node.style(self.style_context()).clone();
|
||||||
let mut data = node.mutate_layout_data().unwrap();
|
let mut data = node.mutate_layout_data().unwrap();
|
||||||
let damage = data.restyle_damage;
|
let damage = data.restyle_damage;
|
||||||
match *node.construction_result_mut(&mut *data) {
|
match *node.construction_result_mut(&mut *data) {
|
||||||
|
@ -1490,18 +1505,20 @@ impl<'a, ConcreteThreadSafeLayoutNode> PostorderNodeMutTraversal<ConcreteThreadS
|
||||||
let (display, float, positioning) = match node.type_id() {
|
let (display, float, positioning) = match node.type_id() {
|
||||||
None => {
|
None => {
|
||||||
// Pseudo-element.
|
// Pseudo-element.
|
||||||
let style = node.style();
|
let style = node.style(self.style_context());
|
||||||
let display = match node.get_pseudo_element_type() {
|
let display = match node.get_pseudo_element_type() {
|
||||||
PseudoElementType::Normal => display::T::inline,
|
PseudoElementType::Normal
|
||||||
PseudoElementType::Before(display) => display,
|
=> display::T::inline,
|
||||||
PseudoElementType::After(display) => display,
|
PseudoElementType::Before(maybe_display) |
|
||||||
PseudoElementType::DetailsContent(display) => display,
|
PseudoElementType::After(maybe_display) |
|
||||||
PseudoElementType::DetailsSummary(display) => display,
|
PseudoElementType::DetailsContent(maybe_display) |
|
||||||
|
PseudoElementType::DetailsSummary(maybe_display)
|
||||||
|
=> maybe_display.unwrap_or(style.get_box().display),
|
||||||
};
|
};
|
||||||
(display, style.get_box().float, style.get_box().position)
|
(display, style.get_box().float, style.get_box().position)
|
||||||
}
|
}
|
||||||
Some(NodeTypeId::Element(_)) => {
|
Some(NodeTypeId::Element(_)) => {
|
||||||
let style = node.style();
|
let style = node.style(self.style_context());
|
||||||
let munged_display = if style.get_box()._servo_display_for_hypothetical_box ==
|
let munged_display = if style.get_box()._servo_display_for_hypothetical_box ==
|
||||||
display::T::inline {
|
display::T::inline {
|
||||||
display::T::inline
|
display::T::inline
|
||||||
|
|
|
@ -108,7 +108,7 @@ pub struct LayoutContext<'a> {
|
||||||
cached_local_layout_context: Rc<LocalLayoutContext>,
|
cached_local_layout_context: Rc<LocalLayoutContext>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> StyleContext<'a, ServoSelectorImpl, ServoComputedValues> for LayoutContext<'a> {
|
impl<'a> StyleContext<'a, ServoSelectorImpl> for LayoutContext<'a> {
|
||||||
fn shared_context(&self) -> &'a SharedStyleContext {
|
fn shared_context(&self) -> &'a SharedStyleContext {
|
||||||
&self.shared.style_context
|
&self.shared.style_context
|
||||||
}
|
}
|
||||||
|
@ -129,6 +129,11 @@ impl<'a> LayoutContext<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline(always)]
|
||||||
|
pub fn style_context(&self) -> &SharedStyleContext {
|
||||||
|
&self.shared.style_context
|
||||||
|
}
|
||||||
|
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
pub fn font_context(&self) -> RefMut<FontContext> {
|
pub fn font_context(&self) -> RefMut<FontContext> {
|
||||||
self.cached_local_layout_context.font_context.borrow_mut()
|
self.cached_local_layout_context.font_context.borrow_mut()
|
||||||
|
|
|
@ -17,8 +17,9 @@ pub struct PrivateLayoutData {
|
||||||
/// Description of how to account for recent style changes.
|
/// Description of how to account for recent style changes.
|
||||||
pub restyle_damage: RestyleDamage,
|
pub restyle_damage: RestyleDamage,
|
||||||
|
|
||||||
/// The current results of flow construction for this node. This is either a flow or a
|
/// The current results of flow construction for this node. This is either a
|
||||||
/// `ConstructionItem`. See comments in `construct.rs` for more details.
|
/// flow or a `ConstructionItem`. See comments in `construct.rs` for more
|
||||||
|
/// details.
|
||||||
pub flow_construction_result: ConstructionResult,
|
pub flow_construction_result: ConstructionResult,
|
||||||
|
|
||||||
pub before_flow_construction_result: ConstructionResult,
|
pub before_flow_construction_result: ConstructionResult,
|
||||||
|
|
|
@ -483,7 +483,7 @@ pub trait ImmutableFlowUtils {
|
||||||
fn need_anonymous_flow(self, child: &Flow) -> bool;
|
fn need_anonymous_flow(self, child: &Flow) -> bool;
|
||||||
|
|
||||||
/// Generates missing child flow of this flow.
|
/// Generates missing child flow of this flow.
|
||||||
fn generate_missing_child_flow<N: ThreadSafeLayoutNode>(self, node: &N) -> FlowRef;
|
fn generate_missing_child_flow<N: ThreadSafeLayoutNode>(self, node: &N, ctx: &LayoutContext) -> FlowRef;
|
||||||
|
|
||||||
/// Returns true if this flow contains fragments that are roots of an absolute flow tree.
|
/// Returns true if this flow contains fragments that are roots of an absolute flow tree.
|
||||||
fn contains_roots_of_absolute_flow_tree(&self) -> bool;
|
fn contains_roots_of_absolute_flow_tree(&self) -> bool;
|
||||||
|
@ -1275,8 +1275,9 @@ impl<'a> ImmutableFlowUtils for &'a Flow {
|
||||||
/// FIXME(pcwalton): This duplicates some logic in
|
/// FIXME(pcwalton): This duplicates some logic in
|
||||||
/// `generate_anonymous_table_flows_if_necessary()`. We should remove this function eventually,
|
/// `generate_anonymous_table_flows_if_necessary()`. We should remove this function eventually,
|
||||||
/// as it's harder to understand.
|
/// as it's harder to understand.
|
||||||
fn generate_missing_child_flow<N: ThreadSafeLayoutNode>(self, node: &N) -> FlowRef {
|
fn generate_missing_child_flow<N: ThreadSafeLayoutNode>(self, node: &N, ctx: &LayoutContext) -> FlowRef {
|
||||||
let mut style = node.style().clone();
|
let style_context = ctx.style_context();
|
||||||
|
let mut style = node.style(style_context).clone();
|
||||||
match self.class() {
|
match self.class() {
|
||||||
FlowClass::Table | FlowClass::TableRowGroup => {
|
FlowClass::Table | FlowClass::TableRowGroup => {
|
||||||
properties::modify_style_for_anonymous_table_object(
|
properties::modify_style_for_anonymous_table_object(
|
||||||
|
@ -1286,7 +1287,7 @@ impl<'a> ImmutableFlowUtils for &'a Flow {
|
||||||
node.opaque(),
|
node.opaque(),
|
||||||
PseudoElementType::Normal,
|
PseudoElementType::Normal,
|
||||||
style,
|
style,
|
||||||
node.selected_style().clone(),
|
node.selected_style(style_context).clone(),
|
||||||
node.restyle_damage(),
|
node.restyle_damage(),
|
||||||
SpecificFragmentInfo::TableRow);
|
SpecificFragmentInfo::TableRow);
|
||||||
Arc::new(TableRowFlow::from_fragment(fragment))
|
Arc::new(TableRowFlow::from_fragment(fragment))
|
||||||
|
@ -1299,10 +1300,10 @@ impl<'a> ImmutableFlowUtils for &'a Flow {
|
||||||
node.opaque(),
|
node.opaque(),
|
||||||
PseudoElementType::Normal,
|
PseudoElementType::Normal,
|
||||||
style,
|
style,
|
||||||
node.selected_style().clone(),
|
node.selected_style(style_context).clone(),
|
||||||
node.restyle_damage(),
|
node.restyle_damage(),
|
||||||
SpecificFragmentInfo::TableCell);
|
SpecificFragmentInfo::TableCell);
|
||||||
let hide = node.style().get_inheritedtable().empty_cells == empty_cells::T::hide;
|
let hide = node.style(style_context).get_inheritedtable().empty_cells == empty_cells::T::hide;
|
||||||
Arc::new(TableCellFlow::from_node_fragment_and_visibility_flag(node, fragment, !hide))
|
Arc::new(TableCellFlow::from_node_fragment_and_visibility_flag(node, fragment, !hide))
|
||||||
},
|
},
|
||||||
FlowClass::Flex => {
|
FlowClass::Flex => {
|
||||||
|
@ -1310,7 +1311,7 @@ impl<'a> ImmutableFlowUtils for &'a Flow {
|
||||||
Fragment::from_opaque_node_and_style(node.opaque(),
|
Fragment::from_opaque_node_and_style(node.opaque(),
|
||||||
PseudoElementType::Normal,
|
PseudoElementType::Normal,
|
||||||
style,
|
style,
|
||||||
node.selected_style().clone(),
|
node.selected_style(style_context).clone(),
|
||||||
node.restyle_damage(),
|
node.restyle_damage(),
|
||||||
SpecificFragmentInfo::Generic);
|
SpecificFragmentInfo::Generic);
|
||||||
Arc::new(BlockFlow::from_fragment(fragment, None))
|
Arc::new(BlockFlow::from_fragment(fragment, None))
|
||||||
|
|
|
@ -319,9 +319,9 @@ pub struct CanvasFragmentInfo {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl CanvasFragmentInfo {
|
impl CanvasFragmentInfo {
|
||||||
pub fn new<N: ThreadSafeLayoutNode>(node: &N, data: HTMLCanvasData) -> CanvasFragmentInfo {
|
pub fn new<N: ThreadSafeLayoutNode>(node: &N, data: HTMLCanvasData, ctx: &LayoutContext) -> CanvasFragmentInfo {
|
||||||
CanvasFragmentInfo {
|
CanvasFragmentInfo {
|
||||||
replaced_image_fragment_info: ReplacedImageFragmentInfo::new(node),
|
replaced_image_fragment_info: ReplacedImageFragmentInfo::new(node, ctx),
|
||||||
ipc_renderer: data.ipc_renderer
|
ipc_renderer: data.ipc_renderer
|
||||||
.map(|renderer| Arc::new(Mutex::new(renderer))),
|
.map(|renderer| Arc::new(Mutex::new(renderer))),
|
||||||
dom_width: Au::from_px(data.width as i32),
|
dom_width: Au::from_px(data.width as i32),
|
||||||
|
@ -382,7 +382,7 @@ impl ImageFragmentInfo {
|
||||||
};
|
};
|
||||||
|
|
||||||
ImageFragmentInfo {
|
ImageFragmentInfo {
|
||||||
replaced_image_fragment_info: ReplacedImageFragmentInfo::new(node),
|
replaced_image_fragment_info: ReplacedImageFragmentInfo::new(node, layout_context),
|
||||||
image: image,
|
image: image,
|
||||||
metadata: metadata,
|
metadata: metadata,
|
||||||
}
|
}
|
||||||
|
@ -441,9 +441,9 @@ pub struct ReplacedImageFragmentInfo {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ReplacedImageFragmentInfo {
|
impl ReplacedImageFragmentInfo {
|
||||||
pub fn new<N>(node: &N) -> ReplacedImageFragmentInfo
|
pub fn new<N>(node: &N, ctx: &LayoutContext) -> ReplacedImageFragmentInfo
|
||||||
where N: ThreadSafeLayoutNode {
|
where N: ThreadSafeLayoutNode {
|
||||||
let is_vertical = node.style().writing_mode.is_vertical();
|
let is_vertical = node.style(ctx.style_context()).writing_mode.is_vertical();
|
||||||
ReplacedImageFragmentInfo {
|
ReplacedImageFragmentInfo {
|
||||||
computed_inline_size: None,
|
computed_inline_size: None,
|
||||||
computed_block_size: None,
|
computed_block_size: None,
|
||||||
|
@ -789,8 +789,9 @@ impl TableColumnFragmentInfo {
|
||||||
|
|
||||||
impl Fragment {
|
impl Fragment {
|
||||||
/// Constructs a new `Fragment` instance.
|
/// Constructs a new `Fragment` instance.
|
||||||
pub fn new<N: ThreadSafeLayoutNode>(node: &N, specific: SpecificFragmentInfo) -> Fragment {
|
pub fn new<N: ThreadSafeLayoutNode>(node: &N, specific: SpecificFragmentInfo, ctx: &LayoutContext) -> Fragment {
|
||||||
let style = node.style().clone();
|
let style_context = ctx.style_context();
|
||||||
|
let style = node.style(style_context).clone();
|
||||||
let writing_mode = style.writing_mode;
|
let writing_mode = style.writing_mode;
|
||||||
|
|
||||||
let mut restyle_damage = node.restyle_damage();
|
let mut restyle_damage = node.restyle_damage();
|
||||||
|
@ -799,7 +800,7 @@ impl Fragment {
|
||||||
Fragment {
|
Fragment {
|
||||||
node: node.opaque(),
|
node: node.opaque(),
|
||||||
style: style,
|
style: style,
|
||||||
selected_style: node.selected_style().clone(),
|
selected_style: node.selected_style(style_context).clone(),
|
||||||
restyle_damage: restyle_damage,
|
restyle_damage: restyle_damage,
|
||||||
border_box: LogicalRect::zero(writing_mode),
|
border_box: LogicalRect::zero(writing_mode),
|
||||||
border_padding: LogicalMargin::zero(writing_mode),
|
border_padding: LogicalMargin::zero(writing_mode),
|
||||||
|
|
|
@ -67,14 +67,13 @@ use std::sync::mpsc::{channel, Sender, Receiver};
|
||||||
use std::sync::{Arc, Mutex, MutexGuard, RwLock};
|
use std::sync::{Arc, Mutex, MutexGuard, RwLock};
|
||||||
use style::animation::Animation;
|
use style::animation::Animation;
|
||||||
use style::computed_values::{filter, mix_blend_mode};
|
use style::computed_values::{filter, mix_blend_mode};
|
||||||
use style::context::{ReflowGoal, StylistWrapper};
|
use style::context::{ReflowGoal};
|
||||||
use style::dom::{TDocument, TElement, TNode};
|
use style::dom::{TDocument, TElement, TNode};
|
||||||
use style::error_reporting::ParseErrorReporter;
|
use style::error_reporting::ParseErrorReporter;
|
||||||
use style::logical_geometry::LogicalPoint;
|
use style::logical_geometry::LogicalPoint;
|
||||||
use style::media_queries::{Device, MediaType};
|
use style::media_queries::{Device, MediaType};
|
||||||
use style::parallel::WorkQueueData;
|
use style::parallel::WorkQueueData;
|
||||||
use style::properties::ComputedValues;
|
use style::properties::ComputedValues;
|
||||||
use style::selector_impl::ServoSelectorImpl;
|
|
||||||
use style::selector_matching::USER_OR_USER_AGENT_STYLESHEETS;
|
use style::selector_matching::USER_OR_USER_AGENT_STYLESHEETS;
|
||||||
use style::servo::{SharedStyleContext, Stylesheet, Stylist};
|
use style::servo::{SharedStyleContext, Stylesheet, Stylist};
|
||||||
use style::stylesheets::CSSRuleIteratorExt;
|
use style::stylesheets::CSSRuleIteratorExt;
|
||||||
|
@ -107,7 +106,7 @@ pub struct LayoutThreadData {
|
||||||
pub display_list: Option<Arc<DisplayList>>,
|
pub display_list: Option<Arc<DisplayList>>,
|
||||||
|
|
||||||
/// Performs CSS selector matching and style resolution.
|
/// Performs CSS selector matching and style resolution.
|
||||||
pub stylist: Box<Stylist>,
|
pub stylist: Arc<Stylist>,
|
||||||
|
|
||||||
/// A queued response for the union of the content boxes of a node.
|
/// A queued response for the union of the content boxes of a node.
|
||||||
pub content_box_response: Rect<Au>,
|
pub content_box_response: Rect<Au>,
|
||||||
|
@ -421,7 +420,7 @@ impl LayoutThread {
|
||||||
let font_cache_receiver =
|
let font_cache_receiver =
|
||||||
ROUTER.route_ipc_receiver_to_new_mpsc_receiver(ipc_font_cache_receiver);
|
ROUTER.route_ipc_receiver_to_new_mpsc_receiver(ipc_font_cache_receiver);
|
||||||
|
|
||||||
let stylist = box Stylist::new(device);
|
let stylist = Arc::new(Stylist::new(device));
|
||||||
let outstanding_web_fonts_counter = Arc::new(AtomicUsize::new(0));
|
let outstanding_web_fonts_counter = Arc::new(AtomicUsize::new(0));
|
||||||
for stylesheet in &*USER_OR_USER_AGENT_STYLESHEETS {
|
for stylesheet in &*USER_OR_USER_AGENT_STYLESHEETS {
|
||||||
add_font_face_rules(stylesheet,
|
add_font_face_rules(stylesheet,
|
||||||
|
@ -510,7 +509,7 @@ impl LayoutThread {
|
||||||
style_context: SharedStyleContext {
|
style_context: SharedStyleContext {
|
||||||
viewport_size: self.viewport_size.clone(),
|
viewport_size: self.viewport_size.clone(),
|
||||||
screen_size_changed: screen_size_changed,
|
screen_size_changed: screen_size_changed,
|
||||||
stylist: StylistWrapper::<ServoSelectorImpl>(&*rw_data.stylist),
|
stylist: rw_data.stylist.clone(),
|
||||||
generation: self.generation,
|
generation: self.generation,
|
||||||
goal: goal,
|
goal: goal,
|
||||||
new_animations_sender: Mutex::new(self.new_animations_sender.clone()),
|
new_animations_sender: Mutex::new(self.new_animations_sender.clone()),
|
||||||
|
@ -809,7 +808,7 @@ impl LayoutThread {
|
||||||
/// Sets quirks mode for the document, causing the quirks mode stylesheet to be used.
|
/// Sets quirks mode for the document, causing the quirks mode stylesheet to be used.
|
||||||
fn handle_set_quirks_mode<'a, 'b>(&self, possibly_locked_rw_data: &mut RwData<'a, 'b>) {
|
fn handle_set_quirks_mode<'a, 'b>(&self, possibly_locked_rw_data: &mut RwData<'a, 'b>) {
|
||||||
let mut rw_data = possibly_locked_rw_data.lock();
|
let mut rw_data = possibly_locked_rw_data.lock();
|
||||||
rw_data.stylist.set_quirks_mode(true);
|
Arc::get_mut(&mut rw_data.stylist).unwrap().set_quirks_mode(true);
|
||||||
possibly_locked_rw_data.block(rw_data);
|
possibly_locked_rw_data.block(rw_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1060,7 +1059,7 @@ impl LayoutThread {
|
||||||
|
|
||||||
// Calculate the actual viewport as per DEVICE-ADAPT § 6
|
// Calculate the actual viewport as per DEVICE-ADAPT § 6
|
||||||
let device = Device::new(MediaType::Screen, initial_viewport);
|
let device = Device::new(MediaType::Screen, initial_viewport);
|
||||||
rw_data.stylist.set_device(device, &data.document_stylesheets);
|
Arc::get_mut(&mut rw_data.stylist).unwrap().set_device(device, &data.document_stylesheets);
|
||||||
|
|
||||||
let constraints = rw_data.stylist.viewport_constraints().clone();
|
let constraints = rw_data.stylist.viewport_constraints().clone();
|
||||||
self.viewport_size = match constraints {
|
self.viewport_size = match constraints {
|
||||||
|
@ -1092,7 +1091,7 @@ impl LayoutThread {
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the entire flow tree is invalid, then it will be reflowed anyhow.
|
// If the entire flow tree is invalid, then it will be reflowed anyhow.
|
||||||
needs_dirtying |= rw_data.stylist.update(&data.document_stylesheets,
|
needs_dirtying |= Arc::get_mut(&mut rw_data.stylist).unwrap().update(&data.document_stylesheets,
|
||||||
data.stylesheets_changed);
|
data.stylesheets_changed);
|
||||||
let needs_reflow = viewport_size_changed && !needs_dirtying;
|
let needs_reflow = viewport_size_changed && !needs_dirtying;
|
||||||
unsafe {
|
unsafe {
|
||||||
|
|
|
@ -103,3 +103,4 @@ mod wrapper;
|
||||||
|
|
||||||
// For unit tests:
|
// For unit tests:
|
||||||
pub use fragment::Fragment;
|
pub use fragment::Fragment;
|
||||||
|
pub use wrapper::ServoThreadSafeLayoutNode;
|
||||||
|
|
|
@ -574,8 +574,8 @@ pub fn process_resolved_style_request<N: LayoutNode>(
|
||||||
let layout_node = match *pseudo {
|
let layout_node = match *pseudo {
|
||||||
Some(PseudoElement::Before) => layout_node.get_before_pseudo(),
|
Some(PseudoElement::Before) => layout_node.get_before_pseudo(),
|
||||||
Some(PseudoElement::After) => layout_node.get_after_pseudo(),
|
Some(PseudoElement::After) => layout_node.get_after_pseudo(),
|
||||||
Some(PseudoElement::DetailsSummary) => layout_node.get_details_summary_pseudo(),
|
Some(PseudoElement::DetailsSummary) |
|
||||||
Some(PseudoElement::DetailsContent) => layout_node.get_details_content_pseudo(),
|
Some(PseudoElement::DetailsContent) |
|
||||||
Some(PseudoElement::Selection) => None,
|
Some(PseudoElement::Selection) => None,
|
||||||
_ => Some(layout_node)
|
_ => Some(layout_node)
|
||||||
};
|
};
|
||||||
|
@ -590,7 +590,7 @@ pub fn process_resolved_style_request<N: LayoutNode>(
|
||||||
Some(layout_node) => layout_node
|
Some(layout_node) => layout_node
|
||||||
};
|
};
|
||||||
|
|
||||||
let style = &*layout_node.style();
|
let style = &*layout_node.resolved_style();
|
||||||
|
|
||||||
let positioned = match style.get_box().position {
|
let positioned = match style.get_box().position {
|
||||||
position::computed_value::T::relative |
|
position::computed_value::T::relative |
|
||||||
|
@ -711,7 +711,7 @@ pub fn process_offset_parent_query<N: LayoutNode>(requested_node: N, layout_root
|
||||||
|
|
||||||
pub fn process_node_overflow_request<N: LayoutNode>(requested_node: N) -> NodeOverflowResponse {
|
pub fn process_node_overflow_request<N: LayoutNode>(requested_node: N) -> NodeOverflowResponse {
|
||||||
let layout_node = requested_node.to_threadsafe();
|
let layout_node = requested_node.to_threadsafe();
|
||||||
let style = &*layout_node.style();
|
let style = &*layout_node.resolved_style();
|
||||||
let style_box = style.get_box();
|
let style_box = style.get_box();
|
||||||
|
|
||||||
NodeOverflowResponse(Some((Point2D::new(style_box.overflow_x, style_box.overflow_y.0))))
|
NodeOverflowResponse(Some((Point2D::new(style_box.overflow_x, style_box.overflow_y.0))))
|
||||||
|
@ -720,7 +720,7 @@ pub fn process_node_overflow_request<N: LayoutNode>(requested_node: N) -> NodeOv
|
||||||
pub fn process_margin_style_query<N: LayoutNode>(requested_node: N)
|
pub fn process_margin_style_query<N: LayoutNode>(requested_node: N)
|
||||||
-> MarginStyleResponse {
|
-> MarginStyleResponse {
|
||||||
let layout_node = requested_node.to_threadsafe();
|
let layout_node = requested_node.to_threadsafe();
|
||||||
let style = &*layout_node.style();
|
let style = &*layout_node.resolved_style();
|
||||||
let margin = style.get_margin();
|
let margin = style.get_margin();
|
||||||
|
|
||||||
MarginStyleResponse {
|
MarginStyleResponse {
|
||||||
|
|
|
@ -72,7 +72,7 @@ use style::properties::{ComputedValues, ServoComputedValues};
|
||||||
use style::properties::{PropertyDeclaration, PropertyDeclarationBlock};
|
use style::properties::{PropertyDeclaration, PropertyDeclarationBlock};
|
||||||
use style::restyle_hints::ElementSnapshot;
|
use style::restyle_hints::ElementSnapshot;
|
||||||
use style::selector_impl::{NonTSPseudoClass, PseudoElement, ServoSelectorImpl};
|
use style::selector_impl::{NonTSPseudoClass, PseudoElement, ServoSelectorImpl};
|
||||||
use style::servo::PrivateStyleData;
|
use style::servo::{PrivateStyleData, SharedStyleContext};
|
||||||
use url::Url;
|
use url::Url;
|
||||||
use util::str::is_whitespace;
|
use util::str::is_whitespace;
|
||||||
|
|
||||||
|
@ -428,14 +428,14 @@ impl<'le> TElement for ServoLayoutElement<'le> {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn get_attr<'a>(&'a self, namespace: &Namespace, name: &Atom) -> Option<&'a str> {
|
fn get_attr(&self, namespace: &Namespace, name: &Atom) -> Option<&str> {
|
||||||
unsafe {
|
unsafe {
|
||||||
(*self.element.unsafe_get()).get_attr_val_for_layout(namespace, name)
|
(*self.element.unsafe_get()).get_attr_val_for_layout(namespace, name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn get_attrs<'a>(&'a self, name: &Atom) -> Vec<&'a str> {
|
fn get_attrs(&self, name: &Atom) -> Vec<&str> {
|
||||||
unsafe {
|
unsafe {
|
||||||
(*self.element.unsafe_get()).get_attr_vals_for_layout(name)
|
(*self.element.unsafe_get()).get_attr_vals_for_layout(name)
|
||||||
}
|
}
|
||||||
|
@ -650,6 +650,16 @@ impl<T> PseudoElementType<T> {
|
||||||
PseudoElementType::DetailsContent(_) => PseudoElementType::DetailsContent(()),
|
PseudoElementType::DetailsContent(_) => PseudoElementType::DetailsContent(()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn style_pseudo_element(&self) -> PseudoElement {
|
||||||
|
match *self {
|
||||||
|
PseudoElementType::Normal => unreachable!("style_pseudo_element called with PseudoElementType::Normal"),
|
||||||
|
PseudoElementType::Before(_) => PseudoElement::Before,
|
||||||
|
PseudoElementType::After(_) => PseudoElement::After,
|
||||||
|
PseudoElementType::DetailsSummary(_) => PseudoElement::DetailsSummary,
|
||||||
|
PseudoElementType::DetailsContent(_) => PseudoElement::DetailsContent,
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A thread-safe version of `LayoutNode`, used during flow construction. This type of layout
|
/// A thread-safe version of `LayoutNode`, used during flow construction. This type of layout
|
||||||
|
@ -661,7 +671,7 @@ pub trait ThreadSafeLayoutNode : Clone + Copy + Sized + PartialEq {
|
||||||
|
|
||||||
/// Creates a new `ThreadSafeLayoutNode` for the same `LayoutNode`
|
/// Creates a new `ThreadSafeLayoutNode` for the same `LayoutNode`
|
||||||
/// with a different pseudo-element type.
|
/// with a different pseudo-element type.
|
||||||
fn with_pseudo(&self, pseudo: PseudoElementType<display::T>) -> Self;
|
fn with_pseudo(&self, pseudo: PseudoElementType<Option<display::T>>) -> Self;
|
||||||
|
|
||||||
/// Converts self into an `OpaqueNode`.
|
/// Converts self into an `OpaqueNode`.
|
||||||
fn opaque(&self) -> OpaqueNode;
|
fn opaque(&self) -> OpaqueNode;
|
||||||
|
@ -685,42 +695,36 @@ pub trait ThreadSafeLayoutNode : Clone + Copy + Sized + PartialEq {
|
||||||
fn as_element(&self) -> Self::ConcreteThreadSafeLayoutElement;
|
fn as_element(&self) -> Self::ConcreteThreadSafeLayoutElement;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn get_pseudo_element_type(&self) -> PseudoElementType<display::T>;
|
fn get_pseudo_element_type(&self) -> PseudoElementType<Option<display::T>>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn get_before_pseudo(&self) -> Option<Self> {
|
fn get_before_pseudo(&self) -> Option<Self> {
|
||||||
self.borrow_layout_data().unwrap()
|
if self.borrow_layout_data().unwrap()
|
||||||
.style_data.per_pseudo
|
.style_data.per_pseudo
|
||||||
.get(&PseudoElement::Before)
|
.contains_key(&PseudoElement::Before) {
|
||||||
.map(|style| {
|
Some(self.with_pseudo(PseudoElementType::Before(None)))
|
||||||
self.with_pseudo(PseudoElementType::Before(style.get_box().display))
|
} else {
|
||||||
})
|
None
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn get_after_pseudo(&self) -> Option<Self> {
|
fn get_after_pseudo(&self) -> Option<Self> {
|
||||||
self.borrow_layout_data().unwrap()
|
if self.borrow_layout_data().unwrap()
|
||||||
.style_data.per_pseudo
|
.style_data.per_pseudo
|
||||||
.get(&PseudoElement::After)
|
.contains_key(&PseudoElement::After) {
|
||||||
.map(|style| {
|
Some(self.with_pseudo(PseudoElementType::After(None)))
|
||||||
self.with_pseudo(PseudoElementType::After(style.get_box().display))
|
} else {
|
||||||
})
|
None
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(emilio): Since the ::-details-* pseudos are internal, just affecting one element, and
|
|
||||||
// only changing `display` property when the element `open` attribute changes, this should be
|
|
||||||
// eligible for not being cascaded eagerly, reading the display property from layout instead.
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn get_details_summary_pseudo(&self) -> Option<Self> {
|
fn get_details_summary_pseudo(&self) -> Option<Self> {
|
||||||
if self.is_element() &&
|
if self.is_element() &&
|
||||||
self.as_element().get_local_name() == &atom!("details") &&
|
self.as_element().get_local_name() == &atom!("details") &&
|
||||||
self.as_element().get_namespace() == &ns!(html) {
|
self.as_element().get_namespace() == &ns!(html) {
|
||||||
self.borrow_layout_data().unwrap()
|
Some(self.with_pseudo(PseudoElementType::DetailsSummary(None)))
|
||||||
.style_data.per_pseudo
|
|
||||||
.get(&PseudoElement::DetailsSummary)
|
|
||||||
.map(|style| {
|
|
||||||
self.with_pseudo(PseudoElementType::DetailsSummary(style.get_box().display))
|
|
||||||
})
|
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
@ -731,12 +735,12 @@ pub trait ThreadSafeLayoutNode : Clone + Copy + Sized + PartialEq {
|
||||||
if self.is_element() &&
|
if self.is_element() &&
|
||||||
self.as_element().get_local_name() == &atom!("details") &&
|
self.as_element().get_local_name() == &atom!("details") &&
|
||||||
self.as_element().get_namespace() == &ns!(html) {
|
self.as_element().get_namespace() == &ns!(html) {
|
||||||
self.borrow_layout_data().unwrap()
|
let display = if self.as_element().get_attr(&ns!(), &atom!("open")).is_some() {
|
||||||
.style_data.per_pseudo
|
None // Specified by the stylesheet
|
||||||
.get(&PseudoElement::DetailsContent)
|
} else {
|
||||||
.map(|style| {
|
Some(display::T::none)
|
||||||
self.with_pseudo(PseudoElementType::DetailsContent(style.get_box().display))
|
};
|
||||||
})
|
Some(self.with_pseudo(PseudoElementType::DetailsContent(display)))
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
@ -759,23 +763,58 @@ pub trait ThreadSafeLayoutNode : Clone + Copy + Sized + PartialEq {
|
||||||
///
|
///
|
||||||
/// Unlike the version on TNode, this handles pseudo-elements.
|
/// Unlike the version on TNode, this handles pseudo-elements.
|
||||||
#[inline]
|
#[inline]
|
||||||
fn style(&self) -> Ref<Arc<ServoComputedValues>> {
|
fn style(&self, context: &SharedStyleContext) -> Ref<Arc<ServoComputedValues>> {
|
||||||
|
match self.get_pseudo_element_type() {
|
||||||
|
PseudoElementType::Normal => {
|
||||||
Ref::map(self.borrow_layout_data().unwrap(), |data| {
|
Ref::map(self.borrow_layout_data().unwrap(), |data| {
|
||||||
let style = match self.get_pseudo_element_type() {
|
data.style_data.style.as_ref().unwrap()
|
||||||
PseudoElementType::Before(_) => data.style_data.per_pseudo.get(&PseudoElement::Before),
|
})
|
||||||
PseudoElementType::After(_) => data.style_data.per_pseudo.get(&PseudoElement::After),
|
},
|
||||||
PseudoElementType::DetailsSummary(_) => data.style_data.per_pseudo.get(&PseudoElement::DetailsSummary),
|
other => {
|
||||||
PseudoElementType::DetailsContent(_) => data.style_data.per_pseudo.get(&PseudoElement::DetailsContent),
|
// Precompute non-eagerly-cascaded pseudo-element styles if not
|
||||||
PseudoElementType::Normal => data.style_data.style.as_ref(),
|
// cached before.
|
||||||
};
|
let style_pseudo = other.style_pseudo_element();
|
||||||
style.unwrap()
|
if !style_pseudo.is_eagerly_cascaded() &&
|
||||||
|
!self.borrow_layout_data().unwrap().style_data.per_pseudo.contains_key(&style_pseudo) {
|
||||||
|
let mut data = self.mutate_layout_data().unwrap();
|
||||||
|
let new_style = context.stylist
|
||||||
|
.computed_values_for_pseudo(&style_pseudo,
|
||||||
|
data.style_data.style.as_ref());
|
||||||
|
data.style_data.per_pseudo.insert(style_pseudo.clone(), new_style.unwrap());
|
||||||
|
}
|
||||||
|
|
||||||
|
Ref::map(self.borrow_layout_data().unwrap(), |data| {
|
||||||
|
data.style_data.per_pseudo.get(&style_pseudo).unwrap()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Returns the already resolved style of the node.
|
||||||
|
///
|
||||||
|
/// This differs from `style(ctx)` in that if the pseudo-element has not yet
|
||||||
|
/// been computed it would panic.
|
||||||
|
///
|
||||||
|
/// This should be used just for querying layout, or when we know the
|
||||||
|
/// element style is precomputed, not from general layout itself.
|
||||||
|
#[inline]
|
||||||
|
fn resolved_style(&self) -> Ref<Arc<ServoComputedValues>> {
|
||||||
|
Ref::map(self.borrow_layout_data().unwrap(), |data| {
|
||||||
|
match self.get_pseudo_element_type() {
|
||||||
|
PseudoElementType::Normal
|
||||||
|
=> data.style_data.style.as_ref().unwrap(),
|
||||||
|
other
|
||||||
|
=> data.style_data.per_pseudo.get(&other.style_pseudo_element()).unwrap(),
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn selected_style(&self) -> Ref<Arc<ServoComputedValues>> {
|
fn selected_style(&self, _context: &SharedStyleContext) -> Ref<Arc<ServoComputedValues>> {
|
||||||
Ref::map(self.borrow_layout_data().unwrap(), |data| {
|
Ref::map(self.borrow_layout_data().unwrap(), |data| {
|
||||||
data.style_data.per_pseudo.get(&PseudoElement::Selection).unwrap_or(data.style_data.style.as_ref().unwrap())
|
data.style_data.per_pseudo
|
||||||
|
.get(&PseudoElement::Selection)
|
||||||
|
.unwrap_or(data.style_data.style.as_ref().unwrap())
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -786,26 +825,16 @@ pub trait ThreadSafeLayoutNode : Clone + Copy + Sized + PartialEq {
|
||||||
let mut data = self.mutate_layout_data().unwrap();
|
let mut data = self.mutate_layout_data().unwrap();
|
||||||
|
|
||||||
match self.get_pseudo_element_type() {
|
match self.get_pseudo_element_type() {
|
||||||
PseudoElementType::Before(_) => {
|
|
||||||
data.style_data.per_pseudo.remove(&PseudoElement::Before);
|
|
||||||
}
|
|
||||||
PseudoElementType::After(_) => {
|
|
||||||
data.style_data.per_pseudo.remove(&PseudoElement::After);
|
|
||||||
}
|
|
||||||
PseudoElementType::DetailsSummary(_) => {
|
|
||||||
data.style_data.per_pseudo.remove(&PseudoElement::DetailsSummary);
|
|
||||||
}
|
|
||||||
PseudoElementType::DetailsContent(_) => {
|
|
||||||
data.style_data.per_pseudo.remove(&PseudoElement::DetailsContent);
|
|
||||||
}
|
|
||||||
|
|
||||||
PseudoElementType::Normal => {
|
PseudoElementType::Normal => {
|
||||||
data.style_data.style = None;
|
data.style_data.style = None;
|
||||||
}
|
}
|
||||||
|
other => {
|
||||||
|
data.style_data.per_pseudo.remove(&other.style_pseudo_element());
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_ignorable_whitespace(&self) -> bool;
|
fn is_ignorable_whitespace(&self, context: &SharedStyleContext) -> bool;
|
||||||
|
|
||||||
fn restyle_damage(self) -> RestyleDamage;
|
fn restyle_damage(self) -> RestyleDamage;
|
||||||
|
|
||||||
|
@ -884,7 +913,7 @@ pub trait ThreadSafeLayoutElement: Clone + Copy + Sized {
|
||||||
type ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode<ConcreteThreadSafeLayoutElement = Self>;
|
type ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode<ConcreteThreadSafeLayoutElement = Self>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn get_attr<'a>(&'a self, namespace: &Namespace, name: &Atom) -> Option<&'a str>;
|
fn get_attr(&self, namespace: &Namespace, name: &Atom) -> Option<&str>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn get_local_name(&self) -> &Atom;
|
fn get_local_name(&self) -> &Atom;
|
||||||
|
@ -898,7 +927,9 @@ pub struct ServoThreadSafeLayoutNode<'ln> {
|
||||||
/// The wrapped node.
|
/// The wrapped node.
|
||||||
node: ServoLayoutNode<'ln>,
|
node: ServoLayoutNode<'ln>,
|
||||||
|
|
||||||
pseudo: PseudoElementType<display::T>,
|
/// The pseudo-element type, with (optionally),
|
||||||
|
/// an specified display value to override the stylesheet.
|
||||||
|
pseudo: PseudoElementType<Option<display::T>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> PartialEq for ServoThreadSafeLayoutNode<'a> {
|
impl<'a> PartialEq for ServoThreadSafeLayoutNode<'a> {
|
||||||
|
@ -948,7 +979,8 @@ impl<'ln> ThreadSafeLayoutNode for ServoThreadSafeLayoutNode<'ln> {
|
||||||
type ConcreteThreadSafeLayoutElement = ServoThreadSafeLayoutElement<'ln>;
|
type ConcreteThreadSafeLayoutElement = ServoThreadSafeLayoutElement<'ln>;
|
||||||
type ChildrenIterator = ThreadSafeLayoutNodeChildrenIterator<Self>;
|
type ChildrenIterator = ThreadSafeLayoutNodeChildrenIterator<Self>;
|
||||||
|
|
||||||
fn with_pseudo(&self, pseudo: PseudoElementType<display::T>) -> ServoThreadSafeLayoutNode<'ln> {
|
fn with_pseudo(&self,
|
||||||
|
pseudo: PseudoElementType<Option<display::T>>) -> ServoThreadSafeLayoutNode<'ln> {
|
||||||
ServoThreadSafeLayoutNode {
|
ServoThreadSafeLayoutNode {
|
||||||
node: self.node.clone(),
|
node: self.node.clone(),
|
||||||
pseudo: pseudo,
|
pseudo: pseudo,
|
||||||
|
@ -993,7 +1025,7 @@ impl<'ln> ThreadSafeLayoutNode for ServoThreadSafeLayoutNode<'ln> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_pseudo_element_type(&self) -> PseudoElementType<display::T> {
|
fn get_pseudo_element_type(&self) -> PseudoElementType<Option<display::T>> {
|
||||||
self.pseudo
|
self.pseudo
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1005,7 +1037,7 @@ impl<'ln> ThreadSafeLayoutNode for ServoThreadSafeLayoutNode<'ln> {
|
||||||
self.node.mutate_layout_data()
|
self.node.mutate_layout_data()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_ignorable_whitespace(&self) -> bool {
|
fn is_ignorable_whitespace(&self, context: &SharedStyleContext) -> bool {
|
||||||
unsafe {
|
unsafe {
|
||||||
let text: LayoutJS<Text> = match self.get_jsmanaged().downcast() {
|
let text: LayoutJS<Text> = match self.get_jsmanaged().downcast() {
|
||||||
Some(text) => text,
|
Some(text) => text,
|
||||||
|
@ -1022,7 +1054,7 @@ impl<'ln> ThreadSafeLayoutNode for ServoThreadSafeLayoutNode<'ln> {
|
||||||
//
|
//
|
||||||
// If you implement other values for this property, you will almost certainly
|
// If you implement other values for this property, you will almost certainly
|
||||||
// want to update this check.
|
// want to update this check.
|
||||||
!self.style().get_inheritedtext().white_space.preserve_newlines()
|
!self.style(context).get_inheritedtext().white_space.preserve_newlines()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1046,13 +1078,7 @@ impl<'ln> ThreadSafeLayoutNode for ServoThreadSafeLayoutNode<'ln> {
|
||||||
|
|
||||||
fn text_content(&self) -> TextContent {
|
fn text_content(&self) -> TextContent {
|
||||||
if self.pseudo.is_replaced_content() {
|
if self.pseudo.is_replaced_content() {
|
||||||
let data = &self.borrow_layout_data().unwrap().style_data;
|
let style = self.resolved_style();
|
||||||
|
|
||||||
let style = if self.pseudo.is_before() {
|
|
||||||
data.per_pseudo.get(&PseudoElement::Before).unwrap()
|
|
||||||
} else {
|
|
||||||
data.per_pseudo.get(&PseudoElement::After).unwrap()
|
|
||||||
};
|
|
||||||
|
|
||||||
return match style.as_ref().get_counters().content {
|
return match style.as_ref().get_counters().content {
|
||||||
content::T::Content(ref value) if !value.is_empty() => {
|
content::T::Content(ref value) if !value.is_empty() => {
|
||||||
|
@ -1078,7 +1104,7 @@ impl<'ln> ThreadSafeLayoutNode for ServoThreadSafeLayoutNode<'ln> {
|
||||||
return TextContent::Text(data);
|
return TextContent::Text(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
panic!("not text!")
|
unreachable!("not text!")
|
||||||
}
|
}
|
||||||
|
|
||||||
fn selection(&self) -> Option<Range<ByteIndex>> {
|
fn selection(&self) -> Option<Range<ByteIndex>> {
|
||||||
|
|
39
components/servo/Cargo.lock
generated
39
components/servo/Cargo.lock
generated
|
@ -158,6 +158,11 @@ name = "bitflags"
|
||||||
version = "0.4.0"
|
version = "0.4.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bitflags"
|
||||||
|
version = "0.5.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "block"
|
name = "block"
|
||||||
version = "0.1.5"
|
version = "0.1.5"
|
||||||
|
@ -727,7 +732,7 @@ dependencies = [
|
||||||
"servo-skia 0.20130412.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"servo-skia 0.20130412.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"simd 0.1.0 (git+https://github.com/huonw/simd)",
|
"simd 0.1.0 (git+https://github.com/huonw/simd)",
|
||||||
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"string_cache 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
"string_cache 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"style 0.0.1",
|
"style 0.0.1",
|
||||||
"style_traits 0.0.1",
|
"style_traits 0.0.1",
|
||||||
"time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
"time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -901,7 +906,7 @@ dependencies = [
|
||||||
"phf 0.7.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
"phf 0.7.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"phf_codegen 0.7.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
"phf_codegen 0.7.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"string_cache 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
"string_cache 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"tendril 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"tendril 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
"time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
@ -1092,11 +1097,11 @@ dependencies = [
|
||||||
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"script 0.0.1",
|
"script 0.0.1",
|
||||||
"script_traits 0.0.1",
|
"script_traits 0.0.1",
|
||||||
"selectors 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"selectors 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"serde_json 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde_json 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"serde_macros 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde_macros 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"string_cache 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
"string_cache 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"style 0.0.1",
|
"style 0.0.1",
|
||||||
"style_traits 0.0.1",
|
"style_traits 0.0.1",
|
||||||
"time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
"time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -1827,10 +1832,10 @@ dependencies = [
|
||||||
"regex 0.1.55 (registry+https://github.com/rust-lang/crates.io-index)",
|
"regex 0.1.55 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"script_traits 0.0.1",
|
"script_traits 0.0.1",
|
||||||
"selectors 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"selectors 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"string_cache 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
"string_cache 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"style 0.0.1",
|
"style 0.0.1",
|
||||||
"time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
"time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"unicase 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"unicase 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -1881,10 +1886,10 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "selectors"
|
name = "selectors"
|
||||||
version = "0.5.2"
|
version = "0.5.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"bitflags 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"cssparser 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cssparser 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"fnv 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"fnv 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"heapsize 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"heapsize 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -1892,7 +1897,7 @@ dependencies = [
|
||||||
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"quickersort 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"quickersort 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"string_cache 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
"string_cache 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -2053,7 +2058,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "string_cache"
|
name = "string_cache"
|
||||||
version = "0.2.12"
|
version = "0.2.13"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"debug_unreachable 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"debug_unreachable 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -2083,11 +2088,11 @@ dependencies = [
|
||||||
"num-traits 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)",
|
"num-traits 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"plugins 0.0.1",
|
"plugins 0.0.1",
|
||||||
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"selectors 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"selectors 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"serde_macros 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde_macros 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"string_cache 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
"string_cache 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"style_traits 0.0.1",
|
"style_traits 0.0.1",
|
||||||
"time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
"time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -2104,8 +2109,8 @@ dependencies = [
|
||||||
"msg 0.0.1",
|
"msg 0.0.1",
|
||||||
"plugins 0.0.1",
|
"plugins 0.0.1",
|
||||||
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"selectors 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"selectors 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"string_cache 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
"string_cache 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"style 0.0.1",
|
"style 0.0.1",
|
||||||
"style_traits 0.0.1",
|
"style_traits 0.0.1",
|
||||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -2124,7 +2129,7 @@ dependencies = [
|
||||||
"log 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"plugins 0.0.1",
|
"plugins 0.0.1",
|
||||||
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"selectors 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"selectors 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"serde_macros 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde_macros 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -2307,7 +2312,7 @@ dependencies = [
|
||||||
"serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"serde_macros 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde_macros 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"string_cache 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
"string_cache 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -2534,7 +2539,7 @@ dependencies = [
|
||||||
"phf 0.7.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
"phf 0.7.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"phf_codegen 0.7.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
"phf_codegen 0.7.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"string_cache 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
"string_cache 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"tendril 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"tendril 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
"time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
|
@ -16,12 +16,6 @@ use std::collections::HashMap;
|
||||||
use std::sync::mpsc::Sender;
|
use std::sync::mpsc::Sender;
|
||||||
use std::sync::{Arc, Mutex, RwLock};
|
use std::sync::{Arc, Mutex, RwLock};
|
||||||
|
|
||||||
pub struct StylistWrapper<Impl: SelectorImplExt>(pub *const Stylist<Impl>);
|
|
||||||
|
|
||||||
// FIXME(#6569) This implementation is unsound.
|
|
||||||
#[allow(unsafe_code)]
|
|
||||||
unsafe impl<Impl: SelectorImplExt> Sync for StylistWrapper<Impl> {}
|
|
||||||
|
|
||||||
pub struct SharedStyleContext<Impl: SelectorImplExt> {
|
pub struct SharedStyleContext<Impl: SelectorImplExt> {
|
||||||
/// The current viewport size.
|
/// The current viewport size.
|
||||||
pub viewport_size: Size2D<Au>,
|
pub viewport_size: Size2D<Au>,
|
||||||
|
@ -30,9 +24,7 @@ pub struct SharedStyleContext<Impl: SelectorImplExt> {
|
||||||
pub screen_size_changed: bool,
|
pub screen_size_changed: bool,
|
||||||
|
|
||||||
/// The CSS selector stylist.
|
/// The CSS selector stylist.
|
||||||
///
|
pub stylist: Arc<Stylist<Impl>>,
|
||||||
/// FIXME(#2604): Make this no longer an unsafe pointer once we have fast `RWArc`s.
|
|
||||||
pub stylist: StylistWrapper<Impl>,
|
|
||||||
|
|
||||||
/// Starts at zero, and increased by one every time a layout completes.
|
/// Starts at zero, and increased by one every time a layout completes.
|
||||||
/// This can be used to easily check for invalid stale data.
|
/// This can be used to easily check for invalid stale data.
|
||||||
|
@ -60,10 +52,9 @@ pub struct LocalStyleContext<C: ComputedValues> {
|
||||||
pub style_sharing_candidate_cache: RefCell<StyleSharingCandidateCache<C>>,
|
pub style_sharing_candidate_cache: RefCell<StyleSharingCandidateCache<C>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait StyleContext<'a, Impl: SelectorImplExt, C: ComputedValues> {
|
pub trait StyleContext<'a, Impl: SelectorImplExt> {
|
||||||
|
|
||||||
fn shared_context(&self) -> &'a SharedStyleContext<Impl>;
|
fn shared_context(&self) -> &'a SharedStyleContext<Impl>;
|
||||||
fn local_context(&self) -> &LocalStyleContext<C>;
|
fn local_context(&self) -> &LocalStyleContext<Impl::ComputedValues>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Why we're doing reflow.
|
/// Why we're doing reflow.
|
||||||
|
@ -74,4 +65,3 @@ pub enum ReflowGoal {
|
||||||
/// We're reflowing in order to satisfy a script query. No display list will be created.
|
/// We're reflowing in order to satisfy a script query. No display list will be created.
|
||||||
ForScriptQuery,
|
ForScriptQuery,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,11 +4,12 @@
|
||||||
|
|
||||||
#![allow(unsafe_code)]
|
#![allow(unsafe_code)]
|
||||||
|
|
||||||
|
use context::SharedStyleContext;
|
||||||
use data::PrivateStyleData;
|
use data::PrivateStyleData;
|
||||||
use element_state::ElementState;
|
use element_state::ElementState;
|
||||||
use properties::{ComputedValues, PropertyDeclaration, PropertyDeclarationBlock};
|
use properties::{ComputedValues, PropertyDeclaration, PropertyDeclarationBlock};
|
||||||
use restyle_hints::{ElementSnapshot, RESTYLE_DESCENDANTS, RESTYLE_LATER_SIBLINGS, RESTYLE_SELF, RestyleHint};
|
use restyle_hints::{ElementSnapshot, RESTYLE_DESCENDANTS, RESTYLE_LATER_SIBLINGS, RESTYLE_SELF, RestyleHint};
|
||||||
use selector_impl::ElementExt;
|
use selector_impl::{ElementExt, SelectorImplExt};
|
||||||
use selectors::Element;
|
use selectors::Element;
|
||||||
use selectors::matching::DeclarationBlock;
|
use selectors::matching::DeclarationBlock;
|
||||||
use smallvec::VecLike;
|
use smallvec::VecLike;
|
||||||
|
@ -170,7 +171,10 @@ pub trait TNode : Sized + Copy + Clone {
|
||||||
|
|
||||||
/// Returns the style results for the given node. If CSS selector matching
|
/// Returns the style results for the given node. If CSS selector matching
|
||||||
/// has not yet been performed, fails.
|
/// has not yet been performed, fails.
|
||||||
fn style(&self) -> Ref<Arc<Self::ConcreteComputedValues>> {
|
fn style(&self,
|
||||||
|
_context: &SharedStyleContext<<Self::ConcreteElement as Element>::Impl>)
|
||||||
|
-> Ref<Arc<Self::ConcreteComputedValues>>
|
||||||
|
where <Self::ConcreteElement as Element>::Impl: SelectorImplExt<ComputedValues=Self::ConcreteComputedValues> {
|
||||||
Ref::map(self.borrow_data().unwrap(), |data| data.style.as_ref().unwrap())
|
Ref::map(self.borrow_data().unwrap(), |data| data.style.as_ref().unwrap())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -136,7 +136,7 @@ impl<'a, E> Element for ElementWrapper<'a, E>
|
||||||
fn get_local_name(&self) -> &Atom {
|
fn get_local_name(&self) -> &Atom {
|
||||||
self.element.get_local_name()
|
self.element.get_local_name()
|
||||||
}
|
}
|
||||||
fn get_namespace<'b>(&self) -> &Namespace {
|
fn get_namespace(&self) -> &Namespace {
|
||||||
self.element.get_namespace()
|
self.element.get_namespace()
|
||||||
}
|
}
|
||||||
fn get_id(&self) -> Option<Atom> {
|
fn get_id(&self) -> Option<Atom> {
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
use element_state::ElementState;
|
use element_state::ElementState;
|
||||||
|
use properties::{self, ServoComputedValues};
|
||||||
use selector_matching::{USER_OR_USER_AGENT_STYLESHEETS, QUIRKS_MODE_STYLESHEET};
|
use selector_matching::{USER_OR_USER_AGENT_STYLESHEETS, QUIRKS_MODE_STYLESHEET};
|
||||||
use selectors::Element;
|
use selectors::Element;
|
||||||
use selectors::parser::{ParserContext, SelectorImpl};
|
use selectors::parser::{ParserContext, SelectorImpl};
|
||||||
|
@ -12,9 +13,51 @@ pub trait ElementExt: Element {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait SelectorImplExt : SelectorImpl + Sized {
|
pub trait SelectorImplExt : SelectorImpl + Sized {
|
||||||
fn each_eagerly_cascaded_pseudo_element<F>(mut fun: F)
|
type ComputedValues: properties::ComputedValues;
|
||||||
|
|
||||||
|
fn each_pseudo_element<F>(mut fun: F)
|
||||||
where F: FnMut(<Self as SelectorImpl>::PseudoElement);
|
where F: FnMut(<Self as SelectorImpl>::PseudoElement);
|
||||||
|
|
||||||
|
/// This function determines if a pseudo-element is eagerly cascaded or not.
|
||||||
|
///
|
||||||
|
/// Eagerly cascaded pseudo-elements are "normal" pseudo-elements (i.e.
|
||||||
|
/// `::before` and `::after`). They inherit styles normally as another
|
||||||
|
/// selector would do.
|
||||||
|
///
|
||||||
|
/// Non-eagerly cascaded ones skip the cascade process entirely, mostly as
|
||||||
|
/// an optimisation since they are private pseudo-elements (like
|
||||||
|
/// `::-servo-details-content`). This pseudo-elements are resolved on the
|
||||||
|
/// fly using global rules (rules of the form `*|*`), and applying them to
|
||||||
|
/// the parent style.
|
||||||
|
///
|
||||||
|
/// If you're implementing a public selector that the end-user might
|
||||||
|
/// customize, then you probably need doing the whole cascading process and
|
||||||
|
/// return true in this function for that pseudo.
|
||||||
|
///
|
||||||
|
/// But if you are implementing a private pseudo-element, please consider if
|
||||||
|
/// it might be possible to skip the cascade for it.
|
||||||
|
fn is_eagerly_cascaded_pseudo_element(pseudo: &<Self as SelectorImpl>::PseudoElement) -> bool;
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
fn each_eagerly_cascaded_pseudo_element<F>(mut fun: F)
|
||||||
|
where F: FnMut(<Self as SelectorImpl>::PseudoElement) {
|
||||||
|
Self::each_pseudo_element(|pseudo| {
|
||||||
|
if Self::is_eagerly_cascaded_pseudo_element(&pseudo) {
|
||||||
|
fun(pseudo)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
fn each_non_eagerly_cascaded_pseudo_element<F>(mut fun: F)
|
||||||
|
where F: FnMut(<Self as SelectorImpl>::PseudoElement) {
|
||||||
|
Self::each_pseudo_element(|pseudo| {
|
||||||
|
if !Self::is_eagerly_cascaded_pseudo_element(&pseudo) {
|
||||||
|
fun(pseudo)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
fn pseudo_class_state_flag(pc: &Self::NonTSPseudoClass) -> ElementState;
|
fn pseudo_class_state_flag(pc: &Self::NonTSPseudoClass) -> ElementState;
|
||||||
|
|
||||||
fn get_user_or_user_agent_stylesheets() -> &'static [Stylesheet<Self>];
|
fn get_user_or_user_agent_stylesheets() -> &'static [Stylesheet<Self>];
|
||||||
|
@ -31,6 +74,19 @@ pub enum PseudoElement {
|
||||||
DetailsContent,
|
DetailsContent,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl PseudoElement {
|
||||||
|
#[inline]
|
||||||
|
pub fn is_eagerly_cascaded(&self) -> bool {
|
||||||
|
match *self {
|
||||||
|
PseudoElement::Before |
|
||||||
|
PseudoElement::After |
|
||||||
|
PseudoElement::Selection |
|
||||||
|
PseudoElement::DetailsSummary => true,
|
||||||
|
PseudoElement::DetailsContent => false,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, HeapSizeOf, Hash)]
|
#[derive(Clone, Debug, PartialEq, Eq, HeapSizeOf, Hash)]
|
||||||
pub enum NonTSPseudoClass {
|
pub enum NonTSPseudoClass {
|
||||||
AnyLink,
|
AnyLink,
|
||||||
|
@ -112,15 +168,17 @@ impl SelectorImpl for ServoSelectorImpl {
|
||||||
"before" => Before,
|
"before" => Before,
|
||||||
"after" => After,
|
"after" => After,
|
||||||
"selection" => Selection,
|
"selection" => Selection,
|
||||||
"-servo-details-summary" => if context.in_user_agent_stylesheet {
|
"-servo-details-summary" => {
|
||||||
|
if !context.in_user_agent_stylesheet {
|
||||||
|
return Err(())
|
||||||
|
}
|
||||||
DetailsSummary
|
DetailsSummary
|
||||||
} else {
|
|
||||||
return Err(())
|
|
||||||
},
|
},
|
||||||
"-servo-details-content" => if context.in_user_agent_stylesheet {
|
"-servo-details-content" => {
|
||||||
DetailsContent
|
if !context.in_user_agent_stylesheet {
|
||||||
} else {
|
|
||||||
return Err(())
|
return Err(())
|
||||||
|
}
|
||||||
|
DetailsContent
|
||||||
},
|
},
|
||||||
_ => return Err(())
|
_ => return Err(())
|
||||||
};
|
};
|
||||||
|
@ -129,15 +187,16 @@ impl SelectorImpl for ServoSelectorImpl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<E: Element<Impl=ServoSelectorImpl>> ElementExt for E {
|
impl SelectorImplExt for ServoSelectorImpl {
|
||||||
fn is_link(&self) -> bool {
|
type ComputedValues = ServoComputedValues;
|
||||||
self.match_non_ts_pseudo_class(NonTSPseudoClass::AnyLink)
|
|
||||||
}
|
#[inline]
|
||||||
|
fn is_eagerly_cascaded_pseudo_element(pseudo: &PseudoElement) -> bool {
|
||||||
|
pseudo.is_eagerly_cascaded()
|
||||||
}
|
}
|
||||||
|
|
||||||
impl SelectorImplExt for ServoSelectorImpl {
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn each_eagerly_cascaded_pseudo_element<F>(mut fun: F)
|
fn each_pseudo_element<F>(mut fun: F)
|
||||||
where F: FnMut(PseudoElement) {
|
where F: FnMut(PseudoElement) {
|
||||||
fun(PseudoElement::Before);
|
fun(PseudoElement::Before);
|
||||||
fun(PseudoElement::After);
|
fun(PseudoElement::After);
|
||||||
|
@ -161,3 +220,9 @@ impl SelectorImplExt for ServoSelectorImpl {
|
||||||
Some(&*QUIRKS_MODE_STYLESHEET)
|
Some(&*QUIRKS_MODE_STYLESHEET)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<E: Element<Impl=ServoSelectorImpl>> ElementExt for E {
|
||||||
|
fn is_link(&self) -> bool {
|
||||||
|
self.match_non_ts_pseudo_class(NonTSPseudoClass::AnyLink)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -8,8 +8,9 @@
|
||||||
use dom::TElement;
|
use dom::TElement;
|
||||||
use element_state::*;
|
use element_state::*;
|
||||||
use error_reporting::{ParseErrorReporter, StdoutErrorReporter};
|
use error_reporting::{ParseErrorReporter, StdoutErrorReporter};
|
||||||
|
use euclid::Size2D;
|
||||||
use media_queries::{Device, MediaType};
|
use media_queries::{Device, MediaType};
|
||||||
use properties::{PropertyDeclaration, PropertyDeclarationBlock};
|
use properties::{self, ComputedValues, PropertyDeclaration, PropertyDeclarationBlock};
|
||||||
use restyle_hints::{ElementSnapshot, RestyleHint, DependencySet};
|
use restyle_hints::{ElementSnapshot, RestyleHint, DependencySet};
|
||||||
use selector_impl::{SelectorImplExt, ServoSelectorImpl};
|
use selector_impl::{SelectorImplExt, ServoSelectorImpl};
|
||||||
use selectors::Element;
|
use selectors::Element;
|
||||||
|
@ -116,11 +117,20 @@ pub struct Stylist<Impl: SelectorImplExt> {
|
||||||
/// The current selector maps, after evaluating media
|
/// The current selector maps, after evaluating media
|
||||||
/// rules against the current device.
|
/// rules against the current device.
|
||||||
element_map: PerPseudoElementSelectorMap<Impl>,
|
element_map: PerPseudoElementSelectorMap<Impl>,
|
||||||
|
|
||||||
/// The selector maps corresponding to a given pseudo-element
|
/// The selector maps corresponding to a given pseudo-element
|
||||||
/// (depending on the implementation)
|
/// (depending on the implementation)
|
||||||
pseudos_map: HashMap<Impl::PseudoElement,
|
pseudos_map: HashMap<Impl::PseudoElement,
|
||||||
PerPseudoElementSelectorMap<Impl>,
|
PerPseudoElementSelectorMap<Impl>,
|
||||||
BuildHasherDefault<::fnv::FnvHasher>>,
|
BuildHasherDefault<::fnv::FnvHasher>>,
|
||||||
|
|
||||||
|
/// Applicable declarations for a given non-eagerly cascaded pseudo-element.
|
||||||
|
/// These are eagerly computed once, and then used to resolve the new
|
||||||
|
/// computed values on the fly on layout.
|
||||||
|
non_eagerly_cascaded_pseudo_element_decls: HashMap<Impl::PseudoElement,
|
||||||
|
Vec<DeclarationBlock>,
|
||||||
|
BuildHasherDefault<::fnv::FnvHasher>>,
|
||||||
|
|
||||||
rules_source_order: usize,
|
rules_source_order: usize,
|
||||||
|
|
||||||
/// Selector dependencies used to compute restyle hints.
|
/// Selector dependencies used to compute restyle hints.
|
||||||
|
@ -138,6 +148,7 @@ impl<Impl: SelectorImplExt> Stylist<Impl> {
|
||||||
|
|
||||||
element_map: PerPseudoElementSelectorMap::new(),
|
element_map: PerPseudoElementSelectorMap::new(),
|
||||||
pseudos_map: HashMap::with_hasher(Default::default()),
|
pseudos_map: HashMap::with_hasher(Default::default()),
|
||||||
|
non_eagerly_cascaded_pseudo_element_decls: HashMap::with_hasher(Default::default()),
|
||||||
rules_source_order: 0,
|
rules_source_order: 0,
|
||||||
state_deps: DependencySet::new(),
|
state_deps: DependencySet::new(),
|
||||||
};
|
};
|
||||||
|
@ -160,6 +171,11 @@ impl<Impl: SelectorImplExt> Stylist<Impl> {
|
||||||
|
|
||||||
self.element_map = PerPseudoElementSelectorMap::new();
|
self.element_map = PerPseudoElementSelectorMap::new();
|
||||||
self.pseudos_map = HashMap::with_hasher(Default::default());
|
self.pseudos_map = HashMap::with_hasher(Default::default());
|
||||||
|
Impl::each_eagerly_cascaded_pseudo_element(|pseudo| {
|
||||||
|
self.pseudos_map.insert(pseudo, PerPseudoElementSelectorMap::new());
|
||||||
|
});
|
||||||
|
|
||||||
|
self.non_eagerly_cascaded_pseudo_element_decls = HashMap::with_hasher(Default::default());
|
||||||
self.rules_source_order = 0;
|
self.rules_source_order = 0;
|
||||||
self.state_deps.clear();
|
self.state_deps.clear();
|
||||||
|
|
||||||
|
@ -182,8 +198,7 @@ impl<Impl: SelectorImplExt> Stylist<Impl> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn add_stylesheet(&mut self, stylesheet: &Stylesheet<Impl>) {
|
fn add_stylesheet(&mut self, stylesheet: &Stylesheet<Impl>) {
|
||||||
let device = &self.device;
|
if !stylesheet.is_effective_for_device(&self.device) {
|
||||||
if !stylesheet.is_effective_for_device(device) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let mut rules_source_order = self.rules_source_order;
|
let mut rules_source_order = self.rules_source_order;
|
||||||
|
@ -195,7 +210,8 @@ impl<Impl: SelectorImplExt> Stylist<Impl> {
|
||||||
if !$style_rule.declarations.$priority.is_empty() {
|
if !$style_rule.declarations.$priority.is_empty() {
|
||||||
for selector in &$style_rule.selectors {
|
for selector in &$style_rule.selectors {
|
||||||
let map = if let Some(ref pseudo) = selector.pseudo_element {
|
let map = if let Some(ref pseudo) = selector.pseudo_element {
|
||||||
self.pseudos_map.entry(pseudo.clone())
|
self.pseudos_map
|
||||||
|
.entry(pseudo.clone())
|
||||||
.or_insert_with(PerPseudoElementSelectorMap::new)
|
.or_insert_with(PerPseudoElementSelectorMap::new)
|
||||||
.borrow_for_origin(&stylesheet.origin)
|
.borrow_for_origin(&stylesheet.origin)
|
||||||
} else {
|
} else {
|
||||||
|
@ -223,7 +239,40 @@ impl<Impl: SelectorImplExt> Stylist<Impl> {
|
||||||
self.state_deps.note_selector(selector.compound_selectors.clone());
|
self.state_deps.note_selector(selector.compound_selectors.clone());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self.rules_source_order = rules_source_order;
|
self.rules_source_order = rules_source_order;
|
||||||
|
|
||||||
|
Impl::each_non_eagerly_cascaded_pseudo_element(|pseudo| {
|
||||||
|
// TODO: Don't precompute this, compute it on demand instead and
|
||||||
|
// cache it.
|
||||||
|
//
|
||||||
|
// This is actually kind of hard, because the stylist is shared
|
||||||
|
// between threads.
|
||||||
|
if let Some(map) = self.pseudos_map.remove(&pseudo) {
|
||||||
|
let mut declarations = vec![];
|
||||||
|
|
||||||
|
map.user_agent.normal.get_universal_rules(&mut declarations);
|
||||||
|
map.user_agent.important.get_universal_rules(&mut declarations);
|
||||||
|
|
||||||
|
self.non_eagerly_cascaded_pseudo_element_decls.insert(pseudo, declarations);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn computed_values_for_pseudo(&self,
|
||||||
|
pseudo: &Impl::PseudoElement,
|
||||||
|
parent: Option<&Arc<Impl::ComputedValues>>) -> Option<Arc<Impl::ComputedValues>> {
|
||||||
|
debug_assert!(!Impl::is_eagerly_cascaded_pseudo_element(pseudo));
|
||||||
|
if let Some(declarations) = self.non_eagerly_cascaded_pseudo_element_decls.get(pseudo) {
|
||||||
|
let (computed, _) =
|
||||||
|
properties::cascade::<Impl::ComputedValues>(Size2D::zero(),
|
||||||
|
&declarations, false,
|
||||||
|
parent.map(|p| &**p), None,
|
||||||
|
box StdoutErrorReporter);
|
||||||
|
Some(Arc::new(computed))
|
||||||
|
} else {
|
||||||
|
parent.map(|p| p.clone())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn compute_restyle_hint<E>(&self, element: &E,
|
pub fn compute_restyle_hint<E>(&self, element: &E,
|
||||||
|
@ -284,20 +333,16 @@ impl<Impl: SelectorImplExt> Stylist<Impl> {
|
||||||
assert!(!self.is_device_dirty);
|
assert!(!self.is_device_dirty);
|
||||||
assert!(style_attribute.is_none() || pseudo_element.is_none(),
|
assert!(style_attribute.is_none() || pseudo_element.is_none(),
|
||||||
"Style attributes do not apply to pseudo-elements");
|
"Style attributes do not apply to pseudo-elements");
|
||||||
|
debug_assert!(pseudo_element.is_none() ||
|
||||||
|
Impl::is_eagerly_cascaded_pseudo_element(pseudo_element.as_ref().unwrap()));
|
||||||
|
|
||||||
let map = match pseudo_element {
|
let map = match pseudo_element {
|
||||||
Some(ref pseudo) => match self.pseudos_map.get(pseudo) {
|
Some(ref pseudo) => self.pseudos_map.get(pseudo).unwrap(),
|
||||||
Some(map) => map,
|
|
||||||
// TODO(emilio): get non eagerly-cascaded pseudo-element rules here.
|
|
||||||
// Actually assume there are no rules applicable.
|
|
||||||
None => return true,
|
|
||||||
},
|
|
||||||
None => &self.element_map,
|
None => &self.element_map,
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut shareable = true;
|
let mut shareable = true;
|
||||||
|
|
||||||
|
|
||||||
// Step 1: Normal user-agent rules.
|
// Step 1: Normal user-agent rules.
|
||||||
map.user_agent.normal.get_all_matching_rules(element,
|
map.user_agent.normal.get_all_matching_rules(element,
|
||||||
parent_bf,
|
parent_bf,
|
||||||
|
|
|
@ -12,5 +12,4 @@ use stylesheets;
|
||||||
pub type Stylesheet = stylesheets::Stylesheet<ServoSelectorImpl>;
|
pub type Stylesheet = stylesheets::Stylesheet<ServoSelectorImpl>;
|
||||||
pub type PrivateStyleData = data::PrivateStyleData<ServoSelectorImpl, ServoComputedValues>;
|
pub type PrivateStyleData = data::PrivateStyleData<ServoSelectorImpl, ServoComputedValues>;
|
||||||
pub type Stylist = selector_matching::Stylist<ServoSelectorImpl>;
|
pub type Stylist = selector_matching::Stylist<ServoSelectorImpl>;
|
||||||
pub type StylistWrapper = context::StylistWrapper<ServoSelectorImpl>;
|
|
||||||
pub type SharedStyleContext = context::SharedStyleContext<ServoSelectorImpl>;
|
pub type SharedStyleContext = context::SharedStyleContext<ServoSelectorImpl>;
|
||||||
|
|
|
@ -123,8 +123,8 @@ pub fn recalc_style_at<'a, N, C>(context: &'a C,
|
||||||
root: OpaqueNode,
|
root: OpaqueNode,
|
||||||
node: N)
|
node: N)
|
||||||
where N: TNode,
|
where N: TNode,
|
||||||
C: StyleContext<'a, <N::ConcreteElement as Element>::Impl, N::ConcreteComputedValues>,
|
C: StyleContext<'a, <N::ConcreteElement as Element>::Impl>,
|
||||||
<N::ConcreteElement as Element>::Impl: SelectorImplExt + 'a {
|
<N::ConcreteElement as Element>::Impl: SelectorImplExt<ComputedValues=N::ConcreteComputedValues> + 'a {
|
||||||
// Initialize layout data.
|
// Initialize layout data.
|
||||||
//
|
//
|
||||||
// FIXME(pcwalton): Stop allocating here. Ideally this should just be done by the HTML
|
// FIXME(pcwalton): Stop allocating here. Ideally this should just be done by the HTML
|
||||||
|
@ -167,8 +167,9 @@ pub fn recalc_style_at<'a, N, C>(context: &'a C,
|
||||||
let shareable_element = match node.as_element() {
|
let shareable_element = match node.as_element() {
|
||||||
Some(element) => {
|
Some(element) => {
|
||||||
// Perform the CSS selector matching.
|
// Perform the CSS selector matching.
|
||||||
let stylist = unsafe { &*context.shared_context().stylist.0 };
|
let stylist = &context.shared_context().stylist;
|
||||||
if element.match_element(stylist,
|
|
||||||
|
if element.match_element(&**stylist,
|
||||||
Some(&*bf),
|
Some(&*bf),
|
||||||
&mut applicable_declarations) {
|
&mut applicable_declarations) {
|
||||||
Some(element)
|
Some(element)
|
||||||
|
|
35
ports/cef/Cargo.lock
generated
35
ports/cef/Cargo.lock
generated
|
@ -143,6 +143,11 @@ name = "bitflags"
|
||||||
version = "0.4.0"
|
version = "0.4.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bitflags"
|
||||||
|
version = "0.5.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "block"
|
name = "block"
|
||||||
version = "0.1.5"
|
version = "0.1.5"
|
||||||
|
@ -656,7 +661,7 @@ dependencies = [
|
||||||
"servo-skia 0.20130412.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"servo-skia 0.20130412.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"simd 0.1.0 (git+https://github.com/huonw/simd)",
|
"simd 0.1.0 (git+https://github.com/huonw/simd)",
|
||||||
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"string_cache 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
"string_cache 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"style 0.0.1",
|
"style 0.0.1",
|
||||||
"style_traits 0.0.1",
|
"style_traits 0.0.1",
|
||||||
"time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
"time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -821,7 +826,7 @@ dependencies = [
|
||||||
"phf 0.7.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
"phf 0.7.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"phf_codegen 0.7.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
"phf_codegen 0.7.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"string_cache 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
"string_cache 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"tendril 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"tendril 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
"time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
@ -1012,11 +1017,11 @@ dependencies = [
|
||||||
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"script 0.0.1",
|
"script 0.0.1",
|
||||||
"script_traits 0.0.1",
|
"script_traits 0.0.1",
|
||||||
"selectors 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"selectors 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"serde_json 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde_json 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"serde_macros 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde_macros 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"string_cache 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
"string_cache 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"style 0.0.1",
|
"style 0.0.1",
|
||||||
"style_traits 0.0.1",
|
"style_traits 0.0.1",
|
||||||
"time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
"time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -1695,10 +1700,10 @@ dependencies = [
|
||||||
"regex 0.1.55 (registry+https://github.com/rust-lang/crates.io-index)",
|
"regex 0.1.55 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"script_traits 0.0.1",
|
"script_traits 0.0.1",
|
||||||
"selectors 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"selectors 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"string_cache 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
"string_cache 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"style 0.0.1",
|
"style 0.0.1",
|
||||||
"time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
"time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"unicase 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"unicase 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -1738,10 +1743,10 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "selectors"
|
name = "selectors"
|
||||||
version = "0.5.2"
|
version = "0.5.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"bitflags 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"cssparser 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cssparser 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"fnv 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"fnv 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"heapsize 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"heapsize 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -1749,7 +1754,7 @@ dependencies = [
|
||||||
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"quickersort 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"quickersort 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"string_cache 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
"string_cache 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -1947,7 +1952,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "string_cache"
|
name = "string_cache"
|
||||||
version = "0.2.12"
|
version = "0.2.13"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"debug_unreachable 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"debug_unreachable 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -1977,11 +1982,11 @@ dependencies = [
|
||||||
"num-traits 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)",
|
"num-traits 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"plugins 0.0.1",
|
"plugins 0.0.1",
|
||||||
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"selectors 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"selectors 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"serde_macros 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde_macros 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"string_cache 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
"string_cache 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"style_traits 0.0.1",
|
"style_traits 0.0.1",
|
||||||
"time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
"time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -2000,7 +2005,7 @@ dependencies = [
|
||||||
"log 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"plugins 0.0.1",
|
"plugins 0.0.1",
|
||||||
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"selectors 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"selectors 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"serde_macros 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde_macros 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -2183,7 +2188,7 @@ dependencies = [
|
||||||
"serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"serde_macros 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde_macros 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"string_cache 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
"string_cache 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -2399,7 +2404,7 @@ dependencies = [
|
||||||
"phf 0.7.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
"phf 0.7.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"phf_codegen 0.7.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
"phf_codegen 0.7.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"string_cache 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
"string_cache 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"tendril 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"tendril 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
"time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
25
ports/geckolib/Cargo.lock
generated
25
ports/geckolib/Cargo.lock
generated
|
@ -13,9 +13,9 @@ dependencies = [
|
||||||
"log 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"num_cpus 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
"num_cpus 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"plugins 0.0.1",
|
"plugins 0.0.1",
|
||||||
"selectors 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"selectors 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"string_cache 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
"string_cache 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"style 0.0.1",
|
"style 0.0.1",
|
||||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"util 0.0.1",
|
"util 0.0.1",
|
||||||
|
@ -81,6 +81,11 @@ name = "bitflags"
|
||||||
version = "0.4.0"
|
version = "0.4.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bitflags"
|
||||||
|
version = "0.5.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "byteorder"
|
name = "byteorder"
|
||||||
version = "0.5.1"
|
version = "0.5.1"
|
||||||
|
@ -422,10 +427,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "selectors"
|
name = "selectors"
|
||||||
version = "0.5.2"
|
version = "0.5.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"bitflags 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"cssparser 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cssparser 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"fnv 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"fnv 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"heapsize 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"heapsize 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -433,7 +438,7 @@ dependencies = [
|
||||||
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"quickersort 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"quickersort 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"string_cache 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
"string_cache 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -466,7 +471,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "string_cache"
|
name = "string_cache"
|
||||||
version = "0.2.12"
|
version = "0.2.13"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"debug_unreachable 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"debug_unreachable 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -496,11 +501,11 @@ dependencies = [
|
||||||
"num-traits 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)",
|
"num-traits 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"plugins 0.0.1",
|
"plugins 0.0.1",
|
||||||
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"selectors 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"selectors 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"serde_macros 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde_macros 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"string_cache 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
"string_cache 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"style_traits 0.0.1",
|
"style_traits 0.0.1",
|
||||||
"time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
"time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -519,7 +524,7 @@ dependencies = [
|
||||||
"log 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"plugins 0.0.1",
|
"plugins 0.0.1",
|
||||||
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"selectors 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"selectors 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"serde_macros 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde_macros 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -600,7 +605,7 @@ dependencies = [
|
||||||
"serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"serde_macros 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde_macros 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"string_cache 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
"string_cache 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
/* automatically generated by rust-bindgen */
|
/* automatically generated by rust-bindgen */
|
||||||
|
|
||||||
|
use gecko_style_structs::SheetParsingMode;
|
||||||
use gecko_style_structs::nsStyleFont;
|
use gecko_style_structs::nsStyleFont;
|
||||||
use gecko_style_structs::nsStyleColor;
|
use gecko_style_structs::nsStyleColor;
|
||||||
use gecko_style_structs::nsStyleList;
|
use gecko_style_structs::nsStyleList;
|
||||||
|
@ -68,7 +69,8 @@ extern "C" {
|
||||||
pub fn Gecko_SetNodeData(node: *mut RawGeckoNode,
|
pub fn Gecko_SetNodeData(node: *mut RawGeckoNode,
|
||||||
data: *mut ServoNodeData);
|
data: *mut ServoNodeData);
|
||||||
pub fn Servo_DropNodeData(data: *mut ServoNodeData);
|
pub fn Servo_DropNodeData(data: *mut ServoNodeData);
|
||||||
pub fn Servo_StylesheetFromUTF8Bytes(bytes: *const u8, length: u32)
|
pub fn Servo_StylesheetFromUTF8Bytes(bytes: *const u8, length: u32,
|
||||||
|
parsing_mode: SheetParsingMode)
|
||||||
-> *mut RawServoStyleSheet;
|
-> *mut RawServoStyleSheet;
|
||||||
pub fn Servo_AddRefStyleSheet(sheet: *mut RawServoStyleSheet);
|
pub fn Servo_AddRefStyleSheet(sheet: *mut RawServoStyleSheet);
|
||||||
pub fn Servo_ReleaseStyleSheet(sheet: *mut RawServoStyleSheet);
|
pub fn Servo_ReleaseStyleSheet(sheet: *mut RawServoStyleSheet);
|
||||||
|
@ -96,6 +98,8 @@ extern "C" {
|
||||||
pub fn Gecko_GetAttrAsUTF8(element: *mut RawGeckoElement, ns: *const u8,
|
pub fn Gecko_GetAttrAsUTF8(element: *mut RawGeckoElement, ns: *const u8,
|
||||||
name: *const u8, length: *mut u32)
|
name: *const u8, length: *mut u32)
|
||||||
-> *const ::std::os::raw::c_char;
|
-> *const ::std::os::raw::c_char;
|
||||||
|
pub fn Gecko_GetAtomAsUTF16(atom: *mut nsIAtom, length: *mut u32)
|
||||||
|
-> *const u16;
|
||||||
pub fn Gecko_LocalName(element: *mut RawGeckoElement, length: *mut u32)
|
pub fn Gecko_LocalName(element: *mut RawGeckoElement, length: *mut u32)
|
||||||
-> *const u16;
|
-> *const u16;
|
||||||
pub fn Gecko_Namespace(element: *mut RawGeckoElement, length: *mut u32)
|
pub fn Gecko_Namespace(element: *mut RawGeckoElement, length: *mut u32)
|
||||||
|
@ -106,23 +110,33 @@ extern "C" {
|
||||||
pub fn Gecko_CopyConstruct_nsStyleFont(ptr: *mut nsStyleFont,
|
pub fn Gecko_CopyConstruct_nsStyleFont(ptr: *mut nsStyleFont,
|
||||||
other: *const nsStyleFont);
|
other: *const nsStyleFont);
|
||||||
pub fn Gecko_Destroy_nsStyleFont(ptr: *mut nsStyleFont);
|
pub fn Gecko_Destroy_nsStyleFont(ptr: *mut nsStyleFont);
|
||||||
|
pub fn Servo_GetStyleFont(computedValues: *mut ServoComputedValues)
|
||||||
|
-> *const nsStyleFont;
|
||||||
pub fn Gecko_Construct_nsStyleColor(ptr: *mut nsStyleColor);
|
pub fn Gecko_Construct_nsStyleColor(ptr: *mut nsStyleColor);
|
||||||
pub fn Gecko_CopyConstruct_nsStyleColor(ptr: *mut nsStyleColor,
|
pub fn Gecko_CopyConstruct_nsStyleColor(ptr: *mut nsStyleColor,
|
||||||
other: *const nsStyleColor);
|
other: *const nsStyleColor);
|
||||||
pub fn Gecko_Destroy_nsStyleColor(ptr: *mut nsStyleColor);
|
pub fn Gecko_Destroy_nsStyleColor(ptr: *mut nsStyleColor);
|
||||||
|
pub fn Servo_GetStyleColor(computedValues: *mut ServoComputedValues)
|
||||||
|
-> *const nsStyleColor;
|
||||||
pub fn Gecko_Construct_nsStyleList(ptr: *mut nsStyleList);
|
pub fn Gecko_Construct_nsStyleList(ptr: *mut nsStyleList);
|
||||||
pub fn Gecko_CopyConstruct_nsStyleList(ptr: *mut nsStyleList,
|
pub fn Gecko_CopyConstruct_nsStyleList(ptr: *mut nsStyleList,
|
||||||
other: *const nsStyleList);
|
other: *const nsStyleList);
|
||||||
pub fn Gecko_Destroy_nsStyleList(ptr: *mut nsStyleList);
|
pub fn Gecko_Destroy_nsStyleList(ptr: *mut nsStyleList);
|
||||||
|
pub fn Servo_GetStyleList(computedValues: *mut ServoComputedValues)
|
||||||
|
-> *const nsStyleList;
|
||||||
pub fn Gecko_Construct_nsStyleText(ptr: *mut nsStyleText);
|
pub fn Gecko_Construct_nsStyleText(ptr: *mut nsStyleText);
|
||||||
pub fn Gecko_CopyConstruct_nsStyleText(ptr: *mut nsStyleText,
|
pub fn Gecko_CopyConstruct_nsStyleText(ptr: *mut nsStyleText,
|
||||||
other: *const nsStyleText);
|
other: *const nsStyleText);
|
||||||
pub fn Gecko_Destroy_nsStyleText(ptr: *mut nsStyleText);
|
pub fn Gecko_Destroy_nsStyleText(ptr: *mut nsStyleText);
|
||||||
|
pub fn Servo_GetStyleText(computedValues: *mut ServoComputedValues)
|
||||||
|
-> *const nsStyleText;
|
||||||
pub fn Gecko_Construct_nsStyleVisibility(ptr: *mut nsStyleVisibility);
|
pub fn Gecko_Construct_nsStyleVisibility(ptr: *mut nsStyleVisibility);
|
||||||
pub fn Gecko_CopyConstruct_nsStyleVisibility(ptr: *mut nsStyleVisibility,
|
pub fn Gecko_CopyConstruct_nsStyleVisibility(ptr: *mut nsStyleVisibility,
|
||||||
other:
|
other:
|
||||||
*const nsStyleVisibility);
|
*const nsStyleVisibility);
|
||||||
pub fn Gecko_Destroy_nsStyleVisibility(ptr: *mut nsStyleVisibility);
|
pub fn Gecko_Destroy_nsStyleVisibility(ptr: *mut nsStyleVisibility);
|
||||||
|
pub fn Servo_GetStyleVisibility(computedValues: *mut ServoComputedValues)
|
||||||
|
-> *const nsStyleVisibility;
|
||||||
pub fn Gecko_Construct_nsStyleUserInterface(ptr:
|
pub fn Gecko_Construct_nsStyleUserInterface(ptr:
|
||||||
*mut nsStyleUserInterface);
|
*mut nsStyleUserInterface);
|
||||||
pub fn Gecko_CopyConstruct_nsStyleUserInterface(ptr:
|
pub fn Gecko_CopyConstruct_nsStyleUserInterface(ptr:
|
||||||
|
@ -130,81 +144,120 @@ extern "C" {
|
||||||
other:
|
other:
|
||||||
*const nsStyleUserInterface);
|
*const nsStyleUserInterface);
|
||||||
pub fn Gecko_Destroy_nsStyleUserInterface(ptr: *mut nsStyleUserInterface);
|
pub fn Gecko_Destroy_nsStyleUserInterface(ptr: *mut nsStyleUserInterface);
|
||||||
|
pub fn Servo_GetStyleUserInterface(computedValues:
|
||||||
|
*mut ServoComputedValues)
|
||||||
|
-> *const nsStyleUserInterface;
|
||||||
pub fn Gecko_Construct_nsStyleTableBorder(ptr: *mut nsStyleTableBorder);
|
pub fn Gecko_Construct_nsStyleTableBorder(ptr: *mut nsStyleTableBorder);
|
||||||
pub fn Gecko_CopyConstruct_nsStyleTableBorder(ptr:
|
pub fn Gecko_CopyConstruct_nsStyleTableBorder(ptr:
|
||||||
*mut nsStyleTableBorder,
|
*mut nsStyleTableBorder,
|
||||||
other:
|
other:
|
||||||
*const nsStyleTableBorder);
|
*const nsStyleTableBorder);
|
||||||
pub fn Gecko_Destroy_nsStyleTableBorder(ptr: *mut nsStyleTableBorder);
|
pub fn Gecko_Destroy_nsStyleTableBorder(ptr: *mut nsStyleTableBorder);
|
||||||
|
pub fn Servo_GetStyleTableBorder(computedValues: *mut ServoComputedValues)
|
||||||
|
-> *const nsStyleTableBorder;
|
||||||
pub fn Gecko_Construct_nsStyleSVG(ptr: *mut nsStyleSVG);
|
pub fn Gecko_Construct_nsStyleSVG(ptr: *mut nsStyleSVG);
|
||||||
pub fn Gecko_CopyConstruct_nsStyleSVG(ptr: *mut nsStyleSVG,
|
pub fn Gecko_CopyConstruct_nsStyleSVG(ptr: *mut nsStyleSVG,
|
||||||
other: *const nsStyleSVG);
|
other: *const nsStyleSVG);
|
||||||
pub fn Gecko_Destroy_nsStyleSVG(ptr: *mut nsStyleSVG);
|
pub fn Gecko_Destroy_nsStyleSVG(ptr: *mut nsStyleSVG);
|
||||||
|
pub fn Servo_GetStyleSVG(computedValues: *mut ServoComputedValues)
|
||||||
|
-> *const nsStyleSVG;
|
||||||
pub fn Gecko_Construct_nsStyleVariables(ptr: *mut nsStyleVariables);
|
pub fn Gecko_Construct_nsStyleVariables(ptr: *mut nsStyleVariables);
|
||||||
pub fn Gecko_CopyConstruct_nsStyleVariables(ptr: *mut nsStyleVariables,
|
pub fn Gecko_CopyConstruct_nsStyleVariables(ptr: *mut nsStyleVariables,
|
||||||
other:
|
other:
|
||||||
*const nsStyleVariables);
|
*const nsStyleVariables);
|
||||||
pub fn Gecko_Destroy_nsStyleVariables(ptr: *mut nsStyleVariables);
|
pub fn Gecko_Destroy_nsStyleVariables(ptr: *mut nsStyleVariables);
|
||||||
|
pub fn Servo_GetStyleVariables(computedValues: *mut ServoComputedValues)
|
||||||
|
-> *const nsStyleVariables;
|
||||||
pub fn Gecko_Construct_nsStyleBackground(ptr: *mut nsStyleBackground);
|
pub fn Gecko_Construct_nsStyleBackground(ptr: *mut nsStyleBackground);
|
||||||
pub fn Gecko_CopyConstruct_nsStyleBackground(ptr: *mut nsStyleBackground,
|
pub fn Gecko_CopyConstruct_nsStyleBackground(ptr: *mut nsStyleBackground,
|
||||||
other:
|
other:
|
||||||
*const nsStyleBackground);
|
*const nsStyleBackground);
|
||||||
pub fn Gecko_Destroy_nsStyleBackground(ptr: *mut nsStyleBackground);
|
pub fn Gecko_Destroy_nsStyleBackground(ptr: *mut nsStyleBackground);
|
||||||
|
pub fn Servo_GetStyleBackground(computedValues: *mut ServoComputedValues)
|
||||||
|
-> *const nsStyleBackground;
|
||||||
pub fn Gecko_Construct_nsStylePosition(ptr: *mut nsStylePosition);
|
pub fn Gecko_Construct_nsStylePosition(ptr: *mut nsStylePosition);
|
||||||
pub fn Gecko_CopyConstruct_nsStylePosition(ptr: *mut nsStylePosition,
|
pub fn Gecko_CopyConstruct_nsStylePosition(ptr: *mut nsStylePosition,
|
||||||
other: *const nsStylePosition);
|
other: *const nsStylePosition);
|
||||||
pub fn Gecko_Destroy_nsStylePosition(ptr: *mut nsStylePosition);
|
pub fn Gecko_Destroy_nsStylePosition(ptr: *mut nsStylePosition);
|
||||||
|
pub fn Servo_GetStylePosition(computedValues: *mut ServoComputedValues)
|
||||||
|
-> *const nsStylePosition;
|
||||||
pub fn Gecko_Construct_nsStyleTextReset(ptr: *mut nsStyleTextReset);
|
pub fn Gecko_Construct_nsStyleTextReset(ptr: *mut nsStyleTextReset);
|
||||||
pub fn Gecko_CopyConstruct_nsStyleTextReset(ptr: *mut nsStyleTextReset,
|
pub fn Gecko_CopyConstruct_nsStyleTextReset(ptr: *mut nsStyleTextReset,
|
||||||
other:
|
other:
|
||||||
*const nsStyleTextReset);
|
*const nsStyleTextReset);
|
||||||
pub fn Gecko_Destroy_nsStyleTextReset(ptr: *mut nsStyleTextReset);
|
pub fn Gecko_Destroy_nsStyleTextReset(ptr: *mut nsStyleTextReset);
|
||||||
|
pub fn Servo_GetStyleTextReset(computedValues: *mut ServoComputedValues)
|
||||||
|
-> *const nsStyleTextReset;
|
||||||
pub fn Gecko_Construct_nsStyleDisplay(ptr: *mut nsStyleDisplay);
|
pub fn Gecko_Construct_nsStyleDisplay(ptr: *mut nsStyleDisplay);
|
||||||
pub fn Gecko_CopyConstruct_nsStyleDisplay(ptr: *mut nsStyleDisplay,
|
pub fn Gecko_CopyConstruct_nsStyleDisplay(ptr: *mut nsStyleDisplay,
|
||||||
other: *const nsStyleDisplay);
|
other: *const nsStyleDisplay);
|
||||||
pub fn Gecko_Destroy_nsStyleDisplay(ptr: *mut nsStyleDisplay);
|
pub fn Gecko_Destroy_nsStyleDisplay(ptr: *mut nsStyleDisplay);
|
||||||
|
pub fn Servo_GetStyleDisplay(computedValues: *mut ServoComputedValues)
|
||||||
|
-> *const nsStyleDisplay;
|
||||||
pub fn Gecko_Construct_nsStyleContent(ptr: *mut nsStyleContent);
|
pub fn Gecko_Construct_nsStyleContent(ptr: *mut nsStyleContent);
|
||||||
pub fn Gecko_CopyConstruct_nsStyleContent(ptr: *mut nsStyleContent,
|
pub fn Gecko_CopyConstruct_nsStyleContent(ptr: *mut nsStyleContent,
|
||||||
other: *const nsStyleContent);
|
other: *const nsStyleContent);
|
||||||
pub fn Gecko_Destroy_nsStyleContent(ptr: *mut nsStyleContent);
|
pub fn Gecko_Destroy_nsStyleContent(ptr: *mut nsStyleContent);
|
||||||
|
pub fn Servo_GetStyleContent(computedValues: *mut ServoComputedValues)
|
||||||
|
-> *const nsStyleContent;
|
||||||
pub fn Gecko_Construct_nsStyleUIReset(ptr: *mut nsStyleUIReset);
|
pub fn Gecko_Construct_nsStyleUIReset(ptr: *mut nsStyleUIReset);
|
||||||
pub fn Gecko_CopyConstruct_nsStyleUIReset(ptr: *mut nsStyleUIReset,
|
pub fn Gecko_CopyConstruct_nsStyleUIReset(ptr: *mut nsStyleUIReset,
|
||||||
other: *const nsStyleUIReset);
|
other: *const nsStyleUIReset);
|
||||||
pub fn Gecko_Destroy_nsStyleUIReset(ptr: *mut nsStyleUIReset);
|
pub fn Gecko_Destroy_nsStyleUIReset(ptr: *mut nsStyleUIReset);
|
||||||
|
pub fn Servo_GetStyleUIReset(computedValues: *mut ServoComputedValues)
|
||||||
|
-> *const nsStyleUIReset;
|
||||||
pub fn Gecko_Construct_nsStyleTable(ptr: *mut nsStyleTable);
|
pub fn Gecko_Construct_nsStyleTable(ptr: *mut nsStyleTable);
|
||||||
pub fn Gecko_CopyConstruct_nsStyleTable(ptr: *mut nsStyleTable,
|
pub fn Gecko_CopyConstruct_nsStyleTable(ptr: *mut nsStyleTable,
|
||||||
other: *const nsStyleTable);
|
other: *const nsStyleTable);
|
||||||
pub fn Gecko_Destroy_nsStyleTable(ptr: *mut nsStyleTable);
|
pub fn Gecko_Destroy_nsStyleTable(ptr: *mut nsStyleTable);
|
||||||
|
pub fn Servo_GetStyleTable(computedValues: *mut ServoComputedValues)
|
||||||
|
-> *const nsStyleTable;
|
||||||
pub fn Gecko_Construct_nsStyleMargin(ptr: *mut nsStyleMargin);
|
pub fn Gecko_Construct_nsStyleMargin(ptr: *mut nsStyleMargin);
|
||||||
pub fn Gecko_CopyConstruct_nsStyleMargin(ptr: *mut nsStyleMargin,
|
pub fn Gecko_CopyConstruct_nsStyleMargin(ptr: *mut nsStyleMargin,
|
||||||
other: *const nsStyleMargin);
|
other: *const nsStyleMargin);
|
||||||
pub fn Gecko_Destroy_nsStyleMargin(ptr: *mut nsStyleMargin);
|
pub fn Gecko_Destroy_nsStyleMargin(ptr: *mut nsStyleMargin);
|
||||||
|
pub fn Servo_GetStyleMargin(computedValues: *mut ServoComputedValues)
|
||||||
|
-> *const nsStyleMargin;
|
||||||
pub fn Gecko_Construct_nsStylePadding(ptr: *mut nsStylePadding);
|
pub fn Gecko_Construct_nsStylePadding(ptr: *mut nsStylePadding);
|
||||||
pub fn Gecko_CopyConstruct_nsStylePadding(ptr: *mut nsStylePadding,
|
pub fn Gecko_CopyConstruct_nsStylePadding(ptr: *mut nsStylePadding,
|
||||||
other: *const nsStylePadding);
|
other: *const nsStylePadding);
|
||||||
pub fn Gecko_Destroy_nsStylePadding(ptr: *mut nsStylePadding);
|
pub fn Gecko_Destroy_nsStylePadding(ptr: *mut nsStylePadding);
|
||||||
|
pub fn Servo_GetStylePadding(computedValues: *mut ServoComputedValues)
|
||||||
|
-> *const nsStylePadding;
|
||||||
pub fn Gecko_Construct_nsStyleBorder(ptr: *mut nsStyleBorder);
|
pub fn Gecko_Construct_nsStyleBorder(ptr: *mut nsStyleBorder);
|
||||||
pub fn Gecko_CopyConstruct_nsStyleBorder(ptr: *mut nsStyleBorder,
|
pub fn Gecko_CopyConstruct_nsStyleBorder(ptr: *mut nsStyleBorder,
|
||||||
other: *const nsStyleBorder);
|
other: *const nsStyleBorder);
|
||||||
pub fn Gecko_Destroy_nsStyleBorder(ptr: *mut nsStyleBorder);
|
pub fn Gecko_Destroy_nsStyleBorder(ptr: *mut nsStyleBorder);
|
||||||
|
pub fn Servo_GetStyleBorder(computedValues: *mut ServoComputedValues)
|
||||||
|
-> *const nsStyleBorder;
|
||||||
pub fn Gecko_Construct_nsStyleOutline(ptr: *mut nsStyleOutline);
|
pub fn Gecko_Construct_nsStyleOutline(ptr: *mut nsStyleOutline);
|
||||||
pub fn Gecko_CopyConstruct_nsStyleOutline(ptr: *mut nsStyleOutline,
|
pub fn Gecko_CopyConstruct_nsStyleOutline(ptr: *mut nsStyleOutline,
|
||||||
other: *const nsStyleOutline);
|
other: *const nsStyleOutline);
|
||||||
pub fn Gecko_Destroy_nsStyleOutline(ptr: *mut nsStyleOutline);
|
pub fn Gecko_Destroy_nsStyleOutline(ptr: *mut nsStyleOutline);
|
||||||
|
pub fn Servo_GetStyleOutline(computedValues: *mut ServoComputedValues)
|
||||||
|
-> *const nsStyleOutline;
|
||||||
pub fn Gecko_Construct_nsStyleXUL(ptr: *mut nsStyleXUL);
|
pub fn Gecko_Construct_nsStyleXUL(ptr: *mut nsStyleXUL);
|
||||||
pub fn Gecko_CopyConstruct_nsStyleXUL(ptr: *mut nsStyleXUL,
|
pub fn Gecko_CopyConstruct_nsStyleXUL(ptr: *mut nsStyleXUL,
|
||||||
other: *const nsStyleXUL);
|
other: *const nsStyleXUL);
|
||||||
pub fn Gecko_Destroy_nsStyleXUL(ptr: *mut nsStyleXUL);
|
pub fn Gecko_Destroy_nsStyleXUL(ptr: *mut nsStyleXUL);
|
||||||
|
pub fn Servo_GetStyleXUL(computedValues: *mut ServoComputedValues)
|
||||||
|
-> *const nsStyleXUL;
|
||||||
pub fn Gecko_Construct_nsStyleSVGReset(ptr: *mut nsStyleSVGReset);
|
pub fn Gecko_Construct_nsStyleSVGReset(ptr: *mut nsStyleSVGReset);
|
||||||
pub fn Gecko_CopyConstruct_nsStyleSVGReset(ptr: *mut nsStyleSVGReset,
|
pub fn Gecko_CopyConstruct_nsStyleSVGReset(ptr: *mut nsStyleSVGReset,
|
||||||
other: *const nsStyleSVGReset);
|
other: *const nsStyleSVGReset);
|
||||||
pub fn Gecko_Destroy_nsStyleSVGReset(ptr: *mut nsStyleSVGReset);
|
pub fn Gecko_Destroy_nsStyleSVGReset(ptr: *mut nsStyleSVGReset);
|
||||||
|
pub fn Servo_GetStyleSVGReset(computedValues: *mut ServoComputedValues)
|
||||||
|
-> *const nsStyleSVGReset;
|
||||||
pub fn Gecko_Construct_nsStyleColumn(ptr: *mut nsStyleColumn);
|
pub fn Gecko_Construct_nsStyleColumn(ptr: *mut nsStyleColumn);
|
||||||
pub fn Gecko_CopyConstruct_nsStyleColumn(ptr: *mut nsStyleColumn,
|
pub fn Gecko_CopyConstruct_nsStyleColumn(ptr: *mut nsStyleColumn,
|
||||||
other: *const nsStyleColumn);
|
other: *const nsStyleColumn);
|
||||||
pub fn Gecko_Destroy_nsStyleColumn(ptr: *mut nsStyleColumn);
|
pub fn Gecko_Destroy_nsStyleColumn(ptr: *mut nsStyleColumn);
|
||||||
|
pub fn Servo_GetStyleColumn(computedValues: *mut ServoComputedValues)
|
||||||
|
-> *const nsStyleColumn;
|
||||||
pub fn Gecko_Construct_nsStyleEffects(ptr: *mut nsStyleEffects);
|
pub fn Gecko_Construct_nsStyleEffects(ptr: *mut nsStyleEffects);
|
||||||
pub fn Gecko_CopyConstruct_nsStyleEffects(ptr: *mut nsStyleEffects,
|
pub fn Gecko_CopyConstruct_nsStyleEffects(ptr: *mut nsStyleEffects,
|
||||||
other: *const nsStyleEffects);
|
other: *const nsStyleEffects);
|
||||||
pub fn Gecko_Destroy_nsStyleEffects(ptr: *mut nsStyleEffects);
|
pub fn Gecko_Destroy_nsStyleEffects(ptr: *mut nsStyleEffects);
|
||||||
|
pub fn Servo_GetStyleEffects(computedValues: *mut ServoComputedValues)
|
||||||
|
-> *const nsStyleEffects;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ use util::workqueue::WorkQueue;
|
||||||
pub struct PerDocumentStyleData {
|
pub struct PerDocumentStyleData {
|
||||||
|
|
||||||
/// Rule processor.
|
/// Rule processor.
|
||||||
pub stylist: Stylist,
|
pub stylist: Arc<Stylist>,
|
||||||
|
|
||||||
/// List of stylesheets, mirrored from Gecko.
|
/// List of stylesheets, mirrored from Gecko.
|
||||||
pub stylesheets: Vec<Arc<Stylesheet>>,
|
pub stylesheets: Vec<Arc<Stylesheet>>,
|
||||||
|
@ -50,8 +50,8 @@ impl PerDocumentStyleData {
|
||||||
let num_threads = cmp::max(num_cpus::get() * 3 / 4, 1);
|
let num_threads = cmp::max(num_cpus::get() * 3 / 4, 1);
|
||||||
|
|
||||||
PerDocumentStyleData {
|
PerDocumentStyleData {
|
||||||
stylist: Stylist::new(device),
|
stylist: Arc::new(Stylist::new(device)),
|
||||||
stylesheets: Vec::new(),
|
stylesheets: vec![],
|
||||||
stylesheets_changed: true,
|
stylesheets_changed: true,
|
||||||
new_animations_sender: new_anims_sender,
|
new_animations_sender: new_anims_sender,
|
||||||
new_animations_receiver: new_anims_receiver,
|
new_animations_receiver: new_anims_receiver,
|
||||||
|
|
|
@ -3986,6 +3986,34 @@ fn bindgen_test_layout_CounterStyleManager() {
|
||||||
assert_eq!(::std::mem::size_of::<CounterStyleManager>() , 72usize);
|
assert_eq!(::std::mem::size_of::<CounterStyleManager>() , 72usize);
|
||||||
assert_eq!(::std::mem::align_of::<CounterStyleManager>() , 8usize);
|
assert_eq!(::std::mem::align_of::<CounterStyleManager>() , 8usize);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Enum defining the mode in which a sheet is to be parsed. This is
|
||||||
|
* usually, but not always, the same as the cascade level at which the
|
||||||
|
* sheet will apply (see nsStyleSet.h). Most of the Loader APIs only
|
||||||
|
* support loading of author sheets.
|
||||||
|
*
|
||||||
|
* Author sheets are the normal case: styles embedded in or linked
|
||||||
|
* from HTML pages. They are also the most restricted.
|
||||||
|
*
|
||||||
|
* User sheets can do anything author sheets can do, and also get
|
||||||
|
* access to a few CSS extensions that are not yet suitable for
|
||||||
|
* exposure on the public Web, but are very useful for expressing
|
||||||
|
* user style overrides, such as @-moz-document rules.
|
||||||
|
*
|
||||||
|
* Agent sheets have access to all author- and user-sheet features
|
||||||
|
* plus more extensions that are necessary for internal use but,
|
||||||
|
* again, not yet suitable for exposure on the public Web. Some of
|
||||||
|
* these are outright unsafe to expose; in particular, incorrect
|
||||||
|
* styling of anonymous box pseudo-elements can violate layout
|
||||||
|
* invariants.
|
||||||
|
*/
|
||||||
|
#[repr(u32)]
|
||||||
|
#[derive(Debug, Copy, Clone)]
|
||||||
|
pub enum SheetParsingMode {
|
||||||
|
eAuthorSheetFeatures = 0,
|
||||||
|
eUserSheetFeatures = 1,
|
||||||
|
eAgentSheetFeatures = 2,
|
||||||
|
}
|
||||||
pub type nsLoadFlags = u32;
|
pub type nsLoadFlags = u32;
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(Debug, Copy)]
|
#[derive(Debug, Copy)]
|
||||||
|
|
|
@ -10,16 +10,17 @@ use bindings::{RawServoStyleSet, RawServoStyleSheet, ServoComputedValues, ServoN
|
||||||
use bindings::{nsIAtom};
|
use bindings::{nsIAtom};
|
||||||
use data::PerDocumentStyleData;
|
use data::PerDocumentStyleData;
|
||||||
use euclid::Size2D;
|
use euclid::Size2D;
|
||||||
|
use gecko_style_structs::SheetParsingMode;
|
||||||
use properties::GeckoComputedValues;
|
use properties::GeckoComputedValues;
|
||||||
use selector_impl::{SharedStyleContext, Stylesheet};
|
use selector_impl::{GeckoSelectorImpl, PseudoElement, SharedStyleContext, Stylesheet};
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
use std::mem::{forget, transmute};
|
use std::mem::{forget, transmute};
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
use std::slice;
|
use std::slice;
|
||||||
use std::str::from_utf8_unchecked;
|
use std::str::from_utf8_unchecked;
|
||||||
use std::sync::{Arc, Mutex};
|
use std::sync::{Arc, Mutex};
|
||||||
use style::context::{ReflowGoal, StylistWrapper};
|
use style::context::{ReflowGoal};
|
||||||
use style::dom::{TDocument, TElement, TNode};
|
use style::dom::{TDocument, TNode};
|
||||||
use style::error_reporting::StdoutErrorReporter;
|
use style::error_reporting::StdoutErrorReporter;
|
||||||
use style::parallel;
|
use style::parallel;
|
||||||
use style::properties::ComputedValues;
|
use style::properties::ComputedValues;
|
||||||
|
@ -27,7 +28,30 @@ use style::stylesheets::Origin;
|
||||||
use traversal::RecalcStyleOnly;
|
use traversal::RecalcStyleOnly;
|
||||||
use url::Url;
|
use url::Url;
|
||||||
use util::arc_ptr_eq;
|
use util::arc_ptr_eq;
|
||||||
use wrapper::{GeckoDocument, GeckoElement, GeckoNode, NonOpaqueStyleData};
|
use wrapper::{GeckoDocument, GeckoNode, NonOpaqueStyleData};
|
||||||
|
|
||||||
|
// TODO: This is ugly and should go away once we get an atom back-end.
|
||||||
|
pub fn pseudo_element_from_atom(pseudo: *mut nsIAtom,
|
||||||
|
in_ua_stylesheet: bool) -> Result<PseudoElement, String> {
|
||||||
|
use bindings::Gecko_GetAtomAsUTF16;
|
||||||
|
use selectors::parser::{ParserContext, SelectorImpl};
|
||||||
|
|
||||||
|
let pseudo_string = unsafe {
|
||||||
|
let mut length = 0;
|
||||||
|
let mut buff = Gecko_GetAtomAsUTF16(pseudo, &mut length);
|
||||||
|
|
||||||
|
// Handle the annoying preceding colon in front of everything in nsCSSAnonBoxList.h.
|
||||||
|
debug_assert!(length >= 2 && *buff == ':' as u16 && *buff.offset(1) != ':' as u16);
|
||||||
|
buff = buff.offset(1);
|
||||||
|
length -= 1;
|
||||||
|
|
||||||
|
String::from_utf16(slice::from_raw_parts(buff, length as usize)).unwrap()
|
||||||
|
};
|
||||||
|
|
||||||
|
let mut context = ParserContext::new();
|
||||||
|
context.in_user_agent_stylesheet = in_ua_stylesheet;
|
||||||
|
GeckoSelectorImpl::parse_pseudo_element(&context, &pseudo_string).map_err(|_| pseudo_string)
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* For Gecko->Servo function calls, we need to redeclare the same signature that was declared in
|
* For Gecko->Servo function calls, we need to redeclare the same signature that was declared in
|
||||||
|
@ -51,7 +75,8 @@ pub extern "C" fn Servo_RestyleDocument(doc: *mut RawGeckoDocument, raw_data: *m
|
||||||
// into a runtime-wide init hook at some point.
|
// into a runtime-wide init hook at some point.
|
||||||
GeckoComputedValues::initial_values();
|
GeckoComputedValues::initial_values();
|
||||||
|
|
||||||
let _needs_dirtying = data.stylist.update(&data.stylesheets, data.stylesheets_changed);
|
let _needs_dirtying = Arc::get_mut(&mut data.stylist).unwrap()
|
||||||
|
.update(&data.stylesheets, data.stylesheets_changed);
|
||||||
data.stylesheets_changed = false;
|
data.stylesheets_changed = false;
|
||||||
|
|
||||||
let shared_style_context = SharedStyleContext {
|
let shared_style_context = SharedStyleContext {
|
||||||
|
@ -59,7 +84,7 @@ pub extern "C" fn Servo_RestyleDocument(doc: *mut RawGeckoDocument, raw_data: *m
|
||||||
screen_size_changed: false,
|
screen_size_changed: false,
|
||||||
generation: 0,
|
generation: 0,
|
||||||
goal: ReflowGoal::ForScriptQuery,
|
goal: ReflowGoal::ForScriptQuery,
|
||||||
stylist: StylistWrapper(&data.stylist),
|
stylist: data.stylist.clone(),
|
||||||
new_animations_sender: Mutex::new(data.new_animations_sender.clone()),
|
new_animations_sender: Mutex::new(data.new_animations_sender.clone()),
|
||||||
running_animations: data.running_animations.clone(),
|
running_animations: data.running_animations.clone(),
|
||||||
expired_animations: data.expired_animations.clone(),
|
expired_animations: data.expired_animations.clone(),
|
||||||
|
@ -80,13 +105,20 @@ pub extern "C" fn Servo_DropNodeData(data: *mut ServoNodeData) -> () {
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn Servo_StylesheetFromUTF8Bytes(bytes: *const u8,
|
pub extern "C" fn Servo_StylesheetFromUTF8Bytes(bytes: *const u8,
|
||||||
length: u32) -> *mut RawServoStyleSheet {
|
length: u32,
|
||||||
|
mode: SheetParsingMode) -> *mut RawServoStyleSheet {
|
||||||
|
|
||||||
let input = unsafe { from_utf8_unchecked(slice::from_raw_parts(bytes, length as usize)) };
|
let input = unsafe { from_utf8_unchecked(slice::from_raw_parts(bytes, length as usize)) };
|
||||||
|
|
||||||
// FIXME(heycam): Pass in the real base URL and sheet origin to use.
|
let origin = match mode {
|
||||||
|
SheetParsingMode::eAuthorSheetFeatures => Origin::Author,
|
||||||
|
SheetParsingMode::eUserSheetFeatures => Origin::User,
|
||||||
|
SheetParsingMode::eAgentSheetFeatures => Origin::UserAgent,
|
||||||
|
};
|
||||||
|
|
||||||
|
// FIXME(heycam): Pass in the real base URL.
|
||||||
let url = Url::parse("about:none").unwrap();
|
let url = Url::parse("about:none").unwrap();
|
||||||
let sheet = Arc::new(Stylesheet::from_str(input, url, Origin::Author, Box::new(StdoutErrorReporter)));
|
let sheet = Arc::new(Stylesheet::from_str(input, url, origin, Box::new(StdoutErrorReporter)));
|
||||||
unsafe {
|
unsafe {
|
||||||
transmute(sheet)
|
transmute(sheet)
|
||||||
}
|
}
|
||||||
|
@ -97,19 +129,40 @@ pub struct ArcHelpers<GeckoType, ServoType> {
|
||||||
phantom2: PhantomData<ServoType>,
|
phantom2: PhantomData<ServoType>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
impl<GeckoType, ServoType> ArcHelpers<GeckoType, ServoType> {
|
impl<GeckoType, ServoType> ArcHelpers<GeckoType, ServoType> {
|
||||||
pub fn with<F, Output>(raw: *mut GeckoType, cb: F) -> Output
|
pub fn with<F, Output>(raw: *mut GeckoType, cb: F) -> Output
|
||||||
where F: FnOnce(&Arc<ServoType>) -> Output {
|
where F: FnOnce(&Arc<ServoType>) -> Output {
|
||||||
|
debug_assert!(!raw.is_null());
|
||||||
|
|
||||||
let owned = unsafe { Self::into(raw) };
|
let owned = unsafe { Self::into(raw) };
|
||||||
let result = cb(&owned);
|
let result = cb(&owned);
|
||||||
forget(owned);
|
forget(owned);
|
||||||
result
|
result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn maybe_with<F, Output>(maybe_raw: *mut GeckoType, cb: F) -> Output
|
||||||
|
where F: FnOnce(Option<&Arc<ServoType>>) -> Output {
|
||||||
|
let owned = if maybe_raw.is_null() {
|
||||||
|
None
|
||||||
|
} else {
|
||||||
|
Some(unsafe { Self::into(maybe_raw) })
|
||||||
|
};
|
||||||
|
|
||||||
|
let result = cb(owned.as_ref());
|
||||||
|
forget(owned);
|
||||||
|
|
||||||
|
result
|
||||||
|
}
|
||||||
|
|
||||||
pub unsafe fn into(ptr: *mut GeckoType) -> Arc<ServoType> {
|
pub unsafe fn into(ptr: *mut GeckoType) -> Arc<ServoType> {
|
||||||
transmute(ptr)
|
transmute(ptr)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn from(owned: Arc<ServoType>) -> *mut GeckoType {
|
||||||
|
unsafe { transmute(owned) }
|
||||||
|
}
|
||||||
|
|
||||||
pub unsafe fn addref(ptr: *mut GeckoType) {
|
pub unsafe fn addref(ptr: *mut GeckoType) {
|
||||||
Self::with(ptr, |arc| forget(arc.clone()));
|
Self::with(ptr, |arc| forget(arc.clone()));
|
||||||
}
|
}
|
||||||
|
@ -197,12 +250,26 @@ pub extern "C" fn Servo_GetComputedValues(node: *mut RawGeckoNode)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn Servo_GetComputedValuesForAnonymousBox(_parentStyleOrNull: *mut ServoComputedValues,
|
pub extern "C" fn Servo_GetComputedValuesForAnonymousBox(parent_style_or_null: *mut ServoComputedValues,
|
||||||
_pseudoTag: *mut nsIAtom,
|
pseudo_tag: *mut nsIAtom,
|
||||||
raw_data: *mut RawServoStyleSet)
|
raw_data: *mut RawServoStyleSet)
|
||||||
-> *mut ServoComputedValues {
|
-> *mut ServoComputedValues {
|
||||||
let _data = PerDocumentStyleData::borrow_mut_from_raw(raw_data);
|
let data = PerDocumentStyleData::borrow_mut_from_raw(raw_data);
|
||||||
unimplemented!();
|
|
||||||
|
let pseudo = match pseudo_element_from_atom(pseudo_tag, true) {
|
||||||
|
Ok(pseudo) => pseudo,
|
||||||
|
Err(pseudo) => {
|
||||||
|
warn!("stylo: Unable to parse anonymous-box pseudo-element: {}", pseudo);
|
||||||
|
return ptr::null_mut();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
type Helpers = ArcHelpers<ServoComputedValues, GeckoComputedValues>;
|
||||||
|
|
||||||
|
Helpers::maybe_with(parent_style_or_null, |maybe_parent| {
|
||||||
|
let new_computed = data.stylist.computed_values_for_pseudo(&pseudo, maybe_parent);
|
||||||
|
new_computed.map_or(ptr::null_mut(), |c| Helpers::from(c))
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
|
|
|
@ -151,14 +151,24 @@ impl SelectorImpl for GeckoSelectorImpl {
|
||||||
Ok(pseudo_class)
|
Ok(pseudo_class)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parse_pseudo_element(_context: &ParserContext,
|
fn parse_pseudo_element(context: &ParserContext,
|
||||||
name: &str) -> Result<PseudoElement, ()> {
|
name: &str) -> Result<PseudoElement, ()> {
|
||||||
use self::PseudoElement::*;
|
use self::PseudoElement::*;
|
||||||
let pseudo_element = match_ignore_ascii_case! { name,
|
|
||||||
"before" => Before,
|
|
||||||
"after" => After,
|
|
||||||
"first-line" => FirstLine,
|
|
||||||
|
|
||||||
|
// The braces here are unfortunate, but they're needed for
|
||||||
|
// match_ignore_ascii_case! to work as expected.
|
||||||
|
match_ignore_ascii_case! { name,
|
||||||
|
"before" => { return Ok(Before) },
|
||||||
|
"after" => { return Ok(After) },
|
||||||
|
"first-line" => { return Ok(FirstLine) },
|
||||||
|
_ => {}
|
||||||
|
}
|
||||||
|
|
||||||
|
if !context.in_user_agent_stylesheet {
|
||||||
|
return Err(())
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(match_ignore_ascii_case! { name,
|
||||||
"-moz-non-element" => MozNonElement,
|
"-moz-non-element" => MozNonElement,
|
||||||
|
|
||||||
"-moz-anonymous-block" => MozAnonymousBlock,
|
"-moz-anonymous-block" => MozAnonymousBlock,
|
||||||
|
@ -225,19 +235,94 @@ impl SelectorImpl for GeckoSelectorImpl {
|
||||||
"-moz-svg-text" => MozSVGText,
|
"-moz-svg-text" => MozSVGText,
|
||||||
|
|
||||||
_ => return Err(())
|
_ => return Err(())
|
||||||
};
|
})
|
||||||
|
|
||||||
Ok(pseudo_element)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl SelectorImplExt for GeckoSelectorImpl {
|
impl SelectorImplExt for GeckoSelectorImpl {
|
||||||
|
type ComputedValues = GeckoComputedValues;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn each_eagerly_cascaded_pseudo_element<F>(mut fun: F)
|
fn is_eagerly_cascaded_pseudo_element(pseudo: &PseudoElement) -> bool {
|
||||||
|
match *pseudo {
|
||||||
|
PseudoElement::Before |
|
||||||
|
PseudoElement::After |
|
||||||
|
PseudoElement::FirstLine => true,
|
||||||
|
_ => false,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
fn each_pseudo_element<F>(mut fun: F)
|
||||||
where F: FnMut(PseudoElement) {
|
where F: FnMut(PseudoElement) {
|
||||||
fun(PseudoElement::Before);
|
fun(PseudoElement::Before);
|
||||||
fun(PseudoElement::After);
|
fun(PseudoElement::After);
|
||||||
// TODO: probably a lot more are missing here
|
fun(PseudoElement::FirstLine);
|
||||||
|
|
||||||
|
fun(PseudoElement::MozNonElement);
|
||||||
|
fun(PseudoElement::MozAnonymousBlock);
|
||||||
|
fun(PseudoElement::MozAnonymousPositionedBlock);
|
||||||
|
fun(PseudoElement::MozMathMLAnonymousBlock);
|
||||||
|
fun(PseudoElement::MozXULAnonymousBlock);
|
||||||
|
|
||||||
|
fun(PseudoElement::MozHorizontalFramesetBorder);
|
||||||
|
fun(PseudoElement::MozVerticalFramesetBorder);
|
||||||
|
fun(PseudoElement::MozLineFrame);
|
||||||
|
fun(PseudoElement::MozButtonContent);
|
||||||
|
fun(PseudoElement::MozButtonLabel);
|
||||||
|
fun(PseudoElement::MozCellContent);
|
||||||
|
fun(PseudoElement::MozDropdownList);
|
||||||
|
fun(PseudoElement::MozFieldsetContent);
|
||||||
|
fun(PseudoElement::MozFramesetBlank);
|
||||||
|
fun(PseudoElement::MozDisplayComboboxControlFrame);
|
||||||
|
|
||||||
|
fun(PseudoElement::MozHTMLCanvasContent);
|
||||||
|
fun(PseudoElement::MozInlineTable);
|
||||||
|
fun(PseudoElement::MozTable);
|
||||||
|
fun(PseudoElement::MozTableCell);
|
||||||
|
fun(PseudoElement::MozTableColumnGroup);
|
||||||
|
fun(PseudoElement::MozTableColumn);
|
||||||
|
fun(PseudoElement::MozTableOuter);
|
||||||
|
fun(PseudoElement::MozTableRowGroup);
|
||||||
|
fun(PseudoElement::MozTableRow);
|
||||||
|
|
||||||
|
fun(PseudoElement::MozCanvas);
|
||||||
|
fun(PseudoElement::MozPageBreak);
|
||||||
|
fun(PseudoElement::MozPage);
|
||||||
|
fun(PseudoElement::MozPageContent);
|
||||||
|
fun(PseudoElement::MozPageSequence);
|
||||||
|
fun(PseudoElement::MozScrolledContent);
|
||||||
|
fun(PseudoElement::MozScrolledCanvas);
|
||||||
|
fun(PseudoElement::MozScrolledPageSequence);
|
||||||
|
fun(PseudoElement::MozColumnContent);
|
||||||
|
fun(PseudoElement::MozViewport);
|
||||||
|
fun(PseudoElement::MozViewportScroll);
|
||||||
|
fun(PseudoElement::MozAnonymousFlexItem);
|
||||||
|
fun(PseudoElement::MozAnonymousGridItem);
|
||||||
|
|
||||||
|
fun(PseudoElement::MozRuby);
|
||||||
|
fun(PseudoElement::MozRubyBase);
|
||||||
|
fun(PseudoElement::MozRubyBaseContainer);
|
||||||
|
fun(PseudoElement::MozRubyText);
|
||||||
|
fun(PseudoElement::MozRubyTextContainer);
|
||||||
|
|
||||||
|
fun(PseudoElement::MozTreeColumn);
|
||||||
|
fun(PseudoElement::MozTreeRow);
|
||||||
|
fun(PseudoElement::MozTreeSeparator);
|
||||||
|
fun(PseudoElement::MozTreeCell);
|
||||||
|
fun(PseudoElement::MozTreeIndentation);
|
||||||
|
fun(PseudoElement::MozTreeLine);
|
||||||
|
fun(PseudoElement::MozTreeTwisty);
|
||||||
|
fun(PseudoElement::MozTreeImage);
|
||||||
|
fun(PseudoElement::MozTreeCellText);
|
||||||
|
fun(PseudoElement::MozTreeCheckbox);
|
||||||
|
fun(PseudoElement::MozTreeProgressMeter);
|
||||||
|
fun(PseudoElement::MozTreeDropFeedback);
|
||||||
|
|
||||||
|
fun(PseudoElement::MozSVGMarkerAnonChild);
|
||||||
|
fun(PseudoElement::MozSVGOuterSVGAnonChild);
|
||||||
|
fun(PseudoElement::MozSVGForeignContent);
|
||||||
|
fun(PseudoElement::MozSVGText);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
|
|
@ -28,17 +28,17 @@ else
|
||||||
LIBCLANG_PATH=`brew --prefix llvm38`/lib/llvm-3.8/lib;
|
LIBCLANG_PATH=`brew --prefix llvm38`/lib/llvm-3.8/lib;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Prevent bindgen from generating opaque types for the gecko style structs.
|
# Prevent bindgen from generating opaque types for common gecko types
|
||||||
export MAP_GECKO_STRUCTS=""
|
export MAP_GECKO_TYPES=""
|
||||||
for STRUCT in nsStyleFont nsStyleColor nsStyleList nsStyleText \
|
for STRUCT in SheetParsingMode nsStyleFont nsStyleColor nsStyleList nsStyleText \
|
||||||
nsStyleVisibility nsStyleUserInterface nsStyleTableBorder \
|
nsStyleVisibility nsStyleUserInterface nsStyleTableBorder \
|
||||||
nsStyleSVG nsStyleVariables nsStyleBackground nsStylePosition \
|
nsStyleSVG nsStyleVariables nsStyleBackground nsStylePosition \
|
||||||
nsStyleTextReset nsStyleDisplay nsStyleContent nsStyleUIReset \
|
nsStyleTextReset nsStyleDisplay nsStyleContent nsStyleUIReset \
|
||||||
nsStyleTable nsStyleMargin nsStylePadding nsStyleBorder \
|
nsStyleTable nsStyleMargin nsStylePadding nsStyleBorder \
|
||||||
nsStyleOutline nsStyleXUL nsStyleSVGReset nsStyleColumn nsStyleEffects
|
nsStyleOutline nsStyleXUL nsStyleSVGReset nsStyleColumn nsStyleEffects
|
||||||
do
|
do
|
||||||
MAP_GECKO_STRUCTS=$MAP_GECKO_STRUCTS"-blacklist-type $STRUCT "
|
MAP_GECKO_TYPES=$MAP_GECKO_TYPES"-blacklist-type $STRUCT "
|
||||||
MAP_GECKO_STRUCTS=$MAP_GECKO_STRUCTS"-raw-line 'use gecko_style_structs::$STRUCT;' "
|
MAP_GECKO_TYPES=$MAP_GECKO_TYPES"-raw-line 'use gecko_style_structs::$STRUCT;' "
|
||||||
done
|
done
|
||||||
|
|
||||||
# Check for the include directory.
|
# Check for the include directory.
|
||||||
|
@ -50,7 +50,7 @@ fi
|
||||||
|
|
||||||
export RUST_BACKTRACE=1
|
export RUST_BACKTRACE=1
|
||||||
|
|
||||||
# We need to use 'eval' here to make MAP_GECKO_STRUCTS evaluate properly as
|
# We need to use 'eval' here to make MAP_GECKO_TYPES evaluate properly as
|
||||||
# multiple arguments.
|
# multiple arguments.
|
||||||
eval ./rust-bindgen/target/debug/bindgen \
|
eval ./rust-bindgen/target/debug/bindgen \
|
||||||
-x c++ -std=gnu++0x \
|
-x c++ -std=gnu++0x \
|
||||||
|
@ -61,4 +61,4 @@ eval ./rust-bindgen/target/debug/bindgen \
|
||||||
"$DIST_INCLUDE/mozilla/ServoBindings.h" \
|
"$DIST_INCLUDE/mozilla/ServoBindings.h" \
|
||||||
-match "ServoBindings.h" \
|
-match "ServoBindings.h" \
|
||||||
-match "nsStyleStructList.h" \
|
-match "nsStyleStructList.h" \
|
||||||
$MAP_GECKO_STRUCTS
|
$MAP_GECKO_TYPES
|
||||||
|
|
|
@ -95,6 +95,7 @@ export RUST_BACKTRACE=1
|
||||||
-match "nsDataHashtable.h" \
|
-match "nsDataHashtable.h" \
|
||||||
-match "nsCSSScanner.h" \
|
-match "nsCSSScanner.h" \
|
||||||
-match "Types.h" \
|
-match "Types.h" \
|
||||||
|
-match "SheetParsingMode.h" \
|
||||||
-blacklist-type "IsDestructibleFallbackImpl" \
|
-blacklist-type "IsDestructibleFallbackImpl" \
|
||||||
-blacklist-type "IsDestructibleFallback" \
|
-blacklist-type "IsDestructibleFallback" \
|
||||||
-opaque-type "nsIntMargin" \
|
-opaque-type "nsIntMargin" \
|
||||||
|
|
|
@ -52,7 +52,7 @@ impl<'a> StandaloneStyleContext<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> StyleContext<'a, GeckoSelectorImpl, GeckoComputedValues> for StandaloneStyleContext<'a> {
|
impl<'a> StyleContext<'a, GeckoSelectorImpl> for StandaloneStyleContext<'a> {
|
||||||
fn shared_context(&self) -> &'a SharedStyleContext {
|
fn shared_context(&self) -> &'a SharedStyleContext {
|
||||||
&self.shared
|
&self.shared
|
||||||
}
|
}
|
||||||
|
|
35
ports/gonk/Cargo.lock
generated
35
ports/gonk/Cargo.lock
generated
|
@ -136,6 +136,11 @@ name = "bitflags"
|
||||||
version = "0.4.0"
|
version = "0.4.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bitflags"
|
||||||
|
version = "0.5.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "block"
|
name = "block"
|
||||||
version = "0.1.5"
|
version = "0.1.5"
|
||||||
|
@ -659,7 +664,7 @@ dependencies = [
|
||||||
"servo-skia 0.20130412.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"servo-skia 0.20130412.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"simd 0.1.0 (git+https://github.com/huonw/simd)",
|
"simd 0.1.0 (git+https://github.com/huonw/simd)",
|
||||||
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"string_cache 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
"string_cache 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"style 0.0.1",
|
"style 0.0.1",
|
||||||
"style_traits 0.0.1",
|
"style_traits 0.0.1",
|
||||||
"time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
"time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -804,7 +809,7 @@ dependencies = [
|
||||||
"phf 0.7.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
"phf 0.7.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"phf_codegen 0.7.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
"phf_codegen 0.7.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"string_cache 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
"string_cache 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"tendril 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"tendril 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
"time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
@ -995,11 +1000,11 @@ dependencies = [
|
||||||
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"script 0.0.1",
|
"script 0.0.1",
|
||||||
"script_traits 0.0.1",
|
"script_traits 0.0.1",
|
||||||
"selectors 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"selectors 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"serde_json 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde_json 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"serde_macros 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde_macros 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"string_cache 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
"string_cache 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"style 0.0.1",
|
"style 0.0.1",
|
||||||
"style_traits 0.0.1",
|
"style_traits 0.0.1",
|
||||||
"time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
"time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -1678,10 +1683,10 @@ dependencies = [
|
||||||
"regex 0.1.55 (registry+https://github.com/rust-lang/crates.io-index)",
|
"regex 0.1.55 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"script_traits 0.0.1",
|
"script_traits 0.0.1",
|
||||||
"selectors 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"selectors 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"string_cache 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
"string_cache 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"style 0.0.1",
|
"style 0.0.1",
|
||||||
"time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
"time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"unicase 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"unicase 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -1721,10 +1726,10 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "selectors"
|
name = "selectors"
|
||||||
version = "0.5.2"
|
version = "0.5.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"bitflags 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"cssparser 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cssparser 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"fnv 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"fnv 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"heapsize 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"heapsize 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -1732,7 +1737,7 @@ dependencies = [
|
||||||
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"quickersort 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"quickersort 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"string_cache 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
"string_cache 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -1928,7 +1933,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "string_cache"
|
name = "string_cache"
|
||||||
version = "0.2.12"
|
version = "0.2.13"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"debug_unreachable 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"debug_unreachable 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -1958,11 +1963,11 @@ dependencies = [
|
||||||
"num-traits 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)",
|
"num-traits 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"plugins 0.0.1",
|
"plugins 0.0.1",
|
||||||
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"selectors 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"selectors 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"serde_macros 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde_macros 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"string_cache 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
"string_cache 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"style_traits 0.0.1",
|
"style_traits 0.0.1",
|
||||||
"time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
"time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -1981,7 +1986,7 @@ dependencies = [
|
||||||
"log 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"plugins 0.0.1",
|
"plugins 0.0.1",
|
||||||
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"selectors 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"selectors 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"serde_macros 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde_macros 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -2164,7 +2169,7 @@ dependencies = [
|
||||||
"serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"serde_macros 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde_macros 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"string_cache 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
"string_cache 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -2350,7 +2355,7 @@ dependencies = [
|
||||||
"phf 0.7.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
"phf 0.7.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"phf_codegen 0.7.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
"phf_codegen 0.7.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"string_cache 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
"string_cache 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"tendril 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"tendril 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
"time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
|
@ -51,15 +51,11 @@ details::-servo-details-summary {
|
||||||
details[open]::-servo-details-summary {
|
details[open]::-servo-details-summary {
|
||||||
list-style: disclosure-open;
|
list-style: disclosure-open;
|
||||||
}
|
}
|
||||||
details::-servo-details-content {
|
*|*::-servo-details-content {
|
||||||
margin-left: 40px;
|
margin-left: 40px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
details[open]::-servo-details-content {
|
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Until servo supports svg properly, make sure to at least prevent svg
|
* Until servo supports svg properly, make sure to at least prevent svg
|
||||||
* children from being layed out and rendered like usual html.
|
* children from being layed out and rendered like usual html.
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use layout::Fragment;
|
use layout::Fragment;
|
||||||
|
use layout::ServoThreadSafeLayoutNode;
|
||||||
use std::mem::size_of;
|
use std::mem::size_of;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -12,7 +13,7 @@ fn test_size_of_fragment() {
|
||||||
|
|
||||||
if actual < expected {
|
if actual < expected {
|
||||||
panic!("Your changes have decreased the stack size of layout::fragment::Fragment \
|
panic!("Your changes have decreased the stack size of layout::fragment::Fragment \
|
||||||
from {} to {}. Good work! Please update the size in tests/layout/size_of.rs",
|
from {} to {}. Good work! Please update the size in tests/unit/layout/size_of.rs",
|
||||||
expected, actual);
|
expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,7 +21,27 @@ fn test_size_of_fragment() {
|
||||||
panic!("Your changes have increased the stack size of layout::fragment::Fragment \
|
panic!("Your changes have increased the stack size of layout::fragment::Fragment \
|
||||||
from {} to {}. Please consider choosing a design which avoids this increase. \
|
from {} to {}. Please consider choosing a design which avoids this increase. \
|
||||||
If you feel that the increase is necessary, update the size in \
|
If you feel that the increase is necessary, update the size in \
|
||||||
tests/layout/size_of.rs.",
|
tests/unit/layout/size_of.rs.",
|
||||||
|
expected, actual);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_size_of_layout_node() {
|
||||||
|
let expected = 16;
|
||||||
|
let actual = size_of::<ServoThreadSafeLayoutNode>();
|
||||||
|
|
||||||
|
if actual < expected {
|
||||||
|
panic!("Your changes have decreased the stack size of layout::wrapper::ServoThreadSafeLayoutNode \
|
||||||
|
from {} to {}. Good work! Please update the size in tests/layout/unit/size_of.rs",
|
||||||
|
expected, actual);
|
||||||
|
}
|
||||||
|
|
||||||
|
if actual > expected {
|
||||||
|
panic!("Your changes have increased the stack size of layout::wrapper::ServoThreadSafeLayoutNode \
|
||||||
|
from {} to {}. Please consider choosing a design which avoids this increase. \
|
||||||
|
If you feel that the increase is necessary, update the size in \
|
||||||
|
tests/unit/layout/size_of.rs.",
|
||||||
expected, actual);
|
expected, actual);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,6 @@ app_units = {version = "0.2.3", features = ["plugins"]}
|
||||||
cssparser = {version = "0.5.4", features = ["heap_size"]}
|
cssparser = {version = "0.5.4", features = ["heap_size"]}
|
||||||
euclid = {version = "0.6.4", features = ["plugins"]}
|
euclid = {version = "0.6.4", features = ["plugins"]}
|
||||||
selectors = {version = "0.5", features = ["heap_size"]}
|
selectors = {version = "0.5", features = ["heap_size"]}
|
||||||
string_cache = {version = "0.2.12", features = ["heap_size"]}
|
string_cache = {version = "0.2", features = ["heap_size"]}
|
||||||
url = {version = "1.0.0", features = ["heap_size"]}
|
url = {version = "1.0.0", features = ["heap_size"]}
|
||||||
rustc-serialize = "0.3"
|
rustc-serialize = "0.3"
|
||||||
|
|
|
@ -8,7 +8,7 @@ use selectors::parser::*;
|
||||||
use std::borrow::ToOwned;
|
use std::borrow::ToOwned;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::sync::Mutex;
|
use std::sync::Mutex;
|
||||||
use string_cache::Atom;
|
use string_cache::{Atom, Namespace};
|
||||||
use style::properties::{PropertyDeclaration, PropertyDeclarationBlock, DeclaredValue, longhands};
|
use style::properties::{PropertyDeclaration, PropertyDeclarationBlock, DeclaredValue, longhands};
|
||||||
use style::stylesheets::{CSSRule, StyleRule, Origin};
|
use style::stylesheets::{CSSRule, StyleRule, Origin};
|
||||||
use style::error_reporting::ParseErrorReporter;
|
use style::error_reporting::ParseErrorReporter;
|
||||||
|
@ -32,13 +32,13 @@ fn test_parse_stylesheet() {
|
||||||
media: None,
|
media: None,
|
||||||
dirty_on_viewport_size_change: false,
|
dirty_on_viewport_size_change: false,
|
||||||
rules: vec![
|
rules: vec![
|
||||||
CSSRule::Namespace(None, ns!(html)),
|
CSSRule::Namespace(None, Namespace(Atom::from("http://www.w3.org/1999/xhtml"))),
|
||||||
CSSRule::Style(StyleRule {
|
CSSRule::Style(StyleRule {
|
||||||
selectors: vec![
|
selectors: vec![
|
||||||
Selector {
|
Selector {
|
||||||
compound_selectors: Arc::new(CompoundSelector {
|
compound_selectors: Arc::new(CompoundSelector {
|
||||||
simple_selectors: vec![
|
simple_selectors: vec![
|
||||||
SimpleSelector::Namespace(ns!(html)),
|
SimpleSelector::Namespace(Namespace(Atom::from("http://www.w3.org/1999/xhtml"))),
|
||||||
SimpleSelector::LocalName(LocalName {
|
SimpleSelector::LocalName(LocalName {
|
||||||
name: atom!("input"),
|
name: atom!("input"),
|
||||||
lower_name: atom!("input"),
|
lower_name: atom!("input"),
|
||||||
|
@ -68,7 +68,7 @@ fn test_parse_stylesheet() {
|
||||||
Selector {
|
Selector {
|
||||||
compound_selectors: Arc::new(CompoundSelector {
|
compound_selectors: Arc::new(CompoundSelector {
|
||||||
simple_selectors: vec![
|
simple_selectors: vec![
|
||||||
SimpleSelector::Namespace(ns!(html)),
|
SimpleSelector::Namespace(Namespace(Atom::from("http://www.w3.org/1999/xhtml"))),
|
||||||
SimpleSelector::LocalName(LocalName {
|
SimpleSelector::LocalName(LocalName {
|
||||||
name: atom!("html"),
|
name: atom!("html"),
|
||||||
lower_name: atom!("html"),
|
lower_name: atom!("html"),
|
||||||
|
@ -82,7 +82,7 @@ fn test_parse_stylesheet() {
|
||||||
Selector {
|
Selector {
|
||||||
compound_selectors: Arc::new(CompoundSelector {
|
compound_selectors: Arc::new(CompoundSelector {
|
||||||
simple_selectors: vec![
|
simple_selectors: vec![
|
||||||
SimpleSelector::Namespace(ns!(html)),
|
SimpleSelector::Namespace(Namespace(Atom::from("http://www.w3.org/1999/xhtml"))),
|
||||||
SimpleSelector::LocalName(LocalName {
|
SimpleSelector::LocalName(LocalName {
|
||||||
name: atom!("body"),
|
name: atom!("body"),
|
||||||
lower_name: atom!("body"),
|
lower_name: atom!("body"),
|
||||||
|
@ -107,10 +107,12 @@ fn test_parse_stylesheet() {
|
||||||
Selector {
|
Selector {
|
||||||
compound_selectors: Arc::new(CompoundSelector {
|
compound_selectors: Arc::new(CompoundSelector {
|
||||||
simple_selectors: vec![
|
simple_selectors: vec![
|
||||||
|
SimpleSelector::Namespace(Namespace(Atom::from("http://www.w3.org/1999/xhtml"))),
|
||||||
SimpleSelector::Class(Atom::from("ok")),
|
SimpleSelector::Class(Atom::from("ok")),
|
||||||
],
|
],
|
||||||
next: Some((Arc::new(CompoundSelector {
|
next: Some((Arc::new(CompoundSelector {
|
||||||
simple_selectors: vec![
|
simple_selectors: vec![
|
||||||
|
SimpleSelector::Namespace(Namespace(Atom::from("http://www.w3.org/1999/xhtml"))),
|
||||||
SimpleSelector::ID(Atom::from("d1")),
|
SimpleSelector::ID(Atom::from("d1")),
|
||||||
],
|
],
|
||||||
next: None,
|
next: None,
|
||||||
|
@ -145,7 +147,6 @@ fn test_parse_stylesheet() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
struct CSSError {
|
struct CSSError {
|
||||||
pub line: usize,
|
pub line: usize,
|
||||||
pub column: usize,
|
pub column: usize,
|
||||||
|
|
|
@ -6,4 +6,3 @@
|
||||||
<summary>Test</summary>
|
<summary>Test</summary>
|
||||||
Contents
|
Contents
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue