Commit graph

93 commits

Author SHA1 Message Date
bors-servo
d7b6961104 Auto merge of #5623 - pcwalton:nested-inline-vertical-align, r=glennw
This allows things like `<sup><span>Foo</span></sup>` to work and
improves Wikipedia.

r? @glennw
2015-04-09 17:20:23 -05:00
Patrick Walton
18074bf908 layout: Lay out nested inline elements with different vertical-align
values properly in simple cases.

This allows things like `<sup><span>Foo</span></sup>` to work and
improves Wikipedia.
2015-04-09 14:55:05 -07:00
Patrick Walton
00a2685cbe layout: During inline layout, make place_between_floats use the same
line height computation logic as final block size assignment.

Improves Wikipedia.
2015-04-09 14:23:08 -07:00
Patrick Walton
6d61468160 layout: Simplify and improve the correctness of whitespace stripping in
text layout, and unify the inline layout paths for pre- and
normally-formatted text.

This fixes a lot of "jumpiness" and removes the `new_line_pos` stuff.

Closes #2260.
2015-04-08 14:29:23 -07:00
Ms2ger
a0ad6ba2d4 Use usize for indices into InlineFragments. 2015-04-02 14:53:30 +02:00
Ms2ger
232dadc81d Use isize for FragmentIndex. 2015-04-02 14:53:10 +02:00
Ms2ger
43ed033eff Use isize/usize in range. 2015-03-28 15:36:36 +01:00
Manish Goregaokar
3479d3fa7f Replace unsafe_blocks by unsafe_code. 2015-03-21 10:27:32 +01:00
bors-servo
646f821479 auto merge of #5268 : mbrubeck/servo/append, r=jdm
The new `Vec::append` method is clearer and potentially faster.
2015-03-18 21:39:49 -06:00
Matt Brubeck
94a7563aea Use append instead of extend where possible
The new `Vec::append` method is clearer and potentially faster.
2015-03-18 17:17:33 -07:00
Glenn Watson
d61d3ad4ba Fixes positioning of inline blocks that generate stacking contexts. 2015-03-19 07:38:33 +10:00
Ms2ger
5f15eb5fbf Upgrade rustc to d3c49d2140fc65e8bb7d7cf25bfe74dda6ce5ecf/rustc-1.0.0-dev. 2015-03-18 13:18:31 -04:00
Patrick Walton
f9cdd05d58 layout: Implement ordered lists, CSS counters, and quotes per CSS 2.1
§ 12.3-12.5.

Only simple alphabetic and numeric counter styles are supported. (This
is most of them though.)

Although this PR adds a sequential pass to layout, I verified that on
pages that contain a reasonable number of ordered lists (Reddit
`/r/rust`), the time spent in generated content resolution is dwarfed by
the time spent in the parallelizable parts of layout. So I don't expect
this to negatively affect our parallelism expect perhaps in pathological
cases.
2015-03-09 17:13:45 -07:00
Matt Brubeck
cabbbcc978 Keep track of the containing block writing mode.
This is necessary for correctly converting `relative_containing_block_size`
to physical coordinates.
2015-03-09 14:22:36 -07:00
Matt Brubeck
8221bfc3ef Layout fixes for RTL child flows in LTR parents
...and vice-versa.  This is not a complete fix for all mixed-direction layout
cases, but it fixes enough problems to make some simple test cases pass, like
tha attached reftest.

There are FIXME comments for many of the remaining issues.  In particular,
this does not yet handle RTL layout of fixed/absolute elements.
2015-03-09 14:21:26 -07:00
Dan Fox
559ff68b31 Get rid of servo_util 2015-03-05 17:42:05 +00:00
Simon Sapin
4c1d778ced Revert "layout: Implement ordered lists, CSS counters, and quotes per CSS 2.1"
This reverts commit 30fd28d107.
2015-03-03 21:16:24 +01:00
bors-servo
5cd6316add auto merge of #5067 : servo/servo/counters, r=SimonSapin
Only simple alphabetic and numeric counter styles are supported. (This
is most of them though.)

Although this PR adds a sequential pass to layout, I verified that on
pages that contain a reasonable number of ordered lists (Reddit
`/r/rust`), the time spent in generated content resolution is dwarfed by
the time spent in the parallelizable parts of layout. So I don't expect
this to negatively affect our parallelism expect perhaps in pathological
cases.

Moved from #4544, because Critic.

Fixes #4544.
2015-03-03 10:42:52 -07:00
Patrick Walton
30fd28d107 layout: Implement ordered lists, CSS counters, and quotes per CSS 2.1
§ 12.3-12.5.

Only simple alphabetic and numeric counter styles are supported. (This
is most of them though.)

Although this PR adds a sequential pass to layout, I verified that on
pages that contain a reasonable number of ordered lists (Reddit
`/r/rust`), the time spent in generated content resolution is dwarfed by
the time spent in the parallelizable parts of layout. So I don't expect
this to negatively affect our parallelism expect perhaps in pathological
cases.
2015-03-03 17:31:19 +01:00
Patrick Walton
a82fc00806 layout: Implement overflow-x and overflow-y per CSS-OVERFLOW § 3.
Fragmentation is not yet supported.
2015-03-03 17:03:27 +01:00
Patrick Walton
40a3b41758 layout: Add an option to visualize parallel layout 2015-02-20 19:11:35 -08:00
Simon Sapin
d5dd1d658e Upgrade to rustc ba2f13ef0 2015-02-04 2015-02-11 14:48:34 -08:00
Matthew Rasmus
5b340599f2 Fix 'inline-block' sizing issues
Fixes #3624
2015-02-02 15:52:11 -08:00
bors-servo
172aed535b auto merge of #4757 : servo/servo/newnewnewcss, r=mbrubeck
(Still off by default. Enable with `RUST_LOG=style`.)

r? @mbrubeck
2015-01-30 15:27:53 -07:00
Patrick Walton
7934bf294d layout: Fix warnings. 2015-01-30 11:35:50 -08:00
Simon Sapin
d13d36f57f End the libstyle 'pub use' madness. 2015-01-30 15:08:29 +01:00
Patrick Walton
5fdaba05a6 layout: Implement text-align: justify and text-justify per
CSS-TEXT-3 § 7.3.

`text-justify: distribute` is not supported.

The behavior of `text-justify: none` does not seem to match what Firefox
and Chrome do, but it seems to match the spec.

Closes #213.
2015-01-29 17:00:41 -08:00
Patrick Walton
0f8e436745 layout: Implement text-overflow: ellipsis per CSS-UI-3 § 6.2.
Only the one-value syntax is supported for now.
2015-01-28 16:23:31 -08:00
Josh Matthews
95fc29fa0d Update rustc to 00b112c45a604fa6f4b59af2a40c9deeadfdb7c6/rustc-1.0.0-dev. 2015-01-28 10:16:49 +10:00
Ms2ger
13c7cf928a Stop calling deref() and deref_mut() explicitly. 2015-01-22 16:04:21 +01:00
Ms2ger
16c7060bc8 Update rustc to revision 2cfb5acb5a2751c759627377e602bac4f88f2d19. 2015-01-08 09:58:46 -05:00
Patrick Walton
bf540d590a layout: Explicitly thread border box dimensions and relative offsets
through display list building.

The old `flow_origin` concept was ill-defined (sometimes the border box
plus the flow origin, sometimes including horizontal margins and
sometimes not, sometimes including relative position and sometimes not),
leading to brittleness and test failures. This commit reworks the logic
to always pass border box origins in during display list building.
2015-01-04 17:43:05 -08:00
Patrick Walton
5ea2c6dcfd layout: Paint stacking contexts' overflow areas properly.
This was making `box-shadow` not show up in many cases, in particular,
but the effects were not limited to that.
2015-01-04 17:41:59 -08:00
Ms2ger
b51e83819d Fix obsolete format traits.
They are to be removed from the language in the next rust upgrade.
2015-01-02 19:04:18 +01:00
Patrick Walton
cc7cacfd5f gfx: Clip the background properly when border-radius is used.
Improves Reddit, GitHub, etc.
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
bf4480bb79 Simplify util::range::RangeIndex to always require std::num::Int,
and fix remaining warnings.
2014-12-18 11:34:23 +00: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
42a8d9384b layout: Make line breaking able to restart from any position.
This commit removes the "merge-fragments" pass from inline reflow,
instead merging "on the fly". This ended up being simpler, as well as
more fine grained. Additionally, this patch makes the line breaker no
longer clone every fragment (!)

This functionality will be used in the implementation of
`text-overflow`.
2014-12-14 12:23:11 -08:00
Patrick Walton
6943ddb93e layout: Implement overflow-wrap/word-wrap per CSS-TEXT § 6.2.
This property is used by approximately 55% of page loads.

To implement the line breaking behavior, the "breaking strategy" has
been cleaned up and abstracted. This should allow us to easily support
other similar properties in the future, such as `text-overflow` and
`word-break`.
2014-12-13 13:05:05 -08:00
Patrick Walton
caee309ef4 layout: Implement text-indent per CSS 2.1 § 16.1.
I had to use a somewhat unconventional method of computing text
indentation (propagating from blocks down to inlines) because of the way
containing blocks are handled in Servo.

(As a side note, neither Gecko nor WebKit correctly handles percentages
in `text-align`, at least incrementally -- i.e. when the percentages are
relative to the viewport and the viewport is resized.)
2014-12-12 14:55:41 -08:00
Patrick Walton
071d320728 layout: Refactor inline layout a bit. 2014-12-12 14:55:24 -08:00
Joseph Crail
c254d195ad Fix spelling mistakes in comments. 2014-12-11 23:56:29 -05:00
Matt Brubeck
5d0d11c380 Make all of LineBreaker private 2014-12-09 15:57:05 -08:00
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
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
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