Auto merge of #13969 - bbansalWolfPack:master, r=jdm

html form validation initial steps with  test html file

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

Added code for initial steps in html form validation.
1. Added methods for trait validatable
2. implemented stub methods for  elements like HTMLInputElement, HTMLButtonElement, etc

<!-- 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: -->
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because _____

<!-- 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/13969)

<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-11-25 06:49:44 -08:00 committed by GitHub
commit beec035eb0
9 changed files with 124 additions and 15 deletions

12
components/script/dom/htmlinputelement.rs Normal file → Executable file
View file

@ -31,6 +31,7 @@ use dom::node::{Node, NodeDamage, UnbindContext};
use dom::node::{document_from_node, window_from_node};
use dom::nodelist::NodeList;
use dom::validation::Validatable;
use dom::validitystate::ValidationFlags;
use dom::virtualmethods::VirtualMethods;
use html5ever_atoms::LocalName;
use ipc_channel::ipc::{self, IpcSender};
@ -1131,7 +1132,16 @@ impl VirtualMethods for HTMLInputElement {
impl FormControl for HTMLInputElement {}
impl Validatable for HTMLInputElement {}
impl Validatable for HTMLInputElement {
fn is_instance_validatable(&self) -> bool {
// https://html.spec.whatwg.org/multipage/#candidate-for-constraint-validation
true
}
fn validate(&self, _validate_flags: ValidationFlags) -> bool {
// call stub methods defined in validityState.rs file here according to the flags set in validate_flags
true
}
}
impl Activatable for HTMLInputElement {
fn as_element(&self) -> &Element {