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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLDialogElement.cpp

Issue 2125893003: HTMLDialogElement#showModal() should ignore unfocusable elements with [autofocus] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update dialog-autofocus-multiple-times.html Created 4 years, 5 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 | « third_party/WebKit/LayoutTests/fast/dom/HTMLDialogElement/dialog-autofocus-multiple-times.html ('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) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 if (isHTMLDialogElement(*node)) 48 if (isHTMLDialogElement(*node))
49 next = NodeTraversal::nextSkippingChildren(*node, dialog); 49 next = NodeTraversal::nextSkippingChildren(*node, dialog);
50 else 50 else
51 next = NodeTraversal::next(*node, dialog); 51 next = NodeTraversal::next(*node, dialog);
52 52
53 if (!node->isElementNode()) 53 if (!node->isElementNode())
54 continue; 54 continue;
55 Element* element = toElement(node); 55 Element* element = toElement(node);
56 if (element->isFormControlElement()) { 56 if (element->isFormControlElement()) {
57 HTMLFormControlElement* control = toHTMLFormControlElement(node); 57 HTMLFormControlElement* control = toHTMLFormControlElement(node);
58 if (control->isAutofocusable()) { 58 if (control->isAutofocusable() && control->isFocusable()) {
59 control->focus(); 59 control->focus();
60 return; 60 return;
61 } 61 }
62 } 62 }
63 if (!focusableDescendant && element->isFocusable()) 63 if (!focusableDescendant && element->isFocusable())
64 focusableDescendant = element; 64 focusableDescendant = element;
65 } 65 }
66 66
67 if (focusableDescendant) { 67 if (focusableDescendant) {
68 focusableDescendant->focus(); 68 focusableDescendant->focus();
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 { 201 {
202 if (event->type() == EventTypeNames::cancel) { 202 if (event->type() == EventTypeNames::cancel) {
203 closeDialog(); 203 closeDialog();
204 event->setDefaultHandled(); 204 event->setDefaultHandled();
205 return; 205 return;
206 } 206 }
207 HTMLElement::defaultEventHandler(event); 207 HTMLElement::defaultEventHandler(event);
208 } 208 }
209 209
210 } // namespace blink 210 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/dom/HTMLDialogElement/dialog-autofocus-multiple-times.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698