| 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 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 | 425 |
| 426 if (Page* page = m_frame->page()) { | 426 if (Page* page = m_frame->page()) { |
| 427 // If focus shift is blocked, we eat the event. Note we should never | 427 // If focus shift is blocked, we eat the event. Note we should never |
| 428 // clear swallowEvent if the page already set it (e.g., by canceling | 428 // clear swallowEvent if the page already set it (e.g., by canceling |
| 429 // default behavior). | 429 // default behavior). |
| 430 if (element) { | 430 if (element) { |
| 431 if (slideFocusOnShadowHostIfNecessary(*element)) | 431 if (slideFocusOnShadowHostIfNecessary(*element)) |
| 432 return WebInputEventResult::HandledSystem; | 432 return WebInputEventResult::HandledSystem; |
| 433 if (!page->focusController().setFocusedElement( | 433 if (!page->focusController().setFocusedElement( |
| 434 element, m_frame, | 434 element, m_frame, |
| 435 FocusParams(SelectionBehaviorOnFocus::None, WebFocusTypeMouse, | 435 FocusParams(SelectionBehaviorOnFocus::Restore, WebFocusTypeMouse, |
| 436 sourceCapabilities))) | 436 sourceCapabilities))) |
| 437 return WebInputEventResult::HandledSystem; | 437 return WebInputEventResult::HandledSystem; |
| 438 } else { | 438 } else { |
| 439 // We call setFocusedElement even with !element in order to blur | 439 // We call setFocusedElement even with !element in order to blur |
| 440 // current focus element when a link is clicked; this is expected by | 440 // current focus element when a link is clicked; this is expected by |
| 441 // some sites that rely on onChange handlers running from form | 441 // some sites that rely on onChange handlers running from form |
| 442 // fields before the button click is processed. | 442 // fields before the button click is processed. |
| 443 if (!page->focusController().setFocusedElement( | 443 if (!page->focusController().setFocusedElement( |
| 444 nullptr, m_frame, | 444 nullptr, m_frame, |
| 445 FocusParams(SelectionBehaviorOnFocus::None, WebFocusTypeNone, | 445 FocusParams(SelectionBehaviorOnFocus::Restore, WebFocusTypeNone, |
| 446 sourceCapabilities))) | 446 sourceCapabilities))) |
| 447 return WebInputEventResult::HandledSystem; | 447 return WebInputEventResult::HandledSystem; |
| 448 } | 448 } |
| 449 } | 449 } |
| 450 | 450 |
| 451 return WebInputEventResult::NotHandled; | 451 return WebInputEventResult::NotHandled; |
| 452 } | 452 } |
| 453 | 453 |
| 454 bool MouseEventManager::slideFocusOnShadowHostIfNecessary( | 454 bool MouseEventManager::slideFocusOnShadowHostIfNecessary( |
| 455 const Element& element) { | 455 const Element& element) { |
| (...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 996 | 996 |
| 997 void MouseEventManager::setClickCount(int clickCount) { | 997 void MouseEventManager::setClickCount(int clickCount) { |
| 998 m_clickCount = clickCount; | 998 m_clickCount = clickCount; |
| 999 } | 999 } |
| 1000 | 1000 |
| 1001 bool MouseEventManager::mouseDownMayStartDrag() { | 1001 bool MouseEventManager::mouseDownMayStartDrag() { |
| 1002 return m_mouseDownMayStartDrag; | 1002 return m_mouseDownMayStartDrag; |
| 1003 } | 1003 } |
| 1004 | 1004 |
| 1005 } // namespace blink | 1005 } // namespace blink |
| OLD | NEW |