Commit graph

377 commits

Author SHA1 Message Date
bors-servo
a0cb657fe8 Auto merge of #7423 - pcwalton:iframe-stacking-context-position, r=glennw
layout: Make the compositor rather than layout determine the position of each iframe.

The old code that attempted to do this during layout wasn't able to work
for multiple reasons: it couldn't know where the iframe was going to be
on the page (because of nested iframes), and at the time it was building
the display list for a fragment it couldn't know where that fragment was
going to be in page coordinates.

This patch rewrites that code so that only the size of an iframe is
determined during layout, and the position is determined by the
compositor. Layout layerizes iframes and marks the iframe layers with
the appropriate subpage ID so that the compositor can place them
correctly.

Closes #7377.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7423)
<!-- Reviewable:end -->
2015-09-29 19:26:49 -06:00
bors-servo
a144d086d9 Auto merge of #7786 - mbrubeck:harfbuzz-sys, r=pcwalton
Use Harfbuzz 1.0 and unicode-script for text shaping

Depends on servo/rust-harfbuzz#53 and introduces a dependency on the new servo/unicode-script crate.  r? @pcwalton

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7786)
<!-- Reviewable:end -->
2015-09-29 15:37:11 -06:00
Matt Brubeck
6304186f4f Fix text-transform:capitalize across text runs 2015-09-29 14:34:50 -07:00
bors-servo
0c64e4a2c9 Auto merge of #7764 - j3parker:input-caret-only-for-text, r=pcwalton
Only display text carets in text inputs

For #7756

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7764)
<!-- Reviewable:end -->
2015-09-29 14:13:32 -06:00
Patrick Walton
c72d0c2ed0 layout: Make the compositor rather than layout determine the position of
each iframe.

The old code that attempted to do this during layout wasn't able to work
for multiple reasons: it couldn't know where the iframe was going to be
on the page (because of nested iframes), and at the time it was building
the display list for a fragment it couldn't know where that fragment was
going to be in page coordinates.

This patch rewrites that code so that both the sizes and positions of
iframes are determined by the compositor. Layout layerizes all iframes
and marks the iframe layers with the appropriate pipeline and subpage
IDs so that the compositor can place them correctly. This approach is
similar in spirit to Gecko's `RefLayer` infrastructure. The logic that
determines when it is time to take the screenshot for reftests has been
significantly revamped to deal with this change in delegation of
responsibility.

Additionally, this code removes the infrastructure that sends layout
data back to the layout task to be destroyed, since it is now all
thread-safe and can be destroyed on the script task.

The failing tests now fail because of a pre-existing bug related to
intrinsic heights and borders on inline replaced elements. They happened
to pass before because we never rendered the iframes at all, which meant
they never had a chance to draw the red border the tests expect to not
render!

Closes #7377.
2015-09-29 09:47:28 -07:00
Jacob Parker
9cf43877f2 Only display text carets in text inputs 2015-09-27 19:23:20 -04:00
bors-servo
45a0c48efd Auto merge of #7711 - aopicier:root_layout, r=pcwalton
Use computed `display` property for hypothetical box of root element

Closes #7558.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7711)
<!-- Reviewable:end -->
2015-09-27 17:03:58 -06:00
Emilio Cobos Álvarez
17a9472745 webgl: Add test for passing a canvas with no context as texture source 2015-09-25 18:47:37 +02:00
Emilio Cobos Álvarez
5d7d745ab4 webgl: Add tests for canvas texturing 2015-09-25 16:20:31 +02:00
bors-servo
4d1be2f56c Auto merge of #7703 - bjwbell:bugfix-0px-and-non-0px-border-widths, r=pcwalton
gfx: Fix border-radius panic when a corner has 0px and >0px borders

When one border is 0px and the other is >0px then the border corner
drawing code panics when computing the values to use in drawing the
border corner arcs.

This fixes that bug and makes the `draw_corner` function more robust
by explicitly passing an enum, `BorderCorner`, naming which corner is
being drawn e.g. `BorderCorner::TL`.

Add a ref test,
`border_radius_zero_sizes_a.html/border_radius_zero_sizes_ref.html`.

Fixes https://github.com/servo/servo/issues/7700.

r? @pcwalton or @mbrubeck

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7703)
<!-- Reviewable:end -->
2015-09-24 18:18:07 -06:00
Philipp Hartwig
7d3a712b3a Add ref tests for #7558 2015-09-23 22:44:49 +02:00
Bryan Bell
071acf476b gfx: Fix border-radius panic when a corner has 0px and >0px borders
When one border is 0px and the other is >0px then the border corner
drawing code panics when computing the values to use in drawing the
border corner arcs.

This fixes that bug and makes the `draw_corner` function more robust
by explicitly passing an enum, `BorderCorner`, naming which corner is
being drawn e.g. `BorderCorner::TL`.

Add a ref test,
`border_radius_zero_sizes_a.html/border_radius_zero_sizes_ref.html`.

Fixes https://github.com/servo/servo/issues/7700.
2015-09-21 17:26:47 -07:00
Michael Howell
554a4cf9f2 Add transitions for CSS calc().
Closes #7284
2015-09-19 19:39:55 -07:00
Matt Brubeck
9333f028e8 Snap to screen pixels instead of px
Fixes #7665.
2015-09-18 03:06:06 -07:00
bors-servo
acde10f005 Auto merge of #7656 - mbrubeck:incremental-text-6501, r=pcwalton
Reconstruct flows when text/font styles change

These styles are used during text shaping.  When they change, we need to re-run shaping and construct new flows.

Fixes #6501. r? @pcwalton

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7656)
<!-- Reviewable:end -->
2015-09-18 01:32:40 -06:00
Matt Brubeck
0c77705f52 Reconstruct flows when text/font/list styles change
Fixes #6501.
2015-09-17 11:59:00 -07:00
Martin Robinson
1e6f797268 Ensure unique LayerIds for pseudo-elements
Currently pseudo-elements, like the fragments created for ::before and
::after, with layers will have the same LayerId as the body of their
owning fragments. Instead all LayerIds should be unique.

Fixes #2010.
2015-09-17 06:42:29 -07:00
bors-servo
9e914ca0db Auto merge of #7588 - notriddle:master, r=pcwalton
Actually store the overflow for inline-block elements.

Fixes #7571

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7588)
<!-- Reviewable:end -->
2015-09-17 00:53:04 -06:00
bors-servo
8f0b702018 Auto merge of #7642 - bjwbell:shorthand-parse-elliptical-border-radius, r=jdm
gfx: Add elliptical border-radius shorthand parsing

Adds support for parsing shorthand border-radius values such as:

    /* The syntax of the second radius allows one to four values */
    /* (first radius values) / radius */
    border-radius: 10px 5% / 20px;

    /* (first radius values) / top-left-and-bottom-right | top-right-and-bottom-left */
    border-radius: 10px 5% / 20px 30px;

    /* (first radius values) / top-left | top-right-and-bottom-left | bottom-right */
    border-radius: 10px 5px 2em / 20px 25px 30%;

    /* (first radius values) / top-left | top-right | bottom-right | bottom-left */
    border-radius: 10px 5% / 20px 25em 30px 35em;

r? @pcwalton

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7642)
<!-- Reviewable:end -->
2015-09-16 10:13:52 -06:00
bors-servo
6a12f00d6d Auto merge of #7605 - nox:skew, r=mbrubeck
Implement "transform: skew()"

Thanks to @Jinwoo-Song for the original commit, which I just rebased and cleaned up. Fixes #6237.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7605)
<!-- Reviewable:end -->
2015-09-16 06:31:48 -06:00
Bryan Bell
48f1159845 gfx: Add elliptical border-radius shorthand parsing
Adds elliptical border-radius shorthand parsing, e.g.:

    /* The syntax of the second radius allows one to four values */
    /* (first radius values) / radius */
    border-radius: 10px 5% / 20px;

    /* (first radius values) / top-left-and-bottom-right | top-right-and-bottom-left */
    border-radius: 10px 5% / 20px 30px;

    /* (first radius values) / top-left | top-right-and-bottom-left | bottom-right */
    border-radius: 10px 5px 2em / 20px 25px 30%;

    /* (first radius values) / top-left | top-right | bottom-right | bottom-left */
    border-radius: 10px 5% / 20px 25em 30px 35em;
2015-09-15 16:51:17 -07:00
Corey Farwell
3ae76f4e76 Implement <font> 'face' attribute 2015-09-14 20:24:52 -04:00
Simon Sapin
43c999905c Replace reftest with a problematic file name with a unit test.
Fix #7609, "error: unable to create file tests/ref/hello_a?foo#bar.html
(Invalid argument)" during git checkout on Windows.

Behavior change: passing an nonexistent file name on the command line
now shows a blank page (like network errors)
rather than exit with an error message.
2015-09-12 14:18:15 +02:00
Jinwoo Song
d524601cf5 CSS 'transformation: skew()' should take <angle> type as parameters
Current implementation is taking <number> type as parameter so skew()
does not work properly. Let the skew() to get <angle> as specification
described.

Fixes #6237.
2015-09-12 01:06:35 +02:00
bors-servo
c3f9e1813a Auto merge of #7550 - pcwalton:block-formatting-context-overflow, r=mbrubeck
layout: Defend the block formatting context speculation against going wrong in the presence of blocks that overflow in the inline direction.

Makes the Google search result links appear.

Closes #7298.

r? @mbrubeck

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7550)
<!-- Reviewable:end -->
2015-09-11 10:03:39 -06:00
bors-servo
f29ddb4b5d Auto merge of #7577 - bjwbell:borders_pixel_rounding_bug, r=mbrubeck
gfx: Fix bug with 1px width borders disappearing

In to_nearest_azure_rect when rounding to pixel coordinates, maintain
the invariant of rect non-overlap (if before rounding two rects don't overlap).

The previous code rounded the rect top left corner to the nearest pixel with
the size rounded to the nearest pixel multiple which can violate the
non-overlap condition, e.g.
10px×9.60px at (0px,6.6px) & 10px×9.60px at (0px,16.2px)
would round to
10px×10.0px at (0px,7.0px) & 10px×10.0px at (0px,16.0px), which overlap.

Instead round each corner to the nearest pixel.

For rects that dont need to satify the non-overlap condition and with
width or height between 0.5px and 1px, rounding each rect corner to the
nearest pixel can yield an empty rect e.g.
10px×0.6px at 0px,28.56px -> 10px×0px at 0px,29px.

For this scenario a new function to_nearest_non_empty_azure_rect
rounds the rect top left corner to the nearest pixel and the rect size
to the nearest pixel multiple. It's possible for non-overlapping rects
after this rounding to overlap.

This should fix https://github.com/servo/servo/issues/7184 "rounding ...borders not to be visible", without breaking https://github.com/servo/servo/issues/7152 "Underlines less than 1px high sometimes invisible".

r? @mbrubeck

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7577)
<!-- Reviewable:end -->
2015-09-09 13:30:41 -06:00
Michael Howell
029af81570 Actually store the overflow for inline-block elements.
Fixes #7571
2015-09-09 12:24:28 -07:00
Martin Robinson
184238c348 Layerize StackingContexts that are on top of layers
StackingContexts that should be painted on top of StackingContexts that
are already layerized should automatically get their own layer. This
will ensure proper painting order.
2015-09-09 09:13:14 -07:00
Bryan Bell
642b34865f gfx: Fix bug with 1px width borders disappearing
In to_nearest_azure_rect when rounding to pixel coordinates, maintain
the invariant of rect non-overlap (if before rounding two rects don't overlap).

The previous code rounded the rect top left corner to the nearest pixel with
the size rounded to the nearest pixel multiple which can violate the
non-overlap condition, e.g.
10px×9.60px at (0px,6.6px) & 10px×9.60px at (0px,16.2px)
would round to
10px×10.0px at (0px,7.0px) & 10px×10.0px at (0px,16.0px), which overlap.

Instead round each corner to the nearest pixel.

For rects that dont need to satify the non-overlap condition and with
width or height between 0.5px and 1px, rounding each rect corner to the
nearest pixel can yield an empty rect e.g.
10px×0.6px at 0px,28.56px -> 10px×0px at 0px,29px.

For this scenario a new function to_nearest_non_empty_azure_rect
rounds the rect top left corner to the nearest pixel and the rect size
to the nearest pixel multiple. It's possible for non-overlapping rects
after this rounding to overlap.
2015-09-09 03:20:52 -07:00
Michael Howell
6228edfb4c Include the overflow of the inline block itself.
Closes #7372.
2015-09-07 20:27:06 -07:00
Patrick Walton
683290e109 layout: Use a special path that treats margin: auto as zero for inline-block
inline size computation.

Places the search icon in the right place on the Google SERPs.
2015-09-04 20:42:57 -07:00
bors-servo
aeb8dce2d9 Auto merge of #7534 - pcwalton:inline-absolute-out-of-flow, r=mbrubeck
layout: Lay absolutely-positioned blocks with inline containing blocks out of flow.

Removes the long space before the site-specific drop-down in the Google SERPs.

r? @glennw

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7534)
<!-- Reviewable:end -->
2015-09-04 19:59:11 -06:00
bors-servo
5bad6b1b6e Auto merge of #7502 - bjwbell:elliptical-borders, r=pcwalton
gfx: Add elliptical border radius support

TODO: Add code for parsing shorthand border-radius e.g. "border-radius: 10px 5% / 20px".

r? @pcwalton

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7502)
<!-- Reviewable:end -->
2015-09-04 18:46:24 -06:00
Patrick Walton
ded4a5793e layout: Defend the block formatting context speculation against going wrong in
the presence of blocks that overflow in the inline direction.

Makes the Google search result links appear.

Closes #7298.
2015-09-04 17:00:15 -07:00
Bryan Bell
3e5fb49b6f gfx: Add elliptical border radius support 2015-09-04 14:42:44 -07:00
Patrick Walton
2276d642fd layout: Stop double-counting position: relative offsets for stacking
contexts.

Fixes the location of the gear menu on the Google SERPs.
2015-09-04 09:28:18 -07:00
Patrick Walton
dba3e41a63 layout: Lay absolutely-positioned blocks with inline containing blocks out of
flow.

Removes the long space before the site-specific drop-down in the Google SERPs.
2015-09-03 15:37:40 -07:00
Patrick Walton
ee8741b7a8 layout: Fix several bugs relating to inline borders, padding, and
margins.

* The code that attempted to strip out borders that span multiple
  fragments in the same element could go wrong if fragments were
  stripped out due to text clumping or whitespace stripping. This patch
  rewrites that code to maintain flags in the inline fragment context
  specifying whether the node is the beginning or end of the element.
  Not only is this easier to maintain, it's closer in spirit to what roc
  originally suggested two years ago: it's isomorphic to "begin element,
  end element" markers for inline layout.

* Padding and margins for spans containing inline-blocks are now
  properly handled via a division of labor between the `InlineBlock`
  fragment and the `BlockFlow` that represents the inline-block.

* Unscanned text fragments may not be joined together into a text run if
  borders, padding, or margins separate them.

Because Servo now matches the rendering of Gecko and WebKit on the
`input_button_margins_a` reftest, I had to modify it to add some
vertical alignment.

The combined effect of all of these fixes places "Advertising" on the
right place on google.com.
2015-09-03 10:24:59 -07:00
bors-servo
a547ae6826 Auto merge of #7496 - servo:calc_, r=SimonSapin
Implement CSS3 Calc

This is #7185 with one commit added to make it build merged with master, which got support for the `ch` unit in the meantime.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7496)
<!-- Reviewable:end -->
2015-09-02 02:33:18 -06:00
Simon Sapin
9f48dcd858 Fix font-size keywords parsing. 2015-09-02 09:54:38 +02:00
bors-servo
ba2cb77c26 Auto merge of #7503 - mrobinson:iframe-issue, r=glennw
Upgrade to the latest rust-layers

This should fix a bug where hidden iframes are not properly clipped
away from the compositor scene. This commit adds a test for this
behavior.

Fixes #6849.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7503)
<!-- Reviewable:end -->
2015-09-01 22:18:52 -06:00
Martin Robinson
bc824f117c Upgrade to the latest rust-layers
This should fix a bug where hidden iframes are not properly clipped
away from the compositor scene. This commit adds a test for this
behavior.

Fixes #6849.
2015-09-01 17:57:57 -07:00
bors-servo
e46499a5df Auto merge of #7498 - pcwalton:inline-absolute-containing-blocks, r=mbrubeck
layout: Implement partial support for inline absolute containing blocks.

Improves the position of the down arrows on google.com SERPs.

r? @mbrubeck

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7498)
<!-- Reviewable:end -->
2015-09-01 16:36:58 -06:00
Patrick Walton
676f7014e8 layout: Implement partial support for inline absolute containing blocks.
Improves the position of the down arrows on google.com SERPs.
2015-09-01 12:18:19 -07:00
bors-servo
dcaf66397a Auto merge of #7313 - pcwalton:position-relative-percentage-overflow, r=mbrubeck
layout: Make overflow calculation take relative percentages into account.

This necessitated changing overflow to be calculated by the parent flow
if relatively positioned children are present. That is because the
overflow regions cannot be calculated without knowing relative offsets,
which themselves cannot be calculated without knowing the parent size
(because of percentages). To accomplish this without sacrificing
parallelism in the non-relative case, this patch splits overflow into
"early" and "late" computation. Late overflow computation cannot be
parallelized across children, while early overflow computation can.

Makes the "Apple Music" text show up over the full-bleed promotional
background on apple.com.

r? @SimonSapin -- would appreciate a look over the iframe test case that was changed.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7313)
<!-- Reviewable:end -->
2015-09-01 12:33:07 -06:00
Simon Sapin
80d471d5cf Merge branch 'master' into calc 2015-09-01 18:39:16 +02:00
bors-servo
dee6283483 Auto merge of #7474 - notriddle:master, r=pcwalton
Inline constraint resolver for absolutely positioned tables.

Fixes #7425.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7474)
<!-- Reviewable:end -->
2015-08-31 20:35:06 -06:00
Patrick Walton
b66f17a445 layout: Make overflow calculation take relative percentages into
account.

This necessitated changing overflow to be calculated by the parent flow
if relatively positioned children are present. That is because the
overflow regions cannot be calculated without knowing relative offsets,
which themselves cannot be calculated without knowing the parent size
(because of percentages). To accomplish this without sacrificing
parallelism in the non-relative case, this patch splits overflow into
"early" and "late" computation. Late overflow computation cannot be
parallelized across children, while early overflow computation can.

Makes the "Apple Music" text show up over the full-bleed promotional
background on apple.com.
2015-08-31 16:50:56 -07:00
Michael Howell
36759338c7 Inline constraint resolver for absolutely positioned tables.
Fixes #7425.
2015-08-31 16:45:17 -07:00
bors-servo
afc2c381db Auto merge of #7370 - bjwbell:bugfix-unequal-borders, r=pcwalton
gfx: Border radius support for asymmetric sized borders

When the border-top/right/bottom/left-widths are not equal, the angle on the border corner arc separating the borders isn't PI/4. 

For instance if the top border width is much larger than the left border width then most of the border corner should be drawn using the top border color.

This change adds support for calculating the correct angle in the border
corner arc for switching from one border to another e.g. the left border
to the top border.

It supports elliptical border radii for when elliptical border radii are
added.

A ref test is also included.

r? @Ms2ger 

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7370)
<!-- Reviewable:end -->
2015-08-31 14:58:33 -06:00