Bug 655877 - Part 15: Don't treat SVG text frames as being positioned. r=roc

This commit is contained in:
Cameron McCormack 2012-08-02 21:38:50 +10:00
parent f41c8a5fe8
commit ba7efb66ff
16 changed files with 111 additions and 59 deletions

View File

@ -488,16 +488,15 @@ nsGenericHTMLElement::GetOffsetRect(nsRect& aRect, nsIContent** aOffsetParent)
parent = frame;
}
else {
const bool isPositioned = frame->GetStyleDisplay()->IsPositioned();
const bool isAbsolutelyPositioned =
frame->GetStyleDisplay()->IsAbsolutelyPositioned();
const bool isPositioned = frame->IsPositioned();
const bool isAbsolutelyPositioned = frame->IsAbsolutelyPositioned();
origin += frame->GetPositionIgnoringScrolling();
for ( ; parent ; parent = parent->GetParent()) {
content = parent->GetContent();
// Stop at the first ancestor that is positioned.
if (parent->GetStyleDisplay()->IsPositioned()) {
if (parent->IsPositioned()) {
*aOffsetParent = content;
NS_IF_ADDREF(*aOffsetParent);
break;

View File

@ -1073,7 +1073,7 @@ nsFrameConstructorState::GetGeometricParent(const nsStyleDisplay* aStyleDisplay,
}
if (aStyleDisplay->IsFloatingStyle() && mFloatedItems.containingBlock) {
NS_ASSERTION(!aStyleDisplay->IsAbsolutelyPositioned(),
NS_ASSERTION(!aStyleDisplay->IsAbsolutelyPositionedStyle(),
"Absolutely positioned _and_ floating?");
return mFloatedItems.containingBlock;
}
@ -1933,7 +1933,7 @@ nsCSSFrameConstructor::ConstructTable(nsFrameConstructorState& aState,
const nsStyleDisplay* display = outerStyleContext->GetStyleDisplay();
// Mark the table frame as an absolute container if needed
if (display->IsPositioned()) {
if (display->IsPositioned(aParentFrame)) {
aState.PushAbsoluteContainingBlock(newFrame, absoluteSaveState);
}
if (aItem.mFCData->mBits & FCDATA_USE_CHILD_ITEMS) {
@ -2478,8 +2478,8 @@ nsCSSFrameConstructor::ConstructDocElementFrame(Element* aDocEle
state.GetGeometricParent(display,
mDocElementContainingBlock),
mDocElementContainingBlock, styleContext,
&contentFrame, frameItems, display->IsPositioned(),
nullptr);
&contentFrame, frameItems,
display->IsPositioned(contentFrame), nullptr);
if (NS_FAILED(rv) || frameItems.IsEmpty())
return rv;
*aNewFrame = frameItems.FirstChild();
@ -2977,7 +2977,7 @@ nsCSSFrameConstructor::ConstructSelectFrame(nsFrameConstructorState& aState,
// Notify combobox that it should use the listbox as it's popup
comboBox->SetDropDown(listFrame);
NS_ASSERTION(!listStyle->GetStyleDisplay()->IsPositioned(),
NS_ASSERTION(!listFrame->IsPositioned(),
"Ended up with positioned dropdown list somehow.");
NS_ASSERTION(!listFrame->IsFloating(),
"Ended up with floating dropdown list somehow.");
@ -3141,7 +3141,7 @@ nsCSSFrameConstructor::ConstructFieldSetFrame(nsFrameConstructorState& aState,
nsFrameConstructorSaveState absoluteSaveState;
nsFrameItems childItems;
if (aStyleDisplay->IsPositioned()) {
if (newFrame->IsPositioned()) {
aState.PushAbsoluteContainingBlock(newFrame, absoluteSaveState);
}
@ -3361,7 +3361,7 @@ nsCSSFrameConstructor::FindHTMLData(Element* aElement,
!aElement->GetParent() ||
!aElement->GetParent()->IsHTML(nsGkAtoms::fieldset) ||
aStyleContext->GetStyleDisplay()->IsFloatingStyle() ||
aStyleContext->GetStyleDisplay()->IsAbsolutelyPositioned())) {
aStyleContext->GetStyleDisplay()->IsAbsolutelyPositionedStyle())) {
// <legend> is only special inside fieldset, check both the frame tree
// parent and content tree parent due to XBL issues. For floated or
// absolutely positioned legends we want to construct by display type and
@ -3683,7 +3683,7 @@ nsCSSFrameConstructor::ConstructFrameFromItemInternal(FrameConstructionItem& aIt
// absolute container. It should be the latter if it's
// positioned, otherwise the former.
const nsStyleDisplay* blockDisplay = blockContext->GetStyleDisplay();
if (blockDisplay->IsPositioned()) {
if (blockDisplay->IsPositioned(blockFrame)) {
maybeAbsoluteContainingBlockDisplay = blockDisplay;
maybeAbsoluteContainingBlock = blockFrame;
}
@ -3718,7 +3718,8 @@ nsCSSFrameConstructor::ConstructFrameFromItemInternal(FrameConstructionItem& aIt
if (bits & FCDATA_FORCE_NULL_ABSPOS_CONTAINER) {
aState.PushAbsoluteContainingBlock(nullptr, absoluteSaveState);
} else if (!(bits & FCDATA_SKIP_ABSPOS_PUSH) &&
maybeAbsoluteContainingBlockDisplay->IsPositioned()) {
maybeAbsoluteContainingBlockDisplay->IsPositioned
(maybeAbsoluteContainingBlock)) {
aState.PushAbsoluteContainingBlock(maybeAbsoluteContainingBlock,
absoluteSaveState);
}
@ -4319,7 +4320,7 @@ nsCSSFrameConstructor::FindDisplayData(const nsStyleDisplay* aDisplay,
// The style system ensures that floated and positioned frames are
// block-level.
NS_ASSERTION(!(aDisplay->IsFloatingStyle() ||
aDisplay->IsAbsolutelyPositioned()) ||
aDisplay->IsAbsolutelyPositionedStyle()) ||
aDisplay->IsBlockOutside(),
"Style system did not apply CSS2.1 section 9.7 fixups");
@ -4459,7 +4460,8 @@ nsCSSFrameConstructor::ConstructScrollableBlock(nsFrameConstructorState& aState,
nsresult rv = ConstructBlock(aState,
scrolledContentStyle->GetStyleDisplay(), content,
*aNewFrame, *aNewFrame, scrolledContentStyle,
&scrolledFrame, blockItem, aDisplay->IsPositioned(),
&scrolledFrame, blockItem,
aDisplay->IsPositioned(scrolledFrame),
aItem.mPendingBinding);
if (NS_UNLIKELY(NS_FAILED(rv))) {
// XXXbz any cleanup needed here?
@ -4491,7 +4493,7 @@ nsCSSFrameConstructor::ConstructNonScrollableBlock(nsFrameConstructorState& aSta
// we can check it later in nsFrame::ApplyPaginatedOverflowClipping.
bool clipPaginatedOverflow =
(aItem.mFCData->mBits & FCDATA_FORCED_NON_SCROLLABLE_BLOCK) != 0;
if ((aDisplay->IsAbsolutelyPositioned() ||
if ((aDisplay->IsAbsolutelyPositionedStyle() ||
aDisplay->IsFloatingStyle() ||
NS_STYLE_DISPLAY_INLINE_BLOCK == aDisplay->mDisplay ||
clipPaginatedOverflow) &&
@ -4507,7 +4509,7 @@ nsCSSFrameConstructor::ConstructNonScrollableBlock(nsFrameConstructorState& aSta
return ConstructBlock(aState, aDisplay, aItem.mContent,
aState.GetGeometricParent(aDisplay, aParentFrame),
aParentFrame, styleContext, aNewFrame,
aFrameItems, aDisplay->IsPositioned(),
aFrameItems, aDisplay->IsPositioned(*aNewFrame),
aItem.mPendingBinding);
}
@ -5299,8 +5301,9 @@ nsCSSFrameConstructor::AddFrameConstructionItemsInternal(nsFrameConstructorState
bool canHavePageBreak =
(aFlags & ITEM_ALLOW_PAGE_BREAK) &&
aState.mPresContext->IsPaginated() &&
!display->IsAbsolutelyPositioned() &&
!(bits & FCDATA_IS_TABLE_PART);
!display->IsAbsolutelyPositionedStyle() &&
!(bits & FCDATA_IS_TABLE_PART) &&
!(bits & FCDATA_IS_SVG_TEXT);
if (canHavePageBreak && display->mBreakBefore) {
AddPageBreakItem(aContent, aStyleContext, aItems);
@ -5382,8 +5385,9 @@ nsCSSFrameConstructor::AddFrameConstructionItemsInternal(nsFrameConstructorState
// out-of-flow, we can't use it here. But we _can_ say that the frame will
// for sure end up in-flow if it's not floated or absolutely positioned.
item->mIsBlock = !isInline &&
!display->IsAbsolutelyPositioned() &&
!display->IsFloatingStyle();
!display->IsAbsolutelyPositionedStyle() &&
!display->IsFloatingStyle() &&
!(bits & FCDATA_IS_SVG_TEXT);
}
if (item->mIsAllInline) {
@ -5602,8 +5606,7 @@ nsCSSFrameConstructor::GetAbsoluteContainingBlock(nsIFrame* aFrame)
// Scrollframes are special since they're not positioned, but their
// scrolledframe might be. So, we need to check this special case to return
// the correct containing block (the scrolledframe) in that case.
const nsStyleDisplay* disp = frame->GetStyleDisplay();
if (!disp->IsPositioned()) {
if (!frame->IsPositioned()) {
continue;
}
nsIFrame* absPosCBCandidate = nullptr;
@ -5810,8 +5813,9 @@ nsCSSFrameConstructor::AppendFramesToParent(nsFrameConstructorState& aStat
if (!aFrameList.IsEmpty()) {
const nsStyleDisplay* parentDisplay = aParentFrame->GetStyleDisplay();
bool positioned =
parentDisplay->mPosition == NS_STYLE_POSITION_RELATIVE ||
parentDisplay->HasTransform();
(parentDisplay->mPosition == NS_STYLE_POSITION_RELATIVE ||
parentDisplay->HasTransform()) &&
!aParentFrame->IsSVGText();
nsFrameItems ibSiblings;
CreateIBSiblings(aState, aParentFrame, positioned, aFrameList,
ibSiblings);
@ -11028,7 +11032,8 @@ nsCSSFrameConstructor::ConstructInline(nsFrameConstructorState& aState,
bool positioned =
NS_STYLE_DISPLAY_INLINE == aDisplay->mDisplay &&
(NS_STYLE_POSITION_RELATIVE == aDisplay->mPosition ||
aDisplay->HasTransform());
aDisplay->HasTransform()) &&
!aParentFrame->IsSVGText();
nsIFrame* newFrame = NS_NewInlineFrame(mPresShell, styleContext);
if (!newFrame) {

View File

@ -1888,7 +1888,7 @@ nsLayoutUtils::PaintFrame(nsRenderingContext* aRenderingContext, nsIFrame* aFram
PRInt32
nsLayoutUtils::GetZIndex(nsIFrame* aFrame) {
if (!aFrame->GetStyleDisplay()->IsPositioned())
if (!aFrame->IsPositioned())
return 0;
const nsStylePosition* position =
@ -3445,7 +3445,7 @@ nsLayoutUtils::GetClosestLayer(nsIFrame* aFrame)
{
nsIFrame* layer;
for (layer = aFrame; layer; layer = layer->GetParent()) {
if (layer->GetStyleDisplay()->IsPositioned() ||
if (layer->IsPositioned() ||
(layer->GetParent() &&
layer->GetParent()->GetType() == nsGkAtoms::scrollFrame))
break;

View File

@ -17,7 +17,7 @@ NS_NewLegendFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
{
#ifdef DEBUG
const nsStyleDisplay* disp = aContext->GetStyleDisplay();
NS_ASSERTION(!disp->IsAbsolutelyPositioned() && !disp->IsFloatingStyle(),
NS_ASSERTION(!disp->IsAbsolutelyPositionedStyle() && !disp->IsFloatingStyle(),
"Legends should not be positioned and should not float");
#endif

View File

@ -4955,7 +4955,7 @@ nsBlockFrame::AddFrames(nsFrameList& aFrameList, nsIFrame* aPrevSibling)
NS_ASSERTION(!aPrevSibling || aPrevSibling->GetNextSibling() == newFrame,
"Unexpected aPrevSibling");
NS_ASSERTION(newFrame->GetType() != nsGkAtoms::placeholderFrame ||
(!newFrame->GetStyleDisplay()->IsAbsolutelyPositioned() &&
(!newFrame->IsAbsolutelyPositioned() &&
!newFrame->IsFloating()),
"Placeholders should not float or be positioned");
@ -5132,8 +5132,7 @@ nsBlockFrame::DoRemoveOutOfFlowFrame(nsIFrame* aFrame)
nsBlockFrame* block = (nsBlockFrame*)aFrame->GetParent();
// Remove aFrame from the appropriate list.
const nsStyleDisplay* display = aFrame->GetStyleDisplay();
if (display->IsAbsolutelyPositioned()) {
if (aFrame->IsAbsolutelyPositioned()) {
// This also deletes the next-in-flows
block->GetAbsoluteContainingBlock()->RemoveFrame(block,
kAbsoluteList,
@ -6479,7 +6478,7 @@ nsBlockFrame::ChildIsDirty(nsIFrame* aChild)
{
// See if the child is absolutely positioned
if (aChild->GetStateBits() & NS_FRAME_OUT_OF_FLOW &&
aChild->GetStyleDisplay()->IsAbsolutelyPositioned()) {
aChild->IsAbsolutelyPositioned()) {
// do nothing
} else if (aChild == GetOutsideBullet()) {
// The bullet lives in the first line, unless the first line has

View File

@ -774,7 +774,7 @@ nsContainerFrame::SyncFrameViewProperties(nsPresContext* aPresContext,
// See if the frame is being relatively positioned or absolutely
// positioned
bool isPositioned = aStyleContext->GetStyleDisplay()->IsPositioned();
bool isPositioned = aFrame->IsPositioned();
PRInt32 zIndex = 0;
bool autoZIndex = false;

View File

@ -515,7 +515,7 @@ protected:
#define IS_TRUE_OVERFLOW_CONTAINER(frame) \
( (frame->GetStateBits() & NS_FRAME_IS_OVERFLOW_CONTAINER) \
&& !( (frame->GetStateBits() & NS_FRAME_OUT_OF_FLOW) && \
frame->GetStyleDisplay()->IsAbsolutelyPositioned() ) )
frame->IsAbsolutelyPositioned() ) )
//XXXfr This check isn't quite correct, because it doesn't handle cases
// where the out-of-flow has overflow.. but that's rare.
// We'll need to revisit the way abspos continuations are handled later

View File

@ -522,7 +522,7 @@ nsFrame::Init(nsIContent* aContent,
AddStateBits(NS_FRAME_FONT_INFLATION_CONTAINER);
if (!GetParent() ||
// I'd use NS_FRAME_OUT_OF_FLOW, but it's not set yet.
disp->IsFloating(this) || disp->IsAbsolutelyPositioned()) {
disp->IsFloating(this) || disp->IsAbsolutelyPositioned(this)) {
AddStateBits(NS_FRAME_FONT_INFLATION_FLOW_ROOT);
}
}
@ -1496,7 +1496,7 @@ nsIFrame::GetClipPropClipRect(const nsStyleDisplay* aDisp, nsRect* aRect,
NS_PRECONDITION(aRect, "Must have aRect out parameter");
if (!(aDisp->mClipFlags & NS_STYLE_CLIP_RECT) ||
!(aDisp->IsAbsolutelyPositioned() || IsSVGContentWithCSSClip(this))) {
!(aDisp->IsAbsolutelyPositioned(this) || IsSVGContentWithCSSClip(this))) {
return false;
}
@ -2104,7 +2104,7 @@ nsIFrame::BuildDisplayListForChild(nsDisplayListBuilder* aBuilder,
|| child->IsTransformed()
|| nsSVGIntegrationUtils::UsingEffectsForFrame(child);
bool isPositioned = !isSVG && disp->IsPositioned();
bool isPositioned = !isSVG && disp->IsPositioned(child);
if (isVisuallyAtomic || isPositioned || (!isSVG && disp->IsFloating(child)) ||
((disp->mClipFlags & NS_STYLE_CLIP_RECT) &&
IsSVGContentWithCSSClip(child)) ||
@ -5018,7 +5018,8 @@ ComputeOutlineAndEffectsRect(nsIFrame* aFrame, bool* aAnyOutlineOrEffects,
nsPoint
nsIFrame::GetRelativeOffset(const nsStyleDisplay* aDisplay) const
{
if (!aDisplay || NS_STYLE_POSITION_RELATIVE == aDisplay->mPosition) {
if (!aDisplay ||
aDisplay->IsRelativelyPositioned(this)) {
nsPoint *offsets = static_cast<nsPoint*>
(Properties().Get(ComputedOffsetProperty()));
if (offsets) {
@ -5294,7 +5295,7 @@ nsIFrame::GetContainingBlock() const
// MathML frames might have absolute positioning style, but they would
// still be in-flow. So we have to check to make sure that the frame
// is really out-of-flow too.
if (GetStyleDisplay()->IsAbsolutelyPositioned() &&
if (IsAbsolutelyPositioned() &&
(GetStateBits() & NS_FRAME_OUT_OF_FLOW)) {
return GetParent(); // the parent is always the containing block
}
@ -9363,7 +9364,7 @@ nsHTMLReflowState::DisplayInitFrameTypeExit(nsIFrame* aFrame,
printf(" out-of-flow");
if (aFrame->GetPrevInFlow())
printf(" prev-in-flow");
if (disp->IsAbsolutelyPositioned())
if (aFrame->IsAbsolutelyPositioned())
printf(" abspos");
if (aFrame->IsFloating())
printf(" float");

View File

@ -1516,7 +1516,7 @@ NS_NewHTMLFramesetFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
{
#ifdef DEBUG
const nsStyleDisplay* disp = aContext->GetStyleDisplay();
NS_ASSERTION(!disp->IsAbsolutelyPositioned() && !disp->IsFloatingStyle(),
NS_ASSERTION(!disp->IsAbsolutelyPositionedStyle() && !disp->IsFloatingStyle(),
"Framesets should not be positioned and should not float");
#endif

View File

@ -2116,7 +2116,7 @@ nsGfxScrollFrameInner::AppendScrollPartsTo(nsDisplayListBuilder* aBuilder,
{
for (nsIFrame* kid = mOuter->GetFirstPrincipalChild(); kid; kid = kid->GetNextSibling()) {
if (kid == mScrolledFrame ||
(kid->GetStyleDisplay()->IsPositioned() != aPositioned))
(kid->IsPositioned() != aPositioned))
continue;
nsDisplayListCollection partList;

View File

@ -395,7 +395,7 @@ IsQuirkContainingBlockHeight(const nsHTMLReflowState* rs, nsIAtom* aFrameType)
// Note: This next condition could change due to a style change,
// but that would cause a style reflow anyway, which means we're ok.
if (NS_AUTOHEIGHT == rs->ComputedHeight()) {
if (!rs->frame->GetStyleDisplay()->IsAbsolutelyPositioned()) {
if (!rs->frame->IsAbsolutelyPositioned()) {
return false;
}
}
@ -641,13 +641,13 @@ nsHTMLReflowState::InitFrameType(nsIAtom* aFrameType)
return;
}
NS_ASSERTION(frame->GetStyleDisplay()->IsAbsolutelyPositioned() ==
disp->IsAbsolutelyPositioned(),
NS_ASSERTION(frame->GetStyleDisplay()->IsAbsolutelyPositionedStyle() ==
disp->IsAbsolutelyPositionedStyle(),
"Unexpected position style");
NS_ASSERTION(frame->GetStyleDisplay()->IsFloatingStyle() ==
disp->IsFloatingStyle(), "Unexpected float style");
if (frame->GetStateBits() & NS_FRAME_OUT_OF_FLOW) {
if (disp->IsAbsolutelyPositioned()) {
if (disp->IsAbsolutelyPositioned(frame)) {
frameType = NS_CSS_FRAME_TYPE_ABSOLUTE;
//XXXfr hack for making frames behave properly when in overflow container lists
// see bug 154892; need to revisit later
@ -1608,7 +1608,7 @@ CalcQuirkContainingBlockHeight(const nsHTMLReflowState* aCBReflowState)
// not auto-height, use this as the percentage base. 2) If auto-height,
// keep looking, unless the frame is positioned.
if (NS_AUTOHEIGHT == rs->ComputedHeight()) {
if (rs->frame->GetStyleDisplay()->IsAbsolutelyPositioned()) {
if (rs->frame->IsAbsolutelyPositioned()) {
break;
} else {
continue;
@ -1694,7 +1694,7 @@ nsHTMLReflowState::ComputeContainingBlockRectangle(nsPresContext* aPres
// special case them here.
if (NS_FRAME_GET_TYPE(mFrameType) == NS_CSS_FRAME_TYPE_ABSOLUTE ||
(frame->GetType() == nsGkAtoms::tableFrame &&
frame->GetStyleDisplay()->IsAbsolutelyPositioned() &&
frame->IsAbsolutelyPositioned() &&
(frame->GetParent()->GetStateBits() & NS_FRAME_OUT_OF_FLOW))) {
// See if the ancestor is block-level or inline-level
if (NS_FRAME_GET_TYPE(aContainingBlockRS->mFrameType) == NS_CSS_FRAME_TYPE_INLINE) {
@ -1897,7 +1897,7 @@ nsHTMLReflowState::InitConstraints(nsPresContext* aPresContext,
// Compute our offsets if the element is relatively positioned. We need
// the correct containing block width and height here, which is why we need
// to do it after all the quirks-n-such above.
if (NS_STYLE_POSITION_RELATIVE == mStyleDisplay->mPosition) {
if (mStyleDisplay->IsRelativelyPositioned(frame)) {
PRUint8 direction = NS_STYLE_DIRECTION_LTR;
if (cbrs && NS_STYLE_DIRECTION_RTL == cbrs->mStyleVisibility->mDirection) {
direction = NS_STYLE_DIRECTION_RTL;

View File

@ -2504,7 +2504,7 @@ public:
bool IsPseudoStackingContextFromStyle() {
const nsStyleDisplay* disp = GetStyleDisplay();
return disp->mOpacity != 1.0f ||
disp->IsPositioned() ||
disp->IsPositioned(this) ||
disp->IsFloating(this);
}
@ -2841,6 +2841,9 @@ NS_PTR_TO_INT32(frame->Properties().Get(nsIFrame::ParagraphDepthProperty()))
bool IsVisibleConsideringAncestors(PRUint32 aFlags = 0) const;
inline bool IsFloating() const;
inline bool IsPositioned() const;
inline bool IsRelativelyPositioned() const;
inline bool IsAbsolutelyPositioned() const;
/**
* Returns the vertical-align value to be used for layout, if it is one
@ -3173,4 +3176,22 @@ nsIFrame::IsFloating() const
return GetStyleDisplay()->IsFloating(this);
}
bool
nsIFrame::IsPositioned() const
{
return GetStyleDisplay()->IsPositioned(this);
}
bool
nsIFrame::IsRelativelyPositioned() const
{
return GetStyleDisplay()->IsRelativelyPositioned(this);
}
bool
nsIFrame::IsAbsolutelyPositioned() const
{
return GetStyleDisplay()->IsAbsolutelyPositioned(this);
}
#endif /* nsIFrame_h___ */

View File

@ -4619,8 +4619,7 @@ nsTextFrame::GetTextDecorations(nsPresContext* aPresContext,
} else {
// In standards/almost-standards mode, if we're on an
// absolutely-positioned element or a floating element, we're done.
if (f->IsFloating() ||
(disp->IsAbsolutelyPositioned() && !f->IsSVGText())) {
if (f->IsFloating() || f->IsAbsolutelyPositioned()) {
break;
}
}

View File

@ -4853,7 +4853,7 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct,
canStoreInRuleTree = false;
}
if (display->IsAbsolutelyPositioned()) {
if (display->IsAbsolutelyPositionedStyle()) {
// 1) if position is 'absolute' or 'fixed' then display must be
// block-level and float must be 'none'
EnsureBlockDisplay(display->mDisplay);

View File

@ -1642,13 +1642,20 @@ struct nsStyleDisplay {
return NS_STYLE_FLOAT_NONE != mFloats;
}
bool IsAbsolutelyPositioned() const {return (NS_STYLE_POSITION_ABSOLUTE == mPosition) ||
(NS_STYLE_POSITION_FIXED == mPosition);}
bool IsAbsolutelyPositionedStyle() const {
return NS_STYLE_POSITION_ABSOLUTE == mPosition ||
NS_STYLE_POSITION_FIXED == mPosition;
}
/* Returns true if we're positioned or there's a transform in effect. */
bool IsPositioned() const {
return IsAbsolutelyPositioned() ||
NS_STYLE_POSITION_RELATIVE == mPosition || HasTransform();
bool IsPositionedStyle() const {
return IsAbsolutelyPositionedStyle() ||
IsRelativelyPositionedStyle() ||
HasTransform();
}
bool IsRelativelyPositionedStyle() const {
return mPosition == NS_STYLE_POSITION_RELATIVE;
}
bool IsScrollableOverflow() const {
@ -1667,6 +1674,9 @@ struct nsStyleDisplay {
// These are defined in nsStyleStructInlines.h.
inline bool IsFloating(const nsIFrame* aFrame) const;
inline bool IsPositioned(const nsIFrame* aFrame) const;
inline bool IsRelativelyPositioned(const nsIFrame* aFrame) const;
inline bool IsAbsolutelyPositioned(const nsIFrame* aFrame) const;
};
struct nsStyleTable {

View File

@ -61,4 +61,22 @@ nsStyleDisplay::IsFloating(const nsIFrame* aFrame) const
return IsFloatingStyle() && !aFrame->IsSVGText();
}
bool
nsStyleDisplay::IsPositioned(const nsIFrame* aFrame) const
{
return IsPositionedStyle() && !aFrame->IsSVGText();
}
bool
nsStyleDisplay::IsRelativelyPositioned(const nsIFrame* aFrame) const
{
return IsRelativelyPositionedStyle() && !aFrame->IsSVGText();
}
bool
nsStyleDisplay::IsAbsolutelyPositioned(const nsIFrame* aFrame) const
{
return IsAbsolutelyPositionedStyle() && !aFrame->IsSVGText();
}
#endif /* !defined(nsStyleStructInlines_h_) */