mirror of
https://github.com/servo/servo.git
synced 2025-09-30 08:39:16 +01:00
style: Be clearer about whether a declaration comes from parsing or not.
This introduces DeclarationSource, to see if a declaration has been parsed or set from CSSOM in a declaration block. The Servo_DeclarationBlock_SetFoo and similar callers are changed to DeclarationSource::CssOm because their semantics are more CSSOM-y, but it shouldn't matter since they should all be checked before hand with Servo_DeclarationBlock_PropertyIsSet.
This commit is contained in:
parent
a89a76e1fc
commit
25c303ee62
6 changed files with 116 additions and 79 deletions
|
@ -5,6 +5,7 @@
|
|||
use cssparser::SourceLocation;
|
||||
use servo_arc::Arc;
|
||||
use style::properties::{LonghandId, LonghandIdSet, PropertyDeclaration, PropertyDeclarationBlock, Importance};
|
||||
use style::properties::DeclarationSource;
|
||||
use style::shared_lock::SharedRwLock;
|
||||
use style::stylesheets::keyframes_rule::{Keyframe, KeyframesAnimation, KeyframePercentage, KeyframeSelector};
|
||||
use style::stylesheets::keyframes_rule::{KeyframesStep, KeyframesStepValue};
|
||||
|
@ -76,12 +77,14 @@ fn test_missing_property_in_initial_keyframe() {
|
|||
block.push(
|
||||
PropertyDeclaration::Width(
|
||||
LengthOrPercentageOrAuto::Length(NoCalcLength::from_px(20f32))),
|
||||
Importance::Normal
|
||||
Importance::Normal,
|
||||
DeclarationSource::Parsing,
|
||||
);
|
||||
block.push(
|
||||
PropertyDeclaration::Height(
|
||||
LengthOrPercentageOrAuto::Length(NoCalcLength::from_px(20f32))),
|
||||
Importance::Normal
|
||||
Importance::Normal,
|
||||
DeclarationSource::Parsing,
|
||||
);
|
||||
block
|
||||
}));
|
||||
|
@ -132,12 +135,14 @@ fn test_missing_property_in_final_keyframe() {
|
|||
block.push(
|
||||
PropertyDeclaration::Width(
|
||||
LengthOrPercentageOrAuto::Length(NoCalcLength::from_px(20f32))),
|
||||
Importance::Normal
|
||||
Importance::Normal,
|
||||
DeclarationSource::Parsing,
|
||||
);
|
||||
block.push(
|
||||
PropertyDeclaration::Height(
|
||||
LengthOrPercentageOrAuto::Length(NoCalcLength::from_px(20f32))),
|
||||
Importance::Normal
|
||||
Importance::Normal,
|
||||
DeclarationSource::Parsing,
|
||||
);
|
||||
block
|
||||
}));
|
||||
|
@ -195,12 +200,14 @@ fn test_missing_keyframe_in_both_of_initial_and_final_keyframe() {
|
|||
block.push(
|
||||
PropertyDeclaration::Width(
|
||||
LengthOrPercentageOrAuto::Length(NoCalcLength::from_px(20f32))),
|
||||
Importance::Normal
|
||||
Importance::Normal,
|
||||
DeclarationSource::Parsing,
|
||||
);
|
||||
block.push(
|
||||
PropertyDeclaration::Height(
|
||||
LengthOrPercentageOrAuto::Length(NoCalcLength::from_px(20f32))),
|
||||
Importance::Normal
|
||||
Importance::Normal,
|
||||
DeclarationSource::Parsing,
|
||||
);
|
||||
block
|
||||
}));
|
||||
|
|
|
@ -20,8 +20,8 @@ use style::error_reporting::{ParseErrorReporter, ContextualParseError};
|
|||
use style::media_queries::MediaList;
|
||||
use style::properties::Importance;
|
||||
use style::properties::{CSSWideKeyword, DeclaredValueOwned, PropertyDeclaration, PropertyDeclarationBlock};
|
||||
use style::properties::longhands;
|
||||
use style::properties::longhands::animation_timing_function;
|
||||
use style::properties::DeclarationSource;
|
||||
use style::properties::longhands::{self, animation_timing_function};
|
||||
use style::shared_lock::SharedRwLock;
|
||||
use style::stylesheets::{Origin, Namespaces};
|
||||
use style::stylesheets::{Stylesheet, StylesheetContents, NamespaceRule, CssRule, CssRules, StyleRule, KeyframesRule};
|
||||
|
@ -35,7 +35,7 @@ pub fn block_from<I>(iterable: I) -> PropertyDeclarationBlock
|
|||
where I: IntoIterator<Item=(PropertyDeclaration, Importance)> {
|
||||
let mut block = PropertyDeclarationBlock::new();
|
||||
for (d, i) in iterable {
|
||||
block.push(d, i)
|
||||
block.push(d, i, DeclarationSource::CssOm);
|
||||
}
|
||||
block
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue