OLD | NEW |
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 10 matching lines...) Expand all Loading... |
21 * | 21 * |
22 */ | 22 */ |
23 | 23 |
24 #ifndef HTMLLinkElement_h | 24 #ifndef HTMLLinkElement_h |
25 #define HTMLLinkElement_h | 25 #define HTMLLinkElement_h |
26 | 26 |
27 #include "core/CoreExport.h" | 27 #include "core/CoreExport.h" |
28 #include "core/css/CSSStyleSheet.h" | 28 #include "core/css/CSSStyleSheet.h" |
29 #include "core/dom/DOMTokenList.h" | 29 #include "core/dom/DOMTokenList.h" |
30 #include "core/dom/IconURL.h" | 30 #include "core/dom/IconURL.h" |
| 31 #include "core/dom/IncrementLoadEventDelayCount.h" |
31 #include "core/dom/StyleEngineContext.h" | 32 #include "core/dom/StyleEngineContext.h" |
32 #include "core/fetch/ResourceOwner.h" | 33 #include "core/fetch/ResourceOwner.h" |
33 #include "core/fetch/StyleSheetResource.h" | 34 #include "core/fetch/StyleSheetResource.h" |
34 #include "core/fetch/StyleSheetResourceClient.h" | 35 #include "core/fetch/StyleSheetResourceClient.h" |
35 #include "core/html/HTMLElement.h" | 36 #include "core/html/HTMLElement.h" |
36 #include "core/html/LinkRelAttribute.h" | 37 #include "core/html/LinkRelAttribute.h" |
37 #include "core/html/LinkResource.h" | 38 #include "core/html/LinkResource.h" |
38 #include "core/html/RelList.h" | 39 #include "core/html/RelList.h" |
39 #include "core/loader/LinkLoader.h" | 40 #include "core/loader/LinkLoader.h" |
40 #include "core/loader/LinkLoaderClient.h" | 41 #include "core/loader/LinkLoaderClient.h" |
| 42 #include <memory> |
41 | 43 |
42 namespace blink { | 44 namespace blink { |
43 | 45 |
44 class HTMLLinkElement; | 46 class HTMLLinkElement; |
45 class KURL; | 47 class KURL; |
46 class LinkImport; | 48 class LinkImport; |
47 | 49 |
48 template<typename T> class EventSender; | |
49 using LinkEventSender = EventSender<HTMLLinkElement>; | |
50 | |
51 // | 50 // |
52 // LinkStyle handles dynamically change-able link resources, which is | 51 // LinkStyle handles dynamically change-able link resources, which is |
53 // typically @rel="stylesheet". | 52 // typically @rel="stylesheet". |
54 // | 53 // |
55 // It could be @rel="shortcut icon" or something else though. Each of | 54 // It could be @rel="shortcut icon" or something else though. Each of |
56 // types might better be handled by a separate class, but dynamically | 55 // types might better be handled by a separate class, but dynamically |
57 // changing @rel makes it harder to move such a design so we are | 56 // changing @rel makes it harder to move such a design so we are |
58 // sticking current way so far. | 57 // sticking current way so far. |
59 // | 58 // |
60 class LinkStyle final : public LinkResource, ResourceOwner<StyleSheetResource> { | 59 class LinkStyle final : public LinkResource, ResourceOwner<StyleSheetResource> { |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 Document* import() const; | 158 Document* import() const; |
160 | 159 |
161 bool styleSheetIsLoading() const; | 160 bool styleSheetIsLoading() const; |
162 | 161 |
163 bool isImport() const { return linkImport(); } | 162 bool isImport() const { return linkImport(); } |
164 bool isDisabled() const { return linkStyle() && linkStyle()->isDisabled(); } | 163 bool isDisabled() const { return linkStyle() && linkStyle()->isDisabled(); } |
165 bool isEnabledViaScript() const { return linkStyle() && linkStyle()->isEnabl
edViaScript(); } | 164 bool isEnabledViaScript() const { return linkStyle() && linkStyle()->isEnabl
edViaScript(); } |
166 | 165 |
167 DOMTokenList* sizes() const; | 166 DOMTokenList* sizes() const; |
168 | 167 |
169 void dispatchPendingEvent(LinkEventSender*); | 168 void dispatchPendingEvent(std::unique_ptr<IncrementLoadEventDelayCount>); |
170 void scheduleEvent(); | 169 void scheduleEvent(); |
171 void dispatchEventImmediately(); | |
172 static void dispatchPendingLoadEvents(); | |
173 | 170 |
174 // From LinkLoaderClient | 171 // From LinkLoaderClient |
175 bool shouldLoadLink() override; | 172 bool shouldLoadLink() override; |
176 | 173 |
177 // For LinkStyle | 174 // For LinkStyle |
178 bool loadLink(const String& type, const String& as, const String& media, con
st KURL&); | 175 bool loadLink(const String& type, const String& as, const String& media, con
st KURL&); |
179 bool isAlternate() const { return linkStyle()->isUnset() && m_relAttribute.i
sAlternate(); } | 176 bool isAlternate() const { return linkStyle()->isUnset() && m_relAttribute.i
sAlternate(); } |
180 bool shouldProcessStyle() { return linkResourceToProcess() && linkStyle(); } | 177 bool shouldProcessStyle() { return linkResourceToProcess() && linkStyle(); } |
181 bool isCreatedByParser() const { return m_createdByParser; } | 178 bool isCreatedByParser() const { return m_createdByParser; } |
182 | 179 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 Member<RelList> m_relList; | 225 Member<RelList> m_relList; |
229 LinkRelAttribute m_relAttribute; | 226 LinkRelAttribute m_relAttribute; |
230 String m_scope; | 227 String m_scope; |
231 | 228 |
232 bool m_createdByParser; | 229 bool m_createdByParser; |
233 }; | 230 }; |
234 | 231 |
235 } // namespace blink | 232 } // namespace blink |
236 | 233 |
237 #endif // HTMLLinkElement_h | 234 #endif // HTMLLinkElement_h |
OLD | NEW |