servo/components/layout
Anthony Ramine 13ea3ac413 Introduce trait Castable
This trait is used to hold onto the downcast and upcast functions of all
castable IDL interfaces. A castable IDL interface is one which either derives
from or is derived by other interfaces.

The deriving relation is represented by implementations of marker trait
DerivedFrom<T: Castable> generated in InheritTypes.

/^[ ]*use dom::bindings::codegen::InheritTypes::.*(Base|Cast|Derived)/ {
    /::[a-zA-Z]+(Base|Cast|Derived);/d
    s/([{ ])[a-zA-Z]+(Base|Cast|Derived), /\1/g
    s/([{ ])[a-zA-Z]+(Base|Cast|Derived), /\1/g
    s/, [a-zA-Z]+(Base|Cast|Derived)([},])/\2/g
    s/, [a-zA-Z]+(Base|Cast|Derived)([},])/\2/g
    /\{([a-zA-Z]+(Base|Cast|Derived))?\};$/d
    s/\{([a-zA-Z_]+)\};$/\1;/
}

s/([a-zA-Z]+)Cast::from_ref\(\&?\**([a-zA-Z_]+)(\.r\(\))?\)/\2.upcast::<\1>()/g
s/([a-zA-Z]+)Cast::from_ref\(\&?\**([a-zA-Z_]+)(\.[a-zA-Z_]+\(\))?\)/\2\3.upcast::<\1>()/g
s/\(([a-zA-Z]+)Cast::from_ref\)/\(Castable::upcast::<\1>\)/g

s/([a-zA-Z]+)Cast::from_root/Root::upcast::<\1>/g

s/([a-zA-Z]+)Cast::from_layout_js\(\&([a-zA-Z_.]+)\)/\2.upcast::<\1>()/g

s/([a-zA-Z]+)Cast::to_ref\(\&?\**([a-zA-Z_]+)(\.r\(\))?\)/\2.downcast::<\1>()/g
s/([a-zA-Z]+)Cast::to_ref\(\&?\**([a-zA-Z_]+)(\.[a-zA-Z_]+\(\))?\)/\2\3.downcast::<\1>()/g
s/\(([a-zA-Z]+)Cast::to_ref\)/\(Castable::downcast::<\1>\)/g

s/([a-zA-Z]+)Cast::to_root/Root::downcast::<\1>/g

s/([a-zA-Z]+)Cast::to_layout_js\(&?([a-zA-Z_.]+(\(\))?)\)/\2.downcast::<\1>()/g

s/\.is_document\(\)/.is::<Document>()/g
s/\.is_htmlanchorelement\(\)/.is::<HTMLAnchorElement>()/g
s/\.is_htmlappletelement\(\)/.is::<HTMLAppletElement>()/g
s/\.is_htmlareaelement\(\)/.is::<HTMLAreaElement>()/g
s/\.is_htmlbodyelement\(\)/.is::<HTMLBodyElement>()/g
s/\.is_htmlembedelement\(\)/.is::<HTMLEmbedElement>()/g
s/\.is_htmlfieldsetelement\(\)/.is::<HTMLFieldSetElement>()/g
s/\.is_htmlformelement\(\)/.is::<HTMLFormElement>()/g
s/\.is_htmlframesetelement\(\)/.is::<HTMLFrameSetElement>()/g
s/\.is_htmlhtmlelement\(\)/.is::<HTMLHtmlElement>()/g
s/\.is_htmlimageelement\(\)/.is::<HTMLImageElement>()/g
s/\.is_htmllegendelement\(\)/.is::<HTMLLegendElement>()/g
s/\.is_htmloptgroupelement\(\)/.is::<HTMLOptGroupElement>()/g
s/\.is_htmloptionelement\(\)/.is::<HTMLOptionElement>()/g
s/\.is_htmlscriptelement\(\)/.is::<HTMLScriptElement>()/g
s/\.is_htmltabledatacellelement\(\)/.is::<HTMLTableDataCellElement>()/g
s/\.is_htmltableheadercellelement\(\)/.is::<HTMLTableHeaderCellElement>()/g
s/\.is_htmltablerowelement\(\)/.is::<HTMLTableRowElement>()/g
s/\.is_htmltablesectionelement\(\)/.is::<HTMLTableSectionElement>()/g
s/\.is_htmltitleelement\(\)/.is::<HTMLTitleElement>()/g
2015-10-21 11:37:16 +02:00
..
css Remove the unused boolean in StyleSharingResult::CannotShare. 2015-10-19 15:01:30 +02:00
animation.rs layout: Do a couple of minor style cleanups. 2015-09-27 15:38:22 -07:00
block.rs Auto merge of #7825 - eefriedman:div-align, r=mbrubeck 2015-10-08 12:20:55 -06:00
Cargo.toml Update servo to use published app units crate 2015-10-01 11:45:35 +10:00
construct.rs Generate the TypeId enums in codegen 2015-10-14 18:45:35 +02:00
context.rs Split Au type into separate crate, with minimal dependencies. 2015-10-01 07:16:11 +10:00
data.rs layout: Make the compositor rather than layout determine the position of 2015-09-29 09:47:28 -07:00
display_list_builder.rs Integrate iframes into the display list 2015-10-20 07:29:06 -07:00
flex.rs Split Au type into separate crate, with minimal dependencies. 2015-10-01 07:16:11 +10:00
floats.rs Split Au type into separate crate, with minimal dependencies. 2015-10-01 07:16:11 +10:00
flow.rs Remove explicit lifetimes which can be elided. 2015-10-21 01:27:48 +02:00
flow_list.rs Remove explicit lifetimes which can be elided. 2015-10-21 01:27:48 +02:00
flow_ref.rs Remove explicit lifetimes which can be elided. 2015-10-21 01:27:48 +02:00
fragment.rs Remove explicit lifetimes which can be elided. 2015-10-21 01:27:48 +02:00
generated_content.rs Fix issues found by rust-clippy 2015-10-12 20:21:49 -04:00
incremental.rs Fix reported test-tidy errors for unmerged import blocks 2015-09-19 12:50:14 -04:00
inline.rs Auto merge of #7950 - mrobinson:layerize-iframes, r=pcwalton 2015-10-20 16:01:38 -06:00
layout_debug.rs sorted the extern crate, mod & use declarations 2015-09-24 02:12:45 +05:30
layout_task.rs Fix issues found by rust-clippy 2015-10-12 20:21:49 -04:00
lib.rs Split Au type into separate crate, with minimal dependencies. 2015-10-01 07:16:11 +10:00
list_item.rs Split Au type into separate crate, with minimal dependencies. 2015-10-01 07:16:11 +10:00
model.rs Split Au type into separate crate, with minimal dependencies. 2015-10-01 07:16:11 +10:00
multicol.rs Split Au type into separate crate, with minimal dependencies. 2015-10-01 07:16:11 +10:00
opaque_node.rs Replace OpaqueNodeMethods::from_{threadsafe_,}layout_node by opaque methods. 2015-06-24 14:55:43 +02:00
parallel.rs Rewrite ParallelPostorderDomTraversal::run_parallel to avoid some unnecessary conversions between LayoutNode and UnsafeLayoutNode. 2015-10-19 15:01:28 +02:00
query.rs Split Au type into separate crate, with minimal dependencies. 2015-10-01 07:16:11 +10:00
sequential.rs Split Au type into separate crate, with minimal dependencies. 2015-10-01 07:16:11 +10:00
table.rs Cleanup code that was warned by rust-clippy 2015-10-11 20:47:45 -04:00
table_caption.rs Split Au type into separate crate, with minimal dependencies. 2015-10-01 07:16:11 +10:00
table_cell.rs Split Au type into separate crate, with minimal dependencies. 2015-10-01 07:16:11 +10:00
table_colgroup.rs Split Au type into separate crate, with minimal dependencies. 2015-10-01 07:16:11 +10:00
table_row.rs Split Au type into separate crate, with minimal dependencies. 2015-10-01 07:16:11 +10:00
table_rowgroup.rs Split Au type into separate crate, with minimal dependencies. 2015-10-01 07:16:11 +10:00
table_wrapper.rs Split Au type into separate crate, with minimal dependencies. 2015-10-01 07:16:11 +10:00
text.rs Add support for pre-wrap and pre-line values for white-space. 2015-10-20 10:44:51 -07:00
traversal.rs Remove the boolean shareable flag in RecalcStyleForNode::process. 2015-10-19 15:01:31 +02:00
wrapper.rs Introduce trait Castable 2015-10-21 11:37:16 +02:00