mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Use DOMRefCell<T> in Element.
This commit is contained in:
parent
2d5d1e36ad
commit
fb98384fa5
2 changed files with 13 additions and 18 deletions
|
@ -35,6 +35,7 @@ use css::node_style::StyledNode;
|
|||
use util::{LayoutDataAccess, LayoutDataWrapper, PrivateLayoutData, OpaqueNodeMethods};
|
||||
|
||||
use gfx::display_list::OpaqueNode;
|
||||
use script::dom::bindings::cell::{Ref, RefMut};
|
||||
use script::dom::bindings::codegen::InheritTypes::{ElementCast, HTMLIFrameElementCast, HTMLImageElementCast};
|
||||
use script::dom::bindings::codegen::InheritTypes::{HTMLInputElementCast, TextCast};
|
||||
use script::dom::bindings::js::JS;
|
||||
|
@ -50,7 +51,6 @@ use script::dom::text::Text;
|
|||
use script::layout_interface::LayoutChan;
|
||||
use servo_msg::constellation_msg::{PipelineId, SubpageId};
|
||||
use servo_util::str::{LengthOrPercentageOrAuto, is_whitespace};
|
||||
use std::cell::{RefCell, Ref, RefMut};
|
||||
use std::kinds::marker::ContravariantLifetime;
|
||||
use std::mem;
|
||||
use style::computed_values::{content, display, white_space};
|
||||
|
@ -445,9 +445,7 @@ pub struct LayoutElement<'le> {
|
|||
impl<'le> LayoutElement<'le> {
|
||||
pub fn style_attribute(&self) -> &'le Option<PropertyDeclarationBlock> {
|
||||
let style: &Option<PropertyDeclarationBlock> = unsafe {
|
||||
let style: &RefCell<Option<PropertyDeclarationBlock>> = self.element.style_attribute();
|
||||
// cast to the direct reference to T placed on the head of RefCell<T>
|
||||
mem::transmute(style)
|
||||
&*self.element.style_attribute().borrow_for_layout()
|
||||
};
|
||||
style
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue