mirror of
https://github.com/servo/servo.git
synced 2025-07-22 14:53:49 +01:00
style: Tidy Stylist::compute_for_declarations.
This commit is contained in:
parent
1d8e78720b
commit
8e3da86636
1 changed files with 5 additions and 8 deletions
|
@ -1494,19 +1494,16 @@ impl Stylist {
|
||||||
E: TElement,
|
E: TElement,
|
||||||
{
|
{
|
||||||
use font_metrics::get_metrics_provider_for_product;
|
use font_metrics::get_metrics_provider_for_product;
|
||||||
|
use std::iter;
|
||||||
|
|
||||||
// FIXME(emilio): Why do we even need the rule node? We should probably
|
// FIXME(emilio): Why do we even need the rule node? We should probably
|
||||||
// just avoid allocating it and calling `apply_declarations` directly,
|
// just avoid allocating it and calling `apply_declarations` directly,
|
||||||
// maybe...
|
// maybe...
|
||||||
//
|
|
||||||
// Also the `vec!` is super-wasteful.
|
|
||||||
let v = vec![ApplicableDeclarationBlock::from_declarations(
|
|
||||||
declarations.clone(),
|
|
||||||
CascadeLevel::StyleAttributeNormal
|
|
||||||
)];
|
|
||||||
|
|
||||||
let rule_node =
|
let rule_node =
|
||||||
self.rule_tree.insert_ordered_rules(v.into_iter().map(|a| a.order_and_level()));
|
self.rule_tree.insert_ordered_rules(iter::once((
|
||||||
|
StyleSource::Declarations(declarations),
|
||||||
|
CascadeLevel::StyleAttributeNormal,
|
||||||
|
)));
|
||||||
|
|
||||||
// This currently ignores visited styles. It appears to be used for
|
// This currently ignores visited styles. It appears to be used for
|
||||||
// font styles in <canvas> via Servo_StyleSet_ResolveForDeclarations.
|
// font styles in <canvas> via Servo_StyleSet_ResolveForDeclarations.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue