Chromium Code Reviews| 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->dispatchBlurEvent(0); | 147 if (focusedElement && focusedElement->isHTMLElement()) { |
| 148 toHTMLElement(focusedElement)->setFocus(false); | |
|
tkent
2014/03/31 07:35:37
We don't need to check isHTMLElement, and don't ne
Habib Virji
2014/03/31 09:30:15
Done.
| |
| 149 } | |
| 150 if (focusedElement == document->focusedElement()) | |
|
tkent
2014/03/31 07:35:37
We don't need to check it. setFocus(false) don't
Habib Virji
2014/03/31 09:30:15
Done.
| |
| 151 focusedElement->dispatchBlurEvent(0); | |
| 148 if (focusedElement == document->focusedElement()) { | 152 if (focusedElement == document->focusedElement()) { |
| 149 focusedElement->dispatchFocusOutEvent(EventTypeNames::focusout, 0); | 153 focusedElement->dispatchFocusOutEvent(EventTypeNames::focusout, 0); |
| 150 if (focusedElement == document->focusedElement()) | 154 if (focusedElement == document->focusedElement()) |
| 151 focusedElement->dispatchFocusOutEvent(EventTypeNames::DOMFocusOu t, 0); | 155 focusedElement->dispatchFocusOutEvent(EventTypeNames::DOMFocusOu t, 0); |
| 152 } | 156 } |
| 153 } | 157 } |
| 154 | 158 |
| 155 if (DOMWindow* window = document->domWindow()) | 159 if (DOMWindow* window = document->domWindow()) |
| 156 window->dispatchEvent(Event::create(focused ? EventTypeNames::focus : Ev entTypeNames::blur)); | 160 window->dispatchEvent(Event::create(focused ? EventTypeNames::focus : Ev entTypeNames::blur)); |
| 157 if (focused && document->focusedElement()) { | 161 if (focused && document->focusedElement()) { |
| 158 RefPtr<Element> focusedElement(document->focusedElement()); | 162 RefPtr<Element> focusedElement(document->focusedElement()); |
| 159 focusedElement->dispatchFocusEvent(0, FocusTypePage); | 163 focusedElement->dispatchFocusEvent(0, FocusTypePage); |
|
tkent
2014/03/31 07:35:37
Because we called setFocus(false) on page blur, we
| |
| 160 if (focusedElement == document->focusedElement()) { | 164 if (focusedElement == document->focusedElement()) { |
| 161 document->focusedElement()->dispatchFocusInEvent(EventTypeNames::foc usin, 0); | 165 document->focusedElement()->dispatchFocusInEvent(EventTypeNames::foc usin, 0); |
| 162 if (focusedElement == document->focusedElement()) | 166 if (focusedElement == document->focusedElement()) |
| 163 document->focusedElement()->dispatchFocusInEvent(EventTypeNames: :DOMFocusIn, 0); | 167 document->focusedElement()->dispatchFocusInEvent(EventTypeNames: :DOMFocusIn, 0); |
| 164 } | 168 } |
| 165 } | 169 } |
| 166 } | 170 } |
| 167 | 171 |
| 168 static inline bool hasCustomFocusLogic(Element* element) | 172 static inline bool hasCustomFocusLogic(Element* element) |
| 169 { | 173 { |
| (...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 904 startingRect = nodeRectInAbsoluteCoordinates(container, true /* ignore b order */); | 908 startingRect = nodeRectInAbsoluteCoordinates(container, true /* ignore b order */); |
| 905 container = scrollableEnclosingBoxOrParentFrameForNodeInDirection(type, container); | 909 container = scrollableEnclosingBoxOrParentFrameForNodeInDirection(type, container); |
| 906 if (container && container->isDocumentNode()) | 910 if (container && container->isDocumentNode()) |
| 907 toDocument(container)->updateLayoutIgnorePendingStylesheets(); | 911 toDocument(container)->updateLayoutIgnorePendingStylesheets(); |
| 908 } while (!consumed && container); | 912 } while (!consumed && container); |
| 909 | 913 |
| 910 return consumed; | 914 return consumed; |
| 911 } | 915 } |
| 912 | 916 |
| 913 } // namespace WebCore | 917 } // namespace WebCore |
| OLD | NEW |