mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 06:11:37 +00:00
Fix drag and drop to/from textarea and input (bug 194802), r=bryner@netscape.com, sr=jst@netscape.com, a=sspitzer@netscape.com
This commit is contained in:
parent
209f09c081
commit
d484da106e
@ -200,6 +200,7 @@ nsDOMEvent::nsDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent,
|
||||
// Get the explicit original target (if it's anonymous make it null)
|
||||
{
|
||||
mExplicitOriginalTarget = GetTargetFromFrame();
|
||||
mTmpRealOriginalTarget = mExplicitOriginalTarget;
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(mExplicitOriginalTarget);
|
||||
if (content) {
|
||||
if (content->IsNativeAnonymous()) {
|
||||
@ -411,6 +412,18 @@ nsDOMEvent::GetExplicitOriginalTarget(nsIDOMEventTarget** aRealEventTarget)
|
||||
return GetTarget(aRealEventTarget);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMEvent::GetTmpRealOriginalTarget(nsIDOMEventTarget** aRealEventTarget)
|
||||
{
|
||||
if (mTmpRealOriginalTarget) {
|
||||
*aRealEventTarget = mTmpRealOriginalTarget;
|
||||
NS_ADDREF(*aRealEventTarget);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return GetOriginalTarget(aRealEventTarget);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMEvent::GetOriginalTarget(nsIDOMEventTarget** aOriginalTarget)
|
||||
{
|
||||
|
@ -241,6 +241,7 @@ protected:
|
||||
nsCOMPtr<nsIDOMEventTarget> mCurrentTarget;
|
||||
nsCOMPtr<nsIDOMEventTarget> mOriginalTarget;
|
||||
nsCOMPtr<nsIDOMEventTarget> mExplicitOriginalTarget;
|
||||
nsCOMPtr<nsIDOMEventTarget> mTmpRealOriginalTarget;
|
||||
nsString* mText;
|
||||
nsCOMPtr<nsIPrivateTextRangeList> mTextRange;
|
||||
PRPackedBool mEventIsInternal;
|
||||
|
@ -92,6 +92,12 @@ interface nsIDOMNSEvent : nsISupports
|
||||
* contain anonymous content.
|
||||
*/
|
||||
readonly attribute nsIDOMEventTarget explicitOriginalTarget;
|
||||
/* XXX This is TEMPORARY.
|
||||
* The original target, without any retargeting (like textnode retargeting).
|
||||
* This really needs to be in .originalTarget, but this is a less risky way of
|
||||
* fixing it.
|
||||
*/
|
||||
[noscript] readonly attribute nsIDOMEventTarget tmpRealOriginalTarget;
|
||||
|
||||
void preventBubble();
|
||||
void preventCapture();
|
||||
|
@ -350,7 +350,7 @@ NS_IMETHODIMP nsPlaintextEditor::CanDrag(nsIDOMEvent *aDragEvent, PRBool *aCanDr
|
||||
nsCOMPtr<nsIDOMNSEvent> nsevent(do_QueryInterface(aDragEvent));
|
||||
|
||||
if (nsevent) {
|
||||
res = nsevent->GetExplicitOriginalTarget(getter_AddRefs(eventTarget));
|
||||
res = nsevent->GetTmpRealOriginalTarget(getter_AddRefs(eventTarget));
|
||||
if (NS_FAILED(res)) return res;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user