Add support for HTMLImageElement's sizes attribute
authoryoav@yoav.ws <yoav@yoav.ws@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 30 Jun 2014 04:07:08 +0000 (04:07 +0000)
committeryoav@yoav.ws <yoav@yoav.ws@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 30 Jun 2014 04:07:08 +0000 (04:07 +0000)
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.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@170576 268f45cc-cd09-0410-ab3c-d52691b4dbfc

47 files changed:
ChangeLog
LayoutTests/ChangeLog
LayoutTests/TestExpectations
LayoutTests/fast/dom/HTMLImageElement/resources/currentSrcHelper.js [new file with mode: 0644]
LayoutTests/fast/dom/HTMLImageElement/resources/image-set-4x.png [new file with mode: 0644]
LayoutTests/fast/dom/HTMLImageElement/sizes/image-sizes-1x-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/HTMLImageElement/sizes/image-sizes-1x.html [new file with mode: 0644]
LayoutTests/fast/dom/HTMLImageElement/sizes/image-sizes-2x-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/HTMLImageElement/sizes/image-sizes-2x.html [new file with mode: 0644]
LayoutTests/fast/dom/HTMLImageElement/sizes/image-sizes-js-change-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/HTMLImageElement/sizes/image-sizes-js-change.html [new file with mode: 0644]
LayoutTests/fast/dom/HTMLImageElement/sizes/image-sizes-js-innerhtml-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/HTMLImageElement/sizes/image-sizes-js-innerhtml.html [new file with mode: 0644]
LayoutTests/http/tests/loading/sizes/preload-image-sizes-2x-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/loading/sizes/preload-image-sizes-2x.html [new file with mode: 0644]
LayoutTests/http/tests/loading/sizes/preload-image-sizes-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/loading/sizes/preload-image-sizes.html [new file with mode: 0644]
LayoutTests/resources/srcset-helper.js [new file with mode: 0644]
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/Configurations/FeatureDefines.xcconfig
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/Configurations/FeatureDefines.xcconfig
Source/WebCore/WebCore.vcxproj/WebCore.vcxproj
Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/css/CSSGrammar.y.in
Source/WebCore/css/CSSParser.cpp
Source/WebCore/css/CSSParser.h
Source/WebCore/css/SourceSizeList.cpp [new file with mode: 0644]
Source/WebCore/css/SourceSizeList.h [new file with mode: 0644]
Source/WebCore/html/HTMLImageElement.cpp
Source/WebCore/html/HTMLImageElement.h
Source/WebCore/html/HTMLImageElement.idl
Source/WebCore/html/parser/HTMLDocumentParser.cpp
Source/WebCore/html/parser/HTMLPreloadScanner.cpp
Source/WebCore/html/parser/HTMLPreloadScanner.h
Source/WebCore/html/parser/HTMLSrcsetParser.cpp
Source/WebCore/html/parser/HTMLSrcsetParser.h
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/Configurations/FeatureDefines.xcconfig
Source/WebKit2/ChangeLog
Source/WebKit2/Configurations/FeatureDefines.xcconfig
Source/cmake/WebKitFeatures.cmake
Source/cmakeconfig.h.cmake
Tools/ChangeLog
Tools/Scripts/webkitperl/FeatureList.pm

index a103146..89230f2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2014-06-29  Yoav Weiss  <yoav@yoav.ws>
+
+        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:
+
 2014-06-26  Daniel Bates  <dabates@apple.com>
 
         [iOS][WK2] Distant focusable element may not be scrolled into view when focused using keyboard
index 0271a0f..3630edf 100644 (file)
@@ -1,3 +1,32 @@
+2014-06-29  Yoav Weiss  <yoav@yoav.ws>
+
+        Add support for HTMLImageElement's sizes attribute
+        https://bugs.webkit.org/show_bug.cgi?id=133620
+
+        Reviewed by Dean Jackson.
+
+        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.
+
 2014-06-29  Youenn Fablet  <youenn.fablet@crf.canon.fr>
 
         TextCodecICU::encode turns the whole string as yen signs if there is any backslash in it
index c797cf1..e8ac500 100644 (file)
@@ -126,3 +126,7 @@ webkit.org/b/132791 svg/as-object/sizing/svg-in-object-placeholder-height-percen
 webkit.org/b/132791 svg/as-object/sizing/svg-in-object-placeholder-height-auto.html [ Skip ]
 
 webkit.org/b/133057 fast/table/border-collapsing/collapsed-borders-adjoining-sections.html [ ImageOnlyFailure ]
+
+# Skip img@sizes tests since it is disabled by default.
+fast/dom/HTMLImageElement/sizes
+http/tests/loading/sizes
diff --git a/LayoutTests/fast/dom/HTMLImageElement/resources/currentSrcHelper.js b/LayoutTests/fast/dom/HTMLImageElement/resources/currentSrcHelper.js
new file mode 100644 (file)
index 0000000..b54e14b
--- /dev/null
@@ -0,0 +1,9 @@
+function fileName(src) {
+    var array = src.split('/');
+    return array[array.length -1];
+};
+
+function currentSrcFileName(id) {
+    var currentSrc = document.getElementById(id).currentSrc;
+    return fileName(currentSrc);
+};
diff --git a/LayoutTests/fast/dom/HTMLImageElement/resources/image-set-4x.png b/LayoutTests/fast/dom/HTMLImageElement/resources/image-set-4x.png
new file mode 100644 (file)
index 0000000..13a38bf
Binary files /dev/null and b/LayoutTests/fast/dom/HTMLImageElement/resources/image-set-4x.png differ
diff --git a/LayoutTests/fast/dom/HTMLImageElement/sizes/image-sizes-1x-expected.txt b/LayoutTests/fast/dom/HTMLImageElement/sizes/image-sizes-1x-expected.txt
new file mode 100644 (file)
index 0000000..d301d45
--- /dev/null
@@ -0,0 +1,33 @@
+PASS successfullyParsed is true
+
+TEST COMPLETE
+PASS document.getElementById("simple").currentSrc.indexOf("file://") == 0 is true
+PASS document.getElementById("simple").clientWidth is (window.innerWidth)
+PASS currentSrcFileName("simple") is "image-set-2x.png"
+PASS document.getElementById("calc").clientWidth is 900
+PASS currentSrcFileName("calc") is "image-set-2x.png"
+PASS document.getElementById("small_sizes").clientWidth is 300
+PASS currentSrcFileName("small_sizes") is "image-set-1x.png"
+PASS document.getElementById("sizes_x_descriptors").clientWidth is 400
+PASS currentSrcFileName("sizes_x_descriptors") is "image-set-1x.png"
+PASS document.getElementById("sizes_src").clientWidth is 400
+PASS currentSrcFileName("sizes_src") is "image-set-1x.png"
+PASS document.getElementById("default_sizes").clientWidth is window.innerWidth
+PASS currentSrcFileName("default_sizes") is "image-set-2x.png"
+PASS document.getElementById("invalid_length").clientWidth is window.innerWidth
+PASS currentSrcFileName("invalid_length") is "image-set-2x.png"
+PASS document.getElementById("src_and_w").clientWidth is within 0.015625 of 700
+PASS currentSrcFileName("src_and_w") is "image-set-4x.png"
+PASS document.getElementById("src_and_w2").clientWidth is within 0.015625 of 700
+PASS currentSrcFileName("src_and_w2") is "image-set-1x.png"
+PASS document.getElementById("x_and_w").clientWidth is within 0.015625 of 700
+PASS currentSrcFileName("x_and_w") is "image-set-4x.png"
+PASS document.getElementById("x_and_w2").clientWidth is 400
+PASS currentSrcFileName("x_and_w2") is "image-set-2x.png"
+PASS document.getElementById("x_and_w3").clientWidth is 400
+PASS currentSrcFileName("x_and_w3") is "image-set-2x.png"
+PASS document.getElementById("half_size").clientWidth is (window.innerWidth/2)
+PASS currentSrcFileName("half_size") is "image-set-2x.png"
+PASS document.getElementById("infitisimal_sizes").clientWidth is (window.innerWidth/100)
+PASS currentSrcFileName("infitisimal_sizes") is "image-set-2x.png"
+              
diff --git a/LayoutTests/fast/dom/HTMLImageElement/sizes/image-sizes-1x.html b/LayoutTests/fast/dom/HTMLImageElement/sizes/image-sizes-1x.html
new file mode 100644 (file)
index 0000000..c6a3f69
--- /dev/null
@@ -0,0 +1,58 @@
+<!DOCTYPE html>
+<script src="../../../../resources/js-test.js"></script>
+<script src="../resources/currentSrcHelper.js"></script>
+<script>
+    if (window.testRunner)
+        testRunner.dumpAsText();
+
+    addEventListener("load", function() {
+        shouldBeTrue('document.getElementById("simple").currentSrc.indexOf("file://") == 0');
+        shouldBe('document.getElementById("simple").clientWidth', '(window.innerWidth)');
+        shouldBe('currentSrcFileName("simple")', '"image-set-2x.png"');
+        shouldBe('document.getElementById("calc").clientWidth', '900');
+        shouldBe('currentSrcFileName("calc")', '"image-set-2x.png"');
+        shouldBe('document.getElementById("small_sizes").clientWidth', '300');
+        shouldBe('currentSrcFileName("small_sizes")', '"image-set-1x.png"');
+        shouldBe('document.getElementById("sizes_x_descriptors").clientWidth', '400');
+        shouldBe('currentSrcFileName("sizes_x_descriptors")', '"image-set-1x.png"');
+        shouldBe('document.getElementById("sizes_src").clientWidth', '400');
+        shouldBe('currentSrcFileName("sizes_src")', '"image-set-1x.png"');
+        shouldBe('document.getElementById("default_sizes").clientWidth', 'window.innerWidth');
+        shouldBe('currentSrcFileName("default_sizes")', '"image-set-2x.png"');
+        shouldBe('document.getElementById("invalid_length").clientWidth', 'window.innerWidth');
+        shouldBe('currentSrcFileName("invalid_length")', '"image-set-2x.png"');
+        shouldBeCloseTo('document.getElementById("src_and_w").clientWidth', 700, 1/64);
+        shouldBe('currentSrcFileName("src_and_w")', '"image-set-4x.png"');
+        shouldBeCloseTo('document.getElementById("src_and_w2").clientWidth', 700, 1/64);
+        shouldBe('currentSrcFileName("src_and_w2")', '"image-set-1x.png"');
+        shouldBeCloseTo('document.getElementById("x_and_w").clientWidth', 700, 1/64);
+        shouldBe('currentSrcFileName("x_and_w")', '"image-set-4x.png"');
+        shouldBe('document.getElementById("x_and_w2").clientWidth', '400');
+        shouldBe('currentSrcFileName("x_and_w2")', '"image-set-2x.png"');
+        shouldBe('document.getElementById("x_and_w3").clientWidth', '400');
+        shouldBe('currentSrcFileName("x_and_w3")', '"image-set-2x.png"');
+        shouldBe('document.getElementById("half_size").clientWidth', '(window.innerWidth/2)');
+        shouldBe('currentSrcFileName("half_size")', '"image-set-2x.png"');
+        shouldBe('document.getElementById("infitisimal_sizes").clientWidth', '(window.innerWidth/100)');
+        shouldBe('currentSrcFileName("infitisimal_sizes")', '"image-set-2x.png"');
+    }, false);
+</script>
+<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">
+<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">
+<img id="small_sizes" src="" sizes="300px" srcset="../../../hidpi/resources/image-set-1x.png 400w, ../../../hidpi/resources/image-set-2x.png 800w">
+<!-- 'sizes' has no impact on 'x' or 'src' resources -->
+<img id="sizes_x_descriptors" src="" sizes="50vw" srcset="../../../hidpi/resources/image-set-1x.png 1x, ../../../hidpi/resources/image-set-2x.png 2x">
+<img id="sizes_src" src="../../../hidpi/resources/image-set-1x.png" sizes="50vw">
+<!-- Missing sizes or an invalid one, give a source size of 100vw -->
+<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">
+<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">
+<!-- Make sure that the img src is not picked when 'w' is present -->
+<img id="src_and_w" src="../../../hidpi/resources/image-set-1x.png" sizes="700px" srcset="../resources/image-set-4x.png 1600w">
+<img id="src_and_w2" src="../../../hidpi/resources/image-set-2x.png" sizes="700px" srcset="../../../hidpi/resources/image-set-1x.png 400w">
+<img id="x_and_w" sizes="700px" srcset="../../../hidpi/resources/image-set-1x.png 0.5x, ../resources/image-set-4x.png 1600w">
+<!-- The 'x' resource should be picked, and 'sizes' have no impact on its intrisic size -->
+<img id="x_and_w2" sizes="700px" srcset="../../../hidpi/resources/image-set-2x.png 2x, ../resources/image-set-4x.png 16000w">
+<img id="x_and_w3" sizes="700px" srcset="../resources/image-set-4x.png 16000w, ../../../hidpi/resources/image-set-2x.png 2x">
+<!-- The intrinsic size should be identical to the 'sizes' value -->
+<img id="half_size" sizes="50vw" srcset="../../../hidpi/resources/image-set-2x.png 800w, ../resources/image-set-4x.png 16000w">
+<img id="infitisimal_sizes" sizes="1vw" srcset="../../../hidpi/resources/image-set-2x.png 800w, ../resources/image-set-4x.png 16000w">
diff --git a/LayoutTests/fast/dom/HTMLImageElement/sizes/image-sizes-2x-expected.txt b/LayoutTests/fast/dom/HTMLImageElement/sizes/image-sizes-2x-expected.txt
new file mode 100644 (file)
index 0000000..daa30d0
--- /dev/null
@@ -0,0 +1,28 @@
+PASS successfullyParsed is true
+
+TEST COMPLETE
+PASS document.getElementById("simple").clientWidth is window.innerWidth
+PASS currentSrcFileName("simple") is "image-set-2x.png"
+PASS document.getElementById("small_sizes").clientWidth is 300
+PASS currentSrcFileName("small_sizes") is "image-set-2x.png"
+PASS document.getElementById("sizes_x_descriptors").clientWidth is 400
+PASS currentSrcFileName("sizes_x_descriptors") is "image-set-2x.png"
+PASS document.getElementById("sizes_src").clientWidth is 400
+PASS currentSrcFileName("sizes_src") is "image-set-1x.png"
+PASS document.getElementById("default_sizes").clientWidth is window.innerWidth
+PASS currentSrcFileName("default_sizes") is "image-set-4x.png"
+PASS document.getElementById("invalid_length").clientWidth is window.innerWidth
+PASS currentSrcFileName("invalid_length") is "image-set-2x.png"
+PASS document.getElementById("src_and_w").clientWidth is within 0.015625 of 700
+PASS currentSrcFileName("src_and_w") is "image-set-4x.png"
+PASS document.getElementById("x_and_w").clientWidth is within 0.015625 of 700
+PASS currentSrcFileName("x_and_w") is "image-set-4x.png"
+PASS document.getElementById("x_and_w2").clientWidth is 400
+PASS currentSrcFileName("x_and_w2") is "image-set-2x.png"
+PASS document.getElementById("x_and_w3").clientWidth is 400
+PASS currentSrcFileName("x_and_w3") is "image-set-2x.png"
+PASS document.getElementById("half_size").clientWidth is (window.innerWidth/2)
+PASS currentSrcFileName("half_size") is "image-set-2x.png"
+PASS document.getElementById("infitisimal_sizes").clientWidth is (window.innerWidth/100)
+PASS currentSrcFileName("infitisimal_sizes") is "image-set-2x.png"
+            
diff --git a/LayoutTests/fast/dom/HTMLImageElement/sizes/image-sizes-2x.html b/LayoutTests/fast/dom/HTMLImageElement/sizes/image-sizes-2x.html
new file mode 100644 (file)
index 0000000..73612da
--- /dev/null
@@ -0,0 +1,54 @@
+<!DOCTYPE html>
+<script>
+    window.targetScaleFactor = 2;
+</script>
+<script src="../../../hidpi/resources/srcset-helper.js"></script>
+<script src="../../../../resources/js-test.js"></script>
+<script src="../resources/currentSrcHelper.js"></script>
+<script>
+    if (window.testRunner)
+        testRunner.dumpAsText();
+
+    addEventListener("load", function() {
+        shouldBe('document.getElementById("simple").clientWidth', 'window.innerWidth');
+        shouldBe('currentSrcFileName("simple")', '"image-set-2x.png"');
+        shouldBe('document.getElementById("small_sizes").clientWidth', '300');
+        shouldBe('currentSrcFileName("small_sizes")', '"image-set-2x.png"');
+        shouldBe('document.getElementById("sizes_x_descriptors").clientWidth', '400');
+        shouldBe('currentSrcFileName("sizes_x_descriptors")', '"image-set-2x.png"');
+        shouldBe('document.getElementById("sizes_src").clientWidth', '400');
+        shouldBe('currentSrcFileName("sizes_src")', '"image-set-1x.png"');
+        shouldBe('document.getElementById("default_sizes").clientWidth', 'window.innerWidth');
+        shouldBe('currentSrcFileName("default_sizes")', '"image-set-4x.png"');
+        shouldBe('document.getElementById("invalid_length").clientWidth', 'window.innerWidth');
+        shouldBe('currentSrcFileName("invalid_length")', '"image-set-2x.png"');
+        shouldBeCloseTo('document.getElementById("src_and_w").clientWidth', 700, 1/64);
+        shouldBe('currentSrcFileName("src_and_w")', '"image-set-4x.png"');
+        shouldBeCloseTo('document.getElementById("x_and_w").clientWidth', 700, 1/64);
+        shouldBe('currentSrcFileName("x_and_w")', '"image-set-4x.png"');
+        shouldBe('document.getElementById("x_and_w2").clientWidth', '400');
+        shouldBe('currentSrcFileName("x_and_w2")', '"image-set-2x.png"');
+        shouldBe('document.getElementById("x_and_w3").clientWidth', '400');
+        shouldBe('currentSrcFileName("x_and_w3")', '"image-set-2x.png"');
+        shouldBe('document.getElementById("half_size").clientWidth', '(window.innerWidth/2)');
+        shouldBe('currentSrcFileName("half_size")', '"image-set-2x.png"');
+        shouldBe('document.getElementById("infitisimal_sizes").clientWidth', '(window.innerWidth/100)');
+        shouldBe('currentSrcFileName("infitisimal_sizes")', '"image-set-2x.png"');
+    }, false);
+</script>
+<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">
+<img id="small_sizes" src="" sizes="300px" srcset="../../../hidpi/resources/image-set-1x.png 400w, ../../../hidpi/resources/image-set-2x.png 800w">
+<!-- 'sizes' has no impact on 'x' or 'src' resources -->
+<img id="sizes_x_descriptors" src="" sizes="50vw" srcset="../../../hidpi/resources/image-set-1x.png 1x, ../../../hidpi/resources/image-set-2x.png 2x">
+<img id="sizes_src" src="../../../hidpi/resources/image-set-1x.png" sizes="50vw">
+<!-- Missing sizes or an invalid one, give a source size of 100vw -->
+<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">
+<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">
+<img id="src_and_w" src="../../../hidpi/resources/image-set-1x.png" sizes="700px" srcset="../resources/image-set-4x.png 1600w">
+<img id="x_and_w" sizes="700px" srcset="../../../hidpi/resources/image-set-1x.png 0.5x, ../resources/image-set-4x.png 1600w">
+<!-- The 'x' resource should be picked, and 'sizes' have no impact on its intrisic size -->
+<img id="x_and_w2" sizes="700px" srcset="../../../hidpi/resources/image-set-2x.png 2x, ../resources/image-set-4x.png 16000w">
+<img id="x_and_w3" sizes="700px" srcset="../resources/image-set-4x.png 16000w, ../../../hidpi/resources/image-set-2x.png 2x">
+<!-- The intrinsic size should be identical to the 'sizes' value -->
+<img id="half_size" sizes="50vw" srcset="../../../hidpi/resources/image-set-2x.png 800w, ../resources/image-set-4x.png 16000w">
+<img id="infitisimal_sizes" sizes="1vw" srcset="../../../hidpi/resources/image-set-2x.png 800w, ../resources/image-set-4x.png 16000w">
diff --git a/LayoutTests/fast/dom/HTMLImageElement/sizes/image-sizes-js-change-expected.txt b/LayoutTests/fast/dom/HTMLImageElement/sizes/image-sizes-js-change-expected.txt
new file mode 100644 (file)
index 0000000..4f52e3d
--- /dev/null
@@ -0,0 +1,9 @@
+image-set-4x.png - willSendRequest <NSURLRequest URL image-set-4x.png, main document URL image-sizes-js-change.html, http method GET> redirectResponse (null)
+js-test.js - didFinishLoading
+image-set-4x.png - didReceiveResponse <NSURLResponse image-set-4x.png, http status code 0>
+image-set-4x.png - didFinishLoading
+PASS successfullyParsed is true
+
+TEST COMPLETE
+PASS currentSrcFileName("foo") is "image-set-4x.png"
+
diff --git a/LayoutTests/fast/dom/HTMLImageElement/sizes/image-sizes-js-change.html b/LayoutTests/fast/dom/HTMLImageElement/sizes/image-sizes-js-change.html
new file mode 100644 (file)
index 0000000..d93173f
--- /dev/null
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<script src="../../../hidpi/resources/srcset-helper.js"></script>
+<script src="../../../../resources/js-test.js"></script>
+<script src="../resources/currentSrcHelper.js"></script>
+<script>
+    if (window.testRunner)
+        testRunner.dumpAsText();
+
+    function updateSrc() {
+        var img = document.getElementById("foo");
+        // sizes must be set first, then srcset must be set, the 'src'
+        // This will be fixed when image loading is done is "stable-state"
+        img.sizes = "400px";
+        img.srcset = "../../../hidpi/resources/image-set-1x.png 200w, ../../../hidpi/resources/image-set-2x.png 400w, ../resources/image-set-4x.png 800w";
+        img.src = "../resources/blue-100-px-square.png"
+    }
+
+    addEventListener("DOMContentLoaded", function() {
+        if (window.testRunner && sessionStorage.pageReloaded)
+            testRunner.dumpResourceLoadCallbacks();
+        updateSrc();
+    }, false);
+    addEventListener("load", function() {
+        shouldBe('currentSrcFileName("foo")', '"image-set-4x.png"');
+    }, false);
+</script>
+<img id="foo">
diff --git a/LayoutTests/fast/dom/HTMLImageElement/sizes/image-sizes-js-innerhtml-expected.txt b/LayoutTests/fast/dom/HTMLImageElement/sizes/image-sizes-js-innerhtml-expected.txt
new file mode 100644 (file)
index 0000000..c97331d
--- /dev/null
@@ -0,0 +1,5 @@
+PASS successfullyParsed is true
+
+TEST COMPLETE
+PASS fileName(window.testdiv.children[0].currentSrc) is "image-set-4x.png"
+
diff --git a/LayoutTests/fast/dom/HTMLImageElement/sizes/image-sizes-js-innerhtml.html b/LayoutTests/fast/dom/HTMLImageElement/sizes/image-sizes-js-innerhtml.html
new file mode 100644 (file)
index 0000000..f55b197
--- /dev/null
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<script src="../../../../resources/js-test.js"></script>
+<script src="../resources/currentSrcHelper.js"></script>
+<script>
+    if (window.testRunner)
+        testRunner.dumpAsText();
+
+    addEventListener("DOMContentLoaded", function() {
+        if (window.testRunner && sessionStorage.pageReloaded)
+            testRunner.dumpResourceRequestCallbacks();
+        window.testdiv = document.createElement("div");
+        window.testdiv.innerHTML = '<img id="foo" src="../resources/blue-100-px-square.png" srcset="../../../hidpi/resources/image-set-1x.png 200w, ../../../hidpi/resources/image-set-2x.png 400w, ../resources/image-set-4x.png 800w">';
+    }, false);
+    addEventListener("load", function() {
+        shouldBe('fileName(window.testdiv.children[0].currentSrc)', '"image-set-4x.png"');
+    }, false);
+</script>
+<img id="foo">
diff --git a/LayoutTests/http/tests/loading/sizes/preload-image-sizes-2x-expected.txt b/LayoutTests/http/tests/loading/sizes/preload-image-sizes-2x-expected.txt
new file mode 100644 (file)
index 0000000..86587b4
--- /dev/null
@@ -0,0 +1,61 @@
+main frame - didStartProvisionalLoadForFrame
+main frame - didCommitLoadForFrame
+main frame - didFinishDocumentLoadForFrame
+main frame - willPerformClientRedirectToURL: http://127.0.0.1:8000/loading/sizes/preload-image-sizes-2x.html 
+main frame - didHandleOnloadEventsForFrame
+main frame - didFinishLoadForFrame
+main frame - didStartProvisionalLoadForFrame
+main frame - didCancelClientRedirectForFrame
+main frame - didCommitLoadForFrame
+main frame - didFinishDocumentLoadForFrame
+main frame - didHandleOnloadEventsForFrame
+main frame - didFinishLoadForFrame
+PASS internals.isPreloaded('resources/image2.png'); is true
+PASS internals.isPreloaded('resources/preload-test.jpg?1'); is false
+PASS internals.isPreloaded('resources/base-image1.png?1'); is false
+PASS internals.isPreloaded('resources/base-image2.png?1'); is true
+PASS internals.isPreloaded('resources/base-image3.png?1'); is false
+PASS internals.isPreloaded('resources/preload-test.jpg?2'); is false
+PASS internals.isPreloaded('resources/base-image1.png?2'); is false
+PASS internals.isPreloaded('resources/base-image2.png?2'); is true
+PASS internals.isPreloaded('resources/base-image3.png?2'); is false
+PASS internals.isPreloaded('resources/preload-test.jpg?3'); is false
+PASS internals.isPreloaded('resources/base-image1.png?3'); is false
+PASS internals.isPreloaded('resources/base-image2.png?3'); is true
+PASS internals.isPreloaded('resources/base-image3.png?3'); is false
+PASS internals.isPreloaded('resources/preload-test.jpg?4'); is false
+PASS internals.isPreloaded('resources/base-image1.png?4'); is false
+PASS internals.isPreloaded('resources/base-image2.png?4'); is true
+PASS internals.isPreloaded('resources/base-image3.png?4'); is false
+PASS internals.isPreloaded('resources/preload-test.jpg?5'); is false
+PASS internals.isPreloaded('resources/base-image1.png?5'); is false
+PASS internals.isPreloaded('resources/base-image2.png?5'); is true
+PASS internals.isPreloaded('resources/base-image3.png?5'); is false
+PASS internals.isPreloaded('resources/preload-test.jpg?6'); is false
+PASS internals.isPreloaded('resources/base-image1.png?6'); is false
+PASS internals.isPreloaded('resources/base-image2.png?6'); is true
+PASS internals.isPreloaded('resources/base-image3.png?6'); is false
+PASS internals.isPreloaded('resources/preload-test.jpg?7'); is false
+PASS internals.isPreloaded('resources/base-image1.png?7'); is false
+PASS internals.isPreloaded('resources/base-image2.png?7'); is true
+PASS internals.isPreloaded('resources/base-image3.png?7'); is false
+PASS internals.isPreloaded('resources/preload-test.jpg?8'); is false
+PASS internals.isPreloaded('resources/base-image1.png?8'); is false
+PASS internals.isPreloaded('resources/base-image2.png?8'); is true
+PASS internals.isPreloaded('resources/base-image3.png?8'); is false
+PASS internals.isPreloaded('resources/preload-test.jpg?9'); is false
+PASS internals.isPreloaded('resources/base-image1.png?9'); is false
+PASS internals.isPreloaded('resources/base-image2.png?9'); is true
+PASS internals.isPreloaded('resources/base-image3.png?9'); is false
+PASS internals.isPreloaded('resources/dup-image1.png?7'); is false
+PASS internals.isPreloaded('resources/dup-image1.png?8'); is false
+PASS internals.isPreloaded('resources/dup-image2.png?8'); is false
+PASS internals.isPreloaded('resources/dup-image3.png?8'); is false
+PASS internals.isPreloaded('resources/preload-test.jpg?10'); is false
+PASS internals.isPreloaded('resources/base-image1.png?10'); is true
+PASS internals.isPreloaded('resources/base-image2.png?10'); is false
+PASS internals.isPreloaded('resources/base-image3.png?10'); is false
+PASS successfullyParsed is true
+
+TEST COMPLETE
+             
diff --git a/LayoutTests/http/tests/loading/sizes/preload-image-sizes-2x.html b/LayoutTests/http/tests/loading/sizes/preload-image-sizes-2x.html
new file mode 100644 (file)
index 0000000..977645e
--- /dev/null
@@ -0,0 +1,51 @@
+<html>
+<head>
+<script src="/js-test-resources/js-test.js"></script>
+<script>
+    window.targetScaleFactor = 2;
+</script>
+<script src="/js-test-resources/srcset-helper.js"></script>
+<script src="http://127.0.0.1:8000/resources/slow-script.pl?delay=100"></script>
+</head>
+<body>
+<script>
+    if (window.testRunner)
+        testRunner.dumpAsText();
+    shouldBeTrue("internals.isPreloaded('resources/image2.png');");
+    for (var i = 1; i <= 9; ++i) {
+        shouldBeFalse("internals.isPreloaded('resources/preload-test.jpg?" + i + "');");
+        shouldBeFalse("internals.isPreloaded('resources/base-image1.png?" + i + "');");
+        shouldBeTrue("internals.isPreloaded('resources/base-image2.png?" + i + "');");
+        shouldBeFalse("internals.isPreloaded('resources/base-image3.png?" + i + "');");
+    }
+    shouldBeFalse("internals.isPreloaded('resources/dup-image1.png?7');");
+    shouldBeFalse("internals.isPreloaded('resources/dup-image1.png?8');");
+    shouldBeFalse("internals.isPreloaded('resources/dup-image2.png?8');");
+    shouldBeFalse("internals.isPreloaded('resources/dup-image3.png?8');");
+    shouldBeFalse("internals.isPreloaded('resources/preload-test.jpg?10');");
+    shouldBeTrue("internals.isPreloaded('resources/base-image1.png?10');");
+    shouldBeFalse("internals.isPreloaded('resources/base-image2.png?10');");
+    shouldBeFalse("internals.isPreloaded('resources/base-image3.png?10');");
+
+</script>
+<!-- Control group -->
+<img src="resources/image2.png">
+<!-- All permutations of src, srcset and sizes -->
+<img src="resources/preload-test.jpg?1" sizes="400px" srcset="resources/base-image1.png?1 200w, resources/base-image3.png?1 400w, resources/base-image2.png?1 800w">
+<img src="resources/preload-test.jpg?2" srcset="resources/base-image1.png?2 200w, resources/base-image3.png?2 400w, resources/base-image2.png?2 800w" sizes="400px">
+<img sizes="400px" src="resources/preload-test.jpg?3" srcset="resources/base-image1.png?3 200w, resources/base-image3.png?3 400w, resources/base-image2.png?3 800w">
+<img sizes="400px" srcset="resources/base-image1.png?4 200w, resources/base-image3.png?4 400w, resources/base-image2.png?4 800w" src="resources/preload-test.jpg?4">
+<img srcset="resources/base-image1.png?5 200w, resources/base-image3.png?5 400w, resources/base-image2.png?5 800w" src="resources/preload-test.jpg?5" sizes="400px">
+<img srcset="resources/base-image1.png?6 200w, resources/base-image3.png?6 400w, resources/base-image2.png?6 800w" sizes="400px" src="resources/preload-test.jpg?6">
+<!-- Duplicate attributes -->
+<img srcset="resources/base-image1.png?7 200w, resources/base-image3.png?7 400w, resources/base-image2.png?7 800w" sizes="400px" src="resources/preload-test.jpg?7"
+     src="resources/dup-image1.png?7">
+<img srcset="resources/base-image1.png?8 200w, resources/base-image3.png?8 400w, resources/base-image2.png?8 800w" sizes="400px" src="resources/preload-test.jpg?8"
+     srcset="resources/dup-image1.png?8 200w, resources/dup-image3.png?8 400w, resources/dup-image2.png?8 800w">
+<img srcset="resources/base-image1.png?9 200w, resources/base-image3.png?9 400w, resources/base-image2.png?9 800w" sizes="400px" src="resources/preload-test.jpg?9"
+     sizes="800px">
+<!-- Sizes with 'x' descriptors -->
+<img srcset="resources/base-image1.png?10 2x, resources/base-image3.png?10 4x, resources/base-image2.png?10 8x" sizes="400px" src="resources/preload-test.jpg?10">
+</body>
+</html>
+
diff --git a/LayoutTests/http/tests/loading/sizes/preload-image-sizes-expected.txt b/LayoutTests/http/tests/loading/sizes/preload-image-sizes-expected.txt
new file mode 100644 (file)
index 0000000..b2ef5b1
--- /dev/null
@@ -0,0 +1,58 @@
+main frame - didStartProvisionalLoadForFrame
+main frame - didCommitLoadForFrame
+main frame - didFinishDocumentLoadForFrame
+main frame - didHandleOnloadEventsForFrame
+main frame - didFinishLoadForFrame
+PASS internals.isPreloaded('resources/image2.png'); is true
+PASS internals.isPreloaded('resources/preload-test.jpg?1'); is false
+PASS internals.isPreloaded('resources/base-image1.png?1'); is false
+PASS internals.isPreloaded('resources/base-image2.png?1'); is false
+PASS internals.isPreloaded('resources/base-image3.png?1'); is true
+PASS internals.isPreloaded('resources/preload-test.jpg?2'); is false
+PASS internals.isPreloaded('resources/base-image1.png?2'); is false
+PASS internals.isPreloaded('resources/base-image2.png?2'); is false
+PASS internals.isPreloaded('resources/base-image3.png?2'); is true
+PASS internals.isPreloaded('resources/preload-test.jpg?3'); is false
+PASS internals.isPreloaded('resources/base-image1.png?3'); is false
+PASS internals.isPreloaded('resources/base-image2.png?3'); is false
+PASS internals.isPreloaded('resources/base-image3.png?3'); is true
+PASS internals.isPreloaded('resources/preload-test.jpg?4'); is false
+PASS internals.isPreloaded('resources/base-image1.png?4'); is false
+PASS internals.isPreloaded('resources/base-image2.png?4'); is false
+PASS internals.isPreloaded('resources/base-image3.png?4'); is true
+PASS internals.isPreloaded('resources/preload-test.jpg?5'); is false
+PASS internals.isPreloaded('resources/base-image1.png?5'); is false
+PASS internals.isPreloaded('resources/base-image2.png?5'); is false
+PASS internals.isPreloaded('resources/base-image3.png?5'); is true
+PASS internals.isPreloaded('resources/preload-test.jpg?6'); is false
+PASS internals.isPreloaded('resources/base-image1.png?6'); is false
+PASS internals.isPreloaded('resources/base-image2.png?6'); is false
+PASS internals.isPreloaded('resources/base-image3.png?6'); is true
+PASS internals.isPreloaded('resources/preload-test.jpg?7'); is false
+PASS internals.isPreloaded('resources/base-image1.png?7'); is false
+PASS internals.isPreloaded('resources/base-image2.png?7'); is false
+PASS internals.isPreloaded('resources/base-image3.png?7'); is true
+PASS internals.isPreloaded('resources/preload-test.jpg?8'); is false
+PASS internals.isPreloaded('resources/base-image1.png?8'); is false
+PASS internals.isPreloaded('resources/base-image2.png?8'); is false
+PASS internals.isPreloaded('resources/base-image3.png?8'); is true
+PASS internals.isPreloaded('resources/preload-test.jpg?9'); is false
+PASS internals.isPreloaded('resources/base-image1.png?9'); is false
+PASS internals.isPreloaded('resources/base-image2.png?9'); is false
+PASS internals.isPreloaded('resources/base-image3.png?9'); is true
+PASS internals.isPreloaded('resources/preload-test.jpg?10'); is false
+PASS internals.isPreloaded('resources/base-image1.png?10'); is false
+PASS internals.isPreloaded('resources/base-image2.png?10'); is false
+PASS internals.isPreloaded('resources/base-image3.png?10'); is true
+PASS internals.isPreloaded('resources/dup-image1.png?8'); is false
+PASS internals.isPreloaded('resources/dup-image2.png?8'); is false
+PASS internals.isPreloaded('resources/dup-image3.png?8'); is false
+PASS internals.isPreloaded('resources/dup-image1.png?10'); is false
+PASS internals.isPreloaded('resources/preload-test.jpg?11'); is true
+PASS internals.isPreloaded('resources/base-image1.png?11'); is false
+PASS internals.isPreloaded('resources/base-image2.png?11'); is false
+PASS internals.isPreloaded('resources/base-image3.png?11'); is false
+PASS successfullyParsed is true
+
+TEST COMPLETE
+              
diff --git a/LayoutTests/http/tests/loading/sizes/preload-image-sizes.html b/LayoutTests/http/tests/loading/sizes/preload-image-sizes.html
new file mode 100644 (file)
index 0000000..d42055e
--- /dev/null
@@ -0,0 +1,48 @@
+<html>
+<head>
+<script src="/js-test-resources/js-test.js"></script>
+<script src="http://127.0.0.1:8000/resources/slow-script.pl?delay=100"></script>
+</head>
+<body>
+<script>
+    if (window.testRunner)
+        testRunner.dumpAsText();
+    shouldBeTrue("internals.isPreloaded('resources/image2.png');");
+    for (var i = 1; i <= 10; ++i) {
+        shouldBeFalse("internals.isPreloaded('resources/preload-test.jpg?" + i + "');");
+        shouldBeFalse("internals.isPreloaded('resources/base-image1.png?" + i + "');");
+        shouldBeFalse("internals.isPreloaded('resources/base-image2.png?" + i + "');");
+        shouldBeTrue("internals.isPreloaded('resources/base-image3.png?" + i + "');");
+    }
+    shouldBeFalse("internals.isPreloaded('resources/dup-image1.png?8');");
+    shouldBeFalse("internals.isPreloaded('resources/dup-image2.png?8');");
+    shouldBeFalse("internals.isPreloaded('resources/dup-image3.png?8');");
+    shouldBeFalse("internals.isPreloaded('resources/dup-image1.png?10');");
+    shouldBeTrue("internals.isPreloaded('resources/preload-test.jpg?11');");
+    shouldBeFalse("internals.isPreloaded('resources/base-image1.png?11');");
+    shouldBeFalse("internals.isPreloaded('resources/base-image2.png?11');");
+    shouldBeFalse("internals.isPreloaded('resources/base-image3.png?11');");
+
+</script>
+<!-- Control group -->
+<img src="resources/image2.png">
+<!-- All permutations of src, srcset and sizes -->
+<img src="resources/preload-test.jpg?1" sizes="400px" srcset="resources/base-image1.png?1 200w, resources/base-image3.png?1 400w, resources/base-image2.png?1 800w">
+<img src="resources/preload-test.jpg?2" srcset="resources/base-image1.png?2 200w, resources/base-image3.png?2 400w, resources/base-image2.png?2 800w" sizes="400px">
+<img sizes="400px" src="resources/preload-test.jpg?3" srcset="resources/base-image1.png?3 200w, resources/base-image3.png?3 400w, resources/base-image2.png?3 800w">
+<img sizes="400px" srcset="resources/base-image1.png?4 200w, resources/base-image3.png?4 400w, resources/base-image2.png?4 800w" src="resources/preload-test.jpg?4">
+<img srcset="resources/base-image1.png?5 200w, resources/base-image3.png?5 400w, resources/base-image2.png?5 800w" src="resources/preload-test.jpg?5" sizes="400px">
+<img srcset="resources/base-image1.png?6 200w, resources/base-image3.png?6 400w, resources/base-image2.png?6 800w" sizes="400px" src="resources/preload-test.jpg?6">
+<img srcset="resources/base-image1.png?7 200w, resources/base-image3.png?7 400w, resources/base-image2.png?7 800w" sizes="calc(4*100px)" src="resources/preload-test.jpg?7">
+<!-- Duplicate attributes -->
+<img srcset="resources/base-image1.png?8 200w, resources/base-image3.png?8 400w, resources/base-image2.png?8 800w" sizes="400px" src="resources/preload-test.jpg?8"
+     srcset="resources/dup-image1.png?8 200w, resources/dup-image3.png?8 400w, resources/dup-image2.png?8 800w">
+<img srcset="resources/base-image1.png?9 200w, resources/base-image3.png?9 400w, resources/base-image2.png?9 800w" sizes="400px" src="resources/preload-test.jpg?9"
+     sizes="800px">
+<img srcset="resources/base-image1.png?10 200w, resources/base-image3.png?10 400w, resources/base-image2.png?10 800w" sizes="400px" src="resources/preload-test.jpg?10"
+     src="resources/dup-image1.png?10">
+<!-- Sizes with 'x' descriptors -->
+<img srcset="resources/base-image1.png?11 2x, resources/base-image3.png?11 4x, resources/base-image2.png?11 8x" sizes="400px" src="resources/preload-test.jpg?11">
+</body>
+</html>
+
diff --git a/LayoutTests/resources/srcset-helper.js b/LayoutTests/resources/srcset-helper.js
new file mode 100644 (file)
index 0000000..db8deb8
--- /dev/null
@@ -0,0 +1,33 @@
+function runTest() {
+    if (!window.testRunner || !window.sessionStorage)
+        return;
+
+    if (!window.targetScaleFactor)
+        window.targetScaleFactor = 2;
+
+    if(!sessionStorage.pageReloaded && window.targetScaleFactor == window.deviceScaleFactor)
+        return;
+
+    if (!sessionStorage.scaleFactorIsSet) {
+        testRunner.waitUntilDone();
+        testRunner.setBackingScaleFactor(targetScaleFactor, scaleFactorIsSet);
+    }
+
+    if (sessionStorage.pageReloaded && sessionStorage.scaleFactorIsSet) {
+        delete sessionStorage.pageReloaded;
+        delete sessionStorage.scaleFactorIsSet;
+        if (!window.manualNotifyDone)
+            testRunner.notifyDone();
+    } else {
+        // Right now there is a bug that srcset does not properly deal with dynamic changes to the scale factor,
+        // so to work around that, we must reload the page to get the new image.
+        sessionStorage.pageReloaded = true;
+        document.location.reload(true);
+    }
+}
+
+function scaleFactorIsSet() {
+    sessionStorage.scaleFactorIsSet = true;
+}
+
+window.addEventListener("load", runTest, false);
index 8af3cff..21f3463 100644 (file)
@@ -1,3 +1,14 @@
+2014-06-29  Yoav Weiss  <yoav@yoav.ws>
+
+        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.
+
+        * Configurations/FeatureDefines.xcconfig:
+
 2014-06-27  Filip Pizlo  <fpizlo@apple.com>
 
         Don't fold a UInt32ToNumber with DoOverflow to Identity since that would result in an Identity that takes an Int32 and returns a DoubleRep
index 59dc18a..416b9b3 100644 (file)
@@ -228,6 +228,7 @@ ENABLE_WEB_REPLAY_macosx_Production = ;
 ENABLE_WEB_REPLAY_iphoneos = ;
 ENABLE_WEB_REPLAY_iphonesimulator = ;
 ENABLE_WEB_SOCKETS = ENABLE_WEB_SOCKETS;
+ENABLE_PICTURE_SIZES = ENABLE_PICTURE_SIZES;
 
 ENABLE_WEB_TIMING = $(ENABLE_WEB_TIMING_$(PLATFORM_NAME));
 ENABLE_WEB_TIMING_macosx = $(ENABLE_WEB_TIMING_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR));
@@ -248,4 +249,4 @@ ENABLE_FTL_JIT_iphonesimulator = ;
 
 ENABLE_LLINT_C_LOOP = ;
 
-FEATURE_DEFINES = $(ENABLE_3D_RENDERING) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ACCELERATED_OVERFLOW_SCROLLING) $(ENABLE_AVF_CAPTIONS) $(ENABLE_CACHE_PARTITIONING) $(ENABLE_CANVAS_PATH) $(ENABLE_CANVAS_PROXY) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CSP_NEXT) $(ENABLE_CSS_BOX_DECORATION_BREAK) $(ENABLE_CSS_COMPOSITING) $(ENABLE_CSS_DEVICE_ADAPTATION) $(ENABLE_CSS_EXCLUSIONS) $(ENABLE_CSS_FILTERS) $(ENABLE_CSS_GRID_LAYOUT) $(ENABLE_CSS_IMAGE_ORIENTATION) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_REGIONS) $(ENABLE_CSS_SHAPES) $(ENABLE_CSS_TRANSFORMS_ANIMATIONS_UNPREFIXED) $(ENABLE_CSS3_CONDITIONAL_RULES) $(ENABLE_CSS3_TEXT) $(ENABLE_CSS3_TEXT_LINE_BREAK) $(ENABLE_CURSOR_VISIBILITY) $(ENABLE_CUSTOM_SCHEME_HANDLER) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATALIST_ELEMENT) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DETAILS_ELEMENT) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DOM4_EVENTS_CONSTRUCTOR) $(ENABLE_ENCRYPTED_MEDIA) $(ENABLE_ENCRYPTED_MEDIA_V2) $(ENABLE_FILTERS) $(ENABLE_FONT_LOAD_EVENTS) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GAMEPAD_DEPRECATED) $(ENABLE_GEOLOCATION) $(ENABLE_HIDDEN_PAGE_DOM_TIMER_THROTTLING) $(ENABLE_HIGH_DPI_CANVAS) $(ENABLE_ICONDATABASE) $(ENABLE_SERVICE_CONTROLS) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INDEXED_DATABASE_IN_WORKERS) $(ENABLE_INDIE_UI) $(ENABLE_INPUT_SPEECH) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_TYPE_COLOR_POPOVER) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME_INCOMPLETE) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_INSPECTOR) $(ENABLE_IOS_AIRPLAY) $(ENABLE_IOS_TEXT_AUTOSIZING) $(ENABLE_LEGACY_CSS_VENDOR_PREFIXES) $(ENABLE_LEGACY_NOTIFICATIONS) $(ENABLE_LEGACY_VENDOR_PREFIXES) $(ENABLE_LEGACY_WEB_AUDIO) $(ENABLE_LETTERPRESS) $(ENABLE_LINK_LONG_PRESS) $(ENABLE_LINK_PREFETCH) $(ENABLE_MATHML) $(ENABLE_MEDIA_CONTROLS_SCRIPT) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_METER_ELEMENT) $(ENABLE_MHTML) $(ENABLE_MOUSE_CURSOR_SCALE) $(ENABLE_NAVIGATOR_CONTENT_UTILS) $(ENABLE_NAVIGATOR_HWCONCURRENCY) $(ENABLE_NOTIFICATIONS) $(ENABLE_PDFKIT_PLUGIN) $(ENABLE_POINTER_LOCK) $(ENABLE_PROMISES) $(ENABLE_PROXIMITY_EVENTS) $(ENABLE_PUBLIC_SUFFIX_LIST) $(ENABLE_QUOTA) $(ENABLE_REQUEST_ANIMATION_FRAME) $(ENABLE_REMOTE_INSPECTOR) $(ENABLE_RESOLUTION_MEDIA_QUERY) $(ENABLE_SCRIPTED_SPEECH) $(ENABLE_SHARED_WORKERS) $(ENABLE_SPEECH_SYNTHESIS) $(ENABLE_SQL_DATABASE) $(ENABLE_SUBPIXEL_LAYOUT) $(ENABLE_SUBTLE_CRYPTO) $(ENABLE_SVG_FONTS) $(ENABLE_TELEPHONE_NUMBER_DETECTION) $(ENABLE_TEMPLATE_ELEMENT) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_TOUCH_EVENTS) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_USERSELECT_ALL) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_DATACUE_VALUE) $(ENABLE_VIEW_MODE_CSS_MEDIA) $(ENABLE_WEBGL) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_REPLAY) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WEBVTT_REGIONS) $(ENABLE_XHR_TIMEOUT) $(ENABLE_XSLT) $(ENABLE_FTL_JIT) $(ENABLE_LLINT_C_LOOP) $(FEATURE_DEFINES_$(PLATFORM_NAME));
+FEATURE_DEFINES = $(ENABLE_3D_RENDERING) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ACCELERATED_OVERFLOW_SCROLLING) $(ENABLE_AVF_CAPTIONS) $(ENABLE_CACHE_PARTITIONING) $(ENABLE_CANVAS_PATH) $(ENABLE_CANVAS_PROXY) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CSP_NEXT) $(ENABLE_CSS_BOX_DECORATION_BREAK) $(ENABLE_CSS_COMPOSITING) $(ENABLE_CSS_DEVICE_ADAPTATION) $(ENABLE_CSS_EXCLUSIONS) $(ENABLE_CSS_FILTERS) $(ENABLE_CSS_GRID_LAYOUT) $(ENABLE_CSS_IMAGE_ORIENTATION) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_REGIONS) $(ENABLE_CSS_SHAPES) $(ENABLE_CSS_TRANSFORMS_ANIMATIONS_UNPREFIXED) $(ENABLE_CSS3_CONDITIONAL_RULES) $(ENABLE_CSS3_TEXT) $(ENABLE_CSS3_TEXT_LINE_BREAK) $(ENABLE_CURSOR_VISIBILITY) $(ENABLE_CUSTOM_SCHEME_HANDLER) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATALIST_ELEMENT) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DETAILS_ELEMENT) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DOM4_EVENTS_CONSTRUCTOR) $(ENABLE_ENCRYPTED_MEDIA) $(ENABLE_ENCRYPTED_MEDIA_V2) $(ENABLE_FILTERS) $(ENABLE_FONT_LOAD_EVENTS) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GAMEPAD_DEPRECATED) $(ENABLE_GEOLOCATION) $(ENABLE_HIDDEN_PAGE_DOM_TIMER_THROTTLING) $(ENABLE_HIGH_DPI_CANVAS) $(ENABLE_ICONDATABASE) $(ENABLE_SERVICE_CONTROLS) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INDEXED_DATABASE_IN_WORKERS) $(ENABLE_INDIE_UI) $(ENABLE_INPUT_SPEECH) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_TYPE_COLOR_POPOVER) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME_INCOMPLETE) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_INSPECTOR) $(ENABLE_IOS_AIRPLAY) $(ENABLE_IOS_TEXT_AUTOSIZING) $(ENABLE_LEGACY_CSS_VENDOR_PREFIXES) $(ENABLE_LEGACY_NOTIFICATIONS) $(ENABLE_LEGACY_VENDOR_PREFIXES) $(ENABLE_LEGACY_WEB_AUDIO) $(ENABLE_LETTERPRESS) $(ENABLE_LINK_LONG_PRESS) $(ENABLE_LINK_PREFETCH) $(ENABLE_MATHML) $(ENABLE_MEDIA_CONTROLS_SCRIPT) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_METER_ELEMENT) $(ENABLE_MHTML) $(ENABLE_MOUSE_CURSOR_SCALE) $(ENABLE_NAVIGATOR_CONTENT_UTILS) $(ENABLE_NAVIGATOR_HWCONCURRENCY) $(ENABLE_NOTIFICATIONS) $(ENABLE_PDFKIT_PLUGIN) $(ENABLE_POINTER_LOCK) $(ENABLE_PROMISES) $(ENABLE_PROXIMITY_EVENTS) $(ENABLE_PUBLIC_SUFFIX_LIST) $(ENABLE_QUOTA) $(ENABLE_REQUEST_ANIMATION_FRAME) $(ENABLE_REMOTE_INSPECTOR) $(ENABLE_RESOLUTION_MEDIA_QUERY) $(ENABLE_SCRIPTED_SPEECH) $(ENABLE_SHARED_WORKERS) $(ENABLE_SPEECH_SYNTHESIS) $(ENABLE_SQL_DATABASE) $(ENABLE_SUBPIXEL_LAYOUT) $(ENABLE_SUBTLE_CRYPTO) $(ENABLE_SVG_FONTS) $(ENABLE_TELEPHONE_NUMBER_DETECTION) $(ENABLE_TEMPLATE_ELEMENT) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_TOUCH_EVENTS) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_USERSELECT_ALL) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_DATACUE_VALUE) $(ENABLE_VIEW_MODE_CSS_MEDIA) $(ENABLE_WEBGL) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_REPLAY) $(ENABLE_WEB_SOCKETS) $(ENABLE_PICTURE_SIZES) $(ENABLE_WEB_TIMING) $(ENABLE_WEBVTT_REGIONS) $(ENABLE_XHR_TIMEOUT) $(ENABLE_XSLT) $(ENABLE_FTL_JIT) $(ENABLE_LLINT_C_LOOP) $(FEATURE_DEFINES_$(PLATFORM_NAME));
index 726c190..6c6204c 100644 (file)
@@ -1277,6 +1277,7 @@ set(WebCore_SOURCES
     css/SelectorChecker.cpp
     css/SelectorCheckerFastPath.cpp
     css/SelectorFilter.cpp
+    css/SourceSizeList.cpp
     css/StyleInvalidationAnalysis.cpp
     css/StyleMedia.cpp
     css/StyleProperties.cpp
index 4b44a74..3fef8f3 100644 (file)
@@ -1,3 +1,73 @@
+2014-06-29  Yoav Weiss  <yoav@yoav.ws>
+
+        Add support for HTMLImageElement's sizes attribute
+        https://bugs.webkit.org/show_bug.cgi?id=133620
+
+        Reviewed by Dean Jackson.
+
+        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:
+
 2014-06-29  Andreas Kling  <akling@apple.com>
 
         No need to lazily initialize ResourceResponse internals when accessing timing data.
index 59dc18a..416b9b3 100644 (file)
@@ -228,6 +228,7 @@ ENABLE_WEB_REPLAY_macosx_Production = ;
 ENABLE_WEB_REPLAY_iphoneos = ;
 ENABLE_WEB_REPLAY_iphonesimulator = ;
 ENABLE_WEB_SOCKETS = ENABLE_WEB_SOCKETS;
+ENABLE_PICTURE_SIZES = ENABLE_PICTURE_SIZES;
 
 ENABLE_WEB_TIMING = $(ENABLE_WEB_TIMING_$(PLATFORM_NAME));
 ENABLE_WEB_TIMING_macosx = $(ENABLE_WEB_TIMING_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR));
@@ -248,4 +249,4 @@ ENABLE_FTL_JIT_iphonesimulator = ;
 
 ENABLE_LLINT_C_LOOP = ;
 
-FEATURE_DEFINES = $(ENABLE_3D_RENDERING) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ACCELERATED_OVERFLOW_SCROLLING) $(ENABLE_AVF_CAPTIONS) $(ENABLE_CACHE_PARTITIONING) $(ENABLE_CANVAS_PATH) $(ENABLE_CANVAS_PROXY) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CSP_NEXT) $(ENABLE_CSS_BOX_DECORATION_BREAK) $(ENABLE_CSS_COMPOSITING) $(ENABLE_CSS_DEVICE_ADAPTATION) $(ENABLE_CSS_EXCLUSIONS) $(ENABLE_CSS_FILTERS) $(ENABLE_CSS_GRID_LAYOUT) $(ENABLE_CSS_IMAGE_ORIENTATION) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_REGIONS) $(ENABLE_CSS_SHAPES) $(ENABLE_CSS_TRANSFORMS_ANIMATIONS_UNPREFIXED) $(ENABLE_CSS3_CONDITIONAL_RULES) $(ENABLE_CSS3_TEXT) $(ENABLE_CSS3_TEXT_LINE_BREAK) $(ENABLE_CURSOR_VISIBILITY) $(ENABLE_CUSTOM_SCHEME_HANDLER) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATALIST_ELEMENT) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DETAILS_ELEMENT) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DOM4_EVENTS_CONSTRUCTOR) $(ENABLE_ENCRYPTED_MEDIA) $(ENABLE_ENCRYPTED_MEDIA_V2) $(ENABLE_FILTERS) $(ENABLE_FONT_LOAD_EVENTS) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GAMEPAD_DEPRECATED) $(ENABLE_GEOLOCATION) $(ENABLE_HIDDEN_PAGE_DOM_TIMER_THROTTLING) $(ENABLE_HIGH_DPI_CANVAS) $(ENABLE_ICONDATABASE) $(ENABLE_SERVICE_CONTROLS) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INDEXED_DATABASE_IN_WORKERS) $(ENABLE_INDIE_UI) $(ENABLE_INPUT_SPEECH) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_TYPE_COLOR_POPOVER) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME_INCOMPLETE) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_INSPECTOR) $(ENABLE_IOS_AIRPLAY) $(ENABLE_IOS_TEXT_AUTOSIZING) $(ENABLE_LEGACY_CSS_VENDOR_PREFIXES) $(ENABLE_LEGACY_NOTIFICATIONS) $(ENABLE_LEGACY_VENDOR_PREFIXES) $(ENABLE_LEGACY_WEB_AUDIO) $(ENABLE_LETTERPRESS) $(ENABLE_LINK_LONG_PRESS) $(ENABLE_LINK_PREFETCH) $(ENABLE_MATHML) $(ENABLE_MEDIA_CONTROLS_SCRIPT) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_METER_ELEMENT) $(ENABLE_MHTML) $(ENABLE_MOUSE_CURSOR_SCALE) $(ENABLE_NAVIGATOR_CONTENT_UTILS) $(ENABLE_NAVIGATOR_HWCONCURRENCY) $(ENABLE_NOTIFICATIONS) $(ENABLE_PDFKIT_PLUGIN) $(ENABLE_POINTER_LOCK) $(ENABLE_PROMISES) $(ENABLE_PROXIMITY_EVENTS) $(ENABLE_PUBLIC_SUFFIX_LIST) $(ENABLE_QUOTA) $(ENABLE_REQUEST_ANIMATION_FRAME) $(ENABLE_REMOTE_INSPECTOR) $(ENABLE_RESOLUTION_MEDIA_QUERY) $(ENABLE_SCRIPTED_SPEECH) $(ENABLE_SHARED_WORKERS) $(ENABLE_SPEECH_SYNTHESIS) $(ENABLE_SQL_DATABASE) $(ENABLE_SUBPIXEL_LAYOUT) $(ENABLE_SUBTLE_CRYPTO) $(ENABLE_SVG_FONTS) $(ENABLE_TELEPHONE_NUMBER_DETECTION) $(ENABLE_TEMPLATE_ELEMENT) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_TOUCH_EVENTS) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_USERSELECT_ALL) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_DATACUE_VALUE) $(ENABLE_VIEW_MODE_CSS_MEDIA) $(ENABLE_WEBGL) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_REPLAY) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WEBVTT_REGIONS) $(ENABLE_XHR_TIMEOUT) $(ENABLE_XSLT) $(ENABLE_FTL_JIT) $(ENABLE_LLINT_C_LOOP) $(FEATURE_DEFINES_$(PLATFORM_NAME));
+FEATURE_DEFINES = $(ENABLE_3D_RENDERING) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ACCELERATED_OVERFLOW_SCROLLING) $(ENABLE_AVF_CAPTIONS) $(ENABLE_CACHE_PARTITIONING) $(ENABLE_CANVAS_PATH) $(ENABLE_CANVAS_PROXY) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CSP_NEXT) $(ENABLE_CSS_BOX_DECORATION_BREAK) $(ENABLE_CSS_COMPOSITING) $(ENABLE_CSS_DEVICE_ADAPTATION) $(ENABLE_CSS_EXCLUSIONS) $(ENABLE_CSS_FILTERS) $(ENABLE_CSS_GRID_LAYOUT) $(ENABLE_CSS_IMAGE_ORIENTATION) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_REGIONS) $(ENABLE_CSS_SHAPES) $(ENABLE_CSS_TRANSFORMS_ANIMATIONS_UNPREFIXED) $(ENABLE_CSS3_CONDITIONAL_RULES) $(ENABLE_CSS3_TEXT) $(ENABLE_CSS3_TEXT_LINE_BREAK) $(ENABLE_CURSOR_VISIBILITY) $(ENABLE_CUSTOM_SCHEME_HANDLER) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATALIST_ELEMENT) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DETAILS_ELEMENT) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DOM4_EVENTS_CONSTRUCTOR) $(ENABLE_ENCRYPTED_MEDIA) $(ENABLE_ENCRYPTED_MEDIA_V2) $(ENABLE_FILTERS) $(ENABLE_FONT_LOAD_EVENTS) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GAMEPAD_DEPRECATED) $(ENABLE_GEOLOCATION) $(ENABLE_HIDDEN_PAGE_DOM_TIMER_THROTTLING) $(ENABLE_HIGH_DPI_CANVAS) $(ENABLE_ICONDATABASE) $(ENABLE_SERVICE_CONTROLS) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INDEXED_DATABASE_IN_WORKERS) $(ENABLE_INDIE_UI) $(ENABLE_INPUT_SPEECH) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_TYPE_COLOR_POPOVER) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME_INCOMPLETE) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_INSPECTOR) $(ENABLE_IOS_AIRPLAY) $(ENABLE_IOS_TEXT_AUTOSIZING) $(ENABLE_LEGACY_CSS_VENDOR_PREFIXES) $(ENABLE_LEGACY_NOTIFICATIONS) $(ENABLE_LEGACY_VENDOR_PREFIXES) $(ENABLE_LEGACY_WEB_AUDIO) $(ENABLE_LETTERPRESS) $(ENABLE_LINK_LONG_PRESS) $(ENABLE_LINK_PREFETCH) $(ENABLE_MATHML) $(ENABLE_MEDIA_CONTROLS_SCRIPT) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_METER_ELEMENT) $(ENABLE_MHTML) $(ENABLE_MOUSE_CURSOR_SCALE) $(ENABLE_NAVIGATOR_CONTENT_UTILS) $(ENABLE_NAVIGATOR_HWCONCURRENCY) $(ENABLE_NOTIFICATIONS) $(ENABLE_PDFKIT_PLUGIN) $(ENABLE_POINTER_LOCK) $(ENABLE_PROMISES) $(ENABLE_PROXIMITY_EVENTS) $(ENABLE_PUBLIC_SUFFIX_LIST) $(ENABLE_QUOTA) $(ENABLE_REQUEST_ANIMATION_FRAME) $(ENABLE_REMOTE_INSPECTOR) $(ENABLE_RESOLUTION_MEDIA_QUERY) $(ENABLE_SCRIPTED_SPEECH) $(ENABLE_SHARED_WORKERS) $(ENABLE_SPEECH_SYNTHESIS) $(ENABLE_SQL_DATABASE) $(ENABLE_SUBPIXEL_LAYOUT) $(ENABLE_SUBTLE_CRYPTO) $(ENABLE_SVG_FONTS) $(ENABLE_TELEPHONE_NUMBER_DETECTION) $(ENABLE_TEMPLATE_ELEMENT) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_TOUCH_EVENTS) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_USERSELECT_ALL) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_DATACUE_VALUE) $(ENABLE_VIEW_MODE_CSS_MEDIA) $(ENABLE_WEBGL) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_REPLAY) $(ENABLE_WEB_SOCKETS) $(ENABLE_PICTURE_SIZES) $(ENABLE_WEB_TIMING) $(ENABLE_WEBVTT_REGIONS) $(ENABLE_XHR_TIMEOUT) $(ENABLE_XSLT) $(ENABLE_FTL_JIT) $(ENABLE_LLINT_C_LOOP) $(FEATURE_DEFINES_$(PLATFORM_NAME));
index 65e5a30..d474ac7 100644 (file)
     <ClCompile Include="..\css\PropertySetCSSStyleDeclaration.cpp" />
     <ClCompile Include="..\css\RGBColor.cpp" />
     <ClCompile Include="..\css\SelectorChecker.cpp" />
+    <ClCompile Include="..\css\SourceSizeList.cpp" />
     <ClCompile Include="..\css\StyleInvalidationAnalysis.cpp" />
     <ClCompile Include="..\css\StyleMedia.cpp" />
     <ClCompile Include="..\css\StyleProperties.cpp">
     <ClInclude Include="..\css\RGBColor.h" />
     <ClInclude Include="..\css\SelectorChecker.h" />
     <ClInclude Include="..\css\SelectorCheckerTestFunctions.h" />
+    <ClInclude Include="..\css\SourceSizeList.h" />
     <ClInclude Include="..\css\StyleInvalidationAnalysis.h" />
     <ClInclude Include="..\css\StyleMedia.h" />
     <ClInclude Include="..\css\StyleProperties.h" />
index d0e482a..2fcec88 100644 (file)
     <ClCompile Include="..\css\SelectorChecker.cpp">
       <Filter>css</Filter>
     </ClCompile>
+    <ClCompile Include="..\css\SourceSizeList.cpp">
+      <Filter>css</Filter>
+    </ClCompile>
     <ClCompile Include="..\css\StyleInvalidationAnalysis.cpp">
       <Filter>css</Filter>
     </ClCompile>
     <ClInclude Include="..\css\SelectorCheckerTestFunctions.h">
       <Filter>css</Filter>
     </ClInclude>
+    <ClInclude Include="..\css\SourceSizeList.h">
+      <Filter>css</Filter>
+    </ClInclude>
     <ClInclude Include="..\css\StyleInvalidationAnalysis.h">
       <Filter>css</Filter>
     </ClInclude>
index 80603fa..2ed0396 100644 (file)
                536D5A20193E18E900CE4CAB /* HTMLSrcsetParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 536D5A1F193E18E900CE4CAB /* HTMLSrcsetParser.h */; };
                536D5A21193E18EE00CE4CAB /* HTMLSrcsetParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 536D5A1E193E18D000CE4CAB /* HTMLSrcsetParser.cpp */; };
                536D5A23193E8E0C00CE4CAB /* ParsingUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 536D5A22193E8E0C00CE4CAB /* ParsingUtilities.h */; };
+               536D5A25193F40FC00CE4CAB /* SourceSizeList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 536D5A24193F40FC00CE4CAB /* SourceSizeList.cpp */; };
+               536D5A27193F410B00CE4CAB /* SourceSizeList.h in Headers */ = {isa = PBXBuildFile; fileRef = 536D5A26193F410B00CE4CAB /* SourceSizeList.h */; };
                53C8298D13D8D92700DE2DEB /* RenderFlexibleBox.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 53C8298B13D8D92700DE2DEB /* RenderFlexibleBox.cpp */; };
                53C8298E13D8D92700DE2DEB /* RenderFlexibleBox.h in Headers */ = {isa = PBXBuildFile; fileRef = 53C8298C13D8D92700DE2DEB /* RenderFlexibleBox.h */; settings = {ATTRIBUTES = (Private, ); }; };
                53E29E5E167A8A1900586D3D /* InternalSettingsGenerated.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 53E29E5C167A8A1900586D3D /* InternalSettingsGenerated.cpp */; };
                536D5A1E193E18D000CE4CAB /* HTMLSrcsetParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = HTMLSrcsetParser.cpp; path = parser/HTMLSrcsetParser.cpp; sourceTree = "<group>"; };
                536D5A1F193E18E900CE4CAB /* HTMLSrcsetParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HTMLSrcsetParser.h; path = parser/HTMLSrcsetParser.h; sourceTree = "<group>"; };
                536D5A22193E8E0C00CE4CAB /* ParsingUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ParsingUtilities.h; path = parser/ParsingUtilities.h; sourceTree = "<group>"; };
+               536D5A24193F40FC00CE4CAB /* SourceSizeList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SourceSizeList.cpp; sourceTree = "<group>"; };
+               536D5A26193F410B00CE4CAB /* SourceSizeList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SourceSizeList.h; sourceTree = "<group>"; };
                53C8298B13D8D92700DE2DEB /* RenderFlexibleBox.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderFlexibleBox.cpp; sourceTree = "<group>"; };
                53C8298C13D8D92700DE2DEB /* RenderFlexibleBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderFlexibleBox.h; sourceTree = "<group>"; };
                53E29E5C167A8A1900586D3D /* InternalSettingsGenerated.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InternalSettingsGenerated.cpp; sourceTree = "<group>"; };
                                26AA0F9A18D2973D00419381 /* SelectorPseudoElementTypeMap.in */,
                                43B85ED618CBEC9700E31AF4 /* SelectorPseudoClassAndCompatibilityElementMap.in */,
                                43107BE118CC19DE00CC18E8 /* SelectorPseudoTypeMap.h */,
+                               536D5A24193F40FC00CE4CAB /* SourceSizeList.cpp */,
+                               536D5A26193F410B00CE4CAB /* SourceSizeList.h */,
                                E47A97CE163059FC005DCD99 /* StyleInvalidationAnalysis.cpp */,
                                E47A97CF163059FC005DCD99 /* StyleInvalidationAnalysis.h */,
                                0FF5026E102BA9660066F39A /* StyleMedia.cpp */,
                                B2227AA30D00BF220071B782 /* SVGScriptElement.h in Headers */,
                                B2227AA60D00BF220071B782 /* SVGSetElement.h in Headers */,
                                E4AFD0100DAF335500F5F55C /* SVGSMILElement.h in Headers */,
+                               536D5A27193F410B00CE4CAB /* SourceSizeList.h in Headers */,
                                0880F70E1282B46D00948505 /* SVGStaticListPropertyTearOff.h in Headers */,
                                0813A4EA1284132600992511 /* SVGStaticPropertyTearOff.h in Headers */,
                                B2227AA90D00BF220071B782 /* SVGStopElement.h in Headers */,
                                BE20507918A458680080647E /* VTTCue.cpp in Sources */,
                                A14832B1187F61E100DA63A6 /* WAKAppKitStubs.m in Sources */,
                                A14832B3187F629100DA63A6 /* WAKClipView.m in Sources */,
+                               536D5A25193F40FC00CE4CAB /* SourceSizeList.cpp in Sources */,
                                A14832B5187F62FC00DA63A6 /* WAKResponder.m in Sources */,
                                A14832B7187F636C00DA63A6 /* WAKScrollView.mm in Sources */,
                                A14832B9187F63D500DA63A6 /* WAKView.mm in Sources */,
index dfb44a0..be9a990 100644 (file)
@@ -80,10 +80,18 @@ static inline CSSParserValue makeIdentValue(CSSParserString string)
 %}
 
 #if ENABLE_CSS_GRID_LAYOUT
+#if ENABLE_PICTURE_SIZES
+%expect 34
+#else
 %expect 30
+#endif
+#else
+#if ENABLE_PICTURE_SIZES
+%expect 33
 #else
 %expect 29
 #endif
+#endif
 
 %nonassoc LOWEST_PREC
 
@@ -123,6 +131,9 @@ static inline CSSParserValue makeIdentValue(CSSParserString string)
 %token WEBKIT_KEYFRAMES_SYM
 %token WEBKIT_VALUE_SYM
 %token WEBKIT_MEDIAQUERY_SYM
+#if ENABLE_PICTURE_SIZES
+%token WEBKIT_SIZESATTR_SYM
+#endif
 %token WEBKIT_SELECTOR_SYM
 %token WEBKIT_REGION_RULE_SYM
 %token WEBKIT_VIEWPORT_RULE_SYM
@@ -223,6 +234,22 @@ static inline CSSParserValue makeIdentValue(CSSParserString string)
 %type <mediaQueryExp> media_query_exp
 %destructor { delete $$; } media_query_exp
 
+#if ENABLE_PICTURE_SIZES
+%union { MediaQueryExp* mediaCondition; }
+%type <mediaQueryExp> media_condition
+%destructor { delete $$; } media_condition
+
+%union { SourceSize* sourceSize; }
+%type <sourceSize> source_size
+%destructor { delete $$; } source_size
+
+%union { SourceSizeList* sourceSizeList; }
+%type <sourceSizeList> source_size_list
+%destructor { delete $$; } source_size_list
+
+%type <value> source_size_length
+#endif
+
 %union { Vector<std::unique_ptr<MediaQueryExp>>* mediaQueryExpList; }
 %type <mediaQueryExpList> media_query_exp_list maybe_and_media_query_exp_list
 %destructor { delete $$; } media_query_exp_list maybe_and_media_query_exp_list
@@ -322,6 +349,9 @@ stylesheet:
   | webkit_decls maybe_space
   | webkit_value maybe_space
   | webkit_mediaquery maybe_space
+#if ENABLE_PICTURE_SIZES
+  | webkit_source_size_list maybe_space
+#endif
   | webkit_selector maybe_space
   | webkit_keyframe_rule maybe_space
 #if ENABLE_CSS3_CONDITIONAL_RULES
@@ -518,6 +548,45 @@ string_or_uri: STRING | URI ;
 
 maybe_media_value: /*empty*/ { $$ = nullptr; } | ':' maybe_space expr maybe_space { $$ = $3; } ;
 
+#if ENABLE_PICTURE_SIZES
+media_condition:
+    maybe_space '(' maybe_space IDENT maybe_space maybe_media_value ')' maybe_space {
+        std::unique_ptr<CSSParserValueList> mediaValue($6);
+        $4.lower();
+        $$ = new MediaQueryExp($4, mediaValue.get());
+    }
+    ;
+
+webkit_source_size_list:
+    WEBKIT_SIZESATTR_SYM WHITESPACE source_size_list '}' { parser->m_sourceSizeList = std::move(std::unique_ptr<SourceSizeList>($3)); };
+
+source_size_list:
+    maybe_space source_size maybe_space {
+        $$ = new SourceSizeList();
+        $$->append(std::unique_ptr<SourceSize>($2));
+    }
+    | maybe_space source_size maybe_space ',' maybe_space source_size_list maybe_space {
+        $$ = $6;
+        $$->append(std::unique_ptr<SourceSize>($2));
+    };
+
+source_size_length:
+    unary_term {
+        $$ = $1;
+    }
+    | calc_function {
+        $$ = $1;
+    };
+
+source_size:
+    media_condition source_size_length {
+        $$ = new SourceSize(std::unique_ptr<MediaQueryExp>($1), $2);
+    }
+    | source_size_length {
+        $$ = new SourceSize(std::make_unique<MediaQueryExp>(emptyString(), nullptr), $1);
+    };
+#endif
+
 media_query_exp:
     maybe_media_restrictor maybe_space '(' maybe_space IDENT maybe_space maybe_media_value ')' maybe_space {
         // If restrictor is specified, media query expression is invalid.
index 3b5a385..7bc1972 100644 (file)
@@ -1455,6 +1455,21 @@ std::unique_ptr<MediaQuery> CSSParser::parseMediaQuery(const String& string)
     return std::move(m_mediaQuery);
 }
 
+#if ENABLE(PICTURE_SIZES)
+std::unique_ptr<SourceSizeList> CSSParser::parseSizesAttribute(const String& string)
+{
+    if (string.isEmpty())
+        return nullptr;
+
+    ASSERT(!m_sourceSizeList.get());
+
+    setupParser("@-webkit-sizesattr ", string, "}");
+    cssyyparse(this);
+
+    return std::move(m_sourceSizeList);
+}
+#endif
+
 static inline void filterProperties(bool important, const CSSParser::ParsedPropertyVector& input, Vector<CSSProperty, 256>& output, size_t& unusedEntries, std::bitset<numCSSProperties>& seenProperties)
 {
     // Add properties in reverse order so that highest priority definitions are reached first. Duplicate definitions can then be ignored when found.
@@ -10802,6 +10817,10 @@ inline void CSSParser::detectAtToken(int length, bool hasEscape)
         case 18:
             if (isEqualToCSSIdentifier(name + 2, "webkit-keyframes"))
                 m_token = WEBKIT_KEYFRAMES_SYM;
+#if ENABLE(PICTURE_SIZES)
+            else if (isEqualToCSSIdentifier(name + 2, "webkit-sizesattr"))
+                m_token = WEBKIT_SIZESATTR_SYM;
+#endif
             return;
 
         case 19:
index 4f3459b..08bdd44 100644 (file)
@@ -33,6 +33,7 @@
 #include "CSSValueKeywords.h"
 #include "Color.h"
 #include "MediaQuery.h"
+#include "SourceSizeList.h"
 #include <memory>
 #include <wtf/HashMap.h>
 #include <wtf/HashSet.h>
@@ -100,6 +101,9 @@ public:
     bool parseDeclaration(MutableStyleProperties*, const String&, PassRefPtr<CSSRuleSourceData>, StyleSheetContents* contextStyleSheet);
     static PassRef<ImmutableStyleProperties> parseInlineStyleDeclaration(const String&, Element*);
     std::unique_ptr<MediaQuery> parseMediaQuery(const String&);
+#if ENABLE(PICTURE_SIZES)
+    std::unique_ptr<SourceSizeList> parseSizesAttribute(const String&);
+#endif
 
     void addPropertyWithPrefixingVariant(CSSPropertyID, PassRefPtr<CSSValue>, bool important, bool implicit = false);
     void addProperty(CSSPropertyID, PassRefPtr<CSSValue>, bool important, bool implicit = false);
@@ -347,6 +351,9 @@ public:
     RefPtr<StyleRuleBase> m_rule;
     RefPtr<StyleKeyframe> m_keyframe;
     std::unique_ptr<MediaQuery> m_mediaQuery;
+#if ENABLE(PICTURE_SIZES)
+    std::unique_ptr<SourceSizeList> m_sourceSizeList;
+#endif
     std::unique_ptr<CSSParserValueList> m_valueList;
 #if ENABLE(CSS3_CONDITIONAL_RULES)
     bool m_supportsCondition;
@@ -409,6 +416,7 @@ public:
     static URL completeURL(const CSSParserContext&, const String& url);
 
     Location currentLocation();
+    static bool isCalculation(CSSParserValue*);
 
 private:
     bool is8BitSource() { return m_is8BitSource; }
@@ -621,7 +629,6 @@ private:
     bool parseBorderImageQuad(Units, RefPtr<CSSPrimitiveValue>&);
     int colorIntFromValue(CSSParserValue*);
     double parsedDouble(CSSParserValue*, ReleaseParsedCalcValueCondition releaseCalc = DoNotReleaseParsedCalcValue);
-    bool isCalculation(CSSParserValue*);
     
     friend class TransformOperationInfo;
 #if ENABLE(CSS_FILTERS)
diff --git a/Source/WebCore/css/SourceSizeList.cpp b/Source/WebCore/css/SourceSizeList.cpp
new file mode 100644 (file)
index 0000000..7fac9ac
--- /dev/null
@@ -0,0 +1,108 @@
+/*
+ * Copyright (C) 2014 Yoav Weiss <yoav@yoav.ws>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+#include "SourceSizeList.h"
+
+#include "CSSParser.h"
+#include "CSSToLengthConversionData.h"
+#include "Document.h"
+#include "MediaList.h"
+#include "MediaQuery.h"
+#include "MediaQueryEvaluator.h"
+#include "RenderObject.h"
+#include "RenderStyle.h"
+#include "RenderView.h"
+
+namespace WebCore {
+
+#if ENABLE(PICTURE_SIZES)
+bool SourceSize::match(RenderStyle& style, Frame* frame)
+{
+    if (m_mediaExp->mediaFeature().isEmpty())
+        return true;
+    auto expList = std::make_unique<Vector<std::unique_ptr<MediaQueryExp>>>();
+    expList->append(m_mediaExp.release());
+
+    RefPtr<MediaQuerySet> mediaQuerySet = MediaQuerySet::create();
+    mediaQuerySet->addMediaQuery(std::make_unique<MediaQuery>(MediaQuery::None, "all", std::move(expList)));
+
+    MediaQueryEvaluator mediaQueryEvaluator("screen", frame, &style);
+    return mediaQueryEvaluator.eval(mediaQuerySet.get());
+}
+
+static unsigned computeLength(CSSParserValue& value, RenderStyle& style, RenderView* view)
+{
+    CSSToLengthConversionData conversionData(&style, &style, view);
+    if (CSSParser::isCalculation(&value)) {
+        CSSParserValueList* args = value.function->args.get();
+        if (args && args->size()) {
+            RefPtr<CSSCalcValue> calcValue = CSSCalcValue::create(value.function->name, *args, CalculationRangeNonNegative);
+            Length length(calcValue->createCalculationValue(conversionData));
+            RefPtr<CSSPrimitiveValue> primitiveValue = CSSPrimitiveValue::create(length, &style);
+            return primitiveValue->computeLength<unsigned>(conversionData);
+        }
+    }
+    RefPtr<CSSValue> cssValue = value.createCSSValue();
+    RefPtr<CSSPrimitiveValue> primitiveValue = toCSSPrimitiveValue(cssValue.get());
+    return primitiveValue->computeLength<unsigned>(conversionData);
+}
+
+static unsigned defaultValue(RenderStyle& style, RenderView* view)
+{
+    const unsigned defaultSizesAttributeValueInVW = 100;
+
+    CSSParserValue value;
+    value.id = CSSValueInvalid;
+    value.isInt = true;
+    value.fValue = defaultSizesAttributeValueInVW;
+    value.unit = CSSPrimitiveValue::CSS_VW;
+
+    return computeLength(value, style, view);
+}
+
+unsigned SourceSize::length(RenderStyle& style, RenderView* view)
+{
+    return computeLength(m_length, style, view);
+}
+
+unsigned SourceSizeList::parseSizesAttribute(const String& sizesAttribute, RenderView* view, Frame* frame)
+{
+    if (!view)
+        return 0;
+    CSSParser parser(CSSStrictMode);
+    std::unique_ptr<SourceSizeList> sourceSizeList = parser.parseSizesAttribute(sizesAttribute);
+    if (!sourceSizeList)
+        return defaultValue(view->style(), view);
+    return sourceSizeList->getEffectiveSize(view->style(), view, frame);
+}
+
+unsigned SourceSizeList::getEffectiveSize(RenderStyle& style, RenderView* view, Frame* frame)
+{
+    for (int i = m_list.size() - 1; i >= 0; --i) {
+        SourceSize* sourceSize = m_list[i].get();
+        if (sourceSize->match(style, frame))
+            return sourceSize->length(style, view);
+    }
+    return defaultValue(style, view);
+}
+
+#endif
+
+} // namespace WebCore
diff --git a/Source/WebCore/css/SourceSizeList.h b/Source/WebCore/css/SourceSizeList.h
new file mode 100644 (file)
index 0000000..1d6a5c0
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2014 Yoav Weiss <yoav@yoav.ws>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef SourceSizeList_h
+#define SourceSizeList_h
+
+#if ENABLE(PICTURE_SIZES)
+
+#include "CSSParserValues.h"
+#include "MediaQueryExp.h"
+#include <memory>
+
+namespace WebCore {
+
+class RenderStyle;
+class RenderView;
+class Frame;
+
+class SourceSize {
+public:
+    SourceSize(std::unique_ptr<MediaQueryExp> mediaExp, const CSSParserValue& length)
+        : m_mediaExp(std::move(mediaExp))
+        , m_length(length)
+    {
+    }
+
+    bool match(RenderStyle&, Frame*);
+    unsigned length(RenderStyle&, RenderView*);
+
+private:
+    std::unique_ptr<MediaQueryExp> m_mediaExp;
+    CSSParserValue m_length;
+};
+
+class SourceSizeList {
+public:
+    void append(std::unique_ptr<SourceSize> sourceSize)
+    {
+        m_list.append(std::move(sourceSize));
+    }
+
+    static unsigned parseSizesAttribute(const String& sizesAttribute, RenderView*, Frame*);
+    unsigned getEffectiveSize(RenderStyle&, RenderView*, Frame*);
+
+private:
+    Vector<std::unique_ptr<SourceSize>> m_list;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(PICTURE_SIZES)
+
+#endif // SourceSizeList_h
+
index 9a32f53..f54b717 100644 (file)
@@ -38,6 +38,7 @@
 #include "RenderImage.h"
 #include "Settings.h"
 #include "ShadowRoot.h"
+#include "SourceSizeList.h"
 
 #if ENABLE(SERVICE_CONTROLS)
 #include "ImageControlsRootElement.h"
@@ -126,6 +127,9 @@ const AtomicString& HTMLImageElement::imageSourceURL() const
 void HTMLImageElement::setBestFitURLAndDPRFromImageCandidate(const ImageCandidate& candidate)
 {
     m_bestFitImageURL = candidate.string.toString();
+#if ENABLE(PICTURE_SIZES)
+    m_currentSrc = AtomicString(document().completeURL(imageSourceURL()).string());
+#endif
     if (candidate.density >= 0)
         m_imageDevicePixelRatio = 1 / candidate.density;
     if (renderer() && renderer()->isImage())
@@ -138,7 +142,11 @@ void HTMLImageElement::parseAttribute(const QualifiedName& name, const AtomicStr
         if (renderer() && renderer()->isRenderImage())
             toRenderImage(renderer())->updateAltText();
     } else if (name == srcAttr || name == srcsetAttr) {
-        ImageCandidate candidate = bestFitSourceForImageAttributes(document().deviceScaleFactor(), fastGetAttribute(srcAttr), fastGetAttribute(srcsetAttr));
+        ImageCandidate candidate = bestFitSourceForImageAttributes(document().deviceScaleFactor(), fastGetAttribute(srcAttr), fastGetAttribute(srcsetAttr)
+#if ENABLE(PICTURE_SIZES)
+            , SourceSizeList::parseSizesAttribute(fastGetAttribute(sizesAttr), document().renderView(), document().frame())
+#endif
+        );
         setBestFitURLAndDPRFromImageCandidate(candidate);
         m_imageLoader.updateFromElementIgnoringPreviousError();
     } else if (name == usemapAttr) {
index de8278e..844c470 100644 (file)
@@ -48,6 +48,9 @@ public:
 
     int naturalWidth() const;
     int naturalHeight() const;
+#if ENABLE_PICTURE_SIZES
+    const AtomicString& currentSrc() const { return m_currentSrc; }
+#endif
 
     bool isServerMap() const;
 
@@ -122,6 +125,9 @@ private:
     HTMLFormElement* m_form;
     CompositeOperator m_compositeOperator;
     AtomicString m_bestFitImageURL;
+#if ENABLE_PICTURE_SIZES
+    AtomicString m_currentSrc;
+#endif
     AtomicString m_lowercasedUsemap;
     float m_imageDevicePixelRatio;
     bool m_experimentalImageMenuEnabled;
index 8c551f8..4609146 100644 (file)
     [Reflect, URL] attribute DOMString longDesc;
     [Reflect, URL] attribute DOMString src;
     [Reflect] attribute DOMString srcset;
+#if ENABLE_PICTURE_SIZES
+    [Reflect] attribute DOMString sizes;
+    readonly attribute DOMString currentSrc;
+#endif
     [Reflect] attribute DOMString useMap;
     [Reflect] attribute long vspace;
     attribute long width;
-    
+
     // Extensions
     readonly attribute boolean complete;
     [Reflect,URL] attribute DOMString lowsrc;
index 4888620..7483f13 100644 (file)
@@ -326,7 +326,11 @@ void HTMLDocumentParser::pumpTokenizer(SynchronousMode mode)
             m_preloadScanner = std::make_unique<HTMLPreloadScanner>(m_options, document()->url(), document()->deviceScaleFactor());
             m_preloadScanner->appendToEnd(m_input.current());
         }
-        m_preloadScanner->scan(m_preloader.get(), document()->baseElementURL());
+        m_preloadScanner->scan(m_preloader.get(), document()->baseElementURL()
+#if ENABLE(PICTURE_SIZES)
+            , document()->renderView(), document()->frame()
+#endif
+        );
     }
 
     InspectorInstrumentation::didWriteHTML(cookie, m_input.current().currentLine().zeroBasedInt());
@@ -388,7 +392,11 @@ void HTMLDocumentParser::insert(const SegmentedString& source)
             m_insertionPreloadScanner = std::make_unique<HTMLPreloadScanner>(m_options, document()->url(), document()->deviceScaleFactor());
         }
         m_insertionPreloadScanner->appendToEnd(source);
-        m_insertionPreloadScanner->scan(m_preloader.get(), document()->baseElementURL());
+        m_insertionPreloadScanner->scan(m_preloader.get(), document()->baseElementURL()
+#if ENABLE(PICTURE_SIZES)
+            , document()->renderView(), document()->frame()
+#endif
+        );
     }
 
     endIfDelayed();
@@ -412,7 +420,11 @@ void HTMLDocumentParser::append(PassRefPtr<StringImpl> inputSource)
         } else {
             m_preloadScanner->appendToEnd(source);
             if (isWaitingForScripts())
-                m_preloadScanner->scan(m_preloader.get(), document()->baseElementURL());
+                m_preloadScanner->scan(m_preloader.get(), document()->baseElementURL()
+#if ENABLE(PICTURE_SIZES)
+                    , document()->renderView(), document()->frame()
+#endif
+                );
         }
     }
 
@@ -545,12 +557,16 @@ void HTMLDocumentParser::stopWatchingForLoad(CachedResource* cachedScript)
 {
     cachedScript->removeClient(this);
 }
-    
+
 void HTMLDocumentParser::appendCurrentInputStreamToPreloadScannerAndScan()
 {
     ASSERT(m_preloadScanner);
     m_preloadScanner->appendToEnd(m_input.current());
-    m_preloadScanner->scan(m_preloader.get(), document()->baseElementURL());
+    m_preloadScanner->scan(m_preloader.get(), document()->baseElementURL()
+#if ENABLE(PICTURE_SIZES)
+        , document()->renderView(), document()->frame()
+#endif
+    );
 }
 
 void HTMLDocumentParser::notifyFinished(CachedResource* cachedResource)
index 70bdd55..01b338f 100644 (file)
@@ -34,6 +34,7 @@
 #include "HTMLTokenizer.h"
 #include "InputTypeNames.h"
 #include "LinkRelAttribute.h"
+#include "SourceSizeList.h"
 #include <wtf/MainThread.h>
 
 namespace WebCore {
@@ -92,7 +93,11 @@ public:
     {
     }
 
-    void processAttributes(const HTMLToken::AttributeList& attributes)
+    void processAttributes(const HTMLToken::AttributeList& attributes
+#if ENABLE(PICTURE_SIZES)
+        , RenderView* view, Frame* frame
+#endif
+        )
     {
         ASSERT(isMainThread());
         if (m_tagId >= TagId::Unknown)
@@ -105,7 +110,11 @@ public:
 
         // Resolve between src and srcSet if we have them.
         if (!m_srcSetAttribute.isEmpty()) {
-            ImageCandidate imageCandidate = bestFitSourceForImageAttributes(m_deviceScaleFactor, m_urlToLoad, m_srcSetAttribute);
+            ImageCandidate imageCandidate = bestFitSourceForImageAttributes(m_deviceScaleFactor, m_urlToLoad, m_srcSetAttribute
+#if ENABLE(PICTURE_SIZES)
+                , SourceSizeList::parseSizesAttribute(m_sizesAttribute, view, frame)
+#endif
+                );
             setUrlToLoad(imageCandidate.string.toString(), true);
         }
     }
@@ -138,8 +147,12 @@ private:
         if (m_tagId == TagId::Script || m_tagId == TagId::Img) {
             if (match(attributeName, srcAttr))
                 setUrlToLoad(attributeValue);
-            else if (match(attributeName, srcsetAttr))
+            else if (match(attributeName, srcsetAttr) && m_srcSetAttribute.isNull())
                 m_srcSetAttribute = attributeValue;
+#if ENABLE(PICTURE_SIZES)
+            else if (match(attributeName, sizesAttr) && m_sizesAttribute.isNull())
+                m_sizesAttribute = attributeValue;
+#endif
             else if (match(attributeName, crossoriginAttr) && !attributeValue.isNull())
                 m_crossOriginMode = stripLeadingAndTrailingHTMLSpaces(attributeValue);
         } else if (m_tagId == TagId::Link) {
@@ -217,6 +230,9 @@ private:
     TagId m_tagId;
     String m_urlToLoad;
     String m_srcSetAttribute;
+#if ENABLE(PICTURE_SIZES)
+    String m_sizesAttribute;
+#endif
     String m_charset;
     String m_crossOriginMode;
     bool m_linkIsStyleSheet;
@@ -263,7 +279,11 @@ void TokenPreloadScanner::rewindTo(TokenPreloadScannerCheckpoint checkpointIndex
     m_checkpoints.clear();
 }
 
-void TokenPreloadScanner::scan(const HTMLToken& token, Vector<std::unique_ptr<PreloadRequest>>& requests)
+void TokenPreloadScanner::scan(const HTMLToken& token, Vector<std::unique_ptr<PreloadRequest>>& requests
+#if ENABLE(PICTURE_SIZES)
+        , RenderView* view, Frame* frame
+#endif
+        )
 {
     switch (token.type()) {
     case HTMLToken::Character:
@@ -314,7 +334,11 @@ void TokenPreloadScanner::scan(const HTMLToken& token, Vector<std::unique_ptr<Pr
         }
 
         StartTagScanner scanner(tagId, m_deviceScaleFactor);
-        scanner.processAttributes(token.attributes());
+        scanner.processAttributes(token.attributes()
+#if ENABLE(PICTURE_SIZES)
+            , view, frame
+#endif
+            );
         if (auto request = scanner.createPreloadRequest(m_predictedBaseElementURL))
             requests.append(std::move(request));
         return;
@@ -348,7 +372,11 @@ void HTMLPreloadScanner::appendToEnd(const SegmentedString& source)
     m_source.append(source);
 }
 
-void HTMLPreloadScanner::scan(HTMLResourcePreloader* preloader, const URL& startingBaseElementURL)
+void HTMLPreloadScanner::scan(HTMLResourcePreloader* preloader, const URL& startingBaseElementURL
+#if ENABLE(PICTURE_SIZES)
+        , RenderView* view, Frame* frame
+#endif
+        )
 {
     ASSERT(isMainThread()); // HTMLTokenizer::updateStateFor only works on the main thread.
 
@@ -361,7 +389,11 @@ void HTMLPreloadScanner::scan(HTMLResourcePreloader* preloader, const URL& start
     while (m_tokenizer->nextToken(m_source, m_token)) {
         if (m_token.type() == HTMLToken::StartTag)
             m_tokenizer->updateStateFor(AtomicString(m_token.name()));
-        m_scanner.scan(m_token, requests);
+        m_scanner.scan(m_token, requests
+#if ENABLE(PICTURE_SIZES)
+            , view, frame
+#endif
+            );
         m_token.clear();
     }
 
index 963c6b9..b67a51a 100644 (file)
@@ -39,6 +39,7 @@ typedef size_t TokenPreloadScannerCheckpoint;
 class HTMLParserOptions;
 class HTMLTokenizer;
 class SegmentedString;
+class Frame;
 
 class TokenPreloadScanner {
     WTF_MAKE_NONCOPYABLE(TokenPreloadScanner); WTF_MAKE_FAST_ALLOCATED;
@@ -46,7 +47,11 @@ public:
     explicit TokenPreloadScanner(const URL& documentURL, float deviceScaleFactor = 1.0);
     ~TokenPreloadScanner();
 
-    void scan(const HTMLToken&, PreloadRequestStream& requests);
+    void scan(const HTMLToken&, PreloadRequestStream& requests
+#if ENABLE_PICTURE_SIZES
+        , RenderView*, Frame*
+#endif
+        );
 
     void setPredictedBaseElementURL(const URL& url) { m_predictedBaseElementURL = url; }
 
@@ -126,7 +131,11 @@ public:
     ~HTMLPreloadScanner();
 
     void appendToEnd(const SegmentedString&);
-    void scan(HTMLResourcePreloader*, const URL& documentBaseElementURL);
+    void scan(HTMLResourcePreloader*, const URL& documentBaseElementURL
+#if ENABLE_PICTURE_SIZES
+        , RenderView*, Frame*
+#endif
+        );
 
 private:
     TokenPreloadScanner m_scanner;
index f7ce80e..12929ae 100644 (file)
@@ -145,6 +145,7 @@ static bool parseDescriptors(Vector<StringView>& descriptors, DescriptorParsingR
             int resourceWidth = descriptor.toInt(isValid);
             if (!isValid || resourceWidth <= 0)
                 return false;
+            result.setResourceWidth(resourceWidth);
         } else if (descriptorChar == 'h') {
             // This is here only for future compat purposes.
             // The value of the 'h' descriptor is not used.
@@ -217,13 +218,24 @@ static void parseImageCandidatesFromSrcsetAttribute(StringView attribute, Vector
         parseImageCandidatesFromSrcsetAttribute<UChar>(attribute.characters16(), attribute.length(), imageCandidates);
 }
 
-static ImageCandidate pickBestImageCandidate(float deviceScaleFactor, Vector<ImageCandidate>& imageCandidates)
+static ImageCandidate pickBestImageCandidate(float deviceScaleFactor, Vector<ImageCandidate>& imageCandidates
+#if ENABLE(PICTURE_SIZES)
+    , unsigned sourceSize
+#endif
+    )
 {
+    bool ignoreSrc = false;
     if (imageCandidates.isEmpty())
         return ImageCandidate();
 
     // http://picture.responsiveimages.org/#normalize-source-densities
     for (auto& candidate : imageCandidates) {
+#if ENABLE(PICTURE_SIZES)
+        if (candidate.resourceWidth > 0) {
+            candidate.density = static_cast<float>(candidate.resourceWidth) / static_cast<float>(sourceSize);
+            ignoreSrc = true;
+        } else
+#endif
         if (candidate.density < 0)
             candidate.density = DefaultDensityValue;
     }
@@ -232,10 +244,14 @@ static ImageCandidate pickBestImageCandidate(float deviceScaleFactor, Vector<Ima
 
     unsigned i;
     for (i = 0; i < imageCandidates.size() - 1; ++i) {
-        if ((imageCandidates[i].density >= deviceScaleFactor))
+        if ((imageCandidates[i].density >= deviceScaleFactor) && (!ignoreSrc || !imageCandidates[i].srcOrigin()))
             break;
     }
 
+    if (imageCandidates[i].srcOrigin() && ignoreSrc) {
+        ASSERT(i > 0);
+        --i;
+    }
     float winningDensity = imageCandidates[i].density;
 
     unsigned winner = i;
@@ -247,7 +263,11 @@ static ImageCandidate pickBestImageCandidate(float deviceScaleFactor, Vector<Ima
     return imageCandidates[winner];
 }
 
-ImageCandidate bestFitSourceForImageAttributes(float deviceScaleFactor, const AtomicString& srcAttribute, const AtomicString& srcsetAttribute)
+ImageCandidate bestFitSourceForImageAttributes(float deviceScaleFactor, const AtomicString& srcAttribute, const AtomicString& srcsetAttribute
+#if ENABLE(PICTURE_SIZES)
+    , unsigned sourceSize
+#endif
+    )
 {
     if (srcsetAttribute.isNull()) {
         if (srcAttribute.isNull())
@@ -262,7 +282,11 @@ ImageCandidate bestFitSourceForImageAttributes(float deviceScaleFactor, const At
     if (!srcAttribute.isEmpty())
         imageCandidates.append(ImageCandidate(StringView(srcAttribute), DescriptorParsingResult(), ImageCandidate::SrcOrigin));
 
-    return pickBestImageCandidate(deviceScaleFactor, imageCandidates);
+    return pickBestImageCandidate(deviceScaleFactor, imageCandidates
+#if ENABLE(PICTURE_SIZES)
+        , sourceSize
+#endif
+        );
 }
 
 } // namespace WebCore
index 6247294..bc1224f 100644 (file)
@@ -98,7 +98,11 @@ struct ImageCandidate {
     OriginAttribute originAttribute;
 };
 
-ImageCandidate bestFitSourceForImageAttributes(float deviceScaleFactor, const AtomicString& srcAttribute, const AtomicString& srcsetAttribute);
+ImageCandidate bestFitSourceForImageAttributes(float deviceScaleFactor, const AtomicString& srcAttribute, const AtomicString& srcsetAttribute
+#if ENABLE(PICTURE_SIZES)
+    , unsigned sourceSize
+#endif
+    );
 
 }
 
index 627d89f..914c5ef 100644 (file)
@@ -1,3 +1,14 @@
+2014-06-29  Yoav Weiss  <yoav@yoav.ws>
+
+        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.
+
+        * Configurations/FeatureDefines.xcconfig:
+
 2014-06-27  Sam Weinig  <sam@webkit.org>
 
         InfoClick (from Nisus Software) dies on viewing found items
index 59dc18a..416b9b3 100644 (file)
@@ -228,6 +228,7 @@ ENABLE_WEB_REPLAY_macosx_Production = ;
 ENABLE_WEB_REPLAY_iphoneos = ;
 ENABLE_WEB_REPLAY_iphonesimulator = ;
 ENABLE_WEB_SOCKETS = ENABLE_WEB_SOCKETS;
+ENABLE_PICTURE_SIZES = ENABLE_PICTURE_SIZES;
 
 ENABLE_WEB_TIMING = $(ENABLE_WEB_TIMING_$(PLATFORM_NAME));
 ENABLE_WEB_TIMING_macosx = $(ENABLE_WEB_TIMING_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR));
@@ -248,4 +249,4 @@ ENABLE_FTL_JIT_iphonesimulator = ;
 
 ENABLE_LLINT_C_LOOP = ;
 
-FEATURE_DEFINES = $(ENABLE_3D_RENDERING) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ACCELERATED_OVERFLOW_SCROLLING) $(ENABLE_AVF_CAPTIONS) $(ENABLE_CACHE_PARTITIONING) $(ENABLE_CANVAS_PATH) $(ENABLE_CANVAS_PROXY) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CSP_NEXT) $(ENABLE_CSS_BOX_DECORATION_BREAK) $(ENABLE_CSS_COMPOSITING) $(ENABLE_CSS_DEVICE_ADAPTATION) $(ENABLE_CSS_EXCLUSIONS) $(ENABLE_CSS_FILTERS) $(ENABLE_CSS_GRID_LAYOUT) $(ENABLE_CSS_IMAGE_ORIENTATION) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_REGIONS) $(ENABLE_CSS_SHAPES) $(ENABLE_CSS_TRANSFORMS_ANIMATIONS_UNPREFIXED) $(ENABLE_CSS3_CONDITIONAL_RULES) $(ENABLE_CSS3_TEXT) $(ENABLE_CSS3_TEXT_LINE_BREAK) $(ENABLE_CURSOR_VISIBILITY) $(ENABLE_CUSTOM_SCHEME_HANDLER) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATALIST_ELEMENT) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DETAILS_ELEMENT) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DOM4_EVENTS_CONSTRUCTOR) $(ENABLE_ENCRYPTED_MEDIA) $(ENABLE_ENCRYPTED_MEDIA_V2) $(ENABLE_FILTERS) $(ENABLE_FONT_LOAD_EVENTS) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GAMEPAD_DEPRECATED) $(ENABLE_GEOLOCATION) $(ENABLE_HIDDEN_PAGE_DOM_TIMER_THROTTLING) $(ENABLE_HIGH_DPI_CANVAS) $(ENABLE_ICONDATABASE) $(ENABLE_SERVICE_CONTROLS) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INDEXED_DATABASE_IN_WORKERS) $(ENABLE_INDIE_UI) $(ENABLE_INPUT_SPEECH) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_TYPE_COLOR_POPOVER) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME_INCOMPLETE) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_INSPECTOR) $(ENABLE_IOS_AIRPLAY) $(ENABLE_IOS_TEXT_AUTOSIZING) $(ENABLE_LEGACY_CSS_VENDOR_PREFIXES) $(ENABLE_LEGACY_NOTIFICATIONS) $(ENABLE_LEGACY_VENDOR_PREFIXES) $(ENABLE_LEGACY_WEB_AUDIO) $(ENABLE_LETTERPRESS) $(ENABLE_LINK_LONG_PRESS) $(ENABLE_LINK_PREFETCH) $(ENABLE_MATHML) $(ENABLE_MEDIA_CONTROLS_SCRIPT) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_METER_ELEMENT) $(ENABLE_MHTML) $(ENABLE_MOUSE_CURSOR_SCALE) $(ENABLE_NAVIGATOR_CONTENT_UTILS) $(ENABLE_NAVIGATOR_HWCONCURRENCY) $(ENABLE_NOTIFICATIONS) $(ENABLE_PDFKIT_PLUGIN) $(ENABLE_POINTER_LOCK) $(ENABLE_PROMISES) $(ENABLE_PROXIMITY_EVENTS) $(ENABLE_PUBLIC_SUFFIX_LIST) $(ENABLE_QUOTA) $(ENABLE_REQUEST_ANIMATION_FRAME) $(ENABLE_REMOTE_INSPECTOR) $(ENABLE_RESOLUTION_MEDIA_QUERY) $(ENABLE_SCRIPTED_SPEECH) $(ENABLE_SHARED_WORKERS) $(ENABLE_SPEECH_SYNTHESIS) $(ENABLE_SQL_DATABASE) $(ENABLE_SUBPIXEL_LAYOUT) $(ENABLE_SUBTLE_CRYPTO) $(ENABLE_SVG_FONTS) $(ENABLE_TELEPHONE_NUMBER_DETECTION) $(ENABLE_TEMPLATE_ELEMENT) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_TOUCH_EVENTS) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_USERSELECT_ALL) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_DATACUE_VALUE) $(ENABLE_VIEW_MODE_CSS_MEDIA) $(ENABLE_WEBGL) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_REPLAY) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WEBVTT_REGIONS) $(ENABLE_XHR_TIMEOUT) $(ENABLE_XSLT) $(ENABLE_FTL_JIT) $(ENABLE_LLINT_C_LOOP) $(FEATURE_DEFINES_$(PLATFORM_NAME));
+FEATURE_DEFINES = $(ENABLE_3D_RENDERING) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ACCELERATED_OVERFLOW_SCROLLING) $(ENABLE_AVF_CAPTIONS) $(ENABLE_CACHE_PARTITIONING) $(ENABLE_CANVAS_PATH) $(ENABLE_CANVAS_PROXY) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CSP_NEXT) $(ENABLE_CSS_BOX_DECORATION_BREAK) $(ENABLE_CSS_COMPOSITING) $(ENABLE_CSS_DEVICE_ADAPTATION) $(ENABLE_CSS_EXCLUSIONS) $(ENABLE_CSS_FILTERS) $(ENABLE_CSS_GRID_LAYOUT) $(ENABLE_CSS_IMAGE_ORIENTATION) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_REGIONS) $(ENABLE_CSS_SHAPES) $(ENABLE_CSS_TRANSFORMS_ANIMATIONS_UNPREFIXED) $(ENABLE_CSS3_CONDITIONAL_RULES) $(ENABLE_CSS3_TEXT) $(ENABLE_CSS3_TEXT_LINE_BREAK) $(ENABLE_CURSOR_VISIBILITY) $(ENABLE_CUSTOM_SCHEME_HANDLER) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATALIST_ELEMENT) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DETAILS_ELEMENT) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DOM4_EVENTS_CONSTRUCTOR) $(ENABLE_ENCRYPTED_MEDIA) $(ENABLE_ENCRYPTED_MEDIA_V2) $(ENABLE_FILTERS) $(ENABLE_FONT_LOAD_EVENTS) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GAMEPAD_DEPRECATED) $(ENABLE_GEOLOCATION) $(ENABLE_HIDDEN_PAGE_DOM_TIMER_THROTTLING) $(ENABLE_HIGH_DPI_CANVAS) $(ENABLE_ICONDATABASE) $(ENABLE_SERVICE_CONTROLS) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INDEXED_DATABASE_IN_WORKERS) $(ENABLE_INDIE_UI) $(ENABLE_INPUT_SPEECH) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_TYPE_COLOR_POPOVER) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME_INCOMPLETE) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_INSPECTOR) $(ENABLE_IOS_AIRPLAY) $(ENABLE_IOS_TEXT_AUTOSIZING) $(ENABLE_LEGACY_CSS_VENDOR_PREFIXES) $(ENABLE_LEGACY_NOTIFICATIONS) $(ENABLE_LEGACY_VENDOR_PREFIXES) $(ENABLE_LEGACY_WEB_AUDIO) $(ENABLE_LETTERPRESS) $(ENABLE_LINK_LONG_PRESS) $(ENABLE_LINK_PREFETCH) $(ENABLE_MATHML) $(ENABLE_MEDIA_CONTROLS_SCRIPT) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_METER_ELEMENT) $(ENABLE_MHTML) $(ENABLE_MOUSE_CURSOR_SCALE) $(ENABLE_NAVIGATOR_CONTENT_UTILS) $(ENABLE_NAVIGATOR_HWCONCURRENCY) $(ENABLE_NOTIFICATIONS) $(ENABLE_PDFKIT_PLUGIN) $(ENABLE_POINTER_LOCK) $(ENABLE_PROMISES) $(ENABLE_PROXIMITY_EVENTS) $(ENABLE_PUBLIC_SUFFIX_LIST) $(ENABLE_QUOTA) $(ENABLE_REQUEST_ANIMATION_FRAME) $(ENABLE_REMOTE_INSPECTOR) $(ENABLE_RESOLUTION_MEDIA_QUERY) $(ENABLE_SCRIPTED_SPEECH) $(ENABLE_SHARED_WORKERS) $(ENABLE_SPEECH_SYNTHESIS) $(ENABLE_SQL_DATABASE) $(ENABLE_SUBPIXEL_LAYOUT) $(ENABLE_SUBTLE_CRYPTO) $(ENABLE_SVG_FONTS) $(ENABLE_TELEPHONE_NUMBER_DETECTION) $(ENABLE_TEMPLATE_ELEMENT) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_TOUCH_EVENTS) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_USERSELECT_ALL) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_DATACUE_VALUE) $(ENABLE_VIEW_MODE_CSS_MEDIA) $(ENABLE_WEBGL) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_REPLAY) $(ENABLE_WEB_SOCKETS) $(ENABLE_PICTURE_SIZES) $(ENABLE_WEB_TIMING) $(ENABLE_WEBVTT_REGIONS) $(ENABLE_XHR_TIMEOUT) $(ENABLE_XSLT) $(ENABLE_FTL_JIT) $(ENABLE_LLINT_C_LOOP) $(FEATURE_DEFINES_$(PLATFORM_NAME));
index a8bde8b..af56297 100644 (file)
@@ -1,3 +1,14 @@
+2014-06-29  Yoav Weiss  <yoav@yoav.ws>
+
+        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.
+
+        * Configurations/FeatureDefines.xcconfig:
+
 2014-06-28  Tim Horton  <timothy_horton@apple.com>
 
         [iOS][WK2] PDFs never load inline again after the Web process crashes
index 59dc18a..416b9b3 100644 (file)
@@ -228,6 +228,7 @@ ENABLE_WEB_REPLAY_macosx_Production = ;
 ENABLE_WEB_REPLAY_iphoneos = ;
 ENABLE_WEB_REPLAY_iphonesimulator = ;
 ENABLE_WEB_SOCKETS = ENABLE_WEB_SOCKETS;
+ENABLE_PICTURE_SIZES = ENABLE_PICTURE_SIZES;
 
 ENABLE_WEB_TIMING = $(ENABLE_WEB_TIMING_$(PLATFORM_NAME));
 ENABLE_WEB_TIMING_macosx = $(ENABLE_WEB_TIMING_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR));
@@ -248,4 +249,4 @@ ENABLE_FTL_JIT_iphonesimulator = ;
 
 ENABLE_LLINT_C_LOOP = ;
 
-FEATURE_DEFINES = $(ENABLE_3D_RENDERING) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ACCELERATED_OVERFLOW_SCROLLING) $(ENABLE_AVF_CAPTIONS) $(ENABLE_CACHE_PARTITIONING) $(ENABLE_CANVAS_PATH) $(ENABLE_CANVAS_PROXY) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CSP_NEXT) $(ENABLE_CSS_BOX_DECORATION_BREAK) $(ENABLE_CSS_COMPOSITING) $(ENABLE_CSS_DEVICE_ADAPTATION) $(ENABLE_CSS_EXCLUSIONS) $(ENABLE_CSS_FILTERS) $(ENABLE_CSS_GRID_LAYOUT) $(ENABLE_CSS_IMAGE_ORIENTATION) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_REGIONS) $(ENABLE_CSS_SHAPES) $(ENABLE_CSS_TRANSFORMS_ANIMATIONS_UNPREFIXED) $(ENABLE_CSS3_CONDITIONAL_RULES) $(ENABLE_CSS3_TEXT) $(ENABLE_CSS3_TEXT_LINE_BREAK) $(ENABLE_CURSOR_VISIBILITY) $(ENABLE_CUSTOM_SCHEME_HANDLER) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATALIST_ELEMENT) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DETAILS_ELEMENT) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DOM4_EVENTS_CONSTRUCTOR) $(ENABLE_ENCRYPTED_MEDIA) $(ENABLE_ENCRYPTED_MEDIA_V2) $(ENABLE_FILTERS) $(ENABLE_FONT_LOAD_EVENTS) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GAMEPAD_DEPRECATED) $(ENABLE_GEOLOCATION) $(ENABLE_HIDDEN_PAGE_DOM_TIMER_THROTTLING) $(ENABLE_HIGH_DPI_CANVAS) $(ENABLE_ICONDATABASE) $(ENABLE_SERVICE_CONTROLS) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INDEXED_DATABASE_IN_WORKERS) $(ENABLE_INDIE_UI) $(ENABLE_INPUT_SPEECH) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_TYPE_COLOR_POPOVER) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME_INCOMPLETE) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_INSPECTOR) $(ENABLE_IOS_AIRPLAY) $(ENABLE_IOS_TEXT_AUTOSIZING) $(ENABLE_LEGACY_CSS_VENDOR_PREFIXES) $(ENABLE_LEGACY_NOTIFICATIONS) $(ENABLE_LEGACY_VENDOR_PREFIXES) $(ENABLE_LEGACY_WEB_AUDIO) $(ENABLE_LETTERPRESS) $(ENABLE_LINK_LONG_PRESS) $(ENABLE_LINK_PREFETCH) $(ENABLE_MATHML) $(ENABLE_MEDIA_CONTROLS_SCRIPT) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_METER_ELEMENT) $(ENABLE_MHTML) $(ENABLE_MOUSE_CURSOR_SCALE) $(ENABLE_NAVIGATOR_CONTENT_UTILS) $(ENABLE_NAVIGATOR_HWCONCURRENCY) $(ENABLE_NOTIFICATIONS) $(ENABLE_PDFKIT_PLUGIN) $(ENABLE_POINTER_LOCK) $(ENABLE_PROMISES) $(ENABLE_PROXIMITY_EVENTS) $(ENABLE_PUBLIC_SUFFIX_LIST) $(ENABLE_QUOTA) $(ENABLE_REQUEST_ANIMATION_FRAME) $(ENABLE_REMOTE_INSPECTOR) $(ENABLE_RESOLUTION_MEDIA_QUERY) $(ENABLE_SCRIPTED_SPEECH) $(ENABLE_SHARED_WORKERS) $(ENABLE_SPEECH_SYNTHESIS) $(ENABLE_SQL_DATABASE) $(ENABLE_SUBPIXEL_LAYOUT) $(ENABLE_SUBTLE_CRYPTO) $(ENABLE_SVG_FONTS) $(ENABLE_TELEPHONE_NUMBER_DETECTION) $(ENABLE_TEMPLATE_ELEMENT) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_TOUCH_EVENTS) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_USERSELECT_ALL) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_DATACUE_VALUE) $(ENABLE_VIEW_MODE_CSS_MEDIA) $(ENABLE_WEBGL) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_REPLAY) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WEBVTT_REGIONS) $(ENABLE_XHR_TIMEOUT) $(ENABLE_XSLT) $(ENABLE_FTL_JIT) $(ENABLE_LLINT_C_LOOP) $(FEATURE_DEFINES_$(PLATFORM_NAME));
+FEATURE_DEFINES = $(ENABLE_3D_RENDERING) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ACCELERATED_OVERFLOW_SCROLLING) $(ENABLE_AVF_CAPTIONS) $(ENABLE_CACHE_PARTITIONING) $(ENABLE_CANVAS_PATH) $(ENABLE_CANVAS_PROXY) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CSP_NEXT) $(ENABLE_CSS_BOX_DECORATION_BREAK) $(ENABLE_CSS_COMPOSITING) $(ENABLE_CSS_DEVICE_ADAPTATION) $(ENABLE_CSS_EXCLUSIONS) $(ENABLE_CSS_FILTERS) $(ENABLE_CSS_GRID_LAYOUT) $(ENABLE_CSS_IMAGE_ORIENTATION) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_REGIONS) $(ENABLE_CSS_SHAPES) $(ENABLE_CSS_TRANSFORMS_ANIMATIONS_UNPREFIXED) $(ENABLE_CSS3_CONDITIONAL_RULES) $(ENABLE_CSS3_TEXT) $(ENABLE_CSS3_TEXT_LINE_BREAK) $(ENABLE_CURSOR_VISIBILITY) $(ENABLE_CUSTOM_SCHEME_HANDLER) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATALIST_ELEMENT) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DETAILS_ELEMENT) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DOM4_EVENTS_CONSTRUCTOR) $(ENABLE_ENCRYPTED_MEDIA) $(ENABLE_ENCRYPTED_MEDIA_V2) $(ENABLE_FILTERS) $(ENABLE_FONT_LOAD_EVENTS) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GAMEPAD_DEPRECATED) $(ENABLE_GEOLOCATION) $(ENABLE_HIDDEN_PAGE_DOM_TIMER_THROTTLING) $(ENABLE_HIGH_DPI_CANVAS) $(ENABLE_ICONDATABASE) $(ENABLE_SERVICE_CONTROLS) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INDEXED_DATABASE_IN_WORKERS) $(ENABLE_INDIE_UI) $(ENABLE_INPUT_SPEECH) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_TYPE_COLOR_POPOVER) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME_INCOMPLETE) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_INSPECTOR) $(ENABLE_IOS_AIRPLAY) $(ENABLE_IOS_TEXT_AUTOSIZING) $(ENABLE_LEGACY_CSS_VENDOR_PREFIXES) $(ENABLE_LEGACY_NOTIFICATIONS) $(ENABLE_LEGACY_VENDOR_PREFIXES) $(ENABLE_LEGACY_WEB_AUDIO) $(ENABLE_LETTERPRESS) $(ENABLE_LINK_LONG_PRESS) $(ENABLE_LINK_PREFETCH) $(ENABLE_MATHML) $(ENABLE_MEDIA_CONTROLS_SCRIPT) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_METER_ELEMENT) $(ENABLE_MHTML) $(ENABLE_MOUSE_CURSOR_SCALE) $(ENABLE_NAVIGATOR_CONTENT_UTILS) $(ENABLE_NAVIGATOR_HWCONCURRENCY) $(ENABLE_NOTIFICATIONS) $(ENABLE_PDFKIT_PLUGIN) $(ENABLE_POINTER_LOCK) $(ENABLE_PROMISES) $(ENABLE_PROXIMITY_EVENTS) $(ENABLE_PUBLIC_SUFFIX_LIST) $(ENABLE_QUOTA) $(ENABLE_REQUEST_ANIMATION_FRAME) $(ENABLE_REMOTE_INSPECTOR) $(ENABLE_RESOLUTION_MEDIA_QUERY) $(ENABLE_SCRIPTED_SPEECH) $(ENABLE_SHARED_WORKERS) $(ENABLE_SPEECH_SYNTHESIS) $(ENABLE_SQL_DATABASE) $(ENABLE_SUBPIXEL_LAYOUT) $(ENABLE_SUBTLE_CRYPTO) $(ENABLE_SVG_FONTS) $(ENABLE_TELEPHONE_NUMBER_DETECTION) $(ENABLE_TEMPLATE_ELEMENT) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_TOUCH_EVENTS) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_USERSELECT_ALL) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_DATACUE_VALUE) $(ENABLE_VIEW_MODE_CSS_MEDIA) $(ENABLE_WEBGL) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_REPLAY) $(ENABLE_WEB_SOCKETS) $(ENABLE_PICTURE_SIZES) $(ENABLE_WEB_TIMING) $(ENABLE_WEBVTT_REGIONS) $(ENABLE_XHR_TIMEOUT) $(ENABLE_XSLT) $(ENABLE_FTL_JIT) $(ENABLE_LLINT_C_LOOP) $(FEATURE_DEFINES_$(PLATFORM_NAME));
index 652de81..5037fd8 100644 (file)
@@ -92,6 +92,7 @@ macro(WEBKIT_OPTION_BEGIN)
     WEBKIT_OPTION_DEFINE(ENABLE_NOTIFICATIONS "Toggle Desktop Notifications Support" OFF)
     WEBKIT_OPTION_DEFINE(ENABLE_ORIENTATION_EVENTS "Toggle Orientation Events support" OFF)
     WEBKIT_OPTION_DEFINE(ENABLE_PERFORMANCE_TIMELINE "Toggle Performance Timeline support" OFF)
+    WEBKIT_OPTION_DEFINE(ENABLE_PICTURE_SIZES "Toggle sizes attribute support" OFF)
     WEBKIT_OPTION_DEFINE(ENABLE_PROMISES "Toggle Promise support" ON)
     WEBKIT_OPTION_DEFINE(ENABLE_PROXIMITY_EVENTS "Toggle Proximity Events support" OFF)
     WEBKIT_OPTION_DEFINE(ENABLE_QUOTA "Toggle Quota support" OFF)
index 33942dc..c48c175 100644 (file)
@@ -86,6 +86,7 @@
 #cmakedefine01 ENABLE_NOTIFICATIONS
 #cmakedefine01 ENABLE_ORIENTATION_EVENTS
 #cmakedefine01 ENABLE_PERFORMANCE_TIMELINE
+#cmakedefine01 ENABLE_PICTURE_SIZES
 #cmakedefine01 ENABLE_PROMISES
 #cmakedefine01 ENABLE_PROXIMITY_EVENTS
 #cmakedefine01 ENABLE_QUOTA
index fcbf67a..5334ab8 100644 (file)
@@ -1,3 +1,14 @@
+2014-06-29  Yoav Weiss  <yoav@yoav.ws>
+
+        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.
+
+        * Scripts/webkitperl/FeatureList.pm:
+
 2014-06-27  Tim Horton  <timothy_horton@apple.com>
 
         check-webkit-style should check the order of #imports as well as #includes
index fab9828..b9ced9d 100644 (file)
@@ -110,6 +110,7 @@ my (
     $orientationEventsSupport,
     $pageVisibilityAPISupport,
     $performanceTimelineSupport,
+    $pictureSizesSupport,
     $promiseSupport,
     $proximityEventsSupport,
     $quotaSupport,
@@ -345,6 +346,9 @@ my @features = (
     { option => "performance-timeline", desc => "Toggle Performance Timeline support",
       define => "ENABLE_PERFORMANCE_TIMELINE", default => isGtk(), value => \$performanceTimelineSupport },
 
+    { option => "picture-sizes", desc => "Toggle sizes attribute support",
+      define => "ENABLE_PICTURE_SIZES", default => 0, value => \$pictureSizesSupport },
+
     { option => "promises", desc => "Toggle Promise support",
       define => "ENABLE_PROMISES", default => 1, value => \$promiseSupport },