Skip to content

Commit

Permalink
Auto merge of #21120 - paavininanda:HTMLSourceElementIDL_attributes, …
Browse files Browse the repository at this point in the history
…r=jdm

Exposing HTMLSourceElement IDL attributes

<!-- Please describe your changes on the following line: -->

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [ ] These changes fix #__ (github issue number if applicable).

<!-- Either: -->
- [x] There are tests for these changes OR
- [ ] These changes do not require tests because _____

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/21120)
<!-- Reviewable:end -->
  • Loading branch information
bors-servo committed Jul 10, 2018
2 parents 934848c + 5f77b60 commit 82213cc
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 4 deletions.
35 changes: 35 additions & 0 deletions components/script/dom/htmlsourceelement.rs
Expand Up @@ -3,9 +3,11 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

use dom::bindings::codegen::Bindings::HTMLSourceElementBinding;
use dom::bindings::codegen::Bindings::HTMLSourceElementBinding::HTMLSourceElementMethods;
use dom::bindings::codegen::Bindings::NodeBinding::NodeBinding::NodeMethods;
use dom::bindings::inheritance::Castable;
use dom::bindings::root::DomRoot;
use dom::bindings::str::DOMString;
use dom::document::Document;
use dom::htmlelement::HTMLElement;
use dom::htmlmediaelement::HTMLMediaElement;
Expand Down Expand Up @@ -53,3 +55,36 @@ impl VirtualMethods for HTMLSourceElement {
}
}
}

impl HTMLSourceElementMethods for HTMLSourceElement {
// https://html.spec.whatwg.org/multipage/#dom-source-src
make_getter!(Src, "src");

// https://html.spec.whatwg.org/multipage/#dom-source-src
make_setter!(SetSrc, "src");

// https://html.spec.whatwg.org/multipage/#dom-source-type
make_getter!(Type, "type");

// https://html.spec.whatwg.org/multipage/#dom-source-type
make_setter!(SetType, "type");

// https://html.spec.whatwg.org/multipage/#dom-source-srcset
make_getter!(Srcset, "srcset");

// https://html.spec.whatwg.org/multipage/#dom-source-srcset
make_setter!(SetSrcset, "srcset");

// https://html.spec.whatwg.org/multipage/#dom-source-sizes
make_getter!(Sizes, "sizes");

// https://html.spec.whatwg.org/multipage/#dom-source-sizes
make_setter!(SetSizes, "sizes");

// https://html.spec.whatwg.org/multipage/#dom-source-media
make_getter!(Media, "media");

// https://html.spec.whatwg.org/multipage/#dom-source-media
make_setter!(SetMedia, "media");

}
14 changes: 10 additions & 4 deletions components/script/dom/webidls/HTMLSourceElement.webidl
Expand Up @@ -5,8 +5,14 @@
// https://html.spec.whatwg.org/multipage/#htmlsourceelement
[HTMLConstructor]
interface HTMLSourceElement : HTMLElement {
// [CEReactions]
// attribute DOMString src;
// [CEReactions]
// attribute DOMString type;
[CEReactions]
attribute DOMString src;
[CEReactions]
attribute DOMString type;
[CEReactions]
attribute DOMString srcset;
[CEReactions]
attribute DOMString sizes;
[CEReactions]
attribute DOMString media;
};

0 comments on commit 82213cc

Please sign in to comment.