Bug 1305957 part 3 - Add IsStickyPositioned() method to nsStyleDisplay. r=emilio

This commit is used in a later commit to exclude frames that are sticky positioned
from being scroll anchors.

Differential Revision: https://phabricator.services.mozilla.com/D13266

--HG--
extra : rebase_source : 50cddce18bbc0164bfff70bf00ab698354ede375
extra : histedit_source : 7cad7389e6958d3107e43e5f915139f6682c168d
This commit is contained in:
Ryan Hunt 2018-11-21 22:35:23 -06:00
Родитель 53ae64fd5e
Коммит 1041d94fae
4 изменённых файлов: 16 добавлений и 0 удалений

Просмотреть файл

@ -3848,6 +3848,7 @@ class nsIFrame : public nsQueryFrame {
inline bool IsAbsPosContainingBlock() const; inline bool IsAbsPosContainingBlock() const;
inline bool IsFixedPosContainingBlock() const; inline bool IsFixedPosContainingBlock() const;
inline bool IsRelativelyPositioned() const; inline bool IsRelativelyPositioned() const;
inline bool IsStickyPositioned() const;
inline bool IsAbsolutelyPositioned( inline bool IsAbsolutelyPositioned(
const nsStyleDisplay* aStyleDisplay = nullptr) const; const nsStyleDisplay* aStyleDisplay = nullptr) const;

Просмотреть файл

@ -47,6 +47,10 @@ bool nsIFrame::IsRelativelyPositioned() const {
return StyleDisplay()->IsRelativelyPositioned(this); return StyleDisplay()->IsRelativelyPositioned(this);
} }
bool nsIFrame::IsStickyPositioned() const {
return StyleDisplay()->IsStickyPositioned(this);
}
bool nsIFrame::IsAbsolutelyPositioned( bool nsIFrame::IsAbsolutelyPositioned(
const nsStyleDisplay* aStyleDisplay) const { const nsStyleDisplay* aStyleDisplay) const {
const nsStyleDisplay* disp = StyleDisplayWithOptionalParam(aStyleDisplay); const nsStyleDisplay* disp = StyleDisplayWithOptionalParam(aStyleDisplay);

Просмотреть файл

@ -2109,6 +2109,9 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleDisplay {
return NS_STYLE_POSITION_RELATIVE == mPosition || return NS_STYLE_POSITION_RELATIVE == mPosition ||
NS_STYLE_POSITION_STICKY == mPosition; NS_STYLE_POSITION_STICKY == mPosition;
} }
bool IsStickyPositionedStyle() const {
return NS_STYLE_POSITION_STICKY == mPosition;
}
bool IsPositionForcingStackingContext() const { bool IsPositionForcingStackingContext() const {
return NS_STYLE_POSITION_STICKY == mPosition || return NS_STYLE_POSITION_STICKY == mPosition ||
NS_STYLE_POSITION_FIXED == mPosition; NS_STYLE_POSITION_FIXED == mPosition;
@ -2230,6 +2233,7 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleDisplay {
inline mozilla::StyleDisplay GetDisplay(const nsIFrame* aContextFrame) const; inline mozilla::StyleDisplay GetDisplay(const nsIFrame* aContextFrame) const;
inline bool IsFloating(const nsIFrame* aContextFrame) const; inline bool IsFloating(const nsIFrame* aContextFrame) const;
inline bool IsRelativelyPositioned(const nsIFrame* aContextFrame) const; inline bool IsRelativelyPositioned(const nsIFrame* aContextFrame) const;
inline bool IsStickyPositioned(const nsIFrame* aContextFrame) const;
inline bool IsAbsolutelyPositioned(const nsIFrame* aContextFrame) const; inline bool IsAbsolutelyPositioned(const nsIFrame* aContextFrame) const;
// These methods are defined in nsStyleStructInlines.h. // These methods are defined in nsStyleStructInlines.h.

Просмотреть файл

@ -211,6 +211,13 @@ bool nsStyleDisplay::IsRelativelyPositioned(
!nsSVGUtils::IsInSVGTextSubtree(aContextFrame); !nsSVGUtils::IsInSVGTextSubtree(aContextFrame);
} }
bool nsStyleDisplay::IsStickyPositioned(const nsIFrame* aContextFrame) const {
NS_ASSERTION(aContextFrame->StyleDisplay() == this,
"unexpected aContextFrame");
return IsStickyPositionedStyle() &&
!nsSVGUtils::IsInSVGTextSubtree(aContextFrame);
}
bool nsStyleDisplay::IsAbsolutelyPositioned( bool nsStyleDisplay::IsAbsolutelyPositioned(
const nsIFrame* aContextFrame) const { const nsIFrame* aContextFrame) const {
NS_ASSERTION(aContextFrame->StyleDisplay() == this, NS_ASSERTION(aContextFrame->StyleDisplay() == this,