forked from servo/servo
-
Notifications
You must be signed in to change notification settings - Fork 0
Image load conformance student project
Josh Matthews edited this page Feb 8, 2016
·
5 revisions
Background information: The HTML5 specification defines a surprisingly complex model for loading images in a web page. Servo's current implementation is straightforward, but non-compliant in a number of important ways. The goal of this project is to implement image loading behaviour that is both more correct and easy to verify against the text of the specification.
Initial steps:
- compile Servo and ensure that it runs on
tests/html/about-mozilla.html
- email the mozilla.dev.servo mailing list introducing your group and describing your progress
- define data types to represent the image request concept, and add pending and current requests to the
HTMLImageElement
type inhtmlimageelement.rs
. These should subsume the existing fields inHTMLImageElement
that are used for storing the image's properties, and the fields of the current request should be used instead. - implement the crossOrigin attribute using the
make_enumerated_getter
/make_setter
macros and uncommenting the attribute inHTMLImageElement.webidl
- implement the currentSrc attribute by adding the appropriate attribute to
HTMLImageElement.webidl
- run
./mach test-wpt tests/wpt/web-platform-tests/html/dom/interfaces.html
and adjust the test result expectations according to the documenatation. - add a command for the image cache task that accepts a URL and a vector of bytes. This command should instruct the cache to store this data as a newly-complete network request and continue decoding the result into pixel data.
Subsequent steps:
- replace the code in
htmlimageelement.rs
that instructs the image cache to fetch a URL with code that directly performs a network request (seeHTMLScriptElement::prepare
for an example that uses theNetworkListener
helper andDocument::load_async
). The result should be sent to the image cache using the newly-added command. - implement the parse a srcset attribute algorithm by defining a
parse_a_srcset_attribute
function inhtmlimageelement.rs
. Write unit tests demonstrating correctness intests/unit/script/htmlimageelement.rs
(./mach test-unit -p script/dom/htmlimageelement
). - implement the parse a sizes attribute algorithm by defining a
parse_a_sizes_attribute
function inhtmlimageelement.rs
. Write unit tests demonstrating correctness intests/unit/script/htmlimageelement.rs
. - implement the normalize the source densities algorithm - create data types for
source set
andimage source
- implement the update the source set algorithm by defining a
update_the_source_set
function inhtmlimageelement.rs
- implement the select an image source algorithm by defining a
select_an_image_source
function inhtmlimageelement.rs