mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
geckolib: Fix geckolib build after style and layout changes
This commit is contained in:
parent
5577a083ec
commit
1a0175fdbb
4 changed files with 87 additions and 9 deletions
|
@ -22,7 +22,7 @@ use util::workqueue::WorkQueue;
|
||||||
pub struct PerDocumentStyleData {
|
pub struct PerDocumentStyleData {
|
||||||
|
|
||||||
/// Rule processor.
|
/// Rule processor.
|
||||||
pub stylist: Stylist,
|
pub stylist: Arc<Stylist>,
|
||||||
|
|
||||||
/// List of stylesheets, mirrored from Gecko.
|
/// List of stylesheets, mirrored from Gecko.
|
||||||
pub stylesheets: Vec<Arc<Stylesheet>>,
|
pub stylesheets: Vec<Arc<Stylesheet>>,
|
||||||
|
@ -50,8 +50,8 @@ impl PerDocumentStyleData {
|
||||||
let num_threads = cmp::max(num_cpus::get() * 3 / 4, 1);
|
let num_threads = cmp::max(num_cpus::get() * 3 / 4, 1);
|
||||||
|
|
||||||
PerDocumentStyleData {
|
PerDocumentStyleData {
|
||||||
stylist: Stylist::new(device),
|
stylist: Arc::new(Stylist::new(device)),
|
||||||
stylesheets: Vec::new(),
|
stylesheets: vec![],
|
||||||
stylesheets_changed: true,
|
stylesheets_changed: true,
|
||||||
new_animations_sender: new_anims_sender,
|
new_animations_sender: new_anims_sender,
|
||||||
new_animations_receiver: new_anims_receiver,
|
new_animations_receiver: new_anims_receiver,
|
||||||
|
|
|
@ -18,7 +18,7 @@ use std::ptr;
|
||||||
use std::slice;
|
use std::slice;
|
||||||
use std::str::from_utf8_unchecked;
|
use std::str::from_utf8_unchecked;
|
||||||
use std::sync::{Arc, Mutex};
|
use std::sync::{Arc, Mutex};
|
||||||
use style::context::{ReflowGoal, StylistWrapper};
|
use style::context::{ReflowGoal};
|
||||||
use style::dom::{TDocument, TElement, TNode};
|
use style::dom::{TDocument, TElement, TNode};
|
||||||
use style::error_reporting::StdoutErrorReporter;
|
use style::error_reporting::StdoutErrorReporter;
|
||||||
use style::parallel;
|
use style::parallel;
|
||||||
|
@ -51,7 +51,8 @@ pub extern "C" fn Servo_RestyleDocument(doc: *mut RawGeckoDocument, raw_data: *m
|
||||||
// into a runtime-wide init hook at some point.
|
// into a runtime-wide init hook at some point.
|
||||||
GeckoComputedValues::initial_values();
|
GeckoComputedValues::initial_values();
|
||||||
|
|
||||||
let _needs_dirtying = data.stylist.update(&data.stylesheets, data.stylesheets_changed);
|
let _needs_dirtying = Arc::get_mut(&mut data.stylist).unwrap()
|
||||||
|
.update(&data.stylesheets, data.stylesheets_changed);
|
||||||
data.stylesheets_changed = false;
|
data.stylesheets_changed = false;
|
||||||
|
|
||||||
let shared_style_context = SharedStyleContext {
|
let shared_style_context = SharedStyleContext {
|
||||||
|
@ -59,7 +60,7 @@ pub extern "C" fn Servo_RestyleDocument(doc: *mut RawGeckoDocument, raw_data: *m
|
||||||
screen_size_changed: false,
|
screen_size_changed: false,
|
||||||
generation: 0,
|
generation: 0,
|
||||||
goal: ReflowGoal::ForScriptQuery,
|
goal: ReflowGoal::ForScriptQuery,
|
||||||
stylist: StylistWrapper(&data.stylist),
|
stylist: data.stylist.clone(),
|
||||||
new_animations_sender: Mutex::new(data.new_animations_sender.clone()),
|
new_animations_sender: Mutex::new(data.new_animations_sender.clone()),
|
||||||
running_animations: data.running_animations.clone(),
|
running_animations: data.running_animations.clone(),
|
||||||
expired_animations: data.expired_animations.clone(),
|
expired_animations: data.expired_animations.clone(),
|
||||||
|
|
|
@ -232,12 +232,89 @@ impl SelectorImpl for GeckoSelectorImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl SelectorImplExt for GeckoSelectorImpl {
|
impl SelectorImplExt for GeckoSelectorImpl {
|
||||||
|
type ComputedValues = GeckoComputedValues;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn each_eagerly_cascaded_pseudo_element<F>(mut fun: F)
|
fn is_eagerly_cascaded_pseudo_element(pseudo: &PseudoElement) -> bool {
|
||||||
|
match *pseudo {
|
||||||
|
PseudoElement::Before |
|
||||||
|
PseudoElement::After |
|
||||||
|
PseudoElement::FirstLine => true,
|
||||||
|
_ => false,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
fn each_pseudo_element<F>(mut fun: F)
|
||||||
where F: FnMut(PseudoElement) {
|
where F: FnMut(PseudoElement) {
|
||||||
fun(PseudoElement::Before);
|
fun(PseudoElement::Before);
|
||||||
fun(PseudoElement::After);
|
fun(PseudoElement::After);
|
||||||
// TODO: probably a lot more are missing here
|
fun(PseudoElement::FirstLine);
|
||||||
|
|
||||||
|
fun(PseudoElement::MozNonElement);
|
||||||
|
fun(PseudoElement::MozAnonymousBlock);
|
||||||
|
fun(PseudoElement::MozAnonymousPositionedBlock);
|
||||||
|
fun(PseudoElement::MozMathMLAnonymousBlock);
|
||||||
|
fun(PseudoElement::MozXULAnonymousBlock);
|
||||||
|
|
||||||
|
fun(PseudoElement::MozHorizontalFramesetBorder);
|
||||||
|
fun(PseudoElement::MozVerticalFramesetBorder);
|
||||||
|
fun(PseudoElement::MozLineFrame);
|
||||||
|
fun(PseudoElement::MozButtonContent);
|
||||||
|
fun(PseudoElement::MozButtonLabel);
|
||||||
|
fun(PseudoElement::MozCellContent);
|
||||||
|
fun(PseudoElement::MozDropdownList);
|
||||||
|
fun(PseudoElement::MozFieldsetContent);
|
||||||
|
fun(PseudoElement::MozFramesetBlank);
|
||||||
|
fun(PseudoElement::MozDisplayComboboxControlFrame);
|
||||||
|
|
||||||
|
fun(PseudoElement::MozHTMLCanvasContent);
|
||||||
|
fun(PseudoElement::MozInlineTable);
|
||||||
|
fun(PseudoElement::MozTable);
|
||||||
|
fun(PseudoElement::MozTableCell);
|
||||||
|
fun(PseudoElement::MozTableColumnGroup);
|
||||||
|
fun(PseudoElement::MozTableColumn);
|
||||||
|
fun(PseudoElement::MozTableOuter);
|
||||||
|
fun(PseudoElement::MozTableRowGroup);
|
||||||
|
fun(PseudoElement::MozTableRow);
|
||||||
|
|
||||||
|
fun(PseudoElement::MozCanvas);
|
||||||
|
fun(PseudoElement::MozPageBreak);
|
||||||
|
fun(PseudoElement::MozPage);
|
||||||
|
fun(PseudoElement::MozPageContent);
|
||||||
|
fun(PseudoElement::MozPageSequence);
|
||||||
|
fun(PseudoElement::MozScrolledContent);
|
||||||
|
fun(PseudoElement::MozScrolledCanvas);
|
||||||
|
fun(PseudoElement::MozScrolledPageSequence);
|
||||||
|
fun(PseudoElement::MozColumnContent);
|
||||||
|
fun(PseudoElement::MozViewport);
|
||||||
|
fun(PseudoElement::MozViewportScroll);
|
||||||
|
fun(PseudoElement::MozAnonymousFlexItem);
|
||||||
|
fun(PseudoElement::MozAnonymousGridItem);
|
||||||
|
|
||||||
|
fun(PseudoElement::MozRuby);
|
||||||
|
fun(PseudoElement::MozRubyBase);
|
||||||
|
fun(PseudoElement::MozRubyBaseContainer);
|
||||||
|
fun(PseudoElement::MozRubyText);
|
||||||
|
fun(PseudoElement::MozRubyTextContainer);
|
||||||
|
|
||||||
|
fun(PseudoElement::MozTreeColumn);
|
||||||
|
fun(PseudoElement::MozTreeRow);
|
||||||
|
fun(PseudoElement::MozTreeSeparator);
|
||||||
|
fun(PseudoElement::MozTreeCell);
|
||||||
|
fun(PseudoElement::MozTreeIndentation);
|
||||||
|
fun(PseudoElement::MozTreeLine);
|
||||||
|
fun(PseudoElement::MozTreeTwisty);
|
||||||
|
fun(PseudoElement::MozTreeImage);
|
||||||
|
fun(PseudoElement::MozTreeCellText);
|
||||||
|
fun(PseudoElement::MozTreeCheckbox);
|
||||||
|
fun(PseudoElement::MozTreeProgressMeter);
|
||||||
|
fun(PseudoElement::MozTreeDropFeedback);
|
||||||
|
|
||||||
|
fun(PseudoElement::MozSVGMarkerAnonChild);
|
||||||
|
fun(PseudoElement::MozSVGOuterSVGAnonChild);
|
||||||
|
fun(PseudoElement::MozSVGForeignContent);
|
||||||
|
fun(PseudoElement::MozSVGText);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
|
|
@ -52,7 +52,7 @@ impl<'a> StandaloneStyleContext<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> StyleContext<'a, GeckoSelectorImpl, GeckoComputedValues> for StandaloneStyleContext<'a> {
|
impl<'a> StyleContext<'a, GeckoSelectorImpl> for StandaloneStyleContext<'a> {
|
||||||
fn shared_context(&self) -> &'a SharedStyleContext {
|
fn shared_context(&self) -> &'a SharedStyleContext {
|
||||||
&self.shared
|
&self.shared
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue