Commit graph

26 commits

Author SHA1 Message Date
Ricky Stewart
8a723d48d5 Standardize on Black for Python code in mozilla-central.
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.

To produce this patch I did all of the following:

1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.

2. Run ./mach lint --linter black --fix

3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.

4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).


Differential Revision: https://phabricator.services.mozilla.com/D94045
2021-02-26 16:44:05 +01:00
Mike Hommey
07c1b39637 style: Convert GenerateServoCSSPropList.py to py3.
Differential Revision: https://phabricator.services.mozilla.com/D70308
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
31837a1efa
style: Make Rust static atoms able to be used in const contexts.
I see atom dropping code generated in release builds for stuff like dropping the
"class" atom here:

https://searchfox.org/mozilla-central/rev/4df8821c1b824db5f40f381f48432f219d99ae36/servo/components/style/gecko/wrapper.rs#592

That is silly, and I hope making Atom be able to be used in const context will
help the compiler see that yeah, we're not doing anything interesting and the
atom shouldn't get dropped.

It also allows us to get rid of a few lazy_static!s, so we should do it anyway.

In order to accomplish this, compute the offset into gGkAtoms manually instead
of going through the static_atoms() array and then back to the byte offset.

Differential Revision: https://phabricator.services.mozilla.com/D55039
2019-11-30 20:45:06 +01:00
Emilio Cobos Álvarez
3231714758 style: Include anon boxes in CSSPseudoElementType, to remove ComputedStyle::mPseudoTag.
This is more consistent with what the Rust bits of the style system do, and
removes a pointer from ComputedStyle which is always nice.

This also aligns the Rust bits with the C++ bits re. not treating xul pseudos as
anonymous boxes. See the comment in nsTreeStyleCache.cpp regarding those.

Can't wait for XUL trees to die.

Differential Revision: https://phabricator.services.mozilla.com/D19002
2019-02-23 21:04:03 -08:00
Emilio Cobos Álvarez
8101539c0a style: Document a few more macros. 2019-01-13 21:59:25 +01:00
Cameron McCormack
63fd707bd3 style: Use atom handles in favour of atom pointers in style system code.
Differential Revision: https://phabricator.services.mozilla.com/D15078
2019-01-11 00:50:26 +01:00
Jan Andre Ikenmeyer
1d6fe65401
Update MPL license to https (part 4) 2018-11-19 14:47:27 +01:00
Emilio Cobos Álvarez
f486ef7e47
style: Add an atom bit to know whether we're ascii lowercase.
And thus massively speed up ascii-case-insensitive atom comparisons when both
atoms are lowercase (which is the common case by far).

This removes almost all the slow selector-matching in this page, and it seems
an easier fix than storing the lowercased version of all class-names in quirks
mode in elements and selectors...

Differential Revision: https://phabricator.services.mozilla.com/D10945
2018-11-17 09:56:01 +01:00
Nicholas Nethercote
cd439df54f
style: Rename nsStaticAtom subclasses.
Specifically:
- nsICSSAnonBoxPseudo --> nsCSSAnonBoxPseudoStaticAtom
- nsICSSPseudoElement --> nsCSSPseudoElementStaticAtom

The `nsI` prefix isn't necessary because these are no longer XPIDL types, and
the `StaticAtom` suffix makes their meaning clearer.

Bug: 1497734
Reviewed-by: heycam
2018-10-19 00:34:02 +02:00
Nicholas Nethercote
0d5d5a9c82
style: Make static atom pointers constexpr.
This saves one word per static atom, per process.

The `nsGkAtoms` change is only a small part of this commit.

In regen_atoms.py:

- There is now only one link name per platform: nsGkAtoms::sAtoms[].

- But there is a new constant per atom, giving the index into
  nsGkAtoms::sAtoms[].

- And the `atom!` macro for each atom indexes into nsGkAtoms::sAtoms[] using
  the index constant.

- A couple of `*mut` pointers are now `*const`.

Elsewhere, the `(nsStaticAtom*)` casts within the `AppendElement()` calls are
necessary to avoid link errors, presumably due to some template instantiation
wrinkle.

Bug: 1449787
Reviewed-by: froydnj,emilio
2018-10-09 19:45:10 +02:00
Nicholas Nethercote
c276c8a341
style: Tweak regen_atoms.py.
Specifically, give all the string templates the ''' form, and give them all
`_TEMPLATE` suffixes. This requires slightly changing the newline handling.

Bug: 1449787
Reviewed-by: emilio
2018-10-09 19:44:45 +02:00
Cameron McCormack
cc1897597c
style: Generate static atom hash in StaticAtoms.py.
Differential Revision: https://phabricator.services.mozilla.com/D3295
2018-08-18 17:54:54 +02:00
Cameron McCormack
f86e9a411a
style: Remove support for multiple static atom sources.
Differential Revision: https://phabricator.services.mozilla.com/D3285
2018-08-18 17:54:54 +02:00
Cameron McCormack
f75419dd7a
style: Move CSS anonymous box atoms to nsGkAtoms.
Differential Revision: https://phabricator.services.mozilla.com/D3284
2018-08-18 17:54:54 +02:00
Cameron McCormack
99a292dd6d
style: Move CSS pseudo-element atoms to nsGkAtoms.
Differential Revision: https://phabricator.services.mozilla.com/D3283
2018-08-18 17:54:54 +02:00
Cameron McCormack
cc3c059bfc
style: Define atom type in nsGkAtomList.h.
Differential Revision: https://phabricator.services.mozilla.com/D3282
2018-08-18 17:54:54 +02:00
Sylvestre Ledru
498592ff61
style: autopep8
Bug: 1468273
Reviewed-by: ted
MozReview-Commit-ID: 8j8EU3E08GP
2018-07-24 03:26:12 +02:00
Emilio Cobos Álvarez
69ddb9501b
style: Remove some uses of unused unsafe. 2017-11-15 13:26:24 +01:00
Sylvestre Ledru
6d6a68b5b1 Support multi lines declarations in the parsing of the Fx header files
For example, in dom/base/nsGkAtomList.h, we currently have:
GK_ATOM(mouseWheel, "mouseWheel")  // For discrete wheel events (e.g. not OSX magic mouse)
but if we change to
GK_ATOM(mouseWheel,
        "mouseWheel")  // For discrete wheel events (e.g. not OSX magic mouse)
The parser didn't handle the declaration
2017-10-27 17:10:42 +02:00
Nicholas Nethercote
5866b820e0 Introduce nsStaticAtom.
It's a sub-class of nsAtom, useful for cases where you know you are dealing
exclusively with static atoms. The nice thing about it is that you can use
raw nsStaticAtom pointers instead of RefPtr<>. (In fact, the AddRef/Release
implementations ensure that we'll crash if we use RefPtr<nsStaticAtom>.)
2017-10-27 20:33:40 +11:00
Nicholas Nethercote
7628c1236a Rename nsIAtom as nsAtom.
Bug 1400459 devirtualized nsIAtom so that it is no longer a subclass of
nsISupports. This means that nsAtom is now a better name for it than
nsIAtom.
2017-10-09 09:27:11 +11:00
Boris Zbarsky
e84cb45078 Stylo's atom generation needs to deal with wrapper anon boxes. 2017-08-11 00:08:11 -04:00
Emilio Cobos Álvarez
6b8649e012
stylo: Fix PseudoElement::pseudo_type.
MozReview-Commit-ID: DH2Pv52ankl
2017-07-18 17:34:42 +02:00
Xidorn Quan
5270b766c1 Skip parent-display-based display type fixup for all anonymous boxes. 2017-07-14 10:53:38 +10:00
Xidorn Quan
a307653581 Implement parsing of tree pseudo-elements. 2017-07-12 20:33:11 +10:00
Emilio Cobos Álvarez
5820e3ecac
Bug 1364412: Convert pseudo-elements to an enum. r=hiro,xidorn 2017-05-16 02:53:41 +02:00
Renamed from components/style/binding_tools/regen_atoms.py (Browse further)