| 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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 | 205 |
| 206 HTMLElement::parseAttribute(name, oldValue, value); | 206 HTMLElement::parseAttribute(name, oldValue, value); |
| 207 } | 207 } |
| 208 } | 208 } |
| 209 | 209 |
| 210 bool HTMLLinkElement::shouldLoadLink() | 210 bool HTMLLinkElement::shouldLoadLink() |
| 211 { | 211 { |
| 212 return inDocument(); | 212 return inDocument(); |
| 213 } | 213 } |
| 214 | 214 |
| 215 bool HTMLLinkElement::loadLink(const String& type, const String& as, const KURL&
url) | 215 bool HTMLLinkElement::loadLink(const String& type, const String& as, const Strin
g& media, const KURL& url) |
| 216 { | 216 { |
| 217 return m_linkLoader->loadLink(m_relAttribute, crossOriginAttributeValue(fast
GetAttribute(HTMLNames::crossoriginAttr)), type, as, url, document(), NetworkHin
tsInterfaceImpl()); | 217 return m_linkLoader->loadLink(m_relAttribute, crossOriginAttributeValue(fast
GetAttribute(HTMLNames::crossoriginAttr)), type, as, media, url, document(), Net
workHintsInterfaceImpl()); |
| 218 } | 218 } |
| 219 | 219 |
| 220 LinkResource* HTMLLinkElement::linkResourceToProcess() | 220 LinkResource* HTMLLinkElement::linkResourceToProcess() |
| 221 { | 221 { |
| 222 bool visible = inDocument() && !m_isInShadowTree; | 222 bool visible = inDocument() && !m_isInShadowTree; |
| 223 if (!visible) { | 223 if (!visible) { |
| 224 ASSERT(!linkStyle() || !linkStyle()->hasSheet()); | 224 ASSERT(!linkStyle() || !linkStyle()->hasSheet()); |
| 225 return nullptr; | 225 return nullptr; |
| 226 } | 226 } |
| 227 | 227 |
| (...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 695 sheet->setAllowRuleAccessFromOrigin(m_owner->document().getSecurityOrigi
n()); | 695 sheet->setAllowRuleAccessFromOrigin(m_owner->document().getSecurityOrigi
n()); |
| 696 } | 696 } |
| 697 m_fetchFollowingCORS = false; | 697 m_fetchFollowingCORS = false; |
| 698 } | 698 } |
| 699 | 699 |
| 700 void LinkStyle::process() | 700 void LinkStyle::process() |
| 701 { | 701 { |
| 702 ASSERT(m_owner->shouldProcessStyle()); | 702 ASSERT(m_owner->shouldProcessStyle()); |
| 703 String type = m_owner->typeValue().lower(); | 703 String type = m_owner->typeValue().lower(); |
| 704 String as = m_owner->asValue().lower(); | 704 String as = m_owner->asValue().lower(); |
| 705 String media = m_owner->media().lower(); |
| 705 LinkRequestBuilder builder(m_owner); | 706 LinkRequestBuilder builder(m_owner); |
| 706 | 707 |
| 707 if (m_owner->relAttribute().getIconType() != InvalidIcon && builder.url().is
Valid() && !builder.url().isEmpty()) { | 708 if (m_owner->relAttribute().getIconType() != InvalidIcon && builder.url().is
Valid() && !builder.url().isEmpty()) { |
| 708 if (!m_owner->shouldLoadLink()) | 709 if (!m_owner->shouldLoadLink()) |
| 709 return; | 710 return; |
| 710 if (!document().getSecurityOrigin()->canDisplay(builder.url())) | 711 if (!document().getSecurityOrigin()->canDisplay(builder.url())) |
| 711 return; | 712 return; |
| 712 if (!document().contentSecurityPolicy()->allowImageFromSource(builder.ur
l())) | 713 if (!document().contentSecurityPolicy()->allowImageFromSource(builder.ur
l())) |
| 713 return; | 714 return; |
| 714 if (document().frame() && document().frame()->loader().client()) | 715 if (document().frame() && document().frame()->loader().client()) |
| 715 document().frame()->loader().client()->dispatchDidChangeIcons(m_owne
r->relAttribute().getIconType()); | 716 document().frame()->loader().client()->dispatchDidChangeIcons(m_owne
r->relAttribute().getIconType()); |
| 716 } | 717 } |
| 717 | 718 |
| 718 if (!m_owner->loadLink(type, as, builder.url())) | 719 if (!m_owner->loadLink(type, as, media, builder.url())) |
| 719 return; | 720 return; |
| 720 | 721 |
| 721 if (m_disabledState != Disabled && m_owner->relAttribute().isStyleSheet() &&
styleSheetTypeIsSupported(type) && shouldLoadResource() && builder.url().isVali
d()) { | 722 if (m_disabledState != Disabled && m_owner->relAttribute().isStyleSheet() &&
styleSheetTypeIsSupported(type) && shouldLoadResource() && builder.url().isVali
d()) { |
| 722 if (resource()) { | 723 if (resource()) { |
| 723 removePendingSheet(); | 724 removePendingSheet(); |
| 724 clearResource(); | 725 clearResource(); |
| 725 clearFetchFollowingCORS(); | 726 clearFetchFollowingCORS(); |
| 726 } | 727 } |
| 727 | 728 |
| 728 if (!m_owner->shouldLoadLink()) | 729 if (!m_owner->shouldLoadLink()) |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 786 } | 787 } |
| 787 | 788 |
| 788 DEFINE_TRACE(LinkStyle) | 789 DEFINE_TRACE(LinkStyle) |
| 789 { | 790 { |
| 790 visitor->trace(m_sheet); | 791 visitor->trace(m_sheet); |
| 791 LinkResource::trace(visitor); | 792 LinkResource::trace(visitor); |
| 792 ResourceOwner<StyleSheetResource>::trace(visitor); | 793 ResourceOwner<StyleSheetResource>::trace(visitor); |
| 793 } | 794 } |
| 794 | 795 |
| 795 } // namespace blink | 796 } // namespace blink |
| OLD | NEW |