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

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

Issue 196743002: Parse the link element's size attribute (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Addressed comments Created 6 years, 9 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 KURL href() const; 126 KURL href() const;
127 const AtomicString& rel() const; 127 const AtomicString& rel() const;
128 String media() const { return m_media; } 128 String media() const { return m_media; }
129 String typeValue() const { return m_type; } 129 String typeValue() const { return m_type; }
130 const LinkRelAttribute& relAttribute() const { return m_relAttribute; } 130 const LinkRelAttribute& relAttribute() const { return m_relAttribute; }
131 131
132 const AtomicString& type() const; 132 const AtomicString& type() const;
133 133
134 IconType iconType() const; 134 IconType iconType() const;
135 135
136 // the icon size string as parsed from the HTML attribute 136 // the icon sizes as parsed from the HTML attribute
137 const AtomicString& iconSizes() const; 137 const Vector<IntSize>& iconSizes() const;
138 138
139 CSSStyleSheet* sheet() const { return linkStyle() ? linkStyle()->sheet() : 0 ; } 139 CSSStyleSheet* sheet() const { return linkStyle() ? linkStyle()->sheet() : 0 ; }
140 Document* import() const; 140 Document* import() const;
141 141
142 bool styleSheetIsLoading() const; 142 bool styleSheetIsLoading() const;
143 143
144 bool isImport() const { return linkImport(); } 144 bool isImport() const { return linkImport(); }
145 bool importOwnsLoader() const; 145 bool importOwnsLoader() const;
146 bool isDisabled() const { return linkStyle() && linkStyle()->isDisabled(); } 146 bool isDisabled() const { return linkStyle() && linkStyle()->isDisabled(); }
147 bool isEnabledViaScript() const { return linkStyle() && linkStyle()->isEnabl edViaScript(); } 147 bool isEnabledViaScript() const { return linkStyle() && linkStyle()->isEnabl edViaScript(); }
148 DOMSettableTokenList* sizes() const; 148 DOMSettableTokenList* sizes() const;
149 149
150 void dispatchPendingEvent(LinkEventSender*); 150 void dispatchPendingEvent(LinkEventSender*);
151 void scheduleEvent(); 151 void scheduleEvent();
152 void dispatchEventImmediately(); 152 void dispatchEventImmediately();
153 static void dispatchPendingLoadEvents(); 153 static void dispatchPendingLoadEvents();
154 154
155 // From LinkLoaderClient 155 // From LinkLoaderClient
156 virtual bool shouldLoadLink() OVERRIDE; 156 virtual bool shouldLoadLink() OVERRIDE;
157 157
158 // For LinkStyle 158 // For LinkStyle
159 bool loadLink(const String& type, const KURL&); 159 bool loadLink(const String& type, const KURL&);
160 bool isAlternate() const { return linkStyle()->isUnset() && m_relAttribute.i sAlternate(); } 160 bool isAlternate() const { return linkStyle()->isUnset() && m_relAttribute.i sAlternate(); }
161 bool shouldProcessStyle() { return linkResourceToProcess() && linkStyle(); } 161 bool shouldProcessStyle() { return linkResourceToProcess() && linkStyle(); }
162 bool isCreatedByParser() const { return m_createdByParser; } 162 bool isCreatedByParser() const { return m_createdByParser; }
163 163
164 // Parse the icon size attribute into |iconSizes|, make this method public
165 // visible for testing purpose.
166 static void parseSizesAttribute(const AtomicString& value, Vector<IntSize>* iconSizes);
167
164 private: 168 private:
165 virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERR IDE; 169 virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERR IDE;
166 170
167 LinkStyle* linkStyle() const; 171 LinkStyle* linkStyle() const;
168 LinkImport* linkImport() const; 172 LinkImport* linkImport() const;
169 LinkResource* linkResourceToProcess(); 173 LinkResource* linkResourceToProcess();
170 174
171 void process(); 175 void process();
172 static void processCallback(Node*); 176 static void processCallback(Node*);
173 177
(...skipping 16 matching lines...) Expand all
190 194
191 private: 195 private:
192 HTMLLinkElement(Document&, bool createdByParser); 196 HTMLLinkElement(Document&, bool createdByParser);
193 197
194 OwnPtr<LinkResource> m_link; 198 OwnPtr<LinkResource> m_link;
195 LinkLoader m_linkLoader; 199 LinkLoader m_linkLoader;
196 200
197 String m_type; 201 String m_type;
198 String m_media; 202 String m_media;
199 RefPtr<DOMSettableTokenList> m_sizes; 203 RefPtr<DOMSettableTokenList> m_sizes;
204 Vector<IntSize> m_iconSizes;
200 LinkRelAttribute m_relAttribute; 205 LinkRelAttribute m_relAttribute;
201 206
202 bool m_createdByParser; 207 bool m_createdByParser;
203 bool m_isInShadowTree; 208 bool m_isInShadowTree;
204 int m_beforeLoadRecurseCount; 209 int m_beforeLoadRecurseCount;
205 }; 210 };
206 211
207 } //namespace 212 } //namespace
208 213
209 #endif 214 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698