Commit graph

419 commits

Author SHA1 Message Date
Patrick Walton
1c1c507c03 layout: Implement opacity per CSS-COLOR § 3.2.
This adds the infrastructure necessary to support stacking contexts that
are not containing blocks for absolutely-positioned elements. Our
infrastructure did not support that before. This minor revamp actually
ended up simplifying the logic around display list building and
stacking-relative position computation for absolutely-positioned flows,
which was nice.
2014-12-03 14:17:16 -08:00
Clark Gaebel
d3e4d29368 Fixed #4170 - Incremental reflow wasn't being aggressive enough when nodes get reparented.
When inserting a node that was already dirtied, the dirtying logic
would short circuit: "This node is already dirty? Great! Then its
parents must be HAS_DIRTY_DESCENDANTS, too! Let's skip that step."

This isn't appropriate when nodes move around the tree. In that case,
the node may be marked HAS_CHANGED, but ancestors may not yet have
the HAS_DIRTY_DESCENDANTS flag set.

This patch adds a `content_and_heritage_changed` hook in the document,
to deal with these cases appropriately.
2014-12-03 11:17:38 -08:00
Clark Gaebel
ffcf0bf394 [gfx/style] Implement border-radius.
This patch is a first stab at implementing border-radius. It looks fine as long as
the border isn't an ellipse (that might not even parse yet), and the border-widths
around a border-radius are the same.

Here's a cool screenshot!

![](https://www.dropbox.com/s/gdtmgjrlnf82gzz/Screenshot%202014-11-12%2018.03.29.png?dl=0)

r? @pcwalton @SimonSapin
2014-12-01 16:10:35 -08:00
bors-servo
9afdce4405 auto merge of #4162 : pcwalton/servo/text-align-flags, r=kmcallister
Fixes the blank spaces showing up in Wikipedia.

r? @kmcallister
2014-12-01 12:12:55 -07:00
Patrick Walton
803624c51e layout: Stop having text alignment stomp on layerization flags.
Fixes the blank spaces showing up in Wikipedia.
2014-12-01 10:55:13 -08:00
Tetsuharu OHZEKI
1305ac4dd0 Remove Element.node(). 2014-11-28 06:05:45 +09:00
Glenn Watson
59cdce3001 Fix layout on google search results. 2014-11-27 09:10:58 +10:00
Patrick Walton
95b57f55cd layout: Fix De Morgan's Law error in incremental reflow, allowing
float/absolute layout layout to be idempotent again.

Fixes the maze solver.
2014-11-21 20:53:59 -08:00
Patrick Walton
55da2c97d5 layout: Incrementalize reflow of block formatting contexts impacted by
floats, and make float placement idempotent.

This moves float placement outside sequential block size computation.

Improves the maze solver.
2014-11-18 15:36:04 -08:00
Patrick Walton
be36fcd3b1 layout: Eliminate the virtual is_float() in favor of the flow flags 2014-11-18 15:36:04 -08:00
Claes 'Letharion' Gyllensvärd
2737db3ad7 Remove bitfield! macro in favour of bitflags! 2014-11-18 19:26:10 +01:00
bors-servo
397d8138e7 auto merge of #3990 : pcwalton/servo/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
2014-11-16 16:39:27 -07:00
Andrew Hobden
a70543c2a3 Fix Table Caption infinite recursion. 2014-11-15 09:37:44 -08:00
Patrick Walton
a4a9a46a87 gfx: Rewrite display list construction to make stacking-contexts more
first-class.

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.
2014-11-14 17:31:15 -08:00
Ms2ger
86d609abaf Use RefCell in DOMRefCell to reduce duplicated code. 2014-11-14 21:18:43 +01:00
Jack Moffitt
d1b433a3b3 Rust upgrade to rustc hash b03a2755193cd756583bcf5831cf4545d75ecb8a 2014-11-13 11:17:43 +10:00
Martin Robinson
c7327450ef Clip display list based on frame viewport
Instead of creating a display list for the entire page, only create one
for an area that expands around the viewport. On my machine this makes
incremental layout of http://timecube.com 50% faster.
2014-11-11 08:46:16 -08:00
Cameron Zwarich
91be7443df Remove unnecessary import of libgreen 2014-11-10 16:18:10 -08:00
bors-servo
f775f12fe9 auto merge of #3886 : glennw/servo/mq, r=SimonSapin 2014-11-06 17:24:28 -07:00
Patrick Walton
215c2a9d4c layout: Implement CSS linear gradients per the CSS-IMAGES specification.
This implements the CSS `linear-gradient` property per the CSS-IMAGES
specification:

    http://dev.w3.org/csswg/css-images-3/

Improves GitHub.
2014-11-06 08:26:47 -08:00
Glenn Watson
11cf538ff4 Make media queries work with resize and page zoom. 2014-11-04 13:25:21 -08:00
bors-servo
39960f32e4 auto merge of #3878 : zwarich/servo/remove-input-fragment, r=jdm
Fixes #3724.
2014-11-03 16:54:31 -07:00
Cameron Zwarich
5043a63284 Remove InputFragment
Fixes #3724.
2014-11-03 15:48:20 -08:00
Martin Robinson
2d72f00ccf Have ContentBox(es)Queries consult the flow tree
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.
2014-11-03 10:30:28 -08:00
bors-servo
035ff19e4a auto merge of #3860 : pcwalton/servo/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
2014-10-31 14:39:34 -06:00
Patrick Walton
a208463b62 layout: Employ a persistent list data structure to avoid copying floats
all the time.

Improves performance on the maze solver significantly since this was
basically O(n^2) before.
2014-10-31 12:42:32 -07:00
Patrick Walton
08fc7c2795 layout: Make incremental reflow more fine-grained by introducing "reflow
out-of-flow" and "reconstruct flow" damage bits.

This is needed for good performance on the maze solver.
2014-10-31 12:24:40 -07:00
Patrick Walton
265763518f layout: Make absolute position calculation idempotent.
This will be necessary for incremental reflow of absolutely-positioned
flows.
2014-10-31 12:24:39 -07:00
bors-servo
ba13e448cf auto merge of #3838 : pcwalton/servo/style-sharing-enhancements, r=SimonSapin
This helps avoid problems with style sharing in common cases, often
caused by the user agent stylesheet.

r? @SimonSapin
2014-10-30 16:33:36 -06:00
Clark Gaebel
314a0d671e layout: Actually calculate restyle damage while styling.
...oops. Looks like I forgot to do this.

r? @pcwalton
2014-10-29 09:34:08 -07:00
Patrick Walton
587cf98209 layout: Promote absolute positioning, floatedness, and clearance into
flags to avoid virtual calls.

These were showing up really high in the maze solver profile.
2014-10-28 19:38:22 -07:00
bors-servo
c20bb66aef auto merge of #3841 : pcwalton/servo/removing-whitespace-damage, r=cgaebel
Avoids total reflow of the entire document on the maze solver.

I have tested Wikipedia reflow and it still works.

r? @cgaebel
2014-10-28 19:12:39 -06:00
bors-servo
08288fea41 auto merge of #3840 : pcwalton/servo/ib-splits-linked-list, r=glennw
r? @glennw
2014-10-28 18:36:41 -06:00
bors-servo
651ef60b1c auto merge of #3839 : pcwalton/servo/fewer-moves-in-dls, r=glennw
These were showing up in the profile.

r? @glennw
2014-10-28 17:57:43 -06:00
bors-servo
4bdd9a5ec0 auto merge of #3837 : pcwalton/servo/layout-formatting-cleanups, r=metajack
These should have no effect on functionality.

r? @metajack
2014-10-28 17:21:48 -06:00
Patrick Walton
01965c399e layout: Stop adding damage when removing whitespace.
Avoids total reflow of the entire document on the maze solver.
2014-10-28 14:56:39 -07:00
Patrick Walton
16c0ebc14c layout: Put {ib} splits into a linked list so we stop copying them all
the time.
2014-10-28 14:39:45 -07:00
Patrick Walton
93bf69a6fe layout: Use the new append_from method to get rid of a bunch of moves
in display list construction.

These were showing up in the profile.
2014-10-28 14:28:34 -07:00
Patrick Walton
4bf0acbe38 layout: Support more types of selectors for style sharing.
This helps avoid problems with style sharing in common cases, often
caused by the user agent stylesheet.
2014-10-28 14:12:50 -07:00
bors-servo
2d8bd10abe auto merge of #3828 : cgaebel/servo/layout-node-dumping, r=pcwalton
r? @pcwalton
2014-10-28 13:12:52 -06:00
Patrick Walton
68091d7a86 layout: Make some formatting cleanups.
These should have no effect on functionality.
2014-10-28 12:00:35 -07:00
Clark Gaebel
e4d8741991 remove warning 2014-10-28 10:28:24 -07:00
Clark Gaebel
47091c014d combine conditions 2014-10-28 10:26:48 -07:00
Clark Gaebel
cb5fa23a1e use println instead of error 2014-10-28 10:24:50 -07:00
Clark Gaebel
a8f80b89f4 layout: Implement flow tree dumping with RUST_LOG=debug is on.
r? @pcwalton
2014-10-28 10:14:12 -07:00
Clark Gaebel
432071b703 Layout: Fix resize (which just plain doesn't work right now).
Currently, both restyle/flow construction _and_ reflow are skipped
during resize. Reflow should not be in that list. This patch fixes
that.
2014-10-28 09:35:24 -07:00
Keegan McAllister
6ec0939a22 Dynamically check DOMRefCell access from layout in debug builds 2014-10-24 16:27:37 -07:00
Josh Matthews
a1b2f4b590 Add an optional --debug-mozjs argument to mach build that enables a non-optimized, debug build of mozjs and rust-mozjs. Update the Cargo snapshot to enable new feature support. 2014-10-24 16:18:25 -04:00
Glenn Watson
b1c226778f Cache last fontgroup. Style recalc on wikipedia/rust 66ms -> 41ms. 2014-10-24 08:25:10 +10:00
Patrick Walton
de5e2fd5e2 layout: Shrink fragments down from 448 bytes down to 128 bytes.
16% performance improvement in layout (!)
2014-10-23 09:13:41 -07:00