Skip to content

Commit b99a653

Browse files
committed
Add support for HTMLImageElement's sizes attribute
https://bugs.webkit.org/show_bug.cgi?id=133620 Reviewed by Dean Jackson. .: Added an ENABLE_PICTURE_SIZES compile flag. * Source/cmake/WebKitFeatures.cmake: * Source/cmakeconfig.h.cmake: Source/JavaScriptCore: Added an ENABLE_PICTURE_SIZES compile flag. * Configurations/FeatureDefines.xcconfig: Source/WebCore: Tests: fast/dom/HTMLImageElement/sizes/image-sizes-1x.html fast/dom/HTMLImageElement/sizes/image-sizes-2x.html fast/dom/HTMLImageElement/sizes/image-sizes-js-change.html fast/dom/HTMLImageElement/sizes/image-sizes-js-innerhtml.html http/tests/loading/sizes/preload-image-sizes-2x.html http/tests/loading/sizes/preload-image-sizes.html This patch adds support for HTMLImageElement's sizes attribute and the related srcset extended syntax as defined in http://picture.responsiveimages.org/. This sizes attribute syntax is added to the CSSGrammar and parsed by the CSSParser. The SourceSizeList class is generated by the parser, and used to get the final source size. HTMLImageElement and HTMLPreloadScanner send this value to HTMLSrcsetParser. HTMLSrcsetParser uses this value in order to pick the right resource. * CMakeLists.txt: Added css/SourceSizeList.cpp. * Configurations/FeatureDefines.xcconfig: Added the PICTURE_SIZES flag. * WebCore.vcxproj/WebCore.vcxproj: Added css/SourceSizeList.*. * WebCore.vcxproj/WebCore.vcxproj.filters: Added css/SourceSizeList.*. * WebCore.xcodeproj/project.pbxproj: Added css/SourceSizeList.*. * css/CSSGrammar.y.in: Added 4 grammar rules that define a Media condition, Source size list, Source size length and source size. * css/CSSParser.cpp: (WebCore::CSSParser::parseSizesAttribute): Parse the sizes attribute. (WebCore::CSSParser::detectAtToken): Set the token to SIZESATTR. * css/CSSParser.h: * css/SourceSizeList.cpp: Added. Defined the SourceSize and SourceSizeList classes. (WebCore::SourceSize::match): (WebCore::computeLength): (WebCore::defaultValue): (WebCore::SourceSize::length): (WebCore::SourceSizeList::parseSizesAttribute): (WebCore::SourceSizeList::getEffectiveSize): * css/SourceSizeList.h: Added. (WebCore::SourceSize::SourceSize): (WebCore::SourceSizeList::append): * html/HTMLImageElement.cpp: Integrated sizes attribute parsing and added currentSrc. (WebCore::HTMLImageElement::setBestFitURLAndDPRFromImageCandidate): (WebCore::HTMLImageElement::parseAttribute): (WebCore::HTMLImageElement::currentSrc): * html/HTMLImageElement.h: * html/HTMLImageElement.idl: * html/parser/HTMLDocumentParser.cpp: Added information required for sizes parsing to HTMLPreloadScanner calls. (WebCore::HTMLDocumentParser::pumpTokenizer): (WebCore::HTMLDocumentParser::insert): (WebCore::HTMLDocumentParser::append): (WebCore::HTMLDocumentParser::appendCurrentInputStreamToPreloadScannerAndScan): * html/parser/HTMLPreloadScanner.cpp: Integrated sizes attribute parsing. (WebCore::TokenPreloadScanner::StartTagScanner::processAttributes): (WebCore::TokenPreloadScanner::StartTagScanner::processAttribute): (WebCore::TokenPreloadScanner::scan): (WebCore::HTMLPreloadScanner::scan): * html/parser/HTMLPreloadScanner.h: * html/parser/HTMLSrcsetParser.cpp: Added 'w' descriptor parsing sizes based normalization. (WebCore::parseDescriptors): (WebCore::pickBestImageCandidate): (WebCore::bestFitSourceForImageAttributes): * html/parser/HTMLSrcsetParser.h: Source/WebKit/mac: Added an ENABLE_PICTURE_SIZES compile flag. * Configurations/FeatureDefines.xcconfig: Source/WebKit2: Added an ENABLE_PICTURE_SIZES compile flag. * Configurations/FeatureDefines.xcconfig: Tools: Added an ENABLE_PICTURE_SIZES compile flag. * Scripts/webkitperl/FeatureList.pm: LayoutTests: These layout tests check that the sizes attribute and the related srcset syntax are well supported, that the right resource is displayed, that the currentSrc attribute is well supported and also that the right resource is preloaded. * fast/dom/HTMLImageElement/resources/currentSrcHelper.js: Added. (fileName): (currentSrcFileName): * fast/dom/HTMLImageElement/resources/image-set-4x.png: Added. * fast/dom/HTMLImageElement/sizes/image-sizes-1x-expected.txt: Added. * fast/dom/HTMLImageElement/sizes/image-sizes-1x.html: Added. * fast/dom/HTMLImageElement/sizes/image-sizes-2x-expected.txt: Added. * fast/dom/HTMLImageElement/sizes/image-sizes-2x.html: Added. * fast/dom/HTMLImageElement/sizes/image-sizes-js-change-expected.txt: Added. * fast/dom/HTMLImageElement/sizes/image-sizes-js-change.html: Added. * fast/dom/HTMLImageElement/sizes/image-sizes-js-innerhtml-expected.txt: Added. * fast/dom/HTMLImageElement/sizes/image-sizes-js-innerhtml.html: Added. * http/tests/loading/sizes/preload-image-sizes-2x-expected.txt: Added. * http/tests/loading/sizes/preload-image-sizes-2x.html: Added. * http/tests/loading/sizes/preload-image-sizes-expected.txt: Added. * http/tests/loading/sizes/preload-image-sizes.html: Added. Canonical link: https://commits.webkit.org/152413@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@170576 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent 229615c commit b99a653

47 files changed

Lines changed: 1080 additions & 26 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

ChangeLog

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
2014-06-29 Yoav Weiss <yoav@yoav.ws>
2+
3+
Add support for HTMLImageElement's sizes attribute
4+
https://bugs.webkit.org/show_bug.cgi?id=133620
5+
6+
Reviewed by Dean Jackson.
7+
8+
Added an ENABLE_PICTURE_SIZES compile flag.
9+
10+
* Source/cmake/WebKitFeatures.cmake:
11+
* Source/cmakeconfig.h.cmake:
12+
113
2014-06-26 Daniel Bates <dabates@apple.com>
214

315
[iOS][WK2] Distant focusable element may not be scrolled into view when focused using keyboard

LayoutTests/ChangeLog

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,32 @@
1+
2014-06-29 Yoav Weiss <yoav@yoav.ws>
2+
3+
Add support for HTMLImageElement's sizes attribute
4+
https://bugs.webkit.org/show_bug.cgi?id=133620
5+
6+
Reviewed by Dean Jackson.
7+
8+
These layout tests check that the sizes attribute and the related
9+
srcset syntax are well supported, that the right resource is displayed,
10+
that the currentSrc attribute is well supported and also that the right
11+
resource is preloaded.
12+
13+
* fast/dom/HTMLImageElement/resources/currentSrcHelper.js: Added.
14+
(fileName):
15+
(currentSrcFileName):
16+
* fast/dom/HTMLImageElement/resources/image-set-4x.png: Added.
17+
* fast/dom/HTMLImageElement/sizes/image-sizes-1x-expected.txt: Added.
18+
* fast/dom/HTMLImageElement/sizes/image-sizes-1x.html: Added.
19+
* fast/dom/HTMLImageElement/sizes/image-sizes-2x-expected.txt: Added.
20+
* fast/dom/HTMLImageElement/sizes/image-sizes-2x.html: Added.
21+
* fast/dom/HTMLImageElement/sizes/image-sizes-js-change-expected.txt: Added.
22+
* fast/dom/HTMLImageElement/sizes/image-sizes-js-change.html: Added.
23+
* fast/dom/HTMLImageElement/sizes/image-sizes-js-innerhtml-expected.txt: Added.
24+
* fast/dom/HTMLImageElement/sizes/image-sizes-js-innerhtml.html: Added.
25+
* http/tests/loading/sizes/preload-image-sizes-2x-expected.txt: Added.
26+
* http/tests/loading/sizes/preload-image-sizes-2x.html: Added.
27+
* http/tests/loading/sizes/preload-image-sizes-expected.txt: Added.
28+
* http/tests/loading/sizes/preload-image-sizes.html: Added.
29+
130
2014-06-29 Youenn Fablet <youenn.fablet@crf.canon.fr>
231

332
TextCodecICU::encode turns the whole string as yen signs if there is any backslash in it

LayoutTests/TestExpectations

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,3 +126,7 @@ webkit.org/b/132791 svg/as-object/sizing/svg-in-object-placeholder-height-percen
126126
webkit.org/b/132791 svg/as-object/sizing/svg-in-object-placeholder-height-auto.html [ Skip ]
127127

128128
webkit.org/b/133057 fast/table/border-collapsing/collapsed-borders-adjoining-sections.html [ ImageOnlyFailure ]
129+
130+
# Skip img@sizes tests since it is disabled by default.
131+
fast/dom/HTMLImageElement/sizes
132+
http/tests/loading/sizes
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
function fileName(src) {
2+
var array = src.split('/');
3+
return array[array.length -1];
4+
};
5+
6+
function currentSrcFileName(id) {
7+
var currentSrc = document.getElementById(id).currentSrc;
8+
return fileName(currentSrc);
9+
};
39 KB
Loading
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
PASS successfullyParsed is true
2+
3+
TEST COMPLETE
4+
PASS document.getElementById("simple").currentSrc.indexOf("file://") == 0 is true
5+
PASS document.getElementById("simple").clientWidth is (window.innerWidth)
6+
PASS currentSrcFileName("simple") is "image-set-2x.png"
7+
PASS document.getElementById("calc").clientWidth is 900
8+
PASS currentSrcFileName("calc") is "image-set-2x.png"
9+
PASS document.getElementById("small_sizes").clientWidth is 300
10+
PASS currentSrcFileName("small_sizes") is "image-set-1x.png"
11+
PASS document.getElementById("sizes_x_descriptors").clientWidth is 400
12+
PASS currentSrcFileName("sizes_x_descriptors") is "image-set-1x.png"
13+
PASS document.getElementById("sizes_src").clientWidth is 400
14+
PASS currentSrcFileName("sizes_src") is "image-set-1x.png"
15+
PASS document.getElementById("default_sizes").clientWidth is window.innerWidth
16+
PASS currentSrcFileName("default_sizes") is "image-set-2x.png"
17+
PASS document.getElementById("invalid_length").clientWidth is window.innerWidth
18+
PASS currentSrcFileName("invalid_length") is "image-set-2x.png"
19+
PASS document.getElementById("src_and_w").clientWidth is within 0.015625 of 700
20+
PASS currentSrcFileName("src_and_w") is "image-set-4x.png"
21+
PASS document.getElementById("src_and_w2").clientWidth is within 0.015625 of 700
22+
PASS currentSrcFileName("src_and_w2") is "image-set-1x.png"
23+
PASS document.getElementById("x_and_w").clientWidth is within 0.015625 of 700
24+
PASS currentSrcFileName("x_and_w") is "image-set-4x.png"
25+
PASS document.getElementById("x_and_w2").clientWidth is 400
26+
PASS currentSrcFileName("x_and_w2") is "image-set-2x.png"
27+
PASS document.getElementById("x_and_w3").clientWidth is 400
28+
PASS currentSrcFileName("x_and_w3") is "image-set-2x.png"
29+
PASS document.getElementById("half_size").clientWidth is (window.innerWidth/2)
30+
PASS currentSrcFileName("half_size") is "image-set-2x.png"
31+
PASS document.getElementById("infitisimal_sizes").clientWidth is (window.innerWidth/100)
32+
PASS currentSrcFileName("infitisimal_sizes") is "image-set-2x.png"
33+
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<!DOCTYPE html>
2+
<script src="../../../../resources/js-test.js"></script>
3+
<script src="../resources/currentSrcHelper.js"></script>
4+
<script>
5+
if (window.testRunner)
6+
testRunner.dumpAsText();
7+
8+
addEventListener("load", function() {
9+
shouldBeTrue('document.getElementById("simple").currentSrc.indexOf("file://") == 0');
10+
shouldBe('document.getElementById("simple").clientWidth', '(window.innerWidth)');
11+
shouldBe('currentSrcFileName("simple")', '"image-set-2x.png"');
12+
shouldBe('document.getElementById("calc").clientWidth', '900');
13+
shouldBe('currentSrcFileName("calc")', '"image-set-2x.png"');
14+
shouldBe('document.getElementById("small_sizes").clientWidth', '300');
15+
shouldBe('currentSrcFileName("small_sizes")', '"image-set-1x.png"');
16+
shouldBe('document.getElementById("sizes_x_descriptors").clientWidth', '400');
17+
shouldBe('currentSrcFileName("sizes_x_descriptors")', '"image-set-1x.png"');
18+
shouldBe('document.getElementById("sizes_src").clientWidth', '400');
19+
shouldBe('currentSrcFileName("sizes_src")', '"image-set-1x.png"');
20+
shouldBe('document.getElementById("default_sizes").clientWidth', 'window.innerWidth');
21+
shouldBe('currentSrcFileName("default_sizes")', '"image-set-2x.png"');
22+
shouldBe('document.getElementById("invalid_length").clientWidth', 'window.innerWidth');
23+
shouldBe('currentSrcFileName("invalid_length")', '"image-set-2x.png"');
24+
shouldBeCloseTo('document.getElementById("src_and_w").clientWidth', 700, 1/64);
25+
shouldBe('currentSrcFileName("src_and_w")', '"image-set-4x.png"');
26+
shouldBeCloseTo('document.getElementById("src_and_w2").clientWidth', 700, 1/64);
27+
shouldBe('currentSrcFileName("src_and_w2")', '"image-set-1x.png"');
28+
shouldBeCloseTo('document.getElementById("x_and_w").clientWidth', 700, 1/64);
29+
shouldBe('currentSrcFileName("x_and_w")', '"image-set-4x.png"');
30+
shouldBe('document.getElementById("x_and_w2").clientWidth', '400');
31+
shouldBe('currentSrcFileName("x_and_w2")', '"image-set-2x.png"');
32+
shouldBe('document.getElementById("x_and_w3").clientWidth', '400');
33+
shouldBe('currentSrcFileName("x_and_w3")', '"image-set-2x.png"');
34+
shouldBe('document.getElementById("half_size").clientWidth', '(window.innerWidth/2)');
35+
shouldBe('currentSrcFileName("half_size")', '"image-set-2x.png"');
36+
shouldBe('document.getElementById("infitisimal_sizes").clientWidth', '(window.innerWidth/100)');
37+
shouldBe('currentSrcFileName("infitisimal_sizes")', '"image-set-2x.png"');
38+
}, false);
39+
</script>
40+
<img id="simple" src="" sizes="(max-width: 300px) 400px, 800px" srcset="../../../hidpi/resources/image-set-1x.png 400w, ../../../hidpi/resources/image-set-2x.png 800w">
41+
<img id="calc" src="" sizes="(max-width: 300px) 400px, calc(2*450px)" srcset="../../../hidpi/resources/image-set-1x.png 400w, ../../../hidpi/resources/image-set-2x.png 800w">
42+
<img id="small_sizes" src="" sizes="300px" srcset="../../../hidpi/resources/image-set-1x.png 400w, ../../../hidpi/resources/image-set-2x.png 800w">
43+
<!-- 'sizes' has no impact on 'x' or 'src' resources -->
44+
<img id="sizes_x_descriptors" src="" sizes="50vw" srcset="../../../hidpi/resources/image-set-1x.png 1x, ../../../hidpi/resources/image-set-2x.png 2x">
45+
<img id="sizes_src" src="../../../hidpi/resources/image-set-1x.png" sizes="50vw">
46+
<!-- Missing sizes or an invalid one, give a source size of 100vw -->
47+
<img id="default_sizes" src="" srcset="../../../hidpi/resources/image-set-1x.png 400w, ../../../hidpi/resources/image-set-2x.png 800w, ../resources/image-set-4x.png 1600w">
48+
<img id="invalid_length" src="" sizes="(max-width: 300px) 400w, 800w" srcset="../../../hidpi/resources/image-set-1x.png 400w, ../../../hidpi/resources/image-set-2x.png 800w">
49+
<!-- Make sure that the img src is not picked when 'w' is present -->
50+
<img id="src_and_w" src="../../../hidpi/resources/image-set-1x.png" sizes="700px" srcset="../resources/image-set-4x.png 1600w">
51+
<img id="src_and_w2" src="../../../hidpi/resources/image-set-2x.png" sizes="700px" srcset="../../../hidpi/resources/image-set-1x.png 400w">
52+
<img id="x_and_w" sizes="700px" srcset="../../../hidpi/resources/image-set-1x.png 0.5x, ../resources/image-set-4x.png 1600w">
53+
<!-- The 'x' resource should be picked, and 'sizes' have no impact on its intrisic size -->
54+
<img id="x_and_w2" sizes="700px" srcset="../../../hidpi/resources/image-set-2x.png 2x, ../resources/image-set-4x.png 16000w">
55+
<img id="x_and_w3" sizes="700px" srcset="../resources/image-set-4x.png 16000w, ../../../hidpi/resources/image-set-2x.png 2x">
56+
<!-- The intrinsic size should be identical to the 'sizes' value -->
57+
<img id="half_size" sizes="50vw" srcset="../../../hidpi/resources/image-set-2x.png 800w, ../resources/image-set-4x.png 16000w">
58+
<img id="infitisimal_sizes" sizes="1vw" srcset="../../../hidpi/resources/image-set-2x.png 800w, ../resources/image-set-4x.png 16000w">
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
PASS successfullyParsed is true
2+
3+
TEST COMPLETE
4+
PASS document.getElementById("simple").clientWidth is window.innerWidth
5+
PASS currentSrcFileName("simple") is "image-set-2x.png"
6+
PASS document.getElementById("small_sizes").clientWidth is 300
7+
PASS currentSrcFileName("small_sizes") is "image-set-2x.png"
8+
PASS document.getElementById("sizes_x_descriptors").clientWidth is 400
9+
PASS currentSrcFileName("sizes_x_descriptors") is "image-set-2x.png"
10+
PASS document.getElementById("sizes_src").clientWidth is 400
11+
PASS currentSrcFileName("sizes_src") is "image-set-1x.png"
12+
PASS document.getElementById("default_sizes").clientWidth is window.innerWidth
13+
PASS currentSrcFileName("default_sizes") is "image-set-4x.png"
14+
PASS document.getElementById("invalid_length").clientWidth is window.innerWidth
15+
PASS currentSrcFileName("invalid_length") is "image-set-2x.png"
16+
PASS document.getElementById("src_and_w").clientWidth is within 0.015625 of 700
17+
PASS currentSrcFileName("src_and_w") is "image-set-4x.png"
18+
PASS document.getElementById("x_and_w").clientWidth is within 0.015625 of 700
19+
PASS currentSrcFileName("x_and_w") is "image-set-4x.png"
20+
PASS document.getElementById("x_and_w2").clientWidth is 400
21+
PASS currentSrcFileName("x_and_w2") is "image-set-2x.png"
22+
PASS document.getElementById("x_and_w3").clientWidth is 400
23+
PASS currentSrcFileName("x_and_w3") is "image-set-2x.png"
24+
PASS document.getElementById("half_size").clientWidth is (window.innerWidth/2)
25+
PASS currentSrcFileName("half_size") is "image-set-2x.png"
26+
PASS document.getElementById("infitisimal_sizes").clientWidth is (window.innerWidth/100)
27+
PASS currentSrcFileName("infitisimal_sizes") is "image-set-2x.png"
28+
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<!DOCTYPE html>
2+
<script>
3+
window.targetScaleFactor = 2;
4+
</script>
5+
<script src="../../../hidpi/resources/srcset-helper.js"></script>
6+
<script src="../../../../resources/js-test.js"></script>
7+
<script src="../resources/currentSrcHelper.js"></script>
8+
<script>
9+
if (window.testRunner)
10+
testRunner.dumpAsText();
11+
12+
addEventListener("load", function() {
13+
shouldBe('document.getElementById("simple").clientWidth', 'window.innerWidth');
14+
shouldBe('currentSrcFileName("simple")', '"image-set-2x.png"');
15+
shouldBe('document.getElementById("small_sizes").clientWidth', '300');
16+
shouldBe('currentSrcFileName("small_sizes")', '"image-set-2x.png"');
17+
shouldBe('document.getElementById("sizes_x_descriptors").clientWidth', '400');
18+
shouldBe('currentSrcFileName("sizes_x_descriptors")', '"image-set-2x.png"');
19+
shouldBe('document.getElementById("sizes_src").clientWidth', '400');
20+
shouldBe('currentSrcFileName("sizes_src")', '"image-set-1x.png"');
21+
shouldBe('document.getElementById("default_sizes").clientWidth', 'window.innerWidth');
22+
shouldBe('currentSrcFileName("default_sizes")', '"image-set-4x.png"');
23+
shouldBe('document.getElementById("invalid_length").clientWidth', 'window.innerWidth');
24+
shouldBe('currentSrcFileName("invalid_length")', '"image-set-2x.png"');
25+
shouldBeCloseTo('document.getElementById("src_and_w").clientWidth', 700, 1/64);
26+
shouldBe('currentSrcFileName("src_and_w")', '"image-set-4x.png"');
27+
shouldBeCloseTo('document.getElementById("x_and_w").clientWidth', 700, 1/64);
28+
shouldBe('currentSrcFileName("x_and_w")', '"image-set-4x.png"');
29+
shouldBe('document.getElementById("x_and_w2").clientWidth', '400');
30+
shouldBe('currentSrcFileName("x_and_w2")', '"image-set-2x.png"');
31+
shouldBe('document.getElementById("x_and_w3").clientWidth', '400');
32+
shouldBe('currentSrcFileName("x_and_w3")', '"image-set-2x.png"');
33+
shouldBe('document.getElementById("half_size").clientWidth', '(window.innerWidth/2)');
34+
shouldBe('currentSrcFileName("half_size")', '"image-set-2x.png"');
35+
shouldBe('document.getElementById("infitisimal_sizes").clientWidth', '(window.innerWidth/100)');
36+
shouldBe('currentSrcFileName("infitisimal_sizes")', '"image-set-2x.png"');
37+
}, false);
38+
</script>
39+
<img id="simple" src="" sizes="(max-width: 300px) 400px, 800px" srcset="../../../hidpi/resources/image-set-1x.png 400w, ../../../hidpi/resources/image-set-2x.png 800w">
40+
<img id="small_sizes" src="" sizes="300px" srcset="../../../hidpi/resources/image-set-1x.png 400w, ../../../hidpi/resources/image-set-2x.png 800w">
41+
<!-- 'sizes' has no impact on 'x' or 'src' resources -->
42+
<img id="sizes_x_descriptors" src="" sizes="50vw" srcset="../../../hidpi/resources/image-set-1x.png 1x, ../../../hidpi/resources/image-set-2x.png 2x">
43+
<img id="sizes_src" src="../../../hidpi/resources/image-set-1x.png" sizes="50vw">
44+
<!-- Missing sizes or an invalid one, give a source size of 100vw -->
45+
<img id="default_sizes" src="" srcset="../../../hidpi/resources/image-set-1x.png 400w, ../../../hidpi/resources/image-set-2x.png 800w, ../resources/image-set-4x.png 1600w">
46+
<img id="invalid_length" src="" sizes="(max-width: 300px) 400w, 800w" srcset="../../../hidpi/resources/image-set-1x.png 400w, ../../../hidpi/resources/image-set-2x.png 800w">
47+
<img id="src_and_w" src="../../../hidpi/resources/image-set-1x.png" sizes="700px" srcset="../resources/image-set-4x.png 1600w">
48+
<img id="x_and_w" sizes="700px" srcset="../../../hidpi/resources/image-set-1x.png 0.5x, ../resources/image-set-4x.png 1600w">
49+
<!-- The 'x' resource should be picked, and 'sizes' have no impact on its intrisic size -->
50+
<img id="x_and_w2" sizes="700px" srcset="../../../hidpi/resources/image-set-2x.png 2x, ../resources/image-set-4x.png 16000w">
51+
<img id="x_and_w3" sizes="700px" srcset="../resources/image-set-4x.png 16000w, ../../../hidpi/resources/image-set-2x.png 2x">
52+
<!-- The intrinsic size should be identical to the 'sizes' value -->
53+
<img id="half_size" sizes="50vw" srcset="../../../hidpi/resources/image-set-2x.png 800w, ../resources/image-set-4x.png 16000w">
54+
<img id="infitisimal_sizes" sizes="1vw" srcset="../../../hidpi/resources/image-set-2x.png 800w, ../resources/image-set-4x.png 16000w">
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
image-set-4x.png - willSendRequest <NSURLRequest URL image-set-4x.png, main document URL image-sizes-js-change.html, http method GET> redirectResponse (null)
2+
js-test.js - didFinishLoading
3+
image-set-4x.png - didReceiveResponse <NSURLResponse image-set-4x.png, http status code 0>
4+
image-set-4x.png - didFinishLoading
5+
PASS successfullyParsed is true
6+
7+
TEST COMPLETE
8+
PASS currentSrcFileName("foo") is "image-set-4x.png"
9+

0 commit comments

Comments
 (0)