Commit graph

156 commits

Author SHA1 Message Date
Simon Sapin
9e1a674b16 Update rust-selectors 2015-06-26 12:35:08 -07:00
Ms2ger
2ea32829af Replace OpaqueNodeMethods::from_{threadsafe_,}layout_node by opaque methods. 2015-06-24 14:55:43 +02:00
bors-servo
469b9550f6 Auto merge of #6443 - Ms2ger:cleanup-layout, r=pcwalton
Various layout cleanup.



<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6443)
<!-- Reviewable:end -->
2015-06-24 03:00:32 -06:00
Glenn Watson
39ddbbb0e1 Implement enough of 3d transforms spec to run the CSS FPS demo. 2015-06-23 14:10:44 +10:00
Ms2ger
13a07a4ed2 Move some TLayoutNode methods to ThreadSafeLayoutNode.
They are unused on LayoutNode.
2015-06-22 10:47:38 +02:00
ecoal95
8cbfb3482c Use euclid from crates.io 2015-06-19 00:04:24 +02:00
bors-servo
db2eb36e19 Auto merge of #6325 - Ms2ger:from_str, r=nox
The former appears to be preferred.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6325)
<!-- Reviewable:end -->
2015-06-14 03:55:56 -06:00
Corey Farwell
5c408d2be9 rust-geom API changes
https://github.com/servo/rust-geom/pull/81
2015-06-13 12:28:21 -07:00
Ms2ger
b49bd79625 Use str::parse() rather than FromStr::from_str.
The former appears to be preferred.
2015-06-13 17:58:16 +02:00
Nicholas Nethercote
9b4d39d6d1 Make LOCAL_CONTEXT_KEY safe and non-leaky.
`LOCAL_CONTEXT_KEY` is currently a `Cell<*mut LocalLayoutContext>`. The use
of the raw pointer means that the `LocalLayoutContext` is not dropped when
the thread dies; this leaks FreeType instances and probably other
things. There are also some unsafe getter functions in `LayoutContext`
(`font_context`, `applicable_declarations_cache` and
`style_sharing_candidate_cache`) that @eddyb says involve undefined
behaviour.

This changeset changes `LOCAL_CONTEXT_KEY` to
`RefCell<Option<Rc<LocalLayoutContext>>>`. This fixes the leak and also
results in safe getters.

(Fixes #6282.)
2015-06-04 20:57:34 -07:00
bors-servo
300c36f250 Auto merge of #6258 - SimonSapin:drop-box-sizing-padding-box, r=jdm
This reverts commit 945adab /  PR #6033.

The CSS Working Group resolved to drop this value from the spec:
http://log.csswg.org/irc.w3.org/css/2015-05-20/#e555680

The group was unable to come up with even a theoretical use case. Gecko only implemented this value for completeness. Other browsers vendors have clearly expressed they have no interest in implementing this.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6258)
<!-- Reviewable:end -->
2015-06-02 08:57:04 -05:00
Simon Sapin
595c726f51 Revert "Add support for 'padding-box' value for 'box-sizing' property (fixes #6032)"
This reverts commit 945adabd48.

The CSS Working Group resolved to drop this value from the spec:
http://log.csswg.org/irc.w3.org/css/2015-05-20/#e555680

The group was unable to come up with even a theoretical use case.
Gecko only implemented this value for completeness.
Other browsers vendors have clearly expressed they have no interest
in implementing this.
2015-06-02 15:31:59 +02:00
Corey Farwell
435e551753 Remove get_ prefix on getters
Part of #6224

I certainly didn't remove all of them; I avoided `unsafe` areas and also `components/script`
2015-06-02 08:54:44 -04:00
bors-servo
77099b25d5 Auto merge of #5586 - pcwalton:no-broken-background-image-redux, r=glennw
r? @jdm

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/5586)
<!-- Reviewable:end -->
2015-05-20 16:43:31 -05:00
bors-servo
ad53e95080 Auto merge of #6083 - ecoal95:layerize-canvas, r=pcwalton
I've done a bit of job to get this done. Right now readback is still used, but we have a `LayerId` -> `CanvasRenderer` map on the paint task, that we can use to get rid of that.

I'd want review, to see if this is a good approach (I know it's not the initial `CanvasId` -> renderer approach, but it's pretty similar, since a canvas involves a `PaintLayer`).

I had to do a bit of refactoring to avoid cyclic dependencies between canvas and gfx. I'd want you to review them too.

It's mergeable and doesn't break any tests :P

Some of my main concerns:
* Does the canvas render really need to be behind an `Arc<Mutex<T>>`?
* I can't clone a `NativeSurface` right now (that's why the `SendNativeSurface()` msg is unimplemented in the WebGL task). It should be easy to add that to rust-layers, supposing the caller is responsible to mark it as non-leaking, any reason to not do it?

cc @jdm @pcwalton

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6083)
<!-- Reviewable:end -->
2015-05-20 15:42:06 -05:00
Patrick Walton
7e7675c1dc net: Don't load the placeholder image for background images, only for
image fragments.

This also changes the way the placeholder is handled in the image cache
task to decode it up front instead of each time an image fails to load,
both because it was more convenient to implement that way and because
it saves CPU cycles to do so.

This matches the behavior of Gecko and WebKit. It improves the look of
our cached copy of Wikipedia.
2015-05-20 12:00:33 -07:00
Patrick Walton
1a3395e077 script: Implement the width and height attributes for iframes per
HTML5 § 4.8.6.

Improves Amazon and Ars Technica.
2015-05-20 11:15:25 -07:00
ecoal95
3350522306 Layerize canvas
Note that this keeps using readback right now, `NativeSurface` painting
will be implemented soon.

Also see https://github.com/servo/servo/issues/6142
2015-05-20 19:10:50 +02:00
Patrick Walton
d5ca1a18dc layout: Support percentage widths in inline-blocks.
Improves Twitter.
2015-05-19 13:35:02 -07:00
bors-servo
68d135e671 Auto merge of #6033 - Jinwoo-Song:boxsizing_paddingbox, r=pcwalton
Spec: http://dev.w3.org/csswg/css-ui/#valdef-box-sizing-padding-box

Currently, only Firefox is supporting this value.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6033)
<!-- Reviewable:end -->
2015-05-15 09:42:18 -05:00
Jinwoo Song
945adabd48 Add support for 'padding-box' value for 'box-sizing' property (fixes #6032)
Spec: http://dev.w3.org/csswg/css-ui/#valdef-box-sizing-padding-box
Currently, only Firefox is supporting this value.
2015-05-14 09:11:43 +09:00
Patrick Walton
1f0b5889da layout: Allow inline elements to be containing blocks for
absolutely-positioned elements.

This also implements a little bit of the infrastructure needed to
support for fragmentation via support for multiple positioned fragments
in one flow.

Improves Google.
2015-05-13 12:00:53 -07:00
Patrick Walton
3875c9db4a layout: Support block-direction margins for inline-blocks.
Improves linux.com.
2015-05-11 17:49:12 -07:00
Ms2ger
34e35df986 Move get_attr and get_attrs into TElementAttributes.
These methods are only called on LayoutElement.
2015-05-10 18:26:06 +02: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
Simon Sapin
b1ecba9f3d Use i32 instead of isize in Au methods. 2015-05-05 18:40:00 +02:00
Simon Sapin
8b522f2e7d Rename Au methods with f32/f64 instead of frac32/frac/subpx 2015-05-05 18:23:29 +02:00
Simon Sapin
32d5e24922 Replace Au-related free functions in util::geometry with Au methods. 2015-05-05 17:36:03 +02:00
Simon Sapin
ef8edd4e87 Upgrade to rustc 551a74dddd84cf01440ee84148ebd18bc68bd7c8. 2015-05-05 10:07:34 -04: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
Glenn Watson
a5a5214783 Various fixes to getClientBoundingRect()
* Fix queries involving stacking contexts
 * The code was double accumulating stacking context origins.
* Handle queries of inline elements.
 * The node addresses being compared were incorrect (CharacterData vs. Span)
* Handle ScriptQuery reflows correctly.
 * The layout task was skipping the compute absolute positions traversal, so failed before window.onload.
2015-05-01 12:40:37 +10: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
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
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
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
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
Diego Marcos
c82485874d Kicks off a WebGL implementation 2015-04-20 14:29:39 -07:00
Patrick Walton
82fcbf7870 layout: Minor stylistic cleanup. 2015-04-14 13:00:11 -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
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
b50b21d1da Stop using int/uint in net_traits. 2015-04-06 16:08:53 +02:00
Gilles Leblanc
ba36a108c1 Split out shared networking code into net_traits crate
Fixes #4476
2015-04-03 13:38:10 -04:00
Ms2ger
a65c80231a Stop using u/i suffixes in layout. 2015-04-02 15:14:09 +02:00
Ms2ger
683749c999 Use isize for Au::from_px. 2015-04-02 15:02:37 +02:00
Ms2ger
7b45a4384d Use a u32 in calculate_split_position_using_breaking_strategy. 2015-04-02 14:59:26 +02:00