Commit graph

119 commits

Author SHA1 Message Date
Ms2ger
3984e39011 Replace the StyledNode trait with inherent methods. 2015-07-27 19:57:33 +02:00
Ms2ger
46b36242a3 Use Ref::map to make ThreadSafeLayoutNode::style safe. 2015-07-17 14:51:58 +02:00
Ms2ger
3e2c44114c Move the traversal traits into the traversal module. 2015-07-17 11:40:40 +02:00
Patrick Walton
24f10df436 layout: Modify styles for replaced content as appropriate during
incremental flow construction.

Fixes jumpiness on lots of Web sites.
2015-07-07 15:00:52 -07:00
David Winslow
261711d51a Include padding in ascent reported for <img>
fixes #6452
2015-07-06 15:28:13 -04:00
Ms2ger
2ea32829af Replace OpaqueNodeMethods::from_{threadsafe_,}layout_node by opaque methods. 2015-06-24 14:55:43 +02:00
Ms2ger
a42e11a95f Replace the LayoutDataAccess trait by inherent methods. 2015-06-22 11:34:31 +02:00
Ms2ger
dc167ca343 Implement type_id as inherent methods.
This implies LayoutNode no longer needs to return an Option, as it never
represents a pseudo-element.

Also, fixes lies in the documentation.
2015-06-22 10:47:52 +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
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
Corey Farwell
8e3f4bba85 Reduce max line length from 150 to 120 characters
Part of https://github.com/servo/servo/issues/6041
2015-05-24 00:01:49 -04: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
Patrick Walton
72f031e2a1 layout: Support inline incremental reflow, and stop reconstructing all
flows when mousing over the document.

This exposes more "jumpiness" on sites like Hacker News, but the bug
that causes it was pre-existing.
2015-05-19 11:08:27 -07:00
Patrick Walton
a299a2c71c layout: Minor whitespace and formatting cleanups. 2015-05-13 12:00:55 -07:00
Patrick Walton
711993eb46 gfx: Print out stacking context info when dumping display lists. 2015-05-13 12:00:54 -07: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
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
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
Jinwoo Song
f404853c99 Make NodeTypeId include CharacterData variant
NodeTypeId is supposed to reflect the WebIDL inheritance hierarchy.
All of Text/ProcessingInstruction/Comment inherit from CharacterData,
which inherits from Node. There should be a CharacterDataTypeId value
that differentiates between those, instead.
2015-04-29 13:30:21 +09:00
Simon Sapin
544a02a250 Refactor flow construction to make float less of a special case. 2015-04-29 02:47:46 +02:00
Simon Sapin
cc4749373a Add MulticolFlow and use it for multicol elements.
It currently "inherits" from BlockFlow and does not override anything.
2015-04-29 02:29:33 +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
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
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
Ms2ger
a65c80231a Stop using u/i suffixes in layout. 2015-04-02 15:14:09 +02:00
Patrick Walton
4011291bf2 layout: Stop rebuilding all inline-block flows unconditionally, and
bubble intrinsic inline sizes as necessary when doing incremental
reflow.
2015-04-01 10:52:15 -07:00
Ms2ger
da1e3a3f11 Use usize for debug ids. 2015-03-28 22:37:41 +01:00
Manish Goregaokar
3479d3fa7f Replace unsafe_blocks by unsafe_code. 2015-03-21 10:27:32 +01:00
Ms2ger
5f15eb5fbf Upgrade rustc to d3c49d2140fc65e8bb7d7cf25bfe74dda6ce5ecf/rustc-1.0.0-dev. 2015-03-18 13:18:31 -04:00
Glenn Watson
7ca3c8d6e3 Restore part of PR #5125 that was accidentally removed in PR #5160. 2015-03-16 15:02:26 +10:00
Patrick Walton
f9cdd05d58 layout: Implement ordered lists, CSS counters, and quotes per CSS 2.1
§ 12.3-12.5.

Only simple alphabetic and numeric counter styles are supported. (This
is most of them though.)

Although this PR adds a sequential pass to layout, I verified that on
pages that contain a reasonable number of ordered lists (Reddit
`/r/rust`), the time spent in generated content resolution is dwarfed by
the time spent in the parallelizable parts of layout. So I don't expect
this to negatively affect our parallelism expect perhaps in pathological
cases.
2015-03-09 17:13:45 -07:00
Dan Fox
559ff68b31 Get rid of servo_util 2015-03-05 17:42:05 +00:00
Dan Fox
19686acdec Merge in servo/master 2015-03-05 17:34:18 +00:00
Glenn Watson
86baef2cc0 Remove compositor layers when iframes are removed from doc or display:none. 2015-03-04 07:51:46 +10:00
Dan Fox
3441b2c329 layout/layout_data.rs -> layout/data.rs 2015-03-03 19:59:38 +00:00
Dan Fox
3f9032c1a1 Re-alphabetise imports 2015-03-03 18:16:50 +00:00
Dan Fox
dd0df4e9c5 Rename util.rs -> layout_data.rs 2015-03-03 18:12:06 +00:00
Dan Fox
b424de2092 Extract OpaqueNodeMethods to own file 2015-03-03 17:49:10 +00:00
bors-servo
65454e51c8 auto merge of #5086 : glennw/servo/reap-more-stuff, r=jdm
Also introduce a clear() function to layout data which will be used to clear items such as compositor layouts.

Clear the layout data when a node becomes display:none.
2015-03-02 16:45:51 -07:00
Glenn Watson
611fd7a846 Reap layout data whenever a node is removed from the tree.
Also introduce a clear() function to layout data which will be used to clear items such as compositor layouts.

Clear the layout data when a node becomes display:none.
2015-03-03 07:12:51 +10:00
Bryan Bell
ec2fa2558c Remove interior borders during flow construction
Instead of looking at the boundaries of the text run, set the border
width to zero and the border style to none on border sides that are not
the outermost for a node container that is display: inline.
2015-02-27 15:52:12 -08:00
Glenn Watson
a2f1f12c96 Fix setting display:none after a layout where the element was visible.
Prior to incremental layout, the code would remove the existing
construction result. However, with incremental layout the construction result
is cloned rather than removed. This change ensures that the previous
construction result is cleared when an element's display type
changes to none.
2015-02-27 07:44:24 +10:00
Simon Sapin
d5dd1d658e Upgrade to rustc ba2f13ef0 2015-02-04 2015-02-11 14:48:34 -08:00
Simon Sapin
d13d36f57f End the libstyle 'pub use' madness. 2015-01-30 15:08:29 +01:00
Glenn Watson
1f37c6eabe Add layout support and tests for inline iframes. Fixes #1697. 2015-01-29 16:36:20 +10:00
Patrick Walton
d891c677aa layout: Implement floated list items.
This patch also makes Servo not crash when
`generated_containing_block_rect()` is called on a list item (as, for
example, GitHub does), and for good measure I added the fix to other
flows as well.
2015-01-28 19:58:24 -08:00
Patrick Walton
0f8e436745 layout: Implement text-overflow: ellipsis per CSS-UI-3 § 6.2.
Only the one-value syntax is supported for now.
2015-01-28 16:23:31 -08:00
Ms2ger
1b3e368bcd Don't shadow lifetimes in layout. 2015-01-28 14:44:32 +01:00