forked from mirrors/gecko-dev
		
	Bug 1888776 - Add invoke defaults for dialog elements r=dom-core,sefeng
Differential Revision: https://phabricator.services.mozilla.com/D206185
This commit is contained in:
		
							parent
							
								
									2ca6aa8f02
								
							
						
					
					
						commit
						74d3d7787c
					
				
					 3 changed files with 38 additions and 123 deletions
				
			
		|  | @ -192,6 +192,39 @@ void HTMLDialogElement::RunCancelDialogSteps() { | |||
|   } | ||||
| } | ||||
| 
 | ||||
| bool HTMLDialogElement::IsValidInvokeAction(InvokeAction aAction) const { | ||||
|   return nsGenericHTMLElement::IsValidInvokeAction(aAction) || | ||||
|          aAction == InvokeAction::ShowModal || aAction == InvokeAction::Close; | ||||
| } | ||||
| 
 | ||||
| bool HTMLDialogElement::HandleInvokeInternal(Element* aInvoker, | ||||
|                                              InvokeAction aAction, | ||||
|                                              ErrorResult& aRv) { | ||||
|   if (nsGenericHTMLElement::HandleInvokeInternal(aInvoker, aAction, aRv)) { | ||||
|     return true; | ||||
|   } | ||||
| 
 | ||||
|   MOZ_ASSERT(IsValidInvokeAction(aAction)); | ||||
| 
 | ||||
|   const bool actionMayClose = | ||||
|       aAction == InvokeAction::Auto || aAction == InvokeAction::Close; | ||||
|   const bool actionMayOpen = | ||||
|       aAction == InvokeAction::Auto || aAction == InvokeAction::ShowModal; | ||||
| 
 | ||||
|   if (actionMayClose && Open()) { | ||||
|     Optional<nsAString> retValue; | ||||
|     Close(retValue); | ||||
|     return true; | ||||
|   } | ||||
| 
 | ||||
|   if (IsInComposedDoc() && !Open() && actionMayOpen) { | ||||
|     ShowModal(aRv); | ||||
|     return true; | ||||
|   } | ||||
| 
 | ||||
|   return false; | ||||
| } | ||||
| 
 | ||||
| JSObject* HTMLDialogElement::WrapNode(JSContext* aCx, | ||||
|                                       JS::Handle<JSObject*> aGivenProto) { | ||||
|   return HTMLDialogElement_Binding::Wrap(aCx, this, aGivenProto); | ||||
|  |  | |||
|  | @ -49,6 +49,11 @@ class HTMLDialogElement final : public nsGenericHTMLElement { | |||
| 
 | ||||
|   int32_t TabIndexDefault() override; | ||||
| 
 | ||||
|   bool IsValidInvokeAction(InvokeAction aAction) const override; | ||||
|   MOZ_CAN_RUN_SCRIPT bool HandleInvokeInternal(Element* invoker, | ||||
|                                                InvokeAction aAction, | ||||
|                                                ErrorResult& aRv) override; | ||||
| 
 | ||||
|   nsString mReturnValue; | ||||
| 
 | ||||
|  protected: | ||||
|  |  | |||
|  | @ -1,123 +0,0 @@ | |||
| [invoketarget-on-dialog-behavior.tentative.html] | ||||
|   [invoking (with invokeaction property as auto) closed dialog opens as modal] | ||||
|     expected: FAIL | ||||
| 
 | ||||
|   [invoking (with invokeaction property as auto) while changing action still opens as modal] | ||||
|     expected: FAIL | ||||
| 
 | ||||
|   [invoking (with invokeaction attribute as auto) closed dialog opens as modal] | ||||
|     expected: FAIL | ||||
| 
 | ||||
|   [invoking (with invokeaction attribute as auto) while changing action still opens as modal] | ||||
|     expected: FAIL | ||||
| 
 | ||||
|   [invoking (with invokeaction property as explicit empty) closed dialog opens as modal] | ||||
|     expected: FAIL | ||||
| 
 | ||||
|   [invoking (with invokeaction property as explicit empty) while changing action still opens as modal] | ||||
|     expected: FAIL | ||||
| 
 | ||||
|   [invoking (with invokeaction attribute as explicit empty) closed dialog opens as modal] | ||||
|     expected: FAIL | ||||
| 
 | ||||
|   [invoking (with invokeaction attribute as explicit empty) while changing action still opens as modal] | ||||
|     expected: FAIL | ||||
| 
 | ||||
|   [invoking (with invokeaction property as showmodal) closed dialog opens as modal] | ||||
|     expected: FAIL | ||||
| 
 | ||||
|   [invoking (with invokeaction property as showmodal) while changing action still opens as modal] | ||||
|     expected: FAIL | ||||
| 
 | ||||
|   [invoking (with invokeaction attribute as showmodal) closed dialog opens as modal] | ||||
|     expected: FAIL | ||||
| 
 | ||||
|   [invoking (with invokeaction attribute as showmodal) while changing action still opens as modal] | ||||
|     expected: FAIL | ||||
| 
 | ||||
|   [invoking (with invokeaction property as sHoWmOdAl) closed dialog opens as modal] | ||||
|     expected: FAIL | ||||
| 
 | ||||
|   [invoking (with invokeaction property as sHoWmOdAl) while changing action still opens as modal] | ||||
|     expected: FAIL | ||||
| 
 | ||||
|   [invoking (with invokeaction attribute as sHoWmOdAl) closed dialog opens as modal] | ||||
|     expected: FAIL | ||||
| 
 | ||||
|   [invoking (with invokeaction attribute as sHoWmOdAl) while changing action still opens as modal] | ||||
|     expected: FAIL | ||||
| 
 | ||||
|   [invoking to close (with invokeaction property as auto) open dialog closes] | ||||
|     expected: FAIL | ||||
| 
 | ||||
|   [invoking to close (with invokeaction property as auto) open dialog while changing action still closes] | ||||
|     expected: FAIL | ||||
| 
 | ||||
|   [invoking to close (with invokeaction property as auto) open modal dialog while changing action still closes] | ||||
|     expected: FAIL | ||||
| 
 | ||||
|   [invoking to close (with invokeaction attribute as auto) open dialog closes] | ||||
|     expected: FAIL | ||||
| 
 | ||||
|   [invoking to close (with invokeaction attribute as auto) open dialog while changing action still closes] | ||||
|     expected: FAIL | ||||
| 
 | ||||
|   [invoking to close (with invokeaction attribute as auto) open modal dialog while changing action still closes] | ||||
|     expected: FAIL | ||||
| 
 | ||||
|   [invoking to close (with invokeaction property as explicit empty) open dialog closes] | ||||
|     expected: FAIL | ||||
| 
 | ||||
|   [invoking to close (with invokeaction property as explicit empty) open dialog while changing action still closes] | ||||
|     expected: FAIL | ||||
| 
 | ||||
|   [invoking to close (with invokeaction property as explicit empty) open modal dialog while changing action still closes] | ||||
|     expected: FAIL | ||||
| 
 | ||||
|   [invoking to close (with invokeaction attribute as explicit empty) open dialog closes] | ||||
|     expected: FAIL | ||||
| 
 | ||||
|   [invoking to close (with invokeaction attribute as explicit empty) open dialog while changing action still closes] | ||||
|     expected: FAIL | ||||
| 
 | ||||
|   [invoking to close (with invokeaction attribute as explicit empty) open modal dialog while changing action still closes] | ||||
|     expected: FAIL | ||||
| 
 | ||||
|   [invoking to close (with invokeaction property as close) open dialog closes] | ||||
|     expected: FAIL | ||||
| 
 | ||||
|   [invoking to close (with invokeaction property as close) open dialog while changing action still closes] | ||||
|     expected: FAIL | ||||
| 
 | ||||
|   [invoking to close (with invokeaction property as close) open modal dialog while changing action still closes] | ||||
|     expected: FAIL | ||||
| 
 | ||||
|   [invoking to close (with invokeaction attribute as close) open dialog closes] | ||||
|     expected: FAIL | ||||
| 
 | ||||
|   [invoking to close (with invokeaction attribute as close) open dialog while changing action still closes] | ||||
|     expected: FAIL | ||||
| 
 | ||||
|   [invoking to close (with invokeaction attribute as close) open modal dialog while changing action still closes] | ||||
|     expected: FAIL | ||||
| 
 | ||||
|   [invoking to close (with invokeaction property as cLoSe) open dialog closes] | ||||
|     expected: FAIL | ||||
| 
 | ||||
|   [invoking to close (with invokeaction property as cLoSe) open dialog while changing action still closes] | ||||
|     expected: FAIL | ||||
| 
 | ||||
|   [invoking to close (with invokeaction property as cLoSe) open modal dialog while changing action still closes] | ||||
|     expected: FAIL | ||||
| 
 | ||||
|   [invoking to close (with invokeaction attribute as cLoSe) open dialog closes] | ||||
|     expected: FAIL | ||||
| 
 | ||||
|   [invoking to close (with invokeaction attribute as cLoSe) open dialog while changing action still closes] | ||||
|     expected: FAIL | ||||
| 
 | ||||
|   [invoking to close (with invokeaction attribute as cLoSe) open modal dialog while changing action still closes] | ||||
|     expected: FAIL | ||||
| 
 | ||||
|   [invoking (as showmodal) closed popover dialog opens as modal] | ||||
|     expected: FAIL | ||||
		Loading…
	
		Reference in a new issue
	
	 keithamus
						keithamus