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:
Emilio Cobos Álvarez 2017-10-13 16:25:13 +02:00
parent a89a76e1fc
commit 25c303ee62
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
6 changed files with 116 additions and 79 deletions

View file

@ -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
}