OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007, 2009, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2009, 2010 Apple Inc. All rights reserved. |
3 * Copyright (C) 2008 Google Inc. | 3 * Copyright (C) 2008 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 DragSession dragSession; | 304 DragSession dragSession; |
305 m_documentIsHandlingDrag = tryDocumentDrag(dragData, m_dragDestinationAction
, dragSession); | 305 m_documentIsHandlingDrag = tryDocumentDrag(dragData, m_dragDestinationAction
, dragSession); |
306 if (!m_documentIsHandlingDrag && (m_dragDestinationAction & DragDestinationA
ctionLoad)) | 306 if (!m_documentIsHandlingDrag && (m_dragDestinationAction & DragDestinationA
ctionLoad)) |
307 dragSession.operation = operationForLoad(dragData); | 307 dragSession.operation = operationForLoad(dragData); |
308 return dragSession; | 308 return dragSession; |
309 } | 309 } |
310 | 310 |
311 static HTMLInputElement* asFileInput(Node* node) | 311 static HTMLInputElement* asFileInput(Node* node) |
312 { | 312 { |
313 ASSERT(node); | 313 ASSERT(node); |
314 for (; node; node = node->shadowHost()) { | 314 for (; node; node = node->ownerShadowHost()) { |
315 if (isHTMLInputElement(*node) && toHTMLInputElement(node)->type() == Inp
utTypeNames::file) | 315 if (isHTMLInputElement(*node) && toHTMLInputElement(node)->type() == Inp
utTypeNames::file) |
316 return toHTMLInputElement(node); | 316 return toHTMLInputElement(node); |
317 } | 317 } |
318 return nullptr; | 318 return nullptr; |
319 } | 319 } |
320 | 320 |
321 // This can return null if an empty document is loaded. | 321 // This can return null if an empty document is loaded. |
322 static Element* elementUnderMouse(Document* documentUnderMouse, const IntPoint&
point) | 322 static Element* elementUnderMouse(Document* documentUnderMouse, const IntPoint&
point) |
323 { | 323 { |
324 HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Active); | 324 HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Active); |
325 HitTestResult result(request, point); | 325 HitTestResult result(request, point); |
326 documentUnderMouse->layoutViewItem().hitTest(result); | 326 documentUnderMouse->layoutViewItem().hitTest(result); |
327 | 327 |
328 Node* n = result.innerNode(); | 328 Node* n = result.innerNode(); |
329 while (n && !n->isElementNode()) | 329 while (n && !n->isElementNode()) |
330 n = n->parentOrShadowHostNode(); | 330 n = n->parentOrShadowHostNode(); |
331 if (n && n->isInShadowTree()) | 331 if (n && n->isInShadowTree()) |
332 n = n->shadowHost(); | 332 n = n->ownerShadowHost(); |
333 | 333 |
334 return toElement(n); | 334 return toElement(n); |
335 } | 335 } |
336 | 336 |
337 bool DragController::tryDocumentDrag(DragData* dragData, DragDestinationAction a
ctionMask, DragSession& dragSession) | 337 bool DragController::tryDocumentDrag(DragData* dragData, DragDestinationAction a
ctionMask, DragSession& dragSession) |
338 { | 338 { |
339 ASSERT(dragData); | 339 ASSERT(dragData); |
340 | 340 |
341 if (!m_documentUnderMouse) | 341 if (!m_documentUnderMouse) |
342 return false; | 342 return false; |
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
997 | 997 |
998 DEFINE_TRACE(DragController) | 998 DEFINE_TRACE(DragController) |
999 { | 999 { |
1000 visitor->trace(m_page); | 1000 visitor->trace(m_page); |
1001 visitor->trace(m_documentUnderMouse); | 1001 visitor->trace(m_documentUnderMouse); |
1002 visitor->trace(m_dragInitiator); | 1002 visitor->trace(m_dragInitiator); |
1003 visitor->trace(m_fileInputElementUnderMouse); | 1003 visitor->trace(m_fileInputElementUnderMouse); |
1004 } | 1004 } |
1005 | 1005 |
1006 } // namespace blink | 1006 } // namespace blink |
OLD | NEW |