Implement XUL tree pseudo style resolution for stylo.

This commit is contained in:
Xidorn Quan 2017-10-20 14:08:40 +11:00
parent 915890af77
commit 2dc714f0ac
9 changed files with 172 additions and 10 deletions

View file

@ -15,6 +15,7 @@ use gecko_bindings::structs::mozilla::css::ImageValue;
use gecko_bindings::structs::mozilla::css::URLValue;
use gecko_bindings::structs::mozilla::css::URLValueData;
use gecko_bindings::structs::mozilla::AnonymousCounterStyle;
use gecko_bindings::structs::mozilla::AtomArray;
use gecko_bindings::structs::mozilla::MallocSizeOf;
use gecko_bindings::structs::mozilla::OriginFlags;
use gecko_bindings::structs::mozilla::UniquePtr;
@ -2945,6 +2946,19 @@ extern "C" {
set: RawServoStyleSetBorrowed)
-> ServoStyleContextStrong;
}
extern "C" {
pub fn Servo_ComputedValues_ResolveXULTreePseudoStyle(element:
RawGeckoElementBorrowed,
pseudo_tag:
*mut nsAtom,
inherited_style:
ServoStyleContextBorrowed,
input_word:
*const AtomArray,
set:
RawServoStyleSetBorrowed)
-> ServoStyleContextStrong;
}
extern "C" {
pub fn Servo_SetExplicitStyle(element: RawGeckoElementBorrowed,
primary_style: ServoStyleContextBorrowed);

View file

@ -1326,6 +1326,48 @@ impl PseudoElement {
None
}
/// Construct a tree pseudo-element from atom and args.
#[inline]
pub fn from_tree_pseudo_atom(atom: &Atom, args: Box<[Atom]>) -> Option<Self> {
if atom == &atom!(":-moz-tree-column") {
return Some(PseudoElement::MozTreeColumn(args));
}
if atom == &atom!(":-moz-tree-row") {
return Some(PseudoElement::MozTreeRow(args));
}
if atom == &atom!(":-moz-tree-separator") {
return Some(PseudoElement::MozTreeSeparator(args));
}
if atom == &atom!(":-moz-tree-cell") {
return Some(PseudoElement::MozTreeCell(args));
}
if atom == &atom!(":-moz-tree-indentation") {
return Some(PseudoElement::MozTreeIndentation(args));
}
if atom == &atom!(":-moz-tree-line") {
return Some(PseudoElement::MozTreeLine(args));
}
if atom == &atom!(":-moz-tree-twisty") {
return Some(PseudoElement::MozTreeTwisty(args));
}
if atom == &atom!(":-moz-tree-image") {
return Some(PseudoElement::MozTreeImage(args));
}
if atom == &atom!(":-moz-tree-cell-text") {
return Some(PseudoElement::MozTreeCellText(args));
}
if atom == &atom!(":-moz-tree-checkbox") {
return Some(PseudoElement::MozTreeCheckbox(args));
}
if atom == &atom!(":-moz-tree-progressmeter") {
return Some(PseudoElement::MozTreeProgressmeter(args));
}
if atom == &atom!(":-moz-tree-drop-feedback") {
return Some(PseudoElement::MozTreeDropFeedback(args));
}
None
}
/// Constructs an atom from a string of text, and whether we're in a
/// user-agent stylesheet.
///

View file

@ -4175,6 +4175,7 @@ pub mod root {
pub struct ShortcutKeyCandidate {
_unused: [u8; 0],
}
pub type AtomArray = root::nsTArray<root::RefPtr<root::nsAtom>>;
/// EventStates is the class used to represent the event states of nsIContent
/// instances. These states are calculated by IntrinsicState() and
/// ContentStatesChanged() has to be called when one of them changes thus
@ -22385,8 +22386,6 @@ pub mod root {
pub struct nsAttrValue {
pub mBits: usize,
}
pub type nsAttrValue_AtomArray =
root::nsTArray<root::RefPtr<root::nsAtom>>;
pub const nsAttrValue_ValueType_eSVGTypesBegin:
root::nsAttrValue_ValueType =
nsAttrValue_ValueType::eSVGAngle;