WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-79443-20120307221157.patch (text/plain), 9.35 KB, created by
Andy Estes
on 2012-03-07 22:11:58 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Andy Estes
Created:
2012-03-07 22:11:58 PST
Size:
9.35 KB
patch
obsolete
>Subversion Revision: 109802 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 8f29bbe31178b022d173fd8b5ee07fe75f63f1a8..6903e8dc7a1c94e5b9da8e983289eca9df22bae2 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,38 @@ >+2012-03-07 Andy Estes <aestes@apple.com> >+ >+ REGRESSION (r105396): Dragging an iWork document into icloud.com opens it in the Mac app instead of uploading it to icloud.com >+ https://bugs.webkit.org/show_bug.cgi?id=79443 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ icloud.com registers a drop event handler that sets display:none on the >+ file input element receiving the drop. After dispatching the drop event, >+ DragController hit tests the position under the mouse to see if it is a >+ file input element in need of receiving files. Since the file input >+ element has lost its renderer, it cannot be found by hit testing, so >+ the dropped file is never attached to the file input element, no change >+ event fires, and no upload commences. We want these things to happen >+ even if the element is no longer visible. >+ >+ Since we already keep track of the file input element under the mouse >+ via m_fileInputElementUnderMouse, this additional hit test is >+ unnecessary. Use m_fileInputElementUnderMouse in concludeEditDrag() >+ when dropping files. >+ >+ Test: fast/events/file-input-hidden-in-ondrop.html >+ >+ * html/HTMLInputElement.cpp: >+ (WebCore::HTMLInputElement::setCanReceiveDroppedFiles): We now call >+ this method at times where the element no longer has a renderer. Add a >+ null check. >+ * page/DragController.cpp: >+ (WebCore::DragController::performDrag): >+ (WebCore::DragController::concludeEditDrag): Use >+ m_fileInputElementUnderMouse instead of the element returned by hit >+ testing. Assert that m_fileInputElementUnderMouse equals the hit tested >+ element unless m_fileInputElementUnderMouse doesn't have a renderer. >+ (WebCore::DragController::canProcessDrag): Ditto. >+ > 2012-03-05 Anders Carlsson <andersca@apple.com> > > Always update the scroll layer position on the main thread when we have an overlay >diff --git a/Source/WebCore/html/HTMLInputElement.cpp b/Source/WebCore/html/HTMLInputElement.cpp >index 0e1f9df200dd58f81ce3988fcc678f3cf432a726..a07cea6f059d63ac8d1288d48488ca428ff62263 100644 >--- a/Source/WebCore/html/HTMLInputElement.cpp >+++ b/Source/WebCore/html/HTMLInputElement.cpp >@@ -1356,7 +1356,8 @@ void HTMLInputElement::setCanReceiveDroppedFiles(bool canReceiveDroppedFiles) > if (m_canReceiveDroppedFiles == canReceiveDroppedFiles) > return; > m_canReceiveDroppedFiles = canReceiveDroppedFiles; >- renderer()->updateFromElement(); >+ if (renderer()) >+ renderer()->updateFromElement(); > } > > String HTMLInputElement::visibleValue() const >diff --git a/Source/WebCore/page/DragController.cpp b/Source/WebCore/page/DragController.cpp >index 4891aad0b620bf621b2ddce9ff1645d69545ce17..53107b4d7ea3a7758bdac759137ff988f7a67ed4 100644 >--- a/Source/WebCore/page/DragController.cpp >+++ b/Source/WebCore/page/DragController.cpp >@@ -218,13 +218,18 @@ bool DragController::performDrag(DragData* dragData) > } > } > >- if ((m_dragDestinationAction & DragDestinationActionEdit) && concludeEditDrag(dragData)) { >- m_documentUnderMouse = 0; >- return true; >+ bool didConcludeEditDrag = (m_dragDestinationAction & DragDestinationActionEdit) && concludeEditDrag(dragData); >+ >+ if (m_fileInputElementUnderMouse) { >+ m_fileInputElementUnderMouse->setCanReceiveDroppedFiles(false); >+ m_fileInputElementUnderMouse = 0; > } > > m_documentUnderMouse = 0; > >+ if (didConcludeEditDrag) >+ return true; >+ > if (operationForLoad(dragData) == DragOperationNone) > return false; > >@@ -424,11 +429,6 @@ bool DragController::concludeEditDrag(DragData* dragData) > ASSERT(dragData); > ASSERT(!m_isHandlingDrag); > >- if (m_fileInputElementUnderMouse) { >- m_fileInputElementUnderMouse->setCanReceiveDroppedFiles(false); >- m_fileInputElementUnderMouse = 0; >- } >- > if (!m_documentUnderMouse) > return false; > >@@ -461,8 +461,11 @@ bool DragController::concludeEditDrag(DragData* dragData) > return false; > } > >- if (HTMLInputElement* fileInput = asFileInput(element)) { >- if (fileInput->disabled()) >+ if (m_fileInputElementUnderMouse) { >+ // m_fileInputElementUnderMouse should be the element we hit tested for, >+ // unless it was made display:none by a drop event handler. >+ ASSERT(m_fileInputElementUnderMouse == element || !m_fileInputElementUnderMouse->renderer()); >+ if (m_fileInputElementUnderMouse->disabled()) > return false; > > if (!dragData->containsFiles()) >@@ -473,7 +476,7 @@ bool DragController::concludeEditDrag(DragData* dragData) > if (filenames.isEmpty()) > return false; > >- fileInput->receiveDroppedFiles(filenames); >+ m_fileInputElementUnderMouse->receiveDroppedFiles(filenames); > return true; > } > >@@ -548,8 +551,17 @@ bool DragController::canProcessDrag(DragData* dragData) > if (!result.innerNonSharedNode()) > return false; > >- if (dragData->containsFiles() && asFileInput(result.innerNonSharedNode())) >- return true; >+ if (dragData->containsFiles()) { >+ if (m_fileInputElementUnderMouse) { >+ // m_fileInputElementUnderMouse should be the element we hit tested >+ // for, unless it was made display:none by a drop event handler. >+ ASSERT(m_fileInputElementUnderMouse == result.innerNonSharedNode() || !m_fileInputElementUnderMouse->renderer()); >+ return true; >+ } >+ >+ if (asFileInput(result.innerNonSharedNode())) >+ return true; >+ } > > if (!result.innerNonSharedNode()->rendererIsEditable()) > return false; >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 1237b9e1a2d31103150d69926577196632b47e95..1ef8838198db6cc2d8a1416de612b7ac035e4788 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,15 @@ >+2012-03-07 Andy Estes <aestes@apple.com> >+ >+ REGRESSION (r105396): Dragging an iWork document into icloud.com opens it in the Mac app instead of uploading it to icloud.com >+ https://bugs.webkit.org/show_bug.cgi?id=79443 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * fast/events/file-input-hidden-in-ondrop-expected.txt: Added. >+ * fast/events/file-input-hidden-in-ondrop.html: Added. >+ * platform/wk2/Skipped: WebKitTestRunner doesn't support >+ EventSender.beginDragWithFiles(). >+ > 2012-03-05 Tony Chang <tony@chromium.org> > > Implement flex-wrap: wrap >diff --git a/LayoutTests/fast/events/file-input-hidden-in-ondrop-expected.txt b/LayoutTests/fast/events/file-input-hidden-in-ondrop-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..2da019e85098642bf1302cc6f6be47c4d8c211bf >--- /dev/null >+++ b/LayoutTests/fast/events/file-input-hidden-in-ondrop-expected.txt >@@ -0,0 +1,2 @@ >+PASS dropTarget.value is "C:\\fakepath\\abe.png" >+ >diff --git a/LayoutTests/fast/events/file-input-hidden-in-ondrop.html b/LayoutTests/fast/events/file-input-hidden-in-ondrop.html >new file mode 100644 >index 0000000000000000000000000000000000000000..9c70ef60302f2f929b5c5a3358e96f7d48239369 >--- /dev/null >+++ b/LayoutTests/fast/events/file-input-hidden-in-ondrop.html >@@ -0,0 +1,38 @@ >+<!DOCTYPE html> >+<html> >+<head> >+ <script src="../js/resources/js-test-pre.js"></script> >+ <script> >+ if (window.layoutTestController) { >+ layoutTestController.dumpAsText(); >+ layoutTestController.waitUntilDone(); >+ } >+ >+ var dropTarget; >+ >+ function test() >+ { >+ dropTarget = document.getElementById("drop-target"); >+ dropTarget.addEventListener("drop", function() { >+ dropTarget.style.display = "none"; >+ setTimeout(function() { >+ shouldBeEqualToString("dropTarget.value", "C:\\fakepath\\abe.png"); >+ if (window.layoutTestController) >+ layoutTestController.notifyDone(); >+ }, 0); >+ }, false); >+ >+ if (window.eventSender) { >+ eventSender.beginDragWithFiles(["resources/abe.png"]); >+ var x = dropTarget.offsetLeft + dropTarget.offsetWidth / 2; >+ var y = dropTarget.offsetTop + dropTarget.offsetHeight / 2; >+ eventSender.mouseMoveTo(x, y); >+ eventSender.mouseUp(); >+ } >+ } >+ </script> >+</head> >+<body onload="test()"> >+ <input type="file" id="drop-target"> >+</body> >+</html> >\ No newline at end of file >diff --git a/LayoutTests/platform/wk2/Skipped b/LayoutTests/platform/wk2/Skipped >index c944aecf38808e9bd8c3d0a9f3d09a819c1ce7ec..2ae147d06b149280563ca73753abaf0dce639a4a 100644 >--- a/LayoutTests/platform/wk2/Skipped >+++ b/LayoutTests/platform/wk2/Skipped >@@ -1344,6 +1344,7 @@ fast/dom/Window/window-postmessage-clone-frames.html > fast/events/drag-file-crash.html > fast/events/drag-to-navigate.html > fast/events/dropzone-004.html >+fast/events/file-input-hidden-in-ondrop.html > fast/events/prevent-drag-to-navigate.html > fast/files/apply-blob-url-to-img.html > fast/files/apply-blob-url-to-xhr.html
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 79443
:
130013
|
130674
|
130769
|
130893