aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2018-06-07 10:13:30 -0400
committerGitHub <noreply@github.com>2018-06-07 10:13:30 -0400
commit56f6762cf8a191732c390c6c55769ccff7947028 (patch)
tree808fec94b327c06979cc73d02c25d9b4f8174ba1
parent199471231478425b0de3c29b473764dabfe45cba (diff)
parent73c0af6759f87124947ed3b4d328f7a2c1845ed3 (diff)
downloadservo-56f6762cf8a191732c390c6c55769ccff7947028.tar.gz
servo-56f6762cf8a191732c390c6c55769ccff7947028.zip
Auto merge of #21015 - tigercosmos:yyy, r=jdm
Support cloning steps for textarea/input <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #13282 (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/21015) <!-- Reviewable:end -->
-rwxr-xr-xcomponents/script/dom/htmltextareaelement.rs15
-rw-r--r--tests/wpt/metadata/html/semantics/forms/the-textarea-element/cloning-steps.html.ini8
2 files changed, 14 insertions, 9 deletions
diff --git a/components/script/dom/htmltextareaelement.rs b/components/script/dom/htmltextareaelement.rs
index 2798305da1d..359fe4d8a19 100755
--- a/components/script/dom/htmltextareaelement.rs
+++ b/components/script/dom/htmltextareaelement.rs
@@ -22,7 +22,7 @@ use dom::htmlelement::HTMLElement;
use dom::htmlfieldsetelement::HTMLFieldSetElement;
use dom::htmlformelement::{FormControl, HTMLFormElement};
use dom::keyboardevent::KeyboardEvent;
-use dom::node::{ChildrenMutation, Node, NodeDamage, UnbindContext};
+use dom::node::{CloneChildrenFlag, ChildrenMutation, Node, NodeDamage, UnbindContext};
use dom::node::{document_from_node, window_from_node};
use dom::nodelist::NodeList;
use dom::textcontrol::{TextControlElement, TextControlSelection};
@@ -420,6 +420,19 @@ impl VirtualMethods for HTMLTextAreaElement {
}
}
+ // The cloning steps for textarea elements must propagate the raw value
+ // and dirty value flag from the node being cloned to the copy.
+ fn cloning_steps(&self, copy: &Node, maybe_doc: Option<&Document>,
+ clone_children: CloneChildrenFlag) {
+ if let Some(ref s) = self.super_type() {
+ s.cloning_steps(copy, maybe_doc, clone_children);
+ }
+ let el = copy.downcast::<HTMLTextAreaElement>().unwrap();
+ el.value_dirty.set(self.value_dirty.get());
+ let mut textinput = el.textinput.borrow_mut();
+ textinput.set_content(self.textinput.borrow().get_content());
+ }
+
fn children_changed(&self, mutation: &ChildrenMutation) {
if let Some(ref s) = self.super_type() {
s.children_changed(mutation);
diff --git a/tests/wpt/metadata/html/semantics/forms/the-textarea-element/cloning-steps.html.ini b/tests/wpt/metadata/html/semantics/forms/the-textarea-element/cloning-steps.html.ini
deleted file mode 100644
index 628f7ff79f3..00000000000
--- a/tests/wpt/metadata/html/semantics/forms/the-textarea-element/cloning-steps.html.ini
+++ /dev/null
@@ -1,8 +0,0 @@
-[cloning-steps.html]
- type: testharness
- [textarea element's value should be cloned]
- expected: FAIL
-
- [textarea element's dirty value flag should be cloned, so setAttribute doesn't affect the cloned textarea's value]
- expected: FAIL
-