summaryrefslogtreecommitdiffstats
path: root/WebCore/page/DragController.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/page/DragController.cpp')
-rw-r--r--WebCore/page/DragController.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/WebCore/page/DragController.cpp b/WebCore/page/DragController.cpp
index eb90f85..8ee5a8d 100644
--- a/WebCore/page/DragController.cpp
+++ b/WebCore/page/DragController.cpp
@@ -255,7 +255,7 @@ static HTMLInputElement* asFileInput(Node* node)
// The button for a FILE input is a sub element with no set input type
// In order to get around this problem we assume any non-FILE input element
// is this internal button, and try querying the shadow parent node.
- if (node->hasTagName(HTMLNames::inputTag) && node->isShadowNode() && !static_cast<HTMLInputElement*>(node)->isFileUpload())
+ if (node->hasTagName(HTMLNames::inputTag) && node->isShadowRoot() && !static_cast<HTMLInputElement*>(node)->isFileUpload())
node = node->shadowParentNode();
if (!node || !node->hasTagName(HTMLNames::inputTag))
@@ -268,6 +268,7 @@ static HTMLInputElement* asFileInput(Node* node)
return inputElement;
}
+// This can return null if an empty document is loaded.
static Element* elementUnderMouse(Document* documentUnderMouse, const IntPoint& p)
{
Frame* frame = documentUnderMouse->frame();
@@ -284,7 +285,6 @@ static Element* elementUnderMouse(Document* documentUnderMouse, const IntPoint&
if (n)
n = n->shadowAncestorNode();
- ASSERT(n);
return static_cast<Element*>(n);
}
@@ -327,6 +327,8 @@ bool DragController::tryDocumentDrag(DragData* dragData, DragDestinationAction a
IntPoint point = frameView->windowToContents(dragData->clientPosition());
Element* element = elementUnderMouse(m_documentUnderMouse.get(), point);
+ if (!element)
+ return false;
if (!asFileInput(element)) {
VisibleSelection dragCaret = m_documentUnderMouse->frame()->visiblePositionForPoint(point);
m_page->dragCaretController()->setSelection(dragCaret);
@@ -386,6 +388,8 @@ bool DragController::concludeEditDrag(DragData* dragData)
IntPoint point = m_documentUnderMouse->view()->windowToContents(dragData->clientPosition());
Element* element = elementUnderMouse(m_documentUnderMouse.get(), point);
+ if (!element)
+ return false;
Frame* innerFrame = element->ownerDocument()->frame();
ASSERT(innerFrame);