Commit 2c485f8e authored by Darwin Huang's avatar Darwin Huang Committed by Commit Bot

Drag and Drop: Refactor: Fixed up spelling/grammar and function naming

simple spelling/grammar fixes
renamed some functions

Bug: N/A
Change-Id: Ia753e830bbc06632e24a5812c970efda82110c5b
Reviewed-on: https://chromium-review.googlesource.com/c/1278286
Commit-Queue: Darwin Huang <huangdarwin@chromium.org>
Reviewed-by: default avatarVictor Costan <pwnall@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#599344}
parent 3b54b6aa
...@@ -639,7 +639,7 @@ class CONTENT_EXPORT RenderWidget ...@@ -639,7 +639,7 @@ class CONTENT_EXPORT RenderWidget
void DidToggleFullscreen(); void DidToggleFullscreen();
// Returns a rect that the compositor needs to raster. For a main frame this // Returns a rect that the compositor needs to raster. For a main frame this
// is always the entire viewprot, but for out-of-process iframes this can be // is always the entire viewport, but for out-of-process iframes this can be
// constrained to limit overdraw. // constrained to limit overdraw.
gfx::Rect ViewportVisibleRect(); gfx::Rect ViewportVisibleRect();
......
...@@ -282,7 +282,8 @@ bool ContainerNode::EnsurePreInsertionValidity( ...@@ -282,7 +282,8 @@ bool ContainerNode::EnsurePreInsertionValidity(
} }
// We need this extra structural check because prior DOM mutation operations // We need this extra structural check because prior DOM mutation operations
// dispatched synchronous events, and their handlers might modified DOM trees. // dispatched synchronous events, so their handlers may have modified DOM
// trees.
bool ContainerNode::RecheckNodeInsertionStructuralPrereq( bool ContainerNode::RecheckNodeInsertionStructuralPrereq(
const NodeVector& new_children, const NodeVector& new_children,
const Node* next, const Node* next,
...@@ -622,13 +623,13 @@ void ContainerNode::WillRemoveChild(Node& child) { ...@@ -622,13 +623,13 @@ void ContainerNode::WillRemoveChild(Node& child) {
DispatchChildRemovalEvents(child); DispatchChildRemovalEvents(child);
ChildFrameDisconnector(child).Disconnect(); ChildFrameDisconnector(child).Disconnect();
if (GetDocument() != child.GetDocument()) { if (GetDocument() != child.GetDocument()) {
// |child| was moved another document by DOM mutation event handler. // |child| was moved to another document by the DOM mutation event handler.
return; return;
} }
// |nodeWillBeRemoved()| must be run after |ChildFrameDisconnector|, because // |nodeWillBeRemoved()| must be run after |ChildFrameDisconnector|, because
// |ChildFrameDisconnector| can run script which may cause state that is to // |ChildFrameDisconnector| may remove the node, resulting in an invalid
// be invalidated by removing the node. // state.
ScriptForbiddenScope script_forbidden_scope; ScriptForbiddenScope script_forbidden_scope;
EventDispatchForbiddenScope assert_no_event_dispatch; EventDispatchForbiddenScope assert_no_event_dispatch;
// e.g. mutation event listener can create a new range. // e.g. mutation event listener can create a new range.
......
...@@ -512,7 +512,7 @@ class CORE_EXPORT Node : public EventTarget { ...@@ -512,7 +512,7 @@ class CORE_EXPORT Node : public EventTarget {
// Please don't use this function. // Please don't use this function.
// Background: When we investigated the usage of (old) UpdateDistribution, // Background: When we investigated the usage of (old) UpdateDistribution,
// some caller's intents were unclear. Thus, we had to introduce this funtion // some caller's intents were unclear. Thus, we had to introduce this function
// for the sake of safety. If we can figure out the intent of each caller, we // for the sake of safety. If we can figure out the intent of each caller, we
// can replace that with calling UpdateDistributionForFlatTreeTraversal (or // can replace that with calling UpdateDistributionForFlatTreeTraversal (or
// just RecalcSlotAssignments()) on a case-by-case basis. // just RecalcSlotAssignments()) on a case-by-case basis.
......
...@@ -195,7 +195,7 @@ void WebFrameWidgetBase::DragSourceSystemDragEnded() { ...@@ -195,7 +195,7 @@ void WebFrameWidgetBase::DragSourceSystemDragEnded() {
} }
void WebFrameWidgetBase::CancelDrag() { void WebFrameWidgetBase::CancelDrag() {
// It's possible for us this to be callback while we're not doing a drag if // It's possible for this to be called while we're not doing a drag if
// it's from a previous page that got unloaded. // it's from a previous page that got unloaded.
if (!doing_drag_and_drop_) if (!doing_drag_and_drop_)
return; return;
......
...@@ -161,8 +161,8 @@ Node::InsertionNotificationRequest PickerIndicatorElement::InsertedInto( ...@@ -161,8 +161,8 @@ Node::InsertionNotificationRequest PickerIndicatorElement::InsertedInto(
void PickerIndicatorElement::DidNotifySubtreeInsertionsToDocument() { void PickerIndicatorElement::DidNotifySubtreeInsertionsToDocument() {
if (!GetDocument().ExistingAXObjectCache()) if (!GetDocument().ExistingAXObjectCache())
return; return;
// Don't make this focusable if we are in layout tests in order to avoid to // Don't make this focusable if we are in layout tests in order to avoid
// break existing tests. // breaking existing tests.
// FIXME: We should have a way to disable accessibility in layout tests. // FIXME: We should have a way to disable accessibility in layout tests.
if (LayoutTestSupport::IsRunningLayoutTest()) if (LayoutTestSupport::IsRunningLayoutTest())
return; return;
......
...@@ -116,7 +116,7 @@ void MouseEventManager::Clear() { ...@@ -116,7 +116,7 @@ void MouseEventManager::Clear() {
svg_pan_ = false; svg_pan_ = false;
drag_start_pos_ = LayoutPoint(); drag_start_pos_ = LayoutPoint();
fake_mouse_move_event_timer_.Stop(); fake_mouse_move_event_timer_.Stop();
ResetDragState(); ResetDragSource();
ClearDragDataTransfer(); ClearDragDataTransfer();
} }
...@@ -662,7 +662,7 @@ WebInputEventResult MouseEventManager::HandleMousePressEvent( ...@@ -662,7 +662,7 @@ WebInputEventResult MouseEventManager::HandleMousePressEvent(
const MouseEventWithHitTestResults& event) { const MouseEventWithHitTestResults& event) {
TRACE_EVENT0("blink", "MouseEventManager::handleMousePressEvent"); TRACE_EVENT0("blink", "MouseEventManager::handleMousePressEvent");
ResetDragState(); ResetDragSource();
CancelFakeMouseMoveEvent(); CancelFakeMouseMoveEvent();
frame_->GetDocument()->UpdateStyleAndLayoutIgnorePendingStylesheets(); frame_->GetDocument()->UpdateStyleAndLayoutIgnorePendingStylesheets();
...@@ -762,7 +762,7 @@ bool MouseEventManager::HandleDragDropIfPossible( ...@@ -762,7 +762,7 @@ bool MouseEventManager::HandleDragDropIfPossible(
EventHandlingUtil::PerformMouseEventHitTest(frame_, request, EventHandlingUtil::PerformMouseEventHitTest(frame_, request,
mouse_drag_event); mouse_drag_event);
mouse_down_may_start_drag_ = true; mouse_down_may_start_drag_ = true;
ResetDragState(); ResetDragSource();
mouse_down_pos_ = frame_->View()->ConvertFromRootFrame( mouse_down_pos_ = frame_->View()->ConvertFromRootFrame(
FlooredIntPoint(mouse_drag_event.PositionInRootFrame())); FlooredIntPoint(mouse_drag_event.PositionInRootFrame()));
return HandleDrag(mev, DragInitiator::kTouch); return HandleDrag(mev, DragInitiator::kTouch);
...@@ -895,7 +895,7 @@ bool MouseEventManager::HandleDrag(const MouseEventWithHitTestResults& event, ...@@ -895,7 +895,7 @@ bool MouseEventManager::HandleDrag(const MouseEventWithHitTestResults& event,
frame_, node, mouse_down_pos_, selection_drag_policy, frame_, node, mouse_down_pos_, selection_drag_policy,
GetDragState().drag_type_); GetDragState().drag_type_);
} else { } else {
ResetDragState(); ResetDragSource();
} }
if (!GetDragState().drag_src_) if (!GetDragState().drag_src_)
...@@ -913,7 +913,7 @@ bool MouseEventManager::HandleDrag(const MouseEventWithHitTestResults& event, ...@@ -913,7 +913,7 @@ bool MouseEventManager::HandleDrag(const MouseEventWithHitTestResults& event,
if (initiator == DragInitiator::kMouse && if (initiator == DragInitiator::kMouse &&
!DragThresholdExceeded( !DragThresholdExceeded(
FlooredIntPoint(event.Event().PositionInRootFrame()))) { FlooredIntPoint(event.Event().PositionInRootFrame()))) {
ResetDragState(); ResetDragSource();
return true; return true;
} }
...@@ -924,7 +924,7 @@ bool MouseEventManager::HandleDrag(const MouseEventWithHitTestResults& event, ...@@ -924,7 +924,7 @@ bool MouseEventManager::HandleDrag(const MouseEventWithHitTestResults& event,
if (!TryStartDrag(event)) { if (!TryStartDrag(event)) {
// Something failed to start the drag, clean up. // Something failed to start the drag, clean up.
ClearDragDataTransfer(); ClearDragDataTransfer();
ResetDragState(); ResetDragSource();
} else { } else {
// Since drag operation started we need to send a pointercancel for the // Since drag operation started we need to send a pointercancel for the
// corresponding pointer. // corresponding pointer.
...@@ -1084,7 +1084,7 @@ void MouseEventManager::DragSourceEndedAt(const WebMouseEvent& event, ...@@ -1084,7 +1084,7 @@ void MouseEventManager::DragSourceEndedAt(const WebMouseEvent& event,
DispatchDragSrcEvent(EventTypeNames::dragend, event); DispatchDragSrcEvent(EventTypeNames::dragend, event);
} }
ClearDragDataTransfer(); ClearDragDataTransfer();
ResetDragState(); ResetDragSource();
// In case the drag was ended due to an escape key press we need to ensure // In case the drag was ended due to an escape key press we need to ensure
// that consecutive mousemove events don't reinitiate the drag and drop. // that consecutive mousemove events don't reinitiate the drag and drop.
mouse_down_may_start_drag_ = false; mouse_down_may_start_drag_ = false;
...@@ -1095,7 +1095,7 @@ DragState& MouseEventManager::GetDragState() { ...@@ -1095,7 +1095,7 @@ DragState& MouseEventManager::GetDragState() {
return frame_->GetPage()->GetDragController().GetDragState(); return frame_->GetPage()->GetDragController().GetDragState();
} }
void MouseEventManager::ResetDragState() { void MouseEventManager::ResetDragSource() {
if (!frame_->GetPage()) if (!frame_->GetPage())
return; return;
GetDragState().drag_src_ = nullptr; GetDragState().drag_src_ = nullptr;
......
...@@ -199,7 +199,7 @@ class CORE_EXPORT MouseEventManager final ...@@ -199,7 +199,7 @@ class CORE_EXPORT MouseEventManager final
void ClearDragDataTransfer(); void ClearDragDataTransfer();
DataTransfer* CreateDraggingDataTransfer() const; DataTransfer* CreateDraggingDataTransfer() const;
void ResetDragState(); void ResetDragSource();
// Implementations of |SynchronousMutationObserver| // Implementations of |SynchronousMutationObserver|
void NodeChildrenWillBeRemoved(ContainerNode&) final; void NodeChildrenWillBeRemoved(ContainerNode&) final;
......
...@@ -207,9 +207,7 @@ bool DragController::DragIsMove(FrameSelection& selection, ...@@ -207,9 +207,7 @@ bool DragController::DragIsMove(FrameSelection& selection,
!IsCopyKeyDown(drag_data); !IsCopyKeyDown(drag_data);
} }
// FIXME: This method is poorly named. We're just clearing the selection from void DragController::ClearDragCaret() {
// the document this drag is exiting.
void DragController::CancelDrag() {
page_->GetDragCaret().Clear(); page_->GetDragCaret().Clear();
} }
...@@ -277,7 +275,7 @@ void DragController::PerformDrag(DragData* drag_data, LocalFrame& local_root) { ...@@ -277,7 +275,7 @@ void DragController::PerformDrag(DragData* drag_data, LocalFrame& local_root) {
} }
if (prevented_default) { if (prevented_default) {
document_under_mouse_ = nullptr; document_under_mouse_ = nullptr;
CancelDrag(); ClearDragCaret();
return; return;
} }
} }
...@@ -318,7 +316,7 @@ void DragController::MouseMovedIntoDocument(Document* new_document) { ...@@ -318,7 +316,7 @@ void DragController::MouseMovedIntoDocument(Document* new_document) {
// If we were over another document clear the selection // If we were over another document clear the selection
if (document_under_mouse_) if (document_under_mouse_)
CancelDrag(); ClearDragCaret();
document_under_mouse_ = new_document; document_under_mouse_ = new_document;
} }
......
...@@ -102,7 +102,8 @@ class CORE_EXPORT DragController final ...@@ -102,7 +102,8 @@ class CORE_EXPORT DragController final
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*);
void CancelDrag(); // Clear the selection from the document this drag is exiting.
void ClearDragCaret();
bool DragIsMove(FrameSelection&, DragData*); bool DragIsMove(FrameSelection&, DragData*);
bool IsCopyKeyDown(DragData*); bool IsCopyKeyDown(DragData*);
......
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