<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[193952] branches/safari-601.1.46-branch</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/193952">193952</a></dd>
<dt>Author</dt> <dd>matthew_hanson@apple.com</dd>
<dt>Date</dt> <dd>2015-12-11 02:01:24 -0800 (Fri, 11 Dec 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Merge <a href="http://trac.webkit.org/projects/webkit/changeset/193859">r193859</a>. rdar://problem/23814345</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#branchessafari601146branchLayoutTestsChangeLog">branches/safari-601.1.46-branch/LayoutTests/ChangeLog</a></li>
<li><a href="#branchessafari601146branchSourceWebCoreChangeLog">branches/safari-601.1.46-branch/Source/WebCore/ChangeLog</a></li>
<li><a href="#branchessafari601146branchSourceWebCorecssMediaQueryEvaluatorcpp">branches/safari-601.1.46-branch/Source/WebCore/css/MediaQueryEvaluator.cpp</a></li>
<li><a href="#branchessafari601146branchSourceWebCorecssMediaQueryEvaluatorh">branches/safari-601.1.46-branch/Source/WebCore/css/MediaQueryEvaluator.h</a></li>
<li><a href="#branchessafari601146branchSourceWebCorecssStyleResolverh">branches/safari-601.1.46-branch/Source/WebCore/css/StyleResolver.h</a></li>
<li><a href="#branchessafari601146branchSourceWebCoredomDocumentcpp">branches/safari-601.1.46-branch/Source/WebCore/dom/Document.cpp</a></li>
<li><a href="#branchessafari601146branchSourceWebCoredomDocumenth">branches/safari-601.1.46-branch/Source/WebCore/dom/Document.h</a></li>
<li><a href="#branchessafari601146branchSourceWebCorehtmlHTMLImageElementcpp">branches/safari-601.1.46-branch/Source/WebCore/html/HTMLImageElement.cpp</a></li>
<li><a href="#branchessafari601146branchSourceWebCorehtmlHTMLPictureElementcpp">branches/safari-601.1.46-branch/Source/WebCore/html/HTMLPictureElement.cpp</a></li>
<li><a href="#branchessafari601146branchSourceWebCorehtmlHTMLPictureElementh">branches/safari-601.1.46-branch/Source/WebCore/html/HTMLPictureElement.h</a></li>
<li><a href="#branchessafari601146branchSourceWebCorehtmlHTMLSourceElementcpp">branches/safari-601.1.46-branch/Source/WebCore/html/HTMLSourceElement.cpp</a></li>
<li><a href="#branchessafari601146branchSourceWebCorehtmlHTMLSourceElementh">branches/safari-601.1.46-branch/Source/WebCore/html/HTMLSourceElement.h</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#branchessafari601146branchLayoutTestsfastpictureresourcesresizetestjs">branches/safari-601.1.46-branch/LayoutTests/fast/picture/resources/resize-test.js</a></li>
<li><a href="#branchessafari601146branchLayoutTestsfastpictureviewportresizeexpectedtxt">branches/safari-601.1.46-branch/LayoutTests/fast/picture/viewport-resize-expected.txt</a></li>
<li><a href="#branchessafari601146branchLayoutTestsfastpictureviewportresizehtml">branches/safari-601.1.46-branch/LayoutTests/fast/picture/viewport-resize.html</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchessafari601146branchLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/LayoutTests/ChangeLog (193951 => 193952)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/LayoutTests/ChangeLog        2015-12-11 10:01:16 UTC (rev 193951)
+++ branches/safari-601.1.46-branch/LayoutTests/ChangeLog        2015-12-11 10:01:24 UTC (rev 193952)
</span><span class="lines">@@ -1,5 +1,21 @@
</span><span class="cx"> 2015-12-11 Matthew Hanson <matthew_hanson@apple.com>
</span><span class="cx">
</span><ins>+ Merge r193859. rdar://problem/23814345
+
+ 2015-12-09 David Hyatt <hyatt@apple.com>
+
+ Picture element needs to respond to dynamic viewport changes.
+ https://bugs.webkit.org/show_bug.cgi?id=152013
+ <rdar://problem/23766375>
+
+ Reviewed by Dean Jackson.
+
+ * fast/picture/resources/resize-test.js: Added.
+ * fast/picture/viewport-resize-expected.txt: Added.
+ * fast/picture/viewport-resize.html: Added.
+
+2015-12-11 Matthew Hanson <matthew_hanson@apple.com>
+
</ins><span class="cx"> Merge r193922. rdar://problem/23716993
</span><span class="cx">
</span><span class="cx"> 2015-12-10 Enrica Casucci <enrica@apple.com>
</span></span></pre></div>
<a id="branchessafari601146branchLayoutTestsfastpictureresourcesresizetestjs"></a>
<div class="addfile"><h4>Added: branches/safari-601.1.46-branch/LayoutTests/fast/picture/resources/resize-test.js (0 => 193952)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/LayoutTests/fast/picture/resources/resize-test.js         (rev 0)
+++ branches/safari-601.1.46-branch/LayoutTests/fast/picture/resources/resize-test.js        2015-12-11 10:01:24 UTC (rev 193952)
</span><span class="lines">@@ -0,0 +1,58 @@
</span><ins>+if (window.testRunner) {
+ testRunner.waitUntilDone();
+ testRunner.dumpAsText();
+}
+
+function resizeTest(sizes, testFunction)
+{
+ var widthDelta;
+ var heightDelta;
+
+ function performNextResize()
+ {
+ if (sizes.length) {
+ resizeTo(sizes[0][0] + widthDelta, sizes[0][1] + heightDelta);
+ return;
+ }
+ removeEventListener("resize", resizeHandler);
+ if (window.testRunner)
+ testRunner.notifyDone();
+ };
+
+ function resizeHandler()
+ {
+ var nextSize = sizes.shift();
+
+ shouldEvaluateTo("innerWidth", nextSize[0]);
+ shouldEvaluateTo("innerHeight", nextSize[1]);
+
+ testFunction();
+
+ performNextResize();
+ };
+
+ const warmupWidth = outerWidth + 13;
+
+ function warmupDone()
+ {
+ if (outerWidth != warmupWidth)
+ return;
+ widthDelta = outerWidth - innerWidth;
+ heightDelta = outerHeight - innerHeight;
+ removeEventListener("resize", warmupDone);
+ setTimeout(function () {
+ addEventListener("resize", resizeHandler);
+ performNextResize();
+ }, 0);
+ }
+
+ addEventListener("resize", warmupDone);
+ setTimeout(function () {
+ resizeTo(warmupWidth, outerHeight);
+ }, 0);
+}
+
+function standardResizeTest(testFunction)
+{
+ resizeTest([[800, 600], [1200, 600]], testFunction);
+}
</ins></span></pre></div>
<a id="branchessafari601146branchLayoutTestsfastpictureviewportresizeexpectedtxt"></a>
<div class="addfile"><h4>Added: branches/safari-601.1.46-branch/LayoutTests/fast/picture/viewport-resize-expected.txt (0 => 193952)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/LayoutTests/fast/picture/viewport-resize-expected.txt         (rev 0)
+++ branches/safari-601.1.46-branch/LayoutTests/fast/picture/viewport-resize-expected.txt        2015-12-11 10:01:24 UTC (rev 193952)
</span><span class="lines">@@ -0,0 +1,59 @@
</span><ins>+Test that pictures properly update when the viewport changes size.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+PASS innerWidth is 800
+PASS innerHeight is 600
+PASS document.getElementById("simple").clientWidth is 800
+PASS currentSrcFileName("simple") is "image-set-2x.png?2"
+PASS document.getElementById("multiple").clientWidth is 800
+PASS currentSrcFileName("multiple") is "image-set-2x.png?2"
+PASS document.getElementById("other_children").clientWidth is 800
+PASS currentSrcFileName("other_children") is "image-set-2x.png?2"
+PASS document.getElementById("img_before_source").clientWidth is 75
+PASS currentSrcFileName("img_before_source") is "blue_rect.jpg?1"
+PASS document.getElementById("unknown_type").clientWidth is 1600
+PASS currentSrcFileName("unknown_type") is "image-set-4x.png?3"
+PASS document.getElementById("svg_type").clientWidth is 800
+PASS currentSrcFileName("svg_type") is "image-set-2x.png?2"
+PASS document.getElementById("empty_type").clientWidth is 800
+PASS currentSrcFileName("empty_type") is "image-set-2x.png?2"
+PASS document.getElementById("whitespace_type").clientWidth is 800
+PASS currentSrcFileName("whitespace_type") is "image-set-2x.png?2"
+PASS document.getElementById("parameter_type").clientWidth is 800
+PASS currentSrcFileName("parameter_type") is "image-set-2x.png?2"
+PASS document.getElementById("empty_srcset").clientWidth is 1600
+PASS currentSrcFileName("empty_srcset") is "image-set-4x.png?3"
+PASS document.getElementById("no_srcset").clientWidth is 1600
+PASS currentSrcFileName("no_srcset") is "image-set-4x.png?3"
+PASS innerWidth is 1200
+PASS innerHeight is 600
+PASS document.getElementById("simple").clientWidth is 1600
+PASS currentSrcFileName("simple") is "image-set-4x.png?3"
+PASS document.getElementById("multiple").clientWidth is 1600
+PASS currentSrcFileName("multiple") is "image-set-4x.png?3"
+PASS document.getElementById("other_children").clientWidth is 1600
+PASS currentSrcFileName("other_children") is "image-set-4x.png?3"
+PASS document.getElementById("img_before_source").clientWidth is 75
+PASS currentSrcFileName("img_before_source") is "blue_rect.jpg?1"
+PASS document.getElementById("unknown_type").clientWidth is 1600
+PASS currentSrcFileName("unknown_type") is "image-set-4x.png?3"
+PASS document.getElementById("svg_type").clientWidth is 1600
+PASS currentSrcFileName("svg_type") is "image-set-4x.png?3"
+PASS document.getElementById("empty_type").clientWidth is 1600
+PASS currentSrcFileName("empty_type") is "image-set-4x.png?3"
+PASS document.getElementById("whitespace_type").clientWidth is 1600
+PASS currentSrcFileName("whitespace_type") is "image-set-4x.png?3"
+PASS document.getElementById("parameter_type").clientWidth is 1600
+PASS currentSrcFileName("parameter_type") is "image-set-4x.png?3"
+PASS document.getElementById("empty_srcset").clientWidth is 1600
+PASS currentSrcFileName("empty_srcset") is "image-set-4x.png?3"
+PASS document.getElementById("no_srcset").clientWidth is 1600
+PASS currentSrcFileName("no_srcset") is "image-set-4x.png?3"
+
+some text
+
</ins></span></pre></div>
<a id="branchessafari601146branchLayoutTestsfastpictureviewportresizehtml"></a>
<div class="addfile"><h4>Added: branches/safari-601.1.46-branch/LayoutTests/fast/picture/viewport-resize.html (0 => 193952)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/LayoutTests/fast/picture/viewport-resize.html         (rev 0)
+++ branches/safari-601.1.46-branch/LayoutTests/fast/picture/viewport-resize.html        2015-12-11 10:01:24 UTC (rev 193952)
</span><span class="lines">@@ -0,0 +1,149 @@
</span><ins>+<!DOCTYPE html>
+<body>
+        <!-- A canary image to see that the test is actually working -->
+        <img id="canary" src="resources/blue_rect.jpg?0">
+        <!-- simple picture construct -->
+        <picture>
+         <source media="(max-width: 400px)" sizes="400px" srcset="../hidpi/resources/image-set-1x.png?1 400w, ../hidpi/resources/image-set-2x.png?1 800w,
+         resources/image-set-4x.png?1 1600w">
+         <source media="(max-width: 800px)" 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">
+         <source media="(max-width: 1600px)" sizes="1600px" srcset="../hidpi/resources/image-set-1x.png?3 400w, ../hidpi/resources/image-set-2x.png?3 800w,
+         resources/image-set-4x.png?3 1600w">
+         <img id="simple" src="resources/blue_rect.jpg?1">
+        </picture>
+        <!-- Multiple img elements -->
+        <picture>
+         <source media="(max-width: 400px)" sizes="400px" srcset="../hidpi/resources/image-set-1x.png?1 400w, ../hidpi/resources/image-set-2x.png?1 800w,
+         resources/image-set-4x.png?1 1600w">
+         <source media="(max-width: 800px)" 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">
+         <source media="(max-width: 1600px)" sizes="1600px" srcset="../hidpi/resources/image-set-1x.png?3 400w, ../hidpi/resources/image-set-2x.png?3 800w,
+         resources/image-set-4x.png?3 1600w">
+         <img src="resources/blue_rect.jpg?1">
+         <img id="multiple" src="resources/blue_rect.jpg?1">
+        </picture>
+        <!-- non-source children - should be ignored-->
+        <picture>
+         <div>some text</div>
+         <source media="(max-width: 400px)" sizes="400px" srcset="../hidpi/resources/image-set-1x.png?1 400w, ../hidpi/resources/image-set-2x.png?1 800w,
+         resources/image-set-4x.png?1 1600w">
+         <source media="(max-width: 800px)" 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">
+         <source media="(max-width: 1600px)" sizes="1600px" srcset="../hidpi/resources/image-set-1x.png?3 400w, ../hidpi/resources/image-set-2x.png?3 800w,
+         resources/image-set-4x.png?3 1600w">
+         <img id="other_children" src="resources/blue_rect.jpg?1">
+        </picture>
+        <!-- img before its source siblings - should ignore its siblings -->
+        <picture>
+         <img id="img_before_source" src="resources/blue_rect.jpg?1">
+         <source media="(max-width: 400px)" sizes="400px" srcset="../hidpi/resources/image-set-1x.png?1 400w, ../hidpi/resources/image-set-2x.png?1 800w,
+         resources/image-set-4x.png?1 1600w">
+         <source media="(max-width: 800px)" 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">
+         <source media="(max-width: 1600px)" sizes="1600px" srcset="../hidpi/resources/image-set-1x.png?3 400w, ../hidpi/resources/image-set-2x.png?3 800w,
+         resources/image-set-4x.png?3 1600w">
+        </picture>
+        <!-- source with unknown type - should be ignored -->
+        <picture>
+         <source media="(max-width: 400px)" sizes="400px" srcset="../hidpi/resources/image-set-1x.png?1 400w, ../hidpi/resources/image-set-2x.png?1 800w,
+         resources/image-set-4x.png?1 1600w">
+         <source media="(max-width: 800px)" type="image/nonsense" 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">
+         <source media="(max-width: 1600px)" sizes="1600px" srcset="../hidpi/resources/image-set-1x.png?3 400w, ../hidpi/resources/image-set-2x.png?3 800w,
+         resources/image-set-4x.png?3 1600w">
+         <img id="unknown_type" src="resources/blue_rect.jpg?1">
+        </picture>
+        <!-- SVG source - should not be ignored -->
+        <picture>
+         <source media="(max-width: 400px)" sizes="400px" srcset="../hidpi/resources/image-set-1x.png?1 400w, ../hidpi/resources/image-set-2x.png?1 800w,
+         resources/image-set-4x.png?1 1600w">
+         <source media="(max-width: 800px)" type="image/svg+xml" 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">
+         <source media="(max-width: 1600px)" sizes="1600px" srcset="../hidpi/resources/image-set-1x.png?3 400w, ../hidpi/resources/image-set-2x.png?3 800w,
+         resources/image-set-4x.png?3 1600w">
+         <img id="svg_type" src="resources/blue_rect.jpg?1">
+        </picture>
+        <!-- Empty type - should not be ignored -->
+        <picture>
+         <source media="(max-width: 400px)" sizes="400px" srcset="../hidpi/resources/image-set-1x.png?1 400w, ../hidpi/resources/image-set-2x.png?1 800w,
+         resources/image-set-4x.png?1 1600w">
+         <source media="(max-width: 800px)" type="" 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">
+         <source media="(max-width: 1600px)" sizes="1600px" srcset="../hidpi/resources/image-set-1x.png?3 400w, ../hidpi/resources/image-set-2x.png?3 800w,
+         resources/image-set-4x.png?3 1600w">
+         <img id="empty_type" src="resources/blue_rect.jpg?1">
+        </picture>
+        <!-- whitespace type - should not be ignored -->
+        <picture>
+         <source media="(max-width: 400px)" sizes="400px" srcset="../hidpi/resources/image-set-1x.png?1 400w, ../hidpi/resources/image-set-2x.png?1 800w,
+         resources/image-set-4x.png?1 1600w">
+         <source media="(max-width: 800px)" type=" " 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">
+         <source media="(max-width: 1600px)" sizes="1600px" srcset="../hidpi/resources/image-set-1x.png?3 400w, ../hidpi/resources/image-set-2x.png?3 800w,
+         resources/image-set-4x.png?3 1600w">
+         <img id="whitespace_type" src="resources/blue_rect.jpg?1">
+        </picture>
+        <!-- parameter type - should not be ignored -->
+        <picture>
+         <source media="(max-width: 400px)" sizes="400px" srcset="../hidpi/resources/image-set-1x.png?1 400w, ../hidpi/resources/image-set-2x.png?1 800w,
+         resources/image-set-4x.png?1 1600w">
+         <source media="(max-width: 800px)" type="image/png;bla=bla" 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">
+         <source media="(max-width: 1600px)" sizes="1600px" srcset="../hidpi/resources/image-set-1x.png?3 400w, ../hidpi/resources/image-set-2x.png?3 800w,
+         resources/image-set-4x.png?3 1600w">
+         <img id="parameter_type" src="resources/blue_rect.jpg?1">
+        </picture>
+        <!-- source with empty srcset - should be ignored -->
+        <picture>
+         <source media="(max-width: 400px)" sizes="400px" srcset="../hidpi/resources/image-set-1x.png?1 400w, ../hidpi/resources/image-set-2x.png?1 800w,
+         resources/image-set-4x.png?1 1600w">
+         <source media="(max-width: 800px)" sizes="800px" srcset=", , ">
+         <source media="(max-width: 1600px)" sizes="1600px" srcset="../hidpi/resources/image-set-1x.png?3 400w, ../hidpi/resources/image-set-2x.png?3 800w,
+         resources/image-set-4x.png?3 1600w">
+         <img id="empty_srcset" src="resources/blue_rect.jpg?1">
+        </picture>
+        <!-- source with no srcset - should be ignored -->
+        <picture>
+         <source media="(max-width: 400px)" sizes="400px" srcset="../hidpi/resources/image-set-1x.png?1 400w, ../hidpi/resources/image-set-2x.png?1 800w,
+         resources/image-set-4x.png?1 1600w">
+         <source media="(max-width: 800px)" sizes="800px">
+         <source media="(max-width: 1600px)" sizes="1600px" srcset="../hidpi/resources/image-set-1x.png?3 400w, ../hidpi/resources/image-set-2x.png?3 800w,
+         resources/image-set-4x.png?3 1600w">
+         <img id="no_srcset" src="resources/blue_rect.jpg?1">
+        </picture>
+
+<script src="../../resources/js-test-pre.js"></script>
+<script src="resources/currentSrcHelper.js"></script>
+<script src="resources/resize-test.js"></script>
+<script>
+description("Test that pictures properly update when the viewport changes size.");
+standardResizeTest(function () {
+ var expectedWidth = innerWidth > 800 ? '1600' : '800'
+ var expectedImage = innerWidth > 800 ? '"image-set-4x.png?3"' : '"image-set-2x.png?2"'
+
+ shouldBe('document.getElementById("simple").clientWidth', expectedWidth);
+         shouldBe('currentSrcFileName("simple")', expectedImage);
+         shouldBe('document.getElementById("multiple").clientWidth', expectedWidth);
+         shouldBe('currentSrcFileName("multiple")', expectedImage);
+         shouldBe('document.getElementById("other_children").clientWidth', expectedWidth);
+         shouldBe('currentSrcFileName("other_children")', expectedImage);
+         shouldBe('document.getElementById("img_before_source").clientWidth', '75');
+         shouldBe('currentSrcFileName("img_before_source")', '"blue_rect.jpg?1"');
+         shouldBe('document.getElementById("unknown_type").clientWidth', '1600');
+         shouldBe('currentSrcFileName("unknown_type")', '"image-set-4x.png?3"');
+ shouldBe('document.getElementById("svg_type").clientWidth', expectedWidth);
+         shouldBe('currentSrcFileName("svg_type")', expectedImage);
+         shouldBe('document.getElementById("empty_type").clientWidth', expectedWidth);
+         shouldBe('currentSrcFileName("empty_type")', expectedImage);
+         shouldBe('document.getElementById("whitespace_type").clientWidth', expectedWidth);
+         shouldBe('currentSrcFileName("whitespace_type")', expectedImage);
+         shouldBe('document.getElementById("parameter_type").clientWidth', expectedWidth);
+         shouldBe('currentSrcFileName("parameter_type")', expectedImage);
+         shouldBe('document.getElementById("empty_srcset").clientWidth', '1600');
+         shouldBe('currentSrcFileName("empty_srcset")', '"image-set-4x.png?3"');
+         shouldBe('document.getElementById("no_srcset").clientWidth', '1600');
+         shouldBe('currentSrcFileName("no_srcset")', '"image-set-4x.png?3"');
+ });
+</script>
+<script src="../../resources/js-test-post.js"></script>
</ins></span></pre></div>
<a id="branchessafari601146branchSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/ChangeLog (193951 => 193952)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/ChangeLog        2015-12-11 10:01:16 UTC (rev 193951)
+++ branches/safari-601.1.46-branch/Source/WebCore/ChangeLog        2015-12-11 10:01:24 UTC (rev 193952)
</span><span class="lines">@@ -1,5 +1,67 @@
</span><span class="cx"> 2015-12-11 Matthew Hanson <matthew_hanson@apple.com>
</span><span class="cx">
</span><ins>+ Merge r193859. rdar://problem/23814345
+
+ 2015-12-09 David Hyatt <hyatt@apple.com>
+
+ Picture element needs to respond to dynamic viewport changes.
+ https://bugs.webkit.org/show_bug.cgi?id=152013
+ <rdar://problem/23766375>
+
+ Reviewed by Dean Jackson.
+
+ Added new tests in fast/picture.
+
+ * css/MediaQueryEvaluator.cpp:
+ (WebCore::MediaQueryEvaluator::evalCheckingViewportDependentResults):
+ Add new evaluation method that adds viewport dependent results to a vector. A follow-up patch
+ will refactor the style resolver code to use this function instead of the special style resolver one, in order to
+ get rid of the code duplication. Tracked by https://bugs.webkit.org/show_bug.cgi?id=152089.
+
+ * css/MediaQueryEvaluator.h:
+ (WebCore::MediaQueryResult::MediaQueryResult):
+ * css/StyleResolver.h:
+ (WebCore::MediaQueryResult::MediaQueryResult): Deleted.
+ Move MediaQueryResult into a header since it is used in multiple places now and not just by the style
+ resolver.
+
+ * dom/Document.cpp:
+ (WebCore::Document::evaluateMediaQueryList):
+ (WebCore::Document::checkViewportDependentPictures):
+ (WebCore::Document::optimizedStyleSheetUpdateTimerFired):
+ (WebCore::Document::applyContentDispositionAttachmentSandbox):
+ (WebCore::Document::addViewportDependentPicture):
+ (WebCore::Document::removeViewportDependentPicture):
+ * dom/Document.h:
+ The document now maintains a HashSet of viewport-dependent pictures, and it checks them whenever the
+ viewport changes. If their media queries stay the same, then nothing happens. If they change, then
+ the <picture> will go back and re-check all its <source> elements to see what the new best candidate is.
+
+ * html/HTMLImageElement.cpp:
+ (WebCore::HTMLImageElement::bestFitSourceFromPictureElement):
+ Revised to check for viewport dependencies and to cache viewport-dependent results on the <picture> elements.
+ When a <picture> is found to be viewport-dependent (or not) it is also added to or removed from the document's
+ set of tracked pictures.
+
+ * html/HTMLPictureElement.cpp:
+ (WebCore::HTMLPictureElement::HTMLPictureElement):
+ (WebCore::HTMLPictureElement::~HTMLPictureElement):
+ (WebCore::HTMLPictureElement::didMoveToNewDocument):
+ (WebCore::HTMLPictureElement::create):
+ (WebCore::HTMLPictureElement::sourcesChanged):
+ (WebCore::HTMLPictureElement::viewportChangeAffectedPicture):
+ * html/HTMLPictureElement.h:
+ New caching of results and updating of the document HashSet when the picture gets destroyed or moves to
+ a different document.
+
+ * html/HTMLSourceElement.cpp:
+ (WebCore::HTMLSourceElement::parseAttribute):
+ * html/HTMLSourceElement.h:
+ Cache the media attribute in a parsed form. A follow-up patch will improve the <video>/<audio>
+ code to make use of this parsed result. Tracked by https://bugs.webkit.org/show_bug.cgi?id=152090.
+
+2015-12-11 Matthew Hanson <matthew_hanson@apple.com>
+
</ins><span class="cx"> Merge r193922. rdar://problem/23716993
</span><span class="cx">
</span><span class="cx"> 2015-12-10 Enrica Casucci <enrica@apple.com>
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebCorecssMediaQueryEvaluatorcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/css/MediaQueryEvaluator.cpp (193951 => 193952)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/css/MediaQueryEvaluator.cpp        2015-12-11 10:01:16 UTC (rev 193951)
+++ branches/safari-601.1.46-branch/Source/WebCore/css/MediaQueryEvaluator.cpp        2015-12-11 10:01:24 UTC (rev 193952)
</span><span class="lines">@@ -170,6 +170,40 @@
</span><span class="cx"> return result;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+bool MediaQueryEvaluator::evalCheckingViewportDependentResults(const MediaQuerySet* querySet, Vector<std::unique_ptr<MediaQueryResult>>& results)
+{
+ if (!querySet)
+ return true;
+
+ auto& queries = querySet->queryVector();
+ if (!queries.size())
+ return true;
+
+ bool result = false;
+ for (size_t i = 0; i < queries.size() && !result; ++i) {
+ MediaQuery* query = queries[i].get();
+
+ if (query->ignored())
+ continue;
+
+ if (mediaTypeMatch(query->mediaType())) {
+ auto& expressions = query->expressions();
+ size_t j = 0;
+ for (; j < expressions.size(); ++j) {
+ bool exprResult = eval(expressions.at(j).get());
+ if (expressions.at(j)->isViewportDependent())
+ results.append(std::make_unique<MediaQueryResult>(*expressions.at(j), exprResult));
+ if (!exprResult)
+ break;
+ }
+ result = applyRestrictor(query->restrictor(), expressions.size() == j);
+ } else
+ result = applyRestrictor(query->restrictor(), false);
+ }
+
+ return result;
+}
+
</ins><span class="cx"> template<typename T>
</span><span class="cx"> bool compareValue(T a, T b, MediaFeaturePrefix op)
</span><span class="cx"> {
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebCorecssMediaQueryEvaluatorh"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/css/MediaQueryEvaluator.h (193951 => 193952)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/css/MediaQueryEvaluator.h        2015-12-11 10:01:16 UTC (rev 193951)
+++ branches/safari-601.1.46-branch/Source/WebCore/css/MediaQueryEvaluator.h        2015-12-11 10:01:24 UTC (rev 193952)
</span><span class="lines">@@ -28,6 +28,7 @@
</span><span class="cx"> #ifndef MediaQueryEvaluator_h
</span><span class="cx"> #define MediaQueryEvaluator_h
</span><span class="cx">
</span><ins>+#include "MediaQueryExp.h"
</ins><span class="cx"> #include <wtf/text/WTFString.h>
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -37,6 +38,19 @@
</span><span class="cx"> class RenderStyle;
</span><span class="cx"> class StyleResolver;
</span><span class="cx">
</span><ins>+class MediaQueryResult {
+ WTF_MAKE_NONCOPYABLE(MediaQueryResult); WTF_MAKE_FAST_ALLOCATED;
+public:
+ MediaQueryResult(const MediaQueryExp& expr, bool result)
+ : m_expression(expr)
+ , m_result(result)
+ {
+ }
+
+ MediaQueryExp m_expression;
+ bool m_result;
+};
+
</ins><span class="cx"> /**
</span><span class="cx"> * Class that evaluates css media queries as defined in
</span><span class="cx"> * CSS3 Module "Media Queries" (http://www.w3.org/TR/css3-mediaqueries/)
</span><span class="lines">@@ -78,6 +92,9 @@
</span><span class="cx">
</span><span class="cx"> /** Evaluates media query subexpression, ie "and (media-feature: value)" part */
</span><span class="cx"> bool eval(const MediaQueryExp*) const;
</span><ins>+
+ /* Evaluates a list of media queries and fills in a vector with any viewport-dependent results found. */
+ bool evalCheckingViewportDependentResults(const MediaQuerySet*, Vector<std::unique_ptr<MediaQueryResult>>&);
</ins><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> String m_mediaType;
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebCorecssStyleResolverh"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/css/StyleResolver.h (193951 => 193952)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/css/StyleResolver.h        2015-12-11 10:01:16 UTC (rev 193951)
+++ branches/safari-601.1.46-branch/Source/WebCore/css/StyleResolver.h        2015-12-11 10:01:24 UTC (rev 193952)
</span><span class="lines">@@ -28,7 +28,7 @@
</span><span class="cx"> #include "DocumentRuleSets.h"
</span><span class="cx"> #include "InspectorCSSOMWrappers.h"
</span><span class="cx"> #include "LinkHash.h"
</span><del>-#include "MediaQueryExp.h"
</del><ins>+#include "MediaQueryEvaluator.h"
</ins><span class="cx"> #include "RenderStyle.h"
</span><span class="cx"> #include "RuleFeature.h"
</span><span class="cx"> #include "RuleSet.h"
</span><span class="lines">@@ -93,19 +93,6 @@
</span><span class="cx"> class WebKitCSSFilterValue;
</span><span class="cx"> struct ResourceLoaderOptions;
</span><span class="cx">
</span><del>-class MediaQueryResult {
- WTF_MAKE_NONCOPYABLE(MediaQueryResult); WTF_MAKE_FAST_ALLOCATED;
-public:
- MediaQueryResult(const MediaQueryExp& expr, bool result)
- : m_expression(expr)
- , m_result(result)
- {
- }
-
- MediaQueryExp m_expression;
- bool m_result;
-};
-
</del><span class="cx"> enum StyleSharingBehavior {
</span><span class="cx"> AllowStyleSharing,
</span><span class="cx"> DisallowStyleSharing,
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebCoredomDocumentcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/dom/Document.cpp (193951 => 193952)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/dom/Document.cpp        2015-12-11 10:01:16 UTC (rev 193951)
+++ branches/safari-601.1.46-branch/Source/WebCore/dom/Document.cpp        2015-12-11 10:01:24 UTC (rev 193952)
</span><span class="lines">@@ -81,6 +81,7 @@
</span><span class="cx"> #include "HTMLMediaElement.h"
</span><span class="cx"> #include "HTMLNameCollection.h"
</span><span class="cx"> #include "HTMLParserIdioms.h"
</span><ins>+#include "HTMLPictureElement.h"
</ins><span class="cx"> #include "HTMLPlugInElement.h"
</span><span class="cx"> #include "HTMLScriptElement.h"
</span><span class="cx"> #include "HTMLStyleElement.h"
</span><span class="lines">@@ -3470,8 +3471,22 @@
</span><span class="cx"> {
</span><span class="cx"> if (m_mediaQueryMatcher)
</span><span class="cx"> m_mediaQueryMatcher->styleResolverChanged();
</span><ins>+
+ checkViewportDependentPictures();
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+void Document::checkViewportDependentPictures()
+{
+ Vector<HTMLPictureElement*, 16> changedPictures;
+ HashSet<HTMLPictureElement*>::iterator end = m_viewportDependentPictures.end();
+ for (HashSet<HTMLPictureElement*>::iterator it = m_viewportDependentPictures.begin(); it != end; ++it) {
+ if ((*it)->viewportChangeAffectedPicture())
+ changedPictures.append(*it);
+ }
+ for (auto* picture : changedPictures)
+ picture->sourcesChanged();
+}
+
</ins><span class="cx"> void Document::optimizedStyleSheetUpdateTimerFired()
</span><span class="cx"> {
</span><span class="cx"> styleResolverChanged(RecalcStyleIfNeeded);
</span><span class="lines">@@ -6738,4 +6753,14 @@
</span><span class="cx"> enforceSandboxFlags(SandboxOrigin);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void Document::addViewportDependentPicture(HTMLPictureElement& picture)
+{
+ m_viewportDependentPictures.add(&picture);
+}
+
+void Document::removeViewportDependentPicture(HTMLPictureElement& picture)
+{
+ m_viewportDependentPictures.remove(&picture);
+}
+
</ins><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebCoredomDocumenth"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/dom/Document.h (193951 => 193952)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/dom/Document.h        2015-12-11 10:01:16 UTC (rev 193951)
+++ branches/safari-601.1.46-branch/Source/WebCore/dom/Document.h        2015-12-11 10:01:24 UTC (rev 193952)
</span><span class="lines">@@ -114,6 +114,7 @@
</span><span class="cx"> class HTMLMapElement;
</span><span class="cx"> class HTMLMediaElement;
</span><span class="cx"> class HTMLNameCollection;
</span><ins>+class HTMLPictureElement;
</ins><span class="cx"> class HTMLScriptElement;
</span><span class="cx"> class HitTestRequest;
</span><span class="cx"> class HitTestResult;
</span><span class="lines">@@ -1280,6 +1281,9 @@
</span><span class="cx"> bool shouldEnforceContentDispositionAttachmentSandbox() const;
</span><span class="cx"> void applyContentDispositionAttachmentSandbox();
</span><span class="cx">
</span><ins>+ void addViewportDependentPicture(HTMLPictureElement&);
+ void removeViewportDependentPicture(HTMLPictureElement&);
+
</ins><span class="cx"> protected:
</span><span class="cx"> enum ConstructionFlags { Synthesized = 1, NonRenderedPlaceholder = 1 << 1 };
</span><span class="cx"> Document(Frame*, const URL&, unsigned = DefaultDocumentClass, unsigned constructionFlags = 0);
</span><span class="lines">@@ -1374,6 +1378,8 @@
</span><span class="cx"> void domCookieCacheExpiryTimerFired();
</span><span class="cx"> virtual void didLoadResourceSynchronously(const ResourceRequest&) override final;
</span><span class="cx">
</span><ins>+ void checkViewportDependentPictures();
+
</ins><span class="cx"> unsigned m_referencingNodeCount;
</span><span class="cx">
</span><span class="cx"> std::unique_ptr<StyleResolver> m_styleResolver;
</span><span class="lines">@@ -1596,6 +1602,8 @@
</span><span class="cx"> RefPtr<RenderStyle> m_savedPlaceholderRenderStyle;
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+ HashSet<HTMLPictureElement*> m_viewportDependentPictures;
+
</ins><span class="cx"> int m_loadEventDelayCount;
</span><span class="cx"> Timer m_loadEventDelayTimer;
</span><span class="cx">
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebCorehtmlHTMLImageElementcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/html/HTMLImageElement.cpp (193951 => 193952)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/html/HTMLImageElement.cpp        2015-12-11 10:01:16 UTC (rev 193951)
+++ branches/safari-601.1.46-branch/Source/WebCore/html/HTMLImageElement.cpp        2015-12-11 10:01:24 UTC (rev 193952)
</span><span class="lines">@@ -32,6 +32,7 @@
</span><span class="cx"> #include "HTMLDocument.h"
</span><span class="cx"> #include "HTMLFormElement.h"
</span><span class="cx"> #include "HTMLParserIdioms.h"
</span><ins>+#include "HTMLPictureElement.h"
</ins><span class="cx"> #include "HTMLSourceElement.h"
</span><span class="cx"> #include "HTMLSrcsetParser.h"
</span><span class="cx"> #include "MIMETypeRegistry.h"
</span><span class="lines">@@ -145,6 +146,9 @@
</span><span class="cx"> auto* parent = parentNode();
</span><span class="cx"> if (!is<HTMLPictureElement>(parent))
</span><span class="cx"> return { };
</span><ins>+ auto* picture = downcast<HTMLPictureElement>(parent);
+ picture->clearViewportDependentResults();
+ document().removeViewportDependentPicture(*picture);
</ins><span class="cx"> for (Node* child = parent->firstChild(); child && child != this; child = child->nextSibling()) {
</span><span class="cx"> if (!is<HTMLSourceElement>(*child))
</span><span class="cx"> continue;
</span><span class="lines">@@ -163,7 +167,10 @@
</span><span class="cx"> continue;
</span><span class="cx"> }
</span><span class="cx"> MediaQueryEvaluator evaluator(document().printing() ? "print" : "screen", document().frame(), computedStyle());
</span><del>- if (!evaluator.eval(MediaQuerySet::createAllowingDescriptionSyntax(source.media()).ptr()))
</del><ins>+ bool evaluation = evaluator.evalCheckingViewportDependentResults(source.mediaQuerySet(), picture->viewportDependentResults());
+ if (picture->hasViewportDependentResults())
+ document().addViewportDependentPicture(*picture);
+ if (!evaluation)
</ins><span class="cx"> continue;
</span><span class="cx">
</span><span class="cx"> float sourceSize = parseSizesAttribute(source.fastGetAttribute(sizesAttr).string(), document().renderView(), document().frame());
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebCorehtmlHTMLPictureElementcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/html/HTMLPictureElement.cpp (193951 => 193952)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/html/HTMLPictureElement.cpp        2015-12-11 10:01:16 UTC (rev 193951)
+++ branches/safari-601.1.46-branch/Source/WebCore/html/HTMLPictureElement.cpp        2015-12-11 10:01:24 UTC (rev 193952)
</span><span class="lines">@@ -37,6 +37,20 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+HTMLPictureElement::~HTMLPictureElement()
+{
+ if (hasViewportDependentResults())
+ document().removeViewportDependentPicture(*this);
+}
+
+void HTMLPictureElement::didMoveToNewDocument(Document* oldDocument)
+{
+ if (hasViewportDependentResults() && oldDocument)
+ oldDocument->removeViewportDependentPicture(*this);
+ HTMLElement::didMoveToNewDocument(oldDocument);
+ sourcesChanged();
+}
+
</ins><span class="cx"> Ref<HTMLPictureElement> HTMLPictureElement::create(const QualifiedName& tagName, Document& document)
</span><span class="cx"> {
</span><span class="cx"> return adoptRef(*new HTMLPictureElement(tagName, document));
</span><span class="lines">@@ -48,5 +62,16 @@
</span><span class="cx"> imageElement.selectImageSource();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+bool HTMLPictureElement::viewportChangeAffectedPicture()
+{
+ MediaQueryEvaluator evaluator(document().printing() ? "print" : "screen", document().frame(), computedStyle());
+ unsigned numResults = m_viewportDependentMediaQueryResults.size();
+ for (unsigned i = 0; i < numResults; i++) {
+ if (evaluator.eval(&m_viewportDependentMediaQueryResults[i]->m_expression) != m_viewportDependentMediaQueryResults[i]->m_result)
+ return true;
+ }
+ return false;
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+}
+
</ins></span></pre></div>
<a id="branchessafari601146branchSourceWebCorehtmlHTMLPictureElementh"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/html/HTMLPictureElement.h (193951 => 193952)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/html/HTMLPictureElement.h        2015-12-11 10:01:16 UTC (rev 193951)
+++ branches/safari-601.1.46-branch/Source/WebCore/html/HTMLPictureElement.h        2015-12-11 10:01:24 UTC (rev 193952)
</span><span class="lines">@@ -27,17 +27,30 @@
</span><span class="cx"> #define HTMLPictureElement_h
</span><span class="cx">
</span><span class="cx"> #include "HTMLElement.h"
</span><ins>+#include "MediaQueryEvaluator.h"
</ins><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><span class="cx"> class HTMLPictureElement final : public HTMLElement {
</span><span class="cx"> public:
</span><span class="cx"> static Ref<HTMLPictureElement> create(const QualifiedName&, Document&);
</span><ins>+ ~HTMLPictureElement();
</ins><span class="cx">
</span><span class="cx"> void sourcesChanged();
</span><span class="cx">
</span><ins>+ void clearViewportDependentResults() { m_viewportDependentMediaQueryResults.clear(); }
+ bool hasViewportDependentResults() const { return m_viewportDependentMediaQueryResults.size(); }
+ Vector<std::unique_ptr<MediaQueryResult>>& viewportDependentResults() { return m_viewportDependentMediaQueryResults; }
+
+ void didMoveToNewDocument(Document* oldDocument);
+
+ bool viewportChangeAffectedPicture();
+
</ins><span class="cx"> private:
</span><span class="cx"> HTMLPictureElement(const QualifiedName&, Document&);
</span><ins>+
+ Vector<std::unique_ptr<MediaQueryResult>> m_viewportDependentMediaQueryResults;
+
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebCorehtmlHTMLSourceElementcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/html/HTMLSourceElement.cpp (193951 => 193952)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/html/HTMLSourceElement.cpp        2015-12-11 10:01:16 UTC (rev 193951)
+++ branches/safari-601.1.46-branch/Source/WebCore/html/HTMLSourceElement.cpp        2015-12-11 10:01:24 UTC (rev 193952)
</span><span class="lines">@@ -167,6 +167,8 @@
</span><span class="cx"> {
</span><span class="cx"> HTMLElement::parseAttribute(name, value);
</span><span class="cx"> if (name == srcsetAttr || name == sizesAttr || name == mediaAttr || name == typeAttr) {
</span><ins>+ if (name == mediaAttr)
+ m_mediaQuerySet = MediaQuerySet::createAllowingDescriptionSyntax(value);
</ins><span class="cx"> auto* parent = parentNode();
</span><span class="cx"> if (is<HTMLPictureElement>(parent))
</span><span class="cx"> downcast<HTMLPictureElement>(*parent).sourcesChanged();
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebCorehtmlHTMLSourceElementh"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/html/HTMLSourceElement.h (193951 => 193952)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/html/HTMLSourceElement.h        2015-12-11 10:01:16 UTC (rev 193951)
+++ branches/safari-601.1.46-branch/Source/WebCore/html/HTMLSourceElement.h        2015-12-11 10:01:24 UTC (rev 193952)
</span><span class="lines">@@ -27,6 +27,7 @@
</span><span class="cx"> #define HTMLSourceElement_h
</span><span class="cx">
</span><span class="cx"> #include "HTMLElement.h"
</span><ins>+#include "MediaList.h"
</ins><span class="cx"> #include "Timer.h"
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -44,6 +45,8 @@
</span><span class="cx"> void scheduleErrorEvent();
</span><span class="cx"> void cancelPendingErrorEvent();
</span><span class="cx">
</span><ins>+ MediaQuerySet* mediaQuerySet() const { return m_mediaQuerySet.get(); }
+
</ins><span class="cx"> private:
</span><span class="cx"> HTMLSourceElement(const QualifiedName&, Document&);
</span><span class="cx">
</span><span class="lines">@@ -64,6 +67,7 @@
</span><span class="cx">
</span><span class="cx"> Timer m_errorEventTimer;
</span><span class="cx"> bool m_shouldRescheduleErrorEventOnResume { false };
</span><ins>+ RefPtr<MediaQuerySet> m_mediaQuerySet;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> } //namespace
</span></span></pre>
</div>
</div>
</body>
</html>