diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2016-03-31 00:47:07 +0530 |
---|---|---|
committer | bors-servo <lbergstrom+bors@mozilla.com> | 2016-03-31 00:47:07 +0530 |
commit | 723989b9dddeb9bcdc28dc7d640fd6fd7247a27f (patch) | |
tree | 1cc0d0875809577e8d2dafab2a3623b043022523 /components/layout/fragment.rs | |
parent | e1485718128bff632eff5445583e925ff796bdba (diff) | |
parent | 46829bd53ced5d7d5a4b4c6600f2061cc8720536 (diff) | |
download | servo-723989b9dddeb9bcdc28dc7d640fd6fd7247a27f.tar.gz servo-723989b9dddeb9bcdc28dc7d640fd6fd7247a27f.zip |
Auto merge of #10252 - emilio:selection, r=mbrubeck
Implement ::selection pseudo-element
It only supports `color` and `background`, for now, but it shouldn't be hard to add more properties (like text-shadow).
r? @mbrubeck
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10252)
<!-- Reviewable:end -->
Diffstat (limited to 'components/layout/fragment.rs')
-rw-r--r-- | components/layout/fragment.rs | 12 |
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 } |