-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Image load conformance student project
Fernando Jiménez Moreno edited this page Mar 2, 2017
·
8 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
HTMLImageElementtype inhtmlimageelement.rs. These should subsume the existing fields inHTMLImageElementthat 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_settermacros 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.htmland adjust the test result expectations according to the documentation. - 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.rsthat instructs the image cache to fetch a URL with code that directly performs a network request (seeHTMLScriptElement::preparefor an example that uses theNetworkListenerhelper 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_attributefunction 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_attributefunction inhtmlimageelement.rs. Write unit tests demonstrating correctness intests/unit/script/htmlimageelement.rs. - implement the normalize the source densities algorithm - create data types for
source setandimage source - implement the update the source set algorithm by defining a
update_the_source_setfunction inhtmlimageelement.rs - implement the select an image source algorithm by defining a
select_an_image_sourcefunction inhtmlimageelement.rs