Auto merge of #10155 - bholley:generalize_style_structs, r=SimonSapin

Generalize the style structs

This allows geckolib to pass gecko style structs and have the style system write to them directly, provided we implement all the traits.

<!-- 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/10155)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-03-25 03:27:33 +05:30
commit 605842f193
47 changed files with 995 additions and 433 deletions

View file

@ -3,6 +3,8 @@ name = "geckoservo"
version = "0.0.1"
authors = ["The Servo Project Developers"]
build = "build.rs"
[lib]
name = "geckoservo"
path = "lib.rs"

View file

@ -28,6 +28,7 @@ pub type intptr_t = int64_t;
pub type uintptr_t = uint64_t;
pub type intmax_t = ::libc::c_long;
pub type uintmax_t = ::libc::c_ulong;
pub enum nsIAtom { }
pub enum nsINode { }
pub type RawGeckoNode = nsINode;
pub enum Element { }
@ -35,6 +36,7 @@ pub type RawGeckoElement = Element;
pub enum nsIDocument { }
pub type RawGeckoDocument = nsIDocument;
pub enum ServoNodeData { }
pub enum ServoComputedValues { }
pub enum RawServoStyleSheet { }
pub enum RawServoStyleSet { }
extern "C" {
@ -72,7 +74,8 @@ extern "C" {
pub fn Servo_StylesheetFromUTF8Bytes(bytes: *const uint8_t,
length: uint32_t)
-> *mut RawServoStyleSheet;
pub fn Servo_ReleaseStylesheet(sheet: *mut RawServoStyleSheet);
pub fn Servo_AddRefStyleSheet(sheet: *mut RawServoStyleSheet);
pub fn Servo_ReleaseStyleSheet(sheet: *mut RawServoStyleSheet);
pub fn Servo_AppendStyleSheet(sheet: *mut RawServoStyleSheet,
set: *mut RawServoStyleSet);
pub fn Servo_PrependStyleSheet(sheet: *mut RawServoStyleSheet,
@ -82,6 +85,12 @@ extern "C" {
pub fn Servo_StyleSheetHasRules(sheet: *mut RawServoStyleSheet) -> bool;
pub fn Servo_InitStyleSet() -> *mut RawServoStyleSet;
pub fn Servo_DropStyleSet(set: *mut RawServoStyleSet);
pub fn Servo_GetComputedValues(element: *mut RawGeckoElement)
-> *mut ServoComputedValues;
pub fn Servo_GetComputedValuesForAnonymousBox(pseudoTag: *mut nsIAtom)
-> *mut ServoComputedValues;
pub fn Servo_AddRefComputedValues(arg1: *mut ServoComputedValues);
pub fn Servo_ReleaseComputedValues(arg1: *mut ServoComputedValues);
pub fn Gecko_GetAttrAsUTF8(element: *mut RawGeckoElement,
ns: *const uint8_t, name: *const uint8_t,
length: *mut uint32_t)

80
ports/geckolib/build.rs Normal file
View file

@ -0,0 +1,80 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use std::env;
use std::fs::File;
use std::io::Write;
use std::path::Path;
use std::process::{Command, Stdio, exit};
#[cfg(windows)]
fn find_python() -> String {
if Command::new("python27.exe").arg("--version").output().is_ok() {
return "python27.exe".to_owned();
}
if Command::new("python.exe").arg("--version").output().is_ok() {
return "python.exe".to_owned();
}
panic!("Can't find python (tried python27.exe and python.exe)! Try fixing PATH or setting the PYTHON env var");
}
#[cfg(not(windows))]
fn find_python() -> String {
if Command::new("python2.7").arg("--version").output().unwrap().status.success() {
"python2.7"
} else {
"python"
}.to_owned()
}
fn main() {
let python = match env::var("PYTHON") {
Ok(python_path) => python_path,
Err(_) => find_python(),
};
// Mako refuses to load templates outside the scope of the current working directory,
// so we need to run it from the top source directory.
let geckolib_dir = Path::new(file!()).parent().unwrap();
let top_dir = geckolib_dir.join("..").join("..");
let style_template = Path::new("components/style/properties.mako.rs");
let geckolib_template = Path::new("ports/geckolib/properties.mako.rs");
let mako = Path::new("components/style/Mako-0.9.1.zip");
let result = Command::new(python)
.current_dir(top_dir)
.env("PYTHONPATH", &mako)
.env("STYLE_TEMPLATE", &style_template)
.env("GECKOLIB_TEMPLATE", &geckolib_template)
.arg("-c")
.arg(r#"
import json
import os
import sys
from mako.template import Template
from mako import exceptions
try:
style_template = Template(filename=os.environ['STYLE_TEMPLATE'], input_encoding='utf8')
style_template.render()
geckolib_template = Template(filename=os.environ['GECKOLIB_TEMPLATE'], input_encoding='utf8')
output = geckolib_template.render(STYLE_STRUCTS = style_template.module.STYLE_STRUCTS,
LONGHANDS = style_template.module.LONGHANDS)
print(output.encode('utf8'))
except:
sys.stderr.write(exceptions.text_error_template().render().encode('utf8'))
sys.exit(1)
"#)
.stderr(Stdio::inherit())
.output()
.unwrap();
if !result.status.success() {
exit(1)
}
let out = env::var("OUT_DIR").unwrap();
File::create(&Path::new(&out).join("properties.rs")).unwrap().write_all(&result.stdout).unwrap();
}

View file

@ -5,24 +5,28 @@
#![allow(unsafe_code)]
use app_units::Au;
use bindings::RawGeckoDocument;
use bindings::{ServoNodeData, RawServoStyleSet, RawServoStyleSheet, uint8_t, uint32_t};
use bindings::{RawGeckoDocument, RawGeckoElement};
use bindings::{RawServoStyleSet, RawServoStyleSheet, ServoComputedValues, ServoNodeData};
use bindings::{nsIAtom, uint8_t, uint32_t};
use data::PerDocumentStyleData;
use euclid::Size2D;
use properties::GeckoComputedValues;
use selector_impl::{SharedStyleContext, Stylesheet};
use std::marker::PhantomData;
use std::mem::{forget, transmute};
use std::ptr;
use std::slice;
use std::str::from_utf8_unchecked;
use std::sync::{Arc, Mutex};
use style::context::{ReflowGoal, StylistWrapper};
use style::dom::{TDocument, TNode};
use style::dom::{TDocument, TElement, TNode};
use style::error_reporting::StdoutErrorReporter;
use style::parallel;
use style::stylesheets::Origin;
use traversal::RecalcStyleOnly;
use url::Url;
use util::arc_ptr_eq;
use wrapper::{GeckoDocument, GeckoNode, NonOpaqueStyleData};
use wrapper::{GeckoDocument, GeckoElement, GeckoNode, NonOpaqueStyleData};
/*
* For Gecko->Servo function calls, we need to redeclare the same signature that was declared in
@ -82,23 +86,39 @@ pub extern "C" fn Servo_StylesheetFromUTF8Bytes(bytes: *const uint8_t,
}
}
fn with_arc_stylesheet<F, Output>(raw: *mut RawServoStyleSheet, cb: F) -> Output
where F: FnOnce(&Arc<Stylesheet>) -> Output {
let owned = unsafe { consume_arc_stylesheet(raw) };
let result = cb(&owned);
forget(owned);
result
struct ArcHelpers<GeckoType, ServoType> {
phantom1: PhantomData<GeckoType>,
phantom2: PhantomData<ServoType>,
}
unsafe fn consume_arc_stylesheet(raw: *mut RawServoStyleSheet) -> Arc<Stylesheet> {
transmute(raw)
impl<GeckoType, ServoType> ArcHelpers<GeckoType, ServoType> {
fn with<F, Output>(raw: *mut GeckoType, cb: F) -> Output
where F: FnOnce(&Arc<ServoType>) -> Output {
let owned = unsafe { Self::into(raw) };
let result = cb(&owned);
forget(owned);
result
}
unsafe fn into(ptr: *mut GeckoType) -> Arc<ServoType> {
transmute(ptr)
}
unsafe fn addref(ptr: *mut GeckoType) {
Self::with(ptr, |arc| forget(arc.clone()));
}
unsafe fn release(ptr: *mut GeckoType) {
let _ = Self::into(ptr);
}
}
#[no_mangle]
pub extern "C" fn Servo_AppendStyleSheet(raw_sheet: *mut RawServoStyleSheet,
raw_data: *mut RawServoStyleSet) {
type Helpers = ArcHelpers<RawServoStyleSheet, Stylesheet>;
let data = PerDocumentStyleData::borrow_mut_from_raw(raw_data);
with_arc_stylesheet(raw_sheet, |sheet| {
Helpers::with(raw_sheet, |sheet| {
data.stylesheets.retain(|x| !arc_ptr_eq(x, sheet));
data.stylesheets.push(sheet.clone());
data.stylesheets_changed = true;
@ -108,8 +128,9 @@ pub extern "C" fn Servo_AppendStyleSheet(raw_sheet: *mut RawServoStyleSheet,
#[no_mangle]
pub extern "C" fn Servo_PrependStyleSheet(raw_sheet: *mut RawServoStyleSheet,
raw_data: *mut RawServoStyleSet) {
type Helpers = ArcHelpers<RawServoStyleSheet, Stylesheet>;
let data = PerDocumentStyleData::borrow_mut_from_raw(raw_data);
with_arc_stylesheet(raw_sheet, |sheet| {
Helpers::with(raw_sheet, |sheet| {
data.stylesheets.retain(|x| !arc_ptr_eq(x, sheet));
data.stylesheets.insert(0, sheet.clone());
data.stylesheets_changed = true;
@ -119,8 +140,9 @@ pub extern "C" fn Servo_PrependStyleSheet(raw_sheet: *mut RawServoStyleSheet,
#[no_mangle]
pub extern "C" fn Servo_RemoveStyleSheet(raw_sheet: *mut RawServoStyleSheet,
raw_data: *mut RawServoStyleSet) {
type Helpers = ArcHelpers<RawServoStyleSheet, Stylesheet>;
let data = PerDocumentStyleData::borrow_mut_from_raw(raw_data);
with_arc_stylesheet(raw_sheet, |sheet| {
Helpers::with(raw_sheet, |sheet| {
data.stylesheets.retain(|x| !arc_ptr_eq(x, sheet));
data.stylesheets_changed = true;
});
@ -128,15 +150,46 @@ pub extern "C" fn Servo_RemoveStyleSheet(raw_sheet: *mut RawServoStyleSheet,
#[no_mangle]
pub extern "C" fn Servo_StyleSheetHasRules(raw_sheet: *mut RawServoStyleSheet) -> bool {
with_arc_stylesheet(raw_sheet, |sheet| !sheet.rules.is_empty())
type Helpers = ArcHelpers<RawServoStyleSheet, Stylesheet>;
Helpers::with(raw_sheet, |sheet| !sheet.rules.is_empty())
}
#[no_mangle]
pub extern "C" fn Servo_AddRefStyleSheet(sheet: *mut RawServoStyleSheet) -> () {
type Helpers = ArcHelpers<RawServoStyleSheet, Stylesheet>;
unsafe { Helpers::addref(sheet) };
}
#[no_mangle]
pub extern "C" fn Servo_ReleaseStylesheet(sheet: *mut RawServoStyleSheet) -> () {
unsafe {
let _ = consume_arc_stylesheet(sheet);
}
pub extern "C" fn Servo_ReleaseStyleSheet(sheet: *mut RawServoStyleSheet) -> () {
type Helpers = ArcHelpers<RawServoStyleSheet, Stylesheet>;
unsafe { Helpers::release(sheet) };
}
#[no_mangle]
pub extern "C" fn Servo_GetComputedValues(element: *mut RawGeckoElement)
-> *mut ServoComputedValues {
let node = unsafe { GeckoElement::from_raw(element).as_node() };
let arc_cv = node.borrow_data().map(|data| data.style.clone());
arc_cv.map_or(ptr::null_mut(), |arc| unsafe { transmute(arc) })
}
#[no_mangle]
pub extern "C" fn Servo_GetComputedValuesForAnonymousBox(_: *mut nsIAtom)
-> *mut ServoComputedValues {
unimplemented!();
}
#[no_mangle]
pub extern "C" fn Servo_AddRefComputedValues(ptr: *mut ServoComputedValues) -> () {
type Helpers = ArcHelpers<ServoComputedValues, GeckoComputedValues>;
unsafe { Helpers::addref(ptr) };
}
#[no_mangle]
pub extern "C" fn Servo_ReleaseComputedValues(ptr: *mut ServoComputedValues) -> () {
type Helpers = ArcHelpers<ServoComputedValues, GeckoComputedValues>;
unsafe { Helpers::release(ptr) };
}
#[no_mangle]
@ -145,7 +198,6 @@ pub extern "C" fn Servo_InitStyleSet() -> *mut RawServoStyleSet {
Box::into_raw(data) as *mut RawServoStyleSet
}
#[no_mangle]
pub extern "C" fn Servo_DropStyleSet(data: *mut RawServoStyleSet) -> () {
unsafe {

View file

@ -40,3 +40,10 @@ pub mod glue;
mod selector_impl;
mod traversal;
mod wrapper;
// Generated from the properties.mako.rs template by build.rs
#[macro_use]
#[allow(unsafe_code)]
pub mod properties {
include!(concat!(env!("OUT_DIR"), "/properties.rs"));
}

View file

@ -0,0 +1,168 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use app_units::Au;
use std::sync::Arc;
use style::custom_properties::ComputedValuesMap;
use style::logical_geometry::WritingMode;
use style::properties::{CascadePropertyFn, ComputedValues, TComputedValues};
use style::properties::longhands;
use style::properties::style_struct_traits::*;
#[derive(Clone)]
pub struct GeckoComputedValues {
% for style_struct in STYLE_STRUCTS:
${style_struct.ident}: Arc<Gecko${style_struct.name}>,
% endfor
custom_properties: Option<Arc<ComputedValuesMap>>,
shareable: bool,
pub writing_mode: WritingMode,
pub root_font_size: Au,
}
impl TComputedValues for GeckoComputedValues {
% for style_struct in STYLE_STRUCTS:
type Concrete${style_struct.name} = Gecko${style_struct.name};
% endfor
// These will go away, and we will never implement them.
fn as_servo<'a>(&'a self) -> &'a ComputedValues { unimplemented!() }
fn as_servo_mut<'a>(&'a mut self) -> &'a mut ComputedValues { unimplemented!() }
fn new(custom_properties: Option<Arc<ComputedValuesMap>>,
shareable: bool,
writing_mode: WritingMode,
root_font_size: Au,
% for style_struct in STYLE_STRUCTS:
${style_struct.ident}: Arc<Gecko${style_struct.name}>,
% endfor
) -> Self {
GeckoComputedValues {
custom_properties: custom_properties,
shareable: shareable,
writing_mode: writing_mode,
root_font_size: root_font_size,
% for style_struct in STYLE_STRUCTS:
${style_struct.ident}: ${style_struct.ident},
% endfor
}
}
fn initial_values() -> &'static Self { unimplemented!() }
fn do_cascade_property<F: FnOnce(&Vec<Option<CascadePropertyFn<Self>>>)>(_: F) {
unimplemented!()
}
% for style_struct in STYLE_STRUCTS:
#[inline]
fn clone_${style_struct.name.lower()}(&self) -> Arc<Self::Concrete${style_struct.name}> {
self.${style_struct.ident}.clone()
}
#[inline]
fn get_${style_struct.name.lower()}<'a>(&'a self) -> &'a Self::Concrete${style_struct.name} {
&self.${style_struct.ident}
}
#[inline]
fn mutate_${style_struct.name.lower()}<'a>(&'a mut self) -> &'a mut Self::Concrete${style_struct.name} {
Arc::make_mut(&mut self.${style_struct.ident})
}
% endfor
fn custom_properties(&self) -> Option<Arc<ComputedValuesMap>> { self.custom_properties.as_ref().map(|x| x.clone())}
fn root_font_size(&self) -> Au { self.root_font_size }
fn set_root_font_size(&mut self, s: Au) { self.root_font_size = s; }
fn set_writing_mode(&mut self, mode: WritingMode) { self.writing_mode = mode; }
#[inline]
fn is_multicol(&self) -> bool { unimplemented!() }
}
% for style_struct in STYLE_STRUCTS:
#[derive(PartialEq, Clone, HeapSizeOf, Debug)]
pub struct Gecko${style_struct.name};
impl T${style_struct.name} for Gecko${style_struct.name} {
% for longhand in style_struct.longhands:
fn set_${longhand.ident}(&mut self, _: longhands::${longhand.ident}::computed_value::T) {
unimplemented!()
}
fn copy_${longhand.ident}_from(&mut self, _: &Self) {
unimplemented!()
}
% endfor
% if style_struct.name == "Animation":
fn transition_count(&self) -> usize {
unimplemented!()
}
% elif style_struct.name == "Border":
% for side in ["top", "right", "bottom", "left"]:
fn border_${side}_is_none_or_hidden_and_has_nonzero_width(&self) -> bool {
unimplemented!()
}
% endfor
% elif style_struct.name == "Box":
fn clone_display(&self) -> longhands::display::computed_value::T {
unimplemented!()
}
fn clone_position(&self) -> longhands::position::computed_value::T {
unimplemented!()
}
fn is_floated(&self) -> bool {
unimplemented!()
}
fn overflow_x_is_visible(&self) -> bool {
unimplemented!()
}
fn overflow_y_is_visible(&self) -> bool {
unimplemented!()
}
% elif style_struct.name == "Color":
fn clone_color(&self) -> longhands::color::computed_value::T {
unimplemented!()
}
% elif style_struct.name == "Font":
fn clone_font_size(&self) -> longhands::font_size::computed_value::T {
unimplemented!()
}
fn clone_font_weight(&self) -> longhands::font_weight::computed_value::T {
unimplemented!()
}
fn compute_font_hash(&mut self) {
unimplemented!()
}
% elif style_struct.name == "InheritedBox":
fn clone_direction(&self) -> longhands::direction::computed_value::T {
unimplemented!()
}
fn clone_writing_mode(&self) -> longhands::writing_mode::computed_value::T {
unimplemented!()
}
fn clone_text_orientation(&self) -> longhands::text_orientation::computed_value::T {
unimplemented!()
}
% elif style_struct.name == "InheritedText":
fn clone__servo_text_decorations_in_effect(&self) ->
longhands::_servo_text_decorations_in_effect::computed_value::T {
unimplemented!()
}
% elif style_struct.name == "Outline":
fn outline_is_none_or_hidden_and_has_nonzero_width(&self) -> bool {
unimplemented!()
}
% elif style_struct.name == "Text":
fn has_underline(&self) -> bool {
unimplemented!()
}
fn has_overline(&self) -> bool {
unimplemented!()
}
fn has_line_through(&self) -> bool {
unimplemented!()
}
% endif
}
% endfor

View file

@ -2,19 +2,16 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use properties::GeckoComputedValues;
use selectors::parser::{ParserContext, SelectorImpl};
use std::process;
use style;
use style::element_state::ElementState;
use style::error_reporting::StdoutErrorReporter;
use style::selector_impl::SelectorImplExt;
use style::stylesheets::Origin;
use url::Url;
pub type Stylist = style::selector_matching::Stylist<GeckoSelectorImpl>;
pub type Stylesheet = style::stylesheets::Stylesheet<GeckoSelectorImpl>;
pub type SharedStyleContext = style::context::SharedStyleContext<GeckoSelectorImpl>;
pub type PrivateStyleData = style::data::PrivateStyleData<GeckoSelectorImpl>;
pub type PrivateStyleData = style::data::PrivateStyleData<GeckoSelectorImpl, GeckoComputedValues>;
pub struct GeckoSelectorImpl;

View file

@ -2,20 +2,23 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use properties::GeckoComputedValues;
use selector_impl::{GeckoSelectorImpl, SharedStyleContext};
use std::cell::RefCell;
use std::mem;
use std::rc::Rc;
use style::context::{LocalStyleContext, StyleContext};
use style::dom::{OpaqueNode, TNode};
use style::dom::OpaqueNode;
use style::matching::{ApplicableDeclarationsCache, StyleSharingCandidateCache};
use style::traversal::{DomTraversalContext, recalc_style_at};
use wrapper::GeckoNode;
thread_local!(static LOCAL_CONTEXT_KEY: RefCell<Option<Rc<LocalStyleContext>>> = RefCell::new(None));
thread_local!(static LOCAL_CONTEXT_KEY:
RefCell<Option<Rc<LocalStyleContext<GeckoComputedValues>>>> = RefCell::new(None));
// Keep this implementation in sync with the one in components/layout/context.rs.
fn create_or_get_local_context(shared: &SharedStyleContext)
-> Rc<LocalStyleContext> {
-> Rc<LocalStyleContext<GeckoComputedValues>> {
LOCAL_CONTEXT_KEY.with(|r| {
let mut r = r.borrow_mut();
if let Some(context) = r.clone() {
@ -36,7 +39,7 @@ fn create_or_get_local_context(shared: &SharedStyleContext)
pub struct StandaloneStyleContext<'a> {
pub shared: &'a SharedStyleContext,
cached_local_context: Rc<LocalStyleContext>,
cached_local_context: Rc<LocalStyleContext<GeckoComputedValues>>,
}
impl<'a> StandaloneStyleContext<'a> {
@ -49,12 +52,12 @@ impl<'a> StandaloneStyleContext<'a> {
}
}
impl<'a> StyleContext<'a, GeckoSelectorImpl> for StandaloneStyleContext<'a> {
impl<'a> StyleContext<'a, GeckoSelectorImpl, GeckoComputedValues> for StandaloneStyleContext<'a> {
fn shared_context(&self) -> &'a SharedStyleContext {
&self.shared
}
fn local_context(&self) -> &LocalStyleContext {
fn local_context(&self) -> &LocalStyleContext<GeckoComputedValues> {
&self.cached_local_context
}
}
@ -64,8 +67,7 @@ pub struct RecalcStyleOnly<'lc> {
root: OpaqueNode,
}
impl<'lc, N: TNode> DomTraversalContext<N> for RecalcStyleOnly<'lc>
where N::ConcreteElement: ::selectors::Element<Impl=GeckoSelectorImpl> {
impl<'lc, 'ln> DomTraversalContext<GeckoNode<'ln>> for RecalcStyleOnly<'lc> {
type SharedContext = SharedStyleContext;
#[allow(unsafe_code)]
fn new<'a>(shared: &'a Self::SharedContext, root: OpaqueNode) -> Self {
@ -78,7 +80,7 @@ impl<'lc, N: TNode> DomTraversalContext<N> for RecalcStyleOnly<'lc>
}
}
fn process_preorder(&self, node: N) { recalc_style_at(&self.context, self.root, node); }
fn process_postorder(&self, _: N) {}
fn process_preorder(&self, node: GeckoNode<'ln>) { recalc_style_at(&self.context, self.root, node); }
fn process_postorder(&self, _: GeckoNode<'ln>) {}
}

View file

@ -19,6 +19,7 @@ use bindings::{Gecko_LocalName, Gecko_Namespace, Gecko_NodeIsElement, Gecko_SetN
use bindings::{RawGeckoDocument, RawGeckoElement, RawGeckoNode};
use bindings::{ServoNodeData};
use libc::uintptr_t;
use properties::GeckoComputedValues;
use selector_impl::{GeckoSelectorImpl, NonTSPseudoClass, PrivateStyleData};
use selectors::Element;
use selectors::matching::DeclarationBlock;
@ -35,7 +36,7 @@ use style::dom::{OpaqueNode, TDocument, TElement, TNode, TRestyleDamage, UnsafeN
use style::element_state::ElementState;
#[allow(unused_imports)] // Used in commented-out code.
use style::error_reporting::StdoutErrorReporter;
use style::properties::{ComputedValues, PropertyDeclaration, PropertyDeclarationBlock};
use style::properties::{PropertyDeclaration, PropertyDeclarationBlock};
#[allow(unused_imports)] // Used in commented-out code.
use style::properties::{parse_style_attribute};
use style::restyle_hints::ElementSnapshot;
@ -78,7 +79,8 @@ impl<'ln> GeckoNode<'ln> {
#[derive(Clone, Copy)]
pub struct DummyRestyleDamage;
impl TRestyleDamage for DummyRestyleDamage {
fn compute(_: Option<&Arc<ComputedValues>>, _: &ComputedValues) -> Self { DummyRestyleDamage }
type ConcreteComputedValues = GeckoComputedValues;
fn compute(_: Option<&Arc<GeckoComputedValues>>, _: &GeckoComputedValues) -> Self { DummyRestyleDamage }
fn rebuild_and_reflow() -> Self { DummyRestyleDamage }
}
impl BitOr for DummyRestyleDamage {
@ -92,6 +94,7 @@ impl<'ln> TNode for GeckoNode<'ln> {
type ConcreteDocument = GeckoDocument<'ln>;
type ConcreteElement = GeckoElement<'ln>;
type ConcreteRestyleDamage = DummyRestyleDamage;
type ConcreteComputedValues = GeckoComputedValues;
fn to_unsafe(&self) -> UnsafeNode {
(self.node as usize, 0)
@ -297,7 +300,7 @@ pub struct GeckoElement<'le> {
}
impl<'le> GeckoElement<'le> {
unsafe fn from_raw(el: *mut RawGeckoElement) -> GeckoElement<'le> {
pub unsafe fn from_raw(el: *mut RawGeckoElement) -> GeckoElement<'le> {
GeckoElement {
element: el,
chain: PhantomData,