Commit graph

116 commits

Author SHA1 Message Date
Per Lundberg
2f7ed1d73e Removed unused imports
This fixes #11185.
2016-05-15 22:24:26 +03:00
Emilio Cobos Álvarez
028f9b6cd2
style: layout: Allow a lazy pseudo-element implementation in Servo. 2016-05-04 00:33:58 +02:00
Emilio Cobos Álvarez
9caaa6004e
style: Support lazy pseudo-elements
These can't be supported in Servo as of right now, because I'm not
totally sure the accesses that should be done in layout would be
thread-safe.

It can be revisited later though.
2016-05-03 19:01:54 +02:00
Emilio Cobos Álvarez
227e39d558
style: Reset the per-pseudo-element maps when update() is called
This was causing panics in stylo.
2016-04-29 22:54:53 +02:00
Emilio Cobos Álvarez
2a499d5a0b
layout: Stop storing PrecomputedStyleData in LayoutNode
Use the SharedStyleContext instead.
2016-04-29 22:54:48 +02:00
Emilio Cobos Álvarez
5a43c7e3cd
style: Allow inheritance when computing anonymous box styles
This is used a lot by Gecko, not still for servo though.
2016-04-29 22:54:46 +02:00
Emilio Cobos Álvarez
3563ecb770
style: Use precomputation for the -servo-details-content pseudo-element 2016-04-29 22:54:45 +02:00
Emilio Cobos Álvarez
b6402a81d0
style: Add infrastructure for non-eagerly-cascaded pseudo-elements
This commit also removes StylistWrapper and uses Arc::get_mut instead.
2016-04-29 22:54:45 +02:00
Simon Sapin
374679852c Make chrome: URLs have a "host". 2016-04-23 20:28:02 +02:00
Corey Farwell
c37ab1facd Make read_resource_file param simpler and more idiomatic.
`<P: AsRef<Path>>` is also what `File::open` uses as a generic type for
the parameter.
2016-04-16 23:06:59 -04:00
Simon Sapin
6889f37d9e Remove the url! plugin.
In rust-url 1.0 the `Url` struct is going to have private fields, and there
is no way to to create an aribitrary one without going through the parser.

The plugin never had a clear demonstrated performance benefit,
it was made mostly because it was possible and relatively easy at the time.
2016-04-14 15:35:28 +02:00
Emilio Cobos Álvarez
41708d753e style: Improve style::selector_matching documentation 2016-04-02 16:43:41 +02:00
Michael Howell
0a82d68f3e Use the new device viewport size for constaints.
Fixes #8443
2016-03-29 09:11:12 -07:00
Emilio Cobos Álvarez
5ed93a5c4a Change old references of ecoal95 2016-03-23 18:12:40 +01:00
bors-servo
41060dbdd7 Auto merge of #10105 - mbrubeck:dirty-viewport-percentages, r=SimonSapin
Don't re-add stylesheets to recompute vw/vh lengths

This is a follow-up to #9876.  It avoids clearing and rebuilding SelectorMaps
when vh and vw units need to be recomputed. Instead it just dirties all nodes,
to force elements to be re-cascaded.

Filed #10104 for later follow-up work to dirty only affected nodes.

r? @SimonSapin

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10105)
<!-- Reviewable:end -->
2016-03-22 18:58:47 +05:30
bors-servo
9a8ba23a76 Auto merge of #10088 - pkondzior:7038-report-memory-usage-in-layout-thread-data-stylist, r=ecoal95
Report memory usage from LayoutThreadData Stylist [#7038]

@jdm PTAL I'm not sure what is the approach of updating cargo components here, I've made a pull request https://github.com/servo/heapsize/pull/54 but it has to be landed first before merge and version bump.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10088)
<!-- Reviewable:end -->
2016-03-22 06:54:11 +05:30
Matt Brubeck
37636e8377 Don't re-add stylesheets to recompute vw/vh lengths
This is a follow-up to #9876.  It avoids clearing and rebuilding SelectorMaps
when vh and vw units need to be recomputed. Instead it just dirties all nodes,
to force elements to be re-cascaded.

Filed #10104 for later follow-up work to dirty only affected nodes.
2016-03-21 10:05:17 -07:00
bors-servo
090da52913 Auto merge of #9586 - notriddle:details_ui, r=SimonSapin
Details ui

Requires a patch to rust-selectors, and doesn't currently recalculate the styles correctly (which is needed to make actual toggling work correctly).

Still trying to figure out what it takes to get style recalc to do what this needs.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9586)
<!-- Reviewable:end -->
2016-03-20 13:27:59 +05:30
Michael Howell
9d9c5398a8 Get the fundamentals of the HTMLDetailsElement rendering stuff working.
Still need to implement the style invalidation.

Part of #9395
2016-03-19 16:02:11 -07:00
Matt Brubeck
25c1bce9f6 Recompute viewport-dependent styles on viewport size change
Fixes #8754.
2016-03-19 13:23:39 -07:00
Pawel Kondzior
db2e10a70f Report memory usage from LayoutThreadData Stylist [#7038] 2016-03-19 11:53:13 -07:00
Bobby Holley
b1878bd925 Remove lifetimes from T{Node,Element,Document}. 2016-03-14 14:31:57 -07:00
Bobby Holley
4da1171474 Stop using servo UA stylesheets for geckolib.
Gecko will provide these. This also removes the need to reference
the servo resource directory.
2016-03-04 11:46:32 -08:00
Emilio Cobos Álvarez
a604d605ed style: Prevent a crash when push_applicable_declarations is called with a non eagerly-cascaded pseudo-element
This actually didn't happen, but this should be done sooner than later.
2016-02-13 16:05:16 +01:00
Emilio Cobos Álvarez
eddec5cc06 style: Use fnv hashing for pseudo-elements 2016-02-13 16:05:14 +01:00
Emilio Cobos Álvarez
dd503dfacb Refactor style to be completely backend-independent
This commit refactors the style crate to be completely independent of
the actual implementation and pseudo-elements supported.

This also adds a gecko backend which introduces parsing for the
anonymous box pseudo-elements[1], although there's still no way of
querying them.

https://mxr.mozilla.org/mozilla-central/source/layout/style/nsCSSAnonBoxList.h
2016-02-13 16:05:14 +01:00
Emilio Cobos Álvarez
a1c830f1c1 Update rust-selectors
This commits updates rust-selectors to use the generic parser, and as
such it moves the element state into the style crate.
2016-02-03 02:11:31 +01:00
Bobby Holley
384cdfcfff Hoist ParseErrorReporter into style and remove the dependency on msg.
The pipeline id stuff is currently unused. If someone needs it, they can add
an additional trait bound on their css error reporter to get the pipeline id.
2016-01-11 18:01:48 -08:00
Johannes Linke
6b215f38ee Fix a bunch of clippy lints 2016-01-02 23:27:15 +01:00
bors-servo
3791447de8 Auto merge of #9090 - Ms2ger:stylesheets-vec, r=SimonSapin
Don't copy the list of stylesheets in LayoutTask::handle_reflow.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9090)
<!-- Reviewable:end -->
2015-12-31 21:50:22 +05:30
Ms2ger
828392b41c Don't copy the list of stylesheets in LayoutTask::handle_reflow.
It would be nice to avoid exposing the fact that these are stored in an Arc
to the selector matching code.
2015-12-30 15:13:08 +01:00
Ms2ger
2fa45aa064 Deny unsafe code in style. 2015-12-30 14:46:35 +01:00
Bobby Holley
47059d2d26 Separate style+layout and layout-specific wrapper functionality.
This patch does a number of things, unfortunately all at once:
* Hoists a large subset of the layout wrapper functionality into the style system.
* Merges TElementAttributes into the newly-created TElement.
* Reorganizes LayoutData by style vs layout, and removes LayoutDataShared.
* Simplifies the API for borrowing style/layout data.

There's still more to do to make the style system usable standalone, but
this is a good start.
2015-12-29 11:50:03 -08:00
GauriGNaik
fc81276c8e Add pipeline information to CSS error reporting. 2015-12-14 11:18:30 -05:00
GauriGNaik
996e9e06b2 Defined new trait ParseErrorReporter and added error_reporter member to ParserContext 2015-11-25 18:28:30 -05:00
Corey Farwell
f34da4120d Implement 'url!(..)' macro
https://github.com/servo/rust-url/issues/136

https://github.com/servo/rust-url/pull/137
2015-11-21 08:15:56 -05:00
Ms2ger
1154cf51c8 Inline PresentationalHintSynthesis::synthesize_presentational_hints_for_legacy_attributes. 2015-11-15 13:46:55 +01:00
Bobby Holley
7fa7936657 Implement attribute restyle hints.
Fixes #6942.
2015-11-10 11:57:24 -08:00
bors-servo
7ff3a17524 Auto merge of #8039 - tschneidereit:script-owns-stylesheets, r=jdm
Move Stylesheet loading and ownership from the layout task into HTML elements

Stylesheets for `HTMLLinkElement`s are now loaded by the resource task, triggered by the element in question. Stylesheets are owned by the elements they're associated with, which can be `HTMLStyleElement`, `HTMLLinkElement`, and `HTMLMetaElement` (for `<meta name="viewport">).

Additionally, the quirks mode stylesheet (just as the user and user agent stylesheets a couple of commits ago), is implemented as a lazy static, loaded once per process and shared between all documents.

This all has various nice consequences:
 - Stylesheet loading becomes a non-blocking operation.
 - Stylesheets are removed when the element they're associated with is removed from the document.
 - It'll be possible to implement the CSSOM APIs that require direct access to the stylesheets (i.e., ~ all of them).
 - Various subtle correctness issues are fixed.

One piece of interesting follow-up work would be to move parsing of external stylesheets to the resource task, too. Right now, it happens in the link element once loading is complete, so blocks the script task. Moving it to the resource task would probably be fairly straight-forward as it doesn't require access to any external state.

Depends on #7979 because without that loading stylesheets asynchronously breaks lots of content.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8039)
<!-- Reviewable:end -->
2015-11-08 01:11:54 +05:30
Till Schneidereit
543703e3d8 Move Stylesheet loading and ownership from the layout task into HTML elements
Stylesheets for `HTMLLinkElement`s are now loaded by the resource task, triggered by the element in question. Stylesheets are owned by the elements they're associated with, which can be `HTMLStyleElement`, `HTMLLinkElement`, and `HTMLMetaElement` (for `<meta name="viewport">).

Additionally, the quirks mode stylesheet (just as the user and user agent stylesheets a couple of commits ago), is implemented as a lazy static, loaded once per process and shared between all documents.

This all has various nice consequences:
 - Stylesheet loading becomes a non-blocking operation.
 - Stylesheets are removed when the element they're associated with is removed from the document.
 - It'll be possible to implement the CSSOM APIs that require direct access to the stylesheets (i.e., ~ all of them).
 - Various subtle correctness issues are fixed.

One piece of interesting follow-up work would be to move parsing of external stylesheets to the resource task, too. Right now, it happens in the link element once loading is complete, so blocks the script task. Moving it to the resource task would probably be fairly straight-forward as it doesn't require access to any external state.
2015-11-07 18:11:29 +01:00
Till Schneidereit
f1b6c7cc99 Let Stylist compute and store viewport constraints when setting the device 2015-11-07 16:19:13 +01:00
Till Schneidereit
f173504ded Make UA and user stylesheets static and shared by all Stylist instances 2015-11-07 15:45:27 +01:00
Bobby Holley
7dba4447f1 Store pristine element state rather than a set of changes.
This is the strategy we'll need to take for attributes, and so this change
puts us in a position to handle attributes and state the same way.

This does mean that we stop taking care to track the situations where our
state has reverted to the original state, with no net change. I think that's
probably of negligible value though.
2015-11-04 19:09:58 -08:00
Bobby Holley
45fc7f2930 Implement restyle hints for state changes. 2015-10-31 14:28:52 -07:00
Ravi Shankar
889eec364b sorted the extern crate, mod & use declarations 2015-09-24 02:12:45 +05:30
Brandon Fairchild
de3547e401 Fix reported test-tidy errors for unmerged import blocks
This merges import blocks that were reported by tidy as unmerged.
2015-09-19 12:50:14 -04:00
João Oliveira
4a305d1e62 Add style_traits crate to improve crate separation,
closes #7353
2015-09-04 12:59:37 +01:00
Johann Tuffe
ec07178b6f sort all uses 2015-08-20 20:47:12 +08:00
Josh Matthews
8bb853f643 Fix existing syntactics nits. 2015-08-16 10:30:43 -04:00
João Oliveira
0038580abf Replace uses of for foo in bar.iter() and for foo in bar.iter_mut()
closes #7197
2015-08-15 02:27:39 +01:00