Skip to content

Commit

Permalink
Bug 1838450 - Refine attribute handling. r=emilio
Browse files Browse the repository at this point in the history
  • Loading branch information
marco-c committed Oct 13, 2023
1 parent 20df61f commit 5365296
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 794 deletions.
132 changes: 58 additions & 74 deletions dom/html/nsGenericHTMLElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3393,38 +3393,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
Expand All @@ -3447,7 +3438,7 @@ static_cast
PopoverAttributeKeyword
>
(
newValue
value
-
>
GetEnumValue
Expand All @@ -3469,7 +3460,19 @@ PopoverAttributeState
None
;
}
;
PopoverAttributeState
newState
=
mapPopoverState
(
GetParsedAttr
(
nsGkAtoms
:
:
popover
)
)
;
const
Expand All @@ -3488,15 +3491,19 @@ newState
oldState
)
{
EnsurePopoverData
PopoverPseudoStateUpdate
(
false
true
)
.
SetPopoverAttributeState
;
if
(
IsPopoverOpen
(
newState
)
;
)
{
HidePopoverInternal
(
true
Expand All @@ -3506,16 +3513,20 @@ IgnoreErrors
)
)
;
if
(
newState
=
=
GetPopoverAttributeState
mapPopoverState
(
GetParsedAttr
(
nsGkAtoms
:
:
popover
)
)
{
;
}
if
(
newState
Expand All @@ -3527,6 +3538,13 @@ PopoverAttributeState
None
)
{
if
(
GetPopoverData
(
)
)
{
OwnerDoc
(
)
Expand All @@ -3538,6 +3556,7 @@ RemovePopoverFromTopLayer
this
)
;
}
ClearPopoverData
(
)
Expand All @@ -3553,16 +3572,18 @@ POPOVER_OPEN
}
else
{
PopoverPseudoStateUpdate
EnsurePopoverData
(
false
true
)
.
SetPopoverAttributeState
(
newState
)
;
}
}
}
}
void
nsGenericHTMLElement
:
Expand Down Expand Up @@ -16277,24 +16298,8 @@ ErrorResult
aRv
)
{
const
PopoverData
*
data
=
GetPopoverData
(
)
;
if
(
!
data
|
|
data
-
>
GetPopoverAttributeState
(
)
Expand All @@ -16306,18 +16311,6 @@ PopoverAttributeState
None
)
{
MOZ_ASSERT
(
!
HasAttr
(
nsGkAtoms
:
:
popover
)
)
;
aRv
.
ThrowNotSupportedError
Expand All @@ -16337,20 +16330,11 @@ return
false
;
}
MOZ_ASSERT
if
(
HasAttr
GetPopoverData
(
nsGkAtoms
:
:
popover
)
)
;
if
(
data
-
>
GetPopoverVisibilityState
Expand Down
Loading

0 comments on commit 5365296

Please sign in to comment.