servo: Merge #4152 - Implements multi line text input for TextArea (from mttr:textview); r=jdm

Fixes #3918

Can be tested in `tests/html/textarea.html`. Also implemented some content reflecting IDL attributes for HTMLTextAreaElement while I was in there.

There are some major problems with TextInput when Multiple is enabled that I haven't addressed here, but I'm prepared to open up a follow-up issue.

Source-Repo: https://github.com/servo/servo
Source-Revision: a369dcfa01f5ad7634469f3a3b652d7f650129a0
This commit is contained in:
Matthew Rasmus
2014-12-05 16:25:07 -07:00
parent 2c0a69616b
commit c8b076b106
7 changed files with 203 additions and 25 deletions

View File

@@ -49,6 +49,7 @@ use script::dom::element::{HTMLObjectElementTypeId, HTMLInputElementTypeId};
use script::dom::element::{HTMLTableColElementTypeId, HTMLTableDataCellElementTypeId};
use script::dom::element::{HTMLTableElementTypeId, HTMLTableHeaderCellElementTypeId};
use script::dom::element::{HTMLTableRowElementTypeId, HTMLTableSectionElementTypeId};
use script::dom::element::HTMLTextAreaElementTypeId;
use script::dom::node::{CommentNodeTypeId, DoctypeNodeTypeId, DocumentFragmentNodeTypeId};
use script::dom::node::{DocumentNodeTypeId, ElementNodeTypeId, ProcessingInstructionNodeTypeId};
use script::dom::node::{TextNodeTypeId};
@@ -487,7 +488,16 @@ impl<'a> FlowConstructor<'a> {
// Special case: If this is generated content, then we need to initialize the accumulator
// with the fragment corresponding to that content.
if node.get_pseudo_element_type() != Normal ||
node.type_id() == Some(ElementNodeTypeId(HTMLInputElementTypeId)) {
node.type_id() == Some(ElementNodeTypeId(HTMLInputElementTypeId)) ||
node.type_id() == Some(ElementNodeTypeId(HTMLTextAreaElementTypeId)) {
// A TextArea's text contents are displayed through the input text
// box, so don't construct them.
// TODO Maybe this belongs somewhere else?
if node.type_id() == Some(ElementNodeTypeId(HTMLTextAreaElementTypeId)) {
for kid in node.children() {
kid.set_flow_construction_result(NoConstructionResult)
}
}
let fragment_info = UnscannedTextFragment(UnscannedTextFragmentInfo::new(node));
let fragment = Fragment::new_from_specific_info(node, fragment_info);
inline_fragment_accumulator.fragments.push_back(fragment);