mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
support textarea clone
This commit is contained in:
parent
464a3ef390
commit
73c0af6759
2 changed files with 14 additions and 9 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue