Commit graph

130 commits

Author SHA1 Message Date
Patrick Walton
9e2b63ddd3 layout: Move the LayoutNode wrapper from script into layout. 2013-12-17 18:07:41 -08:00
Patrick Walton
c506e52c7c layout: Add a lifetime to LayoutNode to prevent layout from stuffing
them into evil places.
2013-12-17 18:07:41 -08:00
Patrick Walton
ee9873bdb5 script: Harden layout a bit more by mostly prohibiting it from seeing
`AbstractNode` at all.

It can still see it by calling `with_element` for now, although that
needs to be fixed.
2013-12-17 18:07:12 -08:00
Patrick Walton
be69a503fe script: Eliminate the phantom type in favor of just whitelisting methods
that layout can safely call.

This is simpler. Currently, the set of methods is not safe, but I plan
to lock it down more soon.
2013-12-17 18:07:12 -08:00
Patrick Walton
199ca33b72 script: Make trees less generic 2013-12-17 13:46:14 -08:00
Bruno de Oliveira Abinader
cfb73ed123 Make Node::is_in_doc O(1)
Added a flags variable inside Node to represent boolean flags, with
is_in_doc being the first of them. It is updated whenever a node is
appended or removed from a parent.

This patch is for:
https://github.com/mozilla/servo/issues/1030
2013-12-17 16:32:43 -04:00
Ms2ger
7f4283f4bc Rename some 'new' functions to 'new_inherited'. 2013-12-12 14:34:58 +01:00
patrick kim
0026eb0899 remove @ in LayoutTask.FontContext 2013-12-11 11:42:14 +09:00
Patrick Walton
30bbaa49b7 Revert "auto merge of #1356 : ksh8281/servo/remove_@_in_LayoutTask.FontContext, r=pcwalton"
This reverts commit e8ffac13d7, reversing
changes made to db923feffe.

Reverting this change because FreeType is *not* thread safe. See the
documentation here:

http://www.freetype.org/freetype2/docs/reference/ft2-base_interface.html

"In multi-threaded applications, make sure that the same FT_Library
object or any of its children doesn't get accessed in parallel."

We will need to use a `MutexArc` instead.
2013-12-09 19:40:08 -08:00
patrick kim
f187035e25 remove @ in LayoutTask.FontContext 2013-12-10 08:59:43 +09:00
bors-servo
529c21bb65 auto merge of #1252 : jdm/servo/layoutassert, r=jdm,metajack
...224.
2013-12-02 16:32:32 -08:00
Josh Matthews
f9f9c42ab7 Ensure that it's safe to modify the DOM node pointers before doing so. Fixes #1224. 2013-12-02 19:25:11 -05:00
june0cho
266b551aa4 Implement local bookmark(hashtag) for Acid2. With @joonwonlee
Support hashtag through link (e.g. <a href="#top">)
2013-12-01 00:36:11 +09:00
Daniel Glazman
9b691611ff Implement :root pseudo-class. Fix #1263, fix #1265 2013-11-20 16:41:12 +00:00
Patrick Walton
155befe10d Rewrite flow construction to be incrementalizable and parallelizable.
This replaces flow construction with a strict bottom-up tree traversal,
allowing for parallelism. Each step of the traversal creates a flow or
a `ConstructionItem`, similar to how Gecko works. {ib} splits are
handled by not creating `InlineFlow`s until the containing block is
reached.

This should be able to be incrementalized by storing the `Flow` from
layout to layout, and performing fixups during flow construction
and/or wiping containing blocks in a previous pass.
2013-11-18 11:24:11 -08:00
Ms2ger
dc6dbc63af Make the HTML parser parse into the document rather than an element.
This removes the duplicate html element.
2013-11-17 13:58:24 +01:00
Tetsuharu OHZEKI
f5ef4365f4 Stop passing DOMStrings via borrowed pointer. (#1201) 2013-11-14 20:35:36 +09:00
bors-servo
4eb8449621 auto merge of #1208 : pcwalton/servo/any-layout-data, r=metajack
Breaks the dependency between `gfx` and `script`, which is nice.

This exposed some performance issues with Rust's `Any` type, which I've filed:

https://github.com/mozilla/rust/issues/10382
2013-11-13 00:07:16 -08:00
Ms2ger
df41a30814 Implement a missing step in the node 'insert' algorithm. 2013-11-12 19:24:22 +01:00
Ms2ger
9bcf5468e4 Rewrite replace_all. 2013-11-13 01:47:47 +09:00
Ms2ger
08afc6d19d Don't pass nullable strings to native DOM methods that want non-nullable strings. Fixes #1207. 2013-11-12 13:57:18 +01:00
Ms2ger
803cd4b7cf Make DOMString represent a non-nullable string. 2013-11-12 13:32:53 +01:00
Patrick Walton
6ff7b4a6a6 Use Any for the layout data.
Breaks the dependency between `gfx` and `script`, which is nice.
2013-11-08 22:45:40 -08:00
Ms2ger
80a6103f7d Remove Reflectable::GetParentObject. 2013-11-06 21:56:47 +01:00
Ms2ger
53731b62ae Remove Reflectable::wrap_object_shared. 2013-11-06 16:40:16 +01:00
bors-servo
c2a99933c9 auto merge of #1171 : jdm/servo/events2, r=jdm,metajack
Now with a split between commits that just pull in unmodified Gecko code and those that modify it.
2013-11-05 10:49:21 -08:00
bors-servo
a55cba04c6 auto merge of #1170 : Ms2ger/servo/pre-insert-document, r=jdm 2013-11-05 10:28:27 -08:00
Josh Matthews
88f5c2b133 Add basic event dispatch with bubbling, capturing, and propagation interruption. 2013-11-05 12:58:28 -05:00
Josh Matthews
7ecf5abbbd Generate code for handling callbacks. Implement add/removeEventListener and hacky dispatchEvent proof-of-concept. 2013-11-05 12:58:28 -05:00
Ms2ger
8c810bf032 Remove Node::as_abstract_node. 2013-11-02 23:31:04 +01:00
Simon Sapin
7a48cb6815 Only export an explicit public API in the style crate
I.e. make every module private by default.
2013-11-01 14:11:13 +00:00
Ms2ger
6623c580a3 Implement restrictions on the children of Document nodes. 2013-11-01 12:13:30 +01:00
bors-servo
352acbb833 auto merge of #1163 : metajack/servo/kmc-rust-upgrade, r=kmcallister
Most work courtesy of @kmcallister.

I already reviewed Keegan's work, so just the last two commits need attention.
2013-10-31 16:34:14 -07:00
Keegan McAllister
e2b7885b73 fmt! -> format! 2013-10-31 14:58:55 -06:00
Josh Matthews
99a36cbeb6 Make Document a Node. 2013-10-31 13:34:44 -04:00
Ms2ger
801348270c Address review comments and replace add_to_doc with node_removed and node_inserted functions. 2013-10-30 11:13:58 +01:00
Ms2ger
2ca1eede9a Implement insertBefore and reimplement appendChild. 2013-10-29 21:48:28 +01:00
bors-servo
2c3d5ec79f auto merge of #1138 : Ms2ger/servo/reflect-HTMLUnknownElement, r=jdm
@jdm: I think we should move nodes more in line with the rest of the DOM. How do you feel about something like this?
2013-10-29 12:17:44 -07:00
Jaeman Park
6dba191efe Implementation of pseudo class 'first-child'. 2013-10-29 14:53:39 +00:00
Patrick Walton
42092921c1 Optimize reflow by changing enums to traits and inlining more 2013-10-28 13:22:26 -07:00
Ms2ger
49b8c7c9b7 Implement HTMLUnknownElement::new. 2013-10-26 13:24:56 +02:00
Patrick Walton
baba35adc9 Revert "Make Document a Node." for breaking Acid1
This reverts commit 4e47d59165.

Conflicts:

	src/components/script/dom/domparser.rs
2013-10-24 15:08:09 -07:00
bors-servo
13644ccab1 auto merge of #1079 : jdm/servo/docnode, r=jdm,metajack
The bit I don't like about these changes is that I ended up hiding the document node from the CSS selecting/matching code, so it continues thinking of the document's first child as the root. When I tried to send the full tree including the document node to layout, the layout code refused to create any child flows. When I sent the document's first child without hiding the document, it saw inherited values for properties like font-family, and later tried to treat the document node as an Element when searching for named nodes.
2013-10-24 09:15:55 -07:00
Josh Matthews
4e47d59165 Make Document a Node. 2013-10-24 18:07:46 +02:00
Ms2ger
5d1eea5f03 Remove unused get_scope_and_cx functions. 2013-10-24 16:37:56 +02:00
Ms2ger
5ee3bc7450 Cleanup NodeList bindings. 2013-10-23 21:13:18 +02:00
Simon Sapin
2045f6a068 Remove (now unused) NetSurf’s libcss and libwapcaplet.
This removes four submodules (two C libraries and their Rust bindings.)
2013-10-23 14:42:29 +02:00
bors-servo
9b25df1968 auto merge of #1109 : sanxiyn/servo/new-style, r=SimonSapin
Regressions are:
* Incremental layout is broken
* `:link` is broken
* Source URL is not passed to CSS parser
* `text-decoration` propagation for block containers establishing an inline formatting context is not handled

This also does not remove NetSurf libcss from the build. That can be done in a followup.

This was a team effort. Credits to Deokjin Kim, Ilyong Cho, Jaeman Park, Junyoung Cho, Ryan Choi, Sangeun Kim, Yongjin Kim, Youngmin Yoo, Youngsoo Son.
2013-10-23 03:57:55 -07:00
Ilyong Cho
a4aa8b05f7 Implementation of node.parentNode/parentElement 2013-10-23 17:04:57 +09:00
Seo Sanghyeon
b2431912d3 Use the new style system
Credits to:
    Deokjin Kim
    Ilyong Cho
    Jaeman Park
    Junyoung Cho
    Ryan Choi
    Sangeun Kim
    Yongjin Kim
    Youngmin Yoo
    Youngsoo Son
2013-10-23 16:49:35 +09:00