Commit graph

5529 commits

Author SHA1 Message Date
Corey Farwell
011ff28aee Merge explicit node iterator structures into single generic structure. 2017-06-25 00:29:08 -04:00
bors-servo
1d045e5c3b Auto merge of #17503 - frewsxcv:frewsxcv-return-node-list-2, r=mbrubeck
Replace iterator struct with anonymous return iterator types.

Similar to https://github.com/servo/servo/pull/17488.

<!-- 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/17503)
<!-- Reviewable:end -->
2017-06-23 19:01:33 -07:00
Corey Farwell
0cabc5c7fd Replace iterator struct with anonymous return iterator types.
Similar to https://github.com/servo/servo/pull/17488.
2017-06-23 18:51:46 -04:00
bors-servo
e2a26e7bd0 Auto merge of #17491 - KiChjang:update-fetch, r=jdm
Introduce service-worker mode

Bringing in the spec changes from whatwg/fetch#435.

<!-- 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/17491)
<!-- Reviewable:end -->
2017-06-23 14:56:00 -07:00
bors-servo
bc5e8f89ff Auto merge of #17488 - frewsxcv:frewsxcv-return-node-list, r=jdm
Replace iterator struct with anonymous return iterator type.

```
hi servo. it's been
some time. here's a pull request.
i hope you like it.
```

<!-- 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/17488)
<!-- Reviewable:end -->
2017-06-23 12:38:02 -07:00
bors-servo
7e493529f0 Auto merge of #17259 - jyc:new-CSSStyleSheet, r=emilio
Force HTMLStyleElement to create a new CSSStyleSheet when re-parsing.

- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors

- [X] These changes do not require tests because I'm pushing to find out what test results this changes; this is part of a series of PRs to fix bug #17182

<!-- 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/17259)
<!-- Reviewable:end -->
2017-06-23 11:37:23 -07:00
bors-servo
626c029623 Auto merge of #17385 - pyfisch:better-scroll, r=mrobinson
Fix several bugs related to scrolling

* scrollLeft/scrollTop returned values of parent or even document root
   Only the scroll of the node itself is returned. Otherwise 0.0.
* Scrolling via script had set viewport.
   This resulted in other nodes appearing scrolled.
   Now scroll_offsets are updated with correct node id.

These bugs caused other odd behavior like both body and
document.documentElement being scrolled or the view for scrolled
elements jumping.

Also try scrolling this [example page](https://pyfisch.org/stuff/scrolltest.html) in servo with and without this change.

<!-- Please describe your changes on the following line: -->

---
<!-- 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 #17342 (github issue number if applicable).

<!-- Either: -->
- [x] There are tests for these changes (partially)

<!-- 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/17385)
<!-- Reviewable:end -->
2017-06-23 01:50:39 -07:00
Keith Yeung
6adc653083 Introduce service-worker mode 2017-06-22 23:48:07 -07:00
bors-servo
dd7540a5d4 Auto merge of #17472 - moonlightdrive:globalscope-current-option, r=asajeffrey
return Option from GlobalScope::current

<!-- Please describe your changes on the following line: -->
handles the case where `GlobalScope::current` calls `CurrentGlobalOrNull` and the result is null

---
<!-- 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 #17238

<!-- Either: -->
- [ ] There are tests for these changes OR
- [X] These changes do not require tests because: no functionality change & ./mach build -d has no errors

<!-- 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/17472)
<!-- Reviewable:end -->
2017-06-22 22:01:43 -07:00
Corey Farwell
917fe9241a Replace iterator struct with anonymous return iterator type. 2017-06-22 23:49:38 -04:00
Jonathan Chan
80dee7a65f Force HTMLStyleElement to create a new CSSStyleSheet when re-parsing.
We already call Document::invalidate_style_sheets and set
the stylesheet member to a new Stylesheet. This matches the behavior of
Firefox, and means the new CSSStyleSheet you get from accessing .sheet
from JS will be correct instead of stale.

(::get_cssom_stylesheet already tries to use the new Stylesheet, but
MutNullableJS::or_init is called, so if we already created a
CSSStyleSheet we will continue to return that one).
2017-06-22 15:51:59 -07:00
Jyotsna Prakash
433cd90bc3 return Option from GlobalScope::current
handles the case where GlobalScope::current calls CurrentGlobalOrNull
and the result is null
2017-06-22 10:04:06 -07:00
bors-servo
0fce761bb3 Auto merge of #17457 - cynicaldevil:trim-parse-node-data, r=nox
Remove target and data fields from parse_node_data

<!-- Please describe your changes on the following line: -->
`parse_node_data` does not need to store `data` and `target`, they can automatically be passed as parameters to the parser operation (`ParseOperation::CreatePI`) that we already create to be processed.

Also, this frees up `process_op` from depending on the sink's `parse_node_data` field, which will later allow for the sink to exist on the parser thread separately.

---
<!-- 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
- [ ] These changes fix #__ (github issue number if applicable).

<!-- Either: -->
- [ ] 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/17457)
<!-- Reviewable:end -->
2017-06-22 09:09:07 -07:00
Nikhil Shagrithaya
48e04d8d8f Remove target and data fields from parse_node_data 2017-06-22 00:40:21 +05:30
bors-servo
b211664e87 Auto merge of #17439 - bholley:compound_left_to_right, r=SimonSapin
Match compound selectors left-to-right (second try)

https://bugzilla.mozilla.org/show_bug.cgi?id=1373800

<!-- 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/17439)
<!-- Reviewable:end -->
2017-06-21 09:28:43 -07:00
bors-servo
819a40bfb0 Auto merge of #17398 - glennw:opt-composite, r=jdm
Improve decisions in compositor over when to draw a frame.

This patch fixes a couple of issues in the compositor:

1) Remove the delayed composition code. Previously, this would schedule
   a composite for 12ms in the future. This doesn't really make any sense
   with WR. There's no point in doing a composite unless WR has provided
   a new frame to be drawn. This fixes issues in several benchmarks where
   we were doing multiple composite / renders per rAF, which is a waste
   of CPU time. This *does* make the framerate slower in some cases (such
   as a slow rAF callback) but it's more correct - otherwise we were just
   compositing the same frame multiple times for no real benefit.

2) Inform the window of the current animation state of the compositor.
   Specifically, if an animation (or rAF) is currently active, the
   window system switches to use event polling, and does not block on
   the OS-level event loop. In the case of active animation, we just
   assume that we want to be running as the vsync interval and not
   blocking. This means the compositor thread only sleeps on vsync
   during animation, which reduces OS scheduling and results in much
   smoother animation.

<!-- 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/17398)
<!-- Reviewable:end -->
2017-06-21 07:47:53 -07:00
Glenn Watson
cbeb181c61 Fix rAF callbacks when in spurious mode.
This fixes another rAF bug, that is being exposed by the previous
two commits. Previously, the fake timer callback would only be
set if we were being called from a non-rAF event handler.

Now, if we're in fake / spurious mode, unconditionally set the one
shot timer.

Otherwise, notify the compositor that animations are present if
we're not currently in a rAF callback.
2017-06-21 11:02:23 +10:00
Bobby Holley
db8f59407f Hoist sink into selectors.
It probably makes more sense (eventually) to put it in SmallVec.

MozReview-Commit-ID: AIBKCLiMNN2
2017-06-20 11:59:10 -07:00
Connor Brewster
2ccf729aa3 Fix crash when id attribute is set via SetAttributeNode 2017-06-20 10:34:33 -06:00
Glenn Watson
6c9e305442 Ensure that rAF callbacks which don't mutate the DOM, but aren't
yet considered spurious force a reflow / composite / animation tick cycle.
2017-06-20 12:42:14 +10:00
Pyfisch
284cb8aae8 Fix several bugs related to scrolling
* scrollLeft/scrollTop returned values of parent or even document root
   Only the scroll of the node itself is returned. Otherwise 0.0.
* Scrolling via script had set viewport.
   This resulted in other nodes appearing scrolled.
   Now scroll_offsets are updated with correct node id.

These bugs caused other odd behavior like both body and
document.documentElement being scrolled or the view for scrolled
elements jumping.
2017-06-19 21:43:35 +02:00
Simon Sapin
7af5a7fd54 Untry script 2017-06-18 13:21:49 +02:00
bors-servo
9c2dffdf72 Auto merge of #17037 - cynicaldevil:impl-Sink, r=nox
Added Async HTML Tokenizer

Design: I realized having two different parsers for sync and async was wrong, because the API for both was fundamentally the same. All I needed to do was create another Tokenizer, because `ParseNode` ( representation for nodes which are yet to be created) is used by the TreeBuilder and the Sink, and the `Tokenizer` is the 'lowermost' type concerned with these two types.

Therefore, I created one and placed it in `async_html.rs`, and also created a new Sink which deals with `ParseNode`s. I changed the methods in ServoParser to take an `async` argument too, which decides which Tokenizer will be used. The Tokenizer isn't exactly *async* for now, but this PR separates action creation from execution, which allows the async behaviour to be implemented later. Right now, all actions are executed soon after they are created.

The Sink consists of two Hashmaps, `nodes`, which contains the actual nodes, with the key being their corresponding `ParseNode`'s id, and `parse_node_data`, which contains metadata about the nodes.

It's still a bit rough, (I can't figure out how to deal with `complete_script` and `is_mathml_annotation_xml_integration_point`, along with some other parts I wrote in a hurry), but I believe the overall design is sound. I'd like to hear what you think about it.

<!-- 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/17037)
<!-- Reviewable:end -->
2017-06-17 02:21:19 -07:00
Nikhil Shagrithaya
ad649bb7e3 Added preference to enable/disable async html tokenizer 2017-06-17 13:35:55 +05:30
Nikhil Shagrithaya
161ff15d54 Added Async HTML Tokenizer 2017-06-17 13:10:10 +05:30
bors-servo
d388dc94fc Auto merge of #17360 - servo:stderr, r=emilio
Hold stderr lock when using stdout through Console APIs.

This addresses a longstanding source of intermittent test failures where the stderr and stdout outputs get interleaved and the test harness becomes confused.

---
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #12797
- [X] There are tests for these changes

<!-- 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/17360)
<!-- Reviewable:end -->
2017-06-16 17:37:26 -07:00
Josh Matthews
b29d0c6c31 Hold stderr lock when using stdout through Console APIs. 2017-06-16 17:55:25 -04:00
Simon Sapin
b83afdedc8 Upgrade cssparser to 0.15 2017-06-16 15:05:46 +02:00
Bastien Orivel
76d8573393 Bump serde to 1.0 2017-06-16 13:31:18 +02:00
bors-servo
e1bce24129 Auto merge of #17352 - glennw:update-wr-faster-text, r=emilio
Update WR (CPU text optimizations, image format renames).

<!-- 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/17352)
<!-- Reviewable:end -->
2017-06-16 01:21:05 -07:00
Glenn Watson
e7b1e041c8 Update WR (CPU text optimizations, image format renames). 2017-06-16 15:27:22 +10:00
bors-servo
c58bcc23ea Auto merge of #17224 - cbrewster:html_constructor, r=jdm
WebIDL HTMLConstructor support

<!-- Please describe your changes on the following line: -->
spec: https://html.spec.whatwg.org/multipage/#htmlconstructor

---
<!-- 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 #17194 (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/17224)
<!-- Reviewable:end -->
2017-06-15 21:47:16 -07:00
Connor Brewster
e4ff934e82 Remove applet from list extendable interfaces 2017-06-15 21:33:32 -06:00
Connor Brewster
1f3fd77d8f Implement step 5 of HTMLConstructor 2017-06-15 21:33:28 -06:00
Connor Brewster
2333b39569 Implement HTMLConstructor 2017-06-15 21:32:22 -06:00
Connor Brewster
d883f55d0c Add function to get constructor objects by name 2017-06-15 21:23:12 -06:00
Connor Brewster
d951dee640 Add HTMLConstructor attributes where needed 2017-06-15 21:16:57 -06:00
Ellen Marie Dash
f2631c2010 Terminate current load blocker before reassignment
Fixes #17319.
2017-06-15 17:06:12 -04:00
Nicolas Silva
8617320500 Bump euclid to 0.14. 2017-06-14 16:00:59 +02:00
Hiroyuki Ikezoe
8bfed4cb3c Move ParsingMode into style_traits. 2017-06-14 09:51:36 +09:00
Connor Brewster
0713257add Generate GetConstructorObject for all interfaces 2017-06-13 15:24:03 -06:00
Emilio Cobos Álvarez
cb06375fe2
style: Implement a more fine-grained invalidation method.
This commit also removes the old restyle_hints module and splits it into
multiple modules under components/style/invalidation/element/.

The basic approach is to walk down the tree using compound selectors as needed,
in order to do as little selector-matching as possible.

Bug: 1368240
MozReview-Commit-ID: 2YO8fKFygZI
2017-06-13 13:26:41 +02:00
Emilio Cobos Álvarez
262f6adc30
Record whether an snapshot is recording a class attribute change or id change.
I'll use this information in order to get fewer dependencies out of the
dependency set.

Bug: 1368240
MozReview-Commit-ID: 5HlmKmSNO8p
2017-06-13 10:57:43 +02:00
Xidorn Quan
cdc537f23e Bug 1331291 part 1 - Set stylesheet url_data correctly for import rule. 2017-06-13 10:07:06 +10:00
Simon Sapin
c5c1c1b350 Classes/IDs case-sensitivity: get quirks mode from matching context. 2017-06-13 00:27:41 +02:00
Simon Sapin
5bccf98aa4 ID and class selectors are ASCII case-insensitive in quirks mode.
https://bugzilla.mozilla.org/show_bug.cgi?id=1363778
2017-06-12 23:33:53 +02:00
Bobby Holley
a98fff1af8 Hoist ApplicableDeclaration{Block,List} into a separate file.
MozReview-Commit-ID: EXnAzfyoZ1e
2017-06-12 12:13:21 -07:00
bors-servo
0c929ad3fd Auto merge of #17254 - servo:webidl, r=jdm
Update the WebIDL parser

<!-- 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/17254)
<!-- Reviewable:end -->
2017-06-12 07:37:49 -07:00
Nazım Can Altınova
15fe48f3f6
stylo: Support :hover and :active quirk 2017-06-10 22:18:32 +03:00
Josh Matthews
27ae1ef2e7 Thread ParseError return values through CSS parsing. 2017-06-09 16:46:25 -04:00