Bug 737889 - Part 2: Stop the propagarion of drag/drop events over non-editable content; r=roc

This commit is contained in:
Ehsan Akhgari 2012-03-23 11:35:40 -04:00
parent 2df3a82068
commit d408136238

View File

@ -676,11 +676,7 @@ nsEditorEventListener::DragOver(nsIDOMDragEvent* aDragEvent)
nsCOMPtr<nsIContent> dropParent = do_QueryInterface(parent);
NS_ENSURE_TRUE(dropParent, NS_ERROR_FAILURE);
if (!dropParent->IsEditable()) {
return NS_OK;
}
if (CanDrop(aDragEvent)) {
if (dropParent->IsEditable() && CanDrop(aDragEvent)) {
aDragEvent->PreventDefault(); // consumed
if (mCaret) {
@ -754,11 +750,7 @@ nsEditorEventListener::Drop(nsIDOMDragEvent* aMouseEvent)
nsCOMPtr<nsIContent> dropParent = do_QueryInterface(parent);
NS_ENSURE_TRUE(dropParent, NS_ERROR_FAILURE);
if (!dropParent->IsEditable()) {
return NS_OK;
}
if (!CanDrop(aMouseEvent)) {
if (!dropParent->IsEditable() || !CanDrop(aMouseEvent)) {
// was it because we're read-only?
if (mEditor->IsReadonly() || mEditor->IsDisabled())
{