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 6fd63ab commit 48bb2dc
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 843 deletions.
211 changes: 88 additions & 123 deletions dom/html/nsGenericHTMLElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -4622,7 +4613,7 @@ static_cast
PopoverAttributeKeyword
>
(
newValue
value
-
>
GetEnumValue
Expand Down Expand Up @@ -4682,7 +4673,19 @@ PopoverAttributeState
None
;
}
;
PopoverAttributeState
newState
=
mapPopoverState
(
GetParsedAttr
(
nsGkAtoms
:
:
popover
)
)
;
const
Expand All @@ -4701,15 +4704,19 @@ newState
oldState
)
{
EnsurePopoverData
PopoverPseudoStateUpdate
(
false
true
)
.
SetPopoverAttributeState
;
if
(
IsPopoverOpen
(
newState
)
;
)
{
HidePopoverInternal
(
/
Expand All @@ -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
Expand All @@ -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
(
)
Expand All @@ -4832,6 +4831,7 @@ RemovePopoverFromTopLayer
this
)
;
}
ClearPopoverData
(
)
Expand Down Expand Up @@ -4859,16 +4859,18 @@ ShowPopup
(
)
?
PopoverPseudoStateUpdate
EnsurePopoverData
(
false
true
)
.
SetPopoverAttributeState
(
newState
)
;
}
}
}
}
void
nsGenericHTMLElement
:
Expand Down Expand Up @@ -20980,24 +20982,8 @@ ErrorResult
aRv
)
{
const
PopoverData
*
data
=
GetPopoverData
(
)
;
if
(
!
data
|
|
data
-
>
GetPopoverAttributeState
(
)
Expand All @@ -21009,18 +20995,6 @@ PopoverAttributeState
None
)
{
MOZ_ASSERT
(
!
HasAttr
(
nsGkAtoms
:
:
popover
)
)
;
aRv
.
ThrowNotSupportedError
Expand All @@ -21040,20 +21014,11 @@ return
false
;
}
MOZ_ASSERT
if
(
HasAttr
GetPopoverData
(
nsGkAtoms
:
:
popover
)
)
;
if
(
data
-
>
GetPopoverVisibilityState
Expand Down
Loading

0 comments on commit 48bb2dc

Please sign in to comment.