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

Unified Diff: third_party/WebKit/Source/core/html/HTMLDialogElement.cpp

Issue 2715793003: Allow an element in shadow tree in <dialog> to be initially focused. (Closed)
Patch Set: Add another test case. Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/html/dialog/shadowdom-in-dialog.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/html/HTMLDialogElement.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLDialogElement.cpp b/third_party/WebKit/Source/core/html/HTMLDialogElement.cpp
index 9edc5883e4ea38e02f6a61618fe0434fdac93113..39ed61e731d906bb083d42dbcd7e6e6bc98b0fd6 100644
--- a/third_party/WebKit/Source/core/html/HTMLDialogElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLDialogElement.cpp
@@ -28,7 +28,7 @@
#include "bindings/core/v8/ExceptionState.h"
#include "core/dom/AXObjectCache.h"
#include "core/dom/ExceptionCode.h"
-#include "core/dom/NodeTraversal.h"
+#include "core/dom/shadow/FlatTreeTraversal.h"
#include "core/events/Event.h"
#include "core/frame/FrameView.h"
#include "core/frame/UseCounter.h"
@@ -42,13 +42,16 @@ using namespace HTMLNames;
// This function chooses the focused element when show() or showModal() is
// invoked, as described in their spec.
static void setFocusForDialog(HTMLDialogElement* dialog) {
- Element* focusableDescendant = 0;
- Node* next = 0;
- for (Node* node = dialog->firstChild(); node; node = next) {
- if (isHTMLDialogElement(*node))
- next = NodeTraversal::nextSkippingChildren(*node, dialog);
- else
- next = NodeTraversal::next(*node, dialog);
+ Element* focusableDescendant = nullptr;
+ Node* next = nullptr;
+
+ // TODO(kochi): Use FlatTreeTraversal for finding focusable element in Shadow
Dan Beam 2017/02/27 04:16:25 i think this is kinda of confusing, because it see
kochi 2017/02/28 06:10:28 Thanks for the feedback, updated the comment.
+ // DOM, which is not yet specified. See crbug/383230 and
+ // https://github.com/whatwg/html/issue/2393 .
+ for (Node* node = FlatTreeTraversal::firstChild(*dialog); node; node = next) {
hayato 2017/02/28 06:12:36 Distribution is not dirty here? If it is dirty, it
+ next = isHTMLDialogElement(*node)
+ ? FlatTreeTraversal::nextSkippingChildren(*node, dialog)
+ : FlatTreeTraversal::next(*node, dialog);
if (!node->isElementNode())
continue;
« no previous file with comments | « third_party/WebKit/LayoutTests/html/dialog/shadowdom-in-dialog.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698