| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
| 3 * Copyright (C) 2009 Torch Mobile, Inc. http://www.torchmobile.com/ | 3 * Copyright (C) 2009 Torch Mobile, Inc. http://www.torchmobile.com/ |
| 4 * Copyright (C) 2010 Google Inc. All Rights Reserved. | 4 * Copyright (C) 2010 Google Inc. All Rights Reserved. |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 | 229 |
| 230 TextPosition position = | 230 TextPosition position = |
| 231 TextPosition(source.CurrentLine(), source.CurrentColumn()); | 231 TextPosition(source.CurrentLine(), source.CurrentColumn()); |
| 232 FetchParameters::ResourceWidth resource_width; | 232 FetchParameters::ResourceWidth resource_width; |
| 233 float source_size = source_size_; | 233 float source_size = source_size_; |
| 234 bool source_size_set = source_size_set_; | 234 bool source_size_set = source_size_set_; |
| 235 if (picture_data.picked) { | 235 if (picture_data.picked) { |
| 236 source_size_set = picture_data.source_size_set; | 236 source_size_set = picture_data.source_size_set; |
| 237 source_size = picture_data.source_size; | 237 source_size = picture_data.source_size; |
| 238 } | 238 } |
| 239 ResourceFetcher::IsImageSet is_image_set = |
| 240 (picture_data.picked || !srcset_image_candidate_.IsEmpty()) |
| 241 ? ResourceFetcher::kImageIsImageSet |
| 242 : ResourceFetcher::kImageNotImageSet; |
| 243 |
| 239 if (source_size_set) { | 244 if (source_size_set) { |
| 240 resource_width.width = source_size; | 245 resource_width.width = source_size; |
| 241 resource_width.is_set = true; | 246 resource_width.is_set = true; |
| 242 } | 247 } |
| 243 | 248 |
| 244 if (type == WTF::kNullopt) | 249 if (type == WTF::kNullopt) |
| 245 type = ResourceType(); | 250 type = ResourceType(); |
| 246 | 251 |
| 247 // The element's 'referrerpolicy' attribute (if present) takes precedence | 252 // The element's 'referrerpolicy' attribute (if present) takes precedence |
| 248 // over the document's referrer policy. | 253 // over the document's referrer policy. |
| 249 ReferrerPolicy referrer_policy = | 254 ReferrerPolicy referrer_policy = |
| 250 (referrer_policy_ != kReferrerPolicyDefault) ? referrer_policy_ | 255 (referrer_policy_ != kReferrerPolicyDefault) ? referrer_policy_ |
| 251 : document_referrer_policy; | 256 : document_referrer_policy; |
| 252 auto request = PreloadRequest::CreateIfNeeded( | 257 auto request = PreloadRequest::CreateIfNeeded( |
| 253 InitiatorFor(tag_impl_), position, url_to_load_, predicted_base_url, | 258 InitiatorFor(tag_impl_), position, url_to_load_, predicted_base_url, |
| 254 type.value(), referrer_policy, PreloadRequest::kDocumentIsReferrer, | 259 type.value(), referrer_policy, PreloadRequest::kDocumentIsReferrer, |
| 255 resource_width, client_hints_preferences, request_type); | 260 is_image_set, resource_width, client_hints_preferences, request_type); |
| 256 if (!request) | 261 if (!request) |
| 257 return nullptr; | 262 return nullptr; |
| 258 | 263 |
| 259 request->SetCrossOrigin(cross_origin_); | 264 request->SetCrossOrigin(cross_origin_); |
| 260 request->SetNonce(nonce_); | 265 request->SetNonce(nonce_); |
| 261 request->SetCharset(Charset()); | 266 request->SetCharset(Charset()); |
| 262 request->SetDefer(defer_); | 267 request->SetDefer(defer_); |
| 263 request->SetIntegrityMetadata(integrity_metadata_); | 268 request->SetIntegrityMetadata(integrity_metadata_); |
| 264 if (scanner_type_ == ScannerType::kInsertion) | 269 if (scanner_type_ == ScannerType::kInsertion) |
| 265 request->SetFromInsertionScanner(true); | 270 request->SetFromInsertionScanner(true); |
| (...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 798 if (Match(tag_impl, styleTag)) { | 803 if (Match(tag_impl, styleTag)) { |
| 799 if (in_style_) | 804 if (in_style_) |
| 800 css_scanner_.Reset(); | 805 css_scanner_.Reset(); |
| 801 in_style_ = false; | 806 in_style_ = false; |
| 802 return; | 807 return; |
| 803 } | 808 } |
| 804 if (Match(tag_impl, scriptTag)) { | 809 if (Match(tag_impl, scriptTag)) { |
| 805 in_script_ = false; | 810 in_script_ = false; |
| 806 return; | 811 return; |
| 807 } | 812 } |
| 808 if (Match(tag_impl, pictureTag)) | 813 if (Match(tag_impl, pictureTag)) { |
| 809 in_picture_ = false; | 814 in_picture_ = false; |
| 815 picture_data_.picked = false; |
| 816 } |
| 810 return; | 817 return; |
| 811 } | 818 } |
| 812 case HTMLToken::kStartTag: { | 819 case HTMLToken::kStartTag: { |
| 813 if (template_count_) | 820 if (template_count_) |
| 814 return; | 821 return; |
| 815 const StringImpl* tag_impl = TagImplFor(token.Data()); | 822 const StringImpl* tag_impl = TagImplFor(token.Data()); |
| 816 if (Match(tag_impl, templateTag)) { | 823 if (Match(tag_impl, templateTag)) { |
| 817 ++template_count_; | 824 ++template_count_; |
| 818 return; | 825 return; |
| 819 } | 826 } |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 955 default_viewport_min_width = document->ViewportDefaultMinWidth(); | 962 default_viewport_min_width = document->ViewportDefaultMinWidth(); |
| 956 viewport_meta_zero_values_quirk = | 963 viewport_meta_zero_values_quirk = |
| 957 document->GetSettings() && | 964 document->GetSettings() && |
| 958 document->GetSettings()->GetViewportMetaZeroValuesQuirk(); | 965 document->GetSettings()->GetViewportMetaZeroValuesQuirk(); |
| 959 viewport_meta_enabled = document->GetSettings() && | 966 viewport_meta_enabled = document->GetSettings() && |
| 960 document->GetSettings()->GetViewportMetaEnabled(); | 967 document->GetSettings()->GetViewportMetaEnabled(); |
| 961 referrer_policy = document->GetReferrerPolicy(); | 968 referrer_policy = document->GetReferrerPolicy(); |
| 962 } | 969 } |
| 963 | 970 |
| 964 } // namespace blink | 971 } // namespace blink |
| OLD | NEW |