Chromium Code Reviews| Index: Source/core/html/HTMLLinkElement.cpp |
| diff --git a/Source/core/html/HTMLLinkElement.cpp b/Source/core/html/HTMLLinkElement.cpp |
| index fbb7a1a97986d7c41135cd2e37e4d288f299d37b..3aec952231469c05250df7dd17f572f4fd653d52 100644 |
| --- a/Source/core/html/HTMLLinkElement.cpp |
| +++ b/Source/core/html/HTMLLinkElement.cpp |
| @@ -44,8 +44,10 @@ |
| #include "core/frame/FrameView.h" |
| #include "core/frame/LocalFrame.h" |
| #include "core/html/imports/LinkImport.h" |
| +#include "core/html/parser/CSSPreloadScanner.h" |
| #include "core/loader/FrameLoader.h" |
| #include "core/loader/FrameLoaderClient.h" |
| +#include "platform/text/SegmentedString.h" |
| #include "wtf/StdLibExtras.h" |
| namespace WebCore { |
| @@ -369,6 +371,7 @@ LinkStyle::LinkStyle(HTMLLinkElement* owner) |
| , m_loading(false) |
| , m_firedLoad(false) |
| , m_loadedSheet(false) |
| + , m_isPreloadScanning(true) |
| { |
| } |
| @@ -428,6 +431,19 @@ void LinkStyle::setCSSStyleSheet(const String& href, const KURL& baseURL, const |
| const_cast<CSSStyleSheetResource*>(cachedStyleSheet)->saveParsedStyleSheet(styleSheet); |
| } |
| +void LinkStyle::dataReceived(const CSSStyleSheetResource* cachedStyleSheet, const char* data, int length) |
| +{ |
| + if (m_isPreloadScanning) { |
| + m_isPreloadScanning = false; |
|
abarth-chromium
2014/03/05 00:27:35
Why do we only scan the first chunk? What if |len
|
| + CSSPreloadScanner m_preloadScanner; |
| + PreloadRequestStream pendingPreloads; |
| + m_preloadScanner.scan(data, SegmentedString(data), pendingPreloads); |
| + |
| + HTMLResourcePreloader m_preloader(&document()); |
| + m_preloader.takeAndPreload(pendingPreloads); |
| + } |
| +} |
| + |
| bool LinkStyle::sheetLoaded() |
| { |
| if (!styleSheetIsLoading()) { |