Commit graph

22712 commits

Author SHA1 Message Date
Emilio Cobos Álvarez
a7c50b57a1
style: Handle logical shorthand animations with variable references correctly.
When we physicalize the declarations for @keyframes, we end up having a physical
declaration with an unparsed value with `from_shorthand` being the logical
shorthand.

Account for this case properly when substituting custom properties, to avoid
panicking.

Differential Revision: https://phabricator.services.mozilla.com/D53663
2019-11-30 20:45:01 +01:00
Boris Chiou
9a43ad996f
style: Update the expected direction vector of rotate property in wpt.
For interpolations with the primitive rotate3d(), the direction vectors of
the transform functions get normalized first. This should also be applied to
rotate property.

https://drafts.csswg.org/css-transforms-2/#interpolation-of-transform-functions

Differential Revision: https://phabricator.services.mozilla.com/D52944
2019-11-30 20:45:01 +01:00
Emilio Cobos Álvarez
246433acfa
style: Remove NODE_IS_ANONYMOUS_ROOT.
We no longer have multiple kinds of anonymous subtrees, so we can get back one
node bit.

Differential Revision: https://phabricator.services.mozilla.com/D53344
2019-11-30 20:45:00 +01:00
Emilio Cobos Álvarez
425025c230
style: Use only Origin during the cascade, rather than CascadeLevel.
The micro-benchmark `style-attr-1.html` regressed slightly with my patch, after
the CascadeLevel size increase.

This benchmark is meant to test for the "changing the style attribute doesn't
cause selector-matching" optimization (which, mind you, keeps working).

But in the process it creates 10k rules which form a perfect path in the rule
tree and that we put into a SmallVec during the cascade, and the benchmark
spends most of the time pushing to that SmallVec and iterating the declarations
(as there's only one property to apply).

So we could argue that the regression is minor and is not what the benchark is
supposed to be testing, but given I did the digging... :)

My patch made CascadeLevel bigger, which means that we create a somewhat bigger
vector in this case. Thankfully it also removed the dependency in the
CascadeLevel, so we can stop using that and use just Origin which is one byte to
revert the perf regression.

Differential Revision: https://phabricator.services.mozilla.com/D53181
2019-11-30 20:45:00 +01:00
Boris Chiou
45c64a7224
style: Set WillChangeBits::TRANSFORM for offset-path and add tests for it.
Differential Revision: https://phabricator.services.mozilla.com/D53109
2019-11-30 20:45:00 +01:00
Boris Chiou
b420293a57
style: Treat 3d translate/scale as 2d if the value can be expressed as 2d.
For the individual transform properties if they spec a value that can be
expressed as 2d we treat as 2d and serialize accordingly.

We drop Translate::Translate and Scale::Scale, and then rename
Translate::Translate3D as Translate::Translate, Scale::Scale3D as
Scale::Scale. So now we use Translate::Translate to represent 2d and 3d
translation, and Scale::Scale to represent 2d and 3d scale. There is no
difference between 2d and 3d translate/scale in Gecko because we always
convert them into 3d format to layers (on the compositor thread), so this
change makes things simpler.

Differential Revision: https://phabricator.services.mozilla.com/D52931
2019-11-30 20:45:00 +01:00
Emilio Cobos Álvarez
bb06ed7206
style: Centralize logic to ignore document colors.
This was a follow-up from the backplate stuff which I requested but didn't
happen.

Differential Revision: https://phabricator.services.mozilla.com/D53170
2019-11-30 20:44:59 +01:00
Emilio Cobos Álvarez
0cfc91d6ce
style: Remove NODE_MAY_BE_IN_BINDING_MNGR.
Never set anymore.

Differential Revision: https://phabricator.services.mozilla.com/D52994
2019-11-30 20:44:59 +01:00
Emilio Cobos Álvarez
1f2c1f555c
style: Optimize storage of ApplicableDeclaration again.
So that we don't regress perf.

Differential Revision: https://phabricator.services.mozilla.com/D52576
2019-11-30 20:44:59 +01:00
Emilio Cobos Álvarez
349492b5e2
style: Fix cascade order of shadow parts.
This moves the shadow cascade order into the cascade level, and refactors the
code a bit for that.

Differential Revision: https://phabricator.services.mozilla.com/D49988
2019-11-30 20:44:58 +01:00
Emilio Cobos Álvarez
28110c060f
style: Split collect_style_attribute_and_animation_rules.
Animations are their own cascade level per https://drafts.csswg.org/css-cascade-4/#cascade-origin

Differential Revision: https://phabricator.services.mozilla.com/D52575
2019-11-30 20:44:58 +01:00
Sam Mauldin
9bdad610ff
style: Remove SpecialColorKeyword enum and merge into SystemColor.
Move all the entires of SpecialColorKeyword into SystemColor
and rearrange their computation to match.
Add the new SystemColor entries into the property list of nsXPLookAndFeel.

Differential Revision: https://phabricator.services.mozilla.com/D50903
2019-11-30 20:44:58 +01:00
Hiroyuki Ikezoe
7fec79ffcf
style: Factor dynamic toolbar max height into layout metrics.
Now
* nsPresContext::mVisibleArea is excluding the toolbar max height so that
  ICB is now static regardless of the dynamic toolbar transition
* nsPresContext::mSizeForViewportUnits is introduced to resolve viewport units
  which is including the toolbar max height

That means that with the dynamic toolbar max height;

  mVisibleArea < mSizeForViewportUnits

See https://github.com/bokand/URLBarSizing for more detail backgrounds of this
change.

Depends on D50417

Differential Revision: https://phabricator.services.mozilla.com/D50418
2019-11-30 20:44:58 +01:00
Dzmitry Malyshau
ff1a9dbb2e
style: Update some dependencies.
Differential Revision: https://phabricator.services.mozilla.com/D49458
2019-11-30 20:44:57 +01:00
Emilio Cobos Álvarez
c28ca7b405
style: Use MaybeUninit in style struct clone impls / constructors.
Differential Revision: https://phabricator.services.mozilla.com/D51788
2019-11-30 20:44:57 +01:00
Tim Nguyen
c04a37982c
style: Remove nsStackFrame platform code.
Differential Revision: https://phabricator.services.mozilla.com/D49487
2019-11-30 20:44:56 +01:00
Emilio Cobos Álvarez
cceb0bcb73
style: Simplify code for keeping alive shared memory until all sheets go away.
The existing code wasn't sound, as CSSOM objects also needed to go away before
the shared memory goes away (as they keep references to them).

This is sound assuming no presence of reference cycles introduced by CSSOM.

We may want to live with this and rely on chrome code not writing cycles like
this with UA stylesheet DOM objects.

We could explicitly drop all potentially-static objects... That seems pretty
error prone though.

Or we could also just leak the shared memory buffer, is there any reason why we
may not want to do that?

Differential Revision: https://phabricator.services.mozilla.com/D51870
2019-11-30 20:44:56 +01:00
Emilio Cobos Álvarez
9c1dd4b3ea
style: Make zoom: 0 mean the same as zoom: 1.
This matches the WebKit implementation, and is clearly a violation of the rules
we generally use for ranges in CSS.

But it seems to be depended-on legacy behavior, see the linked WebKit bug, this
bug, and bug 1593317.

Differential Revision: https://phabricator.services.mozilla.com/D51539
2019-11-30 20:44:56 +01:00
Emilio Cobos Álvarez
d797b0e475
style: Fix ElementWrapper::is_link.
And do a full restyle only when the state goes from visited to unvisited or vice
versa. That is, use regular invalidation for addition or removals of href
attributes, for example.

Differential Revision: https://phabricator.services.mozilla.com/D50821
2019-11-30 20:44:55 +01:00
Emilio Cobos Álvarez
d68d6f7c56
style: Always restyle / repaint when a visited query finishes.
Differential Revision: https://phabricator.services.mozilla.com/D50810
2019-11-30 20:44:55 +01:00
bors-servo
3db473714b
Auto merge of #24670 - glowe:add-crlf-to-boundary, r=Manishearth
Add CRLF to encoded multipart form data

<!-- Please describe your changes on the following line: -->
Some (3) WPT tests were failing because they expected the body for a multipart form data response to end with a CRLF. So I updated encode_multipart_form_data to add the missing terminator.

Looking at the corresponding spec (https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#multipart%2Fform-data-encoding-algorithm) and RFC (https://tools.ietf.org/html/rfc7578), I couldn't find anything mentioned about this detail.

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

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

<!-- 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. -->
2019-11-29 20:21:38 -05:00
glowe
3d322f96e3 Add CRLF to encoded multipart form data
Some WPT tests were failing because they expected the body for a
multipart form data response to end with a CRLF. So I updated
encode_multipart_form_data to add the missing terminator.
2019-11-29 17:29:39 -05:00
bors-servo
b0012a62b2
Auto merge of #24883 - szeged:id_management, r=jdm
Add WebGPU identity management

<!-- 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 addresses a part of #24706

<!-- 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.-->
cc @jdm, @kvark, @zakorgy
<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
2019-11-28 11:05:19 -05:00
Istvan Miklos
b26598d470 Add WebGPU identity management
Issue: https://github.com/servo/servo/issues/24706#issuecomment-557891841
2019-11-28 10:33:03 +01:00
bors-servo
5f1681ad25
Auto merge of #24875 - jdm:wr-no-ipc, r=asajeffrey
Extract IPC out of webrender

Fixes #20172. Fixes #13480.
2019-11-27 20:48:13 -05:00
Josh Matthews
564c16d754 Use non-IPC webrender API over explicit IPC channels. 2019-11-27 20:47:53 -05:00
bors-servo
a020522f37
Auto merge of #24858 - saschanaz:handle-property, r=jdm
Handle u32 property indices

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

Tried porting from Gecko, not sure how to do void JSID check yet.

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

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

<!-- 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. -->
2019-11-27 09:43:46 -05:00
bors-servo
83bb96740d
Auto merge of #24871 - servo:2020-ci, r=nox,SimonSapin
Run WPT with Layout 2020 on CI

… and gate PRs on the result.
2019-11-27 06:02:23 -05:00
Anthony Ramine
9b4baf2efa Use the rayon pool when computing styles in layout 2020 2019-11-27 11:09:35 +01:00
Anthony Ramine
c6f241b0ce Remove some stale servo-2020 gates 2019-11-27 11:09:34 +01:00
Anthony Ramine
20bde0efb3 Dump more stuff in the assertion in set_font_size_dependency 2019-11-27 10:13:24 +01:00
bors-servo
81c59077fd
Auto merge of #24870 - pshaughn:2909, r=jdm
Fix #2909 (squashed version of PR #24865)

<!-- Please describe your changes on the following line: -->
Now using data-url::forgiving_base64 instead of base64, this fixes all the fetch/data-urls/base64.* tests.

---
<!-- 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 quite fix yet #2909

<!-- 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. -->
2019-11-27 03:53:17 -05:00
bors-servo
b0f573b59f
Auto merge of #24877 - atouchet:master, r=jdm
Update some URLs

<!-- 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: -->
- [ ] `./mach build -d` does not report any errors
- [ ] `./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. -->
2019-11-27 02:27:19 -05:00
Kagami Sascha Rosylight
e20de3b04a Handle u32 property indices 2019-11-27 15:50:04 +09:00
bors-servo
f166422102
Auto merge of #24862 - jdm:js-init-destroy-fit-the-second, r=asajeffrey
Ensure SpiderMonkey shuts down cleanly

This is the alternate solution that I described in #24845. Given how much simpler the resulting code is, I'm now much more in favour of this design. Depends on https://github.com/servo/rust-mozjs/pull/487.

---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #21696 and fix #22276
- [x] There are tests for these changes
2019-11-27 01:23:20 -05:00
Josh Matthews
1c7f2d696c Remove use of deprecated language construct. 2019-11-26 21:54:33 -05:00
Josh Matthews
7944d9548c script: Ensure JS engine is initialized and deinitialized on the same thread. 2019-11-26 21:54:33 -05:00
Alex Touchet
56922b70d5
Update some URLs 2019-11-26 17:12:49 -08:00
bors-servo
42003a921b
Auto merge of #24859 - jdm:surfman-fallible, r=Manishearth
Don't panic if surfman initialization fails.

Since WebGL is only one component of the web platform, there's no reason that failing to initialize surfman for webgl support should take down the entire browser.

---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #24642 (in that the browser will now start up) and fix #24627
- [x] These changes do not require tests because tests for graphics acceleration? don't make me laugh.
2019-11-26 16:43:57 -05:00
bors-servo
a922c497fa
Auto merge of #24758 - gterzian:impl_timer_task_source, r=nox
Implement timer-task-source, time-out service worker

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

Implements the timer task-source, and folds the IPC glue-code into a single route set by the globalscope.

Also switches service worker to using a dedicated "time-out" mechanism, which previously relied on the timer mechanism(and I think didn't actually implement script timers).

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [ ] `./mach build -d` does not report any errors
- [ ] `./mach test-tidy` does not report any errors
- [ ] These changes fix #24747 (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. -->
2019-11-26 16:26:20 -05:00
bors-servo
8e0aa68aaa
Auto merge of #24783 - mmatyas:webgl_fns_readpixels, r=nox
Add support for WebGL2 ReadPixels functions

Adds support for the new ReadPixels functions introduced with WebGL2 and the relevant PixelStorei parameters..

Reference: https://www.khronos.org/registry/webgl/specs/latest/2.0/#3.7.10

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

---

This is a work in progress patch, but I think it might be ready for comments. There are a few issues left:

- When the target is the pixel pack buffer, the GL function expects a byte offset as a pointer. In Sparkle the `read_pixels` functions return/work on top of arrays, so for now I've made a [workaround patch](45d8bb263d). I wonder if that's okay or should we do it somehow differently?
- When writing to the pixel pack buffer, padding bytes on the destination are properly ignored. When writing to client buffers, Sparkle `read_pixels` returns a buffer with 1 byte alignment, which I think is fine (less stuff to move between threads), but requires positioning the rows manually (see the bottom of `read_pixels_into` vs. `ReadPixels_`).
- There are some duplicated code between the array buffer and pixel pack buffer variants, eg. the detection of intersection with the framebuffer. This could be refactored, but that results in a function with `Result<Option<Rect<u32>>, WebGLError>`, which I'm not sure is readable enough to help.
- There is a duplication with the WebGL1 code. WebGL2 introduces row length, skip pixels and skip rows as pixel pack parameters which affect the ReadPixels operation. The helper functions could be moved to be usable in WebGL1, but then these new modifiers would also need to be passed as a function parameter, which is somewhat ugly (but would work). What's your opinion about this?

cc @jdm @zakorgy

---
<!-- 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] There are tests for these changes

<!-- 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. -->
2019-11-26 12:31:15 -05:00
Anthony Ramine
858bc5aca6 Split FlowChildren in IndependentLayout and FlowLayout
The result of doing the layout of an independent formatting context
should be unconcerned with margin collapsing.
2019-11-26 16:36:24 +01:00
Anthony Ramine
24b7eadfff Make NodeExt private in layout_2020 2019-11-26 16:36:24 +01:00
Anthony Ramine
10eccc8beb Rename Arc to ServoArc in layout_2020::dom_traversal 2019-11-26 16:36:24 +01:00
Mátyás Mustoha
8fefa23019 Add support for WebGL2 ReadPixels functions
Adds support for the new ReadPixels functions introduced with WebGL2
and the relevant PixelStorei parameters.

Reference: https://www.khronos.org/registry/webgl/specs/latest/2.0/#3.7.10
2019-11-26 16:09:13 +01:00
Patrick Shaughnessy
7363db31db Fix #2909 as far as WPT is concerned, not full data-url class integration 2019-11-26 09:49:30 -05:00
Simon Sapin
80eec48d37 Use std::mem::take instead of defining it 2019-11-26 15:42:27 +01:00
Simon Sapin
b2b3ea992c Make IndependentFormattingContext a struct that owns styles
… and has a private enum for its contents.

Privacy forces the rest of the code to go through methods
rather than matching on the enum,
reducing accidental layout-mode-specific behavior.
2019-11-26 15:42:27 +01:00
bors-servo
7a72f8a168
Auto merge of #24842 - servo:jdm-patch-34, r=nox
Make JS runnables for workers execute on correct event loop

- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #24812
2019-11-26 09:33:59 -05:00
Manish Goregaokar
d233558b9b Fix iterator invalidation in our forEach implementation. 2019-11-25 19:56:14 -08:00