Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(284)

Side by Side Diff: Source/core/page/FocusController.cpp

Issue 541993003: Generate focusin for input type=date/time when selected by tab (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Updated to latest master and updated test Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/html/forms/InputTypeView.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 } 155 }
156 } 156 }
157 157
158 if (LocalDOMWindow* window = document->domWindow()) 158 if (LocalDOMWindow* window = document->domWindow())
159 window->dispatchEvent(Event::create(focused ? EventTypeNames::focus : Ev entTypeNames::blur)); 159 window->dispatchEvent(Event::create(focused ? EventTypeNames::focus : Ev entTypeNames::blur));
160 if (focused && document->focusedElement()) { 160 if (focused && document->focusedElement()) {
161 RefPtrWillBeRawPtr<Element> focusedElement(document->focusedElement()); 161 RefPtrWillBeRawPtr<Element> focusedElement(document->focusedElement());
162 focusedElement->setFocus(true); 162 focusedElement->setFocus(true);
163 focusedElement->dispatchFocusEvent(0, FocusTypePage); 163 focusedElement->dispatchFocusEvent(0, FocusTypePage);
164 if (focusedElement == document->focusedElement()) { 164 if (focusedElement == document->focusedElement()) {
165 document->focusedElement()->dispatchFocusInEvent(EventTypeNames::foc usin, 0); 165 document->focusedElement()->dispatchFocusInEvent(EventTypeNames::foc usin, 0, FocusTypePage);
166 if (focusedElement == document->focusedElement()) 166 if (focusedElement == document->focusedElement())
167 document->focusedElement()->dispatchFocusInEvent(EventTypeNames: :DOMFocusIn, 0); 167 document->focusedElement()->dispatchFocusInEvent(EventTypeNames: :DOMFocusIn, 0, FocusTypePage);
168 } 168 }
169 } 169 }
170 } 170 }
171 171
172 static inline bool hasCustomFocusLogic(Element* element) 172 static inline bool hasCustomFocusLogic(Element* element)
173 { 173 {
174 return element->isHTMLElement() && toHTMLElement(element)->hasCustomFocusLog ic(); 174 return element->isHTMLElement() && toHTMLElement(element)->hasCustomFocusLog ic();
175 } 175 }
176 176
177 #if ENABLE(ASSERT) 177 #if ENABLE(ASSERT)
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 } 283 }
284 } 284 }
285 285
286 RefPtr<LocalFrame> newFocusedFrame = (frame && frame->isLocalFrame()) ? toLo calFrame(frame.get()) : 0; 286 RefPtr<LocalFrame> newFocusedFrame = (frame && frame->isLocalFrame()) ? toLo calFrame(frame.get()) : 0;
287 if (newFocusedFrame && newFocusedFrame->view()) { 287 if (newFocusedFrame && newFocusedFrame->view()) {
288 RefPtrWillBeRawPtr<Document> document = newFocusedFrame->document(); 288 RefPtrWillBeRawPtr<Document> document = newFocusedFrame->document();
289 Element* focusedElement = document ? document->focusedElement() : 0; 289 Element* focusedElement = document ? document->focusedElement() : 0;
290 if (focusedElement) { 290 if (focusedElement) {
291 focusedElement->dispatchFocusEvent(0, FocusTypePage); 291 focusedElement->dispatchFocusEvent(0, FocusTypePage);
292 if (focusedElement == document->focusedElement()) { 292 if (focusedElement == document->focusedElement()) {
293 document->focusedElement()->dispatchFocusInEvent(EventTypeNames: :focusin, 0); 293 document->focusedElement()->dispatchFocusInEvent(EventTypeNames: :focusin, 0, FocusTypePage);
294 if (focusedElement == document->focusedElement()) 294 if (focusedElement == document->focusedElement())
295 document->focusedElement()->dispatchFocusInEvent(EventTypeNa mes::DOMFocusIn, 0); 295 document->focusedElement()->dispatchFocusInEvent(EventTypeNa mes::DOMFocusIn, 0, FocusTypePage);
296 } 296 }
297 } 297 }
298 } 298 }
299 299
300 setFocusedFrame(frame); 300 setFocusedFrame(frame);
301 } 301 }
302 302
303 Frame* FocusController::focusedOrMainFrame() const 303 Frame* FocusController::focusedOrMainFrame() const
304 { 304 {
305 if (Frame* frame = focusedFrame()) 305 if (Frame* frame = focusedFrame())
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after
919 startingRect = nodeRectInAbsoluteCoordinates(container, true /* ignore b order */); 919 startingRect = nodeRectInAbsoluteCoordinates(container, true /* ignore b order */);
920 container = scrollableEnclosingBoxOrParentFrameForNodeInDirection(type, container); 920 container = scrollableEnclosingBoxOrParentFrameForNodeInDirection(type, container);
921 if (container && container->isDocumentNode()) 921 if (container && container->isDocumentNode())
922 toDocument(container)->updateLayoutIgnorePendingStylesheets(); 922 toDocument(container)->updateLayoutIgnorePendingStylesheets();
923 } while (!consumed && container); 923 } while (!consumed && container);
924 924
925 return consumed; 925 return consumed;
926 } 926 }
927 927
928 } // namespace blink 928 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/html/forms/InputTypeView.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698