diff options
-rw-r--r-- | components/layout/query.rs | 179 | ||||
-rw-r--r-- | components/layout_thread/lib.rs | 16 | ||||
-rw-r--r-- | components/script/dom/element.rs | 2 | ||||
-rw-r--r-- | components/script/dom/htmlelement.rs | 24 | ||||
-rw-r--r-- | components/script/dom/node.rs | 4 | ||||
-rw-r--r-- | components/script/dom/webidls/HTMLElement.webidl | 2 | ||||
-rw-r--r-- | components/script/dom/window.rs | 1 | ||||
-rw-r--r-- | components/script_layout_interface/lib.rs | 2 | ||||
-rw-r--r-- | components/script_layout_interface/message.rs | 7 | ||||
-rw-r--r-- | components/script_layout_interface/rpc.rs | 3 | ||||
-rw-r--r-- | tests/wpt/include.ini | 2 | ||||
-rw-r--r-- | tests/wpt/metadata/MANIFEST.json | 2 | ||||
-rw-r--r-- | tests/wpt/metadata/html/dom/interfaces.html.ini | 6 | ||||
-rw-r--r-- | tests/wpt/metadata/innerText/getter.html.ini | 241 | ||||
-rw-r--r-- | tests/wpt/metadata/innerText/setter.html.ini | 367 | ||||
-rw-r--r-- | tests/wpt/web-platform-tests/innerText/getter.html | 2 |
16 files changed, 844 insertions, 16 deletions
diff --git a/components/layout/query.rs b/components/layout/query.rs index 2df1fc99e53..922254293f5 100644 --- a/components/layout/query.rs +++ b/components/layout/query.rs @@ -10,11 +10,13 @@ use context::LayoutContext; use euclid::{Point2D, Vector2D, Rect, Size2D}; use flow::{Flow, GetBaseFlow}; use fragment::{Fragment, FragmentBorderBoxIterator, SpecificFragmentInfo}; -use gfx::display_list::{DisplayList, OpaqueNode, ScrollOffsetMap}; +use gfx::display_list::{DisplayItem, DisplayList, OpaqueNode, ScrollOffsetMap}; use inline::InlineFragmentNodeFlags; use ipc_channel::ipc::IpcSender; use msg::constellation_msg::PipelineId; use opaque_node::OpaqueNodeMethods; +use script_layout_interface::{LayoutElementType, LayoutNodeType}; +use script_layout_interface::StyleData; use script_layout_interface::rpc::{ContentBoxResponse, ContentBoxesResponse, LayoutRPC}; use script_layout_interface::rpc::{NodeGeometryResponse, NodeScrollIdResponse}; use script_layout_interface::rpc::{OffsetParentResponse, ResolvedStyleResponse, StyleResponse}; @@ -24,10 +26,12 @@ use script_traits::LayoutMsg as ConstellationMsg; use script_traits::UntrustedNodeAddress; use sequential; use std::cmp::{min, max}; +use std::collections::HashMap; use std::ops::Deref; use std::sync::{Arc, Mutex}; use style::computed_values::display::T as Display; use style::computed_values::position::T as Position; +use style::computed_values::visibility::T as Visibility; use style::context::{StyleContext, ThreadLocalStyleContext}; use style::dom::TElement; use style::logical_geometry::{WritingMode, BlockFlowDirection, InlineBaseDirection}; @@ -79,6 +83,9 @@ pub struct LayoutThreadData { /// A queued response for the list of nodes at a given point. pub nodes_from_point_response: Vec<UntrustedNodeAddress>, + + /// A queued response for the inner text of a given element. + pub element_inner_text_response: String, } pub struct LayoutRPCImpl(pub Arc<Mutex<LayoutThreadData>>); @@ -161,6 +168,12 @@ impl LayoutRPC for LayoutRPCImpl { let rw_data = rw_data.lock().unwrap(); rw_data.text_index_response.clone() } + + fn element_inner_text(&self) -> String { + let &LayoutRPCImpl(ref rw_data) = self; + let rw_data = rw_data.lock().unwrap(); + rw_data.element_inner_text_response.clone() + } } struct UnioningFragmentBorderBoxIterator { @@ -864,3 +877,167 @@ pub fn process_style_query<N: LayoutNode>(requested_node: N) StyleResponse(data.map(|d| d.styles.primary().clone())) } + +enum InnerTextItem { + Text(String), + RequiredLineBreakCount(u32), +} + +// https://html.spec.whatwg.org/multipage/#the-innertext-idl-attribute +pub fn process_element_inner_text_query<N: LayoutNode>(node: N, + display_list: &Option<Arc<DisplayList>>) -> String { + if !display_list.is_some() { + warn!("We should have a display list at this point. Cannot get inner text"); + return String::new(); + } + + // Step 1. + let mut results = Vec::new(); + // Step 2. + inner_text_collection_steps(node, display_list.as_ref().unwrap(), &mut results); + let mut max_req_line_break_count = 0; + let mut inner_text = Vec::new(); + for item in results { + match item { + InnerTextItem::Text(s) => { + if max_req_line_break_count > 0 { + // Step 5. + for _ in 0..max_req_line_break_count { + inner_text.push("\u{000A}".to_owned()); + } + max_req_line_break_count = 0; + } + // Step 3. + if !s.is_empty() { + inner_text.push(s.to_owned()); + } + }, + InnerTextItem::RequiredLineBreakCount(count) => { + // Step 4. + if inner_text.len() == 0 { + // Remove required line break count at the start. + continue; + } + // Store the count if it's the max of this run, + // but it may be ignored if no text item is found afterwards, + // which means that these are consecutive line breaks at the end. + if count > max_req_line_break_count { + max_req_line_break_count = count; + } + } + } + } + inner_text.into_iter().collect() +} + +// https://html.spec.whatwg.org/multipage/#inner-text-collection-steps +#[allow(unsafe_code)] +fn inner_text_collection_steps<N: LayoutNode>(node: N, + display_list: &Arc<DisplayList>, + results: &mut Vec<InnerTextItem>) { + // Extracts the text nodes from the display list to avoid traversing it + // for each child node. + let mut text = HashMap::new(); + for item in &display_list.as_ref().list { + if let &DisplayItem::Text(ref text_content) = item { + let entries = text.entry(&item.base().metadata.node).or_insert(Vec::new()); + entries.push(&text_content.text_run.text); + } + } + + let mut items = Vec::new(); + for child in node.traverse_preorder() { + let node = match child.type_id() { + LayoutNodeType::Text => { + child.parent_node().unwrap() + }, + _ => child, + }; + + let element_data = unsafe { + node.get_style_and_layout_data().map(|d| { + &(*(d.ptr.as_ptr() as *mut StyleData)).element_data + }) + }; + + if element_data.is_none() { + continue; + } + + let style = match element_data.unwrap().borrow().styles.get_primary() { + None => continue, + Some(style) => style.clone(), + }; + + // Step 2. + if style.get_inheritedbox().visibility != Visibility::Visible { + continue; + } + + // Step 3. + let display = style.get_box().display; + if !child.is_in_document() || display == Display::None { + continue; + } + + match child.type_id() { + LayoutNodeType::Text => { + // Step 4. + if let Some(text_content) = text.get(&child.opaque()) { + for content in text_content { + items.push(InnerTextItem::Text(content.to_string())); + } + } + }, + LayoutNodeType::Element(LayoutElementType::HTMLBRElement) => { + // Step 5. + items.push(InnerTextItem::Text(String::from("\u{000A}" /* line feed */))); + }, + LayoutNodeType::Element(LayoutElementType::HTMLParagraphElement) => { + // Step 8. + items.insert(0, InnerTextItem::RequiredLineBreakCount(2)); + items.push(InnerTextItem::RequiredLineBreakCount(2)); + } + _ => {}, + + } + + match display { + Display::TableCell if !is_last_table_cell() => { + // Step 6. + items.push(InnerTextItem::Text(String::from("\u{0009}" /* tab */))); + }, + Display::TableRow if !is_last_table_row() => { + // Step 7. + items.push(InnerTextItem::Text(String::from("\u{000A}" /* line feed */))); + }, + _ => (), + } + + // Step 9. + if is_block_level_or_table_caption(&display) { + items.insert(0, InnerTextItem::RequiredLineBreakCount(1)); + items.push(InnerTextItem::RequiredLineBreakCount(1)); + } + } + + results.append(&mut items); +} + +fn is_last_table_cell() -> bool { + // FIXME(ferjm) Implement this. + false +} + +fn is_last_table_row() -> bool { + // FIXME(ferjm) Implement this. + false +} + +fn is_block_level_or_table_caption(display: &Display) -> bool { + match *display { + Display::Block | Display::Flex | + Display::TableCaption | Display::Table => true, + _ => false, + } +} diff --git a/components/layout_thread/lib.rs b/components/layout_thread/lib.rs index 5585891a011..a5c3e03293f 100644 --- a/components/layout_thread/lib.rs +++ b/components/layout_thread/lib.rs @@ -76,9 +76,9 @@ use layout::incremental::{LayoutDamageComputation, RelayoutMode, SpecialRestyleD use layout::layout_debug; use layout::parallel; use layout::query::{LayoutRPCImpl, LayoutThreadData, process_content_box_request, process_content_boxes_request}; -use layout::query::{process_node_geometry_request, process_node_scroll_area_request}; -use layout::query::{process_node_scroll_id_request, process_offset_parent_query, process_resolved_style_request}; -use layout::query::process_style_query; +use layout::query::{process_element_inner_text_query, process_node_geometry_request}; +use layout::query::{process_node_scroll_area_request, process_node_scroll_id_request}; +use layout::query::{process_offset_parent_query, process_resolved_style_request, process_style_query}; use layout::sequential; use layout::traversal::{ComputeStackingRelativePositions, PreorderFlowTraversal, RecalcStyleAndConstructFlows}; use layout::wrapper::LayoutNodeLayoutData; @@ -526,6 +526,7 @@ impl LayoutThread { scroll_offsets: HashMap::new(), text_index_response: TextIndexResponse(None), nodes_from_point_response: vec![], + element_inner_text_response: String::new(), })), webrender_image_cache: Arc::new(RwLock::new(FnvHashMap::default())), @@ -1107,6 +1108,9 @@ impl LayoutThread { ReflowGoal::TextIndexQuery(..) => { rw_data.text_index_response = TextIndexResponse(None); } + ReflowGoal::ElementInnerTextQuery(_) => { + rw_data.element_inner_text_response = String::new(); + }, ReflowGoal::Full | ReflowGoal:: TickAnimations => {} } return; @@ -1419,7 +1423,11 @@ impl LayoutThread { .map(|item| UntrustedNodeAddress(item.tag.0 as *const c_void)) .collect() }, - + ReflowGoal::ElementInnerTextQuery(node) => { + let node = unsafe { ServoLayoutNode::new(&node) }; + rw_data.element_inner_text_response = + process_element_inner_text_query(node, &rw_data.display_list); + }, ReflowGoal::Full | ReflowGoal::TickAnimations => {} } } diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs index ad050be3dda..9c88c1391fd 100644 --- a/components/script/dom/element.rs +++ b/components/script/dom/element.rs @@ -357,7 +357,7 @@ impl Element { } // https://drafts.csswg.org/cssom-view/#css-layout-box - fn has_css_layout_box(&self) -> bool { + pub fn has_css_layout_box(&self) -> bool { self.style() .map_or(false, |s| !s.get_box().clone_display().is_none()) } diff --git a/components/script/dom/htmlelement.rs b/components/script/dom/htmlelement.rs index 89b0c0d9de2..ec9b3973ca1 100644 --- a/components/script/dom/htmlelement.rs +++ b/components/script/dom/htmlelement.rs @@ -8,6 +8,7 @@ use dom::bindings::codegen::Bindings::ElementBinding::ElementMethods; use dom::bindings::codegen::Bindings::EventHandlerBinding::EventHandlerNonNull; use dom::bindings::codegen::Bindings::HTMLElementBinding; use dom::bindings::codegen::Bindings::HTMLElementBinding::HTMLElementMethods; +use dom::bindings::codegen::Bindings::NodeBinding::NodeBinding::NodeMethods; use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; use dom::bindings::error::{Error, ErrorResult}; use dom::bindings::inheritance::{ElementTypeId, HTMLElementTypeId, NodeTypeId}; @@ -28,8 +29,10 @@ use dom::node::{Node, NodeFlags}; use dom::node::{document_from_node, window_from_node}; use dom::nodelist::NodeList; use dom::virtualmethods::VirtualMethods; +use dom::window::ReflowReason; use dom_struct::dom_struct; use html5ever::{LocalName, Prefix}; +use script_layout_interface::message::ReflowGoal; use std::collections::HashSet; use std::default::Default; use std::rc::Rc; @@ -400,6 +403,27 @@ impl HTMLElementMethods for HTMLElement { rect.size.height.to_nearest_px() } + + // https://html.spec.whatwg.org/multipage/#the-innertext-idl-attribute + fn InnerText(&self) -> DOMString { + let node = self.upcast::<Node>(); + let window = window_from_node(node); + let element = self.upcast::<Element>(); + + // Step 1. + let element_not_rendered = !node.is_in_doc() || !element.has_css_layout_box(); + if element_not_rendered { + return node.GetTextContent().unwrap(); + } + + window.reflow(ReflowGoal::ElementInnerTextQuery(node.to_trusted_node_address()), ReflowReason::Query); + DOMString::from(window.layout().element_inner_text()) + } + + // https://html.spec.whatwg.org/multipage/#the-innertext-idl-attribute + fn SetInnerText(&self, _: DOMString) { + // XXX (ferjm) implement this. + } } // https://html.spec.whatwg.org/multipage/#attr-data-* diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs index ce97cb1ee4b..64b808c3859 100644 --- a/components/script/dom/node.rs +++ b/components/script/dom/node.rs @@ -2741,6 +2741,8 @@ impl Into<LayoutElementType> for ElementTypeId { #[inline(always)] fn into(self) -> LayoutElementType { match self { + ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLBRElement) => + LayoutElementType::HTMLBRElement, ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLCanvasElement) => LayoutElementType::HTMLCanvasElement, ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLIFrameElement) => @@ -2751,6 +2753,8 @@ impl Into<LayoutElementType> for ElementTypeId { LayoutElementType::HTMLInputElement, ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLObjectElement) => LayoutElementType::HTMLObjectElement, + ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLParagraphElement) => + LayoutElementType::HTMLParagraphElement, ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTableCellElement(_)) => LayoutElementType::HTMLTableCellElement, ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTableColElement) => diff --git a/components/script/dom/webidls/HTMLElement.webidl b/components/script/dom/webidls/HTMLElement.webidl index 7c1b0d62c21..a007a93e6b3 100644 --- a/components/script/dom/webidls/HTMLElement.webidl +++ b/components/script/dom/webidls/HTMLElement.webidl @@ -46,6 +46,8 @@ interface HTMLElement : Element { // attribute boolean spellcheck; // void forceSpellCheck(); + [TreatNullAs=EmptyString] attribute DOMString innerText; + // command API // readonly attribute DOMString? commandType; // readonly attribute DOMString? commandLabel; diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs index c92a04c7cd4..c9765b18253 100644 --- a/components/script/dom/window.rs +++ b/components/script/dom/window.rs @@ -1898,6 +1898,7 @@ fn debug_reflow_events(id: PipelineId, reflow_goal: &ReflowGoal, reason: &Reflow ReflowGoal::StyleQuery(_n) => "\tStyleQuery", ReflowGoal::TextIndexQuery(..) => "\tTextIndexQuery", ReflowGoal::TickAnimations => "\tTickAnimations", + ReflowGoal::ElementInnerTextQuery(_) => "\tElementInnerTextQuery", }); debug_msg.push_str(match *reason { diff --git a/components/script_layout_interface/lib.rs b/components/script_layout_interface/lib.rs index 45c82ee1089..dc2c6f515a7 100644 --- a/components/script_layout_interface/lib.rs +++ b/components/script_layout_interface/lib.rs @@ -108,11 +108,13 @@ pub enum LayoutNodeType { #[derive(Clone, Copy, Debug, Eq, PartialEq)] pub enum LayoutElementType { Element, + HTMLBRElement, HTMLCanvasElement, HTMLIFrameElement, HTMLImageElement, HTMLInputElement, HTMLObjectElement, + HTMLParagraphElement, HTMLTableCellElement, HTMLTableColElement, HTMLTableElement, diff --git a/components/script_layout_interface/message.rs b/components/script_layout_interface/message.rs index f53022d5286..ef408600270 100644 --- a/components/script_layout_interface/message.rs +++ b/components/script_layout_interface/message.rs @@ -121,6 +121,7 @@ pub enum ReflowGoal { StyleQuery(TrustedNodeAddress), TextIndexQuery(TrustedNodeAddress, Point2D<f32>), NodesFromPointQuery(Point2D<f32>, NodesFromPointQueryType), + ElementInnerTextQuery(TrustedNodeAddress), } impl ReflowGoal { @@ -129,12 +130,13 @@ impl ReflowGoal { pub fn needs_display_list(&self) -> bool { match *self { ReflowGoal::NodesFromPointQuery(..) | ReflowGoal::TextIndexQuery(..) | - ReflowGoal::TickAnimations | ReflowGoal::Full => true, + ReflowGoal::TickAnimations | ReflowGoal::ElementInnerTextQuery(_) | + ReflowGoal::Full => true, ReflowGoal::ContentBoxQuery(_) | ReflowGoal::ContentBoxesQuery(_) | ReflowGoal::NodeGeometryQuery(_) | ReflowGoal::NodeScrollGeometryQuery(_) | ReflowGoal::NodeScrollIdQuery(_) | ReflowGoal::ResolvedStyleQuery(..) | ReflowGoal::OffsetParentQuery(_) | - ReflowGoal::StyleQuery(_) => false, + ReflowGoal::StyleQuery(_) => false, } } @@ -148,6 +150,7 @@ impl ReflowGoal { ReflowGoal::NodeScrollIdQuery(_) | ReflowGoal::ResolvedStyleQuery(..) | ReflowGoal::OffsetParentQuery(_) => false, ReflowGoal::NodesFromPointQuery(..) | ReflowGoal::Full | + ReflowGoal::ElementInnerTextQuery(_) | ReflowGoal::TickAnimations => true, } } diff --git a/components/script_layout_interface/rpc.rs b/components/script_layout_interface/rpc.rs index 8902c7d0466..8bdb285ed8e 100644 --- a/components/script_layout_interface/rpc.rs +++ b/components/script_layout_interface/rpc.rs @@ -38,7 +38,8 @@ pub trait LayoutRPC { fn text_index(&self) -> TextIndexResponse; /// Requests the list of nodes from the given point. fn nodes_from_point_response(&self) -> Vec<UntrustedNodeAddress>; - + /// Query layout to get the inner text for a given element. + fn element_inner_text(&self) -> String; } pub struct ContentBoxResponse(pub Option<Rect<Au>>); diff --git a/tests/wpt/include.ini b/tests/wpt/include.ini index 8da888d63b0..0533630c35d 100644 --- a/tests/wpt/include.ini +++ b/tests/wpt/include.ini @@ -73,6 +73,8 @@ skip: true skip: false [html] skip: false +[innerText] + skip: false [js] skip: false [navigation-timing] diff --git a/tests/wpt/metadata/MANIFEST.json b/tests/wpt/metadata/MANIFEST.json index a608194f062..1da4a01193a 100644 --- a/tests/wpt/metadata/MANIFEST.json +++ b/tests/wpt/metadata/MANIFEST.json @@ -563352,7 +563352,7 @@ "support" ], "innerText/getter.html": [ - "644b5b18359d26db9cd4d037b075ca016e2337b5", + "28fc321d84fac1173da328bdfb65b052000fcb4d", "testharness" ], "innerText/multiple-text-nodes.window.js": [ diff --git a/tests/wpt/metadata/html/dom/interfaces.html.ini b/tests/wpt/metadata/html/dom/interfaces.html.ini index 78284b0d68b..983a2f63ba0 100644 --- a/tests/wpt/metadata/html/dom/interfaces.html.ini +++ b/tests/wpt/metadata/html/dom/interfaces.html.ini @@ -8268,9 +8268,6 @@ [Document interface: document.implementation.createDocument(null, "", null) must inherit property "onmousewheel" with the proper type (130)] expected: FAIL - [HTMLElement interface: attribute innerText] - expected: FAIL - [HTMLElement interface: document.createElement("noscript") must inherit property "contextMenu" with the proper type (14)] expected: FAIL @@ -10689,9 +10686,6 @@ [HTMLElement interface: document.createElement("noscript") must inherit property "spellcheck" with the proper type] expected: FAIL - [HTMLElement interface: document.createElement("noscript") must inherit property "innerText" with the proper type] - expected: FAIL - [HTMLElement interface: document.createElement("noscript") must inherit property "onauxclick" with the proper type] expected: FAIL diff --git a/tests/wpt/metadata/innerText/getter.html.ini b/tests/wpt/metadata/innerText/getter.html.ini new file mode 100644 index 00000000000..97483adcfd1 --- /dev/null +++ b/tests/wpt/metadata/innerText/getter.html.ini @@ -0,0 +1,241 @@ +[getter.html] + [Trailing whitespace before hard line break removed ("<div>abc <br>def")] + expected: FAIL + + [Whitespace collapses across element boundaries ("<div><span>abc </span> def")] + expected: FAIL + + [Whitespace collapses across element boundaries ("<div><span>abc </span><span></span> def")] + expected: FAIL + + [Whitespace collapses across element boundaries ("<div><span>abc </span><span style='white-space:pre'></span> def")] + expected: FAIL + + [Soft line breaks ignored ("<div style='width:0'>abc def")] + expected: FAIL + + [::first-line styles applied ("<div class='first-line-uppercase' style='width:0'>abc def")] + expected: FAIL + + [::first-letter styles applied ("<div class='first-letter-uppercase' style='width:0'>abc def")] + expected: FAIL + + [::first-letter float ignored ("<div class='first-letter-float' style='width:0'>abc def")] + expected: FAIL + + [non-display-none child of svg ("<div id='target'>abc")] + expected: FAIL + + [visibility:hidden child not rendered ("<div>123<span style='visibility:hidden'>abc")] + expected: FAIL + + [visibility:visible child rendered ("<div style='visibility:hidden'>123<span style='visibility:visible'>abc")] + expected: FAIL + + [visibility:collapse row-group with visible cell ("<table><tbody style='visibility:collapse'><tr><td style='visibility:visible'>abc")] + expected: FAIL + + [visibility:collapse row with visible cell ("<table><tr style='visibility:collapse'><td style='visibility:visible'>abc")] + expected: FAIL + + [visibility:collapse honored on flex item ("<div style='display:flex'><span style='visibility:collapse'>1</span><span>2</span></div>")] + expected: FAIL + + [visibility:collapse honored on grid item ("<div style='display:grid'><span style='visibility:collapse'>1</span><span>2</span></div>")] + expected: FAIL + + [opacity:0 child rendered ("<div>123<span style='opacity:0'>abc")] + expected: FAIL + + [<audio> contents ignored ("<audio style='display:block'><source id='target' class='poke' style='display:block'>")] + expected: FAIL + + [<video> contents ignored ("<video style='display:block'><source id='target' class='poke' style='display:block'>")] + expected: FAIL + + [<select size='1'> contents of options preserved ("<select size='1'><option>abc</option><option>def")] + expected: FAIL + + [<select size='2'> contents of options preserved ("<select size='2'><option>abc</option><option>def")] + expected: FAIL + + [empty <select> ("<div>a<select></select>bc")] + expected: FAIL + + [<optgroup> containing <option> ("<select><optgroup><option>abc</select>")] + expected: FAIL + + [<div> in <option> ("<select><option class='poke-div'>123</select>")] + expected: FAIL + + [empty <optgroup> in <div> ("<div>a<optgroup></optgroup>bc")] + expected: FAIL + + [<optgroup> in <div> ("<div>a<optgroup>123</optgroup>bc")] + expected: FAIL + + [empty <option> in <div> ("<div>a<option></option>bc")] + expected: FAIL + + [<option> in <div> ("<div>a<option>123</option>bc")] + expected: FAIL + + [<select size='1'> contents of options preserved ("<div><select size='1'><option>abc</option><option>def")] + expected: FAIL + + [<select size='2'> contents of options preserved ("<div><select size='2'><option>abc</option><option>def")] + expected: FAIL + + [Blank lines between <p>s separated by non-empty block ("<div><p>abc</p><div>123</div><p>def")] + expected: FAIL + + [Blank lines around a <p> in its own block ("<div>abc<div><p>123</p></div>def")] + expected: FAIL + + [Blank line after <p> ("<div><p>abc</p>def")] + expected: FAIL + + [No newlines at display:inline-block boundary ("<div>123<span style='display:inline-block'>abc</span>def")] + expected: FAIL + + [Leading/trailing space removal at display:inline-block boundary ("<div>123<span style='display:inline-block'> abc </span>def")] + expected: FAIL + + [Blank lines around <p> even without margin ("<div>123<p style='margin:0px'>abc</p>def")] + expected: FAIL + + [<span> boundaries are irrelevant ("<div>123<span>abc</span>def")] + expected: FAIL + + [<span> boundaries are irrelevant ("<div>123 <span>abc</span> def")] + expected: FAIL + + [<span> boundaries are irrelevant ("<div style='width:0'>123 <span>abc</span> def")] + expected: FAIL + + [<em> gets no special treatment ("<div>123<em>abc</em>def")] + expected: FAIL + + [<b> gets no special treatment ("<div>123<b>abc</b>def")] + expected: FAIL + + [<i> gets no special treatment ("<div>123<i>abc</i>def")] + expected: FAIL + + [<strong> gets no special treatment ("<div>123<strong>abc</strong>def")] + expected: FAIL + + [<tt> gets no special treatment ("<div>123<tt>abc</tt>def")] + expected: FAIL + + [<code> gets no special treatment ("<div>123<code>abc</code>def")] + expected: FAIL + + [soft hyphen preserved ("<div style='width:0'>abc­def")] + expected: FAIL + + [Ignoring non-rendered table whitespace ("<div><table style='white-space:pre'> <td>abc</td> </table>")] + expected: FAIL + + [Tab-separated table cells ("<div><table><tr><td>abc<td>def</table>")] + expected: FAIL + + [Tab-separated table cells including empty cells ("<div><table><tr><td>abc<td><td>def</table>")] + expected: FAIL + + [Tab-separated table cells including trailing empty cells ("<div><table><tr><td>abc<td><td></table>")] + expected: FAIL + + [Newline-separated table rows ("<div><table><tr><td>abc<tr><td>def</table>")] + expected: FAIL + + [Newlines around table ("<div>abc<table><td>def</table>ghi")] + expected: FAIL + + [Tab-separated table cells in a border-collapse table ("<div><table style='border-collapse:collapse'><tr><td>abc<td>def</table>")] + expected: FAIL + + [ ("<table><tfoot><tr><td>footer</tfoot><thead><tr><td style='visibility:collapse'>thead</thead><tbody><tr><td>tbody</tbody></table>")] + expected: FAIL + + [Newline between cells and caption ("<div><table><tr><td>abc<caption>def</caption></table>")] + expected: FAIL + + [Tab-separated table cells ("<div><div class='table'><span class='cell'>abc</span>\\n<span class='cell'>def</span></div>")] + expected: FAIL + + [Newline-separated table rows ("<div><div class='table'><span class='row'><span class='cell'>abc</span></span>\\n<span class='row'><span class='cell'>def</span></span></div>")] + expected: FAIL + + [Newlines around table ("<div>abc<div class='table'><span class='cell'>def</span></div>ghi")] + expected: FAIL + + [Tab-separated table cells ("<div><div class='itable'><span class='cell'>abc</span>\\n<span class='cell'>def</span></div>")] + expected: FAIL + + [Newline-separated table rows ("<div><div class='itable'><span class='row'><span class='cell'>abc</span></span>\\n<span class='row'><span class='cell'>def</span></span></div>")] + expected: FAIL + + [No newlines around inline-table ("<div>abc<div class='itable'><span class='cell'>def</span></div>ghi")] + expected: FAIL + + [Single newline in two-row inline-table ("<div>abc<div class='itable'><span class='row'><span class='cell'>def</span></span>\\n<span class='row'><span class='cell'>123</span></span></div>ghi")] + expected: FAIL + + [<br> induces line break ("<div>abc<br>def")] + expected: FAIL + + [<br> induces line break even at end of block ("<div>abc<br>")] + expected: FAIL + + [<br> content ignored ("<div><br class='poke'>")] + expected: FAIL + + [text-transform handles Turkish casing ("<div><div lang='tr' style='text-transform:uppercase'>i ı")] + expected: FAIL + + [block-in-inline doesn't add unnecessary newlines ("<div>abc<span>123<div>456</div>789</span>def")] + expected: FAIL + + [position:absolute induces a block boundary ("<div>abc<div style='position:absolute'>123</div>def")] + expected: FAIL + + [position:relative has no effect ("<div>abc<span style='position:relative'>123</span>def")] + expected: FAIL + + [text-overflow:ellipsis ignored ("<div style='width:0; overflow:hidden; text-overflow:ellipsis'>abc")] + expected: FAIL + + [<rt> and no <rp> ("<div><ruby>abc<rt>def</rt></ruby>")] + expected: FAIL + + [<rp> ("<div><ruby>abc<rp>(</rp><rt>def</rt><rp>)</rp></ruby>")] + expected: FAIL + + [visibility:collapse row-group ("<table><tbody style='visibility:collapse'><tr><td>abc")] + expected: FAIL + + [visibility:collapse row ("<table><tr style='visibility:collapse'><td>abc")] + expected: FAIL + + [visibility:collapse cell ("<table><tr><td style='visibility:collapse'>abc")] + expected: FAIL + + [<audio> contents ignored ("<audio style='display:block'>abc")] + expected: FAIL + + [<video> contents ignored ("<video>abc")] + expected: FAIL + + [<select> containing text node child ("<select class='poke'></select>")] + expected: FAIL + + [<optgroup> containing <optgroup> ("<select><optgroup class='poke-optgroup'></select>")] + expected: FAIL + + [<audio> contents ignored ("<div><audio>abc")] + expected: FAIL + + [<video> contents ignored ("<div><video>abc")] + expected: FAIL + diff --git a/tests/wpt/metadata/innerText/setter.html.ini b/tests/wpt/metadata/innerText/setter.html.ini new file mode 100644 index 00000000000..89f388f5b90 --- /dev/null +++ b/tests/wpt/metadata/innerText/setter.html.ini @@ -0,0 +1,367 @@ +[setter.html] + [Simplest possible test] + expected: FAIL + + [Simplest possible test, detached] + expected: FAIL + + [Newlines convert to <br> in non-white-space:pre elements] + expected: FAIL + + [Newlines convert to <br> in non-white-space:pre elements, detached] + expected: FAIL + + [Newlines convert to <br> in <pre> element] + expected: FAIL + + [Newlines convert to <br> in <pre> element, detached] + expected: FAIL + + [Newlines convert to <br> in <textarea> element] + expected: FAIL + + [Newlines convert to <br> in <textarea> element, detached] + expected: FAIL + + [Newlines convert to <br> in white-space:pre element] + expected: FAIL + + [Newlines convert to <br> in white-space:pre element, detached] + expected: FAIL + + [CRs convert to <br> in non-white-space:pre elements] + expected: FAIL + + [CRs convert to <br> in non-white-space:pre elements, detached] + expected: FAIL + + [CRs convert to <br> in <pre> element] + expected: FAIL + + [CRs convert to <br> in <pre> element, detached] + expected: FAIL + + [Newline/CR pair converts to <br> in non-white-space:pre element] + expected: FAIL + + [Newline/CR pair converts to <br> in non-white-space:pre element, detached] + expected: FAIL + + [Newline/newline pair converts to two <br>s in non-white-space:pre element] + expected: FAIL + + [Newline/newline pair converts to two <br>s in non-white-space:pre element, detached] + expected: FAIL + + [CR/CR pair converts to two <br>s in non-white-space:pre element] + expected: FAIL + + [CR/CR pair converts to two <br>s in non-white-space:pre element, detached] + expected: FAIL + + [CRs convert to <br> in white-space:pre element] + expected: FAIL + + [CRs convert to <br> in white-space:pre element, detached] + expected: FAIL + + [< preserved] + expected: FAIL + + [< preserved, detached] + expected: FAIL + + [> preserved] + expected: FAIL + + [> preserved, detached] + expected: FAIL + + [& preserved] + expected: FAIL + + [& preserved, detached] + expected: FAIL + + [" preserved] + expected: FAIL + + [" preserved, detached] + expected: FAIL + + [' preserved] + expected: FAIL + + [' preserved, detached] + expected: FAIL + + [innerText not supported on SVG elements] + expected: FAIL + + [innerText not supported on MathML elements] + expected: FAIL + + [Null characters preserved] + expected: FAIL + + [Null characters preserved, detached] + expected: FAIL + + [Tabs preserved] + expected: FAIL + + [Tabs preserved, detached] + expected: FAIL + + [Leading whitespace preserved] + expected: FAIL + + [Leading whitespace preserved, detached] + expected: FAIL + + [Trailing whitespace preserved] + expected: FAIL + + [Trailing whitespace preserved, detached] + expected: FAIL + + [Whitespace not compressed] + expected: FAIL + + [Whitespace not compressed, detached] + expected: FAIL + + [Existing text deleted] + expected: FAIL + + [Existing text deleted, detached] + expected: FAIL + + [Existing <br> deleted] + expected: FAIL + + [Existing <br> deleted, detached] + expected: FAIL + + [Assigning the empty string] + expected: FAIL + + [Assigning null] + expected: FAIL + + [Assigning undefined] + expected: FAIL + + [Assigning undefined, detached] + expected: FAIL + + [Start with CR] + expected: FAIL + + [Start with CR, detached] + expected: FAIL + + [Start with LF] + expected: FAIL + + [Start with LF, detached] + expected: FAIL + + [Start with CRLF] + expected: FAIL + + [Start with CRLF, detached] + expected: FAIL + + [End with CR] + expected: FAIL + + [End with CR, detached] + expected: FAIL + + [End with LF] + expected: FAIL + + [End with LF, detached] + expected: FAIL + + [End with CRLF] + expected: FAIL + + [End with CRLF, detached] + expected: FAIL + + [innerText on <area> element] + expected: FAIL + + [innerText on <area> element, detached] + expected: FAIL + + [innerText on <base> element] + expected: FAIL + + [innerText on <base> element, detached] + expected: FAIL + + [innerText on <basefont> element] + expected: FAIL + + [innerText on <basefont> element, detached] + expected: FAIL + + [innerText on <bgsound> element] + expected: FAIL + + [innerText on <bgsound> element, detached] + expected: FAIL + + [innerText on <br> element] + expected: FAIL + + [innerText on <br> element, detached] + expected: FAIL + + [innerText on <col> element] + expected: FAIL + + [innerText on <col> element, detached] + expected: FAIL + + [innerText on <embed> element] + expected: FAIL + + [innerText on <embed> element, detached] + expected: FAIL + + [innerText on <frame> element] + expected: FAIL + + [innerText on <frame> element, detached] + expected: FAIL + + [innerText on <hr> element] + expected: FAIL + + [innerText on <hr> element, detached] + expected: FAIL + + [innerText on <image> element] + expected: FAIL + + [innerText on <image> element, detached] + expected: FAIL + + [innerText on <img> element] + expected: FAIL + + [innerText on <img> element, detached] + expected: FAIL + + [innerText on <input> element] + expected: FAIL + + [innerText on <input> element, detached] + expected: FAIL + + [innerText on <keygen> element] + expected: FAIL + + [innerText on <keygen> element, detached] + expected: FAIL + + [innerText on <link> element] + expected: FAIL + + [innerText on <link> element, detached] + expected: FAIL + + [innerText on <menuitem> element] + expected: FAIL + + [innerText on <menuitem> element, detached] + expected: FAIL + + [innerText on <meta> element] + expected: FAIL + + [innerText on <meta> element, detached] + expected: FAIL + + [innerText on <param> element] + expected: FAIL + + [innerText on <param> element, detached] + expected: FAIL + + [innerText on <source> element] + expected: FAIL + + [innerText on <source> element, detached] + expected: FAIL + + [innerText on <track> element] + expected: FAIL + + [innerText on <track> element, detached] + expected: FAIL + + [innerText on <wbr> element] + expected: FAIL + + [innerText on <wbr> element, detached] + expected: FAIL + + [innerText on <colgroup> element] + expected: FAIL + + [innerText on <colgroup> element, detached] + expected: FAIL + + [innerText on <frameset> element] + expected: FAIL + + [innerText on <frameset> element, detached] + expected: FAIL + + [innerText on <head> element] + expected: FAIL + + [innerText on <head> element, detached] + expected: FAIL + + [innerText on <html> element] + expected: FAIL + + [innerText on <html> element, detached] + expected: FAIL + + [innerText on <table> element] + expected: FAIL + + [innerText on <table> element, detached] + expected: FAIL + + [innerText on <tbody> element] + expected: FAIL + + [innerText on <tbody> element, detached] + expected: FAIL + + [innerText on <tfoot> element] + expected: FAIL + + [innerText on <tfoot> element, detached] + expected: FAIL + + [innerText on <thead> element] + expected: FAIL + + [innerText on <thead> element, detached] + expected: FAIL + + [innerText on <tr> element] + expected: FAIL + + [innerText on <tr> element, detached] + expected: FAIL + diff --git a/tests/wpt/web-platform-tests/innerText/getter.html b/tests/wpt/web-platform-tests/innerText/getter.html index e6ba0db64b7..7a517db3d14 100644 --- a/tests/wpt/web-platform-tests/innerText/getter.html +++ b/tests/wpt/web-platform-tests/innerText/getter.html @@ -15,6 +15,8 @@ <div id="container"></div> <svg id="svgContainer"></svg> <script> +let container = document.querySelector('#container'); +let svgContainer = document.querySelector('#svgContainer'); function testText(html, expectedPlain, msg) { textTextInContainer(container, html, expectedPlain, msg); } |