Auto merge of #17912 - bzbarsky:stylo-first-line, r=emilio

Implement ::first-line support in stylo

<!-- Please describe your changes on the following line: -->

Fixes Gecko bug 1324619.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix https://bugzilla.mozilla.org/show_bug.cgi?id=1324619

<!-- Either: -->
- [ ] There are tests for these changes OR
- [X] These changes do not require tests because there are Gecko tests

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- 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/17912)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-07-28 22:51:20 -05:00 committed by GitHub
commit ed75bcae75
9 changed files with 204 additions and 37 deletions

View file

@ -204,6 +204,15 @@ impl PerDocumentStyleDataImpl {
pub fn clear_stylist(&mut self) {
self.stylist.clear();
}
/// Returns whether visited links are enabled.
fn visited_links_enabled(&self) -> bool {
unsafe { bindings::Gecko_AreVisitedLinksEnabled() }
}
/// Returns whether visited styles are enabled.
pub fn visited_styles_enabled(&self) -> bool {
self.visited_links_enabled() && !self.is_private_browsing_enabled()
}
}
unsafe impl HasFFI for PerDocumentStyleData {

View file

@ -2817,6 +2817,16 @@ extern "C" {
set: RawServoStyleSetBorrowed)
-> ServoStyleContextStrong;
}
extern "C" {
pub fn Servo_ReparentStyle(style_to_reparent: ServoStyleContextBorrowed,
parent_style: ServoStyleContextBorrowed,
parent_style_ignoring_first_line:
ServoStyleContextBorrowed,
layout_parent_style: ServoStyleContextBorrowed,
element: RawGeckoElementBorrowedOrNull,
set: RawServoStyleSetBorrowed)
-> ServoStyleContextStrong;
}
extern "C" {
pub fn Servo_TraverseSubtree(root: RawGeckoElementBorrowed,
set: RawServoStyleSetBorrowed,

View file

@ -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 {