Rename a bunch of style/layout data items

GetLayoutData::get_style_and_layout_data becomes
GetOpaqueStyleAndLayoutData::get_opaque_style_and_layout_data.

GetRawData::get_raw_data becomes GetStyleAndLayoutData::get_style_and_layout_data.

LayoutNode::init_style_and_layout_data becomes
LayoutNode::init_opaque_style_and_layout_data.

LayoutNode::take_style_and_layout_data becomes
LayoutNode::take_opaque_style_and_layout_data.
This commit is contained in:
Anthony Ramine 2020-04-06 12:06:00 +02:00
parent 3df65c02fe
commit e3be136c9b
10 changed files with 105 additions and 95 deletions

View file

@ -8,7 +8,7 @@ use crate::element_data::{LayoutBox, LayoutDataForElement};
use crate::geom::PhysicalSize;
use crate::replaced::{CanvasInfo, CanvasSource, ReplacedContent};
use crate::style_ext::{Display, DisplayGeneratingBox, DisplayInside, DisplayOutside};
use crate::wrapper::GetRawData;
use crate::wrapper::GetStyleAndLayoutData;
use atomic_refcell::AtomicRefMut;
use html5ever::LocalName;
use net_traits::image::base::Image as NetImage;
@ -448,7 +448,7 @@ where
#[allow(unsafe_code)]
fn layout_data_mut(self) -> AtomicRefMut<'dom, LayoutDataForElement> {
self.get_raw_data()
self.get_style_and_layout_data()
.map(|d| d.layout_data.borrow_mut())
.unwrap()
}

View file

@ -3,7 +3,7 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use crate::context::LayoutContext;
use crate::wrapper::GetRawData;
use crate::wrapper::GetStyleAndLayoutData;
use script_layout_interface::wrapper_traits::LayoutNode;
use style::context::{SharedStyleContext, StyleContext};
use style::data::ElementData;
@ -63,7 +63,7 @@ where
}
fn text_node_needs_traversal(node: E::ConcreteNode, parent_data: &ElementData) -> bool {
node.get_raw_data().is_none() || !parent_data.damage.is_empty()
node.get_style_and_layout_data().is_none() || !parent_data.damage.is_empty()
}
fn shared_context(&self) -> &SharedStyleContext {

View file

@ -5,18 +5,18 @@
#![allow(unsafe_code)]
use crate::data::StyleAndLayoutData;
use script_layout_interface::wrapper_traits::GetLayoutData;
use script_layout_interface::wrapper_traits::GetOpaqueStyleAndLayoutData;
pub trait GetRawData<'dom> {
fn get_raw_data(self) -> Option<&'dom StyleAndLayoutData>;
pub trait GetStyleAndLayoutData<'dom> {
fn get_style_and_layout_data(self) -> Option<&'dom StyleAndLayoutData>;
}
impl<'dom, T> GetRawData<'dom> for T
impl<'dom, T> GetStyleAndLayoutData<'dom> for T
where
T: GetLayoutData<'dom>,
T: GetOpaqueStyleAndLayoutData<'dom>,
{
fn get_raw_data(self) -> Option<&'dom StyleAndLayoutData> {
self.get_style_and_layout_data()
fn get_style_and_layout_data(self) -> Option<&'dom StyleAndLayoutData> {
self.get_opaque_style_and_layout_data()
.map(|opaque| opaque.downcast_ref().unwrap())
}
}