diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
commit | 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch) | |
tree | 46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/WebCore/html/parser/HTMLPreloadScanner.h | |
parent | 32761a6cee1d0dee366b885b7b9c777e67885688 (diff) | |
download | WebKitGtk-tarball-master.tar.gz |
webkitgtk-2.16.5HEADwebkitgtk-2.16.5master
Diffstat (limited to 'Source/WebCore/html/parser/HTMLPreloadScanner.h')
-rw-r--r-- | Source/WebCore/html/parser/HTMLPreloadScanner.h | 82 |
1 files changed, 21 insertions, 61 deletions
diff --git a/Source/WebCore/html/parser/HTMLPreloadScanner.h b/Source/WebCore/html/parser/HTMLPreloadScanner.h index 963c6b92e..8181da74a 100644 --- a/Source/WebCore/html/parser/HTMLPreloadScanner.h +++ b/Source/WebCore/html/parser/HTMLPreloadScanner.h @@ -24,42 +24,24 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef HTMLPreloadScanner_h -#define HTMLPreloadScanner_h +#pragma once #include "CSSPreloadScanner.h" -#include "HTMLToken.h" +#include "HTMLTokenizer.h" #include "SegmentedString.h" -#include <wtf/Vector.h> namespace WebCore { -typedef size_t TokenPreloadScannerCheckpoint; - -class HTMLParserOptions; -class HTMLTokenizer; -class SegmentedString; - class TokenPreloadScanner { - WTF_MAKE_NONCOPYABLE(TokenPreloadScanner); WTF_MAKE_FAST_ALLOCATED; + WTF_MAKE_NONCOPYABLE(TokenPreloadScanner); public: explicit TokenPreloadScanner(const URL& documentURL, float deviceScaleFactor = 1.0); - ~TokenPreloadScanner(); - void scan(const HTMLToken&, PreloadRequestStream& requests); + void scan(const HTMLToken&, PreloadRequestStream&, Document&); void setPredictedBaseElementURL(const URL& url) { m_predictedBaseElementURL = url; } - - // A TokenPreloadScannerCheckpoint is valid until the next call to rewindTo, - // at which point all outstanding checkpoints are invalidated. - TokenPreloadScannerCheckpoint createCheckpoint(); - void rewindTo(TokenPreloadScannerCheckpoint); - - bool isSafeToSendToAnotherThread() - { - return m_documentURL.isSafeToSendToAnotherThread() - && m_predictedBaseElementURL.isSafeToSendToAnotherThread(); - } + + bool inPicture() { return !m_pictureSourceState.isEmpty(); } private: enum class TagId { @@ -68,12 +50,15 @@ private: Input, Link, Script, + Meta, + Source, // These tags are not scanned by the StartTagScanner. Unknown, Style, Base, Template, + Picture }; class StartTagScanner; @@ -82,59 +67,34 @@ private: static String initiatorFor(TagId); - template<typename Token> - void updatePredictedBaseURL(const Token&); - - struct Checkpoint { - Checkpoint(const URL& predictedBaseElementURL, bool inStyle -#if ENABLE(TEMPLATE_ELEMENT) - , size_t templateCount -#endif - ) - : predictedBaseElementURL(predictedBaseElementURL) - , inStyle(inStyle) -#if ENABLE(TEMPLATE_ELEMENT) - , templateCount(templateCount) -#endif - { - } - - URL predictedBaseElementURL; - bool inStyle; -#if ENABLE(TEMPLATE_ELEMENT) - size_t templateCount; -#endif - }; + void updatePredictedBaseURL(const HTMLToken&); CSSPreloadScanner m_cssScanner; const URL m_documentURL; - URL m_predictedBaseElementURL; - bool m_inStyle; - float m_deviceScaleFactor; + const float m_deviceScaleFactor { 1 }; -#if ENABLE(TEMPLATE_ELEMENT) - size_t m_templateCount; -#endif + URL m_predictedBaseElementURL; + bool m_inStyle { false }; + + Vector<bool> m_pictureSourceState; - Vector<Checkpoint> m_checkpoints; + unsigned m_templateCount { 0 }; }; class HTMLPreloadScanner { - WTF_MAKE_NONCOPYABLE(HTMLPreloadScanner); WTF_MAKE_FAST_ALLOCATED; + WTF_MAKE_FAST_ALLOCATED; public: HTMLPreloadScanner(const HTMLParserOptions&, const URL& documentURL, float deviceScaleFactor = 1.0); - ~HTMLPreloadScanner(); void appendToEnd(const SegmentedString&); - void scan(HTMLResourcePreloader*, const URL& documentBaseElementURL); + void scan(HTMLResourcePreloader&, Document&); private: TokenPreloadScanner m_scanner; SegmentedString m_source; - HTMLToken m_token; - std::unique_ptr<HTMLTokenizer> m_tokenizer; + HTMLTokenizer m_tokenizer; }; -} +WEBCORE_EXPORT bool testPreloadScannerViewportSupport(Document*); -#endif +} // namespace WebCore |