зеркало из https://github.com/mozilla/gecko-dev.git
Bug 10209 - Part 1: Add an API for absolute container support for all frame types; r=roc
This commit is contained in:
Родитель
e19f154571
Коммит
d883e58253
|
@ -1022,6 +1022,8 @@ nsFrameConstructorState::PushAbsoluteContainingBlock(nsIFrame* aNewAbsoluteConta
|
|||
*/
|
||||
mFixedPosIsAbsPos = (aNewAbsoluteContainingBlock &&
|
||||
aNewAbsoluteContainingBlock->GetStyleDisplay()->HasTransform());
|
||||
|
||||
aNewAbsoluteContainingBlock->MarkAsAbsoluteContainingBlock();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -128,6 +128,7 @@
|
|||
|
||||
#include "gfxContext.h"
|
||||
#include "CSSCalc.h"
|
||||
#include "nsAbsoluteContainingBlock.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::layers;
|
||||
|
@ -258,6 +259,34 @@ nsFrame::RootFrameList(nsPresContext* aPresContext, FILE* out, PRInt32 aIndent)
|
|||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
DestroyAbsoluteContainingBlock(void* aPropertyValue)
|
||||
{
|
||||
delete static_cast<nsAbsoluteContainingBlock*>(aPropertyValue);
|
||||
}
|
||||
|
||||
NS_DECLARE_FRAME_PROPERTY(AbsoluteContainingBlockProperty, DestroyAbsoluteContainingBlock)
|
||||
|
||||
PRBool
|
||||
nsIFrame::HasAbsolutelyPositionedChildren() const {
|
||||
return IsAbsoluteContainer() && GetAbsoluteContainingBlock()->HasAbsoluteFrames();
|
||||
}
|
||||
|
||||
nsAbsoluteContainingBlock*
|
||||
nsIFrame::GetAbsoluteContainingBlock() const {
|
||||
NS_ASSERTION(IsAbsoluteContainer(), "The frame is not marked as an abspos container correctly");
|
||||
nsAbsoluteContainingBlock* absCB = static_cast<nsAbsoluteContainingBlock*>
|
||||
(Properties().Get(AbsoluteContainingBlockProperty()));
|
||||
NS_ASSERTION(absCB, "The frame is marked as an abspos container but doesn't have the property");
|
||||
return absCB;
|
||||
}
|
||||
|
||||
void
|
||||
nsIFrame::MarkAsAbsoluteContainingBlock() {
|
||||
AddStateBits(NS_FRAME_HAS_ABSPOS_CHILDREN);
|
||||
Properties().Set(AbsoluteContainingBlockProperty(), new nsAbsoluteContainingBlock(GetAbsoluteListName()));
|
||||
}
|
||||
|
||||
void
|
||||
NS_MergeReflowStatusInto(nsReflowStatus* aPrimary, nsReflowStatus aSecondary)
|
||||
{
|
||||
|
|
|
@ -103,6 +103,7 @@ class gfxSkipChars;
|
|||
class gfxSkipCharsIterator;
|
||||
class gfxContext;
|
||||
class nsLineList_iterator;
|
||||
class nsAbsoluteContainingBlock;
|
||||
|
||||
struct nsPeekOffsetStruct;
|
||||
struct nsPoint;
|
||||
|
@ -285,6 +286,9 @@ typedef PRUint64 nsFrameState;
|
|||
// bit; we could free up this bit with a little extra complexity.
|
||||
#define NS_FRAME_UPDATE_LAYER_TREE NS_FRAME_STATE_BIT(36)
|
||||
|
||||
// Frame can accept absolutely positioned children.
|
||||
#define NS_FRAME_HAS_ABSPOS_CHILDREN NS_FRAME_STATE_BIT(37)
|
||||
|
||||
// The lower 20 bits and upper 32 bits of the frame state are reserved
|
||||
// by this API.
|
||||
#define NS_FRAME_RESERVED ~NS_FRAME_IMPL_RESERVED
|
||||
|
@ -2699,7 +2703,17 @@ NS_PTR_TO_INT32(frame->Properties().Get(nsIFrame::EmbeddingLevelProperty()))
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Accessors for the absolute containing block.
|
||||
*/
|
||||
PRBool IsAbsoluteContainer() const { return !!(mState & NS_FRAME_HAS_ABSPOS_CHILDREN); }
|
||||
PRBool HasAbsolutelyPositionedChildren() const;
|
||||
nsAbsoluteContainingBlock* GetAbsoluteContainingBlock() const;
|
||||
virtual void MarkAsAbsoluteContainingBlock();
|
||||
// Child frame types override this function to select their own child list name
|
||||
virtual nsIAtom* GetAbsoluteListName() const { return nsGkAtoms::absoluteList; }
|
||||
|
||||
protected:
|
||||
// Members
|
||||
nsRect mRect;
|
||||
|
|
|
@ -118,6 +118,9 @@ public:
|
|||
NS_IMETHOD GetFrameName(nsAString& aResult) const;
|
||||
#endif
|
||||
|
||||
private:
|
||||
virtual nsIAtom* GetAbsoluteListName() const { return nsGkAtoms::fixedList; }
|
||||
|
||||
protected:
|
||||
nsPoint AdjustReflowStateForScrollbars(nsHTMLReflowState* aReflowState) const;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче