Commit Graph

227 Commits

Author SHA1 Message Date
Xidorn Quan
d7f3530f07 Bug 1449068 part 2 - Use Servo data to back @counter-style rule. r=emilio
This patch basically does:
* Add descriptor setters and generation count to CounterStyleRule in
  Servo. (This code is mostly based on the old code inside
  nsCSSCounterStyleRule for handling mutation.)
* Use RawServoCounterStyleRule in CounterStyleManager.
* Add ServoCounterStyleRule and remove nsCSSCounterStyleRule.

Test change:
* "fixed" was parsed as and thus serialized to "fixed 1", but Servo
  doesn't do so. It preserves whether the number presents. Either way
  is probably fine.

MozReview-Commit-ID: EtKTeu32isi

--HG--
extra : rebase_source : ec44f01c581003ce4b6ef69435a05de7f3da5469
2018-04-05 08:41:28 +10:00
Xidorn Quan
67fd806b66 Bug 1449087 part 2 - Use Servo data to back @font-face rule. r=emilio
This patch does the following things:
* Create a new class ServoFontFaceRule for CSSOM of @font-face rule
  which mostly follows how nsCSSFontFaceRule was implemented.
* Remove the old nsCSSFontFaceRule and binding code to create it.
* Have FontFace backed by Servo data via making mRule and mDescriptors
  of the class hold RawServoFontFaceRule like ServoFontFaceRule.

To keep this patch small, it effectively just delays the conversion
from Servo data to nsCSSValue from parsing to using. This may cause
worse performance if the font set is flushed repeatedly. Supposing we
don't flush font set very frequently, it may not be a big deal.

We may still want to remove the intermediate nsCSSValue conversion at
some point, and have everything converted to their final form directly
when used, but that can happen in followups.

There are some unfortunate bits from this change:
* We lose style sheet for logging in FontFaceSet. This is probably not
  all that worse, because we wouldn't have that before either if the
  page doesn't use CSSOM to visit it. But we should figure out some
  approach to fix it anyway.
* InspectorFontFace no longer shares the same rule object as CSSOM.
  This isn't really a problem if the @font-face rule isn't very mutable.
  Unless we want to make the rule returned from InspectorFontFace to be
  mutable (i.e. via inspector), not using the same object probably isn't
  too bad.

This patch switches the code we use to serialize stuff in FontFace and
CSSFontFaceRule, which leads to some failures in tests. Specifically,
the expected changes including:
* Value of font-family now can be serialized to identifier sequence like
  font-family property. The old code always serializes it to string,
  but it doesn't seem to have different requirement than the property.
  Blink can serialize to identifier as well.
* Family name inside local() is also changed to use the same way as
  family names elsewhere (i.e. can be identifier sequence). Blink has
  the same behavior as the old code, but I don't think it's a big deal.
* The order of descriptors serialized gets changed. I don't think it
  matters at all.
* Empty string as font-family via using string syntax is no longer
  considered invalid for FontFace. I don't find it is mentioned anywhere
  that it should be specifically treated invalid.


MozReview-Commit-ID: 32Fk3Fi9uTs

--HG--
extra : rebase_source : 6221ec8fc56de357b06dd27e770fb175348a2f77
2018-04-04 08:42:10 +10:00
Nicholas Nethercote
94289ab246 Bug 1448225 - Convert StylePrefs to StaticPrefs. r=emilio
The new StaticPrefs machinery means that StylePrefs can be removed.

Note that this approach mirrors all static prefs into Rust, but I have only
updated structs.rs for the prefs that Stylo uses.

On a CLOSED TREE, since a sheriff closed the tree while I was about to land this
via autoland.

MozReview-Commit-ID: G1SY0987WJ7
2018-04-03 09:06:20 +02:00
Xidorn Quan
4cf9aed667 Bug 1449400 part 5 - Remove StyleSetHandle. r=emilio
This patch basically does:
* remove StyleSetHandle and its corresponding files
* revisit #includes of related header files and change correspondingly
* change nsIPresShell::mStyleSet to be UniquePtr<ServoStyleSet>
* change the creating path of ServoStyleSet to pass UniquePtr
* change other mentions of StyleSetHandle to ServoStyleSet*
* remove AsServo() calls on ServoStyleSet

Some unfortunate bits:
* some methods of (Servo)StyleSet only accepts ServoStyleSheet while
  many places call into the methods with StyleSheet, so there are many
  ->AsServo() added to sheets

MozReview-Commit-ID: K4zYnuhOurA

--HG--
extra : rebase_source : 459e8efeb171adad089d94272e143e8c244bd279
extra : source : 65ba2f174fcf7dba4e59c00ee8908b1bd0820a48
2018-03-29 22:15:46 +11:00
Xidorn Quan
d026c664c3 Bug 1449400 part 4 - Split some inline functions from ServoStyleSet.h into an Inlines header. r=emilio
To remove the dependency from ServoStyleSet.h to ServoBindings.h.

MozReview-Commit-ID: 6YJ71AnQklL

--HG--
extra : rebase_source : 20e1ead4438f3e3e457af2a4ae4e614992b5f050
extra : source : 53aae6abf7482d4366b66fc8b14d89bf762c19f3
2018-03-29 22:15:46 +11:00
Xidorn Quan
efc0cdde02 Bug 1447828 part 8 - Remove remaining uses of StyleBackendType as well as the type itself. r=emilio
MozReview-Commit-ID: 6sh4eKvDpRF

--HG--
extra : rebase_source : 7d83f2b2d4e2739333016ed82754bf3a4a700de4
extra : source : 147ca562a24652c3f30add793213db70aff65e9e
2018-03-29 02:34:34 +11:00
Xidorn Quan
0cd2404617 Bug 1449089 part 5 - Remove nsCSSPseudoClasses.{h,cpp} and nsCSSPseudoClassList.h. r=emilio
MozReview-Commit-ID: 7KYFiQ5vUxg

--HG--
extra : rebase_source : 9f3a61b3cb240d2fdf23ccc056762c169eaf42e2
2018-03-28 09:41:04 +11:00
Xidorn Quan
d94d7dcc3a Bug 1449039 part 2 - Remove LogicalGroup. r=emilio
MozReview-Commit-ID: QMMVxURx8w

--HG--
extra : rebase_source : 6017c236d3d53a91d30952e908a8d44861a8cbd6
2018-03-27 10:34:44 +11:00
Nicholas Nethercote
bac452f9ad Bug 1411469 - Statically allocate static atoms. r=froydnj
Currently static atoms are stored on the heap, but their char buffers are
stored in read-only static memory.

This patch changes the representation of nsStaticAtom (thus making it a
non-trivial subclass of nsAtom). Instead of a pointer to the string, it now has
an mStringOffset field which is a 32-bit offset to the string. (This requires
placement of the string and the atom within the same object so that the offset
is known to be small. The docs and macros in nsStaticAtom.h handle that.)

Static and dynamic atoms now store their chars in different ways: nsStaticAtom
stores them inline, nsDynamicAtom has a pointer to separate storage. So
`mString` and GetStringBuffer() move from nsAtom to nsDynamicAtom.

The change to static atoms means they can be made constexpr and stored in
read-only memory instead of on the heap. On 64-bit this reduces the per-process
overhead by 16 bytes; on 32-bit the saving is 12 bytes. (Further reductions
will be possible in follow-up patches.)

The increased use of constexpr required multiple workarounds for MSVC.
- Multiple uses of MOZ_{PUSH,POP}_DISABLE_INTEGRAL_CONSTANT_OVERFLOW_WARNING to
  disable warnings about (well-defined!) overflow of unsigned integer
  arithmetic.
- The use of -Zc:externConstexpr on all files defining static atoms, to make
  MSVC follow the C++ standard(!) and let constexpr variables have external
  linkage.
- The use of -constexpr:steps300000 to increase the number of operations
  allowed in a constexpr value, in order to handle gGkAtoms, which requires
  hashing ~2,500 atom strings.

The patch also changes how HTML5 atoms are handled. They are now treated as
dynamic atoms, i.e. we have "dynamic normal" atoms and "dynamic HTML5 atoms",
and "dynamic atoms" covers both cases, and both are represented via
nsDynamicAtom. The main difference between the two kinds is that dynamic HTML5
atoms still aren't allowed to be used in various operations, most notably
AddRef()/Release(). All this also required moving nsDynamicAtom into the header
file.

There is a slight performance cost to all these changes: now that nsStaticAtom
and nsDynamicAtom store their chars in different ways, a conditional branch is
required in the following functions: Equals(), GetUTF16String(),
WeakAtom::as_slice().

Finally, in about:memory the "explicit/atoms/static/atom-objects" value is no
longer needed, because that memory is static instead of heap-allocated.

MozReview-Commit-ID: 4AxPv05ngZy
2018-03-26 11:18:31 +02:00
Xidorn Quan
051a0fc278 Bug 1448526 part 2 - Make nsStyleStructList.h not generated. r=emilio
nsStyleStructList.h was initially made generated in bug 873368 to avoid
manually maintaining boilerplate for if-dispatch, while the if-dispatch
was replaced by jump table in bug 1171842, so the boilerplate went away.

However, in bug 1122781 (before bug 1171842), boilerplate for dependency
check, so it still needs to be generated.

The dependency table is removed in the previous patch, so we no longer
have any boilerplate in the style struct list, and thus it doesn't need
to be generated anymore.

MozReview-Commit-ID: GkbJZ98ojbE

--HG--
extra : rebase_source : a148b97c051bb6c88846cf6ba617c4edef70ca24
extra : source : f1c7d19cde195fb90ac2627d16ed69d020de01b9
2018-03-26 20:09:17 +11:00
Jonathan Watt
a61676cc19 Bug 1448337 - Remove RuleNodeCacheConditions.h. r=emilio 2018-03-25 20:43:47 +02:00
Narcis Beleuzu
47581f78e2 Backed out 2 changesets (bug 1448294, bug 1448337) for wpt and reftest failures on /mathml
Backed out changeset 180051cfe357 (bug 1448294)
Backed out changeset c188176f3289 (bug 1448337)
2018-03-25 21:31:08 +03:00
Jonathan Watt
35387a6577 Bug 1448337 - Remove RuleNodeCacheConditions.h. r=emilio 2018-03-22 08:44:07 +00:00
Emilio Cobos Álvarez
e341b20ec4 Bug 1447483: Merge nsStyleContext and ServoStyleContext, rename to ComputedStyle. r=jwatt on a CLOSED TREE
MozReview-Commit-ID: JPopq0LudD
2018-03-22 20:06:24 +01:00
Emilio Cobos Álvarez
5dd797f154 Back out changeset b683bb3f22a1 (Bug 1447483) for not landing with all the files. r=me on a CLOSED TREE
This reverts commit 1808914126bb9f9e4a82d2c3d7ac961885fe7d62.

MozReview-Commit-ID: 5skESBseEvo
2018-03-22 20:05:22 +01:00
Emilio Cobos Álvarez
ca5ac79cca Bug 1447483: Merge nsStyleContext and ServoStyleContext, rename to ComputedStyle. r=jwatt
MozReview-Commit-ID: JPopq0LudD
2018-03-22 19:48:42 +01:00
Emilio Cobos Álvarez
06ce853d3c Bug 1447476: Remove TreeMatchContext. r=xidorn
MozReview-Commit-ID: ETK0uGXytqb
2018-03-21 17:20:59 +01:00
Jonathan Watt
f3e6656403 Bug 1447367 - Remove files that are not built when MOZ_OLD_STYLE is not defined. r=emilio
MozReview-Commit-ID: D9bEPfTSw61
2018-03-07 18:08:41 +00:00
Xidorn Quan
26878c7730 Bug 1444296 part 1 - Have servo report traversal statistics to gecko. r=bholley
MozReview-Commit-ID: 52YO9mzvneR

--HG--
extra : rebase_source : 873f58bd4ef8e426c350090e4132a8714f4667f4
extra : source : a9d9dc35b9e85eb483aa984977606883680a16c5
2018-03-15 11:59:22 +11:00
Hiroyuki Ikezoe
be2fe6bf8c Bug 1437272 - Split nsTimingFunction into an independent header file. r=birtles
So that we don't need to include nsStyleStruct.h in gfx any more.

MozReview-Commit-ID: 6nOaAbssLCz

--HG--
extra : rebase_source : 9c195c90277a4584dc14a6949e9eea53bcd8487c
2018-03-08 18:22:45 +09:00
Emilio Cobos Álvarez
e6314d1382 Bug 1435939: Make media feature changes always async. r=bz
Much in the spirit of bug 1434474.

We right now call MediaFeatureChanges sync or async pretty randomly. This has
caused bugs in the past like bug 1413143.

Unify media feature changes, and only post them async, and flush them from
FlushPendingNotifications.

This also fixes a pre-existing problem where style wasn't flushed correctly from
getComputedStyle when there were pending media feature values.

MozReview-Commit-ID: H9S1M8fk5H4
2018-02-07 15:27:30 +01:00
Cameron McCormack
d02e54b79b Bug 1430014 - Part 5: Stop building old style system classes when MOZ_OLD_STYLE is not defined. r=xidorn
MozReview-Commit-ID: CIHyPdF7Exl

--HG--
extra : source : 78a2fc781eead47af3923efcde58569c5d882ab1
2018-02-01 15:04:04 +11:00
Boris Zbarsky
eb99a6d933 Bug 1428610 part 1. Devirtualize nsICSSDeclaration::GetDocGroup. r=emilio
MozReview-Commit-ID: 7OGRkYTjTSQ
2018-01-30 14:48:26 -05:00
Noemi Erli
188184d4dc Merge mozilla-central to autoland. r=merge a=merge CLOSED TREE 2018-01-12 00:04:40 +02:00
Bobby Holley
1a733b0d88 Bug 1429529 - Rename CachedAnonBoxStyles to CachedInheritingStyles. r=emilio
MozReview-Commit-ID: xgZbalAJ5x
2018-01-11 11:40:31 -08:00
Bobby Holley
788dd2de1d Bug 1429126 - Rejigger cached anonymous box styles to use a union. r=emilio
MozReview-Commit-ID: I2b3wILKwNp
2018-01-09 18:09:55 -08:00
Cameron McCormack
32554d99d3 Bug 1427512 - Part 17: Remove nsICSSStyleRuleDOMWrapper. r=xidorn
This interface is unused since bug 1427419.

MozReview-Commit-ID: HJH628fhfK6
2018-01-11 16:17:56 +08:00
Cameron McCormack
9f9d965d52 Bug 1420379 - Move css::Rule into its own file. r=xidorn
MozReview-Commit-ID: I5SB5uEMu32

--HG--
extra : rebase_source : 224a9daa037a5e7842675a4c6712c158aba29d6f
2017-11-24 18:01:47 +08:00
Cameron McCormack
0df895545b Bug 1420113 - Part 2: Move nsCSSFontFaceRule to its own file. r=xidorn
MozReview-Commit-ID: PVslOIt1ls

--HG--
extra : rebase_source : 9f77e4cc7cc32fd977c54587120edeb9e8cb3136
2017-11-23 18:04:52 +08:00
Cameron McCormack
5346ea6841 Bug 1420113 - Part 1: Move nsCSSCounterStyleRule to its own file. r=xidorn
MozReview-Commit-ID: 765dOTUOBEQ

--HG--
extra : rebase_source : fef451dade0ac52a64413b3bd84db541f22c5af8
2017-11-23 18:04:26 +08:00
Cameron McCormack
0a5fdb11a0 Bug 1419652 - Remove HandleRefPtr. r=TYLin
This class was used back when we didn't have a base class for CSSStyleSheet
and ServoStyleSheet.  Now it's unused.

MozReview-Commit-ID: 8xaMAA3Opf7

--HG--
extra : rebase_source : fe507762ba80ab54ca2a87e84faa8bc1a1a8590f
2017-11-22 13:11:12 +08:00
Nicholas Nethercote
21e7dce1a2 Bug 1410294 (part 3) - Overhaul static atom macros. r=froydnj.
There are four things that must be provided for every static atom, two of which
have a macro:
- the atom pointer declaration (no macro);
- the atom pointer definition (no macro);
- the atom char buffer (NS_STATIC_ATOM_BUFFER);
- the StaticAtomSetup struct (NS_STATIC_ATOM_SETUP).

This patch introduces new macros for the first two things: NS_STATIC_ATOM_DECL
and NS_STATIC_ATOM_DEFN, and changes the arguments of the existing two macros
to make them easier to use (e.g. all the '##' concatenation now happens within
the macros).

One consequence of the change is that all static atoms must be within a class,
so the patch adds a couple of classes where necessary (DefaultAtoms, TSAtoms).

The patch also adds a big comment explaining how the macros are used, and what
their expansion looks like. This makes it a lot easier to understand how static
atoms work. Correspondingly, the patch removes some small comments scattered
around the macro use points.

MozReview-Commit-ID: wpRyrEOTHE

--HG--
extra : rebase_source : 9f85d477b4d06c9a9e710c757de1f1476edb6efe
2017-10-22 08:50:25 +11:00
Cameron McCormack
460faae1fa Bug 1408312 - Part 1: Add ServoCSSParser utility class. r=xidorn
MozReview-Commit-ID: KzM9332hBSx

--HG--
extra : rebase_source : cee890ae943bdd855528522ef774bc95adfd4245
2017-10-16 08:54:47 +08:00
Sebastian Hengst
edb0dd8898 Backed out changeset bcffb222c970 (bug 1408312) for failing web-platform-test /2dcontext/fill-and-stroke-styles/2d.gradient.object.current.html with stylo disabled. r=backout
--HG--
extra : amend_source : 66151415de533e9e7af7e49e788fc65680fd7be5
2017-10-16 16:15:45 +02:00
Cameron McCormack
b9be378e65 Bug 1408312 - Part 1: Add ServoCSSParser utility class. r=xidorn
MozReview-Commit-ID: KzM9332hBSx

--HG--
extra : rebase_source : c048323e36bef9dceb3c86d3cc9ee66aa39efb51
2017-10-16 08:54:47 +08:00
Xidorn Quan
841f0f88b0 Bug 1407843 part 3 - Remove nsICSSPseudoComparator. r=heycam
MozReview-Commit-ID: Ct3zUoiSIA4

--HG--
extra : rebase_source : 4a415c13fe51d5cfbff0c9cd873f3100974da327
2017-10-13 13:50:04 +11:00
Henri Sivonen
3c8567b60d Bug 1354989 - Avoid pivoting via UTF-16 when loading CSS in the Stylo mode. r=jdm,SimonSapin
MozReview-Commit-ID: Llt29dvB4Io

--HG--
extra : rebase_source : 3ae51dc8beff3fb19e9318a6c7c30c9ab08a5b57
2017-08-29 16:01:42 +03:00
Chung-Sheng Fu
c978a96e84 Bug 1395486 - Move resource://gre-resource/plaintext.css to resource://content-accessible/plaintext.css. r=heycam
MozReview-Commit-ID: Efz2Z78W2ix

--HG--
extra : rebase_source : 0522f382acd14372c6fea0a695f1d09300810912
2017-08-31 17:06:22 +08:00
Chung-Sheng Fu
e5b80e9a8f Bug 863246 - Move resources that need to be exposed to web content to locations that are marked as contentaccessible r=billm
MozReview-Commit-ID: ArhSHKPYOr8

--HG--
extra : rebase_source : 888f7ce8f9db809ad5abbe6340af74e9dfb1d73b
2017-06-08 17:52:46 +08:00
Sebastian Hengst
2e163c99b1 Backed out changeset 1bfbae351dd7 (bug 863246) 2017-08-25 16:43:44 +02:00
Chung-Sheng Fu
bb279d6d5e Bug 863246 - Move resources that need to be exposed to web content to locations that are marked as contentaccessible r=billm
MozReview-Commit-ID: ArhSHKPYOr8

--HG--
extra : rebase_source : b0cf8d159ba6bfa6e7bcd9528ae2f9851185ac30
2017-06-08 17:52:46 +08:00
Xidorn Quan
9dc5b62112 Bug 1366956 part 1 - Move CSS prefs from nsCSSParser into an independent class. r=heycam
MozReview-Commit-ID: S5xaJcP1jb

--HG--
extra : rebase_source : bf483459609aa05031d68224ce17228298f3a80f
2017-07-18 10:54:32 +10:00
Nazım Can Altınova
ffc264cb6b Bug 1365900 - Create ServoFontFeatureValuesRule and bind servo data r=xidorn
Add ServoFontFeatureValuesRule for CSSOM representation of
@font-feature-values rule and wire up with bindings.

MozReview-Commit-ID: B4Lpj43bvKX

--HG--
extra : rebase_source : 6508027f88ff76784ed7d0e5420d6e174f116b38
2017-07-25 18:30:15 -07:00
Nazım Can Altınova
0598921a5f Bug 1365900 - Extract CSSFontFeatureValuesRule base class r=xidorn
Extract CSSFontFeatureValuesRule from nsCSSFontFeatureValuesRule
class. This is necessary because we will create a FontFeatureValues
rule for Servo side.

MozReview-Commit-ID: GKy5wa6JLv9

--HG--
extra : rebase_source : 015f13da9a776c4ece8aa13655395afbb347b870
2017-07-24 16:12:57 -07:00
Manish Goregaokar
cdb73416fd Bug 1367904 - Part 14: stylo: Remove FFI calls for fetching style structs from ServoComputedValues; r=bholley
MozReview-Commit-ID: 2HrVZl9HZu1
2017-07-17 21:01:10 -07:00
Ralph Giles
2108ee3e4e Bug 1368083 - Pass -isysroot to bindgen. r=gps
When cross-compiling, rust-bindgen needs the -isysroot
flag we pass to the C++ compiler to find the correct
headers. Add a new BINDGEN_CFLAGS environment variable
for passing this and other relevant options, and reformat
its contents in toolchain.configure so we can use autoconf-
style template substitution to poke it into a bindgen.toml
file to be read by build scripts like build_gecko.rs.

Set this variable from the macosx/cross-mozconfig.common
to the same extra flags we pass to CXX so automation
builds work correctly with --enable-stylo.

MozReview-Commit-ID: 7wabObiFtVb

--HG--
extra : rebase_source : eeba30e3d64112da65e2e6830ef5fc1b54965529
2017-07-06 11:34:03 -07:00
Manish Goregaokar
3188b9bfd6 Bug 1373018 - Part 10: stylo: Remove StyleSource; r=bholley
MozReview-Commit-ID: 4IcROeDNoBA

--HG--
extra : rebase_source : e2f65c316be2c5640150eb5ff5628505ce446535
2017-06-10 22:27:45 -07:00
Manish Goregaokar
70773cfc42 Bug 1373018 - Part 5: stylo: Move child/sibling pointers to GeckoStyleContext; r=bholley
MozReview-Commit-ID: Gay6RwpkNcu

--HG--
extra : rebase_source : 57a7f22b3d830e2fdc47faa15ceafbe5020a5964
2017-06-10 22:27:45 -07:00
Manish Goregaokar
01dc13b311 Bug 1373018 - Part 1: stylo: Introduce ServoStyleContext and GeckoStyleContext subclasses; r=bholley
MozReview-Commit-ID: GY1GfkWMK0n

--HG--
extra : rebase_source : a631b068cf0d54f5105e3dfe411365157490cac5
2017-06-10 22:27:45 -07:00
Xidorn Quan
4f83161da8 Bug 1352968 part 3 - Add basic CSSOM support for @import rule. r=heycam
Initialization of mChildSheet will be implemented in a later patch.

MozReview-Commit-ID: 3SX3GJEhpBQ

--HG--
extra : source : e45a434d0e9d2e2d8c628b17c2074b8f5de4b1ee
2017-05-30 11:10:25 +10:00