| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/html/LinkStyle.h" | 5 #include "core/html/LinkStyle.h" |
| 6 | 6 |
| 7 #include "core/css/StyleSheetContents.h" | 7 #include "core/css/StyleSheetContents.h" |
| 8 #include "core/frame/LocalFrame.h" | 8 #include "core/frame/LocalFrame.h" |
| 9 #include "core/frame/LocalFrameClient.h" | 9 #include "core/frame/LocalFrameClient.h" |
| 10 #include "core/frame/SubresourceIntegrity.h" | 10 #include "core/frame/SubresourceIntegrity.h" |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 | 298 |
| 299 String title = owner_->title(); | 299 String title = owner_->title(); |
| 300 if (!title.IsEmpty() && !owner_->IsAlternate() && | 300 if (!title.IsEmpty() && !owner_->IsAlternate() && |
| 301 disabled_state_ != kEnabledViaScript && owner_->IsInDocumentTree()) { | 301 disabled_state_ != kEnabledViaScript && owner_->IsInDocumentTree()) { |
| 302 GetDocument().GetStyleEngine().SetPreferredStylesheetSetNameIfNotSet(title); | 302 GetDocument().GetStyleEngine().SetPreferredStylesheetSetNameIfNotSet(title); |
| 303 } | 303 } |
| 304 | 304 |
| 305 bool media_query_matches = true; | 305 bool media_query_matches = true; |
| 306 LocalFrame* frame = LoadingFrame(); | 306 LocalFrame* frame = LoadingFrame(); |
| 307 if (!owner_->Media().IsEmpty() && frame) { | 307 if (!owner_->Media().IsEmpty() && frame) { |
| 308 MediaQuerySet* media = MediaQuerySet::Create(owner_->Media()); | 308 RefPtr<MediaQuerySet> media = MediaQuerySet::Create(owner_->Media()); |
| 309 MediaQueryEvaluator evaluator(frame); | 309 MediaQueryEvaluator evaluator(frame); |
| 310 media_query_matches = evaluator.Eval(media); | 310 media_query_matches = evaluator.Eval(*media); |
| 311 } | 311 } |
| 312 | 312 |
| 313 // Don't hold up layout tree construction and script execution on | 313 // Don't hold up layout tree construction and script execution on |
| 314 // stylesheets that are not needed for the layout at the moment. | 314 // stylesheets that are not needed for the layout at the moment. |
| 315 bool blocking = media_query_matches && !owner_->IsAlternate() && | 315 bool blocking = media_query_matches && !owner_->IsAlternate() && |
| 316 owner_->IsCreatedByParser(); | 316 owner_->IsCreatedByParser(); |
| 317 AddPendingSheet(blocking ? kBlocking : kNonBlocking); | 317 AddPendingSheet(blocking ? kBlocking : kNonBlocking); |
| 318 | 318 |
| 319 // Load stylesheets that are not needed for the layout immediately with low | 319 // Load stylesheets that are not needed for the layout immediately with low |
| 320 // priority. When the link element is created by scripts, load the | 320 // priority. When the link element is created by scripts, load the |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 RemovePendingSheet(); | 409 RemovePendingSheet(); |
| 410 } | 410 } |
| 411 | 411 |
| 412 DEFINE_TRACE(LinkStyle) { | 412 DEFINE_TRACE(LinkStyle) { |
| 413 visitor->Trace(sheet_); | 413 visitor->Trace(sheet_); |
| 414 LinkResource::Trace(visitor); | 414 LinkResource::Trace(visitor); |
| 415 ResourceOwner<StyleSheetResource>::Trace(visitor); | 415 ResourceOwner<StyleSheetResource>::Trace(visitor); |
| 416 } | 416 } |
| 417 | 417 |
| 418 } // namespace blink | 418 } // namespace blink |
| OLD | NEW |