Auto merge of #16967 - emilio:after, r=heycam,emilio

Bug 1366144: Correctly diff ::before and ::after pseudo-element styles if there's no generated content. r=heycam

<!-- 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/16967)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-05-20 13:44:31 -05:00 committed by GitHub
commit 05a26a2996
15 changed files with 692 additions and 227 deletions

View file

@ -141,6 +141,13 @@ impl ComputedValues {
self.get_box().clone_display() == longhands::display::computed_value::T::contents
}
/// Returns true if the value of the `content` property would make a
/// pseudo-element not rendered.
#[inline]
pub fn ineffective_content_property(&self) -> bool {
self.get_counters().ineffective_content_property()
}
% for style_struct in data.style_structs:
#[inline]
pub fn clone_${style_struct.name_lower}(&self) -> Arc<style_structs::${style_struct.name}> {
@ -4204,6 +4211,10 @@ clip-path
<%self:impl_trait style_struct_name="Counters"
skip_longhands="content counter-increment counter-reset">
pub fn ineffective_content_property(&self) -> bool {
self.gecko.mContents.is_empty()
}
pub fn set_content(&mut self, v: longhands::content::computed_value::T) {
use properties::longhands::content::computed_value::T;
use properties::longhands::content::computed_value::ContentItem;

View file

@ -1813,6 +1813,19 @@ impl ComputedValues {
/// Since this isn't supported in Servo, this is always false for Servo.
pub fn is_display_contents(&self) -> bool { false }
#[inline]
/// Returns whether the "content" property for the given style is completely
/// ineffective, and would yield an empty `::before` or `::after`
/// pseudo-element.
pub fn ineffective_content_property(&self) -> bool {
use properties::longhands::content::computed_value::T;
match self.get_counters().content {
T::normal |
T::none => true,
T::Content(ref items) => items.is_empty(),
}
}
/// Whether the current style is multicolumn.
#[inline]
pub fn is_multicol(&self) -> bool {