Commit graph

67 commits

Author SHA1 Message Date
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
Emilio Cobos Álvarez
9b2d96f7e7
stylo: Honor the relevant link visited pref.
MozReview-Commit-ID: D5NiEJUpONQ
2017-07-23 22:37:47 +02:00
Michael Partheil
b07ebbae6b Replace all uses of the style::stylearc alias with servo_arc.
The alias is left there temporarilly and will be removed completely in a later commit where
also components/style/gecko/generated/structs_{debug|release}.rs are re-generated (they still
use the old alias).
2017-07-19 09:29:05 +02:00
Emilio Cobos Álvarez
07e1c6e75a
stylo: Cleanup the Gecko bits.
MozReview-Commit-ID: dbVDy1u4vp
2017-07-18 17:35:44 +02:00
Manish Goregaokar
808b1f509b stylo: Use ComputedValuesInner instead of ComputedValues when we don't need it 2017-07-17 18:02:25 -07:00
Emilio Cobos Álvarez
1263075776
stylo: Fix StyleSheetInner/Stylesheet mapping
The key of this patch is the split between Stylesheet and StylesheetContents.

Gecko will use StylesheetContents, which maps to a ServoStyleSheetInner.
2017-07-02 15:49:40 +02:00
Emilio Cobos Álvarez
6fefe522a3
style: Assert we never style a root element from another document.
Right now when calling getComputedStyle with an element from another document,
we return the style using the pres context of that document, not of the document
of the window getComputedStyle was called on, so this holds.

But it will stop holding if we ever change this, so assert it doesn't happen.

Bug: 1374062
Reviewed-By: Manishearth
MozReview-Commit-ID: 3g8yQWWdsen
2017-06-21 19:55:02 +02:00
Emilio Cobos Álvarez
dd3bf6f952
Ensure the default computed values are up-to-date before evaluating media queries.
Zoom changes can change the meaning of ems, so we can't re-evaluate media
queries with the old values, because otherwise we may miss a restyle.

Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1357461
MozReview-Commit-ID: HQInvR7RPqR
2017-06-03 14:44:12 +02:00
Emilio Cobos Álvarez
ac5872b48c
Bug 1357583: style: Make effective_rules return an iterator, stop refcounting the Device. r=heycam
This makes the code cleaner, and also documents the fact that effective_rules
recurses into imports.

No we're not adding the imported stylesheets twice, and we share code with the
invalidation analysis.

MozReview-Commit-ID: DOF2AViTlmR
2017-05-29 20:27:43 +02:00
Emilio Cobos Álvarez
39e836966e
Bug 1357583: style: Hook up the invalidator in the StyleSheetSet. r=heycam
MozReview-Commit-ID: IhgKAovTJMX
2017-05-29 20:27:36 +02:00
Emilio Cobos Álvarez
bc8382ebe9
style: Use a FnvHashMap for ExtraStyleData, and remove unused stuff from PerDocumentStyleDataImpl. 2017-05-23 14:47:18 +02:00
heyzoos
4196156bb9 Change device and rule_set references to accessors 2017-05-18 22:18:16 -05:00
Xidorn Quan
3e00a91e20 Enable querying counter-style rule on Servo backend. 2017-05-16 14:42:46 +10:00
Nazım Can Altınova
c54d255d07
stylo: Propagate quirks mode information from Gecko to Servo 2017-05-14 01:51:50 +03:00
Emilio Cobos Álvarez
25d39006b6
stylo: Stop cloning the list of stylesheets each flush. 2017-05-12 14:51:01 +02:00
Emilio Cobos Álvarez
677daaabc5
style: Parameterize the update and rebuild methods to take an iterator.
In preparation to avoid cloning the stylesheets while rebuilding in Gecko.
2017-05-12 14:50:59 +02:00
Emilio Cobos Álvarez
50e0c67e2c
style: Stop refcounting the stylist. 2017-05-11 21:05:42 +02:00
Boris Zbarsky
4588664873 Clear the stylist when Gecko stylesheets change, but don't rebuild it until explicitly flushed.
This is the servo part of part 3 of the fix for https://bugzilla.mozilla.org/show_bug.cgi?id=1361843
2017-05-10 16:25:54 -04:00
Bobby Holley
d78ca4c4f9 Use StyleArc in the style system.
MozReview-Commit-ID: flF0fv9E9M
2017-05-02 17:35:44 -07:00
Brad Werth
2b6c494f85 Change StyleSet to track stylesheets by unique ID.
MozReview-Commit-ID: Ky3P53o4Euw
2017-05-02 13:38:13 -07:00
Emilio Cobos Álvarez
4651b94ff0
style: Simplify author_style_disabled handling. 2017-04-19 09:41:37 +02:00
Emilio Cobos Álvarez
97235d0bf7
stylo: Centralize stylesheet handling.
This is needed for both bug 1357461 and bug 1273303, where I plan to add smarter
invalidations than what we have now.

Also, it's cleaner.

Ideally I'll move this onto stylist, though that may require extra work to make
it work fine for Servo, so for now let's just do the obvious thing.
2017-04-19 09:41:36 +02:00
Brad Werth
91a9fb06c7 Add an author_style_disabled flag to stylist.update, and associated structs.
MozReview-Commit-ID: FiXyEN4xVnU
2017-04-14 09:24:20 +08:00
Xidorn Quan
01e986f2e6 Record effective @font-face rules when updating stylist. 2017-03-30 11:41:12 +11:00
Simon Sapin
d5074136e3 Rename ReadGuards to StylesheetGuards 2017-03-19 22:30:42 +01:00
Simon Sapin
aeffca2a59 Replace RwLock<StyleRule> with Locked<StyleRule> 2017-03-19 22:30:37 +01:00