| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | |
| 4 * Copyright (C) 2003, 2008, 2010 Apple Inc. All rights reserved. | |
| 5 * Copyright (C) 2011 Google Inc. All rights reserved. | |
| 6 * | |
| 7 * This library is free software; you can redistribute it and/or | |
| 8 * modify it under the terms of the GNU Library General Public | |
| 9 * License as published by the Free Software Foundation; either | |
| 10 * version 2 of the License, or (at your option) any later version. | |
| 11 * | |
| 12 * This library is distributed in the hope that it will be useful, | |
| 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 15 * Library General Public License for more details. | |
| 16 * | |
| 17 * You should have received a copy of the GNU Library General Public License | |
| 18 * along with this library; see the file COPYING.LIB. If not, write to | |
| 19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | |
| 20 * Boston, MA 02110-1301, USA. | |
| 21 * | |
| 22 */ | |
| 23 | |
| 24 #ifndef HTMLLinkElement_h | |
| 25 #define HTMLLinkElement_h | |
| 26 | |
| 27 #include "core/css/CSSStyleSheet.h" | |
| 28 #include "core/dom/DOMSettableTokenList.h" | |
| 29 #include "core/fetch/ResourceOwner.h" | |
| 30 #include "core/html/HTMLElement.h" | |
| 31 #include "core/html/LinkRelAttribute.h" | |
| 32 #include "core/html/LinkResource.h" | |
| 33 | |
| 34 namespace blink { | |
| 35 | |
| 36 class DocumentFragment; | |
| 37 class HTMLLinkElement; | |
| 38 class KURL; | |
| 39 class LinkImport; | |
| 40 | |
| 41 template<typename T> class EventSender; | |
| 42 typedef EventSender<HTMLLinkElement> LinkEventSender; | |
| 43 | |
| 44 class HTMLLinkElement final : public HTMLElement { | |
| 45 DEFINE_WRAPPERTYPEINFO(); | |
| 46 public: | |
| 47 static PassRefPtr<HTMLLinkElement> create(Document&, bool createdByParser); | |
| 48 virtual ~HTMLLinkElement(); | |
| 49 | |
| 50 KURL href() const; | |
| 51 const AtomicString& rel() const; | |
| 52 String media() const { return m_media; } | |
| 53 String typeValue() const { return m_type; } | |
| 54 const LinkRelAttribute& relAttribute() const { return m_relAttribute; } | |
| 55 | |
| 56 const AtomicString& type() const; | |
| 57 | |
| 58 // the icon sizes as parsed from the HTML attribute | |
| 59 const Vector<IntSize>& iconSizes() const; | |
| 60 | |
| 61 bool async() const; | |
| 62 String as() const; | |
| 63 | |
| 64 CSSStyleSheet* sheet() const { return 0; } | |
| 65 Document* import() const; | |
| 66 | |
| 67 bool isImport() const { return linkImport(); } | |
| 68 bool isDisabled() const { return false; } | |
| 69 | |
| 70 DOMSettableTokenList* sizes() const; | |
| 71 | |
| 72 void dispatchPendingEvent(LinkEventSender*); | |
| 73 void scheduleEvent(); | |
| 74 void dispatchEventImmediately(); | |
| 75 static void dispatchPendingLoadEvents(); | |
| 76 | |
| 77 // For LinkStyle | |
| 78 bool shouldProcessStyle() { return false; } | |
| 79 bool isCreatedByParser() const { return m_createdByParser; } | |
| 80 | |
| 81 // Parse the icon size attribute into |iconSizes|, make this method public | |
| 82 // visible for testing purpose. | |
| 83 static void parseSizesAttribute(const AtomicString& value, Vector<IntSize>&
iconSizes); | |
| 84 | |
| 85 virtual void trace(Visitor*) override; | |
| 86 | |
| 87 private: | |
| 88 virtual void parseAttribute(const QualifiedName&, const AtomicString&) overr
ide; | |
| 89 | |
| 90 LinkImport* linkImport() const; | |
| 91 LinkResource* linkResourceToProcess(); | |
| 92 | |
| 93 void process(); | |
| 94 static void processCallback(Node*); | |
| 95 | |
| 96 // From Node and subclassses | |
| 97 virtual InsertionNotificationRequest insertedInto(ContainerNode*) override; | |
| 98 virtual void removedFrom(ContainerNode*) override; | |
| 99 virtual bool isURLAttribute(const Attribute&) const override; | |
| 100 virtual bool hasLegalLinkAttribute(const QualifiedName&) const override; | |
| 101 virtual const QualifiedName& subResourceAttributeName() const override; | |
| 102 virtual void finishParsingChildren() override; | |
| 103 | |
| 104 private: | |
| 105 HTMLLinkElement(Document&, bool createdByParser); | |
| 106 | |
| 107 OwnPtr<LinkResource> m_link; | |
| 108 | |
| 109 String m_type; | |
| 110 String m_media; | |
| 111 RefPtr<DOMSettableTokenList> m_sizes; | |
| 112 Vector<IntSize> m_iconSizes; | |
| 113 LinkRelAttribute m_relAttribute; | |
| 114 | |
| 115 bool m_createdByParser; | |
| 116 bool m_isInShadowTree; | |
| 117 }; | |
| 118 | |
| 119 } // namespace blink | |
| 120 | |
| 121 #endif // HTMLLinkElement_h | |
| OLD | NEW |