зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1008969 - part 1, Initialize the nsHTMLReflowState "frame type" correctly for display:grid/inline-grid. Add nsIFrame::IsFlexOrGridItem(), and use it to share some flexbox code in nsHTMLReflowState. r=dholbert
This commit is contained in:
Родитель
b084cf48ba
Коммит
ca7136dba2
|
@ -1689,7 +1689,7 @@ nsDisplayItem::MaxActiveLayers()
|
|||
int32_t
|
||||
nsDisplayItem::ZIndex() const
|
||||
{
|
||||
if (!mFrame->IsPositioned() && !mFrame->IsFlexItem())
|
||||
if (!mFrame->IsPositioned() && !mFrame->IsFlexOrGridItem())
|
||||
return 0;
|
||||
|
||||
const nsStylePosition* position = mFrame->StylePosition();
|
||||
|
|
|
@ -141,9 +141,9 @@ nsCSSOffsetState::nsCSSOffsetState(nsIFrame *aFrame,
|
|||
, rendContext(aRenderingContext)
|
||||
, mWritingMode(aFrame->GetWritingMode())
|
||||
{
|
||||
MOZ_ASSERT(!aFrame->IsFlexItem(),
|
||||
MOZ_ASSERT(!aFrame->IsFlexOrGridItem(),
|
||||
"We're about to resolve vertical percent margin & padding "
|
||||
"values against CB width, which is incorrect for flex items");
|
||||
"values against CB width, which is incorrect for flex/grid items");
|
||||
InitOffsets(aContainingBlockWidth, aContainingBlockWidth, frame->GetType());
|
||||
}
|
||||
|
||||
|
@ -717,6 +717,7 @@ nsHTMLReflowState::InitFrameType(nsIAtom* aFrameType)
|
|||
case NS_STYLE_DISPLAY_TABLE:
|
||||
case NS_STYLE_DISPLAY_TABLE_CAPTION:
|
||||
case NS_STYLE_DISPLAY_FLEX:
|
||||
case NS_STYLE_DISPLAY_GRID:
|
||||
frameType = NS_CSS_FRAME_TYPE_BLOCK;
|
||||
break;
|
||||
|
||||
|
@ -727,6 +728,7 @@ nsHTMLReflowState::InitFrameType(nsIAtom* aFrameType)
|
|||
case NS_STYLE_DISPLAY_INLINE_XUL_GRID:
|
||||
case NS_STYLE_DISPLAY_INLINE_STACK:
|
||||
case NS_STYLE_DISPLAY_INLINE_FLEX:
|
||||
case NS_STYLE_DISPLAY_INLINE_GRID:
|
||||
frameType = NS_CSS_FRAME_TYPE_INLINE;
|
||||
break;
|
||||
|
||||
|
@ -1873,7 +1875,7 @@ VerticalOffsetPercentBasis(const nsIFrame* aFrame,
|
|||
nscoord aContainingBlockWidth,
|
||||
nscoord aContainingBlockHeight)
|
||||
{
|
||||
if (!aFrame->IsFlexItem()) {
|
||||
if (!aFrame->IsFlexOrGridItem()) {
|
||||
return aContainingBlockWidth;
|
||||
}
|
||||
|
||||
|
|
|
@ -2931,6 +2931,10 @@ NS_PTR_TO_INT32(frame->Properties().Get(nsIFrame::ParagraphDepthProperty()))
|
|||
* Is this a flex item? (i.e. a non-abs-pos child of a flex container)
|
||||
*/
|
||||
inline bool IsFlexItem() const;
|
||||
/**
|
||||
* Is this a flex or grid item? (i.e. a non-abs-pos child of a flex/grid container)
|
||||
*/
|
||||
inline bool IsFlexOrGridItem() const;
|
||||
|
||||
inline bool IsBlockInside() const;
|
||||
inline bool IsBlockOutside() const;
|
||||
|
|
|
@ -18,6 +18,18 @@ nsIFrame::IsFlexItem() const
|
|||
!(GetStateBits() & NS_FRAME_OUT_OF_FLOW);
|
||||
}
|
||||
|
||||
bool
|
||||
nsIFrame::IsFlexOrGridItem() const
|
||||
{
|
||||
if (mParent) {
|
||||
nsIAtom* t = mParent->GetType();
|
||||
return (t == nsGkAtoms::flexContainerFrame ||
|
||||
t == nsGkAtoms::gridContainerFrame) &&
|
||||
!(GetStateBits() & NS_FRAME_OUT_OF_FLOW);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
nsIFrame::IsFloating() const
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче