OLD | NEW |
1 /* | 1 /* |
2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) | 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) |
3 * (C) 2002-2003 Dirk Mueller (mueller@kde.org) | 3 * (C) 2002-2003 Dirk Mueller (mueller@kde.org) |
4 * Copyright (C) 2002, 2005, 2006, 2008, 2009, 2010, 2012 Apple Inc. All rights | 4 * Copyright (C) 2002, 2005, 2006, 2008, 2009, 2010, 2012 Apple Inc. All rights |
5 * reserved. | 5 * reserved. |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
(...skipping 14 matching lines...) Expand all Loading... |
25 #include "core/css/StyleSheetContents.h" | 25 #include "core/css/StyleSheetContents.h" |
26 #include "core/dom/Document.h" | 26 #include "core/dom/Document.h" |
27 #include "core/loader/resource/CSSStyleSheetResource.h" | 27 #include "core/loader/resource/CSSStyleSheetResource.h" |
28 #include "platform/loader/fetch/FetchInitiatorTypeNames.h" | 28 #include "platform/loader/fetch/FetchInitiatorTypeNames.h" |
29 #include "platform/loader/fetch/FetchParameters.h" | 29 #include "platform/loader/fetch/FetchParameters.h" |
30 #include "platform/loader/fetch/ResourceFetcher.h" | 30 #include "platform/loader/fetch/ResourceFetcher.h" |
31 | 31 |
32 namespace blink { | 32 namespace blink { |
33 | 33 |
34 StyleRuleImport* StyleRuleImport::Create(const String& href, | 34 StyleRuleImport* StyleRuleImport::Create(const String& href, |
35 MediaQuerySet* media) { | 35 RefPtr<MediaQuerySet> media) { |
36 return new StyleRuleImport(href, media); | 36 return new StyleRuleImport(href, media); |
37 } | 37 } |
38 | 38 |
39 StyleRuleImport::StyleRuleImport(const String& href, MediaQuerySet* media) | 39 StyleRuleImport::StyleRuleImport(const String& href, |
| 40 RefPtr<MediaQuerySet> media) |
40 : StyleRuleBase(kImport), | 41 : StyleRuleBase(kImport), |
41 parent_style_sheet_(nullptr), | 42 parent_style_sheet_(nullptr), |
42 style_sheet_client_(new ImportedStyleSheetClient(this)), | 43 style_sheet_client_(new ImportedStyleSheetClient(this)), |
43 str_href_(href), | 44 str_href_(href), |
44 media_queries_(media), | 45 media_queries_(media), |
45 loading_(false) { | 46 loading_(false) { |
46 if (!media_queries_) | 47 if (!media_queries_) |
47 media_queries_ = MediaQuerySet::Create(String()); | 48 media_queries_ = MediaQuerySet::Create(String()); |
48 } | 49 } |
49 | 50 |
50 StyleRuleImport::~StyleRuleImport() {} | 51 StyleRuleImport::~StyleRuleImport() {} |
51 | 52 |
52 void StyleRuleImport::Dispose() { | 53 void StyleRuleImport::Dispose() { |
53 if (resource_) | 54 if (resource_) |
54 resource_->RemoveClient(style_sheet_client_); | 55 resource_->RemoveClient(style_sheet_client_); |
55 resource_ = nullptr; | 56 resource_ = nullptr; |
56 } | 57 } |
57 | 58 |
58 DEFINE_TRACE_AFTER_DISPATCH(StyleRuleImport) { | 59 DEFINE_TRACE_AFTER_DISPATCH(StyleRuleImport) { |
59 visitor->Trace(style_sheet_client_); | 60 visitor->Trace(style_sheet_client_); |
60 visitor->Trace(parent_style_sheet_); | 61 visitor->Trace(parent_style_sheet_); |
61 visitor->Trace(media_queries_); | |
62 visitor->Trace(style_sheet_); | 62 visitor->Trace(style_sheet_); |
63 visitor->Trace(resource_); | 63 visitor->Trace(resource_); |
64 StyleRuleBase::TraceAfterDispatch(visitor); | 64 StyleRuleBase::TraceAfterDispatch(visitor); |
65 } | 65 } |
66 | 66 |
67 void StyleRuleImport::SetCSSStyleSheet( | 67 void StyleRuleImport::SetCSSStyleSheet( |
68 const String& href, | 68 const String& href, |
69 const KURL& base_url, | 69 const KURL& base_url, |
70 ReferrerPolicy referrer_policy, | 70 ReferrerPolicy referrer_policy, |
71 const String& charset, | 71 const String& charset, |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 // the sheet being imported is pending. | 139 // the sheet being imported is pending. |
140 if (parent_style_sheet_ && parent_style_sheet_->LoadCompleted() && | 140 if (parent_style_sheet_ && parent_style_sheet_->LoadCompleted() && |
141 root_sheet == parent_style_sheet_) | 141 root_sheet == parent_style_sheet_) |
142 parent_style_sheet_->StartLoadingDynamicSheet(); | 142 parent_style_sheet_->StartLoadingDynamicSheet(); |
143 loading_ = true; | 143 loading_ = true; |
144 resource_->AddClient(style_sheet_client_); | 144 resource_->AddClient(style_sheet_client_); |
145 } | 145 } |
146 } | 146 } |
147 | 147 |
148 } // namespace blink | 148 } // namespace blink |
OLD | NEW |