Commit graph

93 commits

Author SHA1 Message Date
Patrick Walton
7d447dbc06 script: Stop trusting pointers to DOM nodes that layout provides.
Pointers to DOM nodes from layout could go stale if incremental reflow
does not correctly destroy dead nodes. Therefore, we ask the JavaScript
garbage collector to verify that each DOM node is indeed a valid pointer
before calling event handlers on it, and fail otherwise.
2014-01-14 21:51:24 -08:00
zmike
193b6d2635 add names for all servo spawned tasks
* add servo_util::task::{spawn_named,spawn_with_named} functions

* add name param for spawn_listener and spawn_conversation functions

this should resolve #1169
2014-01-13 13:12:48 -05:00
Jack Moffitt
a7ef1cd35e Upgrade to latest Rust. 2014-01-12 19:45:45 -07:00
Simon Sapin
a16087da5f Selector mathing: Move the pseudo-elements buckets inside Stylist.
Refactor to have only one Stylist per document.
2014-01-08 14:54:16 +00:00
Jaeman Park
62691cb6ef Change range to iter() and add comment for FirstLine and FirstLetter 2014-01-08 09:09:52 +09:00
Jaeman Park
138e425607 CSS parsing/selector-matching for pseudo elements 2014-01-07 18:03:07 +09:00
Patrick Walton
9e2b63ddd3 layout: Move the LayoutNode wrapper from script into layout. 2013-12-17 18:07:41 -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
Patrick Walton
89af9017ef layout: Replace AbstractNodes in layout with OpaqueNode, preventing
DOM access during reflow.
2013-12-16 15:17:15 -08:00
Daniel Hedlund
e7a591a7e1 Ensure render and layout tasks get destructed before main thread finishes
Fixes #1097.
2013-12-15 14:25:41 -08:00
Patrick Walton
971f77d2c6 layout: Stop going to the DOM for iframe sizes 2013-12-13 15:10:04 -08:00
Patrick Walton
21e8c72a75 constellation: Stop using futures for frame sizes.
This will allow us to stop going to the DOM in order to handle iframe
sizing. Instead we can just store the pipeline and frame IDs of iframes
inside the flow tree itself.
2013-12-13 10:43:27 -08:00
Patrick Walton
a2e91d242b layout: Perform text decoration propagation per CSS 2.1 § 16.3.1 without
going to the DOM.
2013-12-12 17:54:51 -08:00
bors-servo
144737ce1b auto merge of #1394 : kmcallister/servo/style-damage, r=pcwalton
This fixes the computation of restyle damage on `color-change-text.html`, which can be seen with `RUST_LOG=servo::layout::layout_task`.

However we can't prune the layout traversals yet, because we don't reuse `Flow` objects between reflows, so we have no old values to fall back to.

I think this used to work because `FlowContexts` (as they were called then) were stored in a DOM node's `LayoutData` and reused.  But it's possible that it never really worked, and my testing when I landed the restyle damage code was insufficient (I didn't understand the layout code nearly as well back then).

r? @pcwalton
2013-12-12 15:17:27 -08:00
Keegan McAllister
53747638a1 Disable remaining reflow traversal pruning for now
We don't reuse Flow objects between reflows, so we have no old values to fall
back to.

I think this used to work because FlowContexts (as they were called then) were
stored in a DOM node's LayoutData and reused.  But it's possible that it never
really worked, and my testing when I landed the restyle damage code was
insufficient (I didn't understand the layout code nearly as well back then).
2013-12-12 14:44:34 -08:00
Patrick Walton
4c8383c38b layout: Reference count ComputedValues structures like Gecko does.
This has no difference in CSS selector matching performance and results
in a 31% speedup in constraint solving on the rainbow page.
2013-12-12 14:44:24 -08:00
Keegan McAllister
dd0bb08927 Print restyle damage for debugging 2013-12-12 14:43:24 -08:00
Keegan McAllister
c3c87e3d44 Propagate up the right bits of style damage
The call to propagate_up was lost in eb1b40db13.
2013-12-12 11:52:35 -08:00
Patrick Walton
511d2b11d4 layout: If the border style is "none", treat its width as 0.
Closes #1383.
2013-12-11 17:46:36 -08: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
bors-servo
e8ffac13d7 auto merge of #1356 : ksh8281/servo/remove_@_in_LayoutTask.FontContext, r=pcwalton
Remove @ in LayoutTask.FontContext, ScannedTextBox.text_run
#1334
2013-12-09 19:13:45 -08:00
Patrick Walton
64222f5772 layout: Remove DisplayBoxes to save memory and as one step toward an
`@`-free layout
2013-12-09 18:16:06 -08:00
patrick kim
f187035e25 remove @ in LayoutTask.FontContext 2013-12-10 08:59:43 +09:00
Keegan McAllister
962984fb3b Reflow with full style damage when content changes
Fixes #664.
2013-12-09 12:34:33 -08:00
Keegan McAllister
dda6d2b53c Convert LayoutContext.image_cache from @mut to MutexArc
LocalImageCache isn't Freeze so we have to use unsafe_access,
which exists for MutexArc and not RWArc.
2013-12-06 11:31:49 -08:00
Bruno de Oliveira Abinader
bf277e634b s/FlowContext/Flow
This patch is for:
https://github.com/mozilla/servo/issues/1282
2013-12-02 16:14:06 -04:00
bors-servo
b867e54dd4 auto merge of #1298 : recrack/servo/overflow_property, r=metajack
Impl #1290

@jaeminMoon @ksh8281 
Thanks @metajack
2013-11-28 21:46:51 -08:00
Patrick Walton
7eb4097dc9 layout: Make the LocalImageCache on_image_available callback not use
`@`.

This is one small step toward parallel layout.
2013-11-26 11:55:15 -08:00
patrick kim
9b4b414abe fix ContentBoxQuery 2013-11-26 11:49:44 +09:00
sh8281.kim
af80c57029 modify to displaylist to tree & add cliping 2013-11-26 11:49:44 +09:00
Isabelle Carter
9886135b43 unrendered content uses doc's background color
uses html's background color, or body's.
2013-11-24 16:50:12 -06: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
Tetsuharu OHZEKI
3cdc115ff0 Rename main/layout/aux.rs -> main/layout/extra.rs. (#1226) 2013-11-13 20:25:52 +09: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
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
bors-servo
ddce8b8fa0 auto merge of #1152 : ILyoan/servo/parallel_selector_matching, r=SimonSapin
This an attempt to parallelize selector matching.

Approach
* Let the `match_subtree` spawn limited number of tasks.
* Each of them takes a list of nodes that is uniformly distributed
* And then each task does the selector matching for every single node in its list.

(Not sure if this is worthwhile for long term especially considering CSS optimizing techniques such as ancestor filter or style sharing)

Benchmark from my machine (LayoutSelectorMatchCategory) (intel i7 3.4GHz * 8, linux x86_64)
* src/test/demo.html
 * original: 0.07ms
 * parallel: 0.20ms
* perf-rainbow.html
 * original: 485ms
 * parallel: 245ms
* A test page with 15000 nodes and 3000 CSS selector(including inline style).
 * original: 140ms
 * parallel: 60ms
2013-10-31 23:25:26 -07:00
Keegan McAllister
e2b7885b73 fmt! -> format! 2013-10-31 14:58:55 -06:00
Patrick Walton
5327c9c44f Implement basic overflow computation. Closes #1148.
This adds just 4 ms out of ~120 ms on the rainbow page.
2013-10-31 10:41:47 -07:00
Ilyong Cho
901dfc45e5 parallel selector matching 2013-10-31 11:33:40 +09:00
Patrick Walton
42092921c1 Optimize reflow by changing enums to traits and inlining more 2013-10-28 13:22:26 -07: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
Jack Moffitt
94202661c0 Update to latest Rust. 2013-10-21 17:38:34 -06:00
Keegan McAllister
8bd9be7240 Add a spawn_with! macro and clean up some spawns 2013-10-17 19:51:50 -07:00
Simon Sapin
a325905fa6 Move the gfx::geometry module to servo_util::geometry.
This is part of #1006, in order to use Au from the script crate
without introducing a circular crate dependency.
2013-10-16 14:55:07 +01:00
Tim Kuehn
103cd6255d split script_task::ExitMsg into WindowExitMsg and PipelineExitMsg 2013-09-24 00:15:35 -04:00
Josh Matthews
d465abdb1c Make all DOM manipulation wait until it's safe to do so (ie. all reflows for the page have completed). Fix a race where a newly-initiated reflow would be considered complete when receiving the completion notice for the previous reflow. 2013-09-16 23:41:34 -04:00
Josh Matthews
7b239bd246 Move border computation into unpruned traversal. Get rid of extraneous explicit initial reflow. Fixes #935. 2013-09-13 16:40:13 -07:00
bors-servo
df2906fc29 auto merge of #831 : SimonSapin/servo/newnewcss, r=metajack
I started this in a [separate repository](https://github.com/SimonSapin/servo-style), and imported it with [git-subtree](https://github.com/git/git/blob/master/contrib/subtree/git-subtree.txt) into `servo/src/components/script/style` after some Rust minor upgrades.

I move this into the script crate because it’s gonna both need stuff there (the content tree, for selector matching) and be needed by stuff there (the HTML parser calls the CSS parser). As far as I know, we can not have circular dependencies between crates.
2013-09-04 10:00:52 -07:00