OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. |
3 * Copyright (C) 2008 Nuanti Ltd. | 3 * Copyright (C) 2008 Nuanti Ltd. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 // https://bugs.webkit.org/show_bug.cgi?id=27105 | 137 // https://bugs.webkit.org/show_bug.cgi?id=27105 |
138 | 138 |
139 // Do not fire events while modal dialogs are up. See https://bugs.webkit.o
rg/show_bug.cgi?id=33962 | 139 // Do not fire events while modal dialogs are up. See https://bugs.webkit.o
rg/show_bug.cgi?id=33962 |
140 if (Page* page = document->page()) { | 140 if (Page* page = document->page()) { |
141 if (page->defersLoading()) | 141 if (page->defersLoading()) |
142 return; | 142 return; |
143 } | 143 } |
144 | 144 |
145 if (!focused && document->focusedElement()) { | 145 if (!focused && document->focusedElement()) { |
146 RefPtr<Element> focusedElement(document->focusedElement()); | 146 RefPtr<Element> focusedElement(document->focusedElement()); |
| 147 focusedElement->setFocus(false); |
147 focusedElement->dispatchBlurEvent(0); | 148 focusedElement->dispatchBlurEvent(0); |
148 if (focusedElement == document->focusedElement()) { | 149 if (focusedElement == document->focusedElement()) { |
149 focusedElement->dispatchFocusOutEvent(EventTypeNames::focusout, 0); | 150 focusedElement->dispatchFocusOutEvent(EventTypeNames::focusout, 0); |
150 if (focusedElement == document->focusedElement()) | 151 if (focusedElement == document->focusedElement()) |
151 focusedElement->dispatchFocusOutEvent(EventTypeNames::DOMFocusOu
t, 0); | 152 focusedElement->dispatchFocusOutEvent(EventTypeNames::DOMFocusOu
t, 0); |
152 } | 153 } |
153 } | 154 } |
154 | 155 |
155 if (DOMWindow* window = document->domWindow()) | 156 if (DOMWindow* window = document->domWindow()) |
156 window->dispatchEvent(Event::create(focused ? EventTypeNames::focus : Ev
entTypeNames::blur)); | 157 window->dispatchEvent(Event::create(focused ? EventTypeNames::focus : Ev
entTypeNames::blur)); |
157 if (focused && document->focusedElement()) { | 158 if (focused && document->focusedElement()) { |
158 RefPtr<Element> focusedElement(document->focusedElement()); | 159 RefPtr<Element> focusedElement(document->focusedElement()); |
| 160 focusedElement->setFocus(true); |
159 focusedElement->dispatchFocusEvent(0, FocusTypePage); | 161 focusedElement->dispatchFocusEvent(0, FocusTypePage); |
160 if (focusedElement == document->focusedElement()) { | 162 if (focusedElement == document->focusedElement()) { |
161 document->focusedElement()->dispatchFocusInEvent(EventTypeNames::foc
usin, 0); | 163 document->focusedElement()->dispatchFocusInEvent(EventTypeNames::foc
usin, 0); |
162 if (focusedElement == document->focusedElement()) | 164 if (focusedElement == document->focusedElement()) |
163 document->focusedElement()->dispatchFocusInEvent(EventTypeNames:
:DOMFocusIn, 0); | 165 document->focusedElement()->dispatchFocusInEvent(EventTypeNames:
:DOMFocusIn, 0); |
164 } | 166 } |
165 } | 167 } |
166 } | 168 } |
167 | 169 |
168 static inline bool hasCustomFocusLogic(Element* element) | 170 static inline bool hasCustomFocusLogic(Element* element) |
(...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
904 startingRect = nodeRectInAbsoluteCoordinates(container, true /* ignore b
order */); | 906 startingRect = nodeRectInAbsoluteCoordinates(container, true /* ignore b
order */); |
905 container = scrollableEnclosingBoxOrParentFrameForNodeInDirection(type,
container); | 907 container = scrollableEnclosingBoxOrParentFrameForNodeInDirection(type,
container); |
906 if (container && container->isDocumentNode()) | 908 if (container && container->isDocumentNode()) |
907 toDocument(container)->updateLayoutIgnorePendingStylesheets(); | 909 toDocument(container)->updateLayoutIgnorePendingStylesheets(); |
908 } while (!consumed && container); | 910 } while (!consumed && container); |
909 | 911 |
910 return consumed; | 912 return consumed; |
911 } | 913 } |
912 | 914 |
913 } // namespace WebCore | 915 } // namespace WebCore |
OLD | NEW |