Commit graph

610 commits

Author SHA1 Message Date
Ms2ger
ed052bc080 Move the sink into util::vec. 2015-04-27 23:44:22 +02: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
Ms2ger
811ea395bc Avoid creating a vector in can_share_style_with. 2015-04-27 20:25:19 +02:00
Simon Sapin
11b3e3b775 Remove some usage of .as_slice(). 2015-04-27 17:38:37 +02:00
Patrick Walton
0b6f84e6a1 Tidy fix 2015-04-27 17:12:08 +02:00
Patrick Walton
4d46d257cd Address review comments 2015-04-27 17:12:08 +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
e3440c8a59 Move bgcolor over to the new infrastructure.
Note that I call is_htmltabledatacellelement in
synthesize_presentational_hints_for_legacy_attributes, rather than
is_htmltablecellelement (which was used in
get_simple_color_attribute_for_layout), because that function was never called
for th elements.
2015-04-26 22:25:11 +02:00
Anthony Ramine
4e7b9d319c Remove useless unsafe methods on LayoutJS<T> 2015-04-26 21:39:11 +02:00
Ms2ger
582ee1c2b3 Create a new infrastructure for presentational hints. 2015-04-26 21:25:06 +02:00
Ms2ger
9185c3de79 Remove as_mut_slice() calls. 2015-04-26 11:09:03 +02:00
Patrick Walton
8741d9e8c4 layout: Use a flag to record whether we need to perform a line break if
wrapping on newlines rather than searching for a newline character.

Since the newline character might have been stripped out during
whitespace stripping, this was incorrect.

Fixes the "jumpiness" seen on the Google home page, Wikipedia, and many
other places.
2015-04-24 13:16:34 -07:00
Ms2ger
6a55ae06d7 Remove some as_slice calls. 2015-04-24 17:44:47 +02: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
bors-servo
68f03c9dbb Auto merge of #5805 - pcwalton:whitespace-effect-on-minimum-inline-sizes, r=glennw
Improves Amazon.

r? @glennw

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/5805)
<!-- Reviewable:end -->
2015-04-22 20:23:17 -05:00
Patrick Walton
f8b9b31680 layout: Take the white-space property into account when computing
intrinsic sizes of inline flows.

Improves Amazon.
2015-04-22 17:45:16 -07:00
bors-servo
ac0645c236 Auto merge of #5767 - glennw:image-cache, r=larsbergstrom,jdm
* Simpler image cache API for clients to use.
 * Significantly fewer threads.
   * One thread for image cache task (multiplexes commands, decoder threads and async resource requests).
   * 4 threads for decoder worker tasks.
 * Removed ReflowEvent hacks in script and layout tasks.
   * Image elements pass a Trusted<T> to image cache, which is used to dirty nodes via script task. Previous use of Untrusted addresses was unsafe.
   * Image requests such as background-image on layout / paint threads trigger repaint only rather than full reflow.
 * Add reflow batching for when multiple images load quickly.
   * Reduces the number of paints loading wikipedia from ~95 to ~35.
 * Reasonably simple to add proper prefetch support in a follow up PR.
 * Async loaded images always construct Image fragments now, instead of generic.
   * Image fragments support the image not being present.
 * Simpler implementation of synchronous image loading for reftests.
 * Removed image holder.
 * image.onload support.
 * image NaturalWidth and NaturalHeight support.
 * Updated WPT expectations.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/5767)
<!-- Reviewable:end -->
2015-04-22 19:16:46 -05:00
Glenn Watson
d8aef7208e Refactored image cache task - details below.
* Simpler image cache API for clients to use.
 * Significantly fewer threads.
   * One thread for image cache task (multiplexes commands, decoder threads and async resource requests).
   * 4 threads for decoder worker tasks.
 * Removed ReflowEvent hacks in script and layout tasks.
   * Image elements pass a Trusted<T> to image cache, which is used to dirty nodes via script task. Previous use of Untrusted addresses was unsafe.
   * Image requests such as background-image on layout / paint threads trigger repaint only rather than full reflow.
 * Add reflow batching for when multiple images load quickly.
   * Reduces the number of paints loading wikipedia from ~95 to ~35.
 * Reasonably simple to add proper prefetch support in a follow up PR.
 * Async loaded images always construct Image fragments now, instead of generic.
   * Image fragments support the image not being present.
 * Simpler implementation of synchronous image loading for reftests.
 * Removed image holder.
 * image.onload support.
 * image NaturalWidth and NaturalHeight support.
 * Updated WPT expectations.
2015-04-23 09:40:24 +10:00
bors-servo
43e664cda1 Auto merge of #5801 - Ms2ger:range, r=pcwalton
<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/5801)
<!-- Reviewable:end -->
2015-04-22 18:24:21 -05:00
bors-servo
f9a50c9be0 Auto merge of #5787 - Adenilson:colorWhite01, r=SimonSapin
<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/5787)
<!-- Reviewable:end -->
2015-04-22 17:04:41 -05:00
Adenilson Cavalcanti
2c7edeb2bf Renaming the color function to just *transparent*,
as suggested on review.
2015-04-22 14:51:39 -07:00
Adenilson Cavalcanti
cf2406de47 After discussion, it seems that transparent_white() has undefined behavior. 2015-04-22 14:42:14 -07:00
Ms2ger
4d41f1c991 Stop using the deprecated range function. 2015-04-22 20:26:40 +02:00
Adenilson Cavalcanti
95bcc5747c Adding transparent white.
Using helper color function (less verbose and clear to understand).
2015-04-21 19:10:07 -07:00
bors-servo
e4b620ea54 Auto merge of #5652 - dmarcos:webgl, r=jdm
@jdm @ecoal95 I'm working on making VR happen in the Browser and I want to bring to Servo the [webVR APIs](https://github.com/MozVR/webvr-spec/blob/master/webvr.idl) we already have in Gecko. Before anything happens we need a working implementation of WebGL (and also the [fullscreen API](https://fullscreen.spec.whatwg.org/)). My implementation is very basic and probably naive (I just recently started to contribute to Servo). My patch is just a starting point: 

- It only implements ```clearColor``` and ```clear``` methods of the [WebGL spec](https://www.khronos.org/registry/webgl/specs/latest/).
- It uses the readback strategy that ```canvasRenderingContext2D``` is using (The webgl task paints stuff independently on it's own buffer and the compositor task request the pixels back to the webgl task when it needs them) I'm sure there are much better ways to handle this. Latency and FPS are critical in VR so we have to figure out the fastest way to push pixels to the screen. I've read something about layerizing the canvas but I'm still not sure what that even means :)
- There's an included test you can try ```./mach run tests/ref/webgl-context/clearcolor.html``` 

@ecoal95 I know you'll be working on this for the next three months. With a foundation in place we will be able to make quick progress in parallel. This is exciting!

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/5652)
<!-- Reviewable:end -->
2015-04-20 19:29:02 -05:00
Diego Marcos
c82485874d Kicks off a WebGL implementation 2015-04-20 14:29:39 -07:00
Adenilson Cavalcanti
8aa9427af0 Skip computing fragment position and return early if visibility property
is not set.
2015-04-20 12:17:38 -07:00
Corey Farwell
8b08c6f43f Don't link to specific WHATWG multipage page
"Links to the multipage version of the specification are unfortunately
likely to break over time."
-- https://html.spec.whatwg.org/multipage/asefij.html

This commit removes all references to the specific pages when viewing
WHATWG using multipage mode. I went through all these links and they
redirect fine.

Regex used to generate this commit:

`s_whatwg.org/multipage/.*#_whatwg.org/multipage/#_g`
2015-04-16 22:39:25 -04:00
bors-servo
653b40d3e5 Auto merge of #5704 - jseaton:jseaton/animation-props, r=pcwalton
Contributes towards servo/servo#5494 - includes all properties listed at http://dev.w3.org/csswg/css-transitions/#animatable-css .

Unforunately the most obvious way to support text-shadow meant making a few structures NoCopy.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/5704)
<!-- Reviewable:end -->
2015-04-16 13:42:16 -05:00
Joseph Seaton
d843526cb8 Animate many more CSS properties 2015-04-16 17:42:57 +01: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
bdcf606f48 Auto merge of #5691 - pcwalton:hypothetical-box-reform, r=glennw
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.

r? @glennw

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/5691)
<!-- Reviewable:end -->
2015-04-14 18:14:11 -05:00
Corey Farwell
cc4a64e1fe Add/update comments with links to spec
Extracted out of #5649

* add more hyperlinks to associated specification for structs/methods
* follow redirects and update links
* replace broken links
* removal of WHATWG multipage page name since the page name is not
  guaranteed to be stable
2015-04-14 18:03:13 -04:00
Patrick Walton
82fcbf7870 layout: Minor stylistic cleanup. 2015-04-14 13:00:11 -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
bors-servo
4997d3a112 Auto merge of #5677 - frewsxcv:https, r=Ms2ger
Extracted this out of #5649

This commit was created with the following commands:

```
find . -iname "*.webidl" -type f -print0 | xargs -0 sed -i '' 's/http:\(.*\)whatwg.org/https:\1whatwg.org/g'
```

```
find . -iname "*.rs" -type f -print0 | xargs -0 sed -i '' 's/http:\(.*\)whatwg.org/https:\1whatwg.org/g'
```
2015-04-14 02:57:41 -05:00
bors-servo
b7f59a3646 Auto merge of #5642 - aneeshusa:arc-box-image-to-arc-image, r=Ms2ger
Image used to be a trait, but no longer is, so boxing it is no longer
necessary. Fixes #5639.
2015-04-14 01:57:07 -05:00
bors-servo
4fac8b6810 Auto merge of #5593 - shinglyu:ismap, r=jdm
This implements issue 4873
2015-04-14 00:10:08 -05:00
Corey Farwell
5eaa922045 Update WHATWG links to use HTTPS
Extracted this out of #5649

This commit was created with the following commands:

```
find . -iname "*.webidl" -type f -print0 | xargs -0 sed -i '' 's/http:\(.*\)whatwg.org/https:\1whatwg.org/g'
```

```
find . -iname "*.rs" -type f -print0 | xargs -0 sed -i '' 's/http:\(.*\)whatwg.org/https:\1whatwg.org/g'
```
2015-04-13 21:34:27 -07:00
Shing Lyu
7a65b95ae5 4873 - Support the image map processing for <img ismap/> inside an <a/> 2015-04-14 10:09:23 +08:00
bors-servo
22e570a06e Auto merge of #5553 - luniv:css-rule-iterators, r=SimonSapin 2015-04-10 19:17:49 -05:00
Aneesh Agrawal
5b593a3d32 Switch Arc<Box<Image>> to Arc<Image> for perf boost.
Image used to be a trait, but no longer is, so boxing it is no longer
necessary.
2015-04-10 18:59:02 -04:00
Patrick Walton
002d0672ba layout: Fix some whitespace. 2015-04-10 15:33:40 -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
875f07ff25 Auto merge of #5608 - pgonda:cmdline-disable-style-sharing, r=Ms2ger
Let me know if I should fix anything, or how I could implement a test if needed.  I looked at some testing in servo/ports/command_line.rs but it did not seem to apply.

Thanks!
2015-04-10 03:06:11 -05:00
bors-servo
db4609d722 Auto merge of #5629 - glennw:glyph-count, r=pcwalton 2015-04-09 21:01:06 -05:00
Peter
881112d34e Adding cmdling argument for disabling style share cache, fix #5581 2015-04-09 21:42:41 -04:00
bors-servo
80851f7055 Auto merge of #5572 - laumann:remove-unnecessary-buffer-sends, r=glennw
Some debugging reveals that the send_back_unused_buffers() quite often sends empty vectors back to the paint task. This still incurs a communication overhead though. Instead check that the there actually are buffers to send back.
2015-04-09 20:28:31 -05:00
Glenn Watson
3815cb4a81 Remove unneeded assert (code below handles it) and a warning. Fixes #5230. 2015-04-10 09:55:59 +10: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