| 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 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 | 306 |
| 307 String title = m_owner->title(); | 307 String title = m_owner->title(); |
| 308 if (!title.isEmpty() && !m_owner->isAlternate() && | 308 if (!title.isEmpty() && !m_owner->isAlternate() && |
| 309 m_disabledState != EnabledViaScript && m_owner->isInDocumentTree()) { | 309 m_disabledState != EnabledViaScript && m_owner->isInDocumentTree()) { |
| 310 document().styleEngine().setPreferredStylesheetSetNameIfNotSet(title); | 310 document().styleEngine().setPreferredStylesheetSetNameIfNotSet(title); |
| 311 } | 311 } |
| 312 | 312 |
| 313 bool mediaQueryMatches = true; | 313 bool mediaQueryMatches = true; |
| 314 LocalFrame* frame = loadingFrame(); | 314 LocalFrame* frame = loadingFrame(); |
| 315 if (!m_owner->media().isEmpty() && frame) { | 315 if (!m_owner->media().isEmpty() && frame) { |
| 316 MediaQuerySet* media = MediaQuerySet::create(m_owner->media()); | 316 RefPtr<MediaQuerySet> media = MediaQuerySet::create(m_owner->media()); |
| 317 MediaQueryEvaluator evaluator(frame); | 317 MediaQueryEvaluator evaluator(frame); |
| 318 mediaQueryMatches = evaluator.eval(media); | 318 mediaQueryMatches = evaluator.eval(*media); |
| 319 } | 319 } |
| 320 | 320 |
| 321 // Don't hold up layout tree construction and script execution on | 321 // Don't hold up layout tree construction and script execution on |
| 322 // stylesheets that are not needed for the layout at the moment. | 322 // stylesheets that are not needed for the layout at the moment. |
| 323 bool blocking = mediaQueryMatches && !m_owner->isAlternate() && | 323 bool blocking = mediaQueryMatches && !m_owner->isAlternate() && |
| 324 m_owner->isCreatedByParser(); | 324 m_owner->isCreatedByParser(); |
| 325 addPendingSheet(blocking ? Blocking : NonBlocking); | 325 addPendingSheet(blocking ? Blocking : NonBlocking); |
| 326 | 326 |
| 327 // Load stylesheets that are not needed for the layout immediately with low | 327 // Load stylesheets that are not needed for the layout immediately with low |
| 328 // priority. When the link element is created by scripts, load the | 328 // priority. When the link element is created by scripts, load the |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 removePendingSheet(); | 415 removePendingSheet(); |
| 416 } | 416 } |
| 417 | 417 |
| 418 DEFINE_TRACE(LinkStyle) { | 418 DEFINE_TRACE(LinkStyle) { |
| 419 visitor->trace(m_sheet); | 419 visitor->trace(m_sheet); |
| 420 LinkResource::trace(visitor); | 420 LinkResource::trace(visitor); |
| 421 ResourceOwner<StyleSheetResource>::trace(visitor); | 421 ResourceOwner<StyleSheetResource>::trace(visitor); |
| 422 } | 422 } |
| 423 | 423 |
| 424 } // namespace blink | 424 } // namespace blink |
| OLD | NEW |