| 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 731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 742 // Don't hold up layout tree construction and script execution on styles
heets | 742 // Don't hold up layout tree construction and script execution on styles
heets |
| 743 // that are not needed for the layout at the moment. | 743 // that are not needed for the layout at the moment. |
| 744 bool blocking = mediaQueryMatches && !m_owner->isAlternate() && m_owner-
>isCreatedByParser(); | 744 bool blocking = mediaQueryMatches && !m_owner->isAlternate() && m_owner-
>isCreatedByParser(); |
| 745 addPendingSheet(blocking ? Blocking : NonBlocking); | 745 addPendingSheet(blocking ? Blocking : NonBlocking); |
| 746 | 746 |
| 747 // Load stylesheets that are not needed for the layout immediately with
low priority. | 747 // Load stylesheets that are not needed for the layout immediately with
low priority. |
| 748 // When the link element is created by scripts, load the stylesheets asy
nchronously but in high priority. | 748 // When the link element is created by scripts, load the stylesheets asy
nchronously but in high priority. |
| 749 bool lowPriority = !mediaQueryMatches || m_owner->isAlternate(); | 749 bool lowPriority = !mediaQueryMatches || m_owner->isAlternate(); |
| 750 FetchRequest request = builder.build(lowPriority); | 750 FetchRequest request = builder.build(lowPriority); |
| 751 CrossOriginAttributeValue crossOrigin = crossOriginAttributeValue(m_owne
r->fastGetAttribute(HTMLNames::crossoriginAttr)); | 751 CrossOriginAttributeValue crossOrigin = crossOriginAttributeValue(m_owne
r->fastGetAttribute(HTMLNames::crossoriginAttr)); |
| 752 if (crossOrigin != CrossOriginAttributeNotSet) { | 752 request.setCrossOriginAccessControl(document().getSecurityOrigin(), cros
sOrigin); |
| 753 request.setCrossOriginAccessControl(document().getSecurityOrigin(),
crossOrigin); | 753 if (crossOrigin != CrossOriginAttributeNotSet) |
| 754 setFetchFollowingCORS(); | 754 setFetchFollowingCORS(); |
| 755 } | |
| 756 setResource(CSSStyleSheetResource::fetch(request, document().fetcher()))
; | 755 setResource(CSSStyleSheetResource::fetch(request, document().fetcher()))
; |
| 757 | 756 |
| 758 if (m_loading && !resource()) { | 757 if (m_loading && !resource()) { |
| 759 // 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. | 758 // 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. |
| 760 // setCSSStyleSheet() can be called synchronuosly in setResource() a
nd thus resource() is null and |m_loading| is false in such cases even if the re
quest succeeds. | 759 // setCSSStyleSheet() can be called synchronuosly in setResource() a
nd thus resource() is null and |m_loading| is false in such cases even if the re
quest succeeds. |
| 761 m_loading = false; | 760 m_loading = false; |
| 762 removePendingSheet(); | 761 removePendingSheet(); |
| 763 notifyLoadedSheetAndAllCriticalSubresources(Node::ErrorOccurredLoadi
ngSubresource); | 762 notifyLoadedSheetAndAllCriticalSubresources(Node::ErrorOccurredLoadi
ngSubresource); |
| 764 } | 763 } |
| 765 } else if (m_sheet) { | 764 } else if (m_sheet) { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 786 } | 785 } |
| 787 | 786 |
| 788 DEFINE_TRACE(LinkStyle) | 787 DEFINE_TRACE(LinkStyle) |
| 789 { | 788 { |
| 790 visitor->trace(m_sheet); | 789 visitor->trace(m_sheet); |
| 791 LinkResource::trace(visitor); | 790 LinkResource::trace(visitor); |
| 792 ResourceOwner<StyleSheetResource>::trace(visitor); | 791 ResourceOwner<StyleSheetResource>::trace(visitor); |
| 793 } | 792 } |
| 794 | 793 |
| 795 } // namespace blink | 794 } // namespace blink |
| OLD | NEW |