CSC/ECE 517 Spring 2017/M1702 Implement the Mutation Observer API Design: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
m (→‎Project Description: formatted some links)
(→‎Project Description: Updated the project description)
Line 14: Line 14:


=='''Project Description'''==
=='''Project Description'''==
In the first Phase of the Project, we implemented the initial Steps as described in the <span class="plainlinks">[https://github.com/servo/servo/wiki/Mutation-observer-project Project Specification]</span>. The initial implementation is merged in the original Servo Repository and the code can be found <span class="plainlinks">[https://github.com/servo/servo/commit/107ac9ab56c1a4cee3e5f9828f91ab394e3e8eee here]</span>.
The purpose of this project is to implement the basic functionality required to implement a <span class="plainlinks">[https://dom.spec.whatwg.org/#mutation-observers Mutation Observer API]</span> as defined in the <span class="plainlinks">[https://dom.spec.whatwg.org DOM]</span> Specifications.
For the next phase of the project, we have to implement the following steps:
In the <span class="plainlinks">[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2017/M1702_Implement_the_Mutation_Observer_API First Phase of the Project]</span>, we implemented the initial Steps as described in the <span class="plainlinks">[https://github.com/servo/servo/wiki/Mutation-observer-project Project Specification]</span>. The initial implementation is merged in the original Servo Repository and the code can be found <span class="plainlinks">[https://github.com/servo/servo/commit/107ac9ab56c1a4cee3e5f9828f91ab394e3e8eee here]</span>.
For the next phase of the project, we have to implement the functionality for supporting Mutation Observers. We plan on acheiving that in the following steps:


*add support for mutation observer microtasks
===Add support for mutation observer microtasks===
**add a <code>mutation_observer_compound_microtask_queued</code> member to <code>ScriptThread</code>.
*We will add a <code>mutation_observer_compound_microtask_queued</code> member to <code>ScriptThread</code>. This will be used later to implement the <span class="plainlinks">[https://dom.spec.whatwg.org/#queue-a-mutation-observer-compound-microtask queue a mutation observer compound microtask algorithm]</span> described below.
**implement the <span class="plainlinks">[https://dom.spec.whatwg.org/#queue-a-mutation-observer-compound-microtask queue a mutation observer compound microtask algorithm]</span> by adding a new variant to the <span class="plainlinks">[https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/microtask.rs#29 Microtask]</span> enum for mutation observers.
*Next, we are going to implement the <span class="plainlinks">[https://dom.spec.whatwg.org/#queue-a-mutation-observer-compound-microtask queue a mutation observer compound microtask algorithm]</span> by adding a new variant to the <span class="plainlinks">[https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/microtask.rs#29 Microtask]</span> enum for mutation observers.
**implement the <span class="plainlinks">[https://dom.spec.whatwg.org/#notify-mutation-observers notify mutation observers algorithm]</span> (ignoring the specific text about "execute a compound microtask") using the vector of observers previously added to <code>ScriptThread</code>.
**
*We will implement the <span class="plainlinks">[https://dom.spec.whatwg.org/#notify-mutation-observers notify mutation observers algorithm]</span> (ignoring the specific text about "execute a compound microtask") using the vector of observers previously added to <code>ScriptThread</code>.


*add support for observing specific mutations
===Add support for observing specific mutations===
**add a vector of <code>MutationObserver</code> objects to Node.
*We will add a vector of <code>MutationObserver</code> objects to <code>Node</code>.
**implement <span class="plainlinks">[https://dom.spec.whatwg.org/#dom-mutationobserver-observe MutationObserver.observe]</span> (step 7 and 8 mean "replace an existing matching entry with the new options, or add a new entry if there is no match").
*We will implement <span class="plainlinks">[https://dom.spec.whatwg.org/#dom-mutationobserver-observe MutationObserver.observe]</span> (step 7 and 8 mean "replace an existing matching entry with the new options, or add a new entry if there is no match").
**implement the <span class="plainlinks">[https://dom.spec.whatwg.org/#queue-a-mutation-record queue a mutation record algorithm]</span>.
*We will implement the <span class="plainlinks">[https://dom.spec.whatwg.org/#queue-a-mutation-record queue a mutation record algorithm]</span>.
**make <span class="plainlinks">[https://dom.spec.whatwg.org/#concept-element-attributes-change changing]</span>/<span class="plainlinks">[https://dom.spec.whatwg.org/#concept-element-attributes-append appending]</span>/<span class="plainlinks">[https://dom.spec.whatwg.org/#concept-element-attributes-remove removing]</span>/<span class="plainlinks">[https://dom.spec.whatwg.org/#concept-element-attributes-replace replacing]</span> an attribute queue a mutation record via <span class="plainlinks">[https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/attr.rs#171 Attr::set_value]</span>, <span class="plainlinks">[https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/element.rs#955 Element::push_attribute]</span>, and <span class="plainlinks">[https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/element.rs#1077 Element::remove_first_matching_attribute]</span>.
*We will make <span class="plainlinks">[https://dom.spec.whatwg.org/#concept-element-attributes-change changing]</span>/<span class="plainlinks">[https://dom.spec.whatwg.org/#concept-element-attributes-append appending]</span>/<span class="plainlinks">[https://dom.spec.whatwg.org/#concept-element-attributes-remove removing]</span>/<span class="plainlinks">[https://dom.spec.whatwg.org/#concept-element-attributes-replace replacing]</span> an attribute queue a mutation record via <span class="plainlinks">[https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/attr.rs#171 Attr::set_value]</span>, <span class="plainlinks">[https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/element.rs#955 Element::push_attribute]</span>, and <span class="plainlinks">[https://dxr.mozilla.org/servo/rev/216a89f7766dd366c4afbeae42cf6e1fb4f67349/components/script/dom/element.rs#1077 Element::remove_first_matching_attribute]</span>.


=='''Test Plan'''==
=='''Test Plan'''==

Revision as of 21:31, 7 April 2017

Mutation Observer API Project with SERVO & RUST

Servo is a prototype web browser engine written in the RUST language. The DOM standard defines a MutationObserver API that allows web content to receive callbacks when the page contents are mutated. In simple words, MutationObserver facilitates the developers with a technique to react to the changes in DOM. MutationObserver is designed to replace the Mutation Events defined in the DOM3 Events specification. The goal of this project is to implement the fundamental pieces required to support the Mutation Observer API.

Introduction

Servo

Servo is an open source web browser engine designed for application and embedded use. It is a high performance browser engine created by Mozilla Research and is written in the Rust language. The main idea behind the Servo is to create a parallel environment where the components are handle by isolated and fine grained tasks. These components can be rendering, HTML parsing etc.

Rust

Rust is an open source systems programming language developed by Mozilla. Servo is written in Rust. The main purpose behind it's design is to be thread safe and concurrent. The emphasis is also on speed, safety and control of memory layout.

Setting up and Building the Project

Follow the Guidelines mentioned in the read me page of the project's Wiki Page for building the Project in a Linux Environment.

Project Description

The purpose of this project is to implement the basic functionality required to implement a Mutation Observer API as defined in the DOM Specifications. In the First Phase of the Project, we implemented the initial Steps as described in the Project Specification. The initial implementation is merged in the original Servo Repository and the code can be found here. For the next phase of the project, we have to implement the functionality for supporting Mutation Observers. We plan on acheiving that in the following steps:

Add support for mutation observer microtasks

Add support for observing specific mutations

Test Plan

Design Pattern

Our Project follows the Observer Pattern, where a list of the objects dependent on the current object is maintained and the dependents are notified of any state changes. The Mutation Observer helps in achieving this functionality.

References

1. https://doc.rust-lang.org/stable/book/
2. https://en.wikipedia.org/wiki/Rust_(programming_language)
3. https://en.wikipedia.org/wiki/Servo_(layout_engine)
4. https://github.com/servo/servo
5. https://github.com/servo/servo/wiki/Mutation-observer-project
6. https://dom.spec.whatwg.org/