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

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

Issue 2623513005: Introduce Element::AttributeModificationParams (Closed)
Patch Set: Created 3 years, 11 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 5 * Copyright (C) 2003, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights
6 * reserved. 6 * reserved.
7 * Copyright (C) 2009 Rob Buis (rwlbuis@gmail.com) 7 * Copyright (C) 2009 Rob Buis (rwlbuis@gmail.com)
8 * Copyright (C) 2011 Google Inc. All rights reserved. 8 * Copyright (C) 2011 Google Inc. All rights reserved.
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 m_relList(this, RelList::create(this)), 55 m_relList(this, RelList::create(this)),
56 m_createdByParser(createdByParser) {} 56 m_createdByParser(createdByParser) {}
57 57
58 HTMLLinkElement* HTMLLinkElement::create(Document& document, 58 HTMLLinkElement* HTMLLinkElement::create(Document& document,
59 bool createdByParser) { 59 bool createdByParser) {
60 return new HTMLLinkElement(document, createdByParser); 60 return new HTMLLinkElement(document, createdByParser);
61 } 61 }
62 62
63 HTMLLinkElement::~HTMLLinkElement() {} 63 HTMLLinkElement::~HTMLLinkElement() {}
64 64
65 void HTMLLinkElement::parseAttribute(const QualifiedName& name, 65 void HTMLLinkElement::parseAttribute(
66 const AtomicString& oldValue, 66 const AttributeModificationParams& params) {
67 const AtomicString& value) { 67 const QualifiedName& name = params.name;
68 const AtomicString& value = params.newValue;
68 if (name == relAttr) { 69 if (name == relAttr) {
69 m_relAttribute = LinkRelAttribute(value); 70 m_relAttribute = LinkRelAttribute(value);
70 m_relList->setRelValues(value); 71 m_relList->setRelValues(value);
71 process(); 72 process();
72 } else if (name == hrefAttr) { 73 } else if (name == hrefAttr) {
73 // Log href attribute before logging resource fetching in process(). 74 // Log href attribute before logging resource fetching in process().
74 logUpdateAttributeIfIsolatedWorldAndInDocument("link", hrefAttr, oldValue, 75 logUpdateAttributeIfIsolatedWorldAndInDocument("link", params);
75 value);
76 process(); 76 process();
77 } else if (name == typeAttr) { 77 } else if (name == typeAttr) {
78 m_type = value; 78 m_type = value;
79 process(); 79 process();
80 } else if (name == asAttr) { 80 } else if (name == asAttr) {
81 m_as = value; 81 m_as = value;
82 process(); 82 process();
83 } else if (name == referrerpolicyAttr) { 83 } else if (name == referrerpolicyAttr) {
84 m_referrerPolicy = ReferrerPolicyDefault; 84 m_referrerPolicy = ReferrerPolicyDefault;
85 if (!value.isNull()) 85 if (!value.isNull())
86 SecurityPolicy::referrerPolicyFromString(value, &m_referrerPolicy); 86 SecurityPolicy::referrerPolicyFromString(value, &m_referrerPolicy);
87 } else if (name == sizesAttr) { 87 } else if (name == sizesAttr) {
88 m_sizes->setValue(value); 88 m_sizes->setValue(value);
89 } else if (name == mediaAttr) { 89 } else if (name == mediaAttr) {
90 m_media = value.lower(); 90 m_media = value.lower();
91 process(); 91 process();
92 } else if (name == scopeAttr) { 92 } else if (name == scopeAttr) {
93 m_scope = value; 93 m_scope = value;
94 process(); 94 process();
95 } else if (name == disabledAttr) { 95 } else if (name == disabledAttr) {
96 UseCounter::count(document(), UseCounter::HTMLLinkElementDisabled); 96 UseCounter::count(document(), UseCounter::HTMLLinkElementDisabled);
97 if (LinkStyle* link = linkStyle()) 97 if (LinkStyle* link = linkStyle())
98 link->setDisabledState(!value.isNull()); 98 link->setDisabledState(!value.isNull());
99 } else { 99 } else {
100 if (name == titleAttr) { 100 if (name == titleAttr) {
101 if (LinkStyle* link = linkStyle()) 101 if (LinkStyle* link = linkStyle())
102 link->setSheetTitle(value); 102 link->setSheetTitle(value);
103 } 103 }
104 104
105 HTMLElement::parseAttribute(name, oldValue, value); 105 HTMLElement::parseAttribute(params);
106 } 106 }
107 } 107 }
108 108
109 bool HTMLLinkElement::shouldLoadLink() { 109 bool HTMLLinkElement::shouldLoadLink() {
110 return isInDocumentTree() || (isConnected() && m_relAttribute.isStyleSheet()); 110 return isInDocumentTree() || (isConnected() && m_relAttribute.isStyleSheet());
111 } 111 }
112 112
113 bool HTMLLinkElement::loadLink(const String& type, 113 bool HTMLLinkElement::loadLink(const String& type,
114 const String& as, 114 const String& as,
115 const String& media, 115 const String& media,
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 LinkLoaderClient::trace(visitor); 358 LinkLoaderClient::trace(visitor);
359 DOMTokenListObserver::trace(visitor); 359 DOMTokenListObserver::trace(visitor);
360 } 360 }
361 361
362 DEFINE_TRACE_WRAPPERS(HTMLLinkElement) { 362 DEFINE_TRACE_WRAPPERS(HTMLLinkElement) {
363 visitor->traceWrappers(m_relList); 363 visitor->traceWrappers(m_relList);
364 HTMLElement::traceWrappers(visitor); 364 HTMLElement::traceWrappers(visitor);
365 } 365 }
366 366
367 } // namespace blink 367 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLLinkElement.h ('k') | third_party/WebKit/Source/core/html/HTMLMapElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698