Commit graph

48 commits

Author SHA1 Message Date
Ms2ger
208c05f944 Fix warnings. 2015-12-04 10:31:19 +01:00
bors-servo
2dbc314e2d Auto merge of #8796 - cheba:zero-point, r=SimonSapin
Replaced ZERO_POINT with Point2D::zero()

This is a proposed in servo/servo#8792 clean up.

Fixes #8792.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8796)
<!-- Reviewable:end -->
2015-12-04 11:09:59 +05:30
bors-servo
68922e0ac2 Auto merge of #8797 - cheba:rect-contains, r=Manishearth
Replaced rect_contains_point with Rect.contains()

This is a proposed in servo/servo#8791 clean up.

Fixes #8791.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8797)
<!-- Reviewable:end -->
2015-12-04 04:01:44 +05:30
Alexander Mankuta
ee746e252c Replaced ZERO_POINT with Point2D::zero() 2015-12-03 19:46:45 +02:00
Alexander Mankuta
96a8b442b8 Replaced rect_contains_point with Rect.contains() 2015-12-03 16:15:34 +02:00
Alexander Mankuta
546d2f564f Replaced ZERO_RECT with Rect::zero() 2015-12-03 15:39:30 +02:00
Martin Robinson
a7a58e47a0 Expand DisplayList layer bounds to whole pixels
Before passing these layers to the paint task, expand them to pixel
boundaries. This ensures that subpixel edges of the layer will not be
clipped away and helps prevent rounding issues with layer contents.

Fixes #8166.
2015-10-28 18:11:59 -07:00
Ms2ger
d20ef3b6d8 Use a where clause for rect_contains_point to bring the line under 100 columns. 2015-10-23 10:35:11 +02:00
Glenn Watson
339a3f869b Split Au type into separate crate, with minimal dependencies. 2015-10-01 07:16:11 +10:00
Glenn Watson
5684a75187 A few clean ups for Au type 2015-09-28 16:05:16 +10:00
Ravi Shankar
889eec364b sorted the extern crate, mod & use declarations 2015-09-24 02:12:45 +05:30
Brandon Fairchild
de3547e401 Fix reported test-tidy errors for unmerged import blocks
This merges import blocks that were reported by tidy as unmerged.
2015-09-19 12:50:14 -04:00
Matt Brubeck
9333f028e8 Snap to screen pixels instead of px
Fixes #7665.
2015-09-18 03:06:06 -07:00
Patrick Walton
4a53c873f5 util: Make the number of app units per pixel a constant instead of
repeating the literal value everywhere.

Factoring this value out into a public constant makes it easier to
create `Au` constants in other modules.
2015-09-17 13:31:10 +02:00
Johann Tuffe
ec07178b6f sort all uses 2015-08-20 20:47:12 +08:00
Josh Matthews
8bb853f643 Fix existing syntactics nits. 2015-08-16 10:30:43 -04:00
Glenn Watson
11b1c19b05 Support transforms for display list optimization. Prevents clipping in #6643. 2015-08-05 11:48:07 +10:00
David Zbarsky
e484d6b5e3 Implement getComputedStyle 2015-07-29 20:17:50 -04:00
Patrick Walton
9ce65c08a5 layout: Make the LayoutControlChan use IPC. 2015-07-14 13:45:52 -07:00
ecoal95
8cbfb3482c Use euclid from crates.io 2015-06-19 00:04:24 +02:00
Corey Farwell
5c408d2be9 rust-geom API changes
https://github.com/servo/rust-geom/pull/81
2015-06-13 12:28:21 -07:00
Simon Sapin
5f0c55cefb Make most Au methods take self by value. (It’s a i32 wrapper.) 2015-05-05 18:43:12 +02:00
Simon Sapin
4f618c45a5 Used foo.0 tuple access notation instead of let Au(a) = a; 2015-05-05 18:42:31 +02:00
Simon Sapin
b1ecba9f3d Use i32 instead of isize in Au methods. 2015-05-05 18:40:00 +02:00
Simon Sapin
8b522f2e7d Rename Au methods with f32/f64 instead of frac32/frac/subpx 2015-05-05 18:23:29 +02:00
Simon Sapin
32d5e24922 Replace Au-related free functions in util::geometry with Au methods. 2015-05-05 17:36:03 +02:00
Simon Sapin
ef8edd4e87 Upgrade to rustc 551a74dddd84cf01440ee84148ebd18bc68bd7c8. 2015-05-05 10:07:34 -04:00
Ms2ger
903305416a Implement Clone for Copy types. 2015-04-28 23:31:10 +02:00
Patrick Walton
48299a53cb layout: Implement most of border-collapse per CSS 2.1 § 17.6.2.
Known issues:

* Collapsed borders do not correctly affect the border-box of the table
  itself.

* The content widths of all cells in a column and the content height of
  all cells in a row is the same in this patch, but not in Gecko and
  WebKit.

* Corners are not painted well. The spec does not say what to do here.

* Column spans are not handled well. The spec does not say what to do
  here either.
2015-04-27 17:12:07 +02:00
Ms2ger
5f15eb5fbf Upgrade rustc to d3c49d2140fc65e8bb7d7cf25bfe74dda6ce5ecf/rustc-1.0.0-dev. 2015-03-18 13:18:31 -04:00
Patrick Walton
d10627a2b3 layout: Implement 2D CSS transforms per CSS-TRANSFORMS § 5, 6, 7, and 8. 2015-03-17 11:30:55 -07:00
Alexandru Cojocaru
aaf7a7e439 Remove uint/int inside components/util (partial #4745).
This leaves range.rs alone.
2015-02-28 15:03:07 +01:00
Simon Sapin
d5dd1d658e Upgrade to rustc ba2f13ef0 2015-02-04 2015-02-11 14:48:34 -08:00
Josh Matthews
95fc29fa0d Update rustc to 00b112c45a604fa6f4b59af2a40c9deeadfdb7c6/rustc-1.0.0-dev. 2015-01-28 10:16:49 +10:00
Ms2ger
16c7060bc8 Update rustc to revision 2cfb5acb5a2751c759627377e602bac4f88f2d19. 2015-01-08 09:58:46 -05:00
Patrick Walton
dea8375613 gfx: Refactor the border drawing code and split out fragment display
list building into multiple functions.

This should have no functional changes; it's just code cleanup.
2014-12-22 14:48:55 -08:00
Patrick Walton
6b28965b94 layout: Implement clip per CSS 2.1 § 11.1.2.
Only the recommended, comma-separated syntax is supported.
2014-12-18 13:07:13 -08:00
Simon Sapin
084a63df45 Remove usage of the deprecated std::num::Zero trait. 2014-12-18 11:16:47 +00:00
Ms2ger
466faac2a5 Update rustc to revision 3dcd2157403163789aaf21a9ab3c4d30a7c6494d. 2014-12-17 15:19:45 -05:00
Patrick Walton
07bc97e3e2 gfx: Implement letter-spacing per CSS 2.1 § 16.4.
The ligature disabling code has been manually verified, but I was unable
to reftest it. (The only way I could think of would be to create an
Ahem-like font with a ligature table, but that would be an awful lot of
work.)

Near as I can tell, the method used to apply the spacing (manually
inserting extra advance post-shaping) matches Gecko.
2014-12-12 11:43:43 -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
Jack Moffitt
d1b433a3b3 Rust upgrade to rustc hash b03a2755193cd756583bcf5831cf4545d75ecb8a 2014-11-13 11:17:43 +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
Patrick Walton
dbdfce0695 gfx: Use subpixel positioning for glyphs.
Improves text rendering significantly.
2014-10-02 08:05:24 -07:00
Patrick Walton
3bb4020ff8 layout: Adjust the position of block formatting contexts based on float
placement.

Improves Reddit considerably.

Closes #3456.
2014-09-22 18:04:15 -07:00
Simon Sapin
010d87b93e Remove min/max functions from util::geometry. Use std::cmp instead. 2014-09-19 13:56:35 +01:00
Simon Sapin
415bbaeb2e Fix dimensionality of Au
Previously, we implemented:

Au * Au -> Au
Au / Au -> Au
Au % Au -> Au

... which are inconsistent. It should be:

Au * Au -> SquaredAu
Au / Au -> i32
Au % Au -> i32

or:

Au * i32 -> Au
Au / i32 -> Au
Au % i32 -> Au

I picked the latter.

Also, the multiplicative identity does not make sense
when multiplication take two different types.
2014-09-19 13:54:57 +01:00
Jack Moffitt
c6ab60dbfc Cargoify servo 2014-09-08 20:21:42 -06:00
Renamed from src/components/util/geometry.rs (Browse further)