mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Auto merge of #18499 - heycam:rule-cache, r=emilio
Rule cache <!-- Please describe your changes on the following line: --> This adds a TLS-based cache reset styles structs keyed off rule nodes. Reviewed in https://bugzilla.mozilla.org/show_bug.cgi?id=1367635 by me and Emilio. --- <!-- 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 - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- 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. -->
This commit is contained in:
commit
874cb0d9df
21 changed files with 471 additions and 35 deletions
|
@ -132,9 +132,18 @@ impl FontRelativeLength {
|
|||
|
||||
match *self {
|
||||
FontRelativeLength::Em(length) => {
|
||||
if !matches!(base_size, FontBaseSize::InheritedStyle) {
|
||||
context.rule_cache_conditions.borrow_mut()
|
||||
.set_font_size_dependency(
|
||||
reference_font_size.into()
|
||||
);
|
||||
}
|
||||
(reference_font_size, length)
|
||||
},
|
||||
FontRelativeLength::Ex(length) => {
|
||||
if context.for_non_inherited_property.is_some() {
|
||||
context.rule_cache_conditions.borrow_mut().set_uncacheable();
|
||||
}
|
||||
let reference_size = match query_font_metrics(context, reference_font_size) {
|
||||
FontMetricsQueryResult::Available(metrics) => {
|
||||
metrics.x_height
|
||||
|
@ -152,6 +161,9 @@ impl FontRelativeLength {
|
|||
(reference_size, length)
|
||||
},
|
||||
FontRelativeLength::Ch(length) => {
|
||||
if context.for_non_inherited_property.is_some() {
|
||||
context.rule_cache_conditions.borrow_mut().set_uncacheable();
|
||||
}
|
||||
let reference_size = match query_font_metrics(context, reference_font_size) {
|
||||
FontMetricsQueryResult::Available(metrics) => {
|
||||
metrics.zero_advance_measure
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue