Avoid downloading the wrong image for <picture> elements.
authorhyatt@apple.com <hyatt@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 14 Jan 2016 19:13:26 +0000 (19:13 +0000)
committerhyatt@apple.com <hyatt@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 14 Jan 2016 19:13:26 +0000 (19:13 +0000)
https://bugs.webkit.org/show_bug.cgi?id=153027

Reviewed by Dean Jackson.

Source/WebCore:

Added test in fast/picture.

* html/HTMLImageElement.cpp:
(WebCore::HTMLImageElement::HTMLImageElement):
(WebCore::HTMLImageElement::~HTMLImageElement):
(WebCore::HTMLImageElement::createForJSConstructor):
(WebCore::HTMLImageElement::bestFitSourceFromPictureElement):
(WebCore::HTMLImageElement::insertedInto):
(WebCore::HTMLImageElement::removedFrom):
(WebCore::HTMLImageElement::pictureElement):
(WebCore::HTMLImageElement::setPictureElement):
(WebCore::HTMLImageElement::width):
* html/HTMLImageElement.h:
(WebCore::HTMLImageElement::hasShadowControls):
* html/HTMLPictureElement.h:
* html/parser/HTMLConstructionSite.cpp:
(WebCore::HTMLConstructionSite::createHTMLElement):
* html/parser/HTMLPreloadScanner.cpp:
(WebCore::TokenPreloadScanner::StartTagScanner::processAttribute):

Images that are built underneath a <picture> element are now connected
to that picture element via a setPictureNode call from the parser. This
ensures that the correct <source> elements are examined before checking the image.

This connection between images and their picture owners is handled using a static
HashMap in HTMLImageElement. This connection is made both from the parser and from
DOM insertions, and the map is queried now instead of looking directly at the
image's parentNode().

LayoutTests:

* fast/picture/image-picture-loads-1x-expected.txt: Added.
* fast/picture/image-picture-loads-1x.html: Added.

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

LayoutTests/ChangeLog
LayoutTests/fast/picture/hidpi-image-picture-loads-expected.txt [new file with mode: 0644]
LayoutTests/fast/picture/hidpi-image-picture-loads.html [new file with mode: 0644]
LayoutTests/platform/ios-simulator/TestExpectations
LayoutTests/platform/mac-yosemite/TestExpectations [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/html/HTMLImageElement.cpp
Source/WebCore/html/HTMLImageElement.h
Source/WebCore/html/HTMLPictureElement.h
Source/WebCore/html/parser/HTMLConstructionSite.cpp
Source/WebCore/html/parser/HTMLPreloadScanner.cpp

index b0f31a0..9a6c400 100644 (file)
@@ -1,3 +1,13 @@
+2016-01-14  Dave Hyatt  <hyatt@apple.com>
+
+        Avoid downloading the wrong image for <picture> elements.
+        https://bugs.webkit.org/show_bug.cgi?id=153027
+
+        Reviewed by Dean Jackson.
+
+        * fast/picture/image-picture-loads-1x-expected.txt: Added.
+        * fast/picture/image-picture-loads-1x.html: Added.
+
 2016-01-14  Youenn Fablet  <youenn.fablet@crf.canon.fr>
 
         Move streams/webkitGetUserMedia-shadowing-then.html to fast/mediastream
diff --git a/LayoutTests/fast/picture/hidpi-image-picture-loads-expected.txt b/LayoutTests/fast/picture/hidpi-image-picture-loads-expected.txt
new file mode 100644 (file)
index 0000000..fc0038c
--- /dev/null
@@ -0,0 +1,13 @@
+resources/image-set-4x.png - willSendRequest <NSURLRequest URL resources/image-set-4x.png, main document URL hidpi-image-picture-loads.html, http method GET> redirectResponse (null)
+resources/image-set-4x.png - willSendRequest <NSURLRequest URL resources/image-set-4x.png, main document URL hidpi-image-picture-loads.html, http method GET> redirectResponse (null)
+data:,b - willSendRequest <NSURLRequest URL data:,b, main document URL hidpi-image-picture-loads.html, http method GET> redirectResponse (null)
+hidpi-image-picture-loads.html - didFinishLoading
+resources/image-set-4x.png - didReceiveResponse <NSURLResponse resources/image-set-4x.png, http status code 0>
+resources/image-set-4x.png - didFinishLoading
+resources/image-set-4x.png - didReceiveResponse <NSURLResponse resources/image-set-4x.png, http status code 0>
+resources/image-set-4x.png - didFinishLoading
+data:,b - didReceiveResponse <NSURLResponse data:,b, http status code 0>
+data:,b - didFinishLoading
+   
+some text
+         
diff --git a/LayoutTests/fast/picture/hidpi-image-picture-loads.html b/LayoutTests/fast/picture/hidpi-image-picture-loads.html
new file mode 100644 (file)
index 0000000..518121f
--- /dev/null
@@ -0,0 +1,108 @@
+<!DOCTYPE html>
+       <script>
+        if (window.testRunner) {
+               testRunner.dumpAsText();
+            testRunner.dumpResourceLoadCallbacks();
+        }
+       </script>
+       <!-- simple picture construct -->
+       <picture>
+           <source media="(max-width: 400px)" sizes="400px" srcset="../hidpi/resources/image-set-1x.png?10001 400w, ../hidpi/resources/image-set-2x.png?10001 800w,
+               resources/image-set-4x.png?10001 1600w">
+           <source media="(max-width: 800px)" sizes="800px" srcset="../hidpi/resources/image-set-1x.png?10002 400w, ../hidpi/resources/image-set-2x.png?10002 800w,
+               resources/image-set-4x.png?10002 1600w">
+           <source media="(max-width: 1600px)" sizes="1600px" srcset="../hidpi/resources/image-set-1x.png?10003 400w, ../hidpi/resources/image-set-2x.png?10003 800w,
+               resources/image-set-4x.png?10003 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?10001 400w, ../hidpi/resources/image-set-2x.png?10001 800w,
+               resources/image-set-4x.png?10001 1600w">
+           <source media="(max-width: 800px)" sizes="800px" srcset="../hidpi/resources/image-set-1x.png?10002 400w, ../hidpi/resources/image-set-2x.png?10002 800w,
+               resources/image-set-4x.png?10002 1600w">
+           <source media="(max-width: 1600px)" sizes="1600px" srcset="../hidpi/resources/image-set-1x.png?10003 400w, ../hidpi/resources/image-set-2x.png?10003 800w,
+               resources/image-set-4x.png?10003 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?10001 400w, ../hidpi/resources/image-set-2x.png?10001 800w,
+               resources/image-set-4x.png?10001 1600w">
+           <source media="(max-width: 800px)" sizes="800px" srcset="../hidpi/resources/image-set-1x.png?10002 400w, ../hidpi/resources/image-set-2x.png?10002 800w,
+               resources/image-set-4x.png?10002 1600w">
+           <source media="(max-width: 1600px)" sizes="1600px" srcset="../hidpi/resources/image-set-1x.png?10003 400w, ../hidpi/resources/image-set-2x.png?10003 800w,
+               resources/image-set-4x.png?10003 1600w">
+           <img id="other_children" src="resources/blue_rect.jpg?1">
+       </picture>
+       <!-- source with unknown type - should be ignored -->
+       <picture>
+           <source media="(max-width: 400px)" sizes="400px" srcset="../hidpi/resources/image-set-1x.png?10001 400w, ../hidpi/resources/image-set-2x.png?10001 800w,
+               resources/image-set-4x.png?10001 1600w">
+           <source media="(max-width: 800px)" type="image/nonsense" sizes="800px" srcset="../hidpi/resources/image-set-1x.png?10002 400w, ../hidpi/resources/image-set-2x.png?10002 800w,
+               resources/image-set-4x.png?10002 1600w">
+           <source media="(max-width: 1600px)" sizes="1600px" srcset="../hidpi/resources/image-set-1x.png?10003 400w, ../hidpi/resources/image-set-2x.png?10003 800w,
+               resources/image-set-4x.png?10003 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?10001 400w, ../hidpi/resources/image-set-2x.png?10001 800w,
+               resources/image-set-4x.png?10001 1600w">
+           <source media="(max-width: 800px)" type="image/svg+xml" sizes="800px" srcset="../hidpi/resources/image-set-1x.png?10002 400w, ../hidpi/resources/image-set-2x.png?10002 800w,
+               resources/image-set-4x.png?10002 1600w">
+           <source media="(max-width: 1600px)" sizes="1600px" srcset="../hidpi/resources/image-set-1x.png?10003 400w, ../hidpi/resources/image-set-2x.png?10003 800w,
+               resources/image-set-4x.png?10003 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?10001 400w, ../hidpi/resources/image-set-2x.png?10001 800w,
+               resources/image-set-4x.png?10001 1600w">
+           <source media="(max-width: 800px)" type="" sizes="800px" srcset="../hidpi/resources/image-set-1x.png?10002 400w, ../hidpi/resources/image-set-2x.png?10002 800w,
+               resources/image-set-4x.png?10002 1600w">
+           <source media="(max-width: 1600px)" sizes="1600px" srcset="../hidpi/resources/image-set-1x.png?10003 400w, ../hidpi/resources/image-set-2x.png?10003 800w,
+               resources/image-set-4x.png?10003 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?10001 400w, ../hidpi/resources/image-set-2x.png?10001 800w,
+               resources/image-set-4x.png?10001 1600w">
+           <source media="(max-width: 800px)" type=" " sizes="800px" srcset="../hidpi/resources/image-set-1x.png?10002 400w, ../hidpi/resources/image-set-2x.png?10002 800w,
+               resources/image-set-4x.png?10002 1600w">
+           <source media="(max-width: 1600px)" sizes="1600px" srcset="../hidpi/resources/image-set-1x.png?10003 400w, ../hidpi/resources/image-set-2x.png?10003 800w,
+               resources/image-set-4x.png?10003 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?10001 400w, ../hidpi/resources/image-set-2x.png?10001 800w,
+               resources/image-set-4x.png?10001 1600w">
+           <source media="(max-width: 800px)" type="image/png;bla=bla" sizes="800px" srcset="../hidpi/resources/image-set-1x.png?10002 400w, ../hidpi/resources/image-set-2x.png?10002 800w,
+               resources/image-set-4x.png?10002 1600w">
+           <source media="(max-width: 1600px)" sizes="1600px" srcset="../hidpi/resources/image-set-1x.png?10003 400w, ../hidpi/resources/image-set-2x.png?10003 800w,
+               resources/image-set-4x.png?10003 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?10001 400w, ../hidpi/resources/image-set-2x.png?10001 800w,
+               resources/image-set-4x.png?10001 1600w">
+           <source media="(max-width: 800px)" sizes="800px" srcset=", ,  ">
+           <source media="(max-width: 1600px)" sizes="1600px" srcset="../hidpi/resources/image-set-1x.png?10003 400w, ../hidpi/resources/image-set-2x.png?10003 800w,
+               resources/image-set-4x.png?10003 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?10001 400w, ../hidpi/resources/image-set-2x.png?10001 800w,
+               resources/image-set-4x.png?10001 1600w">
+           <source media="(max-width: 800px)" sizes="800px">
+           <source media="(max-width: 1600px)" sizes="1600px" srcset="../hidpi/resources/image-set-1x.png?10003 400w, ../hidpi/resources/image-set-2x.png?10003 800w,
+               resources/image-set-4x.png?10003 1600w">
+           <img id="no_srcset" src="resources/blue_rect.jpg?1">
+       </picture>
+    <picture><source srcset="data:,b"><img src="resources/blue_rect.jpg?1"></picture>
index 5a0cb11..6a1c7c6 100644 (file)
@@ -2839,7 +2839,6 @@ webkit.org/b/152134 fast/events/ios/viewport-device-width-at-initial-scale-fast-
 webkit.org/b/152141 fast/picture/image-picture-1x.html [ Skip ]
 webkit.org/b/152141 fast/picture/image-picture-invalid.html [ Skip ]
 webkit.org/b/152141 fast/picture/image-picture-nested.html [ Skip ]
-webkit.org/b/153043 fast/picture/image-picture-loads-1x.html [ Skip ]
 webkit.org/b/152992 http/tests/loading/preload-picture-invalid.html [ Skip ]
 webkit.org/b/152992 http/tests/loading/preload-picture-nested.html [ Skip ]
 webkit.org/b/152992 http/tests/loading/preload-picture-sizes.html [ Skip ]
diff --git a/LayoutTests/platform/mac-yosemite/TestExpectations b/LayoutTests/platform/mac-yosemite/TestExpectations
new file mode 100644 (file)
index 0000000..ef5d126
--- /dev/null
@@ -0,0 +1 @@
+webkit.org/b/153027 fast/picture/hidpi-image-picture-loads.html [ Skip ]
index aadd4d5..e2b5d81 100644 (file)
@@ -1,3 +1,39 @@
+2016-01-14  Dave Hyatt  <hyatt@apple.com>
+
+        Avoid downloading the wrong image for <picture> elements.
+        https://bugs.webkit.org/show_bug.cgi?id=153027
+
+        Reviewed by Dean Jackson.
+
+        Added test in fast/picture.
+
+        * html/HTMLImageElement.cpp:
+        (WebCore::HTMLImageElement::HTMLImageElement):
+        (WebCore::HTMLImageElement::~HTMLImageElement):
+        (WebCore::HTMLImageElement::createForJSConstructor):
+        (WebCore::HTMLImageElement::bestFitSourceFromPictureElement):
+        (WebCore::HTMLImageElement::insertedInto):
+        (WebCore::HTMLImageElement::removedFrom):
+        (WebCore::HTMLImageElement::pictureElement):
+        (WebCore::HTMLImageElement::setPictureElement):
+        (WebCore::HTMLImageElement::width):
+        * html/HTMLImageElement.h:
+        (WebCore::HTMLImageElement::hasShadowControls):
+        * html/HTMLPictureElement.h:
+        * html/parser/HTMLConstructionSite.cpp:
+        (WebCore::HTMLConstructionSite::createHTMLElement):
+        * html/parser/HTMLPreloadScanner.cpp:
+        (WebCore::TokenPreloadScanner::StartTagScanner::processAttribute):
+
+        Images that are built underneath a <picture> element are now connected
+        to that picture element via a setPictureNode call from the parser. This
+        ensures that the correct <source> elements are examined before checking the image.
+
+        This connection between images and their picture owners is handled using a static
+        HashMap in HTMLImageElement. This connection is made both from the parser and from
+        DOM insertions, and the map is queried now instead of looking directly at the
+        image's parentNode().
+
 2016-01-14  Commit Queue  <commit-queue@webkit.org>
 
         Unreviewed, rolling out r195002.
index b611f07..db62972 100644 (file)
@@ -53,6 +53,9 @@ namespace WebCore {
 
 using namespace HTMLNames;
 
+typedef HashMap<const HTMLImageElement*, WeakPtr<HTMLPictureElement>> PictureOwnerMap;
+static PictureOwnerMap* gPictureOwnerMap = nullptr;
+
 HTMLImageElement::HTMLImageElement(const QualifiedName& tagName, Document& document, HTMLFormElement* form)
     : HTMLElement(tagName, document)
     , m_imageLoader(*this)
@@ -82,6 +85,7 @@ HTMLImageElement::~HTMLImageElement()
 {
     if (m_form)
         m_form->removeImgElement(this);
+    setPictureElement(nullptr);
 }
 
 Ref<HTMLImageElement> HTMLImageElement::createForJSConstructor(Document& document, const int* optionalWidth, const int* optionalHeight)
@@ -140,13 +144,12 @@ void HTMLImageElement::setBestFitURLAndDPRFromImageCandidate(const ImageCandidat
 
 ImageCandidate HTMLImageElement::bestFitSourceFromPictureElement()
 {
-    auto* parent = parentNode();
-    if (!is<HTMLPictureElement>(parent))
+    auto* picture = pictureElement();
+    if (!picture)
         return { };
-    auto* picture = downcast<HTMLPictureElement>(parent);
     picture->clearViewportDependentResults();
     document().removeViewportDependentPicture(*picture);
-    for (Node* child = parent->firstChild(); child && child != this; child = child->nextSibling()) {
+    for (Node* child = picture->firstChild(); child && child != this; child = child->nextSibling()) {
         if (!is<HTMLSourceElement>(*child))
             continue;
         auto& source = downcast<HTMLSourceElement>(*child);
@@ -163,7 +166,7 @@ ImageCandidate HTMLImageElement::bestFitSourceFromPictureElement()
             if (!type.isEmpty() && !MIMETypeRegistry::isSupportedImageMIMEType(type) && type != "image/svg+xml")
                 continue;
         }
-        MediaQueryEvaluator evaluator(document().printing() ? "print" : "screen", document().frame(), computedStyle());
+        MediaQueryEvaluator evaluator(document().printing() ? "print" : "screen", document().frame(), document().documentElement() ? document().documentElement()->computedStyle() : nullptr);
         bool evaluation = evaluator.evalCheckingViewportDependentResults(source.mediaQuerySet(), picture->viewportDependentResults());
         if (picture->hasViewportDependentResults())
             document().addViewportDependentPicture(*picture);
@@ -313,8 +316,10 @@ Node::InsertionNotificationRequest HTMLImageElement::insertedInto(ContainerNode&
     if (insertionPoint.inDocument() && !m_lowercasedUsemap.isNull())
         document().addImageElementByLowercasedUsemap(*m_lowercasedUsemap.impl(), *this);
 
-    if (is<HTMLPictureElement>(parentNode()))
+    if (is<HTMLPictureElement>(parentNode())) {
+        setPictureElement(&downcast<HTMLPictureElement>(*parentNode()));
         selectImageSource();
+    }
 
     // If we have been inserted from a renderer-less document,
     // our loader may have not fetched the image, so do it now.
@@ -331,11 +336,37 @@ void HTMLImageElement::removedFrom(ContainerNode& insertionPoint)
 
     if (insertionPoint.inDocument() && !m_lowercasedUsemap.isNull())
         document().removeImageElementByLowercasedUsemap(*m_lowercasedUsemap.impl(), *this);
-
+    
+    if (is<HTMLPictureElement>(parentNode()))
+        setPictureElement(nullptr);
+    
     m_form = nullptr;
     HTMLElement::removedFrom(insertionPoint);
 }
 
+HTMLPictureElement* HTMLImageElement::pictureElement() const
+{
+    if (!gPictureOwnerMap || !gPictureOwnerMap->contains(this))
+        return nullptr;
+    HTMLPictureElement* result = gPictureOwnerMap->get(this).get();
+    if (!result)
+        gPictureOwnerMap->remove(this);
+    return result;
+}
+    
+void HTMLImageElement::setPictureElement(HTMLPictureElement* pictureElement)
+{
+    if (!pictureElement) {
+        if (gPictureOwnerMap)
+            gPictureOwnerMap->remove(this);
+        return;
+    }
+    
+    if (!gPictureOwnerMap)
+        gPictureOwnerMap = new PictureOwnerMap();
+    gPictureOwnerMap->add(this, pictureElement->createWeakPtr());
+}
+    
 int HTMLImageElement::width(bool ignorePendingStylesheets)
 {
     if (!renderer()) {
index 199e8c0..447b624 100644 (file)
@@ -87,6 +87,9 @@ public:
     virtual const AtomicString& imageSourceURL() const override;
 
     bool hasShadowControls() const { return m_experimentalImageMenuEnabled; }
+    
+    HTMLPictureElement* pictureElement() const;
+    void setPictureElement(HTMLPictureElement*);
 
 protected:
     HTMLImageElement(const QualifiedName&, Document&, HTMLFormElement* = 0);
@@ -127,6 +130,7 @@ private:
     HTMLImageLoader m_imageLoader;
     HTMLFormElement* m_form;
     HTMLFormElement* m_formSetByParser;
+
     CompositeOperator m_compositeOperator;
     AtomicString m_bestFitImageURL;
     AtomicString m_currentSrc;
index 20b917d..abd47c0 100644 (file)
@@ -46,9 +46,12 @@ public:
     
     bool viewportChangeAffectedPicture();
 
+    WeakPtr<HTMLPictureElement> createWeakPtr() { return m_weakFactory.createWeakPtr(); }
+
 private:
     HTMLPictureElement(const QualifiedName&, Document&);
     
+    WeakPtrFactory<HTMLPictureElement> m_weakFactory { this };
     Vector<std::unique_ptr<MediaQueryResult>> m_viewportDependentMediaQueryResults;
 
 };
index 8f283da..6c24eea 100644 (file)
 #include "HTMLElementFactory.h"
 #include "HTMLFormElement.h"
 #include "HTMLHtmlElement.h"
+#include "HTMLImageElement.h"
 #include "HTMLOptGroupElement.h"
 #include "HTMLOptionElement.h"
 #include "HTMLParserIdioms.h"
+#include "HTMLPictureElement.h"
 #include "HTMLScriptElement.h"
 #include "HTMLTemplateElement.h"
 #include "NotImplemented.h"
@@ -640,6 +642,13 @@ PassRefPtr<Element> HTMLConstructionSite::createHTMLElement(AtomicHTMLToken* tok
     Document& ownerDocument = ownerDocumentForCurrentNode();
     bool insideTemplateElement = !ownerDocument.frame();
     RefPtr<Element> element = HTMLElementFactory::createElement(tagName, ownerDocument, insideTemplateElement ? nullptr : form(), true);
+    
+    // FIXME: This is a hack to connect images to pictures before the image has
+    // been inserted into the document. It can be removed once asynchronous image
+    // loading is working.
+    if (is<HTMLPictureElement>(currentNode()) && is<HTMLImageElement>(*element.get()))
+        downcast<HTMLImageElement>(*element.get()).setPictureElement(&downcast<HTMLPictureElement>(currentNode()));
+
     setAttributes(element.get(), token, m_parserContentPolicy);
     ASSERT(element->isHTMLElement());
     return element.release();
index d8304dc..2a8168f 100644 (file)
@@ -208,7 +208,7 @@ private:
                 m_mediaAttribute = attributeValue;
                 Ref<MediaQuerySet> mediaSet = MediaQuerySet::createAllowingDescriptionSyntax(attributeValue);
                 Vector<std::unique_ptr<MediaQueryResult>> viewportDependentMediaQueryResults;
-                MediaQueryEvaluator evaluator(document.printing() ? "print" : "screen", document.frame(), document.documentElement()->computedStyle());
+                MediaQueryEvaluator evaluator(document.printing() ? "print" : "screen", document.frame(), document.documentElement() ? document.documentElement()->computedStyle() : nullptr);
                 m_mediaMatched = evaluator.evalCheckingViewportDependentResults(mediaSet.ptr(), viewportDependentMediaQueryResults);
             }
             break;