Commit graph

160 commits

Author SHA1 Message Date
bors-servo
2bc4ffe5cf auto merge of #3744 : cgaebel/servo/efficient-preorder-traversal, r=pcwalton
This also tackles some nearby FIXMEs. `traverse_preorder` is used in a LOT of
DOM functions..

r? @pcwalton
2014-10-21 13:09:38 -06:00
bors-servo
018146b1a8 auto merge of #3728 : cgaebel/servo/dump-flow-tree-with-println, r=mrobinson
r? @mrobinson
2014-10-21 11:27:40 -06:00
Clark Gaebel
a5bb2f299f more efficient preorder DOM traversals 2014-10-21 10:01:15 -07:00
Patrick Walton
e9a61c1ccf layout: Don't destroy the flow tree when resizing the window 2014-10-20 22:05:38 -07:00
Patrick Walton
bb6f557276 layout: Rewrite text and inline fragment handling during flow
construction to avoid cloning and moving flows so much.

Besides amounting to a 5%-10% win on a page with a lot of text, this
simplifies and refactors the text layout code.
2014-10-20 22:05:38 -07:00
Clark Gaebel
174975061e Dump the flow tree with println, instead of error 2014-10-20 11:14:03 -07:00
Clark Gaebel
81bd3cbd9d Fixes the table_percentage_width_a.html reftest with incremental reflow turned on. 2014-10-20 11:13:31 -07:00
Glenn Watson
076495db94 Use opts as a global, to avoid cloning and passing the struct all over the code. 2014-10-20 10:48:47 +10:00
bors-servo
3906cecd16 auto merge of #3719 : mrobinson/servo/flow-dump, r=pcwalton
The flow tree is currently dumped for debugging purposes early on in
the flow process, so many values are still zero. If we wait to dump it
until later, the output will more accurately reflect the real flow tree.
2014-10-17 19:51:24 -06:00
Martin Robinson
e7c79906bd Wait to dump flow tree until flow is complete
The flow tree is currently dumped for debugging purposes early on in
the flow process, so many values are still zero. If we wait to dump it
until later, the output will more accurately reflect the real flow tree.
2014-10-17 18:48:09 -07:00
Clark Gaebel
8496c056e7 Fixed the inline_element_border_a reftest with incremental layout turned on. 2014-10-17 11:11:14 -07:00
Clark Gaebel
2faf5b270f Fix image_dynamic_remove reftest with incremental layout turned out
This also adds some extra debugging infrastructure which I found useful tracking
this bug down. A regression in the br reftests is also uncovered by this patch,
which I'll work on fixing next.

r? @pcwalton
2014-10-17 11:11:14 -07:00
Patrick Walton
a6fcec468f layout: Remove FontStyle in favor of using the font style struct
directly, and optimize `get_layout_font_group()` to use a small vector.

Seems to be a 38% layout win on a site I tested with a lot of text.
2014-10-15 22:17:57 -07:00
bors-servo
f3066c70da auto merge of #3689 : cgaebel/servo/working-incremental-flow-construction, r=pcwalton
This implements fragment merging, in order to incrementally reflow linebroken
text. This makes the `whitespace_pre.html` reftest pass with incremental reflow
turned on with `-i`.
2014-10-15 21:27:20 -06:00
bors-servo
b83352f7eb auto merge of #3692 : cgaebel/servo/fix-incremental-append-style, r=pcwalton
@pcwalton r?
2014-10-15 20:00:20 -06:00
Clark Gaebel
481adcd654 Fix whitespace_pre with incremental reflow turned on.
This implements fragment merging, in order to incrementally reflow linebroken
text. This makes the `whitespace_pre.html` reftest pass with incremental reflow
turned on with `-i`.
2014-10-15 16:04:21 -07:00
Clark Gaebel
0a541fc83c Fix append_style reftests with incremental reflow turned on.
@pcwalton r?
2014-10-15 15:47:11 -07:00
Clark Gaebel
76ed7484eb Use the Deref traits for FlowRefs.
This patch switches FlowRefs to using the Deref and DerefMut traits, instead of
the custom `get` and `get_mut` functions.
2014-10-15 11:04:05 -07:00
Tetsuharu OHZEKI
fb98384fa5 Use DOMRefCell<T> in Element. 2014-10-15 13:44:02 +09:00
bors-servo
f1c050531f auto merge of #3655 : kaseyc/servo/add_to_js_method, r=jdm
Replace the manual checks and calls to transmute_copy in /layout/wrapper.rs with calls to to_js/

Fixes #3616
2014-10-14 22:00:28 -06:00
Kasey Carrothers
6d91e92c90 Add a to_js method to the casting trait code in CodegenRust.py
Replace the manual checks and calls to transmute_copy in /layout/wrapper.rs with calls to to_js

Fixes #3616
2014-10-14 19:06:53 -07:00
bors-servo
7eaeaeeb21 auto merge of #3668 : cgaebel/servo/sequential-reflow, r=pcwalton
Now that DOM/Flow traversals have been refactored out, the `recalc_style_for_subtree`
function in `css/matching.rs` can be removed, in lieu of just running the standard
`recalc_style_for_node` and `construct_flows` traversals sequentially. Now we
no longer have the maintenance headache of duplicating selector matching logic
in two places! \o/

This passes reftests with both default arguments, and with `-y 1`.

r? @pcwalton
2014-10-14 19:33:28 -06:00
bors-servo
3eb6b17137 auto merge of #3610 : glennw/servo/media-queries, r=SimonSapin 2014-10-14 18:36:29 -06:00
Clark Gaebel
7368d42225 Removes duplicate CSS selector matching logic.
Now that DOM/Flow traversals have been refactored out, the `recalc_style_for_subtree`
function in `css/matching.rs` can be removed, in lieu of just running the standard
`recalc_style_for_node` and `construct_flows` traversals sequentially. Now we
no longer have the maintenance headache of duplicating selector matching logic
in two places! \o/

r? @pcwalton
2014-10-14 16:28:29 -07:00
bors-servo
56989b8dec auto merge of #3640 : cgaebel/servo/incremental-flow-construction, r=pcwalton
This also hides the not-yet-working parts of incremental reflow behind a runtime
flag. As I get the failing reftests passing, I'll send pull requests for them one
by one.
2014-10-14 16:51:30 -06:00
Glenn Watson
c7d81fdde6 Implement media queries parser and matching. Improves mobile first sites like bootstrap3. 2014-10-15 07:36:31 +10:00
Patrick Walton
c7e619dfe7 layout: Rewrite intrinsic inline-size and automatic table layout to
match L. David Baron's work-in-progress specification.

    http://dbaron.org/css/intrinsic/

Column spans are not yet supported.

This effectively adds support for percentage widths, and it also fixes
many bugs, improving the layout of Google and Wikipedia.
2014-10-14 14:17:57 -07:00
Patrick Walton
5f8d3f72d8 layout: Introduce support for legacy presentational attributes to selector
matching, and use it for `<input size>` and `<td width>`.

This implements a general framework for legacy presentational attributes
to the DOM and style calculation, so that adding more of them later will
be straightforward.
2014-10-14 12:44:09 -07:00
bors-servo
8077edc062 auto merge of #3623 : pcwalton/servo/use-atoms-2, r=jdm
75% improvement in style recalc for Guardians of the Galaxy.
2014-10-14 12:42:35 -06:00
Clark Gaebel
f552e2f750 try to reset flows which need reflow, since reflow isn't yet idempotent 2014-10-14 10:33:46 -07:00
bors-servo
48ce107d72 auto merge of #3675 : glennw/servo/local-fonts, r=pcwalton 2014-10-14 11:33:34 -06:00
Patrick Walton
ee2ccc4f87 script: Use atom comparison in more places, especially for attributes.
75% improvement in style recalc for Guardians of the Galaxy.
2014-10-14 10:32:40 -07:00
bors-servo
834df4e211 auto merge of #3673 : mrobinson/servo/iframe-margin, r=pcwalton
Instead of taking margin size into account twice when positioning
layers, just rely on the absolute position calculated during display
list construction.
2014-10-14 04:51:35 -06:00
Ms2ger
16e071168c Don't borrow CharacterData.data from layout.
This should fix the most frequent intermittent wpt failure.
2014-10-14 10:49:33 +02:00
bors-servo
fd70b366ae auto merge of #3654 : pcwalton/servo/clip-reform, r=mrobinson
We push down clipping areas during absolute position calculation. This
makes display items into a flat list, improving cache locality. It
dramatically simplifies the code all around.

Because we need to push down clip rects even for absolutely-positioned
children of non-absolutely-positioned flows, this patch alters the
parallel traversal to compute absolute positions for
absolutely-positioned children at the same time it computes absolute
positions for other children. This doesn't seem to break anything either
in theory (since the overall order remains correct) or in practice. It
simplifies the parallel traversal code quite a bit.

See the relevant Gecko bug:
https://bugzilla.mozilla.org/show_bug.cgi?id=615734

r? @mrobinson
2014-10-14 00:42:35 -06:00
Glenn Watson
1827852810 Add support for local font faces. Improves fonts on rust lang and guide. 2014-10-14 15:59:08 +10:00
Patrick Walton
5351c8572f Merge pull request #3674 from glennw/remove-println
Change accidental println to debug macro.
2014-10-13 22:39:15 -07:00
Glenn Watson
38e7df8139 Change accidental println to debug macro. 2014-10-14 15:29:36 +10:00
Patrick Walton
bffaad118e layout: Rewrite clipping to be per-display-item instead of having
a separate `ClipDisplayItem`.

We push down clipping areas during absolute position calculation. This
makes display items into a flat list, improving cache locality. It
dramatically simplifies the code all around.

Because we need to push down clip rects even for absolutely-positioned
children of non-absolutely-positioned flows, this patch alters the
parallel traversal to compute absolute positions for
absolutely-positioned children at the same time it computes absolute
positions for other children. This doesn't seem to break anything either
in theory (since the overall order remains correct) or in practice. It
simplifies the parallel traversal code quite a bit.

See the relevant Gecko bug:
https://bugzilla.mozilla.org/show_bug.cgi?id=615734
2014-10-13 21:40:36 -07:00
bors-servo
f350879574 auto merge of #3666 : ttaubert/servo/issue/3644-privatize-dom, r=Manishearth
This PR removes public fields from all (hope I didn't miss any) DOM structs. Should |Page| be privatized as well? This PR additionally introduces a #[privatize] lint to ensure nobody accidentally re-introduces a public field.

All changesets compile separately if applied in the same order. Hope that helps reviewing but I can of course squash them before merging.
2014-10-13 22:00:37 -06:00
bors-servo
799d0de0c0 auto merge of #3650 : pcwalton/servo/give-up-on-not-splitting, r=glennw
I don't think it will be possible to avoid splitting fragments in the
presence of `vertical-align`, because one `ScannedTextFragment` could
potentially be split into arbitrary many fragments, each having its own
vertical position that can influence layout of other fragments.

This code also removes parts of `Range` that were no longer used.

r? @glennw
2014-10-13 18:36:40 -06:00
Martin Robinson
e53093e127 Do not compound iframe margins when positioning
Instead of taking margin size into account twice when positioning
layers, just rely on the absolute position calculated during display
list construction.
2014-10-13 17:28:32 -07:00
bors-servo
7902ccf850 auto merge of #3631 : pcwalton/servo/idempotent-inline-size, r=glennw
This makes layout more idempotent, which is important for incremental
layout.

Also converts `is_root` to a set of flags and fixes a `TODO` concerning
percentage inline heights of images.

r? @glennw
2014-10-13 18:03:40 -06:00
Patrick Walton
d560d51454 layout: Refactor inline layout to remove the code that tried to avoid
splitting fragments.

I don't think it will be possible to avoid splitting fragments in the
presence of `vertical-align`, because one `ScannedTextFragment` could
potentially be split into arbitrary many fragments, each having its own
vertical position that can influence layout of other fragments.

This code also removes parts of `Range` that were no longer used.
2014-10-13 16:33:19 -07:00
bors-servo
a92e55597e auto merge of #3604 : pcwalton/servo/inline-block-overflow-hidden, r=glennw
Makes lots of GitHub appear.

r? @glennw
2014-10-13 15:54:41 -06:00
Patrick Walton
423f5f0ebf layout: Store containing block inline-size separately rather than
writing it to a temporary location and overwriting it.

This makes layout more idempotent, which is important for incremental
layout.

Also converts `is_root` to a set of flags and fixes a `TODO` concerning
percentage inline heights of images.
2014-10-13 14:39:34 -07:00
Martin Robinson
4c453ac519 Include leading margin in inline block size
According to the documentation for Fragment::position, the inline axis
should include margin size, so we include it for blocks. Also fix
place_float which assumed that it was not included and
assign_inline_sizes which overrode the size set in
set_inline_size_constraint_solutions.

Typically this issue was hidden by large tile sizes, but fitted tiles
makes it more common.
2014-10-13 09:12:56 -07:00
Patrick Walton
2b0e59725b layout: Make content of display: inline-block; overflow: hidden visible. 2014-10-13 08:03:34 -07:00
Tim Taubert
cbe50f1f14 Privatize Element 2014-10-13 13:25:44 +02:00
Tim Taubert
28061b1c91 Privatize Node 2014-10-13 13:25:44 +02:00