Commit graph

238 commits

Author SHA1 Message Date
Simon Sapin
b19cc7e44c Fix warnings
Fixing unused attributes warnings required updating serde_macros
which required updating to rustc 1.6.0-nightly (a2866e387 2015-11-30)
which required updating some other dependencies.
2015-12-03 17:05:26 +01:00
Bobby Holley
cf33f00018 Generalize the rest of layout to operate on generic Layout*.
There wasn't a good way to split this up, unfortunately.

With this change, the only remaining usage of the Servo-specific structures is
in layout_task, where the root node is received from the script task. \o/
2015-11-28 18:01:02 -08:00
Bobby Holley
3aeaff35de Switch ChildrenIterator to be an associated type.
If we use ThreadsafeLayoutNodeChildrenIterator directly as the return type of children(),
we need to export the DangerousThreadSafeLayoutNode which the iterator implementation
relies upon.
2015-11-28 18:01:02 -08:00
Bobby Holley
2cfe4de09b Constrain the ConcreteLayoutFoo associated types to provide full tri-ality among the types.
Otherwise we end up with this problem: http://is.gd/ACBLAU
2015-11-28 18:01:02 -08:00
Guillaume Gomez
adf8b359bb Add XMLDocument object 2015-11-27 14:55:41 +01:00
Alan Jeffrey
3dec6edd10 Update string_cache to 0.2.
Updated string_cache, html5ever, xml5ever and selectors in Cargo.toml files and Cargo.lock.
Removed references to string_cache_plugin.
Import atom! and ns! from string_cache.
Replaced ns!("") by ns!().
Replaced ns!(XML) and co by ns!(xml) and co.
Replaced atom!(foo) by atom!("foo").
Replaced Atom::from_slice by Atom::from.
Replaced atom.as_slice() by &*atom.
2015-11-25 10:13:21 -06:00
bors-servo
711f516d80 Auto merge of #8639 - bholley:generalize_wrappers2, r=pcwalton
Use associated types for layout wrapper trait, and generalized ThreadSafeLayoutFoo

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8639)
<!-- Reviewable:end -->
2015-11-24 04:01:32 +05:30
Bobby Holley
afa3834f3b Rename ThreadSafeLayoutFoo to ServoThreadSafeLayoutFoo and TThreadSafeLayoutFoo to ThreadSafeLayoutFoo. 2015-11-21 11:26:49 -08:00
Bobby Holley
a85ae24c51 Hoist exported ThreadSafeLayoutFoo functionality into traits. 2015-11-21 11:25:20 -08:00
Bobby Holley
05db7b3652 Use associated types instead of wrapper types. 2015-11-21 10:18:02 -08:00
Bobby Holley
516619b230 Make the LayoutElement trait implement TElementAttributes. 2015-11-21 10:18:01 -08:00
Keith Yeung
7de7cb4786 Extend whitespace::T with additional helper methods 2015-11-20 11:05:36 -08:00
Bobby Holley
2f6e94943a Rename Layout*Trait to Layout*.
The next step will be to remote the Servo-specificity of the layout code we want
to share by making it operate generically on Layout*.
2015-11-18 17:24:36 -08:00
Bobby Holley
9dd45b9f2a Prefix concrete types with 'Servo'. 2015-11-18 17:23:46 -08:00
Bobby Holley
54f2700ba6 Hoist exported wrapper functionality into a family of traits.
All the existing code still uses the concrete implementations, so this
shouldn't impact the generated code at all.
2015-11-18 17:23:29 -08:00
Ms2ger
5ec1cdea9b Remove dead code from layout. 2015-11-18 15:00:58 +01:00
Ms2ger
3fb16cc017 Privatize from_layout_js functions. 2015-11-17 09:40:51 +01:00
Ms2ger
9c1d678b1b Remove get_unsigned_integer_attribute. 2015-11-15 11:24:03 +01:00
Ms2ger
5417df6397 Introduce a get_colspan method on LayoutJS<Element>. 2015-11-15 11:16:17 +01:00
Alan Jeffrey
84bde75b42 Replaced DOMString constructor by conversion functions.
Replaced DOMString(...) by DOMString::from(...).
Replaced ....0 by String::from(...).
Removed any uses of .to_owner() in DOMString::from("...").
2015-11-12 17:52:59 -06:00
Bobby Holley
b29369296c Add ::from_layout_js factory to LayoutNode, LayoutElement, and LayoutDocument. 2015-11-10 11:57:25 -08:00
Bobby Holley
7fa7936657 Implement attribute restyle hints.
Fixes #6942.
2015-11-10 11:57:24 -08:00
Bobby Holley
47744d95ad Make RESTYLE_SELF imply RESTYLE_DESCENDANTS.
This is a temporary workaround for #8438.
2015-11-10 11:41:28 -08:00
Bobby Holley
7dba4447f1 Store pristine element state rather than a set of changes.
This is the strategy we'll need to take for attributes, and so this change
puts us in a position to handle attributes and state the same way.

This does mean that we stop taking care to track the situations where our
state has reverted to the original state, with no net change. I think that's
probably of negligible value though.
2015-11-04 19:09:58 -08:00
Ms2ger
6b75078503 Make DOMString a newtype around String, rather than a typedef.
This should make it somewhat easier to experiment with alternative
representations in the future. To reduce churn, this commit leaves the String
field public, though.

Also, this will allow us to use the default String type to represent the IDL
USVString type, which explicitly forbids unpaired surrogates, ans as such is
a better match to the Rust String type.
2015-11-04 12:09:11 +01:00
bors-servo
e91169c0e2 Auto merge of #8265 - fiji-flo:password_caret, r=eefriedman
add get_raw_layout_value (HTMLInputElementHelpers)

This resolves #8107
Previously the index of the insetion point for a password input was
calculated using the scrambled string based on the edit point in the
raw string. That could lead to a wrong position of the caret. This
commit changes this behavior to calculate the insertion point using
the raw string.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8265)
<!-- Reviewable:end -->
2015-11-04 05:29:59 +05:30
Florian Merz
c26b80cf4f add get_insertion_point_index_for_layout
This resolves #8107
Previously the index of the insetion point for a password input was
calculated using the scrambled string based on the edit point in the
raw string. That could lead to a wrong position of the caret. This
commit changes this behavior to calculate the insertion point using
the raw string.
This is done in
`HTMLInputElementHelpers::get_insertion_point_index_for_layout`
and relies on a 1:1 mapping of the chars in the raw input to the
scrambled chars (currently bullets) in the password input.
2015-11-03 21:55:41 +01:00
rohan.prinja
6e774ea6eb merge from master 2015-11-03 19:01:23 +09:00
Bobby Holley
45fc7f2930 Implement restyle hints for state changes. 2015-10-31 14:28:52 -07:00
Bobby Holley
79ac365a68 Move EventState to rust-selectors. 2015-10-30 21:02:35 -07:00
rohan.prinja
51df8e310b rearrange imports to be in alphabetical order 2015-10-30 20:28:59 +09:00
rohan.prinja
9fd823e449 replace InheritTypes imports with inheritance imports 2015-10-30 20:26:30 +09:00
rohan.prinja
45224028db more refactoring 2015-10-30 20:26:29 +09:00
bors-servo
6cc8186481 Auto merge of #8187 - Ms2ger:layoutnode-new, r=pcwalton
Introduce a Layoutnode::new function and use it.



<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8187)
<!-- Reviewable:end -->
2015-10-30 13:43:17 +05:30
bors-servo
b6bcccb204 Auto merge of #8212 - Ms2ger:reflow-root, r=pcwalton
Remove SharedLayoutContext::reflow_root.



<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8212)
<!-- Reviewable:end -->
2015-10-30 05:22:54 +05:30
Ms2ger
cce510900e Use LayoutNode::new to avoid transmute calls in LayoutTask. 2015-10-29 16:55:27 +01:00
Ms2ger
1eb8900f48 Simplify LayoutDocument::root_node. 2015-10-29 16:54:20 +01:00
Ms2ger
06f9a2bc34 Implement a LayoutNode::new function. 2015-10-29 14:24:15 +01:00
Ms2ger
244bd11f3f Privatize LayoutNode::chain.
There is no reason for this field to be public.
2015-10-29 14:24:14 +01:00
Bobby Holley
069c40f788 Check modified event state from layout and dirty it there.
This adds some overhead, but also provides the small performance benefit of
avoiding dirtying in the case where an event state is toggled an even
number of times between reflows.

The main benefit here though is that it sets us up to be smarter about
what we mark as dirty using restyle hints.
2015-10-27 12:48:48 -07:00
Bobby Holley
441c84d75d Pass the document instead of the documentElement to reflow. 2015-10-27 12:41:16 -07:00
Ms2ger
9f91984415 Use the passed-in reflow root rather than the one stored in the SharedLayoutContext. 2015-10-26 17:51:26 +01:00
bors-servo
f6e3146de2 Auto merge of #8208 - Ms2ger:lnfuln, r=jdm
Return a LayoutNode with a limited lifetime from layout_node_from_unsafe_layout_node (fixes #3044).



<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8208)
<!-- Reviewable:end -->
2015-10-26 11:08:33 -05:00
Ms2ger
2f019f2d88 Return a LayoutNode with a limited lifetime from layout_node_from_unsafe_layout_node (fixes #3044). 2015-10-26 15:03:23 +01:00
Ms2ger
b1f4bf617d Pass all the data layout needs from canvas elements at once. 2015-10-26 11:43:23 +01:00
Florian Merz
80e8a674e2 display input caret for textarea. fixes #7758 2015-10-21 22:38:23 +02:00
Bobby Holley
228eff7272 Remove HAS_DIRTY_SIBLINGS.
This isn't doing anything right now, and we're not even setting it properly
in dirty_impl the |dirty_subtree(self)| was causing us to hit the skip case
for step 3.
2015-10-21 09:56:07 -07:00
Anthony Ramine
68014af78e Clean up the cast calls 2015-10-21 11:40:34 +02:00
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
Eli Friedman
3a451ff845 Add support for pre-wrap and pre-line values for white-space.
This is mostly straightforward.  I had to modify a couple of places
which were accidentally discarding whitespace.

Fixes #1513.
2015-10-20 10:44:51 -07:00