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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 } | 101 } |
102 | 102 |
103 static bool mediaAttributeMatches(const MediaValues& mediaValues, const String&
attributeValue) | 103 static bool mediaAttributeMatches(const MediaValues& mediaValues, const String&
attributeValue) |
104 { | 104 { |
105 RefPtrWillBeRawPtr<MediaQuerySet> mediaQueries = MediaQuerySet::createOffMai
nThread(attributeValue); | 105 RefPtrWillBeRawPtr<MediaQuerySet> mediaQueries = MediaQuerySet::createOffMai
nThread(attributeValue); |
106 MediaQueryEvaluator mediaQueryEvaluator(mediaValues); | 106 MediaQueryEvaluator mediaQueryEvaluator(mediaValues); |
107 return mediaQueryEvaluator.eval(mediaQueries.get()); | 107 return mediaQueryEvaluator.eval(mediaQueries.get()); |
108 } | 108 } |
109 | 109 |
110 class TokenPreloadScanner::StartTagScanner { | 110 class TokenPreloadScanner::StartTagScanner { |
| 111 STACK_ALLOCATED(); |
111 public: | 112 public: |
112 StartTagScanner(const StringImpl* tagImpl, PassRefPtr<MediaValues> mediaValu
es) | 113 StartTagScanner(const StringImpl* tagImpl, PassRefPtrWillBeRawPtr<MediaValue
s> mediaValues) |
113 : m_tagImpl(tagImpl) | 114 : m_tagImpl(tagImpl) |
114 , m_linkIsStyleSheet(false) | 115 , m_linkIsStyleSheet(false) |
115 , m_linkIsPreconnect(false) | 116 , m_linkIsPreconnect(false) |
116 , m_linkIsImport(false) | 117 , m_linkIsImport(false) |
117 , m_matchedMediaAttribute(true) | 118 , m_matchedMediaAttribute(true) |
118 , m_inputIsImage(false) | 119 , m_inputIsImage(false) |
119 , m_sourceSize(0) | 120 , m_sourceSize(0) |
120 , m_sourceSizeSet(false) | 121 , m_sourceSizeSet(false) |
121 , m_isCORSEnabled(false) | 122 , m_isCORSEnabled(false) |
122 , m_defer(FetchRequest::NoDefer) | 123 , m_defer(FetchRequest::NoDefer) |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 bool m_linkIsImport; | 403 bool m_linkIsImport; |
403 bool m_matchedMediaAttribute; | 404 bool m_matchedMediaAttribute; |
404 bool m_inputIsImage; | 405 bool m_inputIsImage; |
405 String m_imgSrcUrl; | 406 String m_imgSrcUrl; |
406 String m_srcsetAttributeValue; | 407 String m_srcsetAttributeValue; |
407 float m_sourceSize; | 408 float m_sourceSize; |
408 bool m_sourceSizeSet; | 409 bool m_sourceSizeSet; |
409 bool m_isCORSEnabled; | 410 bool m_isCORSEnabled; |
410 FetchRequest::DeferOption m_defer; | 411 FetchRequest::DeferOption m_defer; |
411 StoredCredentials m_allowCredentials; | 412 StoredCredentials m_allowCredentials; |
412 RefPtr<MediaValues> m_mediaValues; | 413 RefPtrWillBeMember<MediaValues> m_mediaValues; |
413 }; | 414 }; |
414 | 415 |
415 TokenPreloadScanner::TokenPreloadScanner(const KURL& documentURL, PassOwnPtr<Cac
hedDocumentParameters> documentParameters) | 416 TokenPreloadScanner::TokenPreloadScanner(const KURL& documentURL, PassOwnPtr<Cac
hedDocumentParameters> documentParameters) |
416 : m_documentURL(documentURL) | 417 : m_documentURL(documentURL) |
417 , m_inStyle(false) | 418 , m_inStyle(false) |
418 , m_inPicture(false) | 419 , m_inPicture(false) |
419 , m_isAppCacheEnabled(false) | 420 , m_isAppCacheEnabled(false) |
420 , m_isCSPEnabled(false) | 421 , m_isCSPEnabled(false) |
421 , m_templateCount(0) | 422 , m_templateCount(0) |
422 , m_documentParameters(documentParameters) | 423 , m_documentParameters(documentParameters) |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
643 while (m_tokenizer->nextToken(m_source, m_token)) { | 644 while (m_tokenizer->nextToken(m_source, m_token)) { |
644 if (m_token.type() == HTMLToken::StartTag) | 645 if (m_token.type() == HTMLToken::StartTag) |
645 m_tokenizer->updateStateFor(attemptStaticStringCreation(m_token.name
(), Likely8Bit)); | 646 m_tokenizer->updateStateFor(attemptStaticStringCreation(m_token.name
(), Likely8Bit)); |
646 m_scanner.scan(m_token, m_source, requests); | 647 m_scanner.scan(m_token, m_source, requests); |
647 m_token.clear(); | 648 m_token.clear(); |
648 } | 649 } |
649 | 650 |
650 preloader->takeAndPreload(requests); | 651 preloader->takeAndPreload(requests); |
651 } | 652 } |
652 | 653 |
653 CachedDocumentParameters::CachedDocumentParameters(Document* document, PassRefPt
r<MediaValues> givenMediaValues) | 654 CachedDocumentParameters::CachedDocumentParameters(Document* document, PassRefPt
rWillBeRawPtr<MediaValues> givenMediaValues) |
654 { | 655 { |
655 ASSERT(isMainThread()); | 656 ASSERT(isMainThread()); |
656 ASSERT(document); | 657 ASSERT(document); |
657 doHtmlPreloadScanning = !document->settings() || document->settings()->doHtm
lPreloadScanning(); | 658 doHtmlPreloadScanning = !document->settings() || document->settings()->doHtm
lPreloadScanning(); |
658 if (givenMediaValues) | 659 if (givenMediaValues) |
659 mediaValues = givenMediaValues; | 660 mediaValues = givenMediaValues; |
660 else | 661 else |
661 mediaValues = MediaValuesCached::create(*document); | 662 mediaValues = MediaValuesCached::create(*document); |
662 ASSERT(mediaValues->isSafeToSendToAnotherThread()); | 663 ASSERT(mediaValues->isSafeToSendToAnotherThread()); |
663 defaultViewportMinWidth = document->viewportDefaultMinWidth(); | 664 defaultViewportMinWidth = document->viewportDefaultMinWidth(); |
664 viewportMetaZeroValuesQuirk = document->settings() && document->settings()->
viewportMetaZeroValuesQuirk(); | 665 viewportMetaZeroValuesQuirk = document->settings() && document->settings()->
viewportMetaZeroValuesQuirk(); |
665 viewportMetaEnabled = document->settings() && document->settings()->viewport
MetaEnabled(); | 666 viewportMetaEnabled = document->settings() && document->settings()->viewport
MetaEnabled(); |
666 referrerPolicy = ReferrerPolicyDefault; | 667 referrerPolicy = ReferrerPolicyDefault; |
667 } | 668 } |
668 | 669 |
669 } | 670 } |
OLD | NEW |