OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv
ed. | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv
ed. |
3 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 3 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
4 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) | 4 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
8 * are met: | 8 * are met: |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 case DispatchEventResult::CanceledBeforeDispatch: | 387 case DispatchEventResult::CanceledBeforeDispatch: |
388 return WebInputEventResult::HandledSuppressed; | 388 return WebInputEventResult::HandledSuppressed; |
389 default: | 389 default: |
390 ASSERT_NOT_REACHED(); | 390 ASSERT_NOT_REACHED(); |
391 return WebInputEventResult::HandledSystem; | 391 return WebInputEventResult::HandledSystem; |
392 } | 392 } |
393 } | 393 } |
394 | 394 |
395 void EventHandler::nodeWillBeRemoved(Node& nodeToBeRemoved) | 395 void EventHandler::nodeWillBeRemoved(Node& nodeToBeRemoved) |
396 { | 396 { |
397 if (nodeToBeRemoved.containsIncludingShadowDOM(m_clickNode.get())) { | 397 if (nodeToBeRemoved.isShadowIncludingInclusiveAncestorOf(m_clickNode.get()))
{ |
398 // We don't dispatch click events if the mousedown node is removed | 398 // We don't dispatch click events if the mousedown node is removed |
399 // before a mouseup event. It is compatible with IE and Firefox. | 399 // before a mouseup event. It is compatible with IE and Firefox. |
400 m_clickNode = nullptr; | 400 m_clickNode = nullptr; |
401 } | 401 } |
402 } | 402 } |
403 | 403 |
404 WebInputEventResult EventHandler::handleMousePressEvent(const MouseEventWithHitT
estResults& event) | 404 WebInputEventResult EventHandler::handleMousePressEvent(const MouseEventWithHitT
estResults& event) |
405 { | 405 { |
406 TRACE_EVENT0("blink", "EventHandler::handleMousePressEvent"); | 406 TRACE_EVENT0("blink", "EventHandler::handleMousePressEvent"); |
407 | 407 |
(...skipping 1368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1776 } | 1776 } |
1777 } | 1777 } |
1778 | 1778 |
1779 return WebInputEventResult::NotHandled; | 1779 return WebInputEventResult::NotHandled; |
1780 } | 1780 } |
1781 | 1781 |
1782 bool EventHandler::slideFocusOnShadowHostIfNecessary(const Element& element) | 1782 bool EventHandler::slideFocusOnShadowHostIfNecessary(const Element& element) |
1783 { | 1783 { |
1784 if (element.authorShadowRoot() && element.authorShadowRoot()->delegatesFocus
()) { | 1784 if (element.authorShadowRoot() && element.authorShadowRoot()->delegatesFocus
()) { |
1785 Document* doc = m_frame->document(); | 1785 Document* doc = m_frame->document(); |
1786 if (element.containsIncludingShadowDOM(doc->focusedElement())) { | 1786 if (element.isShadowIncludingInclusiveAncestorOf(doc->focusedElement()))
{ |
1787 // If the inner element is already focused, do nothing. | 1787 // If the inner element is already focused, do nothing. |
1788 return true; | 1788 return true; |
1789 } | 1789 } |
1790 | 1790 |
1791 // If the host has a focusable inner element, focus it. Otherwise, the h
ost takes focus. | 1791 // If the host has a focusable inner element, focus it. Otherwise, the h
ost takes focus. |
1792 Page* page = m_frame->page(); | 1792 Page* page = m_frame->page(); |
1793 ASSERT(page); | 1793 ASSERT(page); |
1794 Element* found = page->focusController().findFocusableElementInShadowHos
t(element); | 1794 Element* found = page->focusController().findFocusableElementInShadowHos
t(element); |
1795 if (found && element.containsIncludingShadowDOM(found)) { | 1795 if (found && element.isShadowIncludingInclusiveAncestorOf(found)) { |
1796 // Use WebFocusTypeForward instead of WebFocusTypeMouse here to mean
the focus has slided. | 1796 // Use WebFocusTypeForward instead of WebFocusTypeMouse here to mean
the focus has slided. |
1797 found->focus(FocusParams(SelectionBehaviorOnFocus::Reset, WebFocusTy
peForward, nullptr)); | 1797 found->focus(FocusParams(SelectionBehaviorOnFocus::Reset, WebFocusTy
peForward, nullptr)); |
1798 return true; | 1798 return true; |
1799 } | 1799 } |
1800 } | 1800 } |
1801 return false; | 1801 return false; |
1802 } | 1802 } |
1803 | 1803 |
1804 WebInputEventResult EventHandler::handleWheelEvent(const PlatformWheelEvent& eve
nt) | 1804 WebInputEventResult EventHandler::handleWheelEvent(const PlatformWheelEvent& eve
nt) |
1805 { | 1805 { |
(...skipping 2200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4006 PlatformEvent::Modifiers EventHandler::accessKeyModifiers() | 4006 PlatformEvent::Modifiers EventHandler::accessKeyModifiers() |
4007 { | 4007 { |
4008 #if OS(MACOSX) | 4008 #if OS(MACOSX) |
4009 return static_cast<PlatformEvent::Modifiers>(PlatformEvent::CtrlKey | Platfo
rmEvent::AltKey); | 4009 return static_cast<PlatformEvent::Modifiers>(PlatformEvent::CtrlKey | Platfo
rmEvent::AltKey); |
4010 #else | 4010 #else |
4011 return PlatformEvent::AltKey; | 4011 return PlatformEvent::AltKey; |
4012 #endif | 4012 #endif |
4013 } | 4013 } |
4014 | 4014 |
4015 } // namespace blink | 4015 } // namespace blink |
OLD | NEW |