Commit graph

732 commits

Author SHA1 Message Date
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
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
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
Nicolas Silva
8617320500 Bump euclid to 0.14. 2017-06-14 16:00:59 +02: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
Nazım Can Altınova
15fe48f3f6
stylo: Support :hover and :active quirk 2017-06-10 22:18:32 +03:00
Alan Jeffrey
2fd925bac9 Removed root browsing context from constellation. 2017-06-07 22:53:50 -05:00
bors-servo
e8f9ab51ca Auto merge of #16979 - manfredbrandl:patch-1, r=emilio
remove unused style::restyle_hints::RestyleReplacements

<!-- Please describe your changes on the following line: -->
remove unused style::restyle_hints::RestyleReplacements from line 134

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

<!-- Either: -->
- [X] These changes do not require tests because removes only unused "use"

<!-- 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/16979)
<!-- Reviewable:end -->
2017-05-23 00:31:15 -05:00
Alan Jeffrey
42577365b7 Added a TopLevelBrowsingContextId type. 2017-05-22 09:27:07 -05:00
Manfred Brandl
cb846e0b86 remove unused style::restyle_hints::RestyleReplacements
solve #16978
2017-05-21 12:25:25 +02:00
Cameron McCormack
a397590838
style: Refactor RestyleHint to be a struct.
Later PRs will add additional data to it that is not so easy to
represent using bitflags.
2017-05-20 16:28:09 +02:00
bors-servo
8375319928 Auto merge of #16876 - asajeffrey:constellation-rename-frames, r=cbrewster
Renamed constellation::Frame to constellation::BrowsingContext

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

Now that script has `WindowProxy` rather than `BrowsingContext` objects, we can rename `Frame` in the constellation to `BrowsingContext`. In particular, this means that `FrameId`s are now `BrowsingContextid`s, which better captures their purpose (and they are used in a lot of places, not just the constellation).

---
<!-- 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 do not require tests because renaming

<!-- 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/16876)
<!-- Reviewable:end -->
2017-05-16 23:10:45 -05:00
Martin Robinson
9fd2df5c09 Properly handle scroll offsets in hit testing
Scroll roots are no longer nested containers holding items, so instead
we need to track the offsets of each, carefully handling fixed position
items and stacking contexts that create new reference frames.
Additionally, we remove the complexity of the pre-computed page scroll
offset, instead opting to send script scrolls to the layout task in
order to more quickly have a ScrollState there that matches the
script's idea of the scroll world.

Fixes #16405.
2017-05-16 15:27:09 +02:00
Alan Jeffrey
607e011b05 Renamed constellation::Frame to constellation::BrowsingContext. 2017-05-15 21:03:11 -05:00
Josh Matthews
b0bf2b4bad Make methods storing layout-originating nodes unsafe. 2017-05-15 14:12:08 -04:00
Alan Jeffrey
43ca260689 Renamed BrowsingContext to WindowProxy in script. 2017-05-12 15:02:35 -05:00
bors-servo
8b41c7c137 Auto merge of #16689 - servo:m5e, r=nox
Upgrade to html5ever 0.16

<!-- 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/16689)
<!-- Reviewable:end -->
2017-05-03 08:42:41 -05:00
Bobby Holley
7b0679848b Fix up script and layout. 2017-05-02 17:35:45 -07:00
Simon Sapin
6c518c89b9 Upgrade to html5ever 0.16 2017-05-02 19:24:28 +02:00
Anthony Ramine
f872fdac9a Make Stylist::quirks_mode hold a QuirksMode 2017-04-26 17:30:28 +02:00
Emilio Cobos Álvarez
69fd9a3e9b
script: Ensure we don't suppress reflows when stylesheets are dirty. 2017-04-26 15:32:56 +02:00
bors-servo
6e05a903af Auto merge of #16531 - mrobinson:clip-id, r=glennw
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.

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

<!-- Either: -->
- [ ] There are tests for these changes OR
- [x] These changes do not require tests because they should not change behavior.

<!-- 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/16531)
<!-- Reviewable:end -->
2017-04-20 01:55:33 -05: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
bors-servo
2d732d829b Auto merge of #16472 - cu1t:#14095-fix-xml-doc-namespaces, r=nox
Fix namespaces of elements created in XML documents

Correctly implement following step of [Dom Document Spec](https://dom.spec.whatwg.org/#dom-document-createelement):
> Let namespace be the HTML namespace, if the context object is an HTML document or context object’s content type is "application/xhtml+xml", and null otherwise.

Note, this will make following test in `tests/wpt/web-platform-tests/dom/nodes/Document-constructor.html` to fail, so related .ini file added to mark it as such:
```
test(function() {
  var doc = new Document();
  var a = doc.createElement("a");
  // In UTF-8: 0xC3 0xA4
  a.href = "http://example.org/?\u00E4";
  assert_equals(a.href, "http://example.org/?%C3%A4");
}, "new Document(): URL parsing")
```
I'm not very familiar with specs, but from quick look at it, I'm doubtfull that it is valid in the first place. This is an "application/xml" document, so I don't see why it should encode a.href. Firefox also fails that.

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

<!-- Either: -->
- [ ] There are tests for these changes OR
- [X] These changes do not require tests because because there are already tests which were being ignored

<!-- 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/16472)
<!-- Reviewable:end -->
2017-04-20 01:01:05 -05:00
cu1t
bef86cbf36 Fix namespaces of elements created in XML documents 2017-04-19 19:40:23 +07:00
bjorn3
021f5a3214 Fix indentation of a } 2017-04-17 12:00:53 +02:00
Emilio Cobos Álvarez
53cad6227e
script: Map HTMLCanvasElement width and height attributes. 2017-04-09 18:15:53 +08:00
Simon Sapin
c8b5b4a9bb Revert to per-process shared lock for author-origin stylesheets
Fixes https://github.com/servo/servo/issues/16097
Reopens https://github.com/servo/servo/issues/16027
2017-04-03 18:08:20 +02:00
ddh
e527c9a991 Update Hyper and OpenSSL 2017-03-31 16:32:21 +02:00
Simon Sapin
643545b87f Per-document shared lock for author-origin stylesheets.
Fix #16027
2017-03-19 23:12:15 +01:00
Simon Sapin
aeffca2a59 Replace RwLock<StyleRule> with Locked<StyleRule> 2017-03-19 22:30:37 +01:00
Simon Sapin
c5a7294e05 Replace RwLock<MediaList> with shared_lock::Locked<MediaList> 2017-03-19 22:30:31 +01:00
bors-servo
e62d029ed6 Auto merge of #15906 - mchv:mchv-safe-browsing-context, r=asajeffrey
Access browsing context safely

Current browsing context accessor in `Document` unwraps the browsing context `Option` which prevents document to handle correctly the case when there is no browsing context.

This is the reason servo panics with `session-history.max-length=1` (https://github.com/servo/servo/issues/15877).

As it is my first contribution, I added a `safe` method to retrieve the browsing context rather than change the existing method, but I am happy to change if you think this is the right approach. I did not as well replace all existing method call to the `safe` method, to focus on fixing the issue.

If someone can give me a bit of guidance for the test, I will try to contribute one.

---
<!-- 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
- [ ] `./mach test-tidy` does not report any errors
- [X] These changes fix #15877.
- [ ] There are tests for these changes

<!-- 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/15906)
<!-- Reviewable:end -->
2017-03-16 15:41:07 -07:00
bors-servo
ed98cb9c0a Auto merge of #15938 - servo:form-owner, r=nox,jdm
Implement the form owner concept

<!-- 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/15938)
<!-- Reviewable:end -->
2017-03-15 09:16:08 -07:00
Mukilan Thiyagarajan
38a61712e4 Implement the form owner concept 2017-03-15 16:39:55 +01:00
Alan Jeffrey
5348b63e38 Implement setter for document.domain 2017-03-15 10:34:23 -05:00
Alan Jeffrey
1f61a549a3 Added some same-origin-domain checks. 2017-03-14 14:36:03 -05:00
Mariot Chauvin
f8c7235f73 Access browsing context without panic
Current browsing context accessor in Document unwrap the browsing context option which prevents document to handle correctly the case when there is no browsing context.
2017-03-14 14:18:56 +00:00
bors-servo
f90fc2fa88 Auto merge of #15771 - jdm:img-panic, r=nox
Improve behaviour of image elements that perform multiple requests

This addresses cases where image elements end up making multiple requests, as well as makes the element respond to additional relevant mutations that trigger updating the image data.

---
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #15709 (github issue number if applicable).
- [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/15771)
<!-- Reviewable:end -->
2017-03-08 04:28:58 -08:00
Josh Matthews
dc5335a21e Move checks for document completion to the end of the event loop.
This better reflects the text of the specification - rather than
queuing a task to dispatch the load evnet as soon as the document
loader is unblocked, we want to "spin the event loop until there
is nothing that delays the load event in the Document." Spinning
the event loop is a concept that requires running tasks
completely, hence we check the condition before returning to the
start of the event loop.
2017-03-07 14:02:42 +05:30
Patrick Walton
4e7ac19380 script: Use a timer when rAF is used for non-animation purposes
After this patch, when the page calls `requestAnimationFrame()` too many
times in the row without actually mutating the DOM, further calls to
`rAF` will actually perform the moral equivalent of `setTimeout(16)`.
This saves a lot of CPU time compared to actually waiting for the
vertical blanking interval, because waiting for that requires us to draw
the page.

Reduces CPU usage drastically on nytimes.com, which has a perpetual
`requestAnimationFrame()` loop that checks whether ads are in view.
2017-03-03 23:25:29 +01:00
Fernando Jiménez Moreno
31d833f32c s/nodes_from_point/nodes_from_point_response and change test from reftest to regular test checking only the fixed crash 2017-03-02 16:59:04 +01:00
Fernando Jiménez Moreno
7426d902a3 Trigger reflow on document.elementsFromPoint 2017-03-02 10:44:38 +01:00
bors-servo
a204c4176d Auto merge of #15715 - nox:custom-derive, r=SimonSapin
Make #[dom_struct] a proc_macro attribute

The rustup is needed for https://github.com/rust-lang/rust/pull/40039.

<!-- 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/15715)
<!-- Reviewable:end -->
2017-02-24 05:56:30 -08:00
Anthony Ramine
b2adcfb40b Test that StorageEvent's URL is empty from document.createEvent 2017-02-24 12:22:10 +01:00
Anthony Ramine
31e9d81c0f Make #[dom_struct] a proc_macro attribute 2017-02-24 01:50:51 +01:00
Glenn Watson
30ff2f8f0d Introduce CSSPixel as a replacement for ViewportPx and PagePx. 2017-02-24 06:58:10 +10:00