Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(317)

Unified Diff: LayoutTests/fast/dom/HTMLImageElement/image-picture-invalid.html

Issue 288033018: Add HTMLPictureElement-based source selection to HTMLImageElement (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Review nits Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: LayoutTests/fast/dom/HTMLImageElement/image-picture-invalid.html
diff --git a/LayoutTests/fast/dom/HTMLImageElement/image-picture-invalid.html b/LayoutTests/fast/dom/HTMLImageElement/image-picture-invalid.html
new file mode 100644
index 0000000000000000000000000000000000000000..a1d42a5550b7078b7600cada563ee595ee483fa9
--- /dev/null
+++ b/LayoutTests/fast/dom/HTMLImageElement/image-picture-invalid.html
@@ -0,0 +1,64 @@
+<!DOCTYPE html>
+<script src="../../../resources/js-test.js"></script>
+<script>
+ if (window.testRunner)
+ testRunner.dumpAsText();
+
+ addEventListener("load", function() {
+ shouldBe('document.getElementById("canary").clientWidth', '75');
+ shouldBe('document.getElementById("canary").currentSrc', '"resources/blue_rect.jpg?0"');
+ shouldBe('document.getElementById("div_end_picture").clientWidth', '800');
+ shouldBe('document.getElementById("div_end_picture").currentSrc', '"../../hidpi/resources/image-set-2x.png?2"');
+ shouldBe('document.getElementById("div_multiple_end").clientWidth', '800');
+ shouldBe('document.getElementById("div_multiple_end").currentSrc', '"../../hidpi/resources/image-set-2x.png?2"');
+ shouldBe('document.getElementById("source_in_div").clientWidth', '75');
+ shouldBe('document.getElementById("source_in_div").currentSrc', '"resources/blue_rect.jpg"');
+ shouldBe('document.getElementById("not_in_picture").clientWidth', '75');
+ shouldBe('document.getElementById("not_in_picture").currentSrc', '"resources/blue_rect.jpg"');
+ }, false);
+</script>
+<!-- A canary image to see that the test is actually working -->
+<img id="canary" src="resources/blue_rect.jpg?0">
+<!-- Invalid nesting tests -->
+<!-- In the following tests, nesting shouldn't mess up the selection algorithm -->
+<picture>
+ <picture>
+ <source sizes="800px" srcset="../../hidpi/resources/image-set-1x.png?2 400w, ../../hidpi/resources/image-set-2x.png?2 800w,
+ resources/image-set-4x.png?2 1600w">
+ <div>
+ </picture>
+ </div>
+ <img id="div_end_picture" src="resources/blue_rect.jpg">
+ </picture>
+</picture>
+<picture>
+ <div>
+ </picture>
+ </picture>
+ </picture>
+ </div>
+ <source sizes="800px" srcset="../../hidpi/resources/image-set-1x.png?2 400w, ../../hidpi/resources/image-set-2x.png?2 800w,
+ resources/image-set-4x.png?2 1600w">
+ <img id="div_multiple_end" src="resources/blue_rect.jpg">
+</picture>
+<!-- In the following tests, nesting messes up the selection algorithm -->
+<picture>
+ <div>
+ <picture>
+ <div>
+ <source sizes="400px" srcset="resources/base-image1.png?4 200w, resources/base-image3.png?4 400w, resources/base-image2.png?4 800w">
+ </div>
+ <img id="source_in_div" src="resources/blue_rect.jpg">
+ </picture>
+ </div>
+</picture>
+<picture>
+ <div>
+ <picture>
+ <div>
+ <source sizes="400px" srcset="resources/base-image1.png?5 200w, resources/base-image3.png?5 400w, resources/base-image2.png?5 800w">
+ <img id="not_in_picture" src="resources/blue_rect.jpg">
+ </div>
+ </picture>
+ </div>
+</picture>

Powered by Google App Engine
This is Rietveld 408576698