зеркало из https://github.com/mozilla/gecko-dev.git
servo: Merge #18373 - Don't unnecessarily construct gfxFontFeatureValueSet (from canaltinova:font-feature-vals); r=xidorn
This is reviewed by xidorn in bugzilla. --- - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix [Bug 1394551](https://bugzilla.mozilla.org/show_bug.cgi?id=1394551) Source-Repo: https://github.com/servo/servo Source-Revision: 21c9ef3c6df5ce5886922334b8ea0f94fe83d79a --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : 8be6904697ff4bc8b3527e437609a267e4a71aa7
This commit is contained in:
Родитель
2ec22812fa
Коммит
bd1b4a22ec
|
@ -913,6 +913,10 @@ extern "C" {
|
|||
extern "C" {
|
||||
pub fn Gecko_nsFont_Destroy(dst: *mut nsFont);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Gecko_ConstructFontFeatureValueSet()
|
||||
-> *mut gfxFontFeatureValueSet;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Gecko_AppendFeatureValueHashEntry(value_set:
|
||||
*mut gfxFontFeatureValueSet,
|
||||
|
@ -2047,10 +2051,8 @@ extern "C" {
|
|||
}
|
||||
extern "C" {
|
||||
pub fn Servo_StyleSet_BuildFontFeatureValueSet(set:
|
||||
RawServoStyleSetBorrowed,
|
||||
list:
|
||||
*mut gfxFontFeatureValueSet)
|
||||
-> bool;
|
||||
RawServoStyleSetBorrowed)
|
||||
-> *mut gfxFontFeatureValueSet;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Servo_StyleSet_ResolveForDeclarations(set:
|
||||
|
|
|
@ -210,7 +210,7 @@ impl<'a, 'b, 'i, T> DeclarationParser<'i> for FFVDeclarationsParser<'a, 'b, T>
|
|||
-> Result<(), ParseError<'i>> {
|
||||
let value = input.parse_entirely(|i| T::parse(self.context, i))?;
|
||||
let new = FFVDeclaration {
|
||||
name: Atom::from(&*name).to_ascii_lowercase(),
|
||||
name: Atom::from(&*name),
|
||||
value: value,
|
||||
};
|
||||
update_or_push(&mut self.declarations, new);
|
||||
|
|
|
@ -47,6 +47,7 @@ use style::gecko_bindings::bindings::{ServoCssRulesBorrowed, ServoCssRulesStrong
|
|||
use style::gecko_bindings::bindings::{nsACString, nsAString, nsCSSPropertyIDSetBorrowedMut};
|
||||
use style::gecko_bindings::bindings::Gecko_AddPropertyToSet;
|
||||
use style::gecko_bindings::bindings::Gecko_AppendPropertyValuePair;
|
||||
use style::gecko_bindings::bindings::Gecko_ConstructFontFeatureValueSet;
|
||||
use style::gecko_bindings::bindings::Gecko_GetOrCreateFinalKeyframe;
|
||||
use style::gecko_bindings::bindings::Gecko_GetOrCreateInitialKeyframe;
|
||||
use style::gecko_bindings::bindings::Gecko_GetOrCreateKeyframeAtStart;
|
||||
|
@ -3560,26 +3561,30 @@ pub extern "C" fn Servo_StyleSet_GetCounterStyleRule(raw_data: RawServoStyleSetB
|
|||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn Servo_StyleSet_BuildFontFeatureValueSet(
|
||||
raw_data: RawServoStyleSetBorrowed,
|
||||
set: *mut gfxFontFeatureValueSet
|
||||
) -> bool {
|
||||
raw_data: RawServoStyleSetBorrowed) -> *mut gfxFontFeatureValueSet {
|
||||
let data = PerDocumentStyleData::from_ffi(raw_data).borrow();
|
||||
|
||||
let global_style_data = &*GLOBAL_STYLE_DATA;
|
||||
let guard = global_style_data.shared_lock.read();
|
||||
|
||||
let has_rule = data.extra_style_data
|
||||
.iter_origins()
|
||||
.any(|(d, _)| !d.font_feature_values.is_empty());
|
||||
|
||||
if !has_rule {
|
||||
return ptr::null_mut();
|
||||
}
|
||||
|
||||
let font_feature_values_iter = data.extra_style_data
|
||||
.iter_origins_rev()
|
||||
.flat_map(|(d, _)| d.font_feature_values.iter());
|
||||
|
||||
let mut any_rule = false;
|
||||
let set = unsafe { Gecko_ConstructFontFeatureValueSet() };
|
||||
for src in font_feature_values_iter {
|
||||
any_rule = true;
|
||||
let rule = src.read_with(&guard);
|
||||
rule.set_at_rules(set);
|
||||
}
|
||||
|
||||
any_rule
|
||||
set
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
|
|
Загрузка…
Ссылка в новой задаче