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

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

Issue 2424943002: Add ReferrerPolicy support to preload (Closed)
Patch Set: Fix test. Again Created 4 years, 2 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 // Log href attribute before logging resource fetching in process(). 72 // Log href attribute before logging resource fetching in process().
73 logUpdateAttributeIfIsolatedWorldAndInDocument("link", hrefAttr, oldValue, 73 logUpdateAttributeIfIsolatedWorldAndInDocument("link", hrefAttr, oldValue,
74 value); 74 value);
75 process(); 75 process();
76 } else if (name == typeAttr) { 76 } else if (name == typeAttr) {
77 m_type = value; 77 m_type = value;
78 process(); 78 process();
79 } else if (name == asAttr) { 79 } else if (name == asAttr) {
80 m_as = value; 80 m_as = value;
81 process(); 81 process();
82 } else if (name == referrerpolicyAttr) {
83 m_referrerPolicy = value;
Mike West 2016/10/23 05:25:46 Where do you take the page's referrer policy into
Yoav Weiss 2016/10/23 13:27:09 It's done at the consumers of HTMLLinkElement::ref
82 } else if (name == sizesAttr) { 84 } else if (name == sizesAttr) {
83 m_sizes->setValue(value); 85 m_sizes->setValue(value);
84 } else if (name == mediaAttr) { 86 } else if (name == mediaAttr) {
85 m_media = value.lower(); 87 m_media = value.lower();
86 process(); 88 process();
87 } else if (name == scopeAttr) { 89 } else if (name == scopeAttr) {
88 m_scope = value; 90 m_scope = value;
89 process(); 91 process();
90 } else if (name == disabledAttr) { 92 } else if (name == disabledAttr) {
91 UseCounter::count(document(), UseCounter::HTMLLinkElementDisabled); 93 UseCounter::count(document(), UseCounter::HTMLLinkElementDisabled);
92 if (LinkStyle* link = linkStyle()) 94 if (LinkStyle* link = linkStyle())
93 link->setDisabledState(!value.isNull()); 95 link->setDisabledState(!value.isNull());
94 } else { 96 } else {
95 if (name == titleAttr) { 97 if (name == titleAttr) {
96 if (LinkStyle* link = linkStyle()) 98 if (LinkStyle* link = linkStyle())
97 link->setSheetTitle(value, StyleEngine::UpdateActiveSheets); 99 link->setSheetTitle(value, StyleEngine::UpdateActiveSheets);
98 } 100 }
99 101
100 HTMLElement::parseAttribute(name, oldValue, value); 102 HTMLElement::parseAttribute(name, oldValue, value);
101 } 103 }
102 } 104 }
103 105
104 bool HTMLLinkElement::shouldLoadLink() { 106 bool HTMLLinkElement::shouldLoadLink() {
105 return isInDocumentTree() || (isConnected() && m_relAttribute.isStyleSheet()); 107 return isInDocumentTree() || (isConnected() && m_relAttribute.isStyleSheet());
106 } 108 }
107 109
108 bool HTMLLinkElement::loadLink(const String& type, 110 bool HTMLLinkElement::loadLink(const String& type,
109 const String& as, 111 const String& as,
110 const String& media, 112 const String& media,
113 const String& referrerPolicy,
111 const KURL& url) { 114 const KURL& url) {
112 return m_linkLoader->loadLink( 115 return m_linkLoader->loadLink(
113 m_relAttribute, 116 m_relAttribute,
114 crossOriginAttributeValue(fastGetAttribute(HTMLNames::crossoriginAttr)), 117 crossOriginAttributeValue(fastGetAttribute(HTMLNames::crossoriginAttr)),
115 type, as, media, url, document(), NetworkHintsInterfaceImpl()); 118 type, as, media, referrerPolicy, url, document(),
119 NetworkHintsInterfaceImpl());
116 } 120 }
117 121
118 LinkResource* HTMLLinkElement::linkResourceToProcess() { 122 LinkResource* HTMLLinkElement::linkResourceToProcess() {
119 if (!shouldLoadLink()) { 123 if (!shouldLoadLink()) {
120 DCHECK(!linkStyle() || !linkStyle()->hasSheet()); 124 DCHECK(!linkStyle() || !linkStyle()->hasSheet());
121 return nullptr; 125 return nullptr;
122 } 126 }
123 127
124 if (!m_link) { 128 if (!m_link) {
125 if (m_relAttribute.isImport()) { 129 if (m_relAttribute.isImport()) {
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 LinkLoaderClient::trace(visitor); 357 LinkLoaderClient::trace(visitor);
354 DOMTokenListObserver::trace(visitor); 358 DOMTokenListObserver::trace(visitor);
355 } 359 }
356 360
357 DEFINE_TRACE_WRAPPERS(HTMLLinkElement) { 361 DEFINE_TRACE_WRAPPERS(HTMLLinkElement) {
358 visitor->traceWrappers(m_relList); 362 visitor->traceWrappers(m_relList);
359 HTMLElement::traceWrappers(visitor); 363 HTMLElement::traceWrappers(visitor);
360 } 364 }
361 365
362 } // namespace blink 366 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698