OLD | NEW |
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 26 matching lines...) Expand all Loading... |
37 #include "core/events/Event.h" | 37 #include "core/events/Event.h" |
38 #include "core/events/EventSender.h" | 38 #include "core/events/EventSender.h" |
39 #include "core/fetch/CSSStyleSheetResource.h" | 39 #include "core/fetch/CSSStyleSheetResource.h" |
40 #include "core/fetch/FetchRequest.h" | 40 #include "core/fetch/FetchRequest.h" |
41 #include "core/fetch/ResourceFetcher.h" | 41 #include "core/fetch/ResourceFetcher.h" |
42 #include "core/frame/FrameView.h" | 42 #include "core/frame/FrameView.h" |
43 #include "core/frame/LocalFrame.h" | 43 #include "core/frame/LocalFrame.h" |
44 #include "core/frame/SubresourceIntegrity.h" | 44 #include "core/frame/SubresourceIntegrity.h" |
45 #include "core/frame/UseCounter.h" | 45 #include "core/frame/UseCounter.h" |
46 #include "core/frame/csp/ContentSecurityPolicy.h" | 46 #include "core/frame/csp/ContentSecurityPolicy.h" |
| 47 #include "core/html/CrossOriginAttribute.h" |
47 #include "core/html/LinkManifest.h" | 48 #include "core/html/LinkManifest.h" |
48 #include "core/html/imports/LinkImport.h" | 49 #include "core/html/imports/LinkImport.h" |
49 #include "core/inspector/ConsoleMessage.h" | 50 #include "core/inspector/ConsoleMessage.h" |
50 #include "core/loader/FrameLoader.h" | 51 #include "core/loader/FrameLoader.h" |
51 #include "core/loader/FrameLoaderClient.h" | 52 #include "core/loader/FrameLoaderClient.h" |
52 #include "core/loader/NetworkHintsInterface.h" | 53 #include "core/loader/NetworkHintsInterface.h" |
53 #include "core/style/StyleInheritedData.h" | 54 #include "core/style/StyleInheritedData.h" |
54 #include "platform/RuntimeEnabledFeatures.h" | 55 #include "platform/RuntimeEnabledFeatures.h" |
55 #include "wtf/StdLibExtras.h" | 56 #include "wtf/StdLibExtras.h" |
56 | 57 |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 } | 196 } |
196 } | 197 } |
197 | 198 |
198 bool HTMLLinkElement::shouldLoadLink() | 199 bool HTMLLinkElement::shouldLoadLink() |
199 { | 200 { |
200 return inDocument(); | 201 return inDocument(); |
201 } | 202 } |
202 | 203 |
203 bool HTMLLinkElement::loadLink(const String& type, const String& as, const KURL&
url) | 204 bool HTMLLinkElement::loadLink(const String& type, const String& as, const KURL&
url) |
204 { | 205 { |
205 return m_linkLoader.loadLink(m_relAttribute, fastGetAttribute(HTMLNames::cro
ssoriginAttr), type, as, url, document(), NetworkHintsInterfaceImpl()); | 206 return m_linkLoader.loadLink(m_relAttribute, crossOriginAttributeValue(fastG
etAttribute(HTMLNames::crossoriginAttr)), type, as, url, document(), NetworkHint
sInterfaceImpl()); |
206 } | 207 } |
207 | 208 |
208 LinkResource* HTMLLinkElement::linkResourceToProcess() | 209 LinkResource* HTMLLinkElement::linkResourceToProcess() |
209 { | 210 { |
210 bool visible = inDocument() && !m_isInShadowTree; | 211 bool visible = inDocument() && !m_isInShadowTree; |
211 if (!visible) { | 212 if (!visible) { |
212 ASSERT(!linkStyle() || !linkStyle()->hasSheet()); | 213 ASSERT(!linkStyle() || !linkStyle()->hasSheet()); |
213 return nullptr; | 214 return nullptr; |
214 } | 215 } |
215 | 216 |
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
717 mediaQueryMatches = evaluator.eval(media.get()); | 718 mediaQueryMatches = evaluator.eval(media.get()); |
718 } | 719 } |
719 | 720 |
720 // Don't hold up layout tree construction and script execution on styles
heets | 721 // Don't hold up layout tree construction and script execution on styles
heets |
721 // that are not needed for the layout at the moment. | 722 // that are not needed for the layout at the moment. |
722 bool blocking = mediaQueryMatches && !m_owner->isAlternate(); | 723 bool blocking = mediaQueryMatches && !m_owner->isAlternate(); |
723 addPendingSheet(blocking ? Blocking : NonBlocking); | 724 addPendingSheet(blocking ? Blocking : NonBlocking); |
724 | 725 |
725 // Load stylesheets that are not needed for the layout immediately with
low priority. | 726 // Load stylesheets that are not needed for the layout immediately with
low priority. |
726 FetchRequest request = builder.build(blocking); | 727 FetchRequest request = builder.build(blocking); |
727 AtomicString crossOriginMode = m_owner->fastGetAttribute(HTMLNames::cros
soriginAttr); | 728 CrossOriginAttributeValue crossOrigin = crossOriginAttributeValue(m_owne
r->fastGetAttribute(HTMLNames::crossoriginAttr)); |
728 if (!crossOriginMode.isNull()) { | 729 if (crossOrigin != CrossOriginAttributeNotSet) { |
729 request.setCrossOriginAccessControl(document().securityOrigin(), cro
ssOriginMode); | 730 request.setCrossOriginAccessControl(document().securityOrigin(), cro
ssOrigin); |
730 setFetchFollowingCORS(); | 731 setFetchFollowingCORS(); |
731 } | 732 } |
732 setResource(CSSStyleSheetResource::fetch(request, document().fetcher()))
; | 733 setResource(CSSStyleSheetResource::fetch(request, document().fetcher()))
; |
733 | 734 |
734 if (!resource()) { | 735 if (!resource()) { |
735 // The request may have been denied if (for example) the stylesheet
is local and the document is remote, or if there was a Content Security Policy F
ailure. | 736 // The request may have been denied if (for example) the stylesheet
is local and the document is remote, or if there was a Content Security Policy F
ailure. |
736 m_loading = false; | 737 m_loading = false; |
737 removePendingSheet(); | 738 removePendingSheet(); |
738 notifyLoadedSheetAndAllCriticalSubresources(Node::ErrorOccurredLoadi
ngSubresource); | 739 notifyLoadedSheetAndAllCriticalSubresources(Node::ErrorOccurredLoadi
ngSubresource); |
739 } | 740 } |
(...skipping 20 matching lines...) Expand all Loading... |
760 removePendingSheet(); | 761 removePendingSheet(); |
761 } | 762 } |
762 | 763 |
763 DEFINE_TRACE(LinkStyle) | 764 DEFINE_TRACE(LinkStyle) |
764 { | 765 { |
765 visitor->trace(m_sheet); | 766 visitor->trace(m_sheet); |
766 LinkResource::trace(visitor); | 767 LinkResource::trace(visitor); |
767 } | 768 } |
768 | 769 |
769 } // namespace blink | 770 } // namespace blink |
OLD | NEW |