aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2017-03-13 10:47:05 -0700
committerGitHub <noreply@github.com>2017-03-13 10:47:05 -0700
commite648ebd1613927d3c280540e10703d406f408c09 (patch)
treec776f6f79c2971c291a7efcb3b64d2ab085f0d1a
parenta6f89c503671726bcb0407cd84c380f3af4a7916 (diff)
parent275865486e925ae67f9e05b36c695e7c12b97865 (diff)
downloadservo-e648ebd1613927d3c280540e10703d406f408c09.tar.gz
servo-e648ebd1613927d3c280540e10703d406f408c09.zip
Auto merge of #15910 - bzbarsky:anon-box-nofixup, r=emilio
Add support for skipping display fixup for pseudos. This is needed for https://bugzilla.mozilla.org/show_bug.cgi?id=1346481 <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [X] These changes do not require tests because will be tested on the Gecko side <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/15910) <!-- Reviewable:end -->
-rw-r--r--components/script_layout_interface/wrapper_traits.rs4
-rw-r--r--components/style/gecko_bindings/bindings.rs1
-rw-r--r--components/style/stylist.rs19
-rw-r--r--ports/geckolib/glue.rs15
4 files changed, 24 insertions, 15 deletions
diff --git a/components/script_layout_interface/wrapper_traits.rs b/components/script_layout_interface/wrapper_traits.rs
index 5930538eac2..d8768384245 100644
--- a/components/script_layout_interface/wrapper_traits.rs
+++ b/components/script_layout_interface/wrapper_traits.rs
@@ -21,7 +21,7 @@ use style::context::SharedStyleContext;
use style::data::ElementData;
use style::dom::{LayoutIterator, NodeInfo, PresentationalHintsSynthetizer, TNode};
use style::dom::OpaqueNode;
-use style::properties::ServoComputedValues;
+use style::properties::{CascadeFlags, ServoComputedValues};
use style::selector_parser::{PseudoElement, PseudoElementCascadeType, SelectorImpl};
#[derive(Copy, PartialEq, Clone, Debug)]
@@ -408,7 +408,7 @@ pub trait ThreadSafeLayoutElement: Clone + Copy + Sized + Debug +
&style_pseudo,
Some(data.styles().primary.values()),
&context.default_computed_values,
- false);
+ CascadeFlags::empty());
data.styles_mut().pseudos
.insert(style_pseudo.clone(), new_style);
}
diff --git a/components/style/gecko_bindings/bindings.rs b/components/style/gecko_bindings/bindings.rs
index 2a92156fee4..e3faed75b5a 100644
--- a/components/style/gecko_bindings/bindings.rs
+++ b/components/style/gecko_bindings/bindings.rs
@@ -1666,6 +1666,7 @@ extern "C" {
pub fn Servo_ComputedValues_GetForAnonymousBox(parent_style_or_null:
ServoComputedValuesBorrowedOrNull,
pseudoTag: *mut nsIAtom,
+ skip_display_fixup: bool,
set:
RawServoStyleSetBorrowed)
-> ServoComputedValuesStrong;
diff --git a/components/style/stylist.rs b/components/style/stylist.rs
index 5f7aef1666f..d75963b011b 100644
--- a/components/style/stylist.rs
+++ b/components/style/stylist.rs
@@ -14,7 +14,9 @@ use keyframes::KeyframesAnimation;
use media_queries::Device;
use parking_lot::RwLock;
use pdqsort::sort_by;
-use properties::{self, CascadeFlags, ComputedValues, INHERIT_ALL};
+use properties::{self, CascadeFlags, ComputedValues};
+#[cfg(feature = "servo")]
+use properties::INHERIT_ALL;
use properties::PropertyDeclarationBlock;
use restyle_hints::{RestyleHint, DependencySet};
use rule_tree::{CascadeLevel, RuleTree, StrongRuleNode, StyleSource};
@@ -294,7 +296,7 @@ impl Stylist {
pseudo: &PseudoElement,
parent: Option<&Arc<ComputedValues>>,
default: &Arc<ComputedValues>,
- inherit_all: bool)
+ cascade_flags: CascadeFlags)
-> ComputedStyle {
debug_assert!(SelectorImpl::pseudo_element_cascade_type(pseudo).is_precomputed());
@@ -308,11 +310,6 @@ impl Stylist {
None => self.rule_tree.root(),
};
- let mut flags = CascadeFlags::empty();
- if inherit_all {
- flags.insert(INHERIT_ALL)
- }
-
// NOTE(emilio): We skip calculating the proper layout parent style
// here.
//
@@ -335,7 +332,7 @@ impl Stylist {
default,
None,
Box::new(StdoutErrorReporter),
- flags);
+ cascade_flags);
ComputedStyle::new(rule_node, Arc::new(computed))
}
@@ -363,7 +360,11 @@ impl Stylist {
unreachable!("That pseudo doesn't represent an anonymous box!")
}
};
- self.precomputed_values_for_pseudo(&pseudo, Some(parent_style), default_style, inherit_all)
+ let mut cascade_flags = CascadeFlags::empty();
+ if inherit_all {
+ cascade_flags.insert(INHERIT_ALL);
+ }
+ self.precomputed_values_for_pseudo(&pseudo, Some(parent_style), default_style, cascade_flags)
.values.unwrap()
}
diff --git a/ports/geckolib/glue.rs b/ports/geckolib/glue.rs
index 2d8fc443792..eb51eb7ea09 100644
--- a/ports/geckolib/glue.rs
+++ b/ports/geckolib/glue.rs
@@ -67,8 +67,9 @@ use style::keyframes::KeyframesStepValue;
use style::media_queries::{MediaList, parse_media_query_list};
use style::parallel;
use style::parser::{ParserContext, ParserContextExtraData};
-use style::properties::{ComputedValues, Importance, ParsedDeclaration};
+use style::properties::{CascadeFlags, ComputedValues, Importance, ParsedDeclaration};
use style::properties::{PropertyDeclarationBlock, PropertyId};
+use style::properties::SKIP_ROOT_AND_ITEM_BASED_DISPLAY_FIXUP;
use style::properties::animated_properties::{AnimationValue, Interpolate, TransitionProperty};
use style::properties::parse_one_declaration;
use style::restyle_hints::{self, RestyleHint};
@@ -618,8 +619,9 @@ pub extern "C" fn Servo_MediaRule_GetCssText(rule: RawServoMediaRuleBorrowed, re
#[no_mangle]
pub extern "C" fn Servo_ComputedValues_GetForAnonymousBox(parent_style_or_null: ServoComputedValuesBorrowedOrNull,
- pseudo_tag: *mut nsIAtom,
- raw_data: RawServoStyleSetBorrowed)
+ pseudo_tag: *mut nsIAtom,
+ skip_display_fixup: bool,
+ raw_data: RawServoStyleSetBorrowed)
-> ServoComputedValuesStrong {
let data = PerDocumentStyleData::from_ffi(raw_data).borrow_mut();
let atom = Atom::from(pseudo_tag);
@@ -627,8 +629,13 @@ pub extern "C" fn Servo_ComputedValues_GetForAnonymousBox(parent_style_or_null:
let maybe_parent = ComputedValues::arc_from_borrowed(&parent_style_or_null);
+ let mut cascade_flags = CascadeFlags::empty();
+ if skip_display_fixup {
+ cascade_flags.insert(SKIP_ROOT_AND_ITEM_BASED_DISPLAY_FIXUP);
+ }
data.stylist.precomputed_values_for_pseudo(&pseudo, maybe_parent,
- data.default_computed_values(), false)
+ data.default_computed_values(),
+ cascade_flags)
.values.unwrap()
.into_strong()
}