Calculate source-size length as a float
authoryoav@yoav.ws <yoav@yoav.ws@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 8 May 2015 06:50:57 +0000 (06:50 +0000)
committeryoav@yoav.ws <yoav@yoav.ws@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 8 May 2015 06:50:57 +0000 (06:50 +0000)
commitbf65b6bdb5d7c05d37fd6aa22a3b87b9c1738488
tree5e5e1f3f435a9dd2f7a16ec0764a0aa6747f92bf
parente305e4e361b7658fb9acbbc1870332d769982322
Calculate source-size length as a float
https://bugs.webkit.org/show_bug.cgi?id=144766

Reviewed by Dean Jackson.

Source/WebCore:

Make sure that the source-size length is calculated as a float,
to align with the spec.

Test: fast/dom/HTMLImageElement/sizes/image-sizes-1x.html
      fast/dom/HTMLImageElement/sizes/image-sizes-2x.html

* css/SourceSizeList.cpp:
(WebCore::parseSizesAttribute):
(WebCore::defaultLength):
(WebCore::computeLength):
* css/SourceSizeList.h:
* html/HTMLImageElement.cpp:
(WebCore::HTMLImageElement::parseAttribute):
* html/parser/HTMLPreloadScanner.cpp:
(WebCore::TokenPreloadScanner::StartTagScanner::processAttributes):
* html/parser/HTMLSrcsetParser.cpp:
(WebCore::pickBestImageCandidate):
(WebCore::bestFitSourceForImageAttributes):
* html/parser/HTMLSrcsetParser.h:

LayoutTests:

Add tests that make sure fractional source-size lengths are supported
and are calculated as floats.

* fast/dom/HTMLImageElement/sizes/image-sizes-1x-expected.txt:
* fast/dom/HTMLImageElement/sizes/image-sizes-1x.html:
* fast/dom/HTMLImageElement/sizes/image-sizes-2x-expected.txt:
* fast/dom/HTMLImageElement/sizes/image-sizes-2x.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@183984 268f45cc-cd09-0410-ab3c-d52691b4dbfc
12 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/dom/HTMLImageElement/sizes/image-sizes-1x-expected.txt
LayoutTests/fast/dom/HTMLImageElement/sizes/image-sizes-1x.html
LayoutTests/fast/dom/HTMLImageElement/sizes/image-sizes-2x-expected.txt
LayoutTests/fast/dom/HTMLImageElement/sizes/image-sizes-2x.html
Source/WebCore/ChangeLog
Source/WebCore/css/SourceSizeList.cpp
Source/WebCore/css/SourceSizeList.h
Source/WebCore/html/HTMLImageElement.cpp
Source/WebCore/html/parser/HTMLPreloadScanner.cpp
Source/WebCore/html/parser/HTMLSrcsetParser.cpp
Source/WebCore/html/parser/HTMLSrcsetParser.h