style: Move author-style-disabled handling to push_applicable_declarations.

This will make it easier to handle it properly for Shadow DOM, though this patch
doesn't do that.

This also makes some method inline and infallible for convenience, since nobody
checks the errors anyway.

Bug: 1436798
Reviewed-by: bholley
MozReview-Commit-ID: Hq3erAUs5tf
This commit is contained in:
Emilio Cobos Álvarez 2018-02-08 13:05:28 +01:00
parent 438251cbfc
commit a254dc12a4
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
3 changed files with 34 additions and 49 deletions

View file

@ -135,7 +135,6 @@ use style::selector_parser::{PseudoElementCascadeType, SelectorImpl};
use style::shared_lock::{SharedRwLockReadGuard, StylesheetGuards, ToCssWithGuard, Locked};
use style::string_cache::{Atom, WeakAtom};
use style::style_adjuster::StyleAdjuster;
use style::stylesheet_set::AuthorStylesEnabled;
use style::stylesheets::{CssRule, CssRules, CssRuleType, CssRulesHelpers, DocumentRule};
use style::stylesheets::{FontFeatureValuesRule, ImportRule, KeyframesRule, MediaRule};
use style::stylesheets::{NamespaceRule, Origin, OriginSet, PageRule, StyleRule};
@ -143,7 +142,7 @@ use style::stylesheets::{StylesheetContents, SupportsRule};
use style::stylesheets::StylesheetLoader as StyleStylesheetLoader;
use style::stylesheets::keyframes_rule::{Keyframe, KeyframeSelector, KeyframesStepValue};
use style::stylesheets::supports_rule::parse_condition_or_declaration;
use style::stylist::{add_size_of_ua_cache, RuleInclusion, Stylist};
use style::stylist::{add_size_of_ua_cache, AuthorStylesEnabled, RuleInclusion, Stylist};
use style::thread_state;
use style::timer::Timer;
use style::traversal::DomTraversal;
@ -1248,11 +1247,18 @@ pub unsafe extern "C" fn Servo_StyleSet_FlushStyleSheets(
#[no_mangle]
pub extern "C" fn Servo_StyleSet_NoteStyleSheetsChanged(
raw_data: RawServoStyleSetBorrowed,
author_style_disabled: bool,
changed_origins: OriginFlags,
) {
let mut data = PerDocumentStyleData::from_ffi(raw_data).borrow_mut();
data.stylist.force_stylesheet_origins_dirty(OriginSet::from(changed_origins));
}
#[no_mangle]
pub extern "C" fn Servo_StyleSet_SetAuthorStyleDisabled(
raw_data: RawServoStyleSetBorrowed,
author_style_disabled: bool,
) {
let mut data = PerDocumentStyleData::from_ffi(raw_data).borrow_mut();
let enabled =
if author_style_disabled {
AuthorStylesEnabled::No