| Index: Source/WebCore/html/parser/HTMLPreloadScanner.cpp
|
| diff --git a/Source/WebCore/html/parser/HTMLPreloadScanner.cpp b/Source/WebCore/html/parser/HTMLPreloadScanner.cpp
|
| index 6f9b1778036f656976a7588e3c50f5a6591f691f..c939284f2c2e315fd7d4d56c3c0266c31a0b6cf1 100644
|
| --- a/Source/WebCore/html/parser/HTMLPreloadScanner.cpp
|
| +++ b/Source/WebCore/html/parser/HTMLPreloadScanner.cpp
|
| @@ -34,8 +34,6 @@
|
| #include "HTMLTokenizer.h"
|
| #include "InputTypeNames.h"
|
| #include "LinkRelAttribute.h"
|
| -#include "MediaList.h"
|
| -#include "MediaQueryEvaluator.h"
|
| #include <wtf/Functional.h>
|
| #include <wtf/MainThread.h>
|
|
|
| @@ -111,7 +109,6 @@ public:
|
| explicit StartTagScanner(TagId tagId)
|
| : m_tagId(tagId)
|
| , m_linkIsStyleSheet(false)
|
| - , m_linkMediaAttributeIsScreen(true)
|
| , m_inputIsImage(false)
|
| {
|
| }
|
| @@ -143,7 +140,7 @@ public:
|
| if (!shouldPreload())
|
| return nullptr;
|
|
|
| - OwnPtr<PreloadRequest> request = PreloadRequest::create(initiatorFor(m_tagId), m_urlToLoad, predictedBaseURL, resourceType());
|
| + OwnPtr<PreloadRequest> request = PreloadRequest::create(initiatorFor(m_tagId), m_urlToLoad, predictedBaseURL, resourceType(), m_mediaAttribute);
|
| request->setCrossOriginModeAllowsCookies(crossOriginModeAllowsCookies());
|
| request->setCharset(charset());
|
| return request.release();
|
| @@ -180,7 +177,7 @@ private:
|
| else if (match(attributeName, relAttr))
|
| m_linkIsStyleSheet = relAttributeIsStyleSheet(attributeValue);
|
| else if (match(attributeName, mediaAttr))
|
| - m_linkMediaAttributeIsScreen = linkMediaAttributeIsScreen(attributeValue);
|
| + m_mediaAttribute = attributeValue;
|
| } else if (m_tagId == InputTagId) {
|
| if (match(attributeName, srcAttr))
|
| setUrlToLoad(attributeValue);
|
| @@ -195,19 +192,6 @@ private:
|
| return rel.m_isStyleSheet && !rel.m_isAlternate && rel.m_iconType == InvalidIcon && !rel.m_isDNSPrefetch;
|
| }
|
|
|
| - static bool linkMediaAttributeIsScreen(const String& attributeValue)
|
| - {
|
| - if (attributeValue.isEmpty())
|
| - return true;
|
| - RefPtr<MediaQuerySet> mediaQueries = MediaQuerySet::createAllowingDescriptionSyntax(attributeValue);
|
| -
|
| - // Only preload screen media stylesheets. Used this way, the evaluator evaluates to true for any
|
| - // rules containing complex queries (full evaluation is possible but it requires a frame and a style selector which
|
| - // may be problematic here).
|
| - MediaQueryEvaluator mediaQueryEvaluator("screen");
|
| - return mediaQueryEvaluator.eval(mediaQueries.get());
|
| - }
|
| -
|
| void setUrlToLoad(const String& attributeValue)
|
| {
|
| // We only respect the first src/href, per HTML5:
|
| @@ -231,7 +215,7 @@ private:
|
| return CachedResource::Script;
|
| if (m_tagId == ImgTagId || (m_tagId == InputTagId && m_inputIsImage))
|
| return CachedResource::ImageResource;
|
| - if (m_tagId == LinkTagId && m_linkIsStyleSheet && m_linkMediaAttributeIsScreen)
|
| + if (m_tagId == LinkTagId && m_linkIsStyleSheet)
|
| return CachedResource::CSSStyleSheet;
|
| ASSERT_NOT_REACHED();
|
| return CachedResource::RawResource;
|
| @@ -242,7 +226,7 @@ private:
|
| if (m_urlToLoad.isEmpty())
|
| return false;
|
|
|
| - if (m_tagId == LinkTagId && (!m_linkIsStyleSheet || !m_linkMediaAttributeIsScreen))
|
| + if (m_tagId == LinkTagId && !m_linkIsStyleSheet)
|
| return false;
|
|
|
| if (m_tagId == InputTagId && !m_inputIsImage)
|
| @@ -261,7 +245,7 @@ private:
|
| String m_charset;
|
| String m_crossOriginMode;
|
| bool m_linkIsStyleSheet;
|
| - bool m_linkMediaAttributeIsScreen;
|
| + String m_mediaAttribute;
|
| bool m_inputIsImage;
|
| };
|
|
|
|
|