Commit graph

7437 commits

Author SHA1 Message Date
Bastien Orivel
71fd4477d6 Dedupe num-traits 2018-08-09 18:26:28 +02:00
Emilio Cobos Álvarez
689293e4fb
Fix Servo build. 2018-08-08 01:34:35 +02:00
Emilio Cobos Álvarez
6c5456b4b6
Appease tidy. 2018-08-08 01:34:35 +02:00
Emilio Cobos Álvarez
ffae32f844
style: Fixup some indentation. 2018-08-08 01:37:57 +02:00
Emilio Cobos Álvarez
0ae47b2659
style: Cleanup invalidation processor constructor.
It used to be this way because of lifetime issues (plus the shadow
datas were in RwLocks at some point IIRC). Now we guarantee that as long as the
element is away the cascade data is as well, so we don't need to thread it
around.

Differential Revision: https://phabricator.services.mozilla.com/D2768
2018-08-08 01:37:50 +02:00
Emilio Cobos Álvarez
bbcd7e414a
style: Remove unused selectors methods.
Differential Revision: https://phabricator.services.mozilla.com/D2767
2018-08-08 01:37:45 +02:00
Emilio Cobos Álvarez
489e224cb6
style: Don't print rerun-if-changed files until binding generation has succeeded.
Otherwise they may clobber useful output.

Differential Revision: https://phabricator.services.mozilla.com/D2783
2018-08-08 01:37:37 +02:00
Olli Pettay
87deddb631
style: Change storage of previous and next children in nsINode. 2018-08-08 01:37:28 +02:00
Emilio Cobos Álvarez
888ad3eabe
style: Restrict XUL tree pseudos on nightly and early-beta.
Differential Revision: https://phabricator.services.mozilla.com/D2598
2018-08-08 01:37:20 +02:00
Emilio Cobos Álvarez
998e6f1797
style: Remove the concept of 'canonical' pseudos.
We only have this so that ::-moz-placeholder keeps serializing as
::-moz-placeholder, but I don't think anybody really cares.

Edge aliases ::-webkit-input-placeholder to ::-ms-input-placeholder at parse
time as well, as can be seen in:

```
let s = document.createElement('style');
s.innerHTML = `input::-webkit-input-placeholder { color: red };`;
document.body.appendChild(s);
document.body.innerHTML = s.sheet.cssRules[0].cssText;
```

And I think this is more consistent with what we do for CSS properties that are
aliases.

Differential Revision: https://phabricator.services.mozilla.com/D2595
2018-08-08 01:37:07 +02:00
Cameron McCormack
62419adaaa
style: Shrink selectors::Component to 24 bytes.
This saves about 37 KiB of memory across the UA style sheets.

Bug: 1475197
Reviewed-by: emilio
2018-08-08 01:36:53 +02:00
Jonathan Watt
b05ace3e4a
style: Add a '-moz-menulist-button' value to '-moz-appearance'.
The '-moz-menulist-button' value currently behavies identically to the
'menulist-button' value.  This is not implemented as an alias because later
patches in this patch series will change the behavior of our pre-existing
'menulist-button' value to more closely match what Chrome does.

Bug: 1428676
Reviewed-by: emilio
2018-08-08 01:36:33 +02:00
Emilio Cobos Álvarez
bee7cbad0d
style: Micro-optimize is_root to avoid poking at the parent in the common case.
We can discard the common case of an element having another element or document
fragment parent, which is the common case.

Then we can discard detached subtrees looking at is_in_document().

The only case where we have a non-content parent is the document case:

  https://searchfox.org/mozilla-central/rev/033d45ca70ff32acf04286244644d19308c359d5/dom/base/Element.cpp#1683

Differential Revision: https://phabricator.services.mozilla.com/D2505
2018-08-08 01:36:25 +02:00
Emilio Cobos Álvarez
eb49995737
style: Convert GetStringValue to use Servo.
And remove gPropertyTable / kCSSRawProperties while at it.

Differential Revision: https://phabricator.services.mozilla.com/D2516
2018-08-08 01:36:18 +02:00
Emilio Cobos Álvarez
694d00eb5e
style: Implement nsCSSProps::LookupProperty using Rust.
Always assume allowed-for-all-content. There are a couple callers which weren't
doing that:

 * A unit test -> removed.

 * ComputeAnimationDistance: Used for testing (in transitions_per_property), and
   for the animation inspector. The animation inspector shouldn't show
   non-enabled properties. The transitions_per_property test already relies on
   getComputedStyle stuff which only uses eForAllContent.

 * GetCSSImageURLs: I added this API for the context menu page and such. It
   doesn't rely on non-enabled-everywhere properties, it was only using
   eInChrome because it was a ChromeOnly API, but it doesn't really need this.

Differential Revision: https://phabricator.services.mozilla.com/D2514
2018-08-08 01:36:10 +02:00
Emilio Cobos Álvarez
c3289ad46e
style: Improve logging for attribute changes.
And general Element logging. We now print all the attributes for comparison.

If this turns out to be too verbose we can change it to diff them or something.

Differential Revision: https://phabricator.services.mozilla.com/D2471
2018-08-08 01:36:03 +02:00
Emilio Cobos Álvarez
2e3aacdf80
style: Add a root bucket to the selector map.
:root can't change without getting unbound from the tree so no fancy stuff other
than that needed.

This removes a lot of revalidation and attribute invalidation matching from the
Chrome, and looks like it should be a good idea in general.

Differential Revision: https://phabricator.services.mozilla.com/D2462
2018-08-08 01:35:54 +02:00
Emilio Cobos Álvarez
0b520c9558
style: Make NonCustomPropertyId <-> nsCSSPropertyId conversions fast.
We have a different order in nsCSSPropertyId for no good reason. The only
invariant there is that longhands come before shorthands, and shorthands before
aliases.

Luckily that's also an invariant that NonCustomPropertyId has, so we can reuse
them.

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

MozReview-Commit-ID: 1hsQu6hmqiN
2018-08-08 01:35:48 +02:00
Emilio Cobos Álvarez
5a7358b833
style: Restore the order of Scrollbarbutton appearance values.
The patch at bug 1478391 comment 6 changed the way the math in Scrollbarbutton*
worked, which pretty surely caused this.

Restore the original order and math to be the same as before bug 1478391.

Bug: 1479216
Reviewed-by: xidorn
MozReview-Commit-ID: CK3iOqeX2NW
2018-08-08 01:35:34 +02:00
Nicholas Nethercote
fc9df0bcf3
style: Convert FnvHash{Set,Map} instances to FxHash{Set,Map}.
Bug: 1477628
Reviewed-by: heycam
2018-08-08 01:34:35 +02:00
Emilio Cobos Álvarez
0cab212052
style: Autogenerate StyleAppearance.
This builds on bug 1428676 and introduces StyleAppearance, which replaces the
NS_THEME_* constants.

Really sorry for the size of the patch.

There's a non-trivial change in the gtk theme, which I submitted separately as
bug 1478385.

Differential Revision: https://phabricator.services.mozilla.com/D2361
2018-08-08 01:35:08 +02:00
Emilio Cobos Álvarez
798d45f38d
style: Generate StyleDisplay using cbindgen.
We use the same setup WR uses, which is checking-in the files.

But I think it's much better than keeping the two things in sync manually :)

When you add a new value, you need to add it to the rust source, then run the
command, but since it doesn't need to build the style crate (it uses the Rust
AST, doesn't build) there's no problem.

Differential Revision: https://phabricator.services.mozilla.com/D2354
2018-08-08 01:34:49 +02:00
Hiroyuki Ikezoe
c63a9a37a9
style: Introduce nsCSSKeywordAndBoolTableEntry.
The values in the boolean context depend on its feature.  For examples, in the
case of prefers-reduced-motion 'no-preference' means false and 'reduced' mean
true in the boolean context, whereas in the case of prefers-contrast
'no-preference' means false and other two values, 'high' and 'low' means true
in the boolean context.  To support it we introduce a child struct of
nsCSSKTableEntry that has an additional field representing the value in the
boolean context and use it when we have no specified value in the media feature
(i.e. in the boolean context).

Bug: 1365045
Reviewed-by: heycam
MozReview-Commit-ID: 79HiW8l5ous
2018-08-08 01:34:35 +02:00
Paul Rouget
0d9161dd7b WR update 2018-08-06 07:22:24 +02:00
Fernando Jiménez Moreno
1649b6a528 Fix build errors after rebase 2018-07-30 14:23:45 +02:00
Emilio Cobos Álvarez
658b8e3312
style: Appease tidy. 2018-07-24 03:58:16 +02:00
Emilio Cobos Álvarez
1716259a3a
style: Fix servo build. 2018-07-24 03:38:14 +02:00
Emilio Cobos Álvarez
3a0c8fc760
style: Avoid getting zero normalized vector of rotate3d for animations.
If we have a rotate axis whose length is extremely large, we will get an
infinite value, and its normalized vector is a zero vector, instead of an
unit vector, i.e. (x/inf, y/inf, z/inf) == (0, 0, 0).

The solution is: we scale the vector, so the length becomes a finite value, and
we could get a valid unit vector.

Therefore, we use a different normalization method, robust_normalize().

Bug: 1467277
Reviewed-by: hiro
2018-07-24 03:26:12 +02:00
Ting-Yu Lin
0c0ffef1a5
style: Convert NS_STYLE_COLUMN_SPAN_* to an enum class.
Bug: 1477533
Reviewed-by: heycam
MozReview-Commit-ID: F8M1DlpBop2
2018-07-24 03:31:53 +02:00
Ting-Yu Lin
23b1d4d640
style: Convert NS_STYLE_COLUMN_FILL_* to an enum class.
I put Balance as the first item in StyleColumnFill because it is the default
value.

Bug: 1477533
Reviewed-by: heycam
MozReview-Commit-ID: A4DVMLL6XBa
2018-07-24 03:31:41 +02:00
Ting-Yu Lin
9f5237b87c
style: Use static const class variable to represent column-count: auto.
NS_STYLE_COLUMN_COUNT_UNLIMITED is unused, so I remove it.

Bug: 1477533
Reviewed-by: heycam
MozReview-Commit-ID: HLHLn9ZbkUY
2018-07-24 03:31:24 +02:00
Emilio Cobos Álvarez
77f47eea34
style: Hide display: -moz-box|-moz-inline-box from content on Nightly and early beta.
Bug: 1477553
Differential Revision: https://phabricator.services.mozilla.com/D2288
2018-07-24 03:31:12 +02:00
Emilio Cobos Álvarez
7e77f4dd4e
style: Add @-moz-document media-document(image|video|plugin).
Bug: 1475511
Reviewed-by: xidorn
MozReview-Commit-ID: CD3O1vGLAoV
2018-07-24 03:30:59 +02:00
Emilio Cobos Álvarez
5634a3f670
style: Make document condition parsing a bit nicer.
Bug: 1475511
Reviewed-by: xidorn
MozReview-Commit-ID: Gi0FxrEAYcE
2018-07-24 03:30:46 +02:00
Emilio Cobos Álvarez
095841db7f
style: UrlMatchingFunction -> DocumentMatchingFunction.
Bug: 1475511
Reviewed-by: xidorn
MozReview-Commit-ID: HLcaVmehFW7
2018-07-24 03:30:33 +02:00
Emilio Cobos Álvarez
02d27ad3dd
style: Make svg:use use an actual shadow tree.
This fixes a couple fuzz bugs and prevents special-casing <svg:use> even more in
bug 1431255.

Unfortunately not as many hacks went away as I'd have hoped, since we still need
to match document rules, see the linked SVGWG issues.

But blocks_ancestor_combinators goes away, which is nice since it's on a very
hot path.

Bug: 1450250
Reviewed-by: heycam
Differential Revision: https://phabricator.services.mozilla.com/D2154

MozReview-Commit-ID: C4mthjoSNFh
2018-07-24 03:30:12 +02:00
Xidorn Quan
1a91beaf57
style: Remove DeclarationPushMode.
Bug: 1473180
Reviewed-by: emilio
MozReview-Commit-ID: LFgYeKE1SNk
2018-07-24 03:29:59 +02:00
Xidorn Quan
a0edeb1a92
style: Remove DeclarationPushMode::Update and related code.
Bug: 1473180
Reviewed-by: emilio
MozReview-Commit-ID: 1fI5YRa54lQ
2018-07-24 03:29:42 +02:00
Xidorn Quan
b14b2beaad
style: Add new algorithm for setting property to be used in later commit.
Bug: 1473180
Reviewed-by: emilio
MozReview-Commit-ID: CdM8hDB6rFj
2018-07-24 03:29:28 +02:00
Xidorn Quan
d245f8b579
style: Introduce a concept of logical group.
Bug: 1473180
Reviewed-by: emilio
MozReview-Commit-ID: GXlf8JNML4N
2018-07-24 03:29:15 +02:00
Emilio Cobos Álvarez
08dcd7fca0
style: Remove IS_STYLE_IF_VISITED.
Bug: 1474959
Reviewed-by: xidorn
MozReview-Commit-ID: 8rnlaMOJisA
2018-07-24 03:29:03 +02:00
Emilio Cobos Álvarez
4e1606bfaf
style: Push visited style computation a bit further down.
Bug: 1474959
Reviewed-by: xidorn
MozReview-Commit-ID: 1DILenWIw4D
2018-07-24 03:28:50 +02:00
Emilio Cobos Álvarez
45435a57e9
style: Cleanup might_need_transitions_update.
Thought I had to update this as well, but nope. When basically any style changes
we already update transitions.

needs_transitions_update already handles the physical mapping changing by
checking whether any transition for the physical property remain there or not.

Bug: 1309752
Reviewed-by: birtles
MozReview-Commit-ID: 6vKwal4yzRU
2018-07-24 03:28:36 +02:00
Emilio Cobos Álvarez
856e5d1db6
style: Update animations if the logical to physical property mapping changes.
Bug: 1309752
Reviewed-by: birtles
MozReview-Commit-ID: 1lbOcniojVO
2018-07-24 03:28:23 +02:00
Emilio Cobos Álvarez
5504cbdfd7
style: Animate logical properties.
The setup is that AnimationValue only contains physical properties, and
we physicalize when building keyframes and transitions.

Bug: 1309752
Reviewed-by: birtles
MozReview-Commit-ID: 9dI20N0LFrk
2018-07-24 03:28:10 +02:00
Emilio Cobos Álvarez
be9acba801
style: Introduce PropertyDeclaration::to_physical.
Bug: 1309752
Reviewed-by: heycam
MozReview-Commit-ID: FAL04K5G948
2018-07-24 03:27:56 +02:00
Sylvestre Ledru
498592ff61
style: autopep8
Bug: 1468273
Reviewed-by: ted
MozReview-Commit-ID: 8j8EU3E08GP
2018-07-24 03:26:12 +02:00
Bastien Orivel
ba9cbd87fb Update parking_lot to 0.6 2018-07-20 00:44:08 +02:00
bors-servo
e57187305f
Auto merge of #21181 - nupurbaghel:update_source_set, r=jdm
Implement update source set & select image source

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

- [x] These changes require tests but cannot be written until implementation of responsive images is complete

<!-- 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/21181)
<!-- Reviewable:end -->
2018-07-19 08:18:12 -04:00
nupurbaghel
8d06da8afd implement update_source_set, select_image_source 2018-07-19 09:20:46 +05:30