diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2017-07-15 07:44:08 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-15 07:44:08 -0700 |
commit | 3497bbbf1d092dd8ab274e21b33b6394afa61d8a (patch) | |
tree | 0dc23013790dcb77ac4a0c3bbfe4170876cbc352 /components/layout/traversal.rs | |
parent | 5c5c5147eae4159f94dbad9012e04ab9480063fd (diff) | |
parent | bf9369b29d42255ea52b172e3ddd9b44db922d44 (diff) | |
download | servo-3497bbbf1d092dd8ab274e21b33b6394afa61d8a.tar.gz servo-3497bbbf1d092dd8ab274e21b33b6394afa61d8a.zip |
Auto merge of #17744 - emilio:ensure-data, r=nox
script: Move the layout_wrapper outside of script.
This allows us to have ensure_data() and clear_data() functions on the TElement
trait, instead of hacking around it adding methods in random traits.
This also allows us to do some further cleanup, which I'd rather do in a
followup.
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/17744)
<!-- Reviewable:end -->
Diffstat (limited to 'components/layout/traversal.rs')
-rw-r--r-- | components/layout/traversal.rs | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/components/layout/traversal.rs b/components/layout/traversal.rs index f011925ebb8..cf75a47bbf8 100644 --- a/components/layout/traversal.rs +++ b/components/layout/traversal.rs @@ -4,7 +4,6 @@ //! Traversals over the DOM and flow trees, running the layout computations. -use atomic_refcell::AtomicRefCell; use construct::FlowConstructor; use context::LayoutContext; use display_list_builder::DisplayListBuildState; @@ -13,13 +12,12 @@ use flow::{CAN_BE_FRAGMENTED, Flow, ImmutableFlowUtils, PostorderFlowTraversal}; use script_layout_interface::wrapper_traits::{LayoutNode, ThreadSafeLayoutNode}; use servo_config::opts; use style::context::{SharedStyleContext, StyleContext}; -use style::data::ElementData; use style::dom::{NodeInfo, TElement, TNode}; use style::selector_parser::RestyleDamage; use style::servo::restyle_damage::{BUBBLE_ISIZES, REFLOW, REFLOW_OUT_OF_FLOW, REPAINT}; use style::traversal::{DomTraversal, TraversalDriver, recalc_style_at}; use style::traversal::PerLevelTraversalData; -use wrapper::{GetRawData, LayoutNodeHelpers, LayoutNodeLayoutData}; +use wrapper::{GetRawData, LayoutNodeLayoutData}; use wrapper::ThreadSafeLayoutNodeHelpers; pub struct RecalcStyleAndConstructFlows<'a> { @@ -59,7 +57,7 @@ impl<'a, E> DomTraversal<E> for RecalcStyleAndConstructFlows<'a> context: &mut StyleContext<E>, node: E::ConcreteNode) { // FIXME(pcwalton): Stop allocating here. Ideally this should just be // done by the HTML parser. - node.initialize_data(); + unsafe { node.initialize_data() }; if !node.is_text_node() { let el = node.as_element().unwrap(); @@ -81,15 +79,6 @@ impl<'a, E> DomTraversal<E> for RecalcStyleAndConstructFlows<'a> node.parent_node().unwrap().to_threadsafe().restyle_damage() != RestyleDamage::empty() } - unsafe fn ensure_element_data(element: &E) -> &AtomicRefCell<ElementData> { - element.as_node().initialize_data(); - element.get_data().unwrap() - } - - unsafe fn clear_element_data(element: &E) { - element.as_node().clear_data(); - } - fn shared_context(&self) -> &SharedStyleContext { &self.context.style_context } |