Skip to content

Commit

Permalink
Make sure we don't recreate boxes just because we have a ::first-line.
Browse files Browse the repository at this point in the history
Servo part of part 5 of the fix for Gecko bug 1324619.  r=emilio
  • Loading branch information
bzbarsky committed Jul 29, 2017
1 parent 7161fff commit c531af9
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
6 changes: 6 additions & 0 deletions components/style/gecko/pseudo_element.rs
Expand Up @@ -87,6 +87,12 @@ impl PseudoElement {
*self == PseudoElement::FirstLetter
}

/// Whether this pseudo-element is ::first-line.
#[inline]
pub fn is_first_line(&self) -> bool {
*self == PseudoElement::FirstLine
}

/// Whether this pseudo-element is ::-moz-fieldset-content.
#[inline]
pub fn is_fieldset_content(&self) -> bool {
Expand Down
2 changes: 1 addition & 1 deletion components/style/matching.rs
Expand Up @@ -827,7 +827,7 @@ pub trait MatchMethods : TElement {
return StyleDifference::new(RestyleDamage::empty(), StyleChange::Unchanged)
}

if pseudo.map_or(false, |p| p.is_first_letter()) {
if pseudo.map_or(false, |p| p.is_first_letter() || p.is_first_line()) {
// No one cares about this pseudo, and we've checked above that
// we're not switching from a "cares" to a "doesn't care" state
// or vice versa.
Expand Down
8 changes: 8 additions & 0 deletions components/style/servo/selector_parser.rs
Expand Up @@ -42,6 +42,8 @@ pub enum PseudoElement {
Selection,
// If/when :first-letter is added, update is_first_letter accordingly.

// If/when :first-line is added, update is_first_line accordingly.

// If/when ::first-letter, ::first-line, or ::placeholder are added, adjust
// our property_restriction implementation to do property filtering for
// them. Also, make sure the UA sheet has the !important rules some of the
Expand Down Expand Up @@ -125,6 +127,12 @@ impl PseudoElement {
false
}

/// Whether the current pseudo element is :first-line
#[inline]
pub fn is_first_line(&self) -> bool {
false
}

/// Whether this pseudo-element is eagerly-cascaded.
#[inline]
pub fn is_eager(&self) -> bool {
Expand Down

0 comments on commit c531af9

Please sign in to comment.