Commit fd4eaf27 authored by Dmitry Gozman's avatar Dmitry Gozman Committed by Commit Bot

Remove blink::DragSession

It's not really used, we can use DragOperation instead.

Change-Id: I85b997c9534dc7ce6522a9806a4d7bc4e8f82642
Reviewed-on: https://chromium-review.googlesource.com/1058589Reviewed-by: default avatarPhilip Rogers <pdr@chromium.org>
Commit-Queue: Dmitry Gozman <dgozman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#558844}
parent b493560e
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
#include "third_party/blink/renderer/core/page/drag_actions.h" #include "third_party/blink/renderer/core/page/drag_actions.h"
#include "third_party/blink/renderer/core/page/drag_controller.h" #include "third_party/blink/renderer/core/page/drag_controller.h"
#include "third_party/blink/renderer/core/page/drag_data.h" #include "third_party/blink/renderer/core/page/drag_data.h"
#include "third_party/blink/renderer/core/page/drag_session.h"
#include "third_party/blink/renderer/core/page/focus_controller.h" #include "third_party/blink/renderer/core/page/focus_controller.h"
#include "third_party/blink/renderer/core/page/page.h" #include "third_party/blink/renderer/core/page/page.h"
#include "third_party/blink/renderer/core/page/pointer_lock_controller.h" #include "third_party/blink/renderer/core/page/pointer_lock_controller.h"
...@@ -238,18 +237,16 @@ WebDragOperation WebFrameWidgetBase::DragTargetDragEnterOrOver( ...@@ -238,18 +237,16 @@ WebDragOperation WebFrameWidgetBase::DragTargetDragEnterOrOver(
screen_point, screen_point,
static_cast<DragOperation>(operations_allowed_)); static_cast<DragOperation>(operations_allowed_));
DragSession drag_session; DragOperation drag_operation =
drag_session = GetPage()->GetDragController().DragEnteredOrUpdated( GetPage()->GetDragController().DragEnteredOrUpdated(
&drag_data, *local_root_->GetFrame()); &drag_data, *local_root_->GetFrame());
DragOperation drop_effect = drag_session.operation; // Mask the drag operation against the drag source's allowed
// Mask the drop effect operation against the drag source's allowed
// operations. // operations.
if (!(drop_effect & drag_data.DraggingSourceOperationMask())) if (!(drag_operation & drag_data.DraggingSourceOperationMask()))
drop_effect = kDragOperationNone; drag_operation = kDragOperationNone;
drag_operation_ = static_cast<WebDragOperation>(drop_effect); drag_operation_ = static_cast<WebDragOperation>(drag_operation);
return drag_operation_; return drag_operation_;
} }
......
...@@ -22,7 +22,6 @@ blink_core_sources("page") { ...@@ -22,7 +22,6 @@ blink_core_sources("page") {
"drag_controller.h", "drag_controller.h",
"drag_data.cc", "drag_data.cc",
"drag_data.h", "drag_data.h",
"drag_session.h",
"drag_state.h", "drag_state.h",
"event_with_hit_test_results.h", "event_with_hit_test_results.h",
"focus_changed_observer.cc", "focus_changed_observer.cc",
......
...@@ -76,7 +76,6 @@ ...@@ -76,7 +76,6 @@
#include "third_party/blink/renderer/core/loader/resource/image_resource_content.h" #include "third_party/blink/renderer/core/loader/resource/image_resource_content.h"
#include "third_party/blink/renderer/core/page/chrome_client.h" #include "third_party/blink/renderer/core/page/chrome_client.h"
#include "third_party/blink/renderer/core/page/drag_data.h" #include "third_party/blink/renderer/core/page/drag_data.h"
#include "third_party/blink/renderer/core/page/drag_session.h"
#include "third_party/blink/renderer/core/page/drag_state.h" #include "third_party/blink/renderer/core/page/drag_state.h"
#include "third_party/blink/renderer/core/page/page.h" #include "third_party/blink/renderer/core/page/page.h"
#include "third_party/blink/renderer/core/svg/graphics/svg_image_for_container.h" #include "third_party/blink/renderer/core/svg/graphics/svg_image_for_container.h"
...@@ -319,7 +318,7 @@ void DragController::MouseMovedIntoDocument(Document* new_document) { ...@@ -319,7 +318,7 @@ void DragController::MouseMovedIntoDocument(Document* new_document) {
document_under_mouse_ = new_document; document_under_mouse_ = new_document;
} }
DragSession DragController::DragEnteredOrUpdated(DragData* drag_data, DragOperation DragController::DragEnteredOrUpdated(DragData* drag_data,
LocalFrame& local_root) { LocalFrame& local_root) {
DCHECK(drag_data); DCHECK(drag_data);
...@@ -333,13 +332,13 @@ DragSession DragController::DragEnteredOrUpdated(DragData* drag_data, ...@@ -333,13 +332,13 @@ DragSession DragController::DragEnteredOrUpdated(DragData* drag_data,
: static_cast<DragDestinationAction>(kDragDestinationActionDHTML | : static_cast<DragDestinationAction>(kDragDestinationActionDHTML |
kDragDestinationActionEdit); kDragDestinationActionEdit);
DragSession drag_session; DragOperation drag_operation = kDragOperationNone;
document_is_handling_drag_ = TryDocumentDrag( document_is_handling_drag_ = TryDocumentDrag(
drag_data, drag_destination_action_, drag_session, local_root); drag_data, drag_destination_action_, drag_operation, local_root);
if (!document_is_handling_drag_ && if (!document_is_handling_drag_ &&
(drag_destination_action_ & kDragDestinationActionLoad)) (drag_destination_action_ & kDragDestinationActionLoad))
drag_session.operation = OperationForLoad(drag_data, local_root); drag_operation = OperationForLoad(drag_data, local_root);
return drag_session; return drag_operation;
} }
static HTMLInputElement* AsFileInput(Node* node) { static HTMLInputElement* AsFileInput(Node* node) {
...@@ -370,7 +369,7 @@ static Element* ElementUnderMouse(Document* document_under_mouse, ...@@ -370,7 +369,7 @@ static Element* ElementUnderMouse(Document* document_under_mouse,
bool DragController::TryDocumentDrag(DragData* drag_data, bool DragController::TryDocumentDrag(DragData* drag_data,
DragDestinationAction action_mask, DragDestinationAction action_mask,
DragSession& drag_session, DragOperation& drag_operation,
LocalFrame& local_root) { LocalFrame& local_root) {
DCHECK(drag_data); DCHECK(drag_data);
...@@ -383,8 +382,7 @@ bool DragController::TryDocumentDrag(DragData* drag_data, ...@@ -383,8 +382,7 @@ bool DragController::TryDocumentDrag(DragData* drag_data,
bool is_handling_drag = false; bool is_handling_drag = false;
if (action_mask & kDragDestinationActionDHTML) { if (action_mask & kDragDestinationActionDHTML) {
is_handling_drag = is_handling_drag = TryDHTMLDrag(drag_data, drag_operation, local_root);
TryDHTMLDrag(drag_data, drag_session.operation, local_root);
// Do not continue if m_documentUnderMouse has been reset by tryDHTMLDrag. // Do not continue if m_documentUnderMouse has been reset by tryDHTMLDrag.
// tryDHTMLDrag fires dragenter event. The event listener that listens // tryDHTMLDrag fires dragenter event. The event listener that listens
// to this event may create a nested run loop (open a modal dialog), // to this event may create a nested run loop (open a modal dialog),
...@@ -426,32 +424,20 @@ bool DragController::TryDocumentDrag(DragData* drag_data, ...@@ -426,32 +424,20 @@ bool DragController::TryDocumentDrag(DragData* drag_data,
} }
LocalFrame* inner_frame = element->GetDocument().GetFrame(); LocalFrame* inner_frame = element->GetDocument().GetFrame();
drag_session.operation = DragIsMove(inner_frame->Selection(), drag_data) drag_operation = DragIsMove(inner_frame->Selection(), drag_data)
? kDragOperationMove ? kDragOperationMove
: kDragOperationCopy; : kDragOperationCopy;
drag_session.mouse_is_over_file_input = file_input_element_under_mouse_;
drag_session.number_of_items_to_be_accepted = 0;
const unsigned number_of_files = drag_data->NumberOfFiles();
if (file_input_element_under_mouse_) { if (file_input_element_under_mouse_) {
if (file_input_element_under_mouse_->IsDisabledFormControl()) bool can_receive_dropped_files = false;
drag_session.number_of_items_to_be_accepted = 0; if (!file_input_element_under_mouse_->IsDisabledFormControl()) {
else if (file_input_element_under_mouse_->Multiple()) can_receive_dropped_files = file_input_element_under_mouse_->Multiple()
drag_session.number_of_items_to_be_accepted = number_of_files; ? drag_data->NumberOfFiles() > 0
else if (number_of_files == 1) : drag_data->NumberOfFiles() == 1;
drag_session.number_of_items_to_be_accepted = 1; }
else if (!can_receive_dropped_files)
drag_session.number_of_items_to_be_accepted = 0; drag_operation = kDragOperationNone;
if (!drag_session.number_of_items_to_be_accepted)
drag_session.operation = kDragOperationNone;
file_input_element_under_mouse_->SetCanReceiveDroppedFiles( file_input_element_under_mouse_->SetCanReceiveDroppedFiles(
drag_session.number_of_items_to_be_accepted); can_receive_dropped_files);
} else {
// We are not over a file input element. The dragged item(s) will only
// be loaded into the view the number of dragged items is 1.
drag_session.number_of_items_to_be_accepted =
number_of_files != 1 ? 0 : 1;
} }
return true; return true;
......
...@@ -41,7 +41,6 @@ class DataTransfer; ...@@ -41,7 +41,6 @@ class DataTransfer;
class Document; class Document;
class DragData; class DragData;
class DragImage; class DragImage;
struct DragSession;
class DragState; class DragState;
class LocalFrame; class LocalFrame;
class FloatRect; class FloatRect;
...@@ -56,7 +55,7 @@ class CORE_EXPORT DragController final ...@@ -56,7 +55,7 @@ class CORE_EXPORT DragController final
public: public:
static DragController* Create(Page*); static DragController* Create(Page*);
DragSession DragEnteredOrUpdated(DragData*, LocalFrame& local_root); DragOperation DragEnteredOrUpdated(DragData*, LocalFrame& local_root);
void DragExited(DragData*, LocalFrame& local_root); void DragExited(DragData*, LocalFrame& local_root);
void PerformDrag(DragData*, LocalFrame& local_root); void PerformDrag(DragData*, LocalFrame& local_root);
...@@ -99,7 +98,7 @@ class CORE_EXPORT DragController final ...@@ -99,7 +98,7 @@ class CORE_EXPORT DragController final
DragOperation OperationForLoad(DragData*, LocalFrame& local_root); DragOperation OperationForLoad(DragData*, LocalFrame& local_root);
bool TryDocumentDrag(DragData*, bool TryDocumentDrag(DragData*,
DragDestinationAction, DragDestinationAction,
DragSession&, DragOperation&,
LocalFrame& local_root); LocalFrame& local_root);
bool TryDHTMLDrag(DragData*, DragOperation&, LocalFrame& local_root); bool TryDHTMLDrag(DragData*, DragOperation&, LocalFrame& local_root);
DragOperation GetDragOperation(DragData*); DragOperation GetDragOperation(DragData*);
......
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
#include "third_party/blink/renderer/core/frame/visual_viewport.h" #include "third_party/blink/renderer/core/frame/visual_viewport.h"
#include "third_party/blink/renderer/core/page/autoscroll_controller.h" #include "third_party/blink/renderer/core/page/autoscroll_controller.h"
#include "third_party/blink/renderer/core/page/drag_data.h" #include "third_party/blink/renderer/core/page/drag_data.h"
#include "third_party/blink/renderer/core/page/drag_session.h"
#include "third_party/blink/renderer/core/page/drag_state.h" #include "third_party/blink/renderer/core/page/drag_state.h"
#include "third_party/blink/renderer/core/testing/core_unit_test_helper.h" #include "third_party/blink/renderer/core/testing/core_unit_test_helper.h"
#include "third_party/blink/renderer/core/testing/sim/sim_request.h" #include "third_party/blink/renderer/core/testing/sim/sim_request.h"
......
/*
* Copyright (C) 2011 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_PAGE_DRAG_SESSION_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_PAGE_DRAG_SESSION_H_
#include "third_party/blink/renderer/core/page/drag_actions.h"
#include "third_party/blink/renderer/platform/wtf/allocator.h"
namespace blink {
struct DragSession {
STACK_ALLOCATED();
DragOperation operation;
bool mouse_is_over_file_input;
unsigned number_of_items_to_be_accepted;
DragSession()
: operation(kDragOperationNone),
mouse_is_over_file_input(false),
number_of_items_to_be_accepted(0) {}
};
} // namespace blink
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment