Commit graph

76 commits

Author SHA1 Message Date
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
Josh Matthews
a589ed7848 Mark vertical-lr-blocks.html as flaky to ease the pain while it's being investigated. #3926 2014-11-15 11:17:04 -05: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
Clark Gaebel
d22a64884d Implements case insensitive font family names.
One part (of 8!) of css font family disambiguation is that font families should
be matched case-insensitively.

This patch implements that. Once it lands, a bug needs to be filed to do lowercasing
properly (as a string, instead of char-by-char -- it's a unicode thing).

r? @gw
2014-11-03 17:15:51 -08:00
Josh Matthews
c4e9a42110 Mark the append_style reftest as flaky until we get better reliability. Fixes #3805. 2014-10-24 16:50:05 -04:00
Glenn Watson
d736a5ef82 Reenable visibilty ref test. Fixes #1576. 2014-10-22 13:21:17 +10:00
Clark Gaebel
2faf5b270f Fix image_dynamic_remove reftest with incremental layout turned out
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.

r? @pcwalton
2014-10-17 11:11:14 -07:00
Keegan McAllister
c9b7d1f8df Add a reftest for #1324
Closes #1324, fixed by html5ever.
2014-10-16 13:06:34 -07:00
Gilles Leblanc
33bcd703db Uncomments the multiple css class ref-test
This test had been commented out because it was breaking the travis ci
build but was passing locally.

Issue #3681
2014-10-14 20:27:25 -04:00
Patrick Walton
c7e619dfe7 layout: Rewrite intrinsic inline-size and automatic table layout to
match L. David Baron's work-in-progress specification.

    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.
2014-10-14 14:17:57 -07:00
Patrick Walton
5f8d3f72d8 layout: Introduce support for legacy presentational attributes to selector
matching, and use it for `<input size>` and `<td width>`.

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.
2014-10-14 12:44:09 -07:00
bors-servo
834df4e211 auto merge of #3673 : mrobinson/servo/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.
2014-10-14 04:51:35 -06:00
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
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
bors-servo
6e3c776387 auto merge of #3635 : SimonSapin/servo/ua-stylesheet, r=pcwalton
Based on https://html.spec.whatwg.org/multipage/rendering.html rather than http://dev.w3.org/csswg/css2/grammar.html

Fixes #3629.

r? @pcwalton
2014-10-13 12:21:44 -06: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
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
Matt Brubeck
b9fab5d861 Disable failing reftest (#3636) 2014-10-10 10:34:23 -07:00
Simon Sapin
1117d86b63 Add [foo=bar i] case-insensitive attribute selectors. 2014-10-10 14:29:24 +01: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
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
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
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
Patrick Walton
a4352b1da2 style: Remove max-height from the input style.
Some pages, like Google, want to set height explicitly.
2014-10-07 11:21:50 -07:00
bors-servo
a6cd13c890 auto merge of #3567 : mrobinson/servo/optimizer, r=zwarich
The page_rect passed to DisplayListOptimizer is relative to the
RenderLayer origin, but the display list components are relative to the
page origin. Before passing the page rect to the display list, we
translate it by the RenderLayer position.
2014-10-03 16:27:25 -06:00
Martin Robinson
ec29723f2b Account for RenderLayer position when optimizing display list
The page_rect passed to DisplayListOptimizer is relative to the
RenderLayer origin, but the display list components are relative to the
page origin. Before passing the page rect to the display list, we
translate it by the RenderLayer position.
2014-10-03 14:55:03 -07:00
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
Glenn Watson
2e32720129 Enable acid2 reftest on Linux. Update rust-layers. 2014-09-30 14:31:11 +10:00
Martin Robinson
a75594d7cf Mask root layer rectangles to their boundaries
This prevents iframes contents from overflowing their root layers.
2014-09-29 16:42:26 -07:00
Glenn Watson
52c5007b07 Add support for <super> and <sup> tags. Fixes equations on wikipedia. 2014-09-30 07:12:54 +10:00
Glenn Watson
bc06e27fe2 Add some vertical align reftests now that text elements get correct vertical align property. 2014-09-29 08:05:30 +10: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
bors-servo
33e2a7b362 Merge pull request #3492 from pcwalton/clear-generated-content-table
layout: Support any `display` property in generated content, and allow

Reviewed-by: glennw
2014-09-26 22:24:32 -06:00
bors-servo
94b7c486b1 Merge pull request #3486 from glennw/inline-fixes
Improve acid2. Fix line height calculation. Text fragments get correct enclosing element style.

Reviewed-by: pcwalton
2014-09-26 21:57:35 -06:00
Glenn Watson
71758643dc Remove unneeded clones and add some comments. 2014-09-27 13:51:10 +10:00
Gilles Leblanc
8e77422d8e Handle dynamic addition of attributes
Handles dynamic addition of attributes to <link rel=stylesheet>
elements.

Fixes #3361
2014-09-26 19:04:32 -04:00
Patrick Walton
47fc64052c layout: Support any display property in generated content, and allow
tables to clear floats.

Improves the GitHub header.
2014-09-26 14:09:25 -07:00
Patrick Walton
36f3f5a0ab layout: Block formatting contexts should contain all their floats.
Improves Pinterest considerably.
2014-09-26 00:39:07 -07:00
Glenn Watson
cf79e64a5a Improve acid2. Fix line height calculation. Text fragments get correct enclosing element style.
* Enabled acid2 on mac + linux. Updated the reference image. The only difference from the
real acid2 now is the paint order and a 1 pixel horizontal offset on the nose.
* Change line-height to be calculated correctly.
* Apply enclosing element style to text fragments.
2014-09-26 17:12:22 +10:00
Patrick Walton
5b4380389e layout: Enhance the heuristic that guesses the inline size of block
formatting contexts.

The widths of block formatting contexts depend on the floats prior to
them. To avoid a circular dependency between width assignment and height
assignment, we must guess their widths during the assign-widths pass.
The old code simply used the size of the last float, whether
left-floated or right-floated, but this proved insufficient to handle
layouts like those seen on Reddit. The new heuristic keeps track of both
left and right floats independently and sums the width of all left and
right floats to determine the width of a block formatting context. This
is still insufficient to properly lay out Reddit, but the results are
much more acceptable.

A fully correct approach will require that blocks be laid out again if
the initial guess proved to be incorrect. A `TODO` is in the code to
handle this case.
2014-09-25 17:50:24 -07:00
Patrick Walton
9f4c2de211 layout: Unify the block-size computation for blocks and floats.
The float code was old and did not support most of CSS 2.1. So unifying
the two paths both simplifies code and improves functionality.

Improves the Reddit sidebar.
2014-09-25 16:43:24 -07:00
Patrick Walton
62bb9093d7 layout: Float table wrappers directly instead of generating a block
wrapper around them.

Fixes Wikipedia tables leaking out.

Along the way, I refactored tables' width calculation significantly.
This was necessary in order to properly handle floated tables, as some
of the logic had to be ported over from block flows.
2014-09-25 08:06:03 -07:00
Patrick Walton
fffc7aaf38 layout: Consider relatively positioned blocks as possible block
formatting contexts, and translate floats out of block formatting
contexts.

These improve Reddit.
2014-09-24 22:03:06 -07:00
Patrick Walton
9aacd4c10c layout: Implement white-space: nowrap.
Improves the Reddit header.
2014-09-23 15:47:45 -07:00
Glenn Watson
32c02fc048 Fix inline context padding on inline-block.
Fixes categories bar on wikipedia - ref #2554.
2014-09-23 15:40:08 +10: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
Patrick Walton
34b3408a89 layout: Translate floats when clearing non-floated blocks.
Improves CNN layout considerably.

Closes #3439.
2014-09-22 14:14:20 -07:00