зеркало из https://github.com/mozilla/pjs.git
Bug 380094 - make mousethrough more generally usefulp=toshok@hungry.comr+sr=roc
This commit is contained in:
Родитель
8dc6a9db6f
Коммит
eb97ba7e7c
|
@ -3348,6 +3348,35 @@ nsFrame::AttributeChanged(PRInt32 aNameSpaceID,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
PRBool nsFrame::GetMouseThrough() const
|
||||
{
|
||||
eMouseThrough mousethrough = unset;
|
||||
|
||||
if (mContent) {
|
||||
static nsIContent::AttrValuesArray strings[] =
|
||||
{&nsGkAtoms::never, &nsGkAtoms::always, nsnull};
|
||||
static const eMouseThrough values[] = {never, always};
|
||||
PRInt32 index = mContent->FindAttrValueIn(kNameSpaceID_None,
|
||||
nsGkAtoms::mousethrough, strings, eCaseMatters);
|
||||
if (index >= 0) {
|
||||
mousethrough = values[index];
|
||||
}
|
||||
}
|
||||
|
||||
switch(mousethrough)
|
||||
{
|
||||
case always:
|
||||
return PR_TRUE;
|
||||
case never:
|
||||
return PR_FALSE;
|
||||
case unset:
|
||||
if (mParent)
|
||||
return mParent->GetMouseThrough();
|
||||
}
|
||||
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
// Flow member functions
|
||||
|
||||
nsSplittableType
|
||||
|
|
|
@ -206,6 +206,8 @@ public:
|
|||
PRInt8 aOutSideLimit
|
||||
);
|
||||
|
||||
PRBool GetMouseThrough() const;
|
||||
|
||||
/**
|
||||
* Find the nearest frame with a mouse capturer. If no
|
||||
* parent has mouse capture this will return null.
|
||||
|
|
|
@ -136,8 +136,7 @@ nsBoxFrame::nsBoxFrame(nsIPresShell* aPresShell,
|
|||
nsStyleContext* aContext,
|
||||
PRBool aIsRoot,
|
||||
nsIBoxLayout* aLayoutManager) :
|
||||
nsContainerFrame(aContext),
|
||||
mMouseThrough(unset)
|
||||
nsContainerFrame(aContext)
|
||||
{
|
||||
mState |= NS_FRAME_IS_BOX;
|
||||
mState |= NS_STATE_IS_HORIZONTAL;
|
||||
|
@ -222,47 +221,12 @@ nsBoxFrame::Init(nsIContent* aContent,
|
|||
GetDebugPref(GetPresContext());
|
||||
#endif
|
||||
|
||||
mMouseThrough = unset;
|
||||
|
||||
UpdateMouseThrough();
|
||||
|
||||
// register access key
|
||||
rv = RegUnregAccessKey(PR_TRUE);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
void nsBoxFrame::UpdateMouseThrough()
|
||||
{
|
||||
if (mContent) {
|
||||
static nsIContent::AttrValuesArray strings[] =
|
||||
{&nsGkAtoms::never, &nsGkAtoms::always, nsnull};
|
||||
static const eMouseThrough values[] = {never, always};
|
||||
PRInt32 index = mContent->FindAttrValueIn(kNameSpaceID_None,
|
||||
nsGkAtoms::mousethrough, strings, eCaseMatters);
|
||||
if (index >= 0) {
|
||||
mMouseThrough = values[index];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsBoxFrame::GetMouseThrough() const
|
||||
{
|
||||
switch(mMouseThrough)
|
||||
{
|
||||
case always:
|
||||
return PR_TRUE;
|
||||
case never:
|
||||
return PR_FALSE;
|
||||
case unset:
|
||||
if (mParent && mParent->IsBoxFrame())
|
||||
return mParent->GetMouseThrough();
|
||||
}
|
||||
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
nsBoxFrame::CacheAttributes()
|
||||
{
|
||||
|
@ -1141,7 +1105,6 @@ nsBoxFrame::AttributeChanged(PRInt32 aNameSpaceID,
|
|||
aAttribute == nsGkAtoms::orient ||
|
||||
aAttribute == nsGkAtoms::pack ||
|
||||
aAttribute == nsGkAtoms::dir ||
|
||||
aAttribute == nsGkAtoms::mousethrough ||
|
||||
aAttribute == nsGkAtoms::equalsize) {
|
||||
|
||||
if (aAttribute == nsGkAtoms::align ||
|
||||
|
@ -1206,9 +1169,6 @@ nsBoxFrame::AttributeChanged(PRInt32 aNameSpaceID,
|
|||
aAttribute == nsGkAtoms::top) {
|
||||
mState &= ~NS_STATE_STACK_NOT_POSITIONED;
|
||||
}
|
||||
else if (aAttribute == nsGkAtoms::mousethrough) {
|
||||
UpdateMouseThrough();
|
||||
}
|
||||
|
||||
PresContext()->PresShell()->
|
||||
FrameNeedsReflow(this, nsIPresShell::eStyleChange, NS_FRAME_IS_DIRTY);
|
||||
|
|
|
@ -112,7 +112,6 @@ public:
|
|||
virtual Halignment GetHAlign() const { return mHalign; }
|
||||
NS_IMETHOD DoLayout(nsBoxLayoutState& aBoxLayoutState);
|
||||
|
||||
virtual PRBool GetMouseThrough() const;
|
||||
virtual PRBool ComputesOwnOverflowArea() { return PR_FALSE; }
|
||||
|
||||
// ----- child and sibling operations ---
|
||||
|
@ -282,7 +281,6 @@ private:
|
|||
void DrawLine(nsIRenderingContext& aRenderingContext, PRBool aHorizontal, nscoord x1, nscoord y1, nscoord x2, nscoord y2);
|
||||
void FillRect(nsIRenderingContext& aRenderingContext, PRBool aHorizontal, nscoord x, nscoord y, nscoord width, nscoord height);
|
||||
#endif
|
||||
void UpdateMouseThrough();
|
||||
|
||||
void CacheAttributes();
|
||||
|
||||
|
@ -292,8 +290,6 @@ private:
|
|||
Halignment mHalign;
|
||||
Valignment mValign;
|
||||
|
||||
eMouseThrough mMouseThrough;
|
||||
|
||||
#ifdef DEBUG_LAYOUT
|
||||
static PRBool gDebug;
|
||||
static nsIBox* mDebugChild;
|
||||
|
|
|
@ -73,7 +73,7 @@ NS_NewLeafBoxFrame (nsIPresShell* aPresShell, nsStyleContext* aContext)
|
|||
} // NS_NewLeafBoxFrame
|
||||
|
||||
nsLeafBoxFrame::nsLeafBoxFrame(nsIPresShell* aShell, nsStyleContext* aContext)
|
||||
: nsLeafFrame(aContext), mMouseThrough(unset)
|
||||
: nsLeafFrame(aContext)
|
||||
{
|
||||
mState |= NS_FRAME_IS_BOX;
|
||||
}
|
||||
|
@ -109,58 +109,9 @@ nsLeafBoxFrame::Init(
|
|||
}
|
||||
}
|
||||
|
||||
mMouseThrough = unset;
|
||||
|
||||
UpdateMouseThrough();
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLeafBoxFrame::AttributeChanged(PRInt32 aNameSpaceID,
|
||||
nsIAtom* aAttribute,
|
||||
PRInt32 aModType)
|
||||
{
|
||||
nsresult rv = nsLeafFrame::AttributeChanged(aNameSpaceID, aAttribute,
|
||||
aModType);
|
||||
|
||||
if (aAttribute == nsGkAtoms::mousethrough)
|
||||
UpdateMouseThrough();
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
void nsLeafBoxFrame::UpdateMouseThrough()
|
||||
{
|
||||
if (mContent) {
|
||||
static nsIContent::AttrValuesArray strings[] =
|
||||
{&nsGkAtoms::never, &nsGkAtoms::always, nsnull};
|
||||
switch (mContent->FindAttrValueIn(kNameSpaceID_None,
|
||||
nsGkAtoms::mousethrough,
|
||||
strings, eCaseMatters)) {
|
||||
case 0: mMouseThrough = never; break;
|
||||
case 1: mMouseThrough = always; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsLeafBoxFrame::GetMouseThrough() const
|
||||
{
|
||||
switch (mMouseThrough)
|
||||
{
|
||||
case always:
|
||||
return PR_TRUE;
|
||||
case never:
|
||||
return PR_FALSE;
|
||||
case unset:
|
||||
if (mParent && mParent->IsBoxFrame())
|
||||
return mParent->GetMouseThrough();
|
||||
}
|
||||
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLeafBoxFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||
const nsRect& aDirtyRect,
|
||||
|
|
|
@ -94,11 +94,6 @@ public:
|
|||
const nsRect& aDirtyRect,
|
||||
const nsDisplayListSet& aLists);
|
||||
|
||||
NS_IMETHOD AttributeChanged(PRInt32 aNameSpaceID,
|
||||
nsIAtom* aAttribute,
|
||||
PRInt32 aModType);
|
||||
|
||||
virtual PRBool GetMouseThrough() const;
|
||||
virtual PRBool ComputesOwnOverflowArea() { return PR_FALSE; }
|
||||
|
||||
protected:
|
||||
|
@ -116,14 +111,6 @@ protected:
|
|||
|
||||
nsLeafBoxFrame(nsIPresShell* aShell, nsStyleContext* aContext);
|
||||
|
||||
protected:
|
||||
eMouseThrough mMouseThrough;
|
||||
|
||||
private:
|
||||
|
||||
void UpdateMouseThrough();
|
||||
|
||||
|
||||
}; // class nsLeafBoxFrame
|
||||
|
||||
#endif /* nsLeafBoxFrame_h___ */
|
||||
|
|
Загрузка…
Ссылка в новой задаче