Skip to content

Commit

Permalink
RareFlowFlags -> ~RareFlowFlags
Browse files Browse the repository at this point in the history
  • Loading branch information
ksh8281 committed Jan 23, 2014
1 parent baad6e3 commit 4133982
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 16 deletions.
8 changes: 4 additions & 4 deletions src/components/main/layout/block.rs
Expand Up @@ -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());

Expand All @@ -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)
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/components/main/layout/box_.rs
Expand Up @@ -750,15 +750,15 @@ 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() {
&Some(ref info) => {
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 => {}
Expand Down
18 changes: 10 additions & 8 deletions src/components/main/layout/flow.rs
Expand Up @@ -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)]
Expand All @@ -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.
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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 ;
}
Expand Down Expand Up @@ -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);
}
}
Expand Down Expand Up @@ -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
}
}
Expand Down
5 changes: 3 additions & 2 deletions src/components/main/layout/inline.rs
Expand Up @@ -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.

Expand Down

5 comments on commit 4133982

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from pcwalton
at ksh8281@4133982

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging ksh8281/servo/inline_add = 4133982 into auto

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ksh8281/servo/inline_add = 4133982 merged ok, testing candidate = 6662fb0

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = 6662fb0

Please sign in to comment.