зеркало из https://github.com/mozilla/pjs.git
Fixed some visibility bugs in order to make the tab widget work correctly.
This commit is contained in:
Родитель
9f333724f2
Коммит
2b76d2dc93
|
@ -194,15 +194,24 @@ nsFormControlFrame::DidReflow(nsIPresContext& aPresContext,
|
|||
{
|
||||
nsresult rv = nsLeafFrame::DidReflow(aPresContext, aStatus);
|
||||
|
||||
|
||||
// The view is created hidden; once we have reflowed it and it has been
|
||||
// positioned then we show it.
|
||||
if (NS_FRAME_REFLOW_FINISHED == aStatus) {
|
||||
nsIView* view = nsnull;
|
||||
GetView(&view);
|
||||
if (nsnull != view) {
|
||||
view->SetVisibility(nsViewVisibility_kShow);
|
||||
if (view) {
|
||||
const nsStyleDisplay* display;
|
||||
GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)display));
|
||||
nsViewVisibility newVis = NS_STYLE_VISIBILITY_HIDDEN == display->mVisible ? nsViewVisibility_kHide : nsViewVisibility_kShow;
|
||||
nsViewVisibility oldVis;
|
||||
// only change if different.
|
||||
view->GetVisibility(oldVis);
|
||||
if (newVis != oldVis)
|
||||
view->SetVisibility(newVis);
|
||||
}
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
|
@ -177,6 +177,9 @@ public:
|
|||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus);
|
||||
|
||||
NS_IMETHOD DidReflow(nsIPresContext& aPresContext,
|
||||
nsDidReflowStatus aStatus);
|
||||
|
||||
NS_IMETHOD MoveTo(nscoord aX, nscoord aY);
|
||||
NS_IMETHOD SizeTo(nscoord aWidth, nscoord aHeight);
|
||||
|
||||
|
@ -696,6 +699,30 @@ void TempMakeAbsURL(nsIContent* aContent, nsString& aRelURL, nsString& aAbsURL)
|
|||
NS_IF_RELEASE(baseURL);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLFrameInnerFrame::DidReflow(nsIPresContext& aPresContext,
|
||||
nsDidReflowStatus aStatus)
|
||||
{
|
||||
nsresult rv = nsLeafFrame::DidReflow(aPresContext, aStatus);
|
||||
|
||||
|
||||
// The view is created hidden; once we have reflowed it and it has been
|
||||
// positioned then we show it.
|
||||
if (NS_FRAME_REFLOW_FINISHED == aStatus) {
|
||||
nsIView* view = nsnull;
|
||||
GetView(&view);
|
||||
const nsStyleDisplay* display;
|
||||
GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)display));
|
||||
nsViewVisibility newVis = NS_STYLE_VISIBILITY_HIDDEN == display->mVisible ? nsViewVisibility_kHide : nsViewVisibility_kShow;
|
||||
nsViewVisibility oldVis;
|
||||
// only change if different.
|
||||
view->GetVisibility(oldVis);
|
||||
if (newVis != oldVis)
|
||||
view->SetVisibility(newVis);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLFrameInnerFrame::CreateWebShell(nsIPresContext& aPresContext,
|
||||
|
@ -827,6 +854,7 @@ nsHTMLFrameInnerFrame::CreateWebShell(nsIPresContext& aPresContext,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLFrameInnerFrame::Reflow(nsIPresContext& aPresContext,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
|
|
|
@ -363,6 +363,10 @@ nsHTMLContainerFrame::CreateViewForFrame(nsIPresContext& aPresContext,
|
|||
!display->mVisible) {
|
||||
viewManager->SetViewContentTransparency(view, PR_TRUE);
|
||||
}
|
||||
|
||||
// Set the initial visiblity of the view -EDV
|
||||
view->SetVisibility(NS_STYLE_VISIBILITY_HIDDEN == display->mVisible ? nsViewVisibility_kHide : nsViewVisibility_kShow);
|
||||
|
||||
// XXX If it's relatively positioned or absolutely positioned then we
|
||||
// need to mark it as having transparent content, too. See bug #2502
|
||||
const nsStylePosition* position = (const nsStylePosition*)
|
||||
|
|
|
@ -363,6 +363,10 @@ nsHTMLContainerFrame::CreateViewForFrame(nsIPresContext& aPresContext,
|
|||
!display->mVisible) {
|
||||
viewManager->SetViewContentTransparency(view, PR_TRUE);
|
||||
}
|
||||
|
||||
// Set the initial visiblity of the view -EDV
|
||||
view->SetVisibility(NS_STYLE_VISIBILITY_HIDDEN == display->mVisible ? nsViewVisibility_kHide : nsViewVisibility_kShow);
|
||||
|
||||
// XXX If it's relatively positioned or absolutely positioned then we
|
||||
// need to mark it as having transparent content, too. See bug #2502
|
||||
const nsStylePosition* position = (const nsStylePosition*)
|
||||
|
|
|
@ -177,6 +177,9 @@ public:
|
|||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus);
|
||||
|
||||
NS_IMETHOD DidReflow(nsIPresContext& aPresContext,
|
||||
nsDidReflowStatus aStatus);
|
||||
|
||||
NS_IMETHOD MoveTo(nscoord aX, nscoord aY);
|
||||
NS_IMETHOD SizeTo(nscoord aWidth, nscoord aHeight);
|
||||
|
||||
|
@ -696,6 +699,30 @@ void TempMakeAbsURL(nsIContent* aContent, nsString& aRelURL, nsString& aAbsURL)
|
|||
NS_IF_RELEASE(baseURL);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLFrameInnerFrame::DidReflow(nsIPresContext& aPresContext,
|
||||
nsDidReflowStatus aStatus)
|
||||
{
|
||||
nsresult rv = nsLeafFrame::DidReflow(aPresContext, aStatus);
|
||||
|
||||
|
||||
// The view is created hidden; once we have reflowed it and it has been
|
||||
// positioned then we show it.
|
||||
if (NS_FRAME_REFLOW_FINISHED == aStatus) {
|
||||
nsIView* view = nsnull;
|
||||
GetView(&view);
|
||||
const nsStyleDisplay* display;
|
||||
GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)display));
|
||||
nsViewVisibility newVis = NS_STYLE_VISIBILITY_HIDDEN == display->mVisible ? nsViewVisibility_kHide : nsViewVisibility_kShow;
|
||||
nsViewVisibility oldVis;
|
||||
// only change if different.
|
||||
view->GetVisibility(oldVis);
|
||||
if (newVis != oldVis)
|
||||
view->SetVisibility(newVis);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLFrameInnerFrame::CreateWebShell(nsIPresContext& aPresContext,
|
||||
|
@ -827,6 +854,7 @@ nsHTMLFrameInnerFrame::CreateWebShell(nsIPresContext& aPresContext,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLFrameInnerFrame::Reflow(nsIPresContext& aPresContext,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
|
|
|
@ -347,6 +347,12 @@ nsCheckboxControlFrame::Paint(nsIPresContext& aPresContext,
|
|||
const nsRect& aDirtyRect,
|
||||
nsFramePaintLayer aWhichLayer)
|
||||
{
|
||||
|
||||
const nsStyleDisplay* disp = (const nsStyleDisplay*)
|
||||
mStyleContext->GetStyleData(eStyleStruct_Display);
|
||||
if (!disp->mVisible)
|
||||
return NS_OK;
|
||||
|
||||
// Paint the background
|
||||
nsFormControlFrame::Paint(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer);
|
||||
if (NS_FRAME_PAINT_LAYER_FOREGROUND == aWhichLayer) {
|
||||
|
|
|
@ -194,15 +194,24 @@ nsFormControlFrame::DidReflow(nsIPresContext& aPresContext,
|
|||
{
|
||||
nsresult rv = nsLeafFrame::DidReflow(aPresContext, aStatus);
|
||||
|
||||
|
||||
// The view is created hidden; once we have reflowed it and it has been
|
||||
// positioned then we show it.
|
||||
if (NS_FRAME_REFLOW_FINISHED == aStatus) {
|
||||
nsIView* view = nsnull;
|
||||
GetView(&view);
|
||||
if (nsnull != view) {
|
||||
view->SetVisibility(nsViewVisibility_kShow);
|
||||
if (view) {
|
||||
const nsStyleDisplay* display;
|
||||
GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)display));
|
||||
nsViewVisibility newVis = NS_STYLE_VISIBILITY_HIDDEN == display->mVisible ? nsViewVisibility_kHide : nsViewVisibility_kShow;
|
||||
nsViewVisibility oldVis;
|
||||
// only change if different.
|
||||
view->GetVisibility(oldVis);
|
||||
if (newVis != oldVis)
|
||||
view->SetVisibility(newVis);
|
||||
}
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
|
@ -391,6 +391,11 @@ nsRadioControlFrame::Paint(nsIPresContext& aPresContext,
|
|||
const nsRect& aDirtyRect,
|
||||
nsFramePaintLayer aWhichLayer)
|
||||
{
|
||||
const nsStyleDisplay* disp = (const nsStyleDisplay*)
|
||||
mStyleContext->GetStyleData(eStyleStruct_Display);
|
||||
if (!disp->mVisible)
|
||||
return NS_OK;
|
||||
|
||||
if (NS_FRAME_PAINT_LAYER_FOREGROUND == aWhichLayer) {
|
||||
PaintRadioButton(aPresContext, aRenderingContext, aDirtyRect);
|
||||
}
|
||||
|
|
|
@ -547,7 +547,7 @@ nsBoxFrame::FlowChildAt(nsIFrame* childFrame,
|
|||
|
||||
// if we don't need a reflow then
|
||||
// lets see if we are already that size. Yes? then don't even reflow. We are done.
|
||||
if (/*aReflowState.reason == eReflowReason_Incremental && */!mSprings[spring].needsReflow) {
|
||||
if (!mSprings[spring].needsReflow) {
|
||||
nsRect currentSize;
|
||||
childFrame->GetRect(currentSize);
|
||||
|
||||
|
@ -571,6 +571,7 @@ nsBoxFrame::FlowChildAt(nsIFrame* childFrame,
|
|||
nsHTMLReflowState reflowState(aPresContext, aReflowState, childFrame, nsSize(NS_INTRINSICSIZE, NS_INTRINSICSIZE));
|
||||
reflowState.reason = reason;
|
||||
|
||||
// tell the child what size they should be
|
||||
reflowState.computedWidth = mSprings[spring].calculatedSize.width;
|
||||
reflowState.computedHeight = mSprings[spring].calculatedSize.height;
|
||||
|
||||
|
@ -581,7 +582,7 @@ nsBoxFrame::FlowChildAt(nsIFrame* childFrame,
|
|||
if (reflowState.computedHeight != NS_INTRINSICSIZE)
|
||||
reflowState.computedHeight -= (total.top + total.bottom);
|
||||
|
||||
// HTML flames do not implement nsIBox so unless they set both their width and height we do not know
|
||||
// HTML frames do not implement nsIBox so unless they set both their width and height we do not know
|
||||
// what there preferred size is. We can assume a preferred width or height of 0 when flexable but when
|
||||
// not flexible we are in trouble. Why? Well if the child is fixed we really want its intrinsic size and
|
||||
// the only way to get it is to flow with NS_INTRINSIC. So lets do that if we have to.
|
||||
|
@ -620,33 +621,6 @@ nsBoxFrame::FlowChildAt(nsIFrame* childFrame,
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
else {
|
||||
if (mSprings[spring].prefWidthIntrinsic && reflowState.computedWidth != NS_INTRINSICSIZE) {
|
||||
reflowState.computedWidth = mSprings[spring].calculatedSize.width;
|
||||
mSprings[spring].calculatedSize.width = NS_INTRINSICSIZE;
|
||||
FlowChildAt(childFrame, aPresContext, desiredSize, aReflowState, aStatus, spring, incrementalChild);
|
||||
if (reflowState.computedWidth < desiredSize.width)
|
||||
reflowState.computedWidth = desiredSize.width;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
// XXX complete hack. HTML block don't seem to return the actually size they layed themselves
|
||||
// out in if they did not fit. So if the height is 0 indicating no one set it them. Get this
|
||||
// fixed in blocks themselves.
|
||||
if (mHorizontal) {
|
||||
// if we could not get the height of the child because it did not implement nsIBox and
|
||||
// it did not provide a height via css and we are trying to lay it out with a height of 0
|
||||
if (mSprings[spring].prefHeightIntrinsic && mSprings[spring].calculatedSize.height == 0)
|
||||
reflowState.computedHeight = NS_INTRINSICSIZE;
|
||||
} else {
|
||||
if (mSprings[spring].prefWidthIntrinsic && mSprings[spring].calculatedSize.width == 0)
|
||||
reflowState.computedWidth = NS_INTRINSICSIZE;
|
||||
}
|
||||
*/
|
||||
|
||||
nsSize maxElementSize(NS_INTRINSICSIZE, NS_INTRINSICSIZE);
|
||||
desiredSize.maxElementSize = &maxElementSize;
|
||||
|
@ -661,23 +635,18 @@ nsBoxFrame::FlowChildAt(nsIFrame* childFrame,
|
|||
htmlReflow->Reflow(aPresContext, desiredSize, reflowState, aStatus);
|
||||
NS_ASSERTION(NS_FRAME_IS_COMPLETE(aStatus), "bad status");
|
||||
|
||||
|
||||
if (maxElementSize.width != NS_INTRINSICSIZE && maxElementSize.width > desiredSize.width)
|
||||
desiredSize.width = maxElementSize.width;
|
||||
|
||||
/*
|
||||
if (maxElementSize.height != NS_INTRINSICSIZE && maxElementSize.height < desiredSize.height)
|
||||
desiredSize.height = maxElementSize.height;
|
||||
*/
|
||||
|
||||
// set the rect
|
||||
// set the rect
|
||||
childFrame->SetRect(nsRect(0,0,desiredSize.width, desiredSize.height));
|
||||
}
|
||||
|
||||
// add the margin back in. The child should add its border automatically
|
||||
desiredSize.height += (margin.top + margin.bottom);
|
||||
desiredSize.width += (margin.left + margin.right);
|
||||
|
||||
|
||||
|
||||
|
||||
mSprings[spring].needsReflow = PR_FALSE;
|
||||
|
||||
return NS_OK;
|
||||
|
|
|
@ -35,7 +35,16 @@
|
|||
#include "nsXULAtoms.h"
|
||||
#include "nsHTMLAtoms.h"
|
||||
#include "nsIReflowCommand.h"
|
||||
#include "nsHTMLParts.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsStyleChangeList.h"
|
||||
#include "nsCSSRendering.h"
|
||||
|
||||
/*
|
||||
void
|
||||
ApplyRenderingChangeToTree(nsIPresContext* aPresContext,
|
||||
nsIFrame* aFrame);
|
||||
*/
|
||||
|
||||
nsresult
|
||||
NS_NewDeckFrame ( nsIFrame** aNewFrame )
|
||||
|
@ -95,8 +104,17 @@ nsDeckFrame::AttributeChanged(nsIPresContext* aPresContext,
|
|||
ForceResolveToPseudoElement(*aPresContext,mSelected, hide);
|
||||
*/
|
||||
|
||||
nsIFrame* frame = GetSelectedFrame();
|
||||
mSelected = frame;
|
||||
/*
|
||||
// reflow
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
aPresContext->GetShell(getter_AddRefs(shell));
|
||||
|
||||
nsCOMPtr<nsIReflowCommand> reflowCmd;
|
||||
nsresult rv = NS_NewHTMLReflowCommand(getter_AddRefs(reflowCmd), this,
|
||||
nsIReflowCommand::StyleChanged);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
shell->AppendReflowCommand(reflowCmd);
|
||||
*/
|
||||
|
||||
/*
|
||||
if (nsnull != frame)
|
||||
|
@ -105,8 +123,12 @@ nsDeckFrame::AttributeChanged(nsIPresContext* aPresContext,
|
|||
ForceResolveToPseudoElement(*aPresContext,mSelected, show);
|
||||
}
|
||||
*/
|
||||
// ApplyRenderingChangeToTree(aPresContext, this);
|
||||
|
||||
/*
|
||||
nsRect rect(0, 0, mRect.width, mRect.height);
|
||||
Invalidate(rect, PR_TRUE);
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
@ -135,10 +157,6 @@ nsDeckFrame::GetSelectedFrame()
|
|||
|
||||
// convert it to an integer
|
||||
index = value.ToInteger(&error);
|
||||
printf("index=%d\n",index);
|
||||
} else {
|
||||
printf("no index set\n");
|
||||
|
||||
}
|
||||
|
||||
// get the child at that index.
|
||||
|
@ -153,10 +171,38 @@ nsDeckFrame::Paint(nsIPresContext& aPresContext,
|
|||
const nsRect& aDirtyRect,
|
||||
nsFramePaintLayer aWhichLayer)
|
||||
{
|
||||
// if a tab is hidden all its children are too.
|
||||
const nsStyleDisplay* disp = (const nsStyleDisplay*)
|
||||
mStyleContext->GetStyleData(eStyleStruct_Display);
|
||||
if (!disp->mVisible)
|
||||
return NS_OK;
|
||||
|
||||
if (NS_FRAME_PAINT_LAYER_BACKGROUND == aWhichLayer) {
|
||||
const nsStyleDisplay* disp = (const nsStyleDisplay*)
|
||||
mStyleContext->GetStyleData(eStyleStruct_Display);
|
||||
if (disp->mVisible && mRect.width && mRect.height) {
|
||||
// Paint our background and border
|
||||
PRIntn skipSides = GetSkipSides();
|
||||
const nsStyleColor* color = (const nsStyleColor*)
|
||||
mStyleContext->GetStyleData(eStyleStruct_Color);
|
||||
const nsStyleSpacing* spacing = (const nsStyleSpacing*)
|
||||
mStyleContext->GetStyleData(eStyleStruct_Spacing);
|
||||
|
||||
nsRect rect(0, 0, mRect.width, mRect.height);
|
||||
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *color, *spacing, 0, 0);
|
||||
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, *spacing, mStyleContext, skipSides);
|
||||
}
|
||||
}
|
||||
|
||||
nsIFrame* frame = GetSelectedFrame();
|
||||
|
||||
if (frame != nsnull)
|
||||
PaintChild(aPresContext, aRenderingContext, aDirtyRect, frame, aWhichLayer);
|
||||
|
||||
|
||||
nsHTMLContainerFrame::Paint(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer);
|
||||
return NS_OK;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -708,10 +754,6 @@ nsDeckFrame :: ReResolveStyleContext ( nsIPresContext* aPresContext, nsIStyleCon
|
|||
return result;
|
||||
}
|
||||
|
||||
if (aLocalChange) {
|
||||
*aLocalChange = ourChange;
|
||||
}
|
||||
|
||||
// get our hidden pseudo
|
||||
nsCOMPtr<nsIAtom> hide (do_QueryInterface(NS_NewAtom(":-moz-deck-hidden")));
|
||||
|
||||
|
@ -736,6 +778,12 @@ nsDeckFrame :: ReResolveStyleContext ( nsIPresContext* aPresContext, nsIStyleCon
|
|||
index = value.ToInteger(&error);
|
||||
}
|
||||
|
||||
|
||||
if (aLocalChange) {
|
||||
*aLocalChange = ourChange;
|
||||
}
|
||||
|
||||
|
||||
// resolve all our children that are not selected with the hidden pseudo elements
|
||||
// style context
|
||||
nsIFrame* childFrame = mFrames.FirstChild();
|
||||
|
@ -743,17 +791,37 @@ nsDeckFrame :: ReResolveStyleContext ( nsIPresContext* aPresContext, nsIStyleCon
|
|||
while (nsnull != childFrame)
|
||||
{
|
||||
|
||||
nsIStyleContext* oldS = nsnull;
|
||||
nsIStyleContext* newS = nsnull;
|
||||
|
||||
|
||||
if (count == index)
|
||||
{
|
||||
|
||||
childFrame->GetStyleContext(&oldS);
|
||||
childFrame->ReResolveStyleContext(aPresContext, mStyleContext,
|
||||
ourChange, aChangeList, &ourChange);
|
||||
} else {
|
||||
// use hidden style context
|
||||
childFrame->GetStyleContext(&oldS);
|
||||
childFrame->ReResolveStyleContext(aPresContext, newSC,
|
||||
ourChange, aChangeList, &ourChange);
|
||||
|
||||
}
|
||||
|
||||
childFrame->GetStyleContext(&newS);
|
||||
|
||||
//CaptureStyleChangeFor(childFrame, oldS, newS,
|
||||
// ourChange, aChangeList, &ourChange);
|
||||
|
||||
if (oldS != newS)
|
||||
{
|
||||
if (aChangeList)
|
||||
aChangeList->AppendChange(childFrame, NS_STYLE_HINT_VISUAL);
|
||||
}
|
||||
|
||||
NS_RELEASE(oldS);
|
||||
NS_RELEASE(newS);
|
||||
|
||||
childFrame->GetNextSibling(&childFrame);
|
||||
count++;
|
||||
}
|
||||
|
|
|
@ -192,6 +192,13 @@ nsToolboxFrame :: Paint ( nsIPresContext& aPresContext,
|
|||
const nsRect& aDirtyRect,
|
||||
nsFramePaintLayer aWhichLayer)
|
||||
{
|
||||
// if we aren't visible then we are done.
|
||||
const nsStyleDisplay* disp = (const nsStyleDisplay*)
|
||||
mStyleContext->GetStyleData(eStyleStruct_Display);
|
||||
|
||||
if (!disp->mVisible)
|
||||
return NS_OK;
|
||||
|
||||
// take care of bg painting, borders and children
|
||||
nsresult retVal = nsBoxFrame::Paint ( aPresContext, aRenderingContext, aDirtyRect, aWhichLayer );
|
||||
|
||||
|
|
|
@ -144,7 +144,7 @@ public:
|
|||
* @param aEventFlags see nsIView.h for flag definitions
|
||||
* @result processing status
|
||||
*/
|
||||
NS_IMETHOD HandleEvent(nsGUIEvent *event, PRUint32 aEventFlags, nsEventStatus &aStatus) = 0;
|
||||
NS_IMETHOD HandleEvent(nsGUIEvent *event, PRUint32 aEventFlags, nsEventStatus &aStatus, PRBool& aHandled) = 0;
|
||||
|
||||
/**
|
||||
* Called to indicate that the position of the view has been changed.
|
||||
|
|
|
@ -46,7 +46,7 @@ public:
|
|||
ScrollBarView(nsScrollingView *aScrollingView);
|
||||
~ScrollBarView();
|
||||
|
||||
NS_IMETHOD HandleEvent(nsGUIEvent *aEvent, PRUint32 aEventFlags, nsEventStatus &aStatus);
|
||||
NS_IMETHOD HandleEvent(nsGUIEvent *aEvent, PRUint32 aEventFlags, nsEventStatus &aStatus, PRBool& handled);
|
||||
|
||||
// Do not set the visibility of the ScrollbarView using SetVisibility. Instead it
|
||||
// must be marked as visible or hidden using SetEnabled.
|
||||
|
@ -82,7 +82,7 @@ ScrollBarView::~ScrollBarView()
|
|||
}
|
||||
|
||||
NS_IMETHODIMP ScrollBarView::HandleEvent(nsGUIEvent *aEvent, PRUint32 aEventFlags,
|
||||
nsEventStatus &aStatus)
|
||||
nsEventStatus &aStatus, PRBool& aHandled)
|
||||
{
|
||||
aStatus = nsEventStatus_eIgnore;
|
||||
|
||||
|
|
|
@ -771,7 +771,7 @@ NS_IMETHODIMP nsView :: Paint(nsIRenderingContext& rc, const nsIRegion& region,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP nsView :: HandleEvent(nsGUIEvent *event, PRUint32 aEventFlags,
|
||||
nsEventStatus &aStatus)
|
||||
nsEventStatus &aStatus, PRBool& aHandled)
|
||||
{
|
||||
//printf(" %d %d %d %d (%d,%d) \n", this, event->widget, event->widgetSupports,
|
||||
// event->message, event->point.x, event->point.y);
|
||||
|
@ -784,7 +784,6 @@ NS_IMETHODIMP nsView :: HandleEvent(nsGUIEvent *event, PRUint32 aEventFlags,
|
|||
obs = nsnull;
|
||||
|
||||
aStatus = nsEventStatus_eIgnore;
|
||||
PRBool handledByChild = PR_FALSE;
|
||||
|
||||
//see if any of this view's children can process the event
|
||||
if (aStatus == nsEventStatus_eIgnore && !(mVFlags & NS_VIEW_PUBLIC_FLAG_DONT_CHECK_CHILDREN)) {
|
||||
|
@ -796,7 +795,7 @@ NS_IMETHODIMP nsView :: HandleEvent(nsGUIEvent *event, PRUint32 aEventFlags,
|
|||
x = event->point.x;
|
||||
y = event->point.y;
|
||||
|
||||
for (PRInt32 cnt = 0; cnt < numkids; cnt++)
|
||||
for (PRInt32 cnt = 0; cnt < numkids && !aHandled; cnt++)
|
||||
{
|
||||
nsIView *pKid;
|
||||
|
||||
|
@ -807,7 +806,6 @@ NS_IMETHODIMP nsView :: HandleEvent(nsGUIEvent *event, PRUint32 aEventFlags,
|
|||
|
||||
if (trect.Contains(x, y))
|
||||
{
|
||||
handledByChild = PR_TRUE;
|
||||
//the x, y position of the event in question
|
||||
//is inside this child view, so give it the
|
||||
//opportunity to handle the event
|
||||
|
@ -815,26 +813,42 @@ NS_IMETHODIMP nsView :: HandleEvent(nsGUIEvent *event, PRUint32 aEventFlags,
|
|||
event->point.x -= trect.x;
|
||||
event->point.y -= trect.y;
|
||||
|
||||
pKid->HandleEvent(event, NS_VIEW_FLAG_CHECK_CHILDREN, aStatus);
|
||||
pKid->HandleEvent(event, NS_VIEW_FLAG_CHECK_CHILDREN, aStatus, aHandled);
|
||||
|
||||
event->point.x += trect.x;
|
||||
event->point.y += trect.y;
|
||||
|
||||
if (aStatus != nsEventStatus_eIgnore)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//if no child's bounds matched the event, check the view itself.
|
||||
if (!handledByChild && nsnull != mClientData && nsnull != obs)
|
||||
obs->HandleEvent((nsIView *)this, event, aStatus);
|
||||
// if the child handled the event(Ignore) or it handled the event but still wants
|
||||
// default behavor(ConsumeDoDefault) and we are visible then pass the event down the view's
|
||||
// frame hierarchy. -EDV
|
||||
if (!aHandled && mVis == nsViewVisibility_kShow)
|
||||
{
|
||||
//if no child's bounds matched the event or we consumed but still want
|
||||
//default behavior check the view itself. -EDV
|
||||
if (nsnull != mClientData && nsnull != obs) {
|
||||
obs->HandleEvent((nsIView *)this, event, aStatus);
|
||||
aHandled = PR_TRUE;
|
||||
}
|
||||
}
|
||||
/* XXX Just some debug code to see what event are being thrown away because
|
||||
we are not visible. -EDV
|
||||
else if (mVis == nsViewVisibility_kHide) {
|
||||
nsIFrame* frame = (nsIFrame*)mClientData;
|
||||
printf("Throwing away=%d %d %d (%d,%d) \n", this, event->widget,
|
||||
event->message, event->point.x, event->point.y);
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
NS_IF_RELEASE(obs);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsView :: SetPosition(nscoord x, nscoord y)
|
||||
{
|
||||
mBounds.MoveTo(x, y);
|
||||
|
|
|
@ -54,7 +54,7 @@ public:
|
|||
PRUint32 aPaintFlags, PRBool &aResult);
|
||||
NS_IMETHOD Paint(nsIRenderingContext& rc, const nsIRegion& region,
|
||||
PRUint32 aPaintFlags, PRBool &aResult);
|
||||
NS_IMETHOD HandleEvent(nsGUIEvent *event, PRUint32 aEventFlags, nsEventStatus &aStatus);
|
||||
NS_IMETHOD HandleEvent(nsGUIEvent *event, PRUint32 aEventFlags, nsEventStatus &aStatus, PRBool& aHandled);
|
||||
NS_IMETHOD SetPosition(nscoord x, nscoord y);
|
||||
NS_IMETHOD GetPosition(nscoord *x, nscoord *y) const;
|
||||
NS_IMETHOD SetDimensions(nscoord width, nscoord height, PRBool aPaint = PR_TRUE);
|
||||
|
|
|
@ -1716,11 +1716,13 @@ NS_IMETHODIMP nsViewManager :: DispatchEvent(nsGUIEvent *aEvent, nsEventStatus &
|
|||
|
||||
aEvent->point.x += offset.x;
|
||||
aEvent->point.y += offset.y;
|
||||
|
||||
|
||||
PRBool handled = PR_FALSE;
|
||||
view->HandleEvent(aEvent, NS_VIEW_FLAG_CHECK_CHILDREN |
|
||||
NS_VIEW_FLAG_CHECK_PARENT |
|
||||
NS_VIEW_FLAG_CHECK_SIBLINGS,
|
||||
aStatus);
|
||||
aStatus,
|
||||
handled);
|
||||
|
||||
aEvent->point.x -= offset.x;
|
||||
aEvent->point.y -= offset.y;
|
||||
|
|
Загрузка…
Ссылка в новой задаче