Commit graph

92 commits

Author SHA1 Message Date
Emilio Cobos Álvarez
8f4d782952 style: Don't EnsureUniqueInner from the cssRules getter
Instead, fix up the various content data structures when the stylesheet
is mutated. This makes reading a stylesheet not disable style sharing.

Differential Revision: https://phabricator.services.mozilla.com/D115203
2023-05-24 18:32:38 +02:00
Oriol Brufau
060d74ba3b style: Share CascadeData instances across ShadowRoots
This should be both a memory and speed win for pages using a lot of
Shadow DOM.

In order to make the cache properly work we need to start keying media query
results on the actual StyleSheetContents, as that's what we share on Gecko, but
that should all be fine.

Differential Revision: https://phabricator.services.mozilla.com/D107266
2023-05-16 13:00:08 +02:00
Emilio Cobos Álvarez
e5b5cd78a9 style: Remove support for XBL resources.
So much unsound code going away :-)

Differential Revision: https://phabricator.services.mozilla.com/D28380
2019-05-07 12:55:29 +02:00
Emilio Cobos Álvarez
14b176019c style: Simplify a bit our generated bindings by getting rid of FooBorrowed and FooBorrowedMut.
This reduces a lot the boilerplate that's needed in order to add simple binding
functions.

This starts using &Foo and Option<&Foo> instead, and as a result we need to
remove the servo_function_signatures test, which is a bit unfortunate.

I think it's worth though, this causes problems on some platforms (see bug
1534844), and messing up the functions signature is not something that I've ever
seen (other than bug 1308234, which already had all the FooBorrowed mess which
I'm removing).

Also, cbindgen understands references and Option<&Foo>, so it will be the way to
go in the future.

After this patch we can also remove HasSimpleFFI, but I've kept it for now since
I still use it in a few places, and this patch is quite big on its own.

Differential Revision: https://phabricator.services.mozilla.com/D24092
2019-03-27 14:29:19 +01:00
Emilio Cobos Álvarez
e723a5b7d6 style: Make the pres context optional in the style system.
Differential Revision: https://phabricator.services.mozilla.com/D21239
2019-03-13 15:08:32 +01:00
Emilio Cobos Álvarez
4e3e4c106a style: Refactor preference stylesheet prefs to not require a pres context.
We really only have two sets of prefs, one for chrome-like documents
(stuff in chrome docshells + chrome-origin images), and one for the rest.

Differential Revision: https://phabricator.services.mozilla.com/D20946
2019-03-13 15:08:31 +01:00
Emilio Cobos Álvarez
5f173c463e style: Rustfmt recent changes. 2019-01-07 00:32:54 +01:00
Emilio Cobos Álvarez
a454f6233d Rename nsIDocument to mozilla::dom::Document.
Summary: Really sorry for the size of the patch. It's mostly automatic
s/nsIDocument/Document/ but I had to fix up in a bunch of places manually to
add the right namespacing and such.

Overall it's not a very interesting patch I think.

nsDocument.cpp turns into Document.cpp, nsIDocument.h into Document.h and
nsIDocumentInlines.h into DocumentInlines.h.

I also changed a bunch of nsCOMPtr usage to RefPtr, but not all of it.

While fixing up some of the bits I also removed some unneeded OwnerDoc() null
checks and such, but I didn't do anything riskier than that.

Bug: 1517241
Reviewed-by: smaug
2019-01-07 00:32:51 +01:00
Simon Sapin
be69f9c3e6 Rustfmt has changed its default style :/ 2018-12-28 13:17:47 +01:00
Jan Andre Ikenmeyer
1d6fe65401
Update MPL license to https (part 4) 2018-11-19 14:47:27 +01:00
Simon Sapin
b1822a39fa cargo fix --edition --features gecko 2018-11-10 17:47:28 +01:00
Emilio Cobos Álvarez
8cb5b149eb
style: Some minor formatting nits. 2018-11-08 15:22:31 +01:00
Pyfisch
9e92eb205a Reorder imports 2018-11-06 22:35:07 +01:00
Cameron McCormack
d960db340c
style: Part 11: Move Gecko borrowed FFI types to a separate header file.
Differential Revision: https://phabricator.services.mozilla.com/D8653
2018-10-19 00:36:59 +02:00
chansuke
8dab4d659a
Format style component. 2018-09-09 16:24:45 +02:00
Emilio Cobos Álvarez
87b1e1cdc9
style: no-op visited changes earlier if visited links are disabled.
We force a repaint from ContentStateChangedInternal if visited links are
disabled, and that's observable. Let's cut it off as early as we can to avoid
timing attacks even when :visited is disabled.

Differential Revision: https://phabricator.services.mozilla.com/D3304
2018-08-18 17:54:54 +02:00
Emilio Cobos Álvarez
750c223021
style: Fix tidy. 2018-06-23 20:34:10 +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
Emilio Cobos Álvarez
9d721072f5
style: Remove ServoStyleSheet usage.
Bug: 1457920
Reviewed-by: xidorn
MozReview-Commit-ID: LIBkovuQ6MB
2018-05-05 16:22:47 +02:00
Emilio Cobos Álvarez
9ed48952f5
style: Merge ServoStyleSheet and StyleSheet.
These are the most minimal changes I could make. More cleanups incoming.

Bug: 1457920
Reviewed-by: xidorn
MozReview-Commit-ID: AdMOA1acQIH
2018-05-05 16:22:47 +02:00
Emilio Cobos Álvarez
276fb7e04b
style: Unify MediaList and ServoMediaList.
Bug: 1456471
Reviewed-by: xidorn
MozReview-Commit-ID: KFWxoohpGlb
2018-04-29 03:28:33 +02:00
Bobby Holley
afe484e46b
style: Allow placeholder import sheets.
This is necessary because we can't create GeckoStyleSheets off-main-thread,
so we need a placeholder until it can be filled in.

Bug: 1454030
Reviewed-by: emilio
MozReview-Commit-ID: ssRme4fLYg
2018-04-17 20:01:27 +02:00
Bobby Holley
c99bcdd4b8 Run rustfmt on selectors, servo_arc, and style.
This was generated with:

./mach cargo fmt --package selectors &&
./mach cargo fmt --package servo_arc &&
./mach cargo fmt --package style

Using rustfmt 0.4.1-nightly (a4462d1 2018-03-26)
2018-04-10 17:35:15 -07:00
Bobby Holley
f7ae1a37e3 Manual fixups so that the rustfmt output won't trigger tidy. 2018-04-10 17:33:25 -07:00
Nicholas Nethercote
8705fb3783 Convert StylePrefs to StaticPrefs. 2018-04-03 11:41:03 +10:00
Emilio Cobos Álvarez
9744840e5a
style: Remove useless code after #19994 2018-02-12 13:52:29 +01:00
Manish Goregaokar
9d23962d8e Remove traversal telemetry 2018-02-08 03:04:34 -08:00
Emilio Cobos Álvarez
657d8b8e31
style: Look at the snapshots when invalidating due to stylesheet changes.
Otherwise removal of stylesheets may get out of sync with other DOM changes, and
we may fail to invalidate the style of the affected elements.

Bug: 1432850
Reviewed-by: bz
MozReview-Commit-ID: DrMTgLzQcnk
2018-01-27 02:34:27 +01:00
Manish Goregaokar
337e5288c2 Add weighted telemetry probes for parallel restyles 2017-12-12 10:13:23 -06:00
Manish Goregaokar
d573081fe5 Add telemetry probe for fraction of restyles that are parallel 2017-12-12 10:08:11 -06:00
Emilio Cobos Álvarez
f94601d0a7
style: Disable :visited if the document is being used as an image.
Bug: 1420001
Reviewed-by: dholbert
MozReview-Commit-ID: F9MeT1kXZER
2017-11-27 21:20:14 +01:00
Cameron McCormack
509007febb style: Read visited links pref directly. 2017-11-17 15:42:39 +08:00
Emilio Cobos Álvarez
100dd18307
style: use the XBL styleset quirks mode to match XBL rules.
This fixes bug 1405543.

MozReview-Commit-ID: Dv3mt3Fb8Yp
2017-10-09 11:30:37 +02:00
Nicholas Nethercote
e030c0d96a Rename add_size_of_children() methods as add_size_of().
This makes them match `size_of` from `MallocSizeOf`.
2017-09-26 18:54:36 +10:00
Emilio Cobos Álvarez
0a9309aa96
style: Unify how servo and Gecko handle UA sheets. 2017-09-14 20:33:43 +02:00
Emilio Cobos Álvarez
541977efb3
style: Move ExtraStyleData into CascadeData.
It logically belongs there, and the only reason it wasn't there before we were
working around it.

MozReview-Commit-ID: 5a5iksHAIdN
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-09-13 23:43:09 +02:00
Nicholas Nethercote
32548e5312 Overhaul MallocSizeOf and related things.
This patch makes the MallocSizeOf stuff in Stylo work more like the HeapSizeOf
stuff already in Servo, except better. In particular, it adds deriving support
for MallocSizeOf, which will make it easier to improve coverage.

The patch does the following.

- Combines servo/components/style/stylesheets/memory.rs and the heapsize crate
  into a new crate, malloc_size_of.

- Forks the heapsize_derive crate, calling it malloc_size_of, so that
  MallocSizeOf can be derived.

- Both the new crates have MIT/Apache licenses, like heapsize, in case they are
  incorporated into heapsize in the future.

- Renames the methods within MallocSizeOf and the related traits so they are
  more concise.

- Removes MallocSizeOfWithGuard.

- Adds `derive(MallocSizeOf)` to a lot of types, in some cases replacing an
  equivalent or almost-equivalent hand-written implementation.

- Adds stuff so that Rc/Arc can be handled properly.
2017-09-12 12:37:51 +10:00
Nicholas Nethercote
d880efcab3
Measure the stylist during memory reporting. 2017-09-05 19:43:50 +02:00
Nicholas Nethercote
e08829703a Measure memory usage of Stylo's Rule Tree. 2017-08-30 21:46:15 +10:00
Clément DAVID
c5fe235112 order derivable traits lists
Ignoring :
 - **generated**.rs
 - python/tidy/servo_tidy_tests/rust_tidy.rs
2017-08-23 21:38:44 +02:00
Bobby Holley
d4aa8e3cef Track the restyle root and use it to do less work during the traversal.
MozReview-Commit-ID: A8O3JOpsv4E
2017-08-22 19:34:46 -07:00
Emilio Cobos Álvarez
c73ec5e649
style: Avoid blanket Sync for GeckoStyleSheet, use a more isolated wrapper. 2017-08-22 16:55:55 +02:00
Emilio Cobos Álvarez
cbf388a5fd
style: Move the StyleSheetSet into the Stylist.
This will allow tracking whether there have been only additions to the
stylesheet set, and in that case don't destroy and completely rebuild the
invalidation map.
2017-08-22 16:55:52 +02:00
Emilio Cobos Álvarez
4c80cccbd2
stylo: Cleanup a bit of the Stylist clear setup.
This moves us to clear on rebuild, which allows us to remove yet another place
where we track stylist dirtiness.

Bug: 1390255
Reviewed-by: heycam
MozReview-Commit-ID: nihQbUAbh8
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-08-16 08:49:41 +02:00
Cameron McCormack
84451e521b style: Only flush stylesheet invalidations for origins that have changed. 2017-08-13 18:51:04 +08:00
Cameron McCormack
f3a7adfcc7 style: Add ability to clear and rebuild individual origins. 2017-08-13 18:51:03 +08:00
Cameron McCormack
321643ae61 style: Factor out per-origin data storage.
Also add an iter_mut_origins() function.
2017-08-13 18:50:57 +08:00
Cameron McCormack
57622004ce style: Split collected @font-face / @counter-style rules per origin. 2017-08-11 13:39:49 +08:00
Emilio Cobos Álvarez
de58c088b1
style: Avoid hashing hashes.
These are the last instances I can find of us hashing the atoms hash.
2017-08-08 17:06:11 +02:00
Boris Zbarsky
7161fff1b8 Add a Stylo API for reparenting a given style.
Servo side of part 4 of the fix for Gecko bug 1324619.  r=emilio
2017-07-28 22:54:06 -04:00