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

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

Issue 400763002: Adding relList attr to link and anchor element Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 5 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 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2003, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed. 5 * Copyright (C) 2003, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed.
6 * Copyright (C) 2009 Rob Buis (rwlbuis@gmail.com) 6 * Copyright (C) 2009 Rob Buis (rwlbuis@gmail.com)
7 * Copyright (C) 2011 Google Inc. All rights reserved. 7 * Copyright (C) 2011 Google Inc. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 if (value.is8Bit()) 130 if (value.is8Bit())
131 parseSizes(value.characters8(), value.length(), iconSizes); 131 parseSizes(value.characters8(), value.length(), iconSizes);
132 else 132 else
133 parseSizes(value.characters16(), value.length(), iconSizes); 133 parseSizes(value.characters16(), value.length(), iconSizes);
134 } 134 }
135 135
136 inline HTMLLinkElement::HTMLLinkElement(Document& document, bool createdByParser ) 136 inline HTMLLinkElement::HTMLLinkElement(Document& document, bool createdByParser )
137 : HTMLElement(linkTag, document) 137 : HTMLElement(linkTag, document)
138 , m_linkLoader(this) 138 , m_linkLoader(this)
139 , m_sizes(DOMSettableTokenList::create()) 139 , m_sizes(DOMSettableTokenList::create())
140 , m_relList(ClassList::create(this))
140 , m_createdByParser(createdByParser) 141 , m_createdByParser(createdByParser)
141 , m_isInShadowTree(false) 142 , m_isInShadowTree(false)
142 { 143 {
143 ScriptWrappable::init(this); 144 ScriptWrappable::init(this);
144 } 145 }
145 146
146 PassRefPtrWillBeRawPtr<HTMLLinkElement> HTMLLinkElement::create(Document& docume nt, bool createdByParser) 147 PassRefPtrWillBeRawPtr<HTMLLinkElement> HTMLLinkElement::create(Document& docume nt, bool createdByParser)
147 { 148 {
148 return adoptRefWillBeNoop(new HTMLLinkElement(document, createdByParser)); 149 return adoptRefWillBeNoop(new HTMLLinkElement(document, createdByParser));
149 } 150 }
150 151
151 HTMLLinkElement::~HTMLLinkElement() 152 HTMLLinkElement::~HTMLLinkElement()
152 { 153 {
153 #if !ENABLE(OILPAN) 154 #if !ENABLE(OILPAN)
154 m_link.clear(); 155 m_link.clear();
155 156
156 if (inDocument()) 157 if (inDocument())
157 document().styleEngine()->removeStyleSheetCandidateNode(this); 158 document().styleEngine()->removeStyleSheetCandidateNode(this);
158 #endif 159 #endif
159 160
160 linkLoadEventSender().cancelEvent(this); 161 linkLoadEventSender().cancelEvent(this);
161 } 162 }
162 163
163 void HTMLLinkElement::parseAttribute(const QualifiedName& name, const AtomicStri ng& value) 164 void HTMLLinkElement::parseAttribute(const QualifiedName& name, const AtomicStri ng& value)
164 { 165 {
165 if (name == relAttr) { 166 if (name == relAttr) {
166 m_relAttribute = LinkRelAttribute(value); 167 m_relAttribute = LinkRelAttribute(value);
168 m_relList->setValue(value);
167 process(); 169 process();
168 } else if (name == hrefAttr) { 170 } else if (name == hrefAttr) {
169 process(); 171 process();
170 } else if (name == typeAttr) { 172 } else if (name == typeAttr) {
171 m_type = value; 173 m_type = value;
172 process(); 174 process();
173 } else if (name == sizesAttr) { 175 } else if (name == sizesAttr) {
174 m_sizes->setValue(value); 176 m_sizes->setValue(value);
175 parseSizesAttribute(value, m_iconSizes); 177 parseSizesAttribute(value, m_iconSizes);
176 process(); 178 process();
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 KURL HTMLLinkElement::href() const 416 KURL HTMLLinkElement::href() const
415 { 417 {
416 return document().completeURL(getAttribute(hrefAttr)); 418 return document().completeURL(getAttribute(hrefAttr));
417 } 419 }
418 420
419 const AtomicString& HTMLLinkElement::rel() const 421 const AtomicString& HTMLLinkElement::rel() const
420 { 422 {
421 return getAttribute(relAttr); 423 return getAttribute(relAttr);
422 } 424 }
423 425
426 DOMTokenList* HTMLLinkElement::relList() const
Inactive 2014/07/17 19:37:57 Could return a DOMTokenList&
427 {
428 return m_relList.get();
Inactive 2014/07/17 19:37:57 You could lazy initialize m_relList here instead o
429 }
430
424 const AtomicString& HTMLLinkElement::type() const 431 const AtomicString& HTMLLinkElement::type() const
425 { 432 {
426 return getAttribute(typeAttr); 433 return getAttribute(typeAttr);
427 } 434 }
428 435
429 bool HTMLLinkElement::async() const 436 bool HTMLLinkElement::async() const
430 { 437 {
431 return fastHasAttribute(HTMLNames::asyncAttr); 438 return fastHasAttribute(HTMLNames::asyncAttr);
432 } 439 }
433 440
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
741 removePendingSheet(); 748 removePendingSheet();
742 } 749 }
743 750
744 void LinkStyle::trace(Visitor* visitor) 751 void LinkStyle::trace(Visitor* visitor)
745 { 752 {
746 visitor->trace(m_sheet); 753 visitor->trace(m_sheet);
747 LinkResource::trace(visitor); 754 LinkResource::trace(visitor);
748 } 755 }
749 756
750 } // namespace WebCore 757 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698