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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 #include "core/frame/UseCounter.h" | 44 #include "core/frame/UseCounter.h" |
45 #include "core/frame/csp/ContentSecurityPolicy.h" | 45 #include "core/frame/csp/ContentSecurityPolicy.h" |
46 #include "core/html/CrossOriginAttribute.h" | 46 #include "core/html/CrossOriginAttribute.h" |
47 #include "core/html/LinkManifest.h" | 47 #include "core/html/LinkManifest.h" |
48 #include "core/html/imports/LinkImport.h" | 48 #include "core/html/imports/LinkImport.h" |
49 #include "core/inspector/ConsoleMessage.h" | 49 #include "core/inspector/ConsoleMessage.h" |
50 #include "core/loader/FrameLoader.h" | 50 #include "core/loader/FrameLoader.h" |
51 #include "core/loader/FrameLoaderClient.h" | 51 #include "core/loader/FrameLoaderClient.h" |
52 #include "core/loader/NetworkHintsInterface.h" | 52 #include "core/loader/NetworkHintsInterface.h" |
53 #include "core/style/StyleInheritedData.h" | 53 #include "core/style/StyleInheritedData.h" |
| 54 #include "platform/ContentType.h" |
| 55 #include "platform/MIMETypeRegistry.h" |
54 #include "platform/RuntimeEnabledFeatures.h" | 56 #include "platform/RuntimeEnabledFeatures.h" |
55 #include "public/platform/Platform.h" | 57 #include "public/platform/Platform.h" |
56 #include "wtf/StdLibExtras.h" | 58 #include "wtf/StdLibExtras.h" |
57 | 59 |
58 namespace blink { | 60 namespace blink { |
59 | 61 |
60 using namespace HTMLNames; | 62 using namespace HTMLNames; |
61 | 63 |
62 template <typename CharacterType> | 64 template <typename CharacterType> |
63 static void parseSizes(const CharacterType* value, unsigned length, Vector<IntSi
ze>& iconSizes) | 65 static void parseSizes(const CharacterType* value, unsigned length, Vector<IntSi
ze>& iconSizes) |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 iconSizes.append(IntSize(width, height)); | 121 iconSizes.append(IntSize(width, height)); |
120 } | 122 } |
121 } | 123 } |
122 | 124 |
123 static LinkEventSender& linkLoadEventSender() | 125 static LinkEventSender& linkLoadEventSender() |
124 { | 126 { |
125 DEFINE_STATIC_LOCAL(OwnPtrWillBePersistent<LinkEventSender>, sharedLoadEvent
Sender, (LinkEventSender::create(EventTypeNames::load))); | 127 DEFINE_STATIC_LOCAL(OwnPtrWillBePersistent<LinkEventSender>, sharedLoadEvent
Sender, (LinkEventSender::create(EventTypeNames::load))); |
126 return *sharedLoadEventSender; | 128 return *sharedLoadEventSender; |
127 } | 129 } |
128 | 130 |
| 131 static bool styleSheetTypeIsSupported(const String& type) |
| 132 { |
| 133 String trimmedType = ContentType(type).type(); |
| 134 return trimmedType.isEmpty() || MIMETypeRegistry::isSupportedStyleSheetMIMET
ype(trimmedType); |
| 135 } |
| 136 |
129 void HTMLLinkElement::parseSizesAttribute(const AtomicString& value, Vector<IntS
ize>& iconSizes) | 137 void HTMLLinkElement::parseSizesAttribute(const AtomicString& value, Vector<IntS
ize>& iconSizes) |
130 { | 138 { |
131 ASSERT(iconSizes.isEmpty()); | 139 ASSERT(iconSizes.isEmpty()); |
132 if (value.isEmpty()) | 140 if (value.isEmpty()) |
133 return; | 141 return; |
134 if (value.is8Bit()) | 142 if (value.is8Bit()) |
135 parseSizes(value.characters8(), value.length(), iconSizes); | 143 parseSizes(value.characters8(), value.length(), iconSizes); |
136 else | 144 else |
137 parseSizes(value.characters16(), value.length(), iconSizes); | 145 parseSizes(value.characters16(), value.length(), iconSizes); |
138 } | 146 } |
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
706 if (!document().contentSecurityPolicy()->allowImageFromSource(builder.ur
l())) | 714 if (!document().contentSecurityPolicy()->allowImageFromSource(builder.ur
l())) |
707 return; | 715 return; |
708 if (document().frame() && document().frame()->loader().client()) | 716 if (document().frame() && document().frame()->loader().client()) |
709 document().frame()->loader().client()->dispatchDidChangeIcons(m_owne
r->relAttribute().iconType()); | 717 document().frame()->loader().client()->dispatchDidChangeIcons(m_owne
r->relAttribute().iconType()); |
710 } | 718 } |
711 | 719 |
712 if (!m_owner->loadLink(type, as, builder.url())) | 720 if (!m_owner->loadLink(type, as, builder.url())) |
713 return; | 721 return; |
714 | 722 |
715 if (m_disabledState != Disabled && m_owner->relAttribute().isStyleSheet() &&
shouldLoadResource() && builder.url().isValid()) { | 723 if (m_disabledState != Disabled && m_owner->relAttribute().isStyleSheet() &&
shouldLoadResource() && builder.url().isValid()) { |
| 724 if (!styleSheetTypeIsSupported(type)) |
| 725 UseCounter::countDeprecation(document(), UseCounter::NonCSSStyleShee
tType); |
716 | 726 |
717 if (resource()) { | 727 if (resource()) { |
718 removePendingSheet(); | 728 removePendingSheet(); |
719 clearResource(); | 729 clearResource(); |
720 clearFetchFollowingCORS(); | 730 clearFetchFollowingCORS(); |
721 } | 731 } |
722 | 732 |
723 if (!m_owner->shouldLoadLink()) | 733 if (!m_owner->shouldLoadLink()) |
724 return; | 734 return; |
725 | 735 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
778 } | 788 } |
779 | 789 |
780 DEFINE_TRACE(LinkStyle) | 790 DEFINE_TRACE(LinkStyle) |
781 { | 791 { |
782 visitor->trace(m_sheet); | 792 visitor->trace(m_sheet); |
783 LinkResource::trace(visitor); | 793 LinkResource::trace(visitor); |
784 ResourceOwner<StyleSheetResource>::trace(visitor); | 794 ResourceOwner<StyleSheetResource>::trace(visitor); |
785 } | 795 } |
786 | 796 |
787 } // namespace blink | 797 } // namespace blink |
OLD | NEW |