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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
47 #include "core/editing/markup.h" | 47 #include "core/editing/markup.h" |
48 #include "core/events/TextEvent.h" | 48 #include "core/events/TextEvent.h" |
49 #include "core/fetch/ImageResource.h" | 49 #include "core/fetch/ImageResource.h" |
50 #include "core/fetch/ResourceFetcher.h" | 50 #include "core/fetch/ResourceFetcher.h" |
51 #include "core/frame/FrameView.h" | 51 #include "core/frame/FrameView.h" |
52 #include "core/frame/LocalFrame.h" | 52 #include "core/frame/LocalFrame.h" |
53 #include "core/html/HTMLAnchorElement.h" | 53 #include "core/html/HTMLAnchorElement.h" |
54 #include "core/html/HTMLFormElement.h" | 54 #include "core/html/HTMLFormElement.h" |
55 #include "core/html/HTMLInputElement.h" | 55 #include "core/html/HTMLInputElement.h" |
56 #include "core/html/HTMLPlugInElement.h" | 56 #include "core/html/HTMLPlugInElement.h" |
57 #include "core/html/forms/FileInputType.h" | |
tkent
2014/11/17 05:21:37
Please do not include FileInputType.h here. *Inpu
hirono
2014/11/17 05:59:25
Done.
| |
57 #include "core/loader/FrameLoadRequest.h" | 58 #include "core/loader/FrameLoadRequest.h" |
58 #include "core/loader/FrameLoader.h" | 59 #include "core/loader/FrameLoader.h" |
59 #include "core/page/DragClient.h" | 60 #include "core/page/DragClient.h" |
60 #include "core/page/DragData.h" | 61 #include "core/page/DragData.h" |
61 #include "core/page/DragSession.h" | 62 #include "core/page/DragSession.h" |
62 #include "core/page/DragState.h" | 63 #include "core/page/DragState.h" |
63 #include "core/page/EventHandler.h" | 64 #include "core/page/EventHandler.h" |
64 #include "core/page/Page.h" | 65 #include "core/page/Page.h" |
65 #include "core/frame/Settings.h" | 66 #include "core/frame/Settings.h" |
66 #include "core/rendering/HitTestRequest.h" | 67 #include "core/rendering/HitTestRequest.h" |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
378 } | 379 } |
379 | 380 |
380 if (!m_fileInputElementUnderMouse) | 381 if (!m_fileInputElementUnderMouse) |
381 m_page->dragCaretController().setCaretPosition(m_documentUnderMouse- >frame()->visiblePositionForPoint(point)); | 382 m_page->dragCaretController().setCaretPosition(m_documentUnderMouse- >frame()->visiblePositionForPoint(point)); |
382 | 383 |
383 LocalFrame* innerFrame = element->document().frame(); | 384 LocalFrame* innerFrame = element->document().frame(); |
384 dragSession.operation = dragIsMove(innerFrame->selection(), dragData) ? DragOperationMove : DragOperationCopy; | 385 dragSession.operation = dragIsMove(innerFrame->selection(), dragData) ? DragOperationMove : DragOperationCopy; |
385 dragSession.mouseIsOverFileInput = m_fileInputElementUnderMouse; | 386 dragSession.mouseIsOverFileInput = m_fileInputElementUnderMouse; |
386 dragSession.numberOfItemsToBeAccepted = 0; | 387 dragSession.numberOfItemsToBeAccepted = 0; |
387 | 388 |
388 unsigned numberOfFiles = dragData->numberOfFiles(); | 389 Vector<String> paths; |
390 FileInputType::getAcceptableDropFileNames(*dragData, &paths); | |
391 const unsigned numberOfFiles = paths.size(); | |
389 if (m_fileInputElementUnderMouse) { | 392 if (m_fileInputElementUnderMouse) { |
390 if (m_fileInputElementUnderMouse->isDisabledFormControl()) | 393 if (m_fileInputElementUnderMouse->isDisabledFormControl()) |
391 dragSession.numberOfItemsToBeAccepted = 0; | 394 dragSession.numberOfItemsToBeAccepted = 0; |
392 else if (m_fileInputElementUnderMouse->multiple()) | 395 else if (m_fileInputElementUnderMouse->multiple()) |
393 dragSession.numberOfItemsToBeAccepted = numberOfFiles; | 396 dragSession.numberOfItemsToBeAccepted = numberOfFiles; |
394 else if (numberOfFiles > 1) | 397 else if (numberOfFiles == 1) |
398 dragSession.numberOfItemsToBeAccepted = 1; | |
399 else | |
395 dragSession.numberOfItemsToBeAccepted = 0; | 400 dragSession.numberOfItemsToBeAccepted = 0; |
396 else | |
397 dragSession.numberOfItemsToBeAccepted = 1; | |
398 | 401 |
399 if (!dragSession.numberOfItemsToBeAccepted) | 402 if (!dragSession.numberOfItemsToBeAccepted) |
400 dragSession.operation = DragOperationNone; | 403 dragSession.operation = DragOperationNone; |
401 m_fileInputElementUnderMouse->setCanReceiveDroppedFiles(dragSession. numberOfItemsToBeAccepted); | 404 m_fileInputElementUnderMouse->setCanReceiveDroppedFiles(dragSession. numberOfItemsToBeAccepted); |
402 } else { | 405 } else { |
403 // We are not over a file input element. The dragged item(s) will on ly | 406 // We are not over a file input element. The dragged item(s) will on ly |
404 // be loaded into the view the number of dragged items is 1. | 407 // be loaded into the view the number of dragged items is 1. |
405 dragSession.numberOfItemsToBeAccepted = numberOfFiles != 1 ? 0 : 1; | 408 dragSession.numberOfItemsToBeAccepted = numberOfFiles != 1 ? 0 : 1; |
406 } | 409 } |
407 | 410 |
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
984 | 987 |
985 void DragController::trace(Visitor* visitor) | 988 void DragController::trace(Visitor* visitor) |
986 { | 989 { |
987 visitor->trace(m_page); | 990 visitor->trace(m_page); |
988 visitor->trace(m_documentUnderMouse); | 991 visitor->trace(m_documentUnderMouse); |
989 visitor->trace(m_dragInitiator); | 992 visitor->trace(m_dragInitiator); |
990 visitor->trace(m_fileInputElementUnderMouse); | 993 visitor->trace(m_fileInputElementUnderMouse); |
991 } | 994 } |
992 | 995 |
993 } // namespace blink | 996 } // namespace blink |
OLD | NEW |