From 246b1b3bf4cd8135aa0af0d131e44b8d5a81542d Mon Sep 17 00:00:00 2001 From: "rods%netscape.com" Date: Thu, 23 May 2002 11:25:58 +0000 Subject: [PATCH] temporary patch to the forms controls to ignore mouse events when in printpreview until Bug 124990 gets fixed (radio and checkbox doesn't need the fix) this code will be removed via bug 146399 Bug 129002 r=dcone sr=attinasi --- layout/forms/nsComboboxControlFrame.cpp | 7 +++++++ layout/forms/nsGfxButtonControlFrame.cpp | 8 ++++++++ layout/forms/nsListControlFrame.cpp | 6 ++++++ .../html/forms/src/nsComboboxControlFrame.cpp | 7 +++++++ .../forms/src/nsGfxButtonControlFrame.cpp | 8 ++++++++ .../html/forms/src/nsGfxTextControlFrame2.cpp | 20 +++++++++++++++++++ .../html/forms/src/nsGfxTextControlFrame2.h | 4 ++++ layout/html/forms/src/nsListControlFrame.cpp | 6 ++++++ 8 files changed, 66 insertions(+) diff --git a/layout/forms/nsComboboxControlFrame.cpp b/layout/forms/nsComboboxControlFrame.cpp index ff506fab997..5172ee73766 100644 --- a/layout/forms/nsComboboxControlFrame.cpp +++ b/layout/forms/nsComboboxControlFrame.cpp @@ -2091,6 +2091,13 @@ nsComboboxControlFrame::HandleEvent(nsIPresContext* aPresContext, nsEventStatus* aEventStatus) { NS_ENSURE_ARG_POINTER(aEventStatus); + // temp fix until Bug 124990 gets fixed + PRBool isPaginated = PR_FALSE; + aPresContext->IsPaginated(&isPaginated); + if (isPaginated && NS_IS_MOUSE_EVENT(aEvent)) { + return NS_OK; + } + if (nsEventStatus_eConsumeNoDefault == *aEventStatus) { return NS_OK; } diff --git a/layout/forms/nsGfxButtonControlFrame.cpp b/layout/forms/nsGfxButtonControlFrame.cpp index e7d93286b76..561200a046b 100644 --- a/layout/forms/nsGfxButtonControlFrame.cpp +++ b/layout/forms/nsGfxButtonControlFrame.cpp @@ -49,6 +49,8 @@ #include "nsIServiceManager.h" #include "nsIDOMNode.h" #include "nsLayoutAtoms.h" +// MouseEvent suppression in PP +#include "nsGUIEvent.h" static NS_DEFINE_CID(kTextNodeCID, NS_TEXTNODE_CID); @@ -628,6 +630,12 @@ nsGfxButtonControlFrame::HandleEvent(nsIPresContext* aPresContext, nsGUIEvent* aEvent, nsEventStatus* aEventStatus) { + // temp fix until Bug 124990 gets fixed + PRBool isPaginated = PR_FALSE; + aPresContext->IsPaginated(&isPaginated); + if (isPaginated && NS_IS_MOUSE_EVENT(aEvent)) { + return NS_OK; + } // Override the HandleEvent to prevent the nsFrame::HandleEvent // from being called. The nsFrame::HandleEvent causes the button label // to be selected (Drawn with an XOR rectangle over the label) diff --git a/layout/forms/nsListControlFrame.cpp b/layout/forms/nsListControlFrame.cpp index 8a29b951e67..e3e8d182c12 100644 --- a/layout/forms/nsListControlFrame.cpp +++ b/layout/forms/nsListControlFrame.cpp @@ -1562,6 +1562,12 @@ nsListControlFrame::HandleEvent(nsIPresContext* aPresContext, nsEventStatus* aEventStatus) { NS_ENSURE_ARG_POINTER(aEventStatus); + // temp fix until Bug 124990 gets fixed + PRBool isPaginated = PR_FALSE; + aPresContext->IsPaginated(&isPaginated); + if (isPaginated && NS_IS_MOUSE_EVENT(aEvent)) { + return NS_OK; + } /*const char * desc[] = {"NS_MOUSE_MOVE", "NS_MOUSE_LEFT_BUTTON_UP", diff --git a/layout/html/forms/src/nsComboboxControlFrame.cpp b/layout/html/forms/src/nsComboboxControlFrame.cpp index ff506fab997..5172ee73766 100644 --- a/layout/html/forms/src/nsComboboxControlFrame.cpp +++ b/layout/html/forms/src/nsComboboxControlFrame.cpp @@ -2091,6 +2091,13 @@ nsComboboxControlFrame::HandleEvent(nsIPresContext* aPresContext, nsEventStatus* aEventStatus) { NS_ENSURE_ARG_POINTER(aEventStatus); + // temp fix until Bug 124990 gets fixed + PRBool isPaginated = PR_FALSE; + aPresContext->IsPaginated(&isPaginated); + if (isPaginated && NS_IS_MOUSE_EVENT(aEvent)) { + return NS_OK; + } + if (nsEventStatus_eConsumeNoDefault == *aEventStatus) { return NS_OK; } diff --git a/layout/html/forms/src/nsGfxButtonControlFrame.cpp b/layout/html/forms/src/nsGfxButtonControlFrame.cpp index e7d93286b76..561200a046b 100644 --- a/layout/html/forms/src/nsGfxButtonControlFrame.cpp +++ b/layout/html/forms/src/nsGfxButtonControlFrame.cpp @@ -49,6 +49,8 @@ #include "nsIServiceManager.h" #include "nsIDOMNode.h" #include "nsLayoutAtoms.h" +// MouseEvent suppression in PP +#include "nsGUIEvent.h" static NS_DEFINE_CID(kTextNodeCID, NS_TEXTNODE_CID); @@ -628,6 +630,12 @@ nsGfxButtonControlFrame::HandleEvent(nsIPresContext* aPresContext, nsGUIEvent* aEvent, nsEventStatus* aEventStatus) { + // temp fix until Bug 124990 gets fixed + PRBool isPaginated = PR_FALSE; + aPresContext->IsPaginated(&isPaginated); + if (isPaginated && NS_IS_MOUSE_EVENT(aEvent)) { + return NS_OK; + } // Override the HandleEvent to prevent the nsFrame::HandleEvent // from being called. The nsFrame::HandleEvent causes the button label // to be selected (Drawn with an XOR rectangle over the label) diff --git a/layout/html/forms/src/nsGfxTextControlFrame2.cpp b/layout/html/forms/src/nsGfxTextControlFrame2.cpp index 38cb5ecd7fb..30306836cce 100644 --- a/layout/html/forms/src/nsGfxTextControlFrame2.cpp +++ b/layout/html/forms/src/nsGfxTextControlFrame2.cpp @@ -3517,3 +3517,23 @@ nsGfxTextControlFrame2::SetValueChanged(PRBool aValueChanged) elem->SetValueChanged(aValueChanged); } } + +NS_IMETHODIMP +nsGfxTextControlFrame2::HandleEvent(nsIPresContext* aPresContext, + nsGUIEvent* aEvent, + nsEventStatus* aEventStatus) +{ + NS_ENSURE_ARG_POINTER(aEventStatus); + + // temp fix until Bug 124990 gets fixed + PRBool isPaginated = PR_FALSE; + aPresContext->IsPaginated(&isPaginated); + if (isPaginated && NS_IS_MOUSE_EVENT(aEvent)) { + return NS_OK; + } + + return nsStackFrame::HandleEvent(aPresContext, aEvent, aEventStatus); + +} + + diff --git a/layout/html/forms/src/nsGfxTextControlFrame2.h b/layout/html/forms/src/nsGfxTextControlFrame2.h index 6a37b0f7b86..ca7a8ea3f30 100644 --- a/layout/html/forms/src/nsGfxTextControlFrame2.h +++ b/layout/html/forms/src/nsGfxTextControlFrame2.h @@ -96,6 +96,10 @@ public: nsFramePaintLayer aWhichLayer, nsIFrame** aFrame); + NS_IMETHOD HandleEvent(nsIPresContext* aPresContext, + nsGUIEvent* aEvent, + nsEventStatus* aEventStatus); + NS_IMETHOD GetPrefSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize); NS_IMETHOD GetMinSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize); NS_IMETHOD GetMaxSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize); diff --git a/layout/html/forms/src/nsListControlFrame.cpp b/layout/html/forms/src/nsListControlFrame.cpp index 8a29b951e67..e3e8d182c12 100644 --- a/layout/html/forms/src/nsListControlFrame.cpp +++ b/layout/html/forms/src/nsListControlFrame.cpp @@ -1562,6 +1562,12 @@ nsListControlFrame::HandleEvent(nsIPresContext* aPresContext, nsEventStatus* aEventStatus) { NS_ENSURE_ARG_POINTER(aEventStatus); + // temp fix until Bug 124990 gets fixed + PRBool isPaginated = PR_FALSE; + aPresContext->IsPaginated(&isPaginated); + if (isPaginated && NS_IS_MOUSE_EVENT(aEvent)) { + return NS_OK; + } /*const char * desc[] = {"NS_MOUSE_MOVE", "NS_MOUSE_LEFT_BUTTON_UP",