OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 if (!media.IsEmpty()) { | 294 if (!media.IsEmpty()) { |
295 MediaValues* media_values = | 295 MediaValues* media_values = |
296 MediaValues::CreateDynamicIfFrameExists(document.GetFrame()); | 296 MediaValues::CreateDynamicIfFrameExists(document.GetFrame()); |
297 if (viewport_description) { | 297 if (viewport_description) { |
298 media_values->OverrideViewportDimensions( | 298 media_values->OverrideViewportDimensions( |
299 viewport_description->max_width.GetFloatValue(), | 299 viewport_description->max_width.GetFloatValue(), |
300 viewport_description->max_height.GetFloatValue()); | 300 viewport_description->max_height.GetFloatValue()); |
301 } | 301 } |
302 | 302 |
303 // Preload only if media matches | 303 // Preload only if media matches |
304 MediaQuerySet* media_queries = MediaQuerySet::Create(media); | 304 RefPtr<MediaQuerySet> media_queries = MediaQuerySet::Create(media); |
305 MediaQueryEvaluator evaluator(*media_values); | 305 MediaQueryEvaluator evaluator(*media_values); |
306 if (!evaluator.Eval(media_queries)) | 306 if (!evaluator.Eval(*media_queries)) |
307 return nullptr; | 307 return nullptr; |
308 } | 308 } |
309 if (caller == kLinkCalledFromHeader) | 309 if (caller == kLinkCalledFromHeader) |
310 UseCounter::Count(document, UseCounter::kLinkHeaderPreload); | 310 UseCounter::Count(document, UseCounter::kLinkHeaderPreload); |
311 Optional<Resource::Type> resource_type = | 311 Optional<Resource::Type> resource_type = |
312 LinkLoader::GetResourceTypeFromAsAttribute(as); | 312 LinkLoader::GetResourceTypeFromAsAttribute(as); |
313 if (resource_type == WTF::kNullopt) { | 313 if (resource_type == WTF::kNullopt) { |
314 document.AddConsoleMessage(ConsoleMessage::Create( | 314 document.AddConsoleMessage(ConsoleMessage::Create( |
315 kOtherMessageSource, kWarningMessageLevel, | 315 kOtherMessageSource, kWarningMessageLevel, |
316 String("<link rel=preload> must have a valid `as` value"))); | 316 String("<link rel=preload> must have a valid `as` value"))); |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 | 498 |
499 DEFINE_TRACE(LinkLoader) { | 499 DEFINE_TRACE(LinkLoader) { |
500 visitor->Trace(client_); | 500 visitor->Trace(client_); |
501 visitor->Trace(prerender_); | 501 visitor->Trace(prerender_); |
502 visitor->Trace(link_preload_resource_client_); | 502 visitor->Trace(link_preload_resource_client_); |
503 ResourceOwner<Resource, ResourceClient>::Trace(visitor); | 503 ResourceOwner<Resource, ResourceClient>::Trace(visitor); |
504 PrerenderClient::Trace(visitor); | 504 PrerenderClient::Trace(visitor); |
505 } | 505 } |
506 | 506 |
507 } // namespace blink | 507 } // namespace blink |
OLD | NEW |