Commit graph

419 commits

Author SHA1 Message Date
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
Tim Taubert
9a52bb8310 Privatize InheritTypes 2014-10-13 11:13:12 +02:00
bors-servo
c87f34f877 auto merge of #3615 : pcwalton/servo/box-sizing-fix, r=glennw
Improves GitHub significantly.

r? @glennw
2014-10-12 23:45:45 -06:00
Patrick Walton
2a790d06dd Use Gecko's simpler Bloom filter instead of one based on hash
stretching.

This preserves the usage of the Bloom filter throughout style recalc,
but the implementation is rewritten. Provides a 15% improvement on
Guardians of the Galaxy.
2014-10-10 17:02:27 -07:00
Clark Gaebel
24bff2416b Factors out DOM traversal, keeping the code in parallel free of traversal-specific logic.
DOM traversals and Flow traversals look very similar. This patch unifies them
with the preorder/postorder pattern. Hopefully, it also opens the door for writing
the traversal code only once, instead of the duplication we have today.
2014-10-10 14:55:18 -04:00
Clark Gaebel
a29dc2c979 removed restyledamage 2014-10-09 12:55:25 -04:00
Clark Gaebel
d12c6e7383 Incremental Style Recalc
This patch puts in the initial framework for incremental reflow. Nodes' styles
are no longer recalculated unless the node has changed.

I've been hacking on the general problem of incremental reflow for the past
couple weeks, and I've yet to get a full implementation that actually passes all
the reftests + wikipedia + cnn. Therefore, I'm going to try to land the different
parts of it one by one.

This patch only does incremental style recalc, without incremental flow
construction, inline-size bubbling, reflow, or display lists. Those will be coming
in that order as I finish them.

At least with this strategy, I can land a working version of incremental reflow,
even if not yet complete.

r? @pcwalton
2014-10-09 12:55:21 -04:00
Patrick Walton
611c54ce8c layout: Make box-sizing only affect explicitly-specified or percentage
sizes, not automatically computed ones.

Improves GitHub significantly.
2014-10-09 07:59:54 -07:00
bors-servo
15b508ac10 auto merge of #3600 : pcwalton/servo/pseudo-unshareable, r=mbrubeck
Makes multiple `<br>` elements work, since those are implemented via
`before` pseudos.

r? @mbrubeck
2014-10-09 00:06:32 -06:00
Patrick Walton
a0b369ae7d layout: Mark the styles of elements with pseudos as unshareable.
Makes multiple `<br>` elements work, since those are implemented via
`before` pseudos.
2014-10-08 22:46:54 -07:00
Patrick Walton
01c90d8d6a layout: Implement z-index. 2014-10-08 22:30:44 -07:00
bors-servo
eff0de0ce1 auto merge of #3617 : mrobinson/servo/layer-positioning, r=pcwalton
Layers are currently all children of the root layer, so instead of
using coordinates relative to the parent flow we should use coordinates
relative to the page.

Fixes #2061.
2014-10-08 17:27:33 -06:00
Martin Robinson
659c45e7b0 Position layers using their absolute position
Layers are currently all children of the root layer, so instead of
using coordinates relative to the parent flow we should use coordinates
relative to the page.

Fixes #2061.
2014-10-08 13:18:44 -07:00
Tim Taubert
b9e23563bb Support [*|attr], attribute selectors in any namespace (fixes #1558) 2014-10-08 11:01:31 +02:00
Patrick Walton
d30762bb9f layout: white_space::pre should not yield ignorable whitespace.
Improves the Google home page.
2014-10-07 13:39:41 -07:00
Cameron Zwarich
fb810c08dc Remove trailing whitespace
The Mach test runner doesn't actually make these failures yet, which is
tracked by #3482.
2014-10-06 14:40:42 -07:00
bors-servo
ae4c9be536 auto merge of #3573 : Manishearth/servo/warnings, r=jdm 2014-10-06 11:51:32 -06:00
Manish Goregaokar
1aa98f866a Remove unused mutable variable 2014-10-05 23:28:27 +05:30
Manish Goregaokar
a8f96ddfb2 Remove Traceable/Untraceable from node.rs 2014-10-05 22:36:08 +05:30
Manish Goregaokar
dcda2cb94b Remove Traceable from htmliframelement.rs 2014-10-05 22:16:41 +05:30
Manish Goregaokar
96f6c2fd67 Remove Traceable from element.rs 2014-10-05 22:09:12 +05:30
Manish Goregaokar
4f574b4732 Remove Traceable from characterdata.rs 2014-10-05 21:33:43 +05:30
Patrick Walton
885fc1c28b layout: Implement box-sizing: border-box.
Improves GitHub.
2014-10-01 20:24:34 -07:00
Patrick Walton
287fe3b3ab layout: Implement the correct hypothetical box behavior for
absolutely-positioned elements declared with `display: inline`.

Although the computed `display` property of elements with `position:
absolute` is `block`, `position: absolute; display: inline` can still
behave differently from `position: absolute; display: block`. This is
because the hypothetical box for `position: absolute` can be at the
position it would have been if it had `display: inline`. CSS 2.1 §
10.3.7 describes this case in a parenthetical:

"The static-position containing block is the containing block of a
hypothetical box that would have been the first box of the element if
its specified 'position' value had been 'static' and its specified
'float' had been 'none'. (Note that due to the rules in section 9.7 this
hypothetical calculation might require also assuming a different
computed value for 'display'.)"

To handle this, I had to change both style computation and layout. For
the former, I added an internal property
`-servo-display-for-hypothetical-box`, which stores the `display` value
supplied by the author, before the computed value is calculated. Flow
construction now uses this value.

As for layout, implementing the proper behavior is tricky because the
position of an inline fragment in the inline direction cannot be
determined until height assignment, which is a parallelism hazard
because in parallel layout widths are computed before heights. However,
in this particular case we can avoid the parallelism hazard because the
inline direction of a hypothetical box only affects the layout if an
absolutely-positioned element is unconstrained in the inline direction.
Therefore, we can just lay out such absolutely-positioned elements with
a bogus inline position and fix it up once the true inline position of
the hypothetical box is computed. The name for this fix-up process is
"late computation of inline position" (and the corresponding fix-up for
the block position is called "late computation of block position").

This improves the header on /r/rust.
2014-10-01 18:34:53 -07:00
Josh Matthews
5794da904e Remove unneeded input type information from layout. 2014-10-01 15:40:36 -04:00
Josh Matthews
8112859d55 Disallow toggling radio buttons. Use generated content for checkboxes and radio buttons. Switching to the glyph 0 for the average advance width. 2014-10-01 15:37:40 -04:00
Josh Matthews
f70bb68503 Implement simple layout for text, button, radio, and checkbox inputs. Implement simple interaction for checkboxes and radio buttons. 2014-10-01 15:35:42 -04:00
Cameron Zwarich
79b4ec99b4 Convert TNode / TElement to use self methods rather than &self 2014-09-30 21:26:19 -07:00
Cameron Zwarich
ccc5d976f7 Refine a lifetime parameter on TElement's get_local_name 2014-09-30 21:22:24 -07:00
Cameron Zwarich
4ef0f39c78 Remove a prefix from a method name by manually resolving methods 2014-09-30 21:21:00 -07:00
Glenn Watson
55ef7ca5ad Refactor background image, fix fixed attachment. Improve acid2. 2014-10-01 08:54:24 +10:00
Keegan McAllister
d50114c41d Use string-cache's Namespace type 2014-09-29 21:40:54 -07:00
Keegan McAllister
6429750b33 Eliminate servo_util::atom
We only needed this for Encodable, and now we use JSTraceable instead.
2014-09-29 18:39:36 -07:00
Glenn Watson
52c5007b07 Add support for <super> and <sup> tags. Fixes equations on wikipedia. 2014-09-30 07:12:54 +10:00
Simon Sapin
b3245fa407 Upgrade to rustc d2b30f7d3 2014-09-23 2014-09-29 17:41:45 +01:00
bors-servo
c9c8d63727 Merge pull request #3501 from zwarich/telement-lifetimes
Remove the 'static lifetime parameters from TElement methods

Reviewed-by: jdm
2014-09-27 17:09:28 -06:00
Cameron Zwarich
b2a3519011 Remove the 'static lifetime parameters from TElement methods
This improves the static correctness of layout's use of DOM nodes.

Fixes #2595.
2014-09-27 11:14:10 -07:00
Cameron Zwarich
bf025e9b9b Refine a lifetime parameter 2014-09-27 11:14:10 -07:00
Cameron Zwarich
61ae80e186 Add an extra lifetime parameter to TElement / TNode
This isn't used for anything yet, but it's easier to propagate this
change in a separate commit.
2014-09-27 11:14:10 -07:00
Patrick Walton
690bf079f7 layout: Refactor a few things, mostly just to obey the line limit. 2014-09-27 06:07:58 -07:00
Patrick Walton
fb5952fed0 layout: Don't double-count padding, etc, and don't draw
backgrounds/borders/etc. twice for inline-blocks.

Improves Reddit, GitHub, and many other sites.
2014-09-27 06:07:58 -07:00
Glenn Watson
15e1e5e43f Fix some mutable variable warnings. 2014-09-27 15:04:40 +10:00