aboutsummaryrefslogtreecommitdiffstats
path: root/components
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2017-07-17 21:16:26 -0700
committerGitHub <noreply@github.com>2017-07-17 21:16:26 -0700
commit1b6d29e31996c87218352b825aa93e01909a6a24 (patch)
tree9d0b30ee06926f9b9a221069b924791fde6c8f80 /components
parentd746abaa9e69e6cf0ad187d2b46be661bbe03a9f (diff)
parentbae59d45204668ef16b646b62fc71eea0559ad9a (diff)
downloadservo-1b6d29e31996c87218352b825aa93e01909a6a24.tar.gz
servo-1b6d29e31996c87218352b825aa93e01909a6a24.zip
Auto merge of #17764 - upsuper:fieldset-flexgrid, r=emilio,heycam
Adjust display value for ::-moz-fieldset-content when parent is flex/grid This is the Servo side change for [bug 1379901](https://bugzilla.mozilla.org/show_bug.cgi?id=1379901). <!-- 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/17764) <!-- Reviewable:end -->
Diffstat (limited to 'components')
-rw-r--r--components/style/gecko/pseudo_element.rs6
-rw-r--r--components/style/properties/properties.mako.rs3
-rw-r--r--components/style/style_adjuster.rs26
3 files changed, 35 insertions, 0 deletions
diff --git a/components/style/gecko/pseudo_element.rs b/components/style/gecko/pseudo_element.rs
index 564a288b448..97ce0f4e5a1 100644
--- a/components/style/gecko/pseudo_element.rs
+++ b/components/style/gecko/pseudo_element.rs
@@ -83,6 +83,12 @@ impl PseudoElement {
*self == PseudoElement::FirstLetter
}
+ /// Whether this pseudo-element is ::-moz-fieldset-content.
+ #[inline]
+ pub fn is_fieldset_content(&self) -> bool {
+ *self == PseudoElement::FieldsetContent
+ }
+
/// Whether this pseudo-element is lazily-cascaded.
#[inline]
pub fn is_lazy(&self) -> bool {
diff --git a/components/style/properties/properties.mako.rs b/components/style/properties/properties.mako.rs
index 43248e0feae..b04f03547a1 100644
--- a/components/style/properties/properties.mako.rs
+++ b/components/style/properties/properties.mako.rs
@@ -2668,6 +2668,9 @@ bitflags! {
/// is used by Gecko to prevent display:contents on generated
/// content.
const PROHIBIT_DISPLAY_CONTENTS = 0x10,
+
+ /// Whether we're styling the ::-moz-fieldset-content anonymous box.
+ const IS_FIELDSET_CONTENT = 0x20,
}
}
diff --git a/components/style/style_adjuster.rs b/components/style/style_adjuster.rs
index 9b4d8a69551..72c4e675c8b 100644
--- a/components/style/style_adjuster.rs
+++ b/components/style/style_adjuster.rs
@@ -291,6 +291,31 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
self.style.mutate_box().set_display(display::inline);
}
+ /// If a <fieldset> has grid/flex display type, we need to inherit
+ /// this type into its ::-moz-fieldset-content anonymous box.
+ #[cfg(feature = "gecko")]
+ fn adjust_for_fieldset_content(&mut self,
+ layout_parent_style: &ComputedValuesInner,
+ flags: CascadeFlags) {
+ use properties::IS_FIELDSET_CONTENT;
+ if !flags.contains(IS_FIELDSET_CONTENT) {
+ return;
+ }
+ debug_assert_eq!(self.style.get_box().clone_display(), display::block);
+ // TODO We actually want style from parent rather than layout
+ // parent, so that this fixup doesn't happen incorrectly when
+ // when <fieldset> has "display: contents".
+ let parent_display = layout_parent_style.get_box().clone_display();
+ let new_display = match parent_display {
+ display::flex | display::inline_flex => Some(display::flex),
+ display::grid | display::inline_grid => Some(display::grid),
+ _ => None,
+ };
+ if let Some(new_display) = new_display {
+ self.style.mutate_box().set_display(new_display);
+ }
+ }
+
/// -moz-center, -moz-left and -moz-right are used for HTML's alignment.
///
/// This is covering the <div align="right"><table>...</table></div> case.
@@ -412,6 +437,7 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
#[cfg(feature = "gecko")]
{
self.adjust_for_prohibited_display_contents(flags);
+ self.adjust_for_fieldset_content(layout_parent_style, flags);
}
self.adjust_for_top_layer();
self.blockify_if_necessary(layout_parent_style, flags);