mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Auto merge of #11656 - Ms2ger:reduce-dom-exposure, r=nox
Reduce the amount of dom code used outside the script crate. <!-- Reviewable:start --> This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11656) <!-- Reviewable:end -->
This commit is contained in:
commit
1e3edf3ca4
41 changed files with 166 additions and 161 deletions
|
@ -34,9 +34,9 @@ use inline::{InlineFragmentNodeInfo, LAST_FRAGMENT_OF_ELEMENT};
|
|||
use list_item::{ListItemFlow, ListStyleTypeContent};
|
||||
use multicol::{MulticolFlow, MulticolColumnFlow};
|
||||
use parallel;
|
||||
use script::dom::bindings::inheritance::{CharacterDataTypeId, ElementTypeId};
|
||||
use script::dom::bindings::inheritance::{HTMLElementTypeId, NodeTypeId};
|
||||
use script::dom::htmlobjectelement::is_image_data;
|
||||
use script::layout_interface::is_image_data;
|
||||
use script::layout_interface::{CharacterDataTypeId, ElementTypeId};
|
||||
use script::layout_interface::{HTMLElementTypeId, NodeTypeId};
|
||||
use std::borrow::ToOwned;
|
||||
use std::collections::LinkedList;
|
||||
use std::marker::PhantomData;
|
||||
|
|
|
@ -30,7 +30,7 @@ use net_traits::image::base::{Image, ImageMetadata};
|
|||
use net_traits::image_cache_thread::{ImageOrMetadataAvailable, UsePlaceholder};
|
||||
use range::*;
|
||||
use rustc_serialize::{Encodable, Encoder};
|
||||
use script::dom::htmlcanvaselement::HTMLCanvasData;
|
||||
use script::layout_interface::HTMLCanvasData;
|
||||
use std::borrow::ToOwned;
|
||||
use std::cmp::{max, min};
|
||||
use std::collections::LinkedList;
|
||||
|
|
|
@ -47,7 +47,7 @@ use query::process_offset_parent_query;
|
|||
use query::{LayoutRPCImpl, process_content_box_request, process_content_boxes_request};
|
||||
use query::{process_node_geometry_request, process_node_layer_id_request, process_node_scroll_area_request};
|
||||
use query::{process_node_overflow_request, process_resolved_style_request, process_margin_style_query};
|
||||
use script::dom::node::OpaqueStyleAndLayoutData;
|
||||
use script::layout_interface::OpaqueStyleAndLayoutData;
|
||||
use script::layout_interface::{LayoutRPC, OffsetParentResponse, NodeOverflowResponse, MarginStyleResponse};
|
||||
use script::layout_interface::{Msg, NewLayoutThreadInfo, Reflow, ReflowQueryType, ScriptReflow};
|
||||
use script::reporter::CSSErrorReporter;
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
|
||||
use gfx::display_list::OpaqueNode;
|
||||
use libc::{c_void, uintptr_t};
|
||||
use script::dom::bindings::js::LayoutJS;
|
||||
use script::dom::node::Node;
|
||||
use script::layout_interface::LayoutJS;
|
||||
use script::layout_interface::Node;
|
||||
use script::layout_interface::TrustedNodeAddress;
|
||||
use script_traits::UntrustedNodeAddress;
|
||||
|
||||
|
|
|
@ -39,22 +39,12 @@ use incremental::RestyleDamage;
|
|||
use msg::constellation_msg::PipelineId;
|
||||
use opaque_node::OpaqueNodeMethods;
|
||||
use range::Range;
|
||||
use script::dom::attr::AttrValue;
|
||||
use script::dom::bindings::inheritance::{CharacterDataTypeId, ElementTypeId};
|
||||
use script::dom::bindings::inheritance::{HTMLElementTypeId, NodeTypeId};
|
||||
use script::dom::bindings::js::LayoutJS;
|
||||
use script::dom::characterdata::LayoutCharacterDataHelpers;
|
||||
use script::dom::document::{Document, LayoutDocumentHelpers};
|
||||
use script::dom::element::{Element, LayoutElementHelpers, RawLayoutElementHelpers};
|
||||
use script::dom::htmlcanvaselement::{LayoutHTMLCanvasElementHelpers, HTMLCanvasData};
|
||||
use script::dom::htmliframeelement::HTMLIFrameElement;
|
||||
use script::dom::htmlimageelement::LayoutHTMLImageElementHelpers;
|
||||
use script::dom::htmlinputelement::{HTMLInputElement, LayoutHTMLInputElementHelpers};
|
||||
use script::dom::htmltextareaelement::{HTMLTextAreaElement, LayoutHTMLTextAreaElementHelpers};
|
||||
use script::dom::node::{CAN_BE_FRAGMENTED, HAS_CHANGED, HAS_DIRTY_DESCENDANTS, IS_DIRTY};
|
||||
use script::dom::node::{LayoutNodeHelpers, Node, OpaqueStyleAndLayoutData};
|
||||
use script::dom::text::Text;
|
||||
use script::layout_interface::TrustedNodeAddress;
|
||||
use script::layout_interface::{CAN_BE_FRAGMENTED, HAS_CHANGED, HAS_DIRTY_DESCENDANTS, IS_DIRTY};
|
||||
use script::layout_interface::{CharacterDataTypeId, Document, Element, ElementTypeId};
|
||||
use script::layout_interface::{HTMLCanvasData, HTMLElementTypeId, LayoutCharacterDataHelpers};
|
||||
use script::layout_interface::{LayoutDocumentHelpers, LayoutElementHelpers, LayoutJS};
|
||||
use script::layout_interface::{LayoutNodeHelpers, Node, NodeTypeId, OpaqueStyleAndLayoutData};
|
||||
use script::layout_interface::{RawLayoutElementHelpers, Text, TrustedNodeAddress};
|
||||
use selectors::matching::{DeclarationBlock, ElementFlags};
|
||||
use selectors::parser::{AttrSelector, NamespaceConstraint};
|
||||
use smallvec::VecLike;
|
||||
|
@ -63,6 +53,7 @@ use std::marker::PhantomData;
|
|||
use std::mem::{transmute, transmute_copy};
|
||||
use std::sync::Arc;
|
||||
use string_cache::{Atom, BorrowedAtom, BorrowedNamespace, Namespace};
|
||||
use style::attr::AttrValue;
|
||||
use style::computed_values::content::ContentItem;
|
||||
use style::computed_values::{content, display};
|
||||
use style::dom::{PresentationalHintsSynthetizer, TDocument, TElement, TNode, UnsafeNode};
|
||||
|
@ -1142,39 +1133,25 @@ impl<'ln> ThreadSafeLayoutNode for ServoThreadSafeLayoutNode<'ln> {
|
|||
fn selection(&self) -> Option<Range<ByteIndex>> {
|
||||
let this = unsafe { self.get_jsmanaged() };
|
||||
|
||||
let selection = if let Some(area) = this.downcast::<HTMLTextAreaElement>() {
|
||||
unsafe { area.selection_for_layout() }
|
||||
} else if let Some(input) = this.downcast::<HTMLInputElement>() {
|
||||
unsafe { input.selection_for_layout() }
|
||||
} else {
|
||||
return None;
|
||||
};
|
||||
selection.map(|range| Range::new(ByteIndex(range.start as isize),
|
||||
ByteIndex(range.len() as isize)))
|
||||
this.selection().map(|range| {
|
||||
Range::new(ByteIndex(range.start as isize),
|
||||
ByteIndex(range.len() as isize))
|
||||
})
|
||||
}
|
||||
|
||||
fn image_url(&self) -> Option<Url> {
|
||||
unsafe {
|
||||
self.get_jsmanaged().downcast()
|
||||
.expect("not an image!")
|
||||
.image_url()
|
||||
}
|
||||
let this = unsafe { self.get_jsmanaged() };
|
||||
this.image_url()
|
||||
}
|
||||
|
||||
fn canvas_data(&self) -> Option<HTMLCanvasData> {
|
||||
unsafe {
|
||||
let canvas_element = self.get_jsmanaged().downcast();
|
||||
canvas_element.map(|canvas| canvas.data())
|
||||
}
|
||||
let this = unsafe { self.get_jsmanaged() };
|
||||
this.canvas_data()
|
||||
}
|
||||
|
||||
fn iframe_pipeline_id(&self) -> PipelineId {
|
||||
use script::dom::htmliframeelement::HTMLIFrameElementLayoutMethods;
|
||||
unsafe {
|
||||
let iframe_element = self.get_jsmanaged().downcast::<HTMLIFrameElement>()
|
||||
.expect("not an iframe element!");
|
||||
iframe_element.pipeline_id().unwrap()
|
||||
}
|
||||
let this = unsafe { self.get_jsmanaged() };
|
||||
this.iframe_pipeline_id()
|
||||
}
|
||||
|
||||
fn get_colspan(&self) -> u32 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue