Commit graph

198 commits

Author SHA1 Message Date
Alan Jeffrey
607e011b05 Renamed constellation::Frame to constellation::BrowsingContext. 2017-05-15 21:03:11 -05:00
Josh Matthews
9134918844 Send information to script as part of finishing layout.
This avoids the need for multiple layout RPC operations immediately
following return of control to script. This means that layout and
script can continue to operate in parallel at this point, rather
than one potentially waiting on the shared mutex to be unlocked.
2017-05-15 14:12:08 -04:00
Josh Matthews
c3b9714ab7 Accumulate transitioning nodes inside the layout context. 2017-05-15 14:11:40 -04:00
Josh Matthews
dabebdfbf5 Root nodes for the duration of their CSS transitions.
This ensures that we can pass a node address as part of the asynchronous
transition end notification, making it safe to fire the corresponding
DOM event on the node from the script thread. Without explicitly rooting
this node when the transition starts, we risk the node being GCed before
the transition is complete.
2017-05-15 14:07:41 -04:00
Nazım Can Altınova
c54d255d07
stylo: Propagate quirks mode information from Gecko to Servo 2017-05-14 01:51:50 +03:00
Emilio Cobos Álvarez
677daaabc5
style: Parameterize the update and rebuild methods to take an iterator.
In preparation to avoid cloning the stylesheets while rebuilding in Gecko.
2017-05-12 14:50:59 +02:00
Emilio Cobos Álvarez
50e0c67e2c
style: Stop refcounting the stylist. 2017-05-11 21:05:42 +02:00
Emilio Cobos Álvarez
ebd9bf8181
style: Slim down SharedStyleContext.
This slims down SharedStyleContext, in preparation for a few things.

First, I would like to eventually move the stylist to the document in Servo, in
order for it to hold the StyleSheetSet.

Also, this gets rid of a fair amount of overhead while creating it in stylo.

Fixes bug 1363245.
2017-05-11 21:05:41 +02:00
Emilio Cobos Álvarez
46bf5d61f0
Bug 1355343: Take all the snapshots into account. r=bholley
I've chosen this approach mainly because there's no other good way to guarantee
the model is correct than holding the snapshots alive until a style refresh.

What I tried before this (storing them in a sort of "immutable element data") is
a pain, since we call into style from the frame constructor and other content
notifications, which makes keeping track of which snapshots should be cleared an
which shouldn't an insane task.

Ideally we'd have a single entry-point for style, but that's not the case right
now, and changing that requires pretty non-trivial changes to the frame
constructor.

MozReview-Commit-ID: FF1KWZv2iBM
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-05-10 12:05:39 +02:00
Nathan Froyd
681b578326 bump required rayon version to 0.7
...and bring jpeg-decoder along for the ride.  Minor tweaks were
necessary because of rayon API changes.
2017-05-05 10:36:01 -04:00
Bobby Holley
7b0679848b Fix up script and layout. 2017-05-02 17:35:45 -07:00
Anthony Ramine
f68e2fded9 Propagate quirks mode all the way to ParserContext
The quirks mode is still not properly propagated in geckolib.
2017-04-27 10:41:55 +02:00
Anthony Ramine
f872fdac9a Make Stylist::quirks_mode hold a QuirksMode 2017-04-26 17:30:28 +02:00
Simon Sapin
512944c32c Don’t report CSS parsing errors from user-agent stylesheets.
This used to make `RUST_LOG=style` basically useless.
2017-04-24 08:27:26 +02:00
Simon Sapin
7fe57ecaea Rename StdoutErrorReporter to RustLogReporter. 2017-04-24 08:23:41 +02:00
bors-servo
541db5f9a7 Auto merge of #16458 - stshine:sequential-fallback, r=pcwalton,emilio
layout: Force reflow in the sequential fallback of block format context

When reflowing a block format context during the inorder traversal,
propagate restyle damage manually to its children since they were
already reflowed. Also, test the border box to see if it can fit into
floats according to CSS 2.1 § 9.5.

Improves reddit and yahoo.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #__ (github issue number if applicable).

<!-- Either: -->
- [X] There are tests for these changes OR
- [ ] These changes do not require tests because _____

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/16458)
<!-- Reviewable:end -->
2017-04-22 23:55:22 -05:00
Pu Xingyu
68f74d5cbe Force reflow in the sequential fallback of block format context
When reflowing a block format context during the inorder traversal,
propagate restyle damage manually to its children since they were
already reflowed.
2017-04-23 08:32:25 +08:00
Martin Robinson
d150cc9f95 Eliminate ScrollRootId
Just use WebRender's ClipId directly. This will allow us to create and
use ReferenceFrames in the future, if we need to do that. It will also
make it easier to have Servo responsible for creating the root
scrolling area, which will allow removing some old hacks in the future.
2017-04-20 08:51:38 +02:00
Emilio Cobos Álvarez
4651b94ff0
style: Simplify author_style_disabled handling. 2017-04-19 09:41:37 +02:00
Martin Robinson
4451b8a771 Used shared clips for overflow:hidden and CSS clip
Instead of passing down a complex clipping region to each item, used
shared clipping to handle overflow:hidden and CSS clips. In addition to
being more efficient, this should also fix quite a few issues related
to absolutely positioned elements.

One existing reftest is slightly modified to avoid tickling a quirk
with the way that WebRender rasterizes masks. We are working out how to
best express these combined masks with the API or need to. The change
does not affect the original subject of the reftest.

Fixes #13109.
Fixes #10151.
Fixes #7575.
Fixes #8074.
Fixes #8780.
2017-04-17 17:06:43 +02:00
Brad Werth
91a9fb06c7 Add an author_style_disabled flag to stylist.update, and associated structs.
MozReview-Commit-ID: FiXyEN4xVnU
2017-04-14 09:24:20 +08:00
Emilio Cobos Álvarez
ac7bc414d9
Bug 1325878: Pass the MediaList down to Servo, making <style media> work. r=xidorn
MozReview-Commit-ID: BUCSQJs2CNI
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-04-12 22:27:45 +08:00
Bobby Holley
dc5dbd5542 Store style system options in the global style data and shared style context.
I wanted to add an environmental variable to disable the style sharing
cache for gecko, but the current pattern involves lazy_static!, which
involves an atomic operation on lookup, which is a bit hot to do each
time we try to share styles. This makes that work happen once per
process.
2017-04-12 14:34:42 +08:00
bors-servo
fd2b092839 Auto merge of #16312 - bholley:breadth_first_sequential, r=emilio
Make the sequential traversal breadth-first

Reviewed in https://bugzilla.mozilla.org/show_bug.cgi?id=1354806

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/16312)
<!-- Reviewable:end -->
2017-04-09 01:55:09 -05:00
Bobby Holley
3f52052cf9 Do the sequential traversal breadth-first.
While we're at it, we also eliminate the 'unknown' dom depth for the
bloom filter. Computing depth has negligible cost relative to the
amount of work we do setting up the bloom filter at a given depth.
Doing it once per traversal should be totally fine.

I originally separated the elimination of unknown dom depth from the
traversal changes, but I got bloom filter crashes on the intermediate
patch, presumably because I didn't properly fix the sequential traversal
for this case. Given that the final state is green, I just decided to
squash and move on.
2017-04-09 14:52:49 +08:00
Cameron McCormack
2bbeb21551 style: Move TraversalFlags into SharedStyleContext. 2017-04-08 23:07:35 +08:00
Glenn Watson
aea7d46b91 Update WR (gradient features). 2017-04-05 05:40:29 +10:00
Xidorn Quan
37585309e9 Use a UrlExtraData type alias to unify url handling logic. 2017-04-03 21:57:16 +10:00
Simon Sapin
61812d4d9d Make the parser accept @font-face rules without font-family or src.
Fix #16165.

Also, it turns out that the CSSFontFaceRule IDL specified in the
css-fonts spec is not web-compatible.
Instead browsers implement a .style attribute like in CSSStyleRule:
https://github.com/w3c/csswg-drafts/issues/825

This in turn requires preserving data about which descriptors
were set or not (distinguishing unset from set to a value that happens
to be the initial value),
so this commit also makes every field `Option<_>`.
2017-04-01 14:05:32 +02:00
Xidorn Quan
01e986f2e6 Record effective @font-face rules when updating stylist. 2017-03-30 11:41:12 +11:00
Fernando Jiménez Moreno
72d7ee613b Make image cache per-document rather than global 2017-03-27 19:54:13 +02:00
Hiroyuki Ikezoe
be332fe5a4 Add flag that represents the traversal is only for animation-only restyle.
We will set the flag when the root node of the traversal has
has-animation-only-dirty-descendants flag or has animation restyle hints.
Also we will use this flag to detect whether we need to trigger CSS transitions
or not.
2017-03-27 06:19:51 +09:00
Hiroyuki Ikezoe
499d1c4117 Introduce TraversalFlags to represents target elements of the traversal we are about to do. 2017-03-27 06:19:51 +09:00
Simon Sapin
643545b87f Per-document shared lock for author-origin stylesheets.
Fix #16027
2017-03-19 23:12:15 +01:00
Simon Sapin
02dc8b286a No-op refactor: root_flow param for perform_post_style_recalc_layout_passes
This whole method was a large `if let` block:

```rust
if let Some(mut root_flow) = self.root_flow.clone() {
   // ...
}
```

Move that `if let` to callers to make it clear that the method
doesn’t need to be called when `self.root_flow` is `None`.

By itself, this commit doesn’t change anything.
But it enables the next one.
2017-03-19 23:12:14 +01:00
Simon Sapin
d5074136e3 Rename ReadGuards to StylesheetGuards 2017-03-19 22:30:42 +01:00
Simon Sapin
aeffca2a59 Replace RwLock<StyleRule> with Locked<StyleRule> 2017-03-19 22:30:37 +01:00
Simon Sapin
3ae2ecbec2 More lock acquire in callers 2017-03-19 22:30:32 +01:00
Simon Sapin
d18b1280f2 Move shared lock acquires up the call stack. (Or is it down?) 2017-03-19 22:30:32 +01:00
Simon Sapin
c5a7294e05 Replace RwLock<MediaList> with shared_lock::Locked<MediaList> 2017-03-19 22:30:31 +01:00
Simon Sapin
a8ab65b869 Remove never-sent ReflowWithNewlyLoadedWebFont message, fix #16026 2017-03-19 09:07:54 +01:00
Emilio Cobos Álvarez
b4de69e3eb
style: Avoid cloning all over the error reporter. 2017-03-14 00:49:18 +01:00
Emilio Cobos Álvarez
eaf27ccfa0
style: Kill SharedStyleContext::default_computed_values.
Now that cascade() gets a Device, we can use the default computed values from
there to avoid propagating that state all over the place.

Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-03-14 00:49:16 +01:00
Emilio Cobos Álvarez
95ccfa748e
Bug 1303229: Get the proper viewport size for stylo. r=heycam
At least until we support scrollbars properly, this size is going to be the
correct one. I've left a TODO to grab the proper one once we support it.

This allows to trivially test viewport units for now.

MozReview-Commit-ID: JdaZ6WlZ2C6
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-03-11 11:54:12 +01:00
Patrick Walton
198662f8cb layout: Replace ConstructionResult::swap_out() with get()
It only actually swaps out in nonincremental mode (which isn't suitable
for real world use), so the name is confusing.
2017-03-03 23:25:02 +01:00
Emilio Cobos Álvarez
8832b5ab0a
layout_thread: Also reposition elements when reflowing all nodes.
Fixes #15801
2017-03-03 03:46:13 +01:00
Emilio Cobos Álvarez
072f93e41e
layout_thread: Simplify needs_dirtying setup. 2017-03-03 03:46:12 +01:00
Emilio Cobos Álvarez
71997e6ed9
style: Remove unused goal field from SharedStyleContext. 2017-03-03 03:46:10 +01:00
Emilio Cobos Álvarez
b4daadf7f2
style: Remove unused screen_size_changed layout context field. 2017-03-03 01:01:44 +01:00
Fernando Jiménez Moreno
7426d902a3 Trigger reflow on document.elementsFromPoint 2017-03-02 10:44:38 +01:00