mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
style: Cleanup always-false argument to Servo_ResolveStyleLazily.
I changed this setup in https://bugzilla.mozilla.org/show_bug.cgi?id=1414999, because it was totally unsound.
This commit is contained in:
parent
a98da8ce93
commit
94b687306f
3 changed files with 4 additions and 10 deletions
|
@ -693,7 +693,7 @@ pub fn process_resolved_style_request<'a, N>(context: &LayoutContext,
|
||||||
thread_local: &mut tlc,
|
thread_local: &mut tlc,
|
||||||
};
|
};
|
||||||
|
|
||||||
let styles = resolve_style(&mut context, element, RuleInclusion::All, false, pseudo.as_ref());
|
let styles = resolve_style(&mut context, element, RuleInclusion::All, pseudo.as_ref());
|
||||||
let style = styles.primary();
|
let style = styles.primary();
|
||||||
let longhand_id = match *property {
|
let longhand_id = match *property {
|
||||||
PropertyId::LonghandAlias(id, _) |
|
PropertyId::LonghandAlias(id, _) |
|
||||||
|
|
|
@ -300,7 +300,6 @@ pub fn resolve_style<E>(
|
||||||
context: &mut StyleContext<E>,
|
context: &mut StyleContext<E>,
|
||||||
element: E,
|
element: E,
|
||||||
rule_inclusion: RuleInclusion,
|
rule_inclusion: RuleInclusion,
|
||||||
ignore_existing_style: bool,
|
|
||||||
pseudo: Option<&PseudoElement>,
|
pseudo: Option<&PseudoElement>,
|
||||||
) -> ElementStyles
|
) -> ElementStyles
|
||||||
where
|
where
|
||||||
|
@ -309,7 +308,6 @@ where
|
||||||
use style_resolver::StyleResolverForElement;
|
use style_resolver::StyleResolverForElement;
|
||||||
|
|
||||||
debug_assert!(rule_inclusion == RuleInclusion::DefaultOnly ||
|
debug_assert!(rule_inclusion == RuleInclusion::DefaultOnly ||
|
||||||
ignore_existing_style ||
|
|
||||||
pseudo.map_or(false, |p| p.is_before_or_after()) ||
|
pseudo.map_or(false, |p| p.is_before_or_after()) ||
|
||||||
element.borrow_data().map_or(true, |d| !d.has_styles()),
|
element.borrow_data().map_or(true, |d| !d.has_styles()),
|
||||||
"Why are we here?");
|
"Why are we here?");
|
||||||
|
@ -321,7 +319,7 @@ where
|
||||||
let mut style = None;
|
let mut style = None;
|
||||||
let mut ancestor = element.traversal_parent();
|
let mut ancestor = element.traversal_parent();
|
||||||
while let Some(current) = ancestor {
|
while let Some(current) = ancestor {
|
||||||
if rule_inclusion == RuleInclusion::All && !ignore_existing_style {
|
if rule_inclusion == RuleInclusion::All {
|
||||||
if let Some(data) = current.borrow_data() {
|
if let Some(data) = current.borrow_data() {
|
||||||
if let Some(ancestor_style) = data.styles.get_primary() {
|
if let Some(ancestor_style) = data.styles.get_primary() {
|
||||||
style = Some(ancestor_style.clone());
|
style = Some(ancestor_style.clone());
|
||||||
|
|
|
@ -3646,7 +3646,6 @@ pub extern "C" fn Servo_ResolveStyleLazily(
|
||||||
rule_inclusion: StyleRuleInclusion,
|
rule_inclusion: StyleRuleInclusion,
|
||||||
snapshots: *const ServoElementSnapshotTable,
|
snapshots: *const ServoElementSnapshotTable,
|
||||||
raw_data: RawServoStyleSetBorrowed,
|
raw_data: RawServoStyleSetBorrowed,
|
||||||
ignore_existing_styles: bool,
|
|
||||||
) -> ServoStyleContextStrong {
|
) -> ServoStyleContextStrong {
|
||||||
debug_assert!(!snapshots.is_null());
|
debug_assert!(!snapshots.is_null());
|
||||||
let global_style_data = &*GLOBAL_STYLE_DATA;
|
let global_style_data = &*GLOBAL_STYLE_DATA;
|
||||||
|
@ -3678,14 +3677,12 @@ pub extern "C" fn Servo_ResolveStyleLazily(
|
||||||
let is_before_or_after = pseudo.as_ref().map_or(false, |p| p.is_before_or_after());
|
let is_before_or_after = pseudo.as_ref().map_or(false, |p| p.is_before_or_after());
|
||||||
|
|
||||||
// In the common case we already have the style. Check that before setting
|
// In the common case we already have the style. Check that before setting
|
||||||
// up all the computation machinery. (Don't use it when we're getting
|
// up all the computation machinery.
|
||||||
// default styles or in a bfcached document (as indicated by
|
|
||||||
// ignore_existing_styles), though.)
|
|
||||||
//
|
//
|
||||||
// Also, only probe in the ::before or ::after case, since their styles may
|
// Also, only probe in the ::before or ::after case, since their styles may
|
||||||
// not be in the `ElementData`, given they may exist but not be applicable
|
// not be in the `ElementData`, given they may exist but not be applicable
|
||||||
// to generate an actual pseudo-element (like, having a `content: none`).
|
// to generate an actual pseudo-element (like, having a `content: none`).
|
||||||
if rule_inclusion == RuleInclusion::All && !ignore_existing_styles {
|
if rule_inclusion == RuleInclusion::All {
|
||||||
let styles = element.mutate_data().and_then(|d| {
|
let styles = element.mutate_data().and_then(|d| {
|
||||||
if d.has_styles() {
|
if d.has_styles() {
|
||||||
finish(&d.styles, is_before_or_after)
|
finish(&d.styles, is_before_or_after)
|
||||||
|
@ -3714,7 +3711,6 @@ pub extern "C" fn Servo_ResolveStyleLazily(
|
||||||
&mut context,
|
&mut context,
|
||||||
element,
|
element,
|
||||||
rule_inclusion,
|
rule_inclusion,
|
||||||
ignore_existing_styles,
|
|
||||||
pseudo.as_ref()
|
pseudo.as_ref()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue