Changeset 183951 in webkit
- Timestamp:
- May 7, 2015 3:16:27 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r183950 r183951 1 2015-05-07 Yoav Weiss <yoav@yoav.ws> 2 3 Handle meta viewport in HTMLPreloadScanner 4 https://bugs.webkit.org/show_bug.cgi?id=144640 5 6 Reviewed by Dean Jackson. 7 8 Added a layout test that is simply calling an internals method 9 that tests the HTMLPreloadScanner. 10 11 * fast/dom/HTMLMetaElement/meta-preloader-expected.txt: Added. 12 * fast/dom/HTMLMetaElement/meta-preloader.html: Added. 13 1 14 2015-05-07 Zalan Bujtas <zalan@apple.com> 2 15 -
trunk/Source/WebCore/ChangeLog
r183950 r183951 1 2015-05-07 Yoav Weiss <yoav@yoav.ws> 2 3 Handle meta viewport in HTMLPreloadScanner 4 https://bugs.webkit.org/show_bug.cgi?id=144640 5 6 Reviewed by Dean Jackson. 7 8 Add support for the <meta> tag to the HTMLPreloadScanner 9 and when the meta tag's name is viewport, get the document 10 to process the tag's attribute value, and set its ViewportArgument. 11 12 Tests: fast/dom/HTMLMetaElement/meta-preloader.html 13 14 * html/parser/HTMLPreloadScanner.cpp: 15 (WebCore::TokenPreloadScanner::tagIdFor): Added meta. 16 (WebCore::TokenPreloadScanner::initiatorFor): Added meta. 17 (WebCore::TokenPreloadScanner::StartTagScanner::StartTagScanner): Call document.processViewport is meta viewport encountered. 18 (WebCore::TokenPreloadScanner::StartTagScanner::processAttributes): 19 (WebCore::TokenPreloadScanner::StartTagScanner::processAttribute): Keep track of meta viewport tags. 20 (WebCore::testPreloadScannerViewportSupport): Testing function that makes sure this functionality is working. 21 * html/parser/HTMLPreloadScanner.h: 22 * testing/Internals.cpp: 23 (WebCore::Internals::testPreloaderSettingViewport): Calls the testing function. 24 * testing/Internals.h: 25 * testing/Internals.idl: 26 1 27 2015-05-07 Zalan Bujtas <zalan@apple.com> 2 28 -
trunk/Source/WebCore/html/parser/HTMLPreloadScanner.cpp
r183920 r183951 59 59 if (tagName == templateTag) 60 60 return TagId::Template; 61 if (tagName == metaTag) 62 return TagId::Meta; 61 63 return TagId::Unknown; 62 64 } … … 77 79 case TagId::Base: 78 80 case TagId::Template: 81 case TagId::Meta: 79 82 ASSERT_NOT_REACHED(); 80 83 return "unknown"; … … 89 92 : m_tagId(tagId) 90 93 , m_linkIsStyleSheet(false) 94 , m_metaIsViewport(false) 91 95 , m_inputIsImage(false) 92 96 , m_deviceScaleFactor(deviceScaleFactor) … … 117 121 setUrlToLoad(imageCandidate.string.toString(), true); 118 122 } 123 124 if (m_metaIsViewport && !m_metaContent.isNull()) 125 document.processViewport(m_metaContent, ViewportArguments::ViewportMeta); 119 126 } 120 127 … … 167 174 else if (match(attributeName, typeAttr)) 168 175 m_inputIsImage = equalIgnoringCase(attributeValue, InputTypeNames::image()); 176 } else if (m_tagId == TagId::Meta) { 177 if (match(attributeName, contentAttr)) 178 m_metaContent = attributeValue; 179 else if (match(attributeName, nameAttr)) 180 m_metaIsViewport = equalIgnoringCase(attributeValue, "viewport"); 169 181 } 170 182 } … … 237 249 bool m_linkIsStyleSheet; 238 250 String m_mediaAttribute; 251 String m_metaContent; 252 bool m_metaIsViewport; 239 253 bool m_inputIsImage; 240 254 float m_deviceScaleFactor; … … 348 362 } 349 363 350 } 364 bool testPreloadScannerViewportSupport(Document* document) 365 { 366 ASSERT(document); 367 HTMLParserOptions options(*document); 368 HTMLPreloadScanner scanner(options, document->url()); 369 HTMLResourcePreloader preloader(*document); 370 scanner.appendToEnd(String("<meta name=viewport content='width=400'>")); 371 scanner.scan(preloader, *document); 372 return (document->viewportArguments().width == 400); 373 } 374 375 } -
trunk/Source/WebCore/html/parser/HTMLPreloadScanner.h
r178265 r183951 50 50 Link, 51 51 Script, 52 Meta, 52 53 53 54 // These tags are not scanned by the StartTagScanner. … … 91 92 }; 92 93 94 WEBCORE_EXPORT bool testPreloadScannerViewportSupport(Document*); 95 93 96 } 94 97 -
trunk/Source/WebCore/testing/Internals.cpp
r183906 r183951 59 59 #include "HTMLNames.h" 60 60 #include "HTMLPlugInElement.h" 61 #include "HTMLPreloadScanner.h" 61 62 #include "HTMLSelectElement.h" 62 63 #include "HTMLTextAreaElement.h" … … 2835 2836 #endif 2836 2837 2837 } 2838 bool Internals::testPreloaderSettingViewport() 2839 { 2840 return testPreloadScannerViewportSupport(contextDocument()); 2841 } 2842 2843 } -
trunk/Source/WebCore/testing/Internals.h
r183906 r183951 396 396 RefPtr<File> createFile(const String&); 397 397 void queueMicroTask(int); 398 bool testPreloaderSettingViewport(); 398 399 399 400 #if ENABLE(CONTENT_FILTERING) -
trunk/Source/WebCore/testing/Internals.idl
r183906 r183951 358 358 File createFile(DOMString url); 359 359 void queueMicroTask(long testNumber); 360 boolean testPreloaderSettingViewport(); 360 361 361 362 [Conditional=CONTENT_FILTERING] readonly attribute MockContentFilterSettings mockContentFilterSettings;
Note: See TracChangeset
for help on using the changeset viewer.