Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(667)

Side by Side Diff: Source/core/html/HTMLLinkElement.h

Issue 166633002: Prefetch @import files from CSS files. Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed according to Yoav´s comments Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/fetch/StyleSheetResourceClient.h ('k') | Source/core/html/HTMLLinkElement.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * Copyright (C) 2003, 2008, 2010 Apple Inc. All rights reserved. 4 * Copyright (C) 2003, 2008, 2010 Apple Inc. All rights reserved.
5 * Copyright (C) 2011 Google Inc. All rights reserved. 5 * Copyright (C) 2011 Google Inc. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 15 matching lines...) Expand all
26 26
27 #include "core/css/CSSStyleSheet.h" 27 #include "core/css/CSSStyleSheet.h"
28 #include "core/dom/DOMSettableTokenList.h" 28 #include "core/dom/DOMSettableTokenList.h"
29 #include "core/dom/IconURL.h" 29 #include "core/dom/IconURL.h"
30 #include "core/fetch/ResourceOwner.h" 30 #include "core/fetch/ResourceOwner.h"
31 #include "core/fetch/StyleSheetResource.h" 31 #include "core/fetch/StyleSheetResource.h"
32 #include "core/fetch/StyleSheetResourceClient.h" 32 #include "core/fetch/StyleSheetResourceClient.h"
33 #include "core/html/HTMLElement.h" 33 #include "core/html/HTMLElement.h"
34 #include "core/html/LinkRelAttribute.h" 34 #include "core/html/LinkRelAttribute.h"
35 #include "core/html/LinkResource.h" 35 #include "core/html/LinkResource.h"
36 #include "core/html/parser/BackgroundHTMLInputStream.h"
37 #include "core/html/parser/CSSPreloadScanner.h"
38 #include "core/html/parser/HTMLParserOptions.h"
39 #include "core/html/parser/HTMLTokenizer.h"
36 #include "core/loader/LinkLoader.h" 40 #include "core/loader/LinkLoader.h"
37 #include "core/loader/LinkLoaderClient.h" 41 #include "core/loader/LinkLoaderClient.h"
38 42
39 namespace blink { 43 namespace blink {
40 44
41 class HTMLLinkElement; 45 class HTMLLinkElement;
42 class KURL; 46 class KURL;
43 class LinkImport; 47 class LinkImport;
44 48
45 template<typename T> class EventSender; 49 template<typename T> class EventSender;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 bool hasSheet() const { return m_sheet; } 83 bool hasSheet() const { return m_sheet; }
80 bool isDisabled() const { return m_disabledState == Disabled; } 84 bool isDisabled() const { return m_disabledState == Disabled; }
81 bool isEnabledViaScript() const { return m_disabledState == EnabledViaScript ; } 85 bool isEnabledViaScript() const { return m_disabledState == EnabledViaScript ; }
82 bool isUnset() const { return m_disabledState == Unset; } 86 bool isUnset() const { return m_disabledState == Unset; }
83 87
84 CSSStyleSheet* sheet() const { return m_sheet.get(); } 88 CSSStyleSheet* sheet() const { return m_sheet.get(); }
85 89
86 private: 90 private:
87 // From StyleSheetResourceClient 91 // From StyleSheetResourceClient
88 virtual void setCSSStyleSheet(const String& href, const KURL& baseURL, const String& charset, const CSSStyleSheetResource*) override; 92 virtual void setCSSStyleSheet(const String& href, const KURL& baseURL, const String& charset, const CSSStyleSheetResource*) override;
93 virtual void dataReceived(const CSSStyleSheetResource* cachedStyleSheet) ove rride;
89 94
90 enum DisabledState { 95 enum DisabledState {
91 Unset, 96 Unset,
92 EnabledViaScript, 97 EnabledViaScript,
93 Disabled 98 Disabled
94 }; 99 };
95 100
96 enum PendingSheetType { 101 enum PendingSheetType {
97 None, 102 None,
98 NonBlocking, 103 NonBlocking,
99 Blocking 104 Blocking
100 }; 105 };
101 106
102 void clearSheet(); 107 void clearSheet();
103 void addPendingSheet(PendingSheetType); 108 void addPendingSheet(PendingSheetType);
104 void removePendingSheet(); 109 void removePendingSheet();
105 Document& document(); 110 Document& document();
106 111
107 RefPtrWillBeMember<CSSStyleSheet> m_sheet; 112 RefPtrWillBeMember<CSSStyleSheet> m_sheet;
113 BackgroundHTMLInputStream m_input;
114 OwnPtr<HTMLToken> m_token;
115 HTMLParserOptions m_options;
116 OwnPtr<HTMLTokenizer> m_tokenizer;
117 OwnPtr<CSSPreloadScanner> m_preloadScanner;
118 unsigned m_preloadLength;
108 DisabledState m_disabledState; 119 DisabledState m_disabledState;
109 PendingSheetType m_pendingSheetType; 120 PendingSheetType m_pendingSheetType;
110 bool m_loading; 121 bool m_loading;
111 bool m_firedLoad; 122 bool m_firedLoad;
112 bool m_loadedSheet; 123 bool m_loadedSheet;
113 }; 124 };
114 125
115 126
116 class HTMLLinkElement final : public HTMLElement, public LinkLoaderClient { 127 class HTMLLinkElement final : public HTMLElement, public LinkLoaderClient {
117 DEFINE_WRAPPERTYPEINFO(); 128 DEFINE_WRAPPERTYPEINFO();
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 Vector<IntSize> m_iconSizes; 219 Vector<IntSize> m_iconSizes;
209 LinkRelAttribute m_relAttribute; 220 LinkRelAttribute m_relAttribute;
210 221
211 bool m_createdByParser; 222 bool m_createdByParser;
212 bool m_isInShadowTree; 223 bool m_isInShadowTree;
213 }; 224 };
214 225
215 } // namespace blink 226 } // namespace blink
216 227
217 #endif // HTMLLinkElement_h 228 #endif // HTMLLinkElement_h
OLDNEW
« no previous file with comments | « Source/core/fetch/StyleSheetResourceClient.h ('k') | Source/core/html/HTMLLinkElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698