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

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

Issue 1670203002: Block HTML Imports from loading when inserted via innerHTML. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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
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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 bool m_firedLoad; 126 bool m_firedLoad;
127 bool m_loadedSheet; 127 bool m_loadedSheet;
128 bool m_fetchFollowingCORS; 128 bool m_fetchFollowingCORS;
129 }; 129 };
130 130
131 131
132 class CORE_EXPORT HTMLLinkElement final : public HTMLElement, public LinkLoaderC lient, private DOMSettableTokenListObserver { 132 class CORE_EXPORT HTMLLinkElement final : public HTMLElement, public LinkLoaderC lient, private DOMSettableTokenListObserver {
133 DEFINE_WRAPPERTYPEINFO(); 133 DEFINE_WRAPPERTYPEINFO();
134 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(HTMLLinkElement); 134 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(HTMLLinkElement);
135 public: 135 public:
136 static PassRefPtrWillBeRawPtr<HTMLLinkElement> create(Document&, bool create dByParser); 136 static PassRefPtrWillBeRawPtr<HTMLLinkElement> create(Document&, bool create dByParser, bool alreadyStarted = false);
dglazkov 2016/02/05 18:25:53 Can we use an enum bere? https://www.chromium.org
kouhei (in TOK) 2016/02/08 01:30:24 +1 I prefer extending "bool createdByParser" to en
137 ~HTMLLinkElement() override; 137 ~HTMLLinkElement() override;
138 138
139 KURL href() const; 139 KURL href() const;
140 const AtomicString& rel() const; 140 const AtomicString& rel() const;
141 String media() const { return m_media; } 141 String media() const { return m_media; }
142 String typeValue() const { return m_type; } 142 String typeValue() const { return m_type; }
143 String asValue() const { return m_as; } 143 String asValue() const { return m_as; }
144 const LinkRelAttribute& relAttribute() const { return m_relAttribute; } 144 const LinkRelAttribute& relAttribute() const { return m_relAttribute; }
145 DOMTokenList& relList() const { return static_cast<DOMTokenList&>(*m_relList ); } 145 DOMTokenList& relList() const { return static_cast<DOMTokenList&>(*m_relList ); }
146 146
(...skipping 23 matching lines...) Expand all
170 static void dispatchPendingLoadEvents(); 170 static void dispatchPendingLoadEvents();
171 171
172 // From LinkLoaderClient 172 // From LinkLoaderClient
173 bool shouldLoadLink() override; 173 bool shouldLoadLink() override;
174 174
175 // For LinkStyle 175 // For LinkStyle
176 bool loadLink(const String& type, const String& as, const KURL&); 176 bool loadLink(const String& type, const String& as, const KURL&);
177 bool isAlternate() const { return linkStyle()->isUnset() && m_relAttribute.i sAlternate(); } 177 bool isAlternate() const { return linkStyle()->isUnset() && m_relAttribute.i sAlternate(); }
178 bool shouldProcessStyle() { return linkResourceToProcess() && linkStyle(); } 178 bool shouldProcessStyle() { return linkResourceToProcess() && linkStyle(); }
179 bool isCreatedByParser() const { return m_createdByParser; } 179 bool isCreatedByParser() const { return m_createdByParser; }
180 bool isAlreadyStarted() const { return m_alreadyStarted; }
180 181
181 // Parse the icon size attribute into |iconSizes|, make this method public 182 // Parse the icon size attribute into |iconSizes|, make this method public
182 // visible for testing purpose. 183 // visible for testing purpose.
183 static void parseSizesAttribute(const AtomicString& value, Vector<IntSize>& iconSizes); 184 static void parseSizesAttribute(const AtomicString& value, Vector<IntSize>& iconSizes);
184 185
185 DECLARE_VIRTUAL_TRACE(); 186 DECLARE_VIRTUAL_TRACE();
186 187
187 private: 188 private:
188 HTMLLinkElement(Document&, bool createdByParser); 189 HTMLLinkElement(Document&, bool createdByParser, bool alreadyStarted);
dglazkov 2016/02/05 18:25:53 alreadyStarted is not clear in this context. What
189 190
190 LinkStyle* linkStyle() const; 191 LinkStyle* linkStyle() const;
191 LinkImport* linkImport() const; 192 LinkImport* linkImport() const;
192 LinkResource* linkResourceToProcess(); 193 LinkResource* linkResourceToProcess();
193 194
194 void process(); 195 void process();
195 static void processCallback(Node*); 196 static void processCallback(Node*);
196 197
197 // From Node and subclassses 198 // From Node and subclassses
198 void parseAttribute(const QualifiedName&, const AtomicString&, const AtomicS tring&) override; 199 void parseAttribute(const QualifiedName&, const AtomicString&, const AtomicS tring&) override;
(...skipping 23 matching lines...) Expand all
222 223
223 String m_type; 224 String m_type;
224 String m_as; 225 String m_as;
225 String m_media; 226 String m_media;
226 RefPtrWillBeMember<DOMSettableTokenList> m_sizes; 227 RefPtrWillBeMember<DOMSettableTokenList> m_sizes;
227 Vector<IntSize> m_iconSizes; 228 Vector<IntSize> m_iconSizes;
228 OwnPtrWillBeMember<RelList> m_relList; 229 OwnPtrWillBeMember<RelList> m_relList;
229 LinkRelAttribute m_relAttribute; 230 LinkRelAttribute m_relAttribute;
230 231
231 bool m_createdByParser; 232 bool m_createdByParser;
233 bool m_alreadyStarted;
232 bool m_isInShadowTree; 234 bool m_isInShadowTree;
233 }; 235 };
234 236
235 } // namespace blink 237 } // namespace blink
236 238
237 #endif // HTMLLinkElement_h 239 #endif // HTMLLinkElement_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698