diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index 4cf5cb5460c..0cef3e36547 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -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 diff --git a/layout/generic/nsFrame.h b/layout/generic/nsFrame.h index 28b7a8bd69b..7404cb0aecb 100644 --- a/layout/generic/nsFrame.h +++ b/layout/generic/nsFrame.h @@ -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. diff --git a/layout/xul/base/src/nsBoxFrame.cpp b/layout/xul/base/src/nsBoxFrame.cpp index 9454879894e..3586082619d 100644 --- a/layout/xul/base/src/nsBoxFrame.cpp +++ b/layout/xul/base/src/nsBoxFrame.cpp @@ -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); diff --git a/layout/xul/base/src/nsBoxFrame.h b/layout/xul/base/src/nsBoxFrame.h index 245dc93d30b..5f0a73bb1f7 100644 --- a/layout/xul/base/src/nsBoxFrame.h +++ b/layout/xul/base/src/nsBoxFrame.h @@ -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; diff --git a/layout/xul/base/src/nsLeafBoxFrame.cpp b/layout/xul/base/src/nsLeafBoxFrame.cpp index 322c76b28a0..4e5c704bc9c 100644 --- a/layout/xul/base/src/nsLeafBoxFrame.cpp +++ b/layout/xul/base/src/nsLeafBoxFrame.cpp @@ -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; } @@ -108,59 +108,10 @@ nsLeafBoxFrame::Init( view->CreateWidget(kWidgetCID); } } - - 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, diff --git a/layout/xul/base/src/nsLeafBoxFrame.h b/layout/xul/base/src/nsLeafBoxFrame.h index fef1b9e4b5e..384e0a39599 100644 --- a/layout/xul/base/src/nsLeafBoxFrame.h +++ b/layout/xul/base/src/nsLeafBoxFrame.h @@ -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___ */