imagesrcset / imagesizes: Fix candidate selection when imagesizes is absent

This fixes a bug where image source size is calculated to be zero when
<link rel=preload imagesrcset=...> does not have an imagesizes attribute.

If imagesizes attribute is absent or does not have a valid value, it
should be treated as "100vw" [1]. In HTMLPreloadScanner, this is done by
initializing |source_size_| in the StartTagScanner constructor, but we
did not do that for <link> tags.

[1] https://html.spec.whatwg.org/multipage/images.html#parsing-a-sizes-attribute

Bug: 813452
Change-Id: Ib7609c7de2a305d3e7ca142c9ce7f0c5f8cf7e3a
Reviewed-on: https://chromium-review.googlesource.com/c/1388047
Reviewed-by: Kouhei Ueno <kouhei@chromium.org>
Commit-Queue: Kunihiko Sakamoto <ksakamoto@chromium.org>
Cr-Commit-Position: refs/heads/master@{#618462}
3 files changed