Bug 526286 - Detaching a tab by dragging it down into its content area stopped working, r=enndeakin, sr=jonas
authorOlli Pettay <Olli.Pettay@helsinki.fi>
Thu, 05 Nov 2009 16:39:18 +0200
changeset 34605 5c15de0bc51b5da5de35d90e3b2364199127c256
parent 34604 2b4f94beede52375a2abf04a247de579c7d183b5
child 34606 d211f5c35d006c41e1fe781a01ed90d90ee05f67
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersenndeakin, jonas
bugs526286
milestone1.9.3a1pre
Bug 526286 - Detaching a tab by dragging it down into its content area stopped working, r=enndeakin, sr=jonas
content/base/src/nsContentAreaDragDrop.cpp
content/events/src/nsEventStateManager.cpp
--- a/content/base/src/nsContentAreaDragDrop.cpp
+++ b/content/base/src/nsContentAreaDragDrop.cpp
@@ -323,34 +323,17 @@ nsContentAreaDragDrop::DragOver(nsIDOMDr
 
         if (sourceRoot && sourceRoot == eventRoot) {
           dropAllowed = PR_FALSE;
         }
       }
     }
   }
 
-  nsCOMPtr<nsIDOMNSEvent> e = do_QueryInterface(inEvent);
-  NS_ENSURE_STATE(e);
-  nsCOMPtr<nsIDOMEventTarget> target;
-  e->GetOriginalTarget(getter_AddRefs(target));
-  nsCOMPtr<nsINode> node = do_QueryInterface(target);
-  if (!node) {
-    nsCOMPtr<nsPIDOMWindow> win = do_QueryInterface(target);
-    if (win) {
-      node = do_QueryInterface(win->GetExtantDocument());
-    }
-  }
-  PRBool isChrome =
-    node ? nsContentUtils::IsChromeDoc(node->GetOwnerDoc()) : PR_FALSE;
-  if (isChrome) {
-    session->SetCanDrop(dropAllowed);
-  } else if (dropAllowed) {
-    inEvent->PreventDefault();
-  }
+  session->SetCanDrop(dropAllowed);
 
   return NS_OK;
 }
 
 
 //
 // ExtractURLFromData
 //
--- a/content/events/src/nsEventStateManager.cpp
+++ b/content/events/src/nsEventStateManager.cpp
@@ -3128,17 +3128,18 @@ nsEventStateManager::PostHandleEvent(nsP
         // For now, do this only for dragover.
         //XXXsmaug dragenter needs some more work.
         if (aEvent->message == NS_DRAGDROP_OVER && !isChromeDoc) {
           // Someone has called preventDefault(), check whether is was content.
           dragSession->SetOnlyChromeDrop(
             !(aEvent->flags & NS_EVENT_FLAG_NO_DEFAULT_CALLED_IN_CONTENT));
         }
       } else if (aEvent->message == NS_DRAGDROP_OVER && !isChromeDoc) {
-        dragSession->SetCanDrop(PR_FALSE);
+        // No one called preventDefault(), so handle drop only in chrome.
+        dragSession->SetOnlyChromeDrop(PR_TRUE);
       }
 
       // now set the drop effect in the initial dataTransfer. This ensures
       // that we can get the desired drop effect in the drop event.
       if (initialDataTransferNS)
         initialDataTransferNS->SetDropEffectInt(dropEffect);
     }
     break;