Published using Google Docs
Unlimited FavIcon support
Updated automatically every 5 minutes

Current Situation

WebKit supports exactly three favicons - FavIcon, TouchIcon, and TouchPrecomposedIcon. For all three of these icons, a fixed size is assumed. (16x16,57x57 and 57x57).

Furthermore, if no icons are specified via <link rel=”icon” …> WebKit “guesses” a default FavIcon file.

Goals

Current Code Path

Document parsing

At DOM parse time, when a <link> is encountered, HTMLLinkElement::process calls LinkLoader::loadLink

LinkLoader::loadLink forwards appropriate settings to Document::setIconURL if the link is an icon

Document::setIconURL keeps track of icons encountered

Favicon retrieval

When the UA actually needs an icon, it is retrieved via IconController::urlsForTypes, which returns all icon urls for a specific type. (Currently, there is only one icon for each type)

IconController::defaultURL provides the default favicons if none have been specified.

Proposed Changes

IconURL

IconURL will need to carry a sizes and an isDefault member.

HTMLLinkElement

HTMLLinkElement::process will need to pass sizes to the LinkLoader

LinkLoader

LinkLoader::LoadLink will need an additional ‘sizes’ API parameter which will be passed on to the document

Document

Document gains an additional vector of icons, so it can track icons. (Right now, it only has an array for the three default icons)

Document::SetIconURL will need an additional ‘sizes’ API parameter which will be used to construct an IconURL

Document::iconURL now either needs to return a vector for each type, or we add an additional Document::allIconURLs that returns a vector while the old API stays intact. I don’t think we retrieve iconURL often enough to worry about the overhead of building a temp vector, so I suggest changing iconURL to return a Vector<> for all icon types.

IconController

IconController::urlsForTypes will need to support AnyIcon type

IconController::appendToIconURLs needs to support AnyIcon by retrieving them from the document

IconController::defaultURL needs to specify size for defaults (as empty, since we don’t know) and that they are default icons