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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 | 137 |
138 public: | 138 public: |
139 StartTagScanner(const StringImpl* tag_impl, MediaValuesCached* media_values) | 139 StartTagScanner(const StringImpl* tag_impl, MediaValuesCached* media_values) |
140 : tag_impl_(tag_impl), | 140 : tag_impl_(tag_impl), |
141 link_is_style_sheet_(false), | 141 link_is_style_sheet_(false), |
142 link_is_preconnect_(false), | 142 link_is_preconnect_(false), |
143 link_is_preload_(false), | 143 link_is_preload_(false), |
144 link_is_import_(false), | 144 link_is_import_(false), |
145 matched_(true), | 145 matched_(true), |
146 input_is_image_(false), | 146 input_is_image_(false), |
| 147 nomodule_attribute_value_(false), |
147 source_size_(0), | 148 source_size_(0), |
148 source_size_set_(false), | 149 source_size_set_(false), |
149 defer_(FetchParameters::kNoDefer), | 150 defer_(FetchParameters::kNoDefer), |
150 cross_origin_(kCrossOriginAttributeNotSet), | 151 cross_origin_(kCrossOriginAttributeNotSet), |
151 media_values_(media_values), | 152 media_values_(media_values), |
152 referrer_policy_set_(false), | 153 referrer_policy_set_(false), |
153 referrer_policy_(kReferrerPolicyDefault) { | 154 referrer_policy_(kReferrerPolicyDefault) { |
154 if (Match(tag_impl_, imgTag) || Match(tag_impl_, sourceTag)) { | 155 if (Match(tag_impl_, imgTag) || Match(tag_impl_, sourceTag)) { |
155 source_size_ = SizesAttributeParser(media_values_, String()).length(); | 156 source_size_ = SizesAttributeParser(media_values_, String()).length(); |
156 return; | 157 return; |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 // different metadata (including empty) from the metadata on the request. | 283 // different metadata (including empty) from the metadata on the request. |
283 // See the comment before the call to mustRefetchDueToIntegrityMismatch() in | 284 // See the comment before the call to mustRefetchDueToIntegrityMismatch() in |
284 // Source/core/fetch/ResourceFetcher.cpp for a more complete explanation. | 285 // Source/core/fetch/ResourceFetcher.cpp for a more complete explanation. |
285 else if (Match(attribute_name, integrityAttr)) | 286 else if (Match(attribute_name, integrityAttr)) |
286 SubresourceIntegrity::ParseIntegrityAttribute(attribute_value, | 287 SubresourceIntegrity::ParseIntegrityAttribute(attribute_value, |
287 integrity_metadata_); | 288 integrity_metadata_); |
288 else if (Match(attribute_name, typeAttr)) | 289 else if (Match(attribute_name, typeAttr)) |
289 type_attribute_value_ = attribute_value; | 290 type_attribute_value_ = attribute_value; |
290 else if (Match(attribute_name, languageAttr)) | 291 else if (Match(attribute_name, languageAttr)) |
291 language_attribute_value_ = attribute_value; | 292 language_attribute_value_ = attribute_value; |
| 293 else if (Match(attribute_name, nomoduleAttr)) |
| 294 nomodule_attribute_value_ = true; |
292 } | 295 } |
293 | 296 |
294 template <typename NameType> | 297 template <typename NameType> |
295 void ProcessImgAttribute(const NameType& attribute_name, | 298 void ProcessImgAttribute(const NameType& attribute_name, |
296 const String& attribute_value) { | 299 const String& attribute_value) { |
297 if (Match(attribute_name, srcAttr) && img_src_url_.IsNull()) { | 300 if (Match(attribute_name, srcAttr) && img_src_url_.IsNull()) { |
298 img_src_url_ = attribute_value; | 301 img_src_url_ = attribute_value; |
299 SetUrlToLoad(BestFitSourceForImageAttributes( | 302 SetUrlToLoad(BestFitSourceForImageAttributes( |
300 media_values_->DevicePixelRatio(), source_size_, | 303 media_values_->DevicePixelRatio(), source_size_, |
301 attribute_value, srcset_image_candidate_), | 304 attribute_value, srcset_image_candidate_), |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
517 return false; | 520 return false; |
518 if (!matched_) | 521 if (!matched_) |
519 return false; | 522 return false; |
520 if (Match(tag_impl_, linkTag)) | 523 if (Match(tag_impl_, linkTag)) |
521 return ShouldPreloadLink(type); | 524 return ShouldPreloadLink(type); |
522 if (Match(tag_impl_, inputTag) && !input_is_image_) | 525 if (Match(tag_impl_, inputTag) && !input_is_image_) |
523 return false; | 526 return false; |
524 if (Match(tag_impl_, scriptTag) && | 527 if (Match(tag_impl_, scriptTag) && |
525 !ScriptLoader::IsValidScriptTypeAndLanguage( | 528 !ScriptLoader::IsValidScriptTypeAndLanguage( |
526 type_attribute_value_, language_attribute_value_, | 529 type_attribute_value_, language_attribute_value_, |
| 530 nomodule_attribute_value_, |
527 ScriptLoader::kAllowLegacyTypeInTypeAttribute)) { | 531 ScriptLoader::kAllowLegacyTypeInTypeAttribute)) { |
528 return false; | 532 return false; |
529 } | 533 } |
530 return true; | 534 return true; |
531 } | 535 } |
532 | 536 |
533 void SetCrossOrigin(const String& cors_setting) { | 537 void SetCrossOrigin(const String& cors_setting) { |
534 cross_origin_ = GetCrossOriginAttributeValue(cors_setting); | 538 cross_origin_ = GetCrossOriginAttributeValue(cors_setting); |
535 } | 539 } |
536 | 540 |
(...skipping 11 matching lines...) Expand all Loading... |
548 bool link_is_preconnect_; | 552 bool link_is_preconnect_; |
549 bool link_is_preload_; | 553 bool link_is_preload_; |
550 bool link_is_import_; | 554 bool link_is_import_; |
551 bool matched_; | 555 bool matched_; |
552 bool input_is_image_; | 556 bool input_is_image_; |
553 String img_src_url_; | 557 String img_src_url_; |
554 String srcset_attribute_value_; | 558 String srcset_attribute_value_; |
555 String as_attribute_value_; | 559 String as_attribute_value_; |
556 String type_attribute_value_; | 560 String type_attribute_value_; |
557 String language_attribute_value_; | 561 String language_attribute_value_; |
| 562 bool nomodule_attribute_value_; |
558 float source_size_; | 563 float source_size_; |
559 bool source_size_set_; | 564 bool source_size_set_; |
560 FetchParameters::DeferOption defer_; | 565 FetchParameters::DeferOption defer_; |
561 CrossOriginAttributeValue cross_origin_; | 566 CrossOriginAttributeValue cross_origin_; |
562 String nonce_; | 567 String nonce_; |
563 Member<MediaValuesCached> media_values_; | 568 Member<MediaValuesCached> media_values_; |
564 bool referrer_policy_set_; | 569 bool referrer_policy_set_; |
565 ReferrerPolicy referrer_policy_; | 570 ReferrerPolicy referrer_policy_; |
566 IntegrityMetadataSet integrity_metadata_; | 571 IntegrityMetadataSet integrity_metadata_; |
567 }; | 572 }; |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
935 default_viewport_min_width = document->ViewportDefaultMinWidth(); | 940 default_viewport_min_width = document->ViewportDefaultMinWidth(); |
936 viewport_meta_zero_values_quirk = | 941 viewport_meta_zero_values_quirk = |
937 document->GetSettings() && | 942 document->GetSettings() && |
938 document->GetSettings()->GetViewportMetaZeroValuesQuirk(); | 943 document->GetSettings()->GetViewportMetaZeroValuesQuirk(); |
939 viewport_meta_enabled = document->GetSettings() && | 944 viewport_meta_enabled = document->GetSettings() && |
940 document->GetSettings()->GetViewportMetaEnabled(); | 945 document->GetSettings()->GetViewportMetaEnabled(); |
941 referrer_policy = document->GetReferrerPolicy(); | 946 referrer_policy = document->GetReferrerPolicy(); |
942 } | 947 } |
943 | 948 |
944 } // namespace blink | 949 } // namespace blink |
OLD | NEW |