diff --git a/dom/html/nsGenericHTMLElement.cpp b/dom/html/nsGenericHTMLElement.cpp index 75abd0985d712..fc04c4466966a 100644 --- a/dom/html/nsGenericHTMLElement.cpp +++ b/dom/html/nsGenericHTMLElement.cpp @@ -4568,38 +4568,29 @@ AfterSetPopoverAttr ( ) { -const -nsAttrValue -* -newValue -= -GetParsedAttr -( -nsGkAtoms -: -: -popover -) -; -const -PopoverAttributeState -newState +auto +mapPopoverState = [ -& -newValue ] ( +const +nsAttrValue +* +value ) +- +> +PopoverAttributeState { if ( -newValue +value ) { MOZ_ASSERT ( -newValue +value - > Type @@ -4622,7 +4613,7 @@ static_cast PopoverAttributeKeyword > ( -newValue +value - > GetEnumValue @@ -4682,7 +4673,19 @@ PopoverAttributeState None ; } +; +PopoverAttributeState +newState += +mapPopoverState ( +GetParsedAttr +( +nsGkAtoms +: +: +popover +) ) ; const @@ -4701,15 +4704,19 @@ newState oldState ) { -EnsurePopoverData +PopoverPseudoStateUpdate ( +false +true ) -. -SetPopoverAttributeState +; +if +( +IsPopoverOpen ( -newState ) -; +) +{ HidePopoverInternal ( / @@ -4733,36 +4740,52 @@ IgnoreErrors ; / / -In -case -HidePopoverInternal -changed -the -state -keep +Event +handlers +could +have +removed the -corresponding +popover +attribute +or +changed / / -changes -and -don -' -t -overwrite -anything -here +its +value . -if -( +/ +/ +https +: +/ +/ +github +. +com +/ +whatwg +/ +html +/ +issues +/ +9034 newState = -= -GetPopoverAttributeState +mapPopoverState +( +GetParsedAttr ( +nsGkAtoms +: +: +popover ) ) -{ +; +} if ( newState @@ -4778,49 +4801,25 @@ None / HidePopoverInternal above -didn -' -t -remove +could +have +removed the -element +popover from the top / / layer -because -in -that -call -the -element -' -s -popover -attribute -state -/ -/ -was -already -None . -Revisit -this -when -the -spec -is -corrected -/ -/ +if +( +GetPopoverData ( -bug -1835811 ) -. +) +{ OwnerDoc ( ) @@ -4832,6 +4831,7 @@ RemovePopoverFromTopLayer this ) ; +} ClearPopoverData ( ) @@ -4859,16 +4859,18 @@ ShowPopup ( ) ? -PopoverPseudoStateUpdate +EnsurePopoverData ( -false -true +) +. +SetPopoverAttributeState +( +newState ) ; } } } -} void nsGenericHTMLElement : @@ -20980,24 +20982,8 @@ ErrorResult aRv ) { -const -PopoverData -* -data -= -GetPopoverData -( -) -; if ( -! -data -| -| -data -- -> GetPopoverAttributeState ( ) @@ -21009,18 +20995,6 @@ PopoverAttributeState None ) { -MOZ_ASSERT -( -! -HasAttr -( -nsGkAtoms -: -: -popover -) -) -; aRv . ThrowNotSupportedError @@ -21040,20 +21014,11 @@ return false ; } -MOZ_ASSERT +if ( -HasAttr +GetPopoverData ( -nsGkAtoms -: -: -popover -) ) -; -if -( -data - > GetPopoverVisibilityState diff --git a/testing/web-platform/meta/html/semantics/popovers/popover-attribute-basic.html.ini b/testing/web-platform/meta/html/semantics/popovers/popover-attribute-basic.html.ini index f86ff65dd6a65..05fb9ee2da133 100644 --- a/testing/web-platform/meta/html/semantics/popovers/popover-attribute-basic.html.ini +++ b/testing/web-platform/meta/html/semantics/popovers/popover-attribute-basic.html.ini @@ -12,726 +12,6 @@ Changing a popover from -auto -to -undefined -( -via -attr -) -and -then -auto -during -' -beforetoggle -' -works -] -expected -: -FAIL -[ -Changing -a -popover -from -auto -to -undefined -( -via -attr -) -and -then -manual -during -' -beforetoggle -' -works -] -expected -: -FAIL -[ -Changing -a -popover -from -auto -to -undefined -( -via -attr -) -and -then -invalid -during -' -beforetoggle -' -works -] -expected -: -FAIL -[ -Changing -a -popover -from -auto -to -undefined -( -via -attr -) -and -then -null -during -' -beforetoggle -' -works -] -expected -: -FAIL -[ -Changing -a -popover -from -manual -to -undefined -( -via -attr -) -and -then -auto -during -' -beforetoggle -' -works -] -expected -: -FAIL -[ -Changing -a -popover -from -manual -to -undefined -( -via -attr -) -and -then -manual -during -' -beforetoggle -' -works -] -expected -: -FAIL -[ -Changing -a -popover -from -manual -to -undefined -( -via -attr -) -and -then -invalid -during -' -beforetoggle -' -works -] -expected -: -FAIL -[ -Changing -a -popover -from -manual -to -undefined -( -via -attr -) -and -then -null -during -' -beforetoggle -' -works -] -expected -: -FAIL -[ -Changing -a -popover -from -auto -to -null -( -via -idl -) -and -then -auto -during -' -beforetoggle -' -works -] -expected -: -FAIL -[ -Changing -a -popover -from -auto -to -undefined -( -via -idl -) -and -then -auto -during -' -beforetoggle -' -works -] -expected -: -FAIL -[ -Changing -a -popover -from -manual -to -null -( -via -idl -) -and -then -auto -during -' -beforetoggle -' -works -] -expected -: -FAIL -[ -Changing -a -popover -from -manual -to -undefined -( -via -idl -) -and -then -auto -during -' -beforetoggle -' -works -] -expected -: -FAIL -[ -Changing -a -popover -from -auto -to -null -( -via -idl -) -and -then -manual -during -' -beforetoggle -' -works -] -expected -: -FAIL -[ -Changing -a -popover -from -auto -to -null -( -via -idl -) -and -then -invalid -during -' -beforetoggle -' -works -] -expected -: -FAIL -[ -Changing -a -popover -from -auto -to -undefined -( -via -idl -) -and -then -manual -during -' -beforetoggle -' -works -] -expected -: -FAIL -[ -Changing -a -popover -from -auto -to -undefined -( -via -idl -) -and -then -invalid -during -' -beforetoggle -' -works -] -expected -: -FAIL -[ -Changing -a -popover -from -manual -to -null -( -via -idl -) -and -then -manual -during -' -beforetoggle -' -works -] -expected -: -FAIL -[ -Changing -a -popover -from -manual -to -null -( -via -idl -) -and -then -invalid -during -' -beforetoggle -' -works -] -expected -: -FAIL -[ -Changing -a -popover -from -manual -to -undefined -( -via -idl -) -and -then -manual -during -' -beforetoggle -' -works -] -expected -: -FAIL -[ -Changing -a -popover -from -manual -to -undefined -( -via -idl -) -and -then -invalid -during -' -beforetoggle -' -works -] -expected -: -FAIL -[ -Changing -a -popover -from -auto -to -undefined -( -via -attr -) -and -then -undefined -during -' -beforetoggle -' -works -] -expected -: -FAIL -[ -Changing -a -popover -from -manual -to -undefined -( -via -attr -) -and -then -undefined -during -' -beforetoggle -' -works -] -expected -: -FAIL -[ -Changing -a -popover -from -auto -to -null -( -via -idl -) -and -then -null -during -' -beforetoggle -' -works -] -expected -: -FAIL -[ -Changing -a -popover -from -auto -to -null -( -via -idl -) -and -then -undefined -during -' -beforetoggle -' -works -] -expected -: -FAIL -[ -Changing -a -popover -from -auto -to -undefined -( -via -idl -) -and -then -null -during -' -beforetoggle -' -works -] -expected -: -FAIL -[ -Changing -a -popover -from -auto -to -undefined -( -via -idl -) -and -then -undefined -during -' -beforetoggle -' -works -] -expected -: -FAIL -[ -Changing -a -popover -from -manual -to -null -( -via -idl -) -and -then -null -during -' -beforetoggle -' -works -] -expected -: -FAIL -[ -Changing -a -popover -from -manual -to -null -( -via -idl -) -and -then -undefined -during -' -beforetoggle -' -works -] -expected -: -FAIL -[ -Changing -a -popover -from -manual -to -undefined -( -via -idl -) -and -then -null -during -' -beforetoggle -' -works -] -expected -: -FAIL -[ -Changing -a -popover -from -manual -to -undefined -( -via -idl -) -and -then -undefined -during -' -beforetoggle -' -works -] -expected -: -FAIL -[ -Changing -a -popover -from manual to auto