| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/input/MouseEventManager.h" | 5 #include "core/input/MouseEventManager.h" |
| 6 | 6 |
| 7 #include "core/clipboard/DataObject.h" | 7 #include "core/clipboard/DataObject.h" |
| 8 #include "core/clipboard/DataTransfer.h" | 8 #include "core/clipboard/DataTransfer.h" |
| 9 #include "core/dom/Element.h" | 9 #include "core/dom/Element.h" |
| 10 #include "core/dom/ElementTraversal.h" | 10 #include "core/dom/ElementTraversal.h" |
| (...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 424 | 424 |
| 425 // To fix <rdar://problem/4895428> Can't drag selected ToDo, we don't focus | 425 // To fix <rdar://problem/4895428> Can't drag selected ToDo, we don't focus |
| 426 // a node on mouse down if it's selected and inside a focused node. It will | 426 // a node on mouse down if it's selected and inside a focused node. It will |
| 427 // be focused if the user does a mouseup over it, however, because the | 427 // be focused if the user does a mouseup over it, however, because the |
| 428 // mouseup will set a selection inside it, which will call | 428 // mouseup will set a selection inside it, which will call |
| 429 // FrameSelection::setFocusedNodeIfNeeded. | 429 // FrameSelection::setFocusedNodeIfNeeded. |
| 430 if (element && | 430 if (element && |
| 431 m_frame->selection() | 431 m_frame->selection() |
| 432 .computeVisibleSelectionInDOMTreeDeprecated() | 432 .computeVisibleSelectionInDOMTreeDeprecated() |
| 433 .isRange()) { | 433 .isRange()) { |
| 434 // TODO(yosin) We should not create |Range| object for calling | 434 const EphemeralRange& range = |
| 435 // |isNodeFullyContained()|. | 435 m_frame->selection() |
| 436 if (createRange(m_frame->selection() | 436 .computeVisibleSelectionInDOMTreeDeprecated() |
| 437 .computeVisibleSelectionInDOMTreeDeprecated() | 437 .toNormalizedEphemeralRange(); |
| 438 .toNormalizedEphemeralRange()) | 438 if (isNodeFullyContained(range, *element) && |
| 439 ->isNodeFullyContained(*element) && | |
| 440 element->isDescendantOf(m_frame->document()->focusedElement())) | 439 element->isDescendantOf(m_frame->document()->focusedElement())) |
| 441 return WebInputEventResult::NotHandled; | 440 return WebInputEventResult::NotHandled; |
| 442 } | 441 } |
| 443 | 442 |
| 444 // Only change the focus when clicking scrollbars if it can transfered to a | 443 // Only change the focus when clicking scrollbars if it can transfered to a |
| 445 // mouse focusable node. | 444 // mouse focusable node. |
| 446 if (!element && hitTestResult.scrollbar()) | 445 if (!element && hitTestResult.scrollbar()) |
| 447 return WebInputEventResult::HandledSystem; | 446 return WebInputEventResult::HandledSystem; |
| 448 | 447 |
| 449 if (Page* page = m_frame->page()) { | 448 if (Page* page = m_frame->page()) { |
| (...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1022 | 1021 |
| 1023 void MouseEventManager::setClickCount(int clickCount) { | 1022 void MouseEventManager::setClickCount(int clickCount) { |
| 1024 m_clickCount = clickCount; | 1023 m_clickCount = clickCount; |
| 1025 } | 1024 } |
| 1026 | 1025 |
| 1027 bool MouseEventManager::mouseDownMayStartDrag() { | 1026 bool MouseEventManager::mouseDownMayStartDrag() { |
| 1028 return m_mouseDownMayStartDrag; | 1027 return m_mouseDownMayStartDrag; |
| 1029 } | 1028 } |
| 1030 | 1029 |
| 1031 } // namespace blink | 1030 } // namespace blink |
| OLD | NEW |