Changeset 191180 in webkit


Ignore:
Timestamp:
Oct 16, 2015 10:06:06 AM (9 years ago)
Author:
Chris Dumez
Message:

HTMLPreloadScanner should preload iframes
https://bugs.webkit.org/show_bug.cgi?id=150097
<rdar://problem/23094475>

Reviewed by Antti Koivisto.

Source/WebCore:

HTMLPreloadScanner should preload iframes to decrease page load time.

Tests:

  • fast/preloader/frame-src.html
  • http/tests/loading/preload-no-store-frame-src.html
  • html/parser/HTMLPreloadScanner.cpp:

(WebCore::TokenPreloadScanner::tagIdFor):
(WebCore::TokenPreloadScanner::initiatorFor):
(WebCore::TokenPreloadScanner::StartTagScanner::createPreloadRequest):
(WebCore::TokenPreloadScanner::StartTagScanner::processAttribute):
(WebCore::TokenPreloadScanner::StartTagScanner::resourceType):
(WebCore::TokenPreloadScanner::StartTagScanner::setUrlToLoad): Deleted.
(WebCore::TokenPreloadScanner::StartTagScanner::charset): Deleted.

  • html/parser/HTMLPreloadScanner.h:

LayoutTests:

Add layout test to check that iframes are indeed preloaded.

  • fast/preloader/frame-src-expected.txt: Added.
  • fast/preloader/frame-src.html: Added.
  • fast/preloader/resources/testFrame.html: Added.
  • http/tests/loading/preload-no-store-frame-src-expected.txt: Added.
  • http/tests/loading/preload-no-store-frame-src.html: Added.
Location:
trunk
Files:
5 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r191179 r191180  
     12015-10-16  Chris Dumez  <cdumez@apple.com>
     2
     3        HTMLPreloadScanner should preload iframes
     4        https://bugs.webkit.org/show_bug.cgi?id=150097
     5        <rdar://problem/23094475>
     6
     7        Reviewed by Antti Koivisto.
     8
     9        Add layout test to check that iframes are indeed preloaded.
     10
     11        * fast/preloader/frame-src-expected.txt: Added.
     12        * fast/preloader/frame-src.html: Added.
     13        * fast/preloader/resources/testFrame.html: Added.
     14        * http/tests/loading/preload-no-store-frame-src-expected.txt: Added.
     15        * http/tests/loading/preload-no-store-frame-src.html: Added.
     16
    1172015-10-16  Csaba Osztrogonác  <ossy@webkit.org>
    218
  • trunk/Source/WebCore/ChangeLog

    r191178 r191180  
     12015-10-16  Chris Dumez  <cdumez@apple.com>
     2
     3        HTMLPreloadScanner should preload iframes
     4        https://bugs.webkit.org/show_bug.cgi?id=150097
     5        <rdar://problem/23094475>
     6
     7        Reviewed by Antti Koivisto.
     8
     9        HTMLPreloadScanner should preload iframes to decrease page load time.
     10
     11        Tests:
     12        - fast/preloader/frame-src.html
     13        - http/tests/loading/preload-no-store-frame-src.html
     14
     15        * html/parser/HTMLPreloadScanner.cpp:
     16        (WebCore::TokenPreloadScanner::tagIdFor):
     17        (WebCore::TokenPreloadScanner::initiatorFor):
     18        (WebCore::TokenPreloadScanner::StartTagScanner::createPreloadRequest):
     19        (WebCore::TokenPreloadScanner::StartTagScanner::processAttribute):
     20        (WebCore::TokenPreloadScanner::StartTagScanner::resourceType):
     21        (WebCore::TokenPreloadScanner::StartTagScanner::setUrlToLoad): Deleted.
     22        (WebCore::TokenPreloadScanner::StartTagScanner::charset): Deleted.
     23        * html/parser/HTMLPreloadScanner.h:
     24
    1252015-10-16  David Hyatt  <hyatt@apple.com>
    226
  • trunk/Source/WebCore/html/parser/HTMLPreloadScanner.cpp

    r190755 r191180  
    4545{
    4646    AtomicString tagName(data);
     47    if (tagName == iframeTag)
     48        return TagId::Iframe;
    4749    if (tagName == imgTag)
    4850        return TagId::Img;
     
    6769{
    6870    switch (tagId) {
     71    case TagId::Iframe:
     72        return "iframe";
    6973    case TagId::Img:
    7074        return "img";
     
    154158    {
    155159        switch (m_tagId) {
     160        case TagId::Iframe:
     161            if (match(attributeName, srcAttr))
     162                setUrlToLoad(attributeValue);
     163            break;
    156164        case TagId::Img:
    157165            if (match(attributeName, srcsetAttr) && m_srcSetAttribute.isNull()) {
     
    223231    CachedResource::Type resourceType() const
    224232    {
    225         if (m_tagId == TagId::Script)
     233        switch (m_tagId) {
     234        case TagId::Iframe:
     235            return CachedResource::MainResource;
     236        case TagId::Script:
    226237            return CachedResource::Script;
    227         if (m_tagId == TagId::Img || (m_tagId == TagId::Input && m_inputIsImage))
     238        case TagId::Img:
     239        case TagId::Input:
     240            ASSERT(m_tagId != TagId::Input || m_inputIsImage);
    228241            return CachedResource::ImageResource;
    229         if (m_tagId == TagId::Link && m_linkIsStyleSheet)
     242        case TagId::Link:
     243            ASSERT(m_linkIsStyleSheet);
    230244            return CachedResource::CSSStyleSheet;
     245        case TagId::Meta:
     246        case TagId::Unknown:
     247        case TagId::Style:
     248        case TagId::Base:
     249        case TagId::Template:
     250            break;
     251        }
    231252        ASSERT_NOT_REACHED();
    232253        return CachedResource::RawResource;
     
    238259            return false;
    239260
    240         if (protocolIs(m_urlToLoad, "data"))
     261        if (protocolIs(m_urlToLoad, "data") || protocolIs(m_urlToLoad, "about"))
    241262            return false;
    242263
  • trunk/Source/WebCore/html/parser/HTMLPreloadScanner.h

    r183951 r191180  
    4646    enum class TagId {
    4747        // These tags are scanned by the StartTagScanner.
     48        Iframe,
    4849        Img,
    4950        Input,
Note: See TracChangeset for help on using the changeset viewer.