Commit graph

208 commits

Author SHA1 Message Date
Patrick Walton
b026a8ecf6 layout: Store overflow for flows impacted by floats.
Makes qz.com visible.

In order to work around a compiler bug involving Sized, this patch moves
`store_overflow` to be a virtual method.
2015-05-11 12:59:55 -07:00
bors-servo
844ac2915e Auto merge of #5997 - mbrubeck:table-direction, r=pcwalton
Table columns should be layed out according to the 'direction' property of the
table flow, regardless of the 'direction' property of any table-row,
table-rowgroup, etc. flows.

This fixes a number of the `direction-applies-to-*` tests in the CSS2.1 test
suite.

This also simplifies `propagate_column_inline_sizes_to_child` by separating
the code used for table cells from the code for non-cell flows.

r? @pcwalton

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/5997)
<!-- Reviewable:end -->
2015-05-11 07:50:09 -05:00
Matt Brubeck
e36a498cfb Fix direction of columns in mixed LTR/RTL tables.
Table columns should be layed out according to the 'direction' property of the
table flow, regardless of the 'direction' property of any table-row,
table-rowgroup, etc. flows.

This fixes a number of the `direction-applies-to-*` tests in the CSS2.1 test
suite.

This also simplifies `propagate_column_inline_sizes_to_child` by separating
the code used for table cells from the code for non-cell flows.

r? @pcwalton
2015-05-08 21:29:02 -07:00
Patrick Walton
614c877527 layout: Support vertical-align for inline-blocks.
Improves Twitter.
2015-05-08 17:59:01 -07:00
Patrick Walton
7b92b99c6d layout: Take the width attribute of <img> into account when
computing the intrinsic widths of the associated fragment.

Fixes sites that use spacer gifs for table layout, such as the comments
page on Hacker News.
2015-05-08 13:30:27 -07:00
Patrick Walton
b17b90c8df layout: Implement inline margins.
Improves the Google SERPs.

We mark `html/rendering/replaced-elements/images/space.html` as failing.
This test tested whether `<img hspace>` and inline margins do the same
thing. Since this was trivially the case before (since we implemented
neither) and now is not, this test now fails.
2015-05-07 16:25:05 -07:00
James Gilbertson
455ac536af Add a basic ref test for @viewport 2015-05-06 09:19:16 -06:00
bors-servo
7b87085c18 Auto merge of #5919 - pcwalton:inline-block-intrinsic-widths, r=mbrubeck
* Stop double-counting border and padding for inline-block fragments.
  (Test case: `inline_block_border_intrinsic_size_a.html`.)

* Take clearance into account when determining intrinsic widths of
  blocks containing floats.

Improves the Amazon headers.

r? @mbrubeck

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/5919)
<!-- Reviewable:end -->
2015-05-04 13:37:24 -05:00
Ms2ger
b845ab4725 Submit the drawImage reftests to wpt. 2015-05-04 00:30:02 +02:00
Patrick Walton
33087497ac layout: Fix a couple of issues relating to intrinsic widths of inline
blocks.

* Stop double-counting border and padding for inline-block fragments.
  (Test case: `inline_block_border_intrinsic_size_a.html`.)

* Take clearance into account when determining intrinsic widths of
  blocks containing floats.

Improves the Amazon headers.
2015-05-01 18:07:07 -07:00
Patrick Walton
986f81afa7 layout: Use the border box, not the margin box, for placement of block
formatting contexts.

Improves Amazon.
2015-05-01 15:11:46 -07:00
Ms2ger
bbd7cac371 Run absolute position reftests as part of test-wpt. 2015-04-30 17:44:59 +02:00
Ms2ger
031d4f0c2c Start running reftests with wptrunner.
CC #5618.
2015-04-30 14:49:06 +02:00
Matt Brubeck
50f982bb0c Fix text-align left/right in RTL layout 2015-04-29 07:07:58 -07:00
Matt Brubeck
81e8f18662 Support text-align: start and end 2015-04-29 07:07:58 -07:00
bors-servo
b6fc83cf2b Auto merge of #5887 - pcwalton:border-collapse-missing-cells, r=mbrubeck
This was seen in Twitter and the Google SERPs (sometimes).

r? @mbrubeck

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/5887)
<!-- Reviewable:end -->
2015-04-28 15:32:31 -05:00
Patrick Walton
577f1ea109 layout: Don't panic in border collapse when a row has fewer cells than
its previous sibling.

This was seen in Twitter and the Google SERPs (sometimes).
2015-04-28 13:16:01 -07:00
Matt Brubeck
cad5d8b670 Ignore border-spacing for tables with zero cells 2015-04-28 10:30:47 -07:00
Patrick Walton
44a30054a1 layout: Make margin: auto work properly with tables.
Improves the Amazon home page.
2015-04-28 09:26:08 -07:00
bors-servo
2fd5ecf3d7 Auto merge of #5694 - pcwalton:anonymous-table-objects, r=mbrubeck
Improves Facebook Timeline.

r? @mbrubeck

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/5694)
<!-- Reviewable:end -->
2015-04-28 07:13:53 -05:00
Patrick Walton
a92baf7683 layout: Make the style-specified width affect minimum width.
Improves the front page of Google.
2015-04-27 18:32:28 -07:00
Patrick Walton
f0954f8799 layout: Generate anonymous table objects as necessary per CSS 2.1 §
17.2.1.

Improves Facebook Timeline.
2015-04-27 14:12:44 -07: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
Patrick Walton
79336d21b5 style: Disregard the size attribute for input elements other than text
or password fields.

HTML5 § 4.10.5.3.2 doesn't explicitly say to do this, but all other
browser engines seem to do it.

Improves the Google home page.
2015-04-24 17:33:53 -07:00
Adenilson Cavalcanti
4f210eb8fe Fixing inline elements filtering rendering.
It required to move create_stacking_context() outside of BlockFlow,
as a method of FragmentDisplayListBuilding. This allowed the reuse
for inline fragments that need a stacking context.

As we now create stacking contexts (SC) for inline elements, this stresses
the code in Fragment that calculates the need for a SC.

For while, we create a SC only if there are filters associated with the
Inline element. Companion issue is #5812.
2015-04-23 12:32:18 -07:00
Diego Marcos
c82485874d Kicks off a WebGL implementation 2015-04-20 14:29:39 -07:00
bors-servo
f7bfea5879 Auto merge of #5706 - pcwalton:absolute-clipping-of-own-contents, r=glennw
r? @glennw

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/5706)
<!-- Reviewable:end -->
2015-04-15 21:04:59 -05:00
Patrick Walton
14a544b64c layout: Clip the immediate fragments of block flows that establish
stacking contexts properly.

The code that existed before correctly translated the clips of child
elements, but not those of immediate display items belonging to the flow
itself.

Makes Leaflet.js maps usable.
2015-04-15 17:19:27 -07:00
bors-servo
1fd6a48cca Auto merge of #5546 - Adenilson:blurFilter01, r=pcwalton
See discussion on #5190 and #5496.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/5546)
<!-- Reviewable:end -->
2015-04-15 18:56:49 -05:00
Adenilson Cavalcanti
05dd176186 Implementing Blur filter. 2015-04-15 16:15:21 -07:00
Patrick Walton
acd08c67c6 layout: Use the same code path for computing static positions of regular
flows and static positions of hypothetical boxes.

Before this change, Servo used one code path that computed the position
of flows with `position: static` or `position: relative` and another
separate code path that computed the position of flows with `position:
absolute` or `position: fixed`. The latter code attempted to duplicate
the former code to determine the static position of hypothetical boxes,
but this was both fragile and incorrect in the case of hypothetical
boxes nested inside floats. In fact, it's impossible to determine the
static position of an absolute flow relative to its containing block at
inline-size assignment time, because that static position could depend
on a float that cannot be placed until block-size assignment!

This patch changes block layout to use the same code path for static
positioning of regular flows and static positioning of absolute flows
where applicable. This both simplifies the code and improves its
efficiency, since it allows the `hypothetical_position` field and
`static_block_offsets` data structure to be removed. Moreover, it
improves correctness in the above case (which the new reftest checks).
This allows the sidebar in Facebook Timeline to be positioned properly.
2015-04-14 13:00:10 -07:00
Patrick Walton
2f3b3eb4c4 layout: Include padding in the content block-size when computing the
block-size value when `height: auto` is specified for
absolutely-positioned elements.

Improves "Edit links" on the Wikipedia sidebar.
2015-04-10 15:33:07 -07:00
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
bors-servo
1c884dc76b Auto merge of #5583 - pcwalton:float-ceiling-top-margin-redux, r=mbrubeck
As the float ceiling is relative to the border box, not the margin box,
of the parent flow, top margin must not be included.

This exposed a pre-existing bug whereby margins are discarded if a block
contains only floats and no content, affecting the tests
`float_intrinsic_height.html` and `margins_inside_floats_a.html`. As a
workaround, some invisible content has been added to the bodies of both
tests.

r? @mbrubeck
2015-04-08 18:04:14 -05: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
bors-servo
267badae69 Auto merge of #5587 - pcwalton:list-style-image-sizing-redux, r=glennw
Improves Wikipedia.

r? @glennw
2015-04-08 04:48:30 -05:00
bors-servo
f4da0f0e94 Auto merge of #5584 - pcwalton:fix-a-float-redux, r=glennw
As far as I can tell, this is a cut-and-paste of old buggy code from
block flows. Delegating to the correct block flow code fixes the sidebar
float placement on Guardians of the Galaxy.

r? @glennw
2015-04-08 03:57:36 -05:00
Patrick Walton
7a08a6c1ab layout: Position and size list images properly in the block direction.
Improves Wikipedia.
2015-04-07 15:42:52 -07:00
Patrick Walton
df9c0c7a26 layout: Remove the bogus
`assign_block_size_for_inorder_child_if_necessary` logic from table
wrapper flows.

As far as I can tell, this is a cut-and-paste of old buggy code from
block flows. Delegating to the correct block flow code fixes the sidebar
float placement on Guardians of the Galaxy.
2015-04-07 15:13:17 -07:00
Patrick Walton
c86bc2eb8b layout: Don't take collapsible top margin into account when determining
the float ceiling.

As the float ceiling is relative to the border box, not the margin box,
of the parent flow, top margin must not be included.

This exposed a pre-existing bug whereby margins are discarded if a block
contains only floats and no content, affecting the tests
`float_intrinsic_height.html` and `margins_inside_floats_a.html`. As a
workaround, some invisible content has been added to the bodies of both
tests.
2015-04-07 15:10:15 -07:00
Diego Marcos
88954e3e18 Implements drawImage for html image as ImageSource 2015-04-07 11:02:50 -07:00
Patrick Walton
e10af4fc98 layout: Correctly take the inline size of cleared floats into account
when estimating the inline size of block formatting contexts.

The speculated inline-size of the preceding floats was forced to zero at
the wrong time if the float was itself cleared, causing it to overwrite
the speculated value. Shuffling the code around a bit fixes the problem.
2015-04-06 17:59:14 -07:00
Matt Brubeck
791fa3757d Implement the :focus pseudo-class selector
Fixes #5460. This supports for simple focusable elements that are their own
DOM anchors, like text `input` fields.
2015-04-04 10:57:11 -07:00
bors-servo
40fab8e362 auto merge of #5470 : bjwbell/servo/tab-in-pre, r=mbrubeck
Display tab characters as 4 spaces for pre and other elements that don't
compress whitespace.

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

@pcwalton r?
2015-04-03 04:18:42 -06:00
Bryan Bell
29852bb111 Show tabs in pre elements
Display tab characters as 8 spaces for pre and other elements that don't
compress whitespace.
2015-04-02 22:15:39 -07:00
dhneio
069f53a25e Fix is_simple_advance check. Fixes #4614. 2015-04-01 12:11:56 -04:00
Adenilson Cavalcanti
cdebb3ca54 Load a placeholder when a url to an image is broken.
I decided to use the old Netscape broken image link icon (later we may
replace the image asset for something more trendier). The ref test will
expect that a failed load should display the rippy image.

ImageCacheTask users can define if a placeholder image should be loaded
at start up or not. This enables both the new behavior (e.g. always
return an image even for broken urls) as also the previous one.
2015-03-30 10:02:54 -07:00
Diego Marcos
e3f5a76baa Implementing canvas drawImage API for HTML Canvas elements as image source 2015-03-24 12:23:15 -07:00