Commit Graph

297 Commits

Author SHA1 Message Date
Patrick Walton
43e9d79efa servo: Merge #3990 - gfx: Rewrite display list construction to make stacking-contexts more first-class (from pcwalton:stacking-contexts); r=glennw
This implements the scheme described here:

    https://groups.google.com/forum/#!topic/mozilla.dev.servo/sZVPSfPVfkg

This commit changes Servo to generate one display list per stacking
context instead of one display list per layer. This is purely a
refactoring; there are no functional changes. Performance is essentially
the same as before. However, there should be numerous future benefits
that this is intended to allow for:

* It makes the code simpler to understand because the "new layer needed"
  vs. "no new layer needed" code paths are more consolidated.

* It makes it easy to support CSS properties that did not fit into our
  previous flat display list model (without unconditionally layerizing
  them):

  o `opacity` should be easy to support because the stacking context
    provides the higher-level grouping of display items to which opacity
    is to be applied.

  o `transform` can be easily supported because the stacking context
    provides a place to stash the transformation matrix. This has the side
    benefit of nicely separating the transformation matrix from the
    clipping regions.

* The `flatten` logic is now O(1) instead of O(n) and now only needs to
  be invoked for pseudo-stacking contexts (right now: just floats),
  instead of for every stacking context.

* Layers are now a proper tree instead of a flat list as far as layout
  is concerned, bringing us closer to a production-quality
  compositing/layers framework.

* This commit opens the door to incremental display list construction at
  the level of stacking contexts.

Future performance improvements could come from optimizing allocation of
display list items, and, of course, incremental display list
construction.

r? @glennw
f? @mrobinson @cgaebel

Source-Repo: https://github.com/servo/servo
Source-Revision: 397d8138e7b27541faf03d9635d7648416da4a75
2014-11-16 16:39:27 -07:00
Glenn Watson
71f726977a servo: Merge #3948 - Rust upgrade to rustc hash b03a2755193cd756583bcf5831cf4545d75ecb8a (from servo:rustup-20141105_2); r=Manishearth
Source-Repo: https://github.com/servo/servo
Source-Revision: c5e1b0d32e17fad29799023c85e2e73ac89c3af7
2014-11-12 20:48:31 -07:00
Cameron Zwarich
bcf8988465 servo: Merge #3878 - Remove InputFragment (from zwarich:remove-input-fragment); r=jdm
Fixes #3724.

Source-Repo: https://github.com/servo/servo
Source-Revision: 39960f32e49c69977b185f91e587c9947b0b9a25
2014-11-03 16:54:31 -07:00
Martin Robinson
30e2e70d2d servo: Merge #3857 - Have ContentBox(es)Queries consult the flow tree (from mrobinson:queries); r=pcwalton
Instead of looking at the display tree, have ContentBox(es)Query consult
the flow tree. This allow optimizing away parts of the display tree
later. To do this we need to be more careful about how we send reflow
requests, only querying the flow tree when possible.

Fixes #3790.

Source-Repo: https://github.com/servo/servo
Source-Revision: c9089c45c4b7d40419233b48a192d85a8ad71c99
2014-11-03 12:03:37 -07:00
Patrick Walton
d73bea71dd servo: Merge #3860 - layout: Make incremental reflow more fine-grained by introducing "reflow out-of-flow" and "reconstruct flow" damage bits (from pcwalton:reflow-out-of-flow); r=glennw
This is the last PR and most of the work for the maze solver and RoboHornet.

r? @glennw
cc @cgaebel

Source-Repo: https://github.com/servo/servo
Source-Revision: 035ff19e4a5995989c5fd34928af2a6690bb8062
2014-10-31 14:39:34 -06:00
Glenn Watson
ba8ee908e0 servo: Merge #3794 - Cache last fontgroup. Style recalc on wikipedia/rust 66ms -> 41ms (from glennw:font-content-opt); r=pcwalton
Source-Repo: https://github.com/servo/servo
Source-Revision: 3910bc942fd04a8d263067916c51f53e3355fdff
2014-10-23 21:09:29 -06:00
Patrick Walton
99b16dbc43 servo: Merge #3772 - layout: Shrink fragments down from 448 bytes to 128 bytes (from pcwalton:slim-down-fragment); r=metajack
16% performance improvement in layout (!)

r? @metajack (or whoever)

Source-Repo: https://github.com/servo/servo
Source-Revision: 012a80cc182ea9773f82696bf36f05820ab994b3
2014-10-23 12:18:34 -06:00
Patrick Walton
e8423e72fb servo: Merge #3771 - layout: Largely move display list building out to a separate file (from pcwalton:display-list-building-cleanup); r=mrobinson
`layout::fragment` and `layout::block` were getting too big.

r? @mrobinson

Source-Repo: https://github.com/servo/servo
Source-Revision: 01f6a8102dfbb7eaef564acf8891088011905b59
2014-10-22 10:54:35 -06:00
Clark Gaebel
1b41f49bca servo: Merge #3763 - Fix #3753 (from cgaebel:issue-3753); r=pcwalton
r? @pcwalton

Looks like I forgot to save `ScannedTextFragment`s block sizes with their
inline sizes. This patch fixes that.

Fixes #3753

Source-Repo: https://github.com/servo/servo
Source-Revision: fe230ef37deaed2d6631af58ab923db023dcf319
2014-10-21 23:27:36 -06:00
Martin Robinson
dc9442df7c servo: Merge #3746 - Add an option to show debug fragment borders (from mrobinson:debug-fragment-borders); r=pcwalton
This is quite a bit cleaner than abusing the rust debug functionality.
If we start collecting too many debugging options in the servo
executable we could opt to organize them into a single option.

Fixes #2263.

Source-Repo: https://github.com/servo/servo
Source-Revision: 3936d142607ef5a9b4a49d48e207daf4975cc7d5
2014-10-21 17:06:40 -06:00
Patrick Walton
19177725a9 servo: Merge #3722 - Overhaul flow construction with several performance improvements (from pcwalton:flow-construction-overhaul); r=glennw
This is a grab bag of performance improvements that significantly improve style recalculation, layout, and painting on a few static pages.

Let me know if you'd like me to split this PR up.

r? @glennw

Source-Repo: https://github.com/servo/servo
Source-Revision: 156ca98236a57ee52ff5b68741bc7783ba073612
2014-10-21 10:06:37 -06:00
Clark Gaebel
b649ed2763 servo: Merge #3706 - Fix image_dynamic_remove reftest with incremental layout turned out (from cgaebel:fix-image-dynamic-remove); r=pcwalton
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.

EDIT: nevermind. no regression, I just tested that before a rebase.

r? @pcwalton

Source-Repo: https://github.com/servo/servo
Source-Revision: b86344b697f814b982e52f4a72c26d58c915c37b
2014-10-17 12:15:23 -06:00
Patrick Walton
4a3d80aa08 servo: Merge #3697 - layout: Remove FontStyle in favor of using the font style struct directly, and optimize get_layout_font_group() to use a small vector (from pcwalton:get-layout-font-group); r=glennw
Seems to be a 38% layout win on a site I tested with a lot of text.

Other browser engines typically do not duplicate the information in the font style struct. `FontStyle` actually predates @SimonSapin's CSS selector matching library. It's time to get rid of it!

r? @glennw

Source-Repo: https://github.com/servo/servo
Source-Revision: 83196ddb26b5611bccfa2d709396daeff259bcd1
2014-10-16 15:06:19 -06:00
Clark Gaebel
6599b0028b servo: Merge #3689 - Fix whitespace_pre with incremental reflow turned on (from cgaebel: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`.

Source-Repo: https://github.com/servo/servo
Source-Revision: f3066c70da80306f68833814025deb589d6eeb2a
2014-10-15 21:27:20 -06:00
Clark Gaebel
9487112680 servo: Merge #3686 - Use the Deref traits for FlowRefs (from cgaebel:deref-flows); r=pcwalton
This patch switches FlowRefs to using the Deref and DerefMut traits, instead of
the custom `get` and `get_mut` functions.

Source-Repo: https://github.com/servo/servo
Source-Revision: 6a11ee89de82abae9d6607a6c2890692df5259eb
2014-10-15 16:18:23 -06:00
Patrick Walton
9df551f68e servo: Merge #3609 - layout: Rewrite intrinsic inline-size and automatic table layout to match L. David Baron's work-in-progress specification (from pcwalton:tables); r=SimonSapin
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.

r? @SimonSapin

Source-Repo: https://github.com/servo/servo
Source-Revision: e2d7777c41135b71293c195d2a9d7a1bc2afd0ca
2014-10-14 15:42:32 -06:00
Patrick Walton
07c968075f servo: Merge #3622 - layout: Introduce support for legacy presentational attributes to selector matching, and use it for <input size> and <td width> (from pcwalton:html4ever); r=jdm
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.

Source-Repo: https://github.com/servo/servo
Source-Revision: 0aeecfc41d5f0c637960fcddf87cc2db3e5efeea
2014-10-14 14:06:36 -06:00
Patrick Walton
9f1038ee7a servo: Merge #3623 - script: Use atom comparison in more places, especially for attributes (from pcwalton:use-atoms-2); r=jdm
75% improvement in style recalc for Guardians of the Galaxy.

Source-Repo: https://github.com/servo/servo
Source-Revision: 8077edc0622b04aeb26d42ced86ea285c9cac0e7
2014-10-14 12:42:35 -06:00
Martin Robinson
03fc4160bd servo: Merge #3673 - Do not compound iframe margins when positioning (from mrobinson: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.

Source-Repo: https://github.com/servo/servo
Source-Revision: 834df4e211e7dcac4369da4f5b8113f295869aa1
2014-10-14 04:51:35 -06:00
Patrick Walton
58bfe948cb servo: Merge #3654 - layout: Rewrite clipping to be per-display-item instead of having a separate ClipDisplayItem (from pcwalton: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

Source-Repo: https://github.com/servo/servo
Source-Revision: fd70b366aeada7f8cb4b2457c04fd07f0ea9b143
2014-10-14 00:42:35 -06:00
Patrick Walton
813b44f111 servo: Merge #3631 - layout: Store containing block inline-size separately rather than writing it to a temporary location and overwriting it (from pcwalton: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

Source-Repo: https://github.com/servo/servo
Source-Revision: 7902ccf8507a7ec31515bfb5824dc4727564fe4d
2014-10-13 18:03:40 -06:00
Patrick Walton
4cdf72533b servo: Merge #3604 - layout: Make content of display: inline-block; overflow: hidden visible (from pcwalton:inline-block-overflow-hidden); r=glennw
Makes lots of GitHub appear.

r? @glennw

Source-Repo: https://github.com/servo/servo
Source-Revision: a92e55597e03d6a7b71e8178cf4a7a6d760f94be
2014-10-13 15:54:41 -06:00
Clark Gaebel
c0d7a56ba4 servo: Merge #3590 - Incremental Style Recalc (from cgaebel:slow-incremental-reflow-rebase); r=pcwalton
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

Source-Repo: https://github.com/servo/servo
Source-Revision: 85b277655f07db1cb99c4d3dee93804735ed0470
2014-10-09 11:21:32 -06:00
Patrick Walton
4bd9850e8c servo: Merge #3599 - layout: Implement z-index (from pcwalton:z-index); r=glennw
r? @glennw

Source-Repo: https://github.com/servo/servo
Source-Revision: c4ac93b315f058d9a061b20ce64cacbead339f86
2014-10-08 23:33:33 -06:00
Patrick Walton
ea75d56860 servo: Merge #3603 - layout: white_space::pre should not yield ignorable whitespace (from pcwalton:pre-ignorable-whitespace); r=mbrubeck
Improves the Google home page.

r? @mbrubeck

Source-Repo: https://github.com/servo/servo
Source-Revision: c628d11e6f8defbdaa4438f990b566272a3b0eff
2014-10-08 01:15:36 -06:00
Cameron Zwarich
e4683d9b2b servo: Merge #3592 - Remove trailing whitespace (from zwarich:trailing-whitespace); r=Manishearth
The Mach test runner doesn't actually make these failures yet, which is
tracked by #3482.

Source-Repo: https://github.com/servo/servo
Source-Revision: ae946a9b762d66f01f669ff526eff5c0eaaa3404
2014-10-07 04:57:29 -06:00
Patrick Walton
b47d6ac21f servo: Merge #3556 - layout: Implement box-sizing: border-box (from pcwalton:box-sizing); r=SimonSapin
Improves GitHub.

Source-Repo: https://github.com/servo/servo
Source-Revision: c7915028b498dc8426cdbb5b35f0ad270613a244
2014-10-01 23:39:26 -06:00
Patrick Walton
9798446c46 servo: Merge #3546 - layout: Implement the correct hypothetical box behavior for absolutely-positioned elements declared with display: inline (from pcwalton:absolute-inline); r=glennw
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.

r? @glennw

Source-Repo: https://github.com/servo/servo
Source-Revision: f7d2fb6ff86afff7a5b674f751af9370a5a6b142
2014-10-01 19:36:25 -06:00
Josh Matthews
2dfdae3733 servo: Merge #3520 - Implement basic form control support (from jdm:formcontrols); r=pcwalton
So far the changes to layout seem fairly well-contained; I think this is worth integrating to give us a browser that is easier to dogfood (and allows us to work on things like form submission much easier), especially since the long-term viability of WebComponents-as-forms is not assured.

Source-Repo: https://github.com/servo/servo
Source-Revision: f80096069592b864221abe112eaf2ecb6c444fda
2014-10-01 16:45:29 -06:00
Glenn Watson
35ccd6b338 servo: Merge #3535 - Refactor background image, fix fixed attachment. Improve acid2 (from glennw:fixed-bg); r=pcwalton
Source-Repo: https://github.com/servo/servo
Source-Revision: a63155b564b64825d292953983117c0df4b34e91
2014-09-30 17:45:29 -06:00
Keegan McAllister
8578d570cb servo: Merge #3530 - Use string-cache's Namespace type, backed by Atom (from kmcallister:namespace-atom); r=Ms2ger
Source-Repo: https://github.com/servo/servo
Source-Revision: 698b916c097ae0272a31a680cba7fc6dbd03ca3d
2014-09-30 02:42:23 -06:00
Patrick Walton
f2eb3141b3 servo: Merge #3498 - Stop double-counting stuff in inline-block (from pcwalton:border-box-double-counting)
Reviewed-by: glennw
Source-Repo: https://github.com/servo/servo
Source-Revision: b7345796bc696bd0e7bc00384a71a30c676a3456
2014-09-27 13:12:30 -06:00
Glenn Watson
78a36a7eb2 servo: Merge #3500 - Fix some mutable variable warnings (from glennw:warning-fix)
Reviewed-by: pcwalton
Source-Repo: https://github.com/servo/servo
Source-Revision: f7e5d295188a885027ff8cd5a6d7421581050ccf
2014-09-26 23:09:31 -06:00
Glenn Watson
9e168f34e8 servo: Merge #3486 - Improve acid2. Fix line height calculation. Text fragments get correct enclosing element style (from glennw:inline-fixes)
Reviewed-by: pcwalton
Source-Repo: https://github.com/servo/servo
Source-Revision: 94b7c486b12a50298f0706fce42b70a6ca90cdcb
2014-09-26 21:57:35 -06:00
Glenn Watson
30b905aaf6 servo: Merge #3460 - Fix inline context padding on inline-block (from glennw:inline-block-padding)
Source-Repo: https://github.com/servo/servo
Source-Revision: 4546d5d23caa3f459b75e9a0bf9e91a3376dc197
2014-09-23 07:47:29 -07:00
Glenn Watson
1ab79660a7 servo: Merge #3449 - Add support for min-width and max-width to images (from glennw:img-min-max)
Source-Repo: https://github.com/servo/servo
Source-Revision: 2c3d3b007554990359a06b90ca5380bf466eb308
2014-09-22 14:53:19 +10:00
Simon Sapin
e245f210fb servo: Merge #3438 - Upgrade Rust (from servo:rustup)
Source-Repo: https://github.com/servo/servo
Source-Revision: 045328c8e94f5bdfcd67105c5dfa9209f4cd501c
2014-09-20 15:35:08 -07:00
Simon Sapin
a9567001ca servo: Merge #3424 - Add font-size absolute size keywords. Fix #3417 (from SimonSapin:font-size-absolute)
Source-Repo: https://github.com/servo/servo
Source-Revision: 08e004d10650f36af60818fd3c57ca461a97a678
2014-09-19 15:17:55 -07:00
Patrick Walton
04c97f274a servo: Merge #3399 - Handle generated content with display: block correctly during flow (from pcwalton:fix-generated-content-iteration)
Source-Repo: https://github.com/servo/servo
Source-Revision: b8f34bbc5170f78e4939b1d647f8d8498e3c2fb6
2014-09-19 12:27:32 -07:00
Glenn Watson
153b536d4d servo: Merge #3404 - Include margin in inline block intrinsic width. Fixes [edit] links on wikipedia. Also improves google homepage (from glennw:inline-block-fix)
Source-Repo: https://github.com/servo/servo
Source-Revision: 22bca83509e81aabb8e1cd538cc91a642bd39bfa
2014-09-18 07:51:11 -07:00
Josh Matthews
a3fc1dd4dc servo: Revert "script: Use atom comparison in more places, especially for attributes." for persistent test failures.
This reverts commit 874db261046d6155b1942efa106d2e0014295d6d.

Source-Repo: https://github.com/servo/servo
Source-Revision: 9607b468bc50496c0de3706d22efaa6fdc68b089
2014-09-18 09:20:19 -04:00
Patrick Walton
3834566a2b servo: Merge #3316 - script: Use atom comparison in more places, especially for attributes (from pcwalton:use-atoms)
Source-Repo: https://github.com/servo/servo
Source-Revision: 787a68336524fb9585922b9ed319a8b194fb8ee1
2014-09-17 13:19:00 -07:00
Matt Brubeck
53e13d52f1 servo: Merge #3296 - Support CSS2 background-position keyword and percent values. r=SimonSapin (from mbrubeck:background-position)
Source-Repo: https://github.com/servo/servo
Source-Revision: 8e2ac7a5c54326f47cbb23394142beee0c17cff2
2014-09-16 10:35:00 -07:00
Jack Moffitt
788c9e2676 servo: Merge #3327 - Reinstate errors for unused variables and imports (from metajack:cargo-profiles)
Source-Repo: https://github.com/servo/servo
Source-Revision: 6c179127a311d2c1dcd4441098a176faafe51f52
2014-09-14 09:56:58 -04:00
Glenn Watson
32b09f9347 servo: Merge #3286 - Implement basic support for display: inline-block (from glennw:inline_block)
Source-Repo: https://github.com/servo/servo
Source-Revision: b64f27b2b69996508eed0a76acc7414a791b1a9e
2014-09-12 21:11:27 -07:00
Glenn Watson
d1b4c97b2d servo: Merge #3283 - Partial fix for background images on wikipedia pages (from glennw:bg-image)
Source-Repo: https://github.com/servo/servo
Source-Revision: a18633b163ab81a726efee75309814868c15260f
2014-09-12 11:31:24 +10:00
Jack Moffitt
132ee35633 servo: Merge #3230 - Cargoify servo (from servo:cargoify)
Source-Repo: https://github.com/servo/servo
Source-Revision: b1305bb7d051f83850c51bb0da0ccc86a5e07922
2014-09-09 08:18:18 -06:00