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..879a68b005adda37887ff93d310843625317bc39 100644 |
--- a/third_party/WebKit/Source/core/html/HTMLDialogElement.cpp |
+++ b/third_party/WebKit/Source/core/html/HTMLDialogElement.cpp |
@@ -32,6 +32,7 @@ |
#include "core/events/Event.h" |
#include "core/frame/FrameView.h" |
#include "core/frame/UseCounter.h" |
+#include "core/html/DialogShowParams.h" |
#include "core/html/HTMLFormControlElement.h" |
#include "core/style/ComputedStyle.h" |
@@ -138,19 +139,22 @@ void HTMLDialogElement::scheduleCloseEvent() { |
document().enqueueAnimationFrameEvent(event); |
} |
-void HTMLDialogElement::show() { |
+void HTMLDialogElement::show(const DialogShowParams& showParams) { |
if (fastHasAttribute(openAttr)) |
return; |
setBooleanAttribute(openAttr, true); |
+ if (showParams.skipInitialFocus()) |
+ return; |
+ |
// The layout must be updated here because setFocusForDialog calls |
// Element::isFocusable, which requires an up-to-date layout. |
document().updateStyleAndLayoutIgnorePendingStylesheets(); |
- |
setFocusForDialog(this); |
} |
-void HTMLDialogElement::showModal(ExceptionState& exceptionState) { |
+void HTMLDialogElement::showModal(const DialogShowParams& showParams, |
+ ExceptionState& exceptionState) { |
if (fastHasAttribute(openAttr)) { |
exceptionState.throwDOMException(InvalidStateError, |
"The element already has an 'open' " |
@@ -173,6 +177,10 @@ void HTMLDialogElement::showModal(ExceptionState& exceptionState) { |
inertSubtreesChanged(document()); |
forceLayoutForCentering(); |
+ |
+ if (showParams.skipInitialFocus()) |
+ return; |
+ |
setFocusForDialog(this); |
} |