layout: Mark flex items properly during construction

Set the flag of the fragment of children in a flex container according
to the direction of the container. The mark is done on the fragment
because flex item enstablish a stacking context when its z-index is
non-zero ,despite its `position' property.
This commit is contained in:
Pu Xingyu 2016-11-08 19:49:56 +08:00
parent ef5ca14283
commit 7f721e1f2c
6 changed files with 76 additions and 21 deletions

View file

@ -30,6 +30,7 @@ use block::{BlockFlow, FormattingContextType};
use context::{LayoutContext, SharedLayoutContext};
use display_list_builder::DisplayListBuildState;
use euclid::{Point2D, Size2D};
use flex::FlexFlow;
use floats::{Floats, SpeculatedFloatPlacement};
use flow_list::{FlowList, MutFlowListIterator};
use flow_ref::{FlowRef, WeakFlowRef};
@ -86,6 +87,16 @@ pub trait Flow: fmt::Debug + Sync + Send + 'static {
panic!("called as_mut_block() on a non-block flow")
}
/// If this is a flex flow, returns the underlying object. Fails otherwise.
fn as_flex(&self) -> &FlexFlow {
panic!("called as_flex() on a non-flex flow")
}
/// If this is a flex flow, returns the underlying object, borrowed mutably. Fails otherwise.
fn as_mut_flex(&mut self) -> &mut FlexFlow {
panic!("called as_mut_flex() on a non-flex flow")
}
/// If this is an inline flow, returns the underlying object. Fails otherwise.
fn as_inline(&self) -> &InlineFlow {
panic!("called as_inline() on a non-inline flow")