Commit graph

40 commits

Author SHA1 Message Date
bors-servo
81f6b9a1c7 Auto merge of #17539 - jyc:simplify-an-b, r=emilio
Simplify <an+b> in selector args when serializing.

<!-- 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 am running this to identify what tests will fail; as the other PRs in the series are merged, I believe the tests that pass will change as well.

- [ ] 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/17539)
<!-- Reviewable:end -->
2017-07-19 03:59:50 -07:00
Jonathan Chan
f0e83f6d8a Simplify <an+b> in selector args when serializing. 2017-07-18 11:53:52 -07: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
bors-servo
559c0d1d90 Auto merge of #17501 - jyc:Text-children_changed, r=emilio
Have CharacterData call children_changed on its parent when data is set.

**Can't run WPT on my computer, so pushing here to run tests 😢**

Have CharacterData.SetData call children_changed on its parent when
data is set (if it is a Text node) so that HTMLStyleElement parents can
re-parse. Add variant ChildrenMutation::Text for it to use as the
mutation.

This fixes an issue where an empty <style> element's data is set but the
style is not updated. An HTMLStyleElement parent re-parses in its
children_changed implementation.

<!-- 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 are part of a series to fix #17182 (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/17501)
<!-- Reviewable:end -->
2017-07-13 14:00:13 -07:00
Jonathan Chan
4142665282 Have CharacterData call children_changed on its parent when data is set.
Have CharacterData.SetData call children_changed on its parent when
data is set (if it is a Text node) so that HTMLStyleElement parents can
re-parse. Add variant ChildrenMutation::Text for it to use as the
mutation.

This fixes an issue where an empty <style> element's data is set but the
style is not updated. An HTMLStyleElement parent re-parses in its
children_changed implementation.
2017-07-13 13:02:27 -07:00
Jonathan Chan
92ec8f15f0 Implement CSSStyleRule.selectorText.
We parse when assigning using the namespaces of the stylesheet. It isn't
clear if the spec says to do that (Firefox doesn't support the setter at
all, Chrome does, Safari doesn't); the spec issue is here:
https://github.com/w3c/csswg-drafts/issues/1511

Also fix ToCss implementation of AttrSelectorOperator to not pad with
spaces, to conform with CSSOM. This means we have to update some unit
tests that expect operators with spaces around them in attribute
selectors to roundtrip.

See the "attribute selector" section of "Serializing Selectors" here:
https://drafts.csswg.org/cssom/#serializing-selectors

CSSStyleRule.selectorText is specified here:
https://drafts.csswg.org/cssom/#dom-cssstylerule-selectortext
2017-07-12 01:03:58 -07:00
Xidorn Quan
7568a19688 Merge CSSColor into Color. 2017-06-08 12:59:22 +10:00
Tom Houlé
7ecee05e4a Style: Do not immediately convert absolute specified lengths
The NoCalcLength::Absolute variant has been rewritten to accommodate
other units than Au with the new AbsoluteLength enum. This avoids loss
of precision for some operations.

The conversion from floating point absolute lengths to integer
application unit values adopts the same clamping limits as Gecko.
2017-04-12 11:51:57 +08:00
Josh Matthews
8d9008e5a7 Enable a bunch of additional CSS tests, and remove ini files for directories that are skipped. 2017-02-15 12:04:50 -05:00
Atheed Thameem
17c74cf967 fix to ensure all font-weight keywords are preserved 2017-02-08 13:39:37 -05:00
Ms2ger
296fa2512b Update web-platform-tests and CSS tests.
- Update CSS tests to revision e05bfd5e30ed662c2f8a353577003f8eed230180.
- Update web-platform-tests to revision a052787dd5c069a340031011196b73affbd68cd9.
2017-02-06 22:38:29 +01:00
Manish Goregaokar
56731dc6b5 Update test expectations, enable css-conditional-3 tests 2017-01-07 23:17:54 -08:00
Keith Yeung
aa99f18806 Add WPT test for CSSStyleRule.style property 2016-12-18 15:23:06 -08:00
Keith Yeung
4738ce1af5 Implement CSSStyleRule.style 2016-12-17 23:03:40 -08:00
Emilio Cobos Álvarez
d4d4af9cf7
Update test expectations. 2016-12-16 16:57:21 +01:00
Nazım Can Altınova
c052835281 Implement MediaList interface 2016-12-02 23:46:40 +03:00
Ms2ger
b86965f394 Implement synchronous about:blank loading.
Based on initial work by jdm in <https://github.com/servo/servo/pull/8600>.
2016-11-30 11:26:35 +01:00
Cameron McCormack
64ff6dc103 Implement StyleSheet.disabled. 2016-11-25 11:27:51 +08:00
Manish Goregaokar
18742e72fa Update test expectations 2016-11-23 09:32:48 -08:00
Manish Goregaokar
262408d9cb Update test expectations 2016-11-23 09:30:34 -08:00
Manish Goregaokar
67a68bd1f6 Update test expectations 2016-11-15 06:58:11 -08:00
Ms2ger
ae38c53de7 Dispatch error events at the window object. 2016-09-02 11:44:44 +02:00
Anthony Ramine
6da56f7e67 Define interface members on the global object directly (fixes #4593) 2016-08-25 14:29:16 +02:00
Manish Goregaokar
f29b748a59 Fix serialization of initial/inherit shorthands 2016-08-22 22:42:44 +05:30
David Raifaizen
3831c0650c Adding support for correct shorthand serialization 2016-08-16 22:28:51 -04:00
Ms2ger
12fa92b4d6 Update CSS tests to revision 611d962e1b6ae62ec89ab994c9f787e84ce11b15 2016-06-06 15:47:08 +02:00
Glenn Watson
ff995d739c implement cssText 2016-05-31 19:32:30 -04:00
Maciej Skrzypkowski
43b72537dc Update cssparser to fix CSS.escape test failures
Fixed failing tests #10685
2016-05-06 13:54:26 +02:00
Ms2ger
5944add496 Note bugs. 2016-04-21 09:45:45 +02:00
Ms2ger
82e2d017ef Update wptrunner. 2016-04-21 09:45:44 +02:00
Ms2ger
7deaeea707 Update CSS tests to revision aac1cd51245c0c469325988a0446985a2f1e476c 2016-04-07 15:10:43 +02:00
Mohamed Albashir
b7a57ef487 Initial steps for CSSOM API 2016-03-31 18:17:30 -04:00
Ms2ger
349c75536d Update CSS tests to revision 7d0ff6117ee51720c307ea24d413d13eb5abf3e6 2016-03-01 19:09:10 +01:00
Ms2ger
35c74aecc2 Update CSS tests to revision 0698c2aa9ead844b6d7d10eafb096cb1118e13ef 2015-12-10 10:03:03 -05:00
David Zbarsky
d95ca55f26 Allow retrieving width/height for non-positioned elements 2015-11-03 20:13:09 -08:00
Ms2ger
145aea3eeb Update CSS tests to revision 7a87ef71fc579e52d3438e009107aa442bc4021b 2015-10-06 17:04:25 +02:00
Ms2ger
f235d49372 Update CSS tests to revision d674587d6ae7d2e231d632785559f2613d554eb0 2015-08-21 18:40:37 +02:00
David Zbarsky
a3ee46fc9c Make CSSStyleDeclaration setters rethrow errors instead of unwrapping and crashing. 2015-08-11 00:34:41 -04:00
David Zbarsky
fef2a33043 Enable CSSOM tests 2015-08-10 22:50:13 -04:00