Changeset 224763 in webkit
- Timestamp:
- Nov 13, 2017 11:33:19 AM (6 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r224760 r224763 1 2017-11-13 Colin Bendell <colin@bendell.ca> 2 3 Add tests to ensure that <source> tags are only preloaded when the `type` 4 attribute matches. 5 https://bugs.webkit.org/show_bug.cgi?id=179231 6 7 Reviewed by Alex Christensen. 8 9 * http/tests/preload/picture-type-expected.txt: Added. 10 * http/tests/preload/picture-type.html: Added. 11 1 12 2017-11-13 Antoine Quint <graouts@apple.com> 2 13 -
trunk/Source/WebCore/ChangeLog
r224760 r224763 1 2017-11-13 Colin Bendell <colin@bendell.ca> 2 3 Added mime type check to the picture source preloader to avoid downloading incompatible resources. 4 https://bugs.webkit.org/show_bug.cgi?id=179231 5 6 Reviewed by Alex Christensen. 7 8 Test: http/tests/loading/preload-picture-type.html 9 10 * html/parser/HTMLPreloadScanner.cpp: 11 (WebCore::TokenPreloadScanner::StartTagScanner::processAttributes): include type match state when selecting candidate imgs 12 (WebCore::TokenPreloadScanner::StartTagScanner::processAttribute): added type attribute evaluation and matching 13 1 14 2017-11-13 Antoine Quint <graouts@apple.com> 2 15 -
trunk/Source/WebCore/html/parser/HTMLPreloadScanner.cpp
r224703 r224763 37 37 #include "LinkRelAttribute.h" 38 38 #include "Logging.h" 39 #include "MIMETypeRegistry.h" 39 40 #include "MediaList.h" 40 41 #include "MediaQueryEvaluator.h" … … 122 123 } 123 124 124 if (m_tagId == TagId::Source && !pictureState.isEmpty() && !pictureState.last() && m_mediaMatched && !m_srcSetAttribute.isEmpty()) {125 if (m_tagId == TagId::Source && !pictureState.isEmpty() && !pictureState.last() && m_mediaMatched && m_typeMatched && !m_srcSetAttribute.isEmpty()) { 125 126 126 127 auto sourceSize = SizesAttributeParser(m_sizesAttribute, document).length(); … … 219 220 LOG(MediaQueries, "HTMLPreloadScanner %p processAttribute evaluating media queries", this); 220 221 m_mediaMatched = MediaQueryEvaluator { document.printing() ? "print" : "screen", document, documentElement ? documentElement->computedStyle() : nullptr }.evaluate(mediaSet.get()); 222 } 223 if (match(attributeName, typeAttr) && m_typeAttribute.isNull()) { 224 // when multiple type attributes present: first value wins, ignore subsequent (to match ImageElement parser and Blink behaviours) 225 m_typeAttribute = attributeValue; 226 m_typeMatched &= MIMETypeRegistry::isSupportedImageOrSVGMIMEType(m_typeAttribute); 221 227 } 222 228 break; … … 342 348 String m_sizesAttribute; 343 349 bool m_mediaMatched { true }; 350 bool m_typeMatched { true }; 344 351 String m_charset; 345 352 String m_crossOriginMode;
Note: See TracChangeset
for help on using the changeset viewer.