style: Add a TLS-based style struct caching mechanism.

This commit is contained in:
Emilio Cobos Álvarez 2017-08-23 20:04:11 +08:00 committed by Cameron McCormack
parent 298b1363ff
commit c34c92e904
18 changed files with 278 additions and 13 deletions

View file

@ -52,7 +52,7 @@ use gecko::values::round_border_to_device_pixels;
use logical_geometry::WritingMode;
use media_queries::Device;
use properties::animated_properties::TransitionProperty;
use properties::computed_value_flags::ComputedValueFlags;
use properties::computed_value_flags::*;
use properties::{default_font_size_keyword, longhands, FontComputationData, Importance, LonghandId};
use properties::{PropertyDeclaration, PropertyDeclarationBlock, PropertyDeclarationId};
use rule_tree::StrongRuleNode;
@ -259,6 +259,11 @@ impl ops::DerefMut for ComputedValues {
}
impl ComputedValuesInner {
/// Whether we're a visited style.
pub fn is_style_if_visited(&self) -> bool {
self.flags.contains(IS_STYLE_IF_VISITED)
}
#[inline]
pub fn is_display_contents(&self) -> bool {
self.get_box().clone_display() == longhands::display::computed_value::T::contents