Skip to content

Commit

Permalink
Bug 230307. When cloning a <textarea>, preserve the current value jus…
Browse files Browse the repository at this point in the history
…t like we do for <input>. r=ehsan

The web platform test is just lifted wholesale from
<web-platform-tests/wpt#3734>.

UltraBlame original commit: 9169054bf50447beb0a7793b1c289763ec12ba79
  • Loading branch information
marco-c committed Sep 30, 2019
1 parent df55f0d commit cfd87c2
Show file tree
Hide file tree
Showing 3 changed files with 611 additions and 1 deletion.
161 changes: 160 additions & 1 deletion dom/html/HTMLTextAreaElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -617,10 +617,169 @@ nsGenericHTMLFormElementWithState
/
/
nsIDOMHTMLTextAreaElement
NS_IMPL_ELEMENT_CLONE
nsresult
HTMLTextAreaElement
:
:
Clone
(
mozilla
:
:
dom
:
:
NodeInfo
*
aNodeInfo
nsINode
*
*
aResult
)
const
{
*
aResult
=
nullptr
;
already_AddRefed
<
mozilla
:
:
dom
:
:
NodeInfo
>
ni
=
RefPtr
<
mozilla
:
:
dom
:
:
NodeInfo
>
(
aNodeInfo
)
.
forget
(
)
;
RefPtr
<
HTMLTextAreaElement
>
it
=
new
HTMLTextAreaElement
(
ni
)
;
nsresult
rv
=
const_cast
<
HTMLTextAreaElement
*
>
(
this
)
-
>
CopyInnerTo
(
it
)
;
NS_ENSURE_SUCCESS
(
rv
rv
)
;
if
(
mValueChanged
)
{
/
/
Set
our
value
on
the
clone
.
nsAutoString
value
;
GetValueInternal
(
value
true
)
;
/
/
SetValueInternal
handles
setting
mValueChanged
for
us
rv
=
it
-
>
SetValueInternal
(
value
nsTextEditorState
:
:
eSetValue_Notify
)
;
NS_ENSURE_SUCCESS
(
rv
rv
)
;
}
it
-
>
mLastValueChangeWasInteractive
=
mLastValueChangeWasInteractive
;
it
.
forget
(
aResult
)
;
return
NS_OK
;
}
/
/
nsIConstraintValidation
Expand Down
71 changes: 71 additions & 0 deletions testing/web-platform/meta/MANIFEST.json
Original file line number Diff line number Diff line change
Expand Up @@ -486667,6 +486667,77 @@ html
/
semantics
/
forms
/
the
-
textarea
-
element
/
cloning
-
steps
.
html
"
:
[
{
"
path
"
:
"
html
/
semantics
/
forms
/
the
-
textarea
-
element
/
cloning
-
steps
.
html
"
"
url
"
:
"
/
html
/
semantics
/
forms
/
the
-
textarea
-
element
/
cloning
-
steps
.
html
"
}
]
"
html
/
semantics
/
scripting
-
1
Expand Down
Loading

0 comments on commit cfd87c2

Please sign in to comment.