Commit graph

6718 commits

Author SHA1 Message Date
Nick Price
731706041d Add LengthOrNormal type aliases 2016-12-09 17:57:20 -05:00
Simon Sapin
fdc40592de Use rust-phf to map strings to property IDs 2016-12-09 10:56:23 -10:00
Simon Sapin
137e30b825 Introduce enums for identifying CSS properties.
* `LonghandId` and `ShorthandId` are C-like enums
* `Atom` is used for the name of custom properties.
* `PropertyDeclarationId` is the identifier for `PropertyDeclaration`,
  after parsing and shorthand expansion. (Longhand or custom property.)
* `PropertyId` represents any CSS property, e.g. in CSSOM.
  (Longhand, shorthand, or custom.)

Using these instead of strings avoids some memory allocations and copies.
2016-12-09 10:56:22 -10:00
Simon Sapin
97344b150d cow_to_ascii_lowercase() 2016-12-09 10:56:20 -10:00
Jansen Jan
55f0e56224 Add support for fullscreen #10102 2016-12-09 11:45:50 +01:00
Cameron McCormack
3d881f3622 Regenerate bindings. 2016-12-08 00:29:55 -10:00
Cameron McCormack
8310962b90 Update regen.py for recent mozilla-central and rust-bindgen. 2016-12-08 00:29:08 -10:00
Emilio Cobos Álvarez
e09bc36347 stylo: Update bindings with servo/rust-bindgen#325 2016-12-08 00:27:32 -10:00
Emilio Cobos Álvarez
5832507e56 stylo: Whitelist some stuff to work-around bindgen generating too many tests. 2016-12-08 00:27:32 -10:00
Emilio Cobos Álvarez
f7d64c66da stylo: Regenerate bindings. 2016-12-08 00:27:32 -10:00
Emilio Cobos Álvarez
eafa13c724 stylo: Use proper namespaces in bindings.
This allows us to incrementally remove both bindgen hacks and stylo hacks.
2016-12-08 00:27:32 -10:00
bors-servo
8dfaed2183 Auto merge of #14464 - canaltinova:cssom-test, r=Manishearth
Write tests for CSSOM Interfaces

<!-- Please describe your changes on the following line: -->
ToCss implementation was wrong about Keyframe percentage values, it was writing values between 0-1. I had to fix it. Wrote some tests about CSSKeyframesRule, CSSNamespaceRule, CSSRuleList, CSSStyleSheet, StyleSheetList interfaces.
CSSFontFaceRule and CSSViewportRule looks like not implemented yet. I didn't write one for them.
Also name attribute in CSSKeyframesRule isn't implemented yet. Is there any complication about it? If not, I can implement it.

r? @Manishearth

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

<!-- 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/14464)
<!-- Reviewable:end -->
2016-12-07 13:38:50 -08:00
Cameron McCormack
05ceafa981 Set nsStyleDisplay::mOriginalDisplay when computing display property.
MozReview-Commit-ID: JkjkCDUfcfE
2016-12-06 00:56:55 -10:00
Cameron McCormack
7a4a37870c Skip root- and item-based display style fixup for Gecko NAC.
MozReview-Commit-ID: 6AV2UWyl6pl
2016-12-06 00:56:55 -10:00
Cameron McCormack
be3f2579c4 Blockify grid items like we do flex items.
MozReview-Commit-ID: DysyWARAf3A
2016-12-06 00:56:55 -10:00
Cameron McCormack
7851163610 Do display style fixup for Gecko-specific display values.
MozReview-Commit-ID: 1LjnxzgNJsz
2016-12-06 00:56:55 -10:00
Cameron McCormack
0bc711b023 stylo: Support remaining display property values.
MozReview-Commit-ID: HjLu7t2g7gF
2016-12-05 21:49:19 -10:00
Cameron McCormack
b92c451b97 Regenerate bindings. 2016-12-05 21:48:53 -10:00
Cameron McCormack
0ff7b5f2de Support declaring keyword property Gecko coverage as inexhaustive.
This allows us to control whether the catchall case in the match expression
that maps Gecko const to Servo enum will be generated.

MozReview-Commit-ID: L65IjTONdfl
2016-12-05 21:38:58 -10:00
Nazım Can Altınova
e978f11c9f Fix Keyframe selector serialization 2016-12-06 01:38:06 +03:00
bors-servo
6c3e94805f Auto merge of #14460 - emilio:stylo-bindgenup, r=heycam
stylo: Use master bindgen again.

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

To be fair, this is master bindgen with https://github.com/servo/rust-bindgen/pull/318.

<!-- 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/14460)
<!-- Reviewable:end -->
2016-12-05 03:52:16 -08:00
bors-servo
16c2960c3a Auto merge of #14461 - heycam:bloom-no-common-ancestor, r=emilio
allow the style bloom filter to recover from switch to a node with no common ancestor with the old node

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

Since https://bugzilla.mozilla.org/show_bug.cgi?id=1321284, we can have multiple disjoint subtrees of elements to style in a document, due to document level native anonymous content not inheriting from the document's element.  This patch tweaks the style Bloom filter to allow switching to a new node that has no common ancestor with the old node.

r? @emilio

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

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

… common ancestor with the old node.

<!-- 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/14461)
<!-- Reviewable:end -->
2016-12-05 03:01:12 -08:00
Cameron McCormack
68af62f15f Allow the style bloom filter to recover from switch to a node with no common ancestor with the old node. 2016-12-04 23:35:03 -10:00
Emilio Cobos Álvarez
a890f9037d
stylo: Regen bindings. 2016-12-05 00:16:10 -08:00
Emilio Cobos Álvarez
606ea019b7
stylo: Use bindgen master again.
Stylo has been stuck with an old version of bindgen from quite a bit of time,
this commit does the minimal stuff to put it working again with master.
2016-12-05 00:14:49 -08:00
Cameron McCormack
78c812866a Fix current_dom_depth in sequential traversal. (fixes #14414) 2016-12-04 15:50:25 -10:00
Cameron McCormack
5aef349341 Regenerate bindings. 2016-12-03 23:21:30 -10:00
Cameron McCormack
353b86a7dc Update -webkit-text-stroke-width glue. 2016-12-03 23:07:28 -10:00
Cameron McCormack
2b0d76d825 Update regen.py for recent mozilla-central changes. 2016-12-03 23:06:36 -10:00
bors-servo
7c346e0d94 Auto merge of #14421 - upsuper:patch-2, r=emilio
Treat top-level number in calc() invalid

<!-- Please describe your changes on the following line: -->
This should probably considered as a temporary fix (for [bug 1321206](https://bugzilla.mozilla.org/show_bug.cgi?id=1321206)), to avoid assertion when trying to serialize calc value with only numbers. Certain properties (e.g. `line-height`) would eventually need to keep numbers inside calc.

---
<!-- 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: -->
- [x] There are tests for these changes OR
- [ ] These changes do not require tests because _____

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

Currently, CalcLengthOrPercentage doesn't actually keep the number value. If we don't treat it invalid, we can end up generating empty `calc()` value when one contains numbers (e.g. `calc(1)`), which would violate assertion elsewhere that `calc` must not be empty.

<!-- 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/14421)
<!-- Reviewable:end -->
2016-12-02 20:18:05 -08:00
bors-servo
106a538e7e Auto merge of #14433 - canaltinova:medialist, r=Manishearth
Implement MediaList interface

<!-- Please describe your changes on the following line: -->
Added MediaList interface and implemented `mediaText`, `length` and `index` attributes.
r? @Manishearth

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

<!-- 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/14433)
<!-- Reviewable:end -->
2016-12-02 12:53:57 -08:00
Nazım Can Altınova
c052835281 Implement MediaList interface 2016-12-02 23:46:40 +03:00
Xidorn Quan
6fec4d7645 Treat top-level number in calc() invalid
Currently, CalcLengthOrPercentage doesn't actually keep the number
value, so if we don't treat it invalid, we can end up generating empty
`calc()` value when one contains top-level numbers (e.g. `calc(1)`),
which would violate assertion elsewhere that `calc` must not be empty.
2016-12-03 00:34:43 +11:00
Emilio Cobos Álvarez
e3a9637107
style: Don't pop too much in the bloom filter.
This is not a problem for Servo, because we recovered it without much problem a
few lines below, and we never reached the pathological case where the filter has
one element (the root), and we restyled another element with depth 1.

Fixes bug 1321725.
2016-12-02 12:29:25 +01:00
bors-servo
a913815a4d Auto merge of #14394 - jcdyer:jcdyer/either-column-width, r=Wafflespeanut
Convert column-width to use Either

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

* Converted column-width to use `Either<Length, Auto>`
* Added gecko glue code
* Cleaned up old column-width glue code

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

<!-- Either: -->
- [ ] There are tests for these changes OR
- [x] These changes do not require tests because tests already surround the refactored code.
<!-- 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/14394)
<!-- Reviewable:end -->
2016-12-01 23:03:37 -08:00
bors-servo
290ff5c801 Auto merge of #14370 - thiagopnts:master, r=Wafflespeanut
use Either type for UrlOrNone

Use the Either type for UrlOrNone

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

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

<!-- 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/14370)
<!-- Reviewable:end -->
2016-12-01 22:03:31 -08:00
bors-servo
d2d62267a1 Auto merge of #14418 - pcwalton:infinite-reflows, r=notriddle
layout: Fix some particularly bad cases of spurious reflows leading to script thread unresponsiveness.

See commits for details. This improves nytimes.com quite a bit.

r? @notriddle

<!-- 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/14418)
<!-- Reviewable:end -->
2016-12-01 10:16:38 -08:00
J. Cliff Dyer
5821ff77db Convert column-width to use Either
Fixes #14350
2016-12-01 15:17:51 +05:30
Xidorn Quan
bddd467c0e Add insertRule/deleteRule support for stylo 2016-12-01 16:20:02 +11:00
bors-servo
22c8df150a Auto merge of #14404 - BorisChiou:Bug1317179, r=Manishearth
Use XPCOM string bindings instead of Gecko_Utf8SliceToString

These are the servo-side changes for [bug 1317179](https://bugzilla.mozilla.org/show_bug.cgi?id=1317179). @Manishearth has already reviewed them there. I'd like to merge these patches until the gecko-side changes for [bug 1317179](https://bugzilla.mozilla.org/show_bug.cgi?id=1317179) is landed.

---
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix [bug 1317179](https://bugzilla.mozilla.org/show_bug.cgi?id=1317179).
- [X] These changes do not require tests because there are existing tests for this in mozilla-central

<!-- 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/14404)
<!-- Reviewable:end -->
2016-11-30 20:12:28 -08:00
Patrick Walton
ca3d802f03 layout: Minor style cleanup. 2016-11-30 16:36:02 -08:00
Patrick Walton
89dff2d77f layout: Don't restart a transition if the end value for the new
transition is the same as the end value for a running transition per
CSS-TRANSITIONS § 3.

Besides being contrary to spec, the old behavior could cause a cascade
of CSS transitions incorrectly triggering themselves when calls to
`getComputedStyle()` were intermingled with them.

Improves performance of nytimes.com.
2016-11-30 16:36:02 -08:00
Thiago Pontes
206f4ea5b8 use Either type for UrlOrNone
fix test-tidy errors

fix style unit test

use the Parse trait instead of ParseWithContext

fix stylo test and geckolib build

move all specified url parse code to parse trait and remove refs to unused type
2016-11-30 11:43:14 -05:00
bors-servo
b3cdcfaa39 Auto merge of #14410 - canaltinova:stylo-things, r=Manishearth
Implement 3 more properties for stylo

<!-- Please describe your changes on the following line: -->
Implemented these new properties:

1. Implemented parsing/serialization and stylo glue for `background-blend-mode`.
2. Made `align-items` work for stylo.
3. Implemented parsing/serialization for `-moz-column-rule`.

---
<!-- 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] These changes do not require tests because it's stylo 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/14410)
<!-- Reviewable:end -->
2016-11-30 04:15:19 -08:00
Nazım Can Altınova
ea507aa1d3 Implement column-rule shorthand for stylo 2016-11-30 00:52:12 +03:00
Nazım Can Altınova
a067c46e96 Implement background-blend-mode and make align-items work in stylo 2016-11-30 00:52:10 +03:00
bors-servo
a88487f96a Auto merge of #14399 - Manishearth:feat-offset-logical, r=SimonSapin
Support offset- logical properties

I didn't realize that these map to the top/left/bottom/right physical properties. We can just implement them.

r? @SimonSapin

<!-- 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/14399)
<!-- Reviewable:end -->
2016-11-29 09:27:42 -08:00
Manish Goregaokar
1bd6e5ff9b Support offset- logical properties 2016-11-29 09:27:13 -08:00
Xidorn Quan
599eb1c9f0 Move Arc<RwLock<_>> out from CssRules tuple 2016-11-29 22:15:13 +11:00
bors-servo
40917e7991 Auto merge of #14395 - servo:stylesheet-metadata, r=Manishearth
Use stylesheet’s base URL and ns prefixes in CSSOM insert/appendRule.

<!-- 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
- [ ] These changes do not require tests because _____

<!-- 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/14395)
<!-- Reviewable:end -->
2016-11-29 01:28:06 -08:00