mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Auto merge of #7288 - mdibaiee:computedstyle-element, r=Ms2ger
Fix #7268 - getComputedStyle should take `Element`, not `HTMLElement` This is my first patch, I hope I'm doing it right. About the test, do you think this is enough and reliable? <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7288) <!-- Reviewable:end -->
This commit is contained in:
commit
6e06cae44a
7 changed files with 40 additions and 13 deletions
|
@ -9,8 +9,7 @@ use dom::bindings::global::GlobalRef;
|
|||
use dom::bindings::js::{JS, Root};
|
||||
use dom::bindings::utils::{Reflector, reflect_dom_object};
|
||||
use dom::document::DocumentHelpers;
|
||||
use dom::element::{ElementHelpers, StylePriority};
|
||||
use dom::htmlelement::HTMLElement;
|
||||
use dom::element::{ElementHelpers, StylePriority, Element};
|
||||
use dom::node::{window_from_node, document_from_node, NodeDamage, NodeHelpers};
|
||||
use dom::window::{Window, WindowHelpers};
|
||||
use selectors::parser::PseudoElement;
|
||||
|
@ -28,7 +27,7 @@ use std::cell::Ref;
|
|||
#[derive(HeapSizeOf)]
|
||||
pub struct CSSStyleDeclaration {
|
||||
reflector_: Reflector,
|
||||
owner: JS<HTMLElement>,
|
||||
owner: JS<Element>,
|
||||
readonly: bool,
|
||||
pseudo: Option<PseudoElement>,
|
||||
}
|
||||
|
@ -59,7 +58,7 @@ fn serialize_list(list: &[Ref<PropertyDeclaration>]) -> DOMString {
|
|||
}
|
||||
|
||||
impl CSSStyleDeclaration {
|
||||
pub fn new_inherited(owner: &HTMLElement,
|
||||
pub fn new_inherited(owner: &Element,
|
||||
pseudo: Option<PseudoElement>,
|
||||
modification_access: CSSModificationAccess) -> CSSStyleDeclaration {
|
||||
CSSStyleDeclaration {
|
||||
|
@ -70,7 +69,7 @@ impl CSSStyleDeclaration {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn new(global: &Window, owner: &HTMLElement,
|
||||
pub fn new(global: &Window, owner: &Element,
|
||||
pseudo: Option<PseudoElement>,
|
||||
modification_access: CSSModificationAccess) -> Root<CSSStyleDeclaration> {
|
||||
reflect_dom_object(box CSSStyleDeclaration::new_inherited(owner, pseudo, modification_access),
|
||||
|
@ -84,7 +83,7 @@ trait PrivateCSSStyleDeclarationHelpers {
|
|||
fn get_important_declaration(&self, property: &Atom) -> Option<Ref<PropertyDeclaration>>;
|
||||
}
|
||||
|
||||
impl PrivateCSSStyleDeclarationHelpers for HTMLElement {
|
||||
impl PrivateCSSStyleDeclarationHelpers for Element {
|
||||
fn get_declaration(&self, property: &Atom) -> Option<Ref<PropertyDeclaration>> {
|
||||
let element = ElementCast::from_ref(self);
|
||||
element.get_inline_style_declaration(property)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue