From a064dd059f950ba9810a47685c5997faadab6086 Mon Sep 17 00:00:00 2001 From: "vidur%netscape.com" Date: Fri, 18 May 2001 23:08:00 +0000 Subject: [PATCH] Partial fix for bug 78976. Rather than dropping events that are targeted at the canvas frame, we pass them down to the first frame child. r=joki, sr=jst. --- layout/generic/nsHTMLFrame.cpp | 24 ++++++++++++++++++++++++ layout/html/base/src/nsHTMLFrame.cpp | 24 ++++++++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/layout/generic/nsHTMLFrame.cpp b/layout/generic/nsHTMLFrame.cpp index 1f795edd9883..abb2116e024f 100644 --- a/layout/generic/nsHTMLFrame.cpp +++ b/layout/generic/nsHTMLFrame.cpp @@ -107,6 +107,9 @@ public: NS_IMETHOD GetFrameName(nsString& aResult) const; NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const; #endif + NS_IMETHOD GetContentForEvent(nsIPresContext* aPresContext, + nsEvent* aEvent, + nsIContent** aContent); protected: virtual PRIntn GetSkipSides() const; @@ -451,6 +454,27 @@ CanvasFrame::AttributeChanged(nsIPresContext* aPresContext, return NS_OK; } +NS_IMETHODIMP +CanvasFrame::GetContentForEvent(nsIPresContext* aPresContext, + nsEvent* aEvent, + nsIContent** aContent) +{ + NS_ENSURE_ARG_POINTER(aContent); + nsresult rv = nsFrame::GetContentForEvent(aPresContext, + aEvent, + aContent); + if (NS_FAILED(rv) || !*aContent) { + nsIFrame* kid = mFrames.FirstChild(); + if (kid) { + rv = kid->GetContentForEvent(aPresContext, + aEvent, + aContent); + } + } + + return rv; +} + #ifdef DEBUG NS_IMETHODIMP CanvasFrame::GetFrameName(nsString& aResult) const diff --git a/layout/html/base/src/nsHTMLFrame.cpp b/layout/html/base/src/nsHTMLFrame.cpp index 1f795edd9883..abb2116e024f 100644 --- a/layout/html/base/src/nsHTMLFrame.cpp +++ b/layout/html/base/src/nsHTMLFrame.cpp @@ -107,6 +107,9 @@ public: NS_IMETHOD GetFrameName(nsString& aResult) const; NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const; #endif + NS_IMETHOD GetContentForEvent(nsIPresContext* aPresContext, + nsEvent* aEvent, + nsIContent** aContent); protected: virtual PRIntn GetSkipSides() const; @@ -451,6 +454,27 @@ CanvasFrame::AttributeChanged(nsIPresContext* aPresContext, return NS_OK; } +NS_IMETHODIMP +CanvasFrame::GetContentForEvent(nsIPresContext* aPresContext, + nsEvent* aEvent, + nsIContent** aContent) +{ + NS_ENSURE_ARG_POINTER(aContent); + nsresult rv = nsFrame::GetContentForEvent(aPresContext, + aEvent, + aContent); + if (NS_FAILED(rv) || !*aContent) { + nsIFrame* kid = mFrames.FirstChild(); + if (kid) { + rv = kid->GetContentForEvent(aPresContext, + aEvent, + aContent); + } + } + + return rv; +} + #ifdef DEBUG NS_IMETHODIMP CanvasFrame::GetFrameName(nsString& aResult) const