mirror of
https://github.com/servo/servo.git
synced 2025-08-07 22:45:34 +01:00
Auto merge of #18241 - canaltinova:font-feature-values-lookup, r=emilio,xidorn
stylo: Implement font feature values lookup This PR reviewed by emilio and xidorn on bugzilla. That is backed out because of Windows build problems. Fixed and landing it again. --- <!-- 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 - [X] These changes [Bug 1355721](https://bugzilla.mozilla.org/show_bug.cgi?id=1355721) <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/18241) <!-- Reviewable:end -->
This commit is contained in:
commit
dc8f26432f
8 changed files with 1183 additions and 718 deletions
|
@ -40,7 +40,7 @@ use std::ops;
|
|||
use style_traits::viewport::ViewportConstraints;
|
||||
use stylesheet_set::{OriginValidity, SheetRebuildKind, StylesheetSet, StylesheetIterator, StylesheetFlusher};
|
||||
#[cfg(feature = "gecko")]
|
||||
use stylesheets::{CounterStyleRule, FontFaceRule};
|
||||
use stylesheets::{CounterStyleRule, FontFaceRule, FontFeatureValuesRule};
|
||||
use stylesheets::{CssRule, StyleRule};
|
||||
use stylesheets::{StylesheetInDocument, Origin, OriginSet, PerOrigin, PerOriginIter};
|
||||
use stylesheets::UserAgentStylesheets;
|
||||
|
@ -338,13 +338,19 @@ impl DocumentCascadeData {
|
|||
CssRule::FontFace(ref rule) => {
|
||||
_extra_data
|
||||
.borrow_mut_for_origin(&origin)
|
||||
.add_font_face(&rule);
|
||||
.add_font_face(rule);
|
||||
}
|
||||
#[cfg(feature = "gecko")]
|
||||
CssRule::FontFeatureValues(ref rule) => {
|
||||
_extra_data
|
||||
.borrow_mut_for_origin(&origin)
|
||||
.add_font_feature_values(rule);
|
||||
}
|
||||
#[cfg(feature = "gecko")]
|
||||
CssRule::CounterStyle(ref rule) => {
|
||||
_extra_data
|
||||
.borrow_mut_for_origin(&origin)
|
||||
.add_counter_style(guard, &rule);
|
||||
.add_counter_style(guard, rule);
|
||||
}
|
||||
// We don't care about any other rule.
|
||||
_ => {}
|
||||
|
@ -1568,6 +1574,10 @@ pub struct ExtraStyleData {
|
|||
#[cfg(feature = "gecko")]
|
||||
pub font_faces: Vec<Arc<Locked<FontFaceRule>>>,
|
||||
|
||||
/// A list of effective font-feature-values rules.
|
||||
#[cfg(feature = "gecko")]
|
||||
pub font_feature_values: Vec<Arc<Locked<FontFeatureValuesRule>>>,
|
||||
|
||||
/// A map of effective counter-style rules.
|
||||
#[cfg(feature = "gecko")]
|
||||
pub counter_styles: PrecomputedHashMap<Atom, Arc<Locked<CounterStyleRule>>>,
|
||||
|
@ -1580,6 +1590,11 @@ impl ExtraStyleData {
|
|||
self.font_faces.push(rule.clone());
|
||||
}
|
||||
|
||||
/// Add the given @font-feature-values rule.
|
||||
fn add_font_feature_values(&mut self, rule: &Arc<Locked<FontFeatureValuesRule>>) {
|
||||
self.font_feature_values.push(rule.clone());
|
||||
}
|
||||
|
||||
/// Add the given @counter-style rule.
|
||||
fn add_counter_style(
|
||||
&mut self,
|
||||
|
@ -1596,6 +1611,7 @@ impl ExtraStyleData {
|
|||
#[cfg(feature = "gecko")]
|
||||
{
|
||||
self.font_faces.clear();
|
||||
self.font_feature_values.clear();
|
||||
self.counter_styles.clear();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue