mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Add support for LinkStyle's sheet getter on <style> and <link>
This commit is contained in:
parent
1d20d75cb2
commit
972e9ac0fb
5 changed files with 23 additions and 2 deletions
|
@ -22,6 +22,7 @@ use dom::eventtarget::EventTarget;
|
|||
use dom::globalscope::GlobalScope;
|
||||
use dom::htmlelement::HTMLElement;
|
||||
use dom::node::{Node, document_from_node, window_from_node};
|
||||
use dom::stylesheet::StyleSheet as DOMStyleSheet;
|
||||
use dom::virtualmethods::VirtualMethods;
|
||||
use encoding::EncodingRef;
|
||||
use encoding::all::UTF_8;
|
||||
|
@ -452,4 +453,9 @@ impl HTMLLinkElementMethods for HTMLLinkElement {
|
|||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-link-target
|
||||
make_setter!(SetTarget, "target");
|
||||
|
||||
// https://drafts.csswg.org/cssom/#dom-linkstyle-sheet
|
||||
fn GetSheet(&self) -> Option<Root<DOMStyleSheet>> {
|
||||
self.get_cssom_stylesheet().map(Root::upcast)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
use cssparser::Parser as CssParser;
|
||||
use dom::bindings::cell::DOMRefCell;
|
||||
use dom::bindings::codegen::Bindings::HTMLStyleElementBinding;
|
||||
use dom::bindings::codegen::Bindings::HTMLStyleElementBinding::HTMLStyleElementMethods;
|
||||
use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
|
||||
use dom::bindings::inheritance::Castable;
|
||||
use dom::bindings::js::{JS, MutNullableHeap, Root};
|
||||
|
@ -14,6 +15,7 @@ use dom::document::Document;
|
|||
use dom::element::Element;
|
||||
use dom::htmlelement::HTMLElement;
|
||||
use dom::node::{ChildrenMutation, Node, document_from_node, window_from_node};
|
||||
use dom::stylesheet::StyleSheet as DOMStyleSheet;
|
||||
use dom::virtualmethods::VirtualMethods;
|
||||
use html5ever_atoms::LocalName;
|
||||
use script_layout_interface::message::Msg;
|
||||
|
@ -117,3 +119,10 @@ impl VirtualMethods for HTMLStyleElement {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl HTMLStyleElementMethods for HTMLStyleElement {
|
||||
// https://drafts.csswg.org/cssom/#dom-linkstyle-sheet
|
||||
fn GetSheet(&self) -> Option<Root<DOMStyleSheet>> {
|
||||
self.get_cssom_stylesheet().map(Root::upcast)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ interface HTMLLinkElement : HTMLElement {
|
|||
|
||||
// also has obsolete members
|
||||
};
|
||||
//HTMLLinkElement implements LinkStyle;
|
||||
HTMLLinkElement implements LinkStyle;
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#HTMLLinkElement-partial
|
||||
partial interface HTMLLinkElement {
|
||||
|
|
|
@ -8,4 +8,4 @@ interface HTMLStyleElement : HTMLElement {
|
|||
// attribute DOMString type;
|
||||
// attribute boolean scoped;
|
||||
};
|
||||
//HTMLStyleElement implements LinkStyle;
|
||||
HTMLStyleElement implements LinkStyle;
|
||||
|
|
|
@ -15,3 +15,9 @@ interface StyleSheet {
|
|||
// [SameObject, PutForwards=mediaText] readonly attribute MediaList media;
|
||||
// attribute boolean disabled;
|
||||
};
|
||||
|
||||
// https://drafts.csswg.org/cssom/#the-linkstyle-interface
|
||||
[NoInterfaceObject]
|
||||
interface LinkStyle {
|
||||
readonly attribute StyleSheet? sheet;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue