aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout/fragment.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/layout/fragment.rs')
-rw-r--r--components/layout/fragment.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/components/layout/fragment.rs b/components/layout/fragment.rs
index f5f1677ad3d..8a6d8bf1c85 100644
--- a/components/layout/fragment.rs
+++ b/components/layout/fragment.rs
@@ -85,6 +85,9 @@ pub struct Fragment {
/// The CSS style of this fragment.
pub style: Arc<ServoComputedValues>,
+ /// The CSS style of this fragment when it's selected
+ pub selected_style: Arc<ServoComputedValues>,
+
/// The position of this fragment relative to its owning flow. The size includes padding and
/// border, but not margin.
///
@@ -798,6 +801,7 @@ impl Fragment {
Fragment {
node: node.opaque(),
style: style,
+ selected_style: node.selected_style().clone(),
restyle_damage: restyle_damage,
border_box: LogicalRect::zero(writing_mode),
border_padding: LogicalMargin::zero(writing_mode),
@@ -815,6 +819,7 @@ impl Fragment {
pub fn from_opaque_node_and_style(node: OpaqueNode,
pseudo: PseudoElementType<()>,
style: Arc<ServoComputedValues>,
+ selected_style: Arc<ServoComputedValues>,
mut restyle_damage: RestyleDamage,
specific: SpecificFragmentInfo)
-> Fragment {
@@ -825,6 +830,7 @@ impl Fragment {
Fragment {
node: node,
style: style,
+ selected_style: selected_style,
restyle_damage: restyle_damage,
border_box: LogicalRect::zero(writing_mode),
border_padding: LogicalMargin::zero(writing_mode),
@@ -858,6 +864,7 @@ impl Fragment {
Fragment {
node: self.node,
style: self.style.clone(),
+ selected_style: self.selected_style.clone(),
restyle_damage: restyle_damage,
border_box: new_border_box,
border_padding: self.border_padding,
@@ -1286,6 +1293,11 @@ impl Fragment {
&*self.style
}
+ #[inline(always)]
+ pub fn selected_style(&self) -> &ServoComputedValues {
+ &*self.selected_style
+ }
+
pub fn white_space(&self) -> white_space::T {
self.style().get_inheritedtext().white_space
}