Commit graph

19386 commits

Author SHA1 Message Date
Emilio Cobos Álvarez
e149059608
style: Fix build / unit tests. 2018-07-01 00:54:30 +02:00
Emilio Cobos Álvarez
fc5dbc1bae
style: Remove stray newline. 2018-07-01 00:11:08 +02:00
Emilio Cobos Álvarez
c2d21a8497
style: Serialize content properties using Servo.
Bug: 1472443
Reviewed-by: xidorn
Differential Revision: https://phabricator.services.mozilla.com/D1901
2018-07-01 00:10:46 +02:00
Emilio Cobos Álvarez
856924f167
style: Make StyleContentType an enum class.
Most of it is automated by:

  %s/eStyleContentType_/StyleContentType::/g
  %s/nsStyleContentType/StyleContentType/g

But I removed some parentheses by hand.

Bug: 1472443
Reviewed-by: xidorn
Differential Revision: https://phabricator.services.mozilla.com/D1900
2018-07-01 00:10:31 +02:00
Emilio Cobos Álvarez
28c9820dd9
style: Expose logical props in computed style.
Bug: 1116638
Reviewed-by: xidorn
Differential Revision: https://phabricator.services.mozilla.com/D1862
2018-07-01 00:10:13 +02:00
Olli Pettay
6483a89848
if ExtendedDOMSlots are used before slots, use FatSlots to have fewer allocations.
Bug: 1419661
2018-07-01 00:09:54 +02:00
Gerald Squelart
8488875a56
style: Removed layout.css.all-shorthand.enabled pref.
The 'all' shorthand has shipped a long time ago, so this pref is not needed
anymore.

Bug: 1459524
Reviewed-by: heycam
MozReview-Commit-ID: GND8qSVAfCG
2018-07-01 00:09:38 +02:00
Emilio Cobos Álvarez
e6d62b685b
style: Make :host() and ::slotted() account for the inner selector's specificity.
As resolved in https://github.com/w3c/csswg-drafts/issues/1915.

Bug: 1454165
Reviewed-by: xidorn
Differential Revision: https://phabricator.services.mozilla.com/D1849
2018-07-01 00:09:08 +02:00
Olli Pettay
8688c53f07
style: Unconditionally enable :defined in chrome.
Bug: 1471871
Reviewed-by: emilio
2018-07-01 00:08:48 +02:00
Olli Pettay
b68e4c2352
style: Implement :defined pseudo-class for custom elements.
Bug: 1331334
Reviewed-by: emilio
2018-07-01 00:08:33 +02:00
Emilio Cobos Álvarez
06fa3406de
style: Put offset-* aliases behind a pref.
Bug: 1464782
Reviewed-by: xidorn
MozReview-Commit-ID: Hl6Muim3wVH
2018-07-01 00:08:20 +02:00
Emilio Cobos Álvarez
65953fb158
style: Rename offset-* logical properties to inset-*.
Bug: 1464782
Reviewed-by: xidorn
MozReview-Commit-ID: BW44sru99RF
2018-07-01 00:08:09 +02:00
Xidorn Quan
ce0496e116
style: Generate ComputedStyleMap entry list from property data.
This changes the order of properties returned from gCS. The old order
doesn't make much sense, and other browsers don't agree on an identical
order either, so it should be trivial to change it. Also the spec isn't
super clear / useful in this case.

Several -moz-prefixed properties are excluded from the list due to their
being internal. I suspect they are never accessible anyway, so probably
nothing gets changed by this.

Bug: 1471114
Reviewed-by: xidorn
MozReview-Commit-ID: 9LfangjpJ3P
2018-07-01 00:07:50 +02:00
Xidorn Quan
9d1ae1840f
style: Upgrade cssparser.
Bug: 1471104
MozReview-Commit-ID: 74rBgkJEcYd
2018-07-01 00:07:36 +02:00
Xidorn Quan
26a9c9f53c
style: Remove location from preludes and take it from argument.
Bug: 1471104
Reviewed-by: emilio
MozReview-Commit-ID: HeJUQvkacaf
2018-07-01 00:07:20 +02:00
Xidorn Quan
0d0c6bd29e
style: Use RUSTFMT env in stylo build script.
Bug: 1471486
Reviewed-by: emilio
MozReview-Commit-ID: JOg0xkmG5Yx
2018-07-01 00:07:01 +02:00
Emilio Cobos Álvarez
07456bbd3d
style: Simplify selector serialization.
Bug: 1471063
Reviewed-by: xidorn
MozReview-Commit-ID: 959U7yd5W9j
2018-07-01 00:06:48 +02:00
Emilio Cobos Álvarez
84280c5203
style: Deindent the serialization loop.
Bug: 1471063
Reviewed-by: xidorn
MozReview-Commit-ID: GPlUAx7YXVb
2018-07-01 00:06:35 +02:00
Emilio Cobos Álvarez
aca724ec79
style: Remove unneeded combinator check in selector-matching.
The combinator doesn't change during the loop, no need to check it.

Bug: 1471063
Reviewed-by: xidorn
MozReview-Commit-ID: KIAt0WiEOtI
2018-07-01 00:06:17 +02:00
Hiroyuki Ikezoe
2274f392d8
style: Try to allocate possible size for AnimationValueMap before composing.
The EffectSet count does not exactly represent the count what we really need
for AnimationValueMap, but in most cases it matches.  For example;

1) The element has two different keyframes animations

 @keyframes anim1 {
   to { opacity: 0; }
 }
 @keyframes anim2 {
   to { transform: rotate(360deg); }
 }

 In this case the number matches.

2) The element has two animations but both keyframes have the same CSS property

 @keyframes anim1 {
   to { opacity: 0; }
 }
 @keyframes anim2 {
   to { opacity: 0.1; }
 }

 In this case the number doesn't match, moreover it results more memory than we
 ever needed, but this case is presumably less common.

3) The element has an animation having keyframes for two different CSS
   properties.

 @keyframes anim {
   from { opacity: 0; transform: rotate(360deg); }
 }

 In this kind of cases, the number doesn't match.  But even so, this patch
 reduces the opportunities that the AnimationValueMap tries to allocate a new
 memory (i.e. less opportunities on expanding the map).

Note that when the hash map is expanded, we do allocate a new RawTable with the
new size then replace the old one with the new one [1], so I believe this
change will reduce the crash rate to some extent.

[1] https://hg.mozilla.org/mozilla-central/file/15c95df467be/servo/components/hashglobe/src/hash_map.rs#l734

Bug: 1418806
Reviewed-by: birtles
MozReview-Commit-ID: 6tcF9aqXh7a
2018-07-01 00:05:46 +02:00
Hiroyuki Ikezoe
d307b34be0
style: Introduce a constant variable to represents the number of all animatable longhands.
We will use this number to cap the pre-allocation AnimationValueMap in the next
patch.

Bug: 1418806
MozReview-Commit-ID: Iqq9plbD8Vl
2018-07-01 00:05:29 +02:00
Emilio Cobos Álvarez
fa7d9bf74a
style: Add namespace bucket for the selector map.
After bug 1470163 we have some nasty selectors from mathml.css in every page.

We only want to match them against MathML elements.

This patch brings the global revalidation selectors from 14 to 2 in about:blank.
Also halves the ones from XUL documents.

Bug: 1374017
Reviewed-by: heycam
MozReview-Commit-ID: nOVyknNcVm
2018-07-01 00:05:12 +02:00
Emilio Cobos Álvarez
2d2e84aad5
style: Error reporting fixes for media queries.
Do it so that we always try to evaluate the media expression and the modern
syntax last, so that the most specific error message comes up.

Bug: 1422225
Reviewed-by: xidorn
MozReview-Commit-ID: 2tqdAsWh6Kh
2018-07-01 00:04:48 +02:00
Emilio Cobos Álvarez
3a92fd1cfc
style: Evaluate MediaConditions, and glue it all together.
Bug: 1422225
Reviewed-by: xidorn
MozReview-Commit-ID: 3MThE2FvfDf
2018-07-01 00:04:35 +02:00
Emilio Cobos Álvarez
d2a1895752
style: Add serialization code for MediaCondition.
Bug: 1422225
Reviewed-by: xidorn
MozReview-Commit-ID: AxQQottV1hG
2018-07-01 00:04:21 +02:00
Emilio Cobos Álvarez
0b49a3701a
style: Add code to parse media conditions.
Still unused.

Bug: 1422225
Reviewed-by: xidorn
MozReview-Commit-ID: IQfxObw9BV5
2018-07-01 00:04:07 +02:00
Emilio Cobos Álvarez
e7cc548c35
style: Rename Expression to MediaFeatureExpression.
Which is more appropriate, given it represents a `<media-feature>` per spec, and
expression is a bit overloaded :)

Bug: 1422225
Reviewed-by: xidorn
MozReview-Commit-ID: Fed1nJhHxDu
2018-07-01 00:03:54 +02:00
Emilio Cobos Álvarez
ef14e65636
style: Allow parsing operators in media feature expressions.
The only bit from the spec which I haven't implemented to my knowledge is the
bit that allows you to swap the position of the media feature and the value,
because it unnecessarily complicates parsing (we parse the value in terms of the
feature), and I don't think it's useful given how easy it is to switch from,
e.g., `(500px > width)` to `(width <= 500px)`.

I filed https://github.com/w3c/csswg-drafts/issues/2791 about it.

Bug: 1422225
Reviewed-by: xidorn
MozReview-Commit-ID: 6xrdVl87S9X
2018-07-01 00:03:38 +02:00
Dan Glastonbury
a055e8af89
style: Change nscolor to StyleComplexColor in nsCSSShadowItem.
Bug: 1467621
Reviewed-by: xidorn
MozReview-Commit-ID: moE2CI7fT8
2018-07-01 00:03:11 +02:00
bors-servo
e2fca1b228
Auto merge of #20892 - gw3583:update-wr, r=mbrubeck
Update WR (transaction API change)

<!-- 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/20892)
<!-- Reviewable:end -->
2018-06-26 17:27:31 -04:00
Martin Robinson
7d672555be Give stacking contexts the right reference frame id
Stacking contexts that create reference frames should be created with
the positioning node set to the reference frames that surround them.
2018-06-25 07:35:26 +10:00
Martin Robinson
253117ece6 New reference frames should create containing blocks
Transforms should always create containing blocks. This bug already
existed in Servo, but was covered up by the reference frame id
replacement feature in WebRender. Now that we create reference frames
manually we need to fix it.
2018-06-25 07:35:19 +10:00
Martin Robinson
d41c512e98 Allow inline elements to create reference frames
This is important so that transforms applied to elements actually apply
to the display items created for those elements.
2018-06-25 07:35:10 +10:00
bors-servo
16bdf9225d
Auto merge of #21088 - emilio:gecko-sync, r=emilio
style: Import changes from mozilla-central.

See each individual commit for details.
2018-06-23 14:43:07 -04:00
Emilio Cobos Álvarez
895946bb18
layout: script: Fix build. 2018-06-23 20:34:10 +02:00
Emilio Cobos Álvarez
750c223021
style: Fix tidy. 2018-06-23 20:34:10 +02:00
Emilio Cobos Álvarez
26720e10a9
style: Fix servo build. 2018-06-23 20:34:10 +02:00
Emilio Cobos Álvarez
82db42390d
style: Better debugging for media-query related code and ua-cache.
Bug: 1470145
Reviewed-by: xidorn
MozReview-Commit-ID: 3XHAxK2BOTS
2018-06-23 20:37:16 +02:00
Emilio Cobos Álvarez
f564b32b75
style: Better debugging for stylesheets and URLs.
Bug: 1470145
Reviewed-by: xidorn
MozReview-Commit-ID: FIcz2K1ZYX0
2018-06-23 20:37:03 +02:00
Nicholas Nethercote
46e572a497
Store nsDynamicAtom's chars after the end of the object.
This reduces memory usage because we only need one allocation instead of two
for the dynamic atom and its chars, and because we don't need to store a
refcount and a size. It precludes sharing of chars between dynamic atoms, but
we weren't benefiting much from that anyway.

This reduces per-process memory usage by up to several hundred KiB on my
Linux64 box.

One consequence of this change is that we need to allocate + copy in
DOMString::SetKnownLiveAtom(), which could make some things slower.

Bug: 1447951
Reviewed-by: froydnj
2018-06-23 20:36:41 +02:00
Emilio Cobos Álvarez
ce7b6616fb
style: Fix a typo in stylesheet cloning.
Summary: Just something I noticed while writing unrelated code.

Reviewers: jwatt

Bug #: 1470105

Differential Revision: https://phabricator.services.mozilla.com/D1747

MozReview-Commit-ID: 7KMTT9Kmdwc
2018-06-23 20:36:32 +02:00
Emilio Cobos Álvarez
3a0c3224b9
style: Move the error reporter into ParserContext.
Summary:
This should make it easier to report errors, and also reduce codesize.

The reason this was so generic is that error reporting was unconditionally
enabled and was super-hot, but now that's no longer the case after bug 1452143,
so we can afford the virtual call in the "error reporting enabled" case.

This opens the possibility of simplifying a lot the error setup as well, though
this patch doesn't do it.

Test Plan: No behavior change, so no new tests.

Reviewers: xidorn

Bug #: 1469957

Differential Revision: https://phabricator.services.mozilla.com/D1734

MozReview-Commit-ID: F3wTdhX9MB5
2018-06-23 20:36:23 +02:00
Emilio Cobos Álvarez
bab7be63b2
style: Fix windows build bustage.
Bug: 1468651
MozReview-Commit-ID: 9Xj5lMFG4Ab
2018-06-23 20:36:13 +02:00
Emilio Cobos Álvarez
202ec8a8c8
style: Generate different files for different structs.
Bug: 1468651
Reviewed-by: heycam
MozReview-Commit-ID: KEDJ1zJVwMx
2018-06-23 20:36:02 +02:00
Emilio Cobos Álvarez
a4dcb33986
style: Make StyleStruct.name_lower snake case.
Bug: 1468651
Reviewed-by: heycam
MozReview-Commit-ID: A3TpDTmFgF
2018-06-23 20:35:49 +02:00
Emilio Cobos Álvarez
4571a71bfc
style: Rename mask.mako.rs to svg.mako.rs for consistency.
Bug: 1468651
Reviewed-by: heycam
MozReview-Commit-ID: 6sqGxL8hhA0
2018-06-23 20:35:37 +02:00
Emilio Cobos Álvarez
0a95513368
style: Rename the properties directories from "shorthand" to "shorthands", "longhand" to "longhands".
Bug: 1468651
Reviewed-by: heycam
MozReview-Commit-ID: CY4THCC4zkX
2018-06-23 20:35:18 +02:00
Emilio Cobos Álvarez
5c15c59f56
style: remove shorthand/serialize.mako.rs.
Bug: 1468651
Reviewed-by: heycam
MozReview-Commit-ID: 8Xyep2Q7trR
2018-06-23 20:35:03 +02:00
Emilio Cobos Álvarez
3b90ddd5d1
style: Fix the broken invariants of the rule node cache.
We were spuriously reframing the <shadow> because it initially shared style with
the <br>, which ended up being display: none, while the <shadow> should've been
display: contents from the beginning.

lookup_by_rules seems pretty prone to obscure bugs, and also it's pretty
complex... Probably we should try to get rid of it, I'm unconvinced that it's
worth it.

Even with that, in a normal restyle the <details> wouldn't have ended up with a
style. It of course never had it before the reframe because the <shadow> was
display: none, but that doesn't mean it shouldn't have gotten one, since we
detected we needed to go through kids in:

  https://searchfox.org/mozilla-central/rev/6eea08365e7386a2b81c044e7cc8a3daa51d8754/servo/components/style/matching.rs#500

That code did happen, but since it's an animation-only restyle, we don't look at
unstyled stuff.

That looks somewhat fishy, but I guess for now it's fine as long as display
isn't animatable.

Bug: 1469076
Reviewed-by: heycam
MozReview-Commit-ID: B6NMSTNOKgK
2018-06-23 20:34:50 +02:00
Xidorn Quan
8db8f95f1f
style: Add scrollcorner to -moz-appearance so that widget can render it.
Bug: 1463917
Reviewed-by: heycam
MozReview-Commit-ID: 1Za22ifONfG
2018-06-23 20:34:26 +02:00