Commit graph

140 commits

Author SHA1 Message Date
bors-servo
4fac8b6810 Auto merge of #5593 - shinglyu:ismap, r=jdm
This implements issue 4873
2015-04-14 00:10:08 -05: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
James Gilbertson
85dcc2deaf Use iterators for iterating through CSS rules 2015-04-07 22:28:06 -06:00
Thomas Jespersen
0c1eeb2fc7 Only send unused buffers messages if there are actually any buffers
Some debugging reveals that the send_back_unused_buffers() quite often
sends empty vectors back to the paint task. This still incurs an
communication overhead though. Instead check that the there actually are
buffers to send back.
2015-04-07 17:52:42 +02:00
Gilles Leblanc
ba36a108c1 Split out shared networking code into net_traits crate
Fixes #4476
2015-04-03 13:38:10 -04:00
aditya
a3eaacccf6 Move iframe and url fields from Reflow to LayoutTask and LayoutTaskFactory
* Fix #5466
2015-04-02 16:09:48 -04:00
Ms2ger
37b5e78a2c Avoid a cast in LayoutImageResponder. 2015-04-02 14:56:05 +02:00
Ms2ger
232dadc81d Use isize for FragmentIndex. 2015-04-02 14:53:10 +02:00
Patrick Walton
750bbed2cb gfx: Perform more aggressive caching in
`FontContext::get_layout_font_group_for_style()`.

There are several optimizations here:

* We make font families atoms, to allow for quicker comparisons.

* We precalculate an FNV hash of the relevant fields of the font style
  structure.

* When obtaining a platform font group, we first check pointer equality
  for the font style. If there's no match, we go to the FNV hash. Only
  if both caches miss do we construct and cache a font group. Note that
  individual fonts are *also* cached; thus there are two layers of
  caching here.

15% improvement in total layout thread time for Facebook Timeline.
2015-04-01 08:58:16 -07:00
bors-servo
8976bbfe7d auto merge of #5441 : servo/servo/heap-unclassified, r=jdm 2015-03-31 15:03:56 -06:00
Patrick Walton
66dd8c8a6c layout: Implement CSS transitions per CSS-TRANSITIONS § 2.
Transition events are not yet supported, and the only animatable
properties are `top`, `right`, `bottom`, and `left`. However, all other
features of transitions are supported. There are no automated tests at
present because I'm not sure how best to test it, but three manual tests
are included.
2015-03-31 08:46:11 -07:00
Nicholas Nethercote
66902d2c90 Use usize rather than u64 in MemoryReport.
I should have used usize in the first place.
2015-03-31 15:37:15 +02:00
Patrick Walton
16db7bab28 layout: Stop going to the DOM to determine the root flow's background
color.

This allows us to do layout off the main thread, which is necessary for
transitions.
2015-03-30 10:00:32 -07:00
bors-servo
39556cc832 auto merge of #5422 : bdero/servo/bdero/box-syntax, r=jdm
Closes #5417
2015-03-29 17:10:01 -06:00
Brandon DeRosier
ccc55d658f Use box syntax instead of Box::new()
Closes #5417
2015-03-29 13:41:14 -04:00
Ms2ger
9904216d76 Use u32 for generation numbers. 2015-03-28 22:46:16 +01:00
Fabrice Desré
0580ad9a82 Suppress unused import warnings 2015-03-25 22:57:27 -07:00
Nicholas Nethercote
ce36e574f4 Rename lots of profiling-related things.
------------------------------------------------------------------------
BEFORE                              AFTER
------------------------------------------------------------------------
util::memory                        util::mem
- heap_size_of                      - heap_size_of (unchanged)
- SizeOf                            - HeapSizeOf
  - size_of_excluding_self            - heap_size_of_children

prof::mem                           prof::mem
- MemoryProfilerChan                - ProfilerChan
- MemoryReport                      - Report
- MemoryReportsChan                 - ReportsChan
- MemoryReporter                    - Reporter
- MemoryProfilerMsg                 - ProfilerMsg
  - {R,UnR}egisterMemoryReporter      - {R,UnR}egisterReporter
- MemoryProfiler                    - Prof
- ReportsForest                     - ReportsForest (unchanged)
- ReportsTree                       - ReportsTree   (unchanged)
- SystemMemoryReporter              - SystemReporter

prof::time                          prof::time
- TimeProfilerChan                  - ProfilerChan
- TimerMetadata                     - TimerMetadata (unchanged)
- Formatable                        - Formattable [spelling!]
- TimeProfilerMsg                   - ProfilerMsg
- TimeProfilerCategory              - ProfilerCategory
- TimeProfilerBuckets               - ProfilerBuckets
- TimeProfiler                      - Profiler
- TimerMetadataFrameType            - TimerMetadataFrameType (unchanged)
- TimerMetadataReflowType           - TimerMetadataReflowType (unchanged)
- ProfilerMetadata                  - ProfilerMetadata (unchanged)

In a few places both prof::time and prof::mem are used, and so
module-qualification is needed to avoid overlap, e.g. time::Profiler and
mem::Profiler. Likewise with std::mem and prof::mem. This is not a big
deal.
2015-03-25 16:00:23 -07:00
Nicholas Nethercote
52447ccd9b Move profiler code from util into a new crate profile.
- Most of util::memory has been moved into profile::mem, though the
  `SizeOf` trait and related things remain in util::memory. The
  `SystemMemoryReporter` code is now in a submodule
  profile::mem::system_reporter.

- util::time has been moved entirely into profile::time.
2015-03-24 02:09:31 -07:00
Nicholas Nethercote
fe3e93225b Print trees in the memory profiler's output.
Memory reports are much nicer to read when grouped into trees, which requires giving each report a path instead of a name.

Sample output:
```
Begin memory reports
|
|    2.51 MiB -- pages
|       2.51 MiB -- url(file:///home/njn/moz/servo/../servo-static-suite/wikipedia/Guardians%20of%20the%20Galaxy%20(film)%20-%20Wikipedia,%20the%20free%20encyclopedia.html)
|          2.51 MiB -- display-list
|
|  238.89 MiB -- resident-according-to-smaps
|     188.31 MiB -- anonymous (rw-p)
|      27.29 MiB -- /home/njn/moz/servo/components/servo/target/debug/servo (r-xp)
|       7.82 MiB -- other
|       6.65 MiB -- [heap] (rw-p)
|       3.55 MiB -- /usr/lib/x86_64-linux-gnu/dri/i965_dri.so (r-xp)
|       1.42 MiB -- /lib/x86_64-linux-gnu/libc-2.19.so (r-xp)
|       1.13 MiB -- /home/njn/moz/servo/components/servo/target/debug/servo (r--p)
|       0.74 MiB -- /usr/lib/x86_64-linux-gnu/libX11.so.6.3.0 (r-xp)
|       0.73 MiB -- /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.20 (r-xp)
|       0.65 MiB -- /lib/x86_64-linux-gnu/libm-2.19.so (r-xp)
|       0.60 MiB -- /lib/x86_64-linux-gnu/libglib-2.0.so.0.4200.1 (r-xp)
|
|   71.08 MiB -- jemalloc-heap-active
|   59.11 MiB -- jemalloc-heap-allocated
|  180.00 MiB -- jemalloc-heap-mapped
|  232.87 MiB -- resident
|   54.43 MiB -- system-heap-allocated
| 3130.11 MiB -- vsize
|
End memory reports
```
2015-03-23 15:17:04 -07: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
Patrick Walton
d10627a2b3 layout: Implement 2D CSS transforms per CSS-TRANSFORMS § 5, 6, 7, and 8. 2015-03-17 11:30:55 -07:00
Nicholas Nethercote
ece2711185 Add memory reporting infrastructure and use it to measure the display list.
This changeset implements the beginnings of fine-grained measurement of
Servo's data structures.

- It adds a new `SizeOf` trait, which is used to measure the memory used
  by heap data structures, and implements it for some std types: Box,
  String, Option, Arc, Vec, and DList.

- It adds a new `MemoryReporter` trait which is used to report memory
  measurements from other threads to the memory profiler. Reporters are
  registered and unregistered with the memory profiler, and the memory
  profiler makes measurement requests of reporters when necessary.

- It plumbs a MemoryProfilerChan through to the layout task so it can
  register a memory reporter.

- It implements the `SizeOf` trait for `DisplayList` and associated
  types, and adds a memory reporter that uses it.

The display list hits 14.77 MiB when viewing
tests/html/perf-rainbow.html, and 2.51 MiB when viewing the Guardians of
the Galaxy Wikipedia page from servo-static-suite. Example output:

  0.29: display-list::http://www.reddit.com/
  0.00: display-list::http://static.adzerk.net/reddit/ads.html?sr=-reddit.com,loggedout&bust2#http://www.reddit.com
  0.00: display-list::http://www.reddit.com/static/createadframe.html

There are a number of FIXME comments indicating sub-optimal things. This
is a big enough change for now that doing them as follow-ups seems best.
2015-03-16 18:12:26 -07:00
Nicholas Nethercote
5865d5f717 Rename LayoutTask::handle_script_request.
Because it handles requests from tasks other than the Script Task.
2015-03-16 18:05:36 -07:00
Jack Moffitt
237150fa49 Fix memory leak in flow tree by adding weak refs.
Cycles were being created in the flow tree since absolutely positioned
descendants had pointers to their containing blocks. This adds
WeakFlowRef (based on Weak<T>) and makes these backpointers weak
references. This also harmonizes our custom Arc<T>, FlowRef, to be
consistent with the upstream implementation.

Fixes #4915.
2015-03-16 12:53:16 -06:00
Mikko Perttunen
e7a06cd241 Consider media attribute on link and style tags
Don't add a stylesheet if the current device does not match the media
query specified in a link or style tag.
2015-03-16 17:19:26 +02:00
bors-servo
a50807051b auto merge of #5180 : luniv/servo/viewport-length-cached-values-invalidation, r=SimonSapin
When a viewport is resized, the computed values for a style containing viewport percentage length units become stale. However, there's no way for those styles to be invalidated after a resize. As a solution, this commit invalidates the computed values cache after a resize has occurred, which is probably over-kill.

A better solution would probably be to track under what conditions computed values remain valid, and invalidate them as indicated.
2015-03-13 09:36:50 -06: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
James Gilbertson
fafc357308 Fix broken viewport percentage length units after a viewport resize.
When a viewport is resized, the computed values for a style containing viewport percentage length units become stale. However, there's no way for those styles to be invalidated after a resize. As a solution, this commit invalidates the computed values cache after a resize has occurred, which is probably over-kill.

A better solution would probably be to track under what conditions computed values remain valid, and invalidate them as indicated.
2015-03-08 13:06:27 -06: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
564d12435a Move ToGfxColor to display_list_builder.rs 2015-03-03 17:59:44 +00:00
Dan Fox
b424de2092 Extract OpaqueNodeMethods to own file 2015-03-03 17:49:10 +00: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
Adenilson Cavalcanti
b9e9d7471d Implements a DisplayList dumper.
This patch will iterate through the DisplayList after the reflow
is done and print its elements (as also any sub-lists associated
to a child node stacking context).

It adds a new CLI parameter to trigger the function to dump the display list
to console (i.e. servo --debug dump-display-list url).

Using both display list and flow tree information is helpful to debug
rendering issues.
2015-02-25 19:10:05 -08:00
Glenn Watson
7aacf90161 Fixes background-color calculation for iframes. Fixes #1248 2015-02-16 08:16:18 +10:00
Ms2ger
a09a912178 Import net as net rather than servo_net. 2015-02-10 12:55:24 +01:00
Ms2ger
b2fcc2397e Import msg as msg rather than servo_msg. 2015-02-10 11:40:36 +01:00
Ms2ger
7c6b03abfe Opt-in rather than opt-out to unsafe blocks in layout. 2015-02-08 20:03:27 +01:00
Adenilson Cavalcanti
3088b8fc30 Using the new equality operator in LayoutTask. 2015-02-03 18:14:42 -08:00
Adenilson Cavalcanti
ffa23088ff Using the new transparent_black() in the proper places. 2015-02-03 18:08:30 -08:00
Martin Robinson
8855a25780 Revert "Using Color equality operators to streamline code" 2015-02-03 15:07:30 -08:00
Martin Robinson
728f723753 Merge pull request #4825 from Adenilson/usingColorOperators01
Using Color equality operators to streamline code
2015-02-03 11:12:44 -08:00
Adenilson Cavalcanti
cc404aba1a Using Color equality operators to streamline code in
PaintContext and LayoutTask.
2015-02-03 11:03:09 -08:00