OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2001 Peter Kelly (pmk@post.com) | 4 * (C) 2001 Peter Kelly (pmk@post.com) |
5 * (C) 2001 Dirk Mueller (mueller@kde.org) | 5 * (C) 2001 Dirk Mueller (mueller@kde.org) |
6 * (C) 2007 David Smith (catfish.man@gmail.com) | 6 * (C) 2007 David Smith (catfish.man@gmail.com) |
7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. | 7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. |
8 * All rights reserved. | 8 * All rights reserved. |
9 * (C) 2007 Eric Seidel (eric@webkit.org) | 9 * (C) 2007 Eric Seidel (eric@webkit.org) |
10 * | 10 * |
(...skipping 2640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2651 if (authorShadowRoot() && authorShadowRoot()->delegatesFocus()) { | 2651 if (authorShadowRoot() && authorShadowRoot()->delegatesFocus()) { |
2652 if (isShadowIncludingInclusiveAncestorOf(document().focusedElement())) | 2652 if (isShadowIncludingInclusiveAncestorOf(document().focusedElement())) |
2653 return; | 2653 return; |
2654 | 2654 |
2655 // Slide the focus to its inner node. | 2655 // Slide the focus to its inner node. |
2656 Element* found = | 2656 Element* found = |
2657 document().page()->focusController().findFocusableElementInShadowHost( | 2657 document().page()->focusController().findFocusableElementInShadowHost( |
2658 *this); | 2658 *this); |
2659 if (found && isShadowIncludingInclusiveAncestorOf(found)) { | 2659 if (found && isShadowIncludingInclusiveAncestorOf(found)) { |
2660 found->focus(FocusParams(SelectionBehaviorOnFocus::Reset, | 2660 found->focus(FocusParams(SelectionBehaviorOnFocus::Reset, |
2661 WebFocusTypeForward, nullptr)); | 2661 WebFocusTypeForward, |
| 2662 InputDeviceCapabilities::Null)); |
2662 return; | 2663 return; |
2663 } | 2664 } |
2664 } | 2665 } |
2665 | 2666 |
2666 if (!document().page()->focusController().setFocusedElement( | 2667 if (!document().page()->focusController().setFocusedElement( |
2667 this, document().frame(), params)) | 2668 this, document().frame(), params)) |
2668 return; | 2669 return; |
2669 | 2670 |
2670 if (document().focusedElement() == this && | 2671 if (document().focusedElement() == this && |
2671 document().frame()->hasReceivedUserGesture()) { | 2672 document().frame()->hasReceivedUserGesture()) { |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2778 | 2779 |
2779 bool Element::isFocusedElementInDocument() const { | 2780 bool Element::isFocusedElementInDocument() const { |
2780 return this == document().focusedElement(); | 2781 return this == document().focusedElement(); |
2781 } | 2782 } |
2782 | 2783 |
2783 Element* Element::adjustedFocusedElementInTreeScope() const { | 2784 Element* Element::adjustedFocusedElementInTreeScope() const { |
2784 return isInTreeScope() ? containingTreeScope().adjustedFocusedElement() | 2785 return isInTreeScope() ? containingTreeScope().adjustedFocusedElement() |
2785 : nullptr; | 2786 : nullptr; |
2786 } | 2787 } |
2787 | 2788 |
2788 void Element::dispatchFocusEvent(Element* oldFocusedElement, | 2789 void Element::dispatchFocusEvent( |
2789 WebFocusType type, | 2790 Element* oldFocusedElement, |
2790 InputDeviceCapabilities* sourceCapabilities) { | 2791 WebFocusType type, |
| 2792 const InputDeviceCapabilitiesValue& sourceCapabilities) { |
2791 dispatchEvent(FocusEvent::create(EventTypeNames::focus, false, false, | 2793 dispatchEvent(FocusEvent::create(EventTypeNames::focus, false, false, |
2792 document().domWindow(), 0, oldFocusedElement, | 2794 document().domWindow(), 0, oldFocusedElement, |
2793 sourceCapabilities)); | 2795 sourceCapabilities)); |
2794 } | 2796 } |
2795 | 2797 |
2796 void Element::dispatchBlurEvent(Element* newFocusedElement, | 2798 void Element::dispatchBlurEvent( |
2797 WebFocusType type, | 2799 Element* newFocusedElement, |
2798 InputDeviceCapabilities* sourceCapabilities) { | 2800 WebFocusType type, |
| 2801 const InputDeviceCapabilitiesValue& sourceCapabilities) { |
2799 dispatchEvent(FocusEvent::create(EventTypeNames::blur, false, false, | 2802 dispatchEvent(FocusEvent::create(EventTypeNames::blur, false, false, |
2800 document().domWindow(), 0, newFocusedElement, | 2803 document().domWindow(), 0, newFocusedElement, |
2801 sourceCapabilities)); | 2804 sourceCapabilities)); |
2802 } | 2805 } |
2803 | 2806 |
2804 void Element::dispatchFocusInEvent( | 2807 void Element::dispatchFocusInEvent( |
2805 const AtomicString& eventType, | 2808 const AtomicString& eventType, |
2806 Element* oldFocusedElement, | 2809 Element* oldFocusedElement, |
2807 WebFocusType, | 2810 WebFocusType, |
2808 InputDeviceCapabilities* sourceCapabilities) { | 2811 const InputDeviceCapabilitiesValue& sourceCapabilities) { |
2809 #if DCHECK_IS_ON() | 2812 #if DCHECK_IS_ON() |
2810 DCHECK(!EventDispatchForbiddenScope::isEventDispatchForbidden()); | 2813 DCHECK(!EventDispatchForbiddenScope::isEventDispatchForbidden()); |
2811 #endif | 2814 #endif |
2812 DCHECK(eventType == EventTypeNames::focusin || | 2815 DCHECK(eventType == EventTypeNames::focusin || |
2813 eventType == EventTypeNames::DOMFocusIn); | 2816 eventType == EventTypeNames::DOMFocusIn); |
2814 dispatchScopedEvent( | 2817 dispatchScopedEvent( |
2815 FocusEvent::create(eventType, true, false, document().domWindow(), 0, | 2818 FocusEvent::create(eventType, true, false, document().domWindow(), 0, |
2816 oldFocusedElement, sourceCapabilities)); | 2819 oldFocusedElement, sourceCapabilities)); |
2817 } | 2820 } |
2818 | 2821 |
2819 void Element::dispatchFocusOutEvent( | 2822 void Element::dispatchFocusOutEvent( |
2820 const AtomicString& eventType, | 2823 const AtomicString& eventType, |
2821 Element* newFocusedElement, | 2824 Element* newFocusedElement, |
2822 InputDeviceCapabilities* sourceCapabilities) { | 2825 const InputDeviceCapabilitiesValue& sourceCapabilities) { |
2823 #if DCHECK_IS_ON() | 2826 #if DCHECK_IS_ON() |
2824 DCHECK(!EventDispatchForbiddenScope::isEventDispatchForbidden()); | 2827 DCHECK(!EventDispatchForbiddenScope::isEventDispatchForbidden()); |
2825 #endif | 2828 #endif |
2826 DCHECK(eventType == EventTypeNames::focusout || | 2829 DCHECK(eventType == EventTypeNames::focusout || |
2827 eventType == EventTypeNames::DOMFocusOut); | 2830 eventType == EventTypeNames::DOMFocusOut); |
2828 dispatchScopedEvent( | 2831 dispatchScopedEvent( |
2829 FocusEvent::create(eventType, true, false, document().domWindow(), 0, | 2832 FocusEvent::create(eventType, true, false, document().domWindow(), 0, |
2830 newFocusedElement, sourceCapabilities)); | 2833 newFocusedElement, sourceCapabilities)); |
2831 } | 2834 } |
2832 | 2835 |
(...skipping 1301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4134 } | 4137 } |
4135 | 4138 |
4136 DEFINE_TRACE_WRAPPERS(Element) { | 4139 DEFINE_TRACE_WRAPPERS(Element) { |
4137 if (hasRareData()) { | 4140 if (hasRareData()) { |
4138 visitor->traceWrappers(elementRareData()); | 4141 visitor->traceWrappers(elementRareData()); |
4139 } | 4142 } |
4140 ContainerNode::traceWrappers(visitor); | 4143 ContainerNode::traceWrappers(visitor); |
4141 } | 4144 } |
4142 | 4145 |
4143 } // namespace blink | 4146 } // namespace blink |
OLD | NEW |