Commit graph

15314 commits

Author SHA1 Message Date
Manish Goregaokar
b280585cbb stylo: Clean up GetContext, call it UpdateWithElementState 2017-07-17 18:05:08 -07:00
Manish Goregaokar
2a49a73f91 stylo: Stop using mStyleIfVisited in Servo 2017-07-17 18:04:46 -07:00
Manish Goregaokar
e78947f8b5 stylo: Remove FFI calls for fetching style structs from ServoComputedValues 2017-07-17 18:04:24 -07:00
Manish Goregaokar
ff4bc5a2c6 stylo: Flatten ServoComputedValues into ServoStyleContext
This patch also removes the duplication of style contexts during the
restyle, because otherwise pointer equality of ServoComputedValues stops
holding (and we assert on that in a few places)
2017-07-17 18:04:01 -07:00
Manish Goregaokar
cfad95bff0 stylo: Use ServoStyleContext in ServoStyleSet/ServoRestyleManager 2017-07-17 18:03:41 -07:00
Manish Goregaokar
89930e7565 stylo: Switch Gecko over to ServoStyleContext 2017-07-17 18:03:23 -07:00
Manish Goregaokar
74519cc1a7 stylo: Make Servo Arc types use ptr to T instead of ptr to ArcInner<T> 2017-07-17 18:03:09 -07:00
Manish Goregaokar
808b1f509b stylo: Use ComputedValuesInner instead of ComputedValues when we don't need it 2017-07-17 18:02:25 -07:00
Manish Goregaokar
04b0ae64f2 stylo: Introduce ComputedValuesInner 2017-07-17 18:01:36 -07:00
Manish Goregaokar
5d78743037 stylo: Replace real ComputedValues with bindgenned ComputedValues2 2017-07-17 18:01:20 -07:00
Manish Goregaokar
d52f04d105 stylo: Use RawOffsetArc in ComputedValues 2017-07-17 18:01:01 -07:00
Manish Goregaokar
d1c235d7b7 stylo: Add RawOffsetArc<T> 2017-07-17 18:00:47 -07:00
Manish Goregaokar
4c5cc89f39 stylo: Create C++-side ServoComputedValues 2017-07-17 18:00:31 -07:00
Manish Goregaokar
3343c829ca Update bindings 2017-07-17 18:00:16 -07:00
bors-servo
97023f18f3 Auto merge of #17537 - jyc:default-namespace-serialization, r=emilio
Some fixes to selector serialization re: namespaces and universal selector

- Fix eliding default namespace when serializing
- Fix shortest serialization property when namespace prefix is `*|` and there is no default namespace
- Omit universal selector when serializing to match `cssom/serialize-namespaced-type-selectors` (again so we get the shortest serialization)

<!-- 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 is part of a series to fix #17182

<!-- Either: -->

I'd like to land #17501 first, because it allows some tests for this to work.

- [ ] 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/17537)
<!-- Reviewable:end -->
2017-07-17 16:26:37 -07:00
bors-servo
e122ea65fd Auto merge of #17762 - emilio:visited-nested, r=jryans
style: Cascade the visited style with the normal rules if we didn't find a relevant link.

<!-- 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/17762)
<!-- Reviewable:end -->
2017-07-17 15:21:22 -07:00
Emilio Cobos Álvarez
1d8e069389
style: Cascade the visited style with the normal rules if we didn't find a relevant link.
MozReview-Commit-ID: HbfZs0jnusn
2017-07-17 23:30:37 +02:00
bors-servo
3459748134 Auto merge of #17758 - emilio:extended-slots, r=heycam
Bug 1377993: Make node slots less memory hungry in common cases.

<!-- 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/17758)
<!-- Reviewable:end -->
2017-07-17 14:25:51 -07:00
Emilio Cobos Álvarez
f5bddd1465
style: Update bindings. 2017-07-17 22:51:18 +02:00
Emilio Cobos Álvarez
c606ec13e2
Bug 1377993: Make node slots less memory hungry in common cases. 2017-07-17 22:48:11 +02:00
bors-servo
7f1278a329 Auto merge of #17606 - asajeffrey:canvas-delay-deleting-image-keys, r=jdm
Don't delete webrender image keys immediately.

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

We currently delete webrender image id's immediately on resizing a canvas, which can cause panics. This PR delays deleting the image id until an epoch has passed.

---
<!-- 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 #17534
- [X] These changes do not require tests because the intermittent failure is already triggered by the css-paint-api tests.

<!-- 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/17606)
<!-- Reviewable:end -->
2017-07-17 13:25:37 -07:00
Alan Jeffrey
3002c45184 Don't delete webrender image keys immediately. 2017-07-17 15:24:42 -05:00
Jonathan Chan
1301bcdf10 Omit serializing the universal selector when possible.
If omitting the universal selector in the serialization is possible, we
should do it so we obtain a shorter serialization (to match the behavior
asserted in cssom/serialize-namespaced-type-selectors.html).

For example, if someone writes *|*::before and there is no default
namespace, we should serialize to ::before; however, if there is a
default namespace, we should serialize to *|*::before.
(This is the test case "Universal selector in any namespace followed by
pseudo element).

This matches the behavior implemented by WebKit; that one case in
particular isn't implemented by Gecko, but other cases where the
universal selector should be elided are implemented by Gecko but were not
previously by Servo.
2017-07-17 10:52:17 -07:00
Jonathan Chan
989b707623 Elide the explicit any namespace prefix when lacking default namespace.
Once again it seems we don't need to preserve the original prefix name,
and this lets to_css serialize to the shortest form when there is no
default namespace and the *| prefix is used.

Selectors § 6.1.1 says:

    Element type selectors that have no namespace component (no namespace
    separator) represent elements without regard to the element's namespace
    (equivalent to "*|") unless a default namespace has been declared for
    namespaced selectors (e.g. in CSS, in the style sheet). If a default
    namespace has been declared, such selectors will represent only elements
    in the default namespace.

Then if there is no default namespace, *| (which we write as
QNamePrefix::ExplicitAnyNamespace) is equivalent to what we write as
QNamePrefix::ImplicitAnyNamespace; the latter has a shorter
serialization, so we should use that.
2017-07-17 10:43:24 -07:00
Austin Hicks
033b31979b Convert node serialization to a purely iterative algorithm.
We maintain a stack of open element nodes and non-node elements and use it to determine when to close them.
2017-07-17 12:24:30 -04:00
bors-servo
2bb4f65100 Auto merge of #16508 - brainlessdeveloper:fetch-set-origin, r=asajeffrey
Properly set origin of fetch requests

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

These changes aim to fix #15247

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

<!-- Either: -->
- [ ] There are tests for these changes
- [x] These changes do not require tests because cors is already tested with different origins

These changes require changes in tests, but I need help with that (see comments below).

<!-- 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/16508)
<!-- Reviewable:end -->
2017-07-17 08:29:23 -07:00
bors-servo
38f4ae80c4 Auto merge of #17739 - jdm:no-vendor-prefixed-errors, r=emilio
Suppress CSS parser errors for vendor-prefixed properties.

This matches the behaviour of Gecko's CSS parser.

- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #17736
- [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/17739)
<!-- Reviewable:end -->
2017-07-17 07:10:11 -07:00
Josh Matthews
94d631c1f4 Suppress CSS parser errors for vendor-prefixed properties. 2017-07-17 10:00:31 -04:00
bors-servo
2d37700cf8 Auto merge of #17731 - emilio:percentage-calc, r=nox
style: Respect calc for percentages.

<!-- 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/17731)
<!-- Reviewable:end -->
2017-07-17 01:29:11 -07:00
Paul Rouget
cd3172c913 allow_navigation: use channel to send response 2017-07-17 08:55:59 +02:00
Fausto Núñez Alberro
6032940fb8 Change RequestInit origin type to ImmutableOrigin 2017-07-16 21:44:33 +02:00
Emilio Cobos Álvarez
1316f3640b
style: Fix a typo that makes us resolve styles for the whole spin to the root.
For undisplayed elements, at least.
2017-07-16 16:32:50 +02:00
bors-servo
17f99e2a7b Auto merge of #17741 - bholley:trim_traversal_fat, r=emilio
Trim some fat from the traversal

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

<!-- 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/17741)
<!-- Reviewable:end -->
2017-07-15 15:07:51 -07:00
Bobby Holley
b7de96e702 Pass a callback to recalc_style_at to avoid traversing children twice.
MozReview-Commit-ID: DIHXaVNzbFM
2017-07-15 14:45:51 -07:00
Bobby Holley
e534ec9e47 Move clearing of dirty descendants bit closer to the last place it's needed.
In the next patch, we'll move logic to identify the children for traversal into
preprocess_children (which will be renamed), and the set_dirty_descendants logic
will move along with it. So left as-is, the code here will clobber the flags.

MozReview-Commit-ID: 7ZskKWD4QC3
2017-07-15 14:27:18 -07:00
Bobby Holley
2a58c0768b Avoid memmoving the large smallvec in Parallel.rs.
MozReview-Commit-ID: 7nzjMwOmszZ
2017-07-15 14:27:18 -07:00
bors-servo
98836ff30d Auto merge of #17745 - SergeevPavel:cleanup, r=emilio
rustify if statements style

<!-- Please describe your changes on the following line: -->
Rewrite if statement in more rusty style.

---
<!-- 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 #17699 (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/17745)
<!-- Reviewable:end -->
2017-07-15 14:07:19 -07:00
bors-servo
9d78008acb Auto merge of #17747 - emilio:more-stuff-going-away, r=wafflespeanut
style: Remove unused ElementStyles::styles_and_restyle_mut.

Never enough code going away.

<!-- 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/17747)
<!-- Reviewable:end -->
2017-07-15 11:11:13 -07:00
Emilio Cobos Álvarez
65d2e8ff99
style: Remove unused ElementStyles::styles_and_restyle_mut. 2017-07-15 19:15:27 +02:00
Emilio Cobos Álvarez
3faba0cfff
style: Remove some no longer needed type arguments. 2017-07-15 19:02:19 +02:00
Pavel Sergeev
729b8120e0 rustify if statements style 2017-07-15 19:57:47 +03:00
Emilio Cobos Álvarez
bf9369b29d
script: Move the layout_wrapper outside of script.
This allows us to have ensure_data() and clear_data() functions on the TElement
trait, instead of hacking around it adding methods in random traits.

This also allows us to do some further cleanup, which I'd rather do in a
followup.
2017-07-15 16:41:12 +02:00
Hiroyuki Ikezoe
0053efb154 Update bindings. 2017-07-15 11:54:43 +09:00
Hiroyuki Ikezoe
e700a66e9f Preserve restyle hints after ForThrottledAnimationFlush restyle.
Those remaining restyle hints are needed for normal traversal later.
2017-07-15 11:54:43 +09:00
bors-servo
3fb309c755 Auto merge of #17696 - jyc:image-orientation-redux, r=Manishearth
Sync Servo / Gecko image-orientation rounding; pass as enum.

Make Servo's rounding of image-orientation values agree with Gecko's,
and pass orientations directly as an enum instead of as angles.

Depends on a Gecko change to be subsequently landed in m-c.

Were reviewed here: https://reviewboard.mozilla.org/r/155336/

<!-- 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 [Bugzilla Bug 1355380](https://bugzilla.mozilla.org/show_bug.cgi?id=1355380) (github issue number if applicable).

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

<!-- 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/17696)
<!-- Reviewable:end -->
2017-07-14 18:54:45 -07:00
Nazım Can Altınova
ade76f10b7 Convert TrackList's 'values' field to store only TrackSize.
It was storing both TrackSize and TrackRepeat before and TrackRepeat have to be
converted into sequence of TrackSize during serialization. Instead of doing this
in serialization process(which is hard and hacky), we converted to do this in
parsing process. We were doing this conversion in the ComputedValue conversion.
So we only had to move this process to parsing.
2017-07-14 15:55:40 -07:00
Jonathan Chan
c6a7f10182 Sync Servo / Gecko image-orientation rounding; pass as enum.
Make Servo's rounding of image-orientation values agree with Gecko's,
and pass orientations directly as an enum instead of as angles.

Depends on a Gecko change to be subsequently landed in m-c.
2017-07-14 14:44:23 -07:00
Jonathan Chan
bd5ff3b4ce Replace Namespace components which map to the default namespace with DefaultNamespace.
It seems we don't need to preserve the original prefix name, and this
conveniently leads to_css to now implement CSSOM's requirement to elide
the namespace prefix during serialization when it maps to the default
namespace.

https://drafts.csswg.org/cssom/#serialize-a-simple-selector
2017-07-14 12:19:03 -07:00
bors-servo
2913d65b75 Auto merge of #17726 - paulrouget:rm_WindowNavigateMsg, r=jdm
Remove WindowNavigateMsg

Two reasons:

- We want to be able to jump further in history from the embedder.
- We don't want to have an extra translation step in the compositor, where `WindowNavigateMsg` is translated to `TraversalDirection`

---
<!-- 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/17726)
<!-- Reviewable:end -->
2017-07-14 07:16:18 -07:00
bors-servo
bb0c05dd2b Auto merge of #17732 - emilio:font-size-as-ratio, r=nox
style: Simplify font_size::SpecifiedValue::as_font_ratio.

<!-- 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/17732)
<!-- Reviewable:end -->
2017-07-14 05:01:48 -07:00