mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
RareFlowFlags -> ~RareFlowFlags
This commit is contained in:
parent
baad6e3963
commit
4133982050
4 changed files with 19 additions and 16 deletions
|
@ -705,6 +705,8 @@ impl Flow for BlockFlow {
|
|||
self.base.flags_info.flags.inorder() || self.base.num_floats > 0
|
||||
};
|
||||
|
||||
// FIXME(ksh8281): avoid copy
|
||||
let flags_info = self.base.flags_info.clone();
|
||||
for kid in self.base.child_iter() {
|
||||
assert!(kid.starts_block_flow() || kid.starts_inline_flow());
|
||||
|
||||
|
@ -721,10 +723,8 @@ impl Flow for BlockFlow {
|
|||
//
|
||||
// TODO(pcwalton): When we have out-of-flow children, don't unconditionally propagate.
|
||||
|
||||
// FIXME(ksh8281): avoid copy
|
||||
child_base.flags_info.propagate_text_decoration_from_parent(self.base.flags_info);
|
||||
|
||||
child_base.flags_info.propagate_text_alignment_from_parent(self.base.flags_info)
|
||||
child_base.flags_info.propagate_text_decoration_from_parent(&flags_info);
|
||||
child_base.flags_info.propagate_text_alignment_from_parent(&flags_info)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -750,7 +750,7 @@ impl Box {
|
|||
let text_color = self.style().Color.color.to_gfx_color();
|
||||
|
||||
// Set the various text display item flags.
|
||||
let mut flow_flags = flow::base(flow).flags_info;
|
||||
let mut flow_flags = flow::base(flow).flags_info.clone();
|
||||
|
||||
let inline_info = self.inline_info.borrow();
|
||||
match inline_info.get() {
|
||||
|
@ -758,7 +758,7 @@ impl Box {
|
|||
for data in info.parent_info.rev_iter() {
|
||||
let parent_info = FlowFlagsInfo::new(data.style.get());
|
||||
//FIXME(ksh8281) avoid copy
|
||||
flow_flags.propagate_text_decoration_from_parent(parent_info);
|
||||
flow_flags.propagate_text_decoration_from_parent(&parent_info);
|
||||
}
|
||||
},
|
||||
&None => {}
|
||||
|
|
|
@ -259,11 +259,12 @@ pub trait PostorderFlowTraversal {
|
|||
}
|
||||
}
|
||||
|
||||
#[deriving(Clone)]
|
||||
pub struct FlowFlagsInfo{
|
||||
flags: FlowFlags,
|
||||
|
||||
/// text-decoration colors
|
||||
rare_flow_flags: Option<RareFlowFlags>,
|
||||
rare_flow_flags: Option<~RareFlowFlags>,
|
||||
}
|
||||
|
||||
#[deriving(Clone)]
|
||||
|
@ -274,6 +275,7 @@ pub struct RareFlowFlags {
|
|||
}
|
||||
|
||||
/// Flags used in flows, tightly packed to save space.
|
||||
#[deriving(Clone)]
|
||||
pub struct FlowFlags(u8);
|
||||
|
||||
/// The bitmask of flags that represent text decoration fields that get propagated downward.
|
||||
|
@ -301,8 +303,8 @@ impl FlowFlagsInfo {
|
|||
flags.set_override_line_through(text_decoration.line_through);
|
||||
|
||||
// TODO(ksh8281) compute text-decoration-color,style,line
|
||||
let rare_flow_flags = if flags.is_text_decoration_enable() {
|
||||
Some(RareFlowFlags {
|
||||
let rare_flow_flags = if flags.is_text_decoration_enabled() {
|
||||
Some(~RareFlowFlags {
|
||||
underline_color: style.Color.color.to_gfx_color(),
|
||||
overline_color: style.Color.color.to_gfx_color(),
|
||||
line_through_color: style.Color.color.to_gfx_color(),
|
||||
|
@ -351,12 +353,12 @@ impl FlowFlagsInfo {
|
|||
}
|
||||
|
||||
/// Propagates text decoration flags from an appropriate parent flow per CSS 2.1 § 16.3.1.
|
||||
pub fn propagate_text_decoration_from_parent(&mut self, parent: FlowFlagsInfo) {
|
||||
if !parent.flags.is_text_decoration_enable() {
|
||||
pub fn propagate_text_decoration_from_parent(&mut self, parent: &FlowFlagsInfo) {
|
||||
if !parent.flags.is_text_decoration_enabled() {
|
||||
return ;
|
||||
}
|
||||
|
||||
if !self.flags.is_text_decoration_enable() && parent.flags.is_text_decoration_enable() {
|
||||
if !self.flags.is_text_decoration_enabled() && parent.flags.is_text_decoration_enabled() {
|
||||
self.rare_flow_flags = parent.rare_flow_flags.clone();
|
||||
return ;
|
||||
}
|
||||
|
@ -416,7 +418,7 @@ impl FlowFlagsInfo {
|
|||
}
|
||||
|
||||
/// Propagates text alignment flags from an appropriate parent flow per CSS 2.1.
|
||||
pub fn propagate_text_alignment_from_parent(&mut self, parent: FlowFlagsInfo) {
|
||||
pub fn propagate_text_alignment_from_parent(&mut self, parent: &FlowFlagsInfo) {
|
||||
self.flags.set_text_align_override(parent.flags);
|
||||
}
|
||||
}
|
||||
|
@ -462,7 +464,7 @@ impl FlowFlags {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
pub fn is_text_decoration_enable(&self) -> bool {
|
||||
pub fn is_text_decoration_enabled(&self) -> bool {
|
||||
(**self & TEXT_DECORATION_OVERRIDE_BITMASK) != 0
|
||||
}
|
||||
}
|
||||
|
|
|
@ -640,12 +640,13 @@ impl Flow for InlineFlow {
|
|||
}
|
||||
}
|
||||
|
||||
// FIXME(ksh8281) avoid copy
|
||||
let flags_info = self.base.flags_info.clone();
|
||||
for kid in self.base.child_iter() {
|
||||
let child_base = flow::mut_base(*kid);
|
||||
child_base.position.size.width = self.base.position.size.width;
|
||||
child_base.flags_info.flags.set_inorder(self.base.flags_info.flags.inorder());
|
||||
// FIXME(ksh8281) avoid copy
|
||||
child_base.flags_info.propagate_text_alignment_from_parent(self.base.flags_info)
|
||||
child_base.flags_info.propagate_text_alignment_from_parent(&flags_info)
|
||||
}
|
||||
// There are no child contexts, so stop here.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue