Changeset 207620 in webkit


Ignore:
Timestamp:
Oct 20, 2016 9:38:50 AM (8 years ago)
Author:
akling@apple.com
Message:

Drop StyleResolver and SelectorQueryCache when entering PageCache.
<https://webkit.org/b/154238>

Reviewed by Antti Koivisto.

Source/WebCore:

Stop keeping these around for cached pages to save lots of memory.
We can easily rebuild them if a cached navigation occurs, and this
way we also don't need to worry about invalidating style for cached
pages in all the right places.

Restoring a cached page will now lead to a forced style recalc.
We don't try to defer this (beyond a zero-timer) since it's going
to happen anyway, and it's nicer to front-load the cost rather than
stuttering on the first user content interaction.

  • dom/Document.cpp:

(WebCore::Document::setPageCacheState):

  • history/CachedPage.cpp:

(WebCore::CachedPage::restore):
(WebCore::CachedPage::clear):

  • history/CachedPage.h:

(WebCore::CachedPage::markForVisitedLinkStyleRecalc): Deleted.
(WebCore::CachedPage::markForFullStyleRecalc): Deleted.

  • history/PageCache.cpp:

(WebCore::PageCache::markPagesForVisitedLinkStyleRecalc): Deleted.
(WebCore::PageCache::markPagesForFullStyleRecalc): Deleted.

  • history/PageCache.h:
  • page/Frame.cpp:

(WebCore::Frame::setPageAndTextZoomFactors):

  • page/Page.cpp:

(WebCore::Page::setViewScaleFactor):
(WebCore::Page::setDeviceScaleFactor):
(WebCore::Page::setPagination):
(WebCore::Page::setPaginationLineGridEnabled):
(WebCore::Page::setVisitedLinkStore):

LayoutTests:

Progression in compositing/iframes/page-cache-layer-tree.html, when navigating back,
the two iframes' dimensions correctly exclude the horizontal scrollbar's height since
it's not present after a style recalc.

  • compositing/iframes/page-cache-layer-tree-expected.txt:
Location:
trunk
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r207588 r207620  
     12016-10-20  Andreas Kling  <akling@apple.com>
     2
     3        Drop StyleResolver and SelectorQueryCache when entering PageCache.
     4        <https://webkit.org/b/154238>
     5
     6        Reviewed by Antti Koivisto.
     7
     8        Progression in compositing/iframes/page-cache-layer-tree.html, when navigating back,
     9        the two iframes' dimensions correctly exclude the horizontal scrollbar's height since
     10        it's not present after a style recalc.
     11
     12        * compositing/iframes/page-cache-layer-tree-expected.txt:
     13
    1142016-10-20  Nael Ouedraogo  <nael.ouedraogo@crf.canon.fr>
    215
  • trunk/LayoutTests/compositing/iframes/page-cache-layer-tree-expected.txt

    r192270 r207620  
    2424                (GraphicsLayer
    2525                  (anchor 0.00 0.00)
    26                   (bounds 285.00 135.00)
     26                  (bounds 285.00 150.00)
    2727                  (children 1
    2828                    (GraphicsLayer
     
    7474                    (GraphicsLayer
    7575                      (anchor 0.00 0.00)
    76                       (bounds 285.00 135.00)
     76                      (bounds 285.00 150.00)
    7777                      (children 1
    7878                        (GraphicsLayer
  • trunk/Source/WebCore/ChangeLog

    r207619 r207620  
     12016-10-20  Andreas Kling  <akling@apple.com>
     2
     3        Drop StyleResolver and SelectorQueryCache when entering PageCache.
     4        <https://webkit.org/b/154238>
     5
     6        Reviewed by Antti Koivisto.
     7
     8        Stop keeping these around for cached pages to save lots of memory.
     9        We can easily rebuild them if a cached navigation occurs, and this
     10        way we also don't need to worry about invalidating style for cached
     11        pages in all the right places.
     12
     13        Restoring a cached page will now lead to a forced style recalc.
     14        We don't try to defer this (beyond a zero-timer) since it's going
     15        to happen anyway, and it's nicer to front-load the cost rather than
     16        stuttering on the first user content interaction.
     17
     18        * dom/Document.cpp:
     19        (WebCore::Document::setPageCacheState):
     20        * history/CachedPage.cpp:
     21        (WebCore::CachedPage::restore):
     22        (WebCore::CachedPage::clear):
     23        * history/CachedPage.h:
     24        (WebCore::CachedPage::markForVisitedLinkStyleRecalc): Deleted.
     25        (WebCore::CachedPage::markForFullStyleRecalc): Deleted.
     26        * history/PageCache.cpp:
     27        (WebCore::PageCache::markPagesForVisitedLinkStyleRecalc): Deleted.
     28        (WebCore::PageCache::markPagesForFullStyleRecalc): Deleted.
     29        * history/PageCache.h:
     30        * page/Frame.cpp:
     31        (WebCore::Frame::setPageAndTextZoomFactors):
     32        * page/Page.cpp:
     33        (WebCore::Page::setViewScaleFactor):
     34        (WebCore::Page::setDeviceScaleFactor):
     35        (WebCore::Page::setPagination):
     36        (WebCore::Page::setPaginationLineGridEnabled):
     37        (WebCore::Page::setVisitedLinkStore):
     38
    1392016-10-20  Carlos Alberto Lopez Perez  <clopez@igalia.com>
    240
  • trunk/Source/WebCore/dom/Document.cpp

    r207541 r207620  
    46004600                v->resetScrollbars();
    46014601        }
     4602
     4603        styleScope().clearResolver();
     4604        clearSelectorQueryCache();
    46024605        m_styleRecalcTimer.stop();
    46034606
  • trunk/Source/WebCore/history/CachedPage.cpp

    r202160 r207620  
    101101    }
    102102
    103     if (m_needStyleRecalcForVisitedLinks) {
    104         for (Frame* frame = &page.mainFrame(); frame; frame = frame->tree().traverseNext())
    105             frame->document()->visitedLinkState().invalidateStyleForAllLinks();
    106     }
    107 
    108103    if (m_needsDeviceOrPageScaleChanged)
    109104        page.mainFrame().deviceOrPageScaleFactorChanged();
    110105
    111     if (m_needsFullStyleRecalc)
    112         page.setNeedsRecalcStyleInAllFrames();
     106    page.setNeedsRecalcStyleInAllFrames();
    113107
    114108#if ENABLE(VIDEO_TRACK)
     
    130124    m_cachedMainFrame->clear();
    131125    m_cachedMainFrame = nullptr;
    132     m_needStyleRecalcForVisitedLinks = false;
    133     m_needsFullStyleRecalc = false;
    134126#if ENABLE(VIDEO_TRACK)
    135127    m_needsCaptionPreferencesChanged = false;
  • trunk/Source/WebCore/history/CachedPage.h

    r201655 r207620  
    5151    CachedFrame* cachedMainFrame() { return m_cachedMainFrame.get(); }
    5252
    53     void markForVisitedLinkStyleRecalc() { m_needStyleRecalcForVisitedLinks = true; }
    54     void markForFullStyleRecalc() { m_needsFullStyleRecalc = true; }
    5553#if ENABLE(VIDEO_TRACK)
    5654    void markForCaptionPreferencesChanged() { m_needsCaptionPreferencesChanged = true; }
     
    6462    double m_expirationTime;
    6563    std::unique_ptr<CachedFrame> m_cachedMainFrame;
    66     bool m_needStyleRecalcForVisitedLinks { false };
    67     bool m_needsFullStyleRecalc { false };
    6864#if ENABLE(VIDEO_TRACK)
    6965    bool m_needsCaptionPreferencesChanged { false };
  • trunk/Source/WebCore/history/PageCache.cpp

    r205786 r207620  
    313313}
    314314
    315 void PageCache::markPagesForVisitedLinkStyleRecalc()
    316 {
    317     for (auto& item : m_items) {
    318         ASSERT(item->m_cachedPage);
    319         item->m_cachedPage->markForVisitedLinkStyleRecalc();
    320     }
    321 }
    322 
    323 void PageCache::markPagesForFullStyleRecalc(Page& page)
    324 {
    325     for (auto& item : m_items) {
    326         CachedPage& cachedPage = *item->m_cachedPage;
    327         if (&page.mainFrame() == &cachedPage.cachedMainFrame()->view()->frame())
    328             cachedPage.markForFullStyleRecalc();
    329     }
    330 }
    331 
    332315void PageCache::markPagesForDeviceOrPageScaleChanged(Page& page)
    333316{
  • trunk/Source/WebCore/history/PageCache.h

    r201655 r207620  
    6262    WEBCORE_EXPORT unsigned frameCount() const;
    6363
    64     WEBCORE_EXPORT void markPagesForVisitedLinkStyleRecalc();
    65     // Will mark all cached pages associated with the given page as needing style recalc.
    66     void markPagesForFullStyleRecalc(Page&);
    6764    void markPagesForDeviceOrPageScaleChanged(Page&);
    6865    void markPagesForContentsSizeChanged(Page&);
  • trunk/Source/WebCore/page/Frame.cpp

    r206917 r207620  
    964964            view->layout();
    965965    }
    966 
    967     if (isMainFrame())
    968         PageCache::singleton().markPagesForFullStyleRecalc(*page);
    969966}
    970967
  • trunk/Source/WebCore/page/Page.cpp

    r207345 r207620  
    879879    m_viewScaleFactor = scale;
    880880    PageCache::singleton().markPagesForDeviceOrPageScaleChanged(*this);
    881     PageCache::singleton().markPagesForFullStyleRecalc(*this);
    882881}
    883882
     
    897896    PageCache::singleton().markPagesForDeviceOrPageScaleChanged(*this);
    898897
    899     PageCache::singleton().markPagesForFullStyleRecalc(*this);
    900898    GraphicsContext::updateDocumentMarkerResources();
    901899
     
    990988
    991989    setNeedsRecalcStyleInAllFrames();
    992     PageCache::singleton().markPagesForFullStyleRecalc(*this);
    993990}
    994991
     
    1001998   
    1002999    setNeedsRecalcStyleInAllFrames();
    1003     PageCache::singleton().markPagesForFullStyleRecalc(*this);
    10041000}
    10051001
     
    19001896
    19011897    invalidateStylesForAllLinks();
    1902     PageCache::singleton().markPagesForFullStyleRecalc(*this);
    19031898}
    19041899
  • trunk/Source/WebKit/mac/WebCoreSupport/WebVisitedLinkStore.mm

    r201655 r207620  
    7575    for (auto& visitedLinkStore : visitedLinkStores())
    7676        visitedLinkStore->removeVisitedLinkHashes();
    77     PageCache::singleton().markPagesForVisitedLinkStyleRecalc();
    7877}
    7978
     
    104103
    105104    invalidateStylesForLink(linkHash);
    106     PageCache::singleton().markPagesForVisitedLinkStyleRecalc();
    107105}
    108106
     
    153151
    154152    invalidateStylesForLink(linkHash);
    155     PageCache::singleton().markPagesForVisitedLinkStyleRecalc();
    156153}
    157154
  • trunk/Source/WebKit/win/WebCoreSupport/WebVisitedLinkStore.cpp

    r201655 r207620  
    7272    for (auto& visitedLinkStore : visitedLinkStores())
    7373        visitedLinkStore->removeVisitedLinkHashes();
    74     PageCache::singleton().markPagesForVisitedLinkStyleRecalc();
    7574}
    7675
     
    125124
    126125    invalidateStylesForLink(linkHash);
    127     PageCache::singleton().markPagesForVisitedLinkStyleRecalc();
    128126}
    129127
  • trunk/Source/WebKit2/WebProcess/WebPage/VisitedLinkTableController.cpp

    r202242 r207620  
    9898
    9999    invalidateStylesForAllLinks();
    100     PageCache::singleton().markPagesForVisitedLinkStyleRecalc();
    101100}
    102101
     
    105104    for (auto linkHash : linkHashes)
    106105        invalidateStylesForLink(linkHash);
    107     PageCache::singleton().markPagesForVisitedLinkStyleRecalc();
    108106}
    109107
     
    111109{
    112110    invalidateStylesForAllLinks();
    113     PageCache::singleton().markPagesForVisitedLinkStyleRecalc();
    114111}
    115112
     
    119116
    120117    invalidateStylesForAllLinks();
    121     PageCache::singleton().markPagesForVisitedLinkStyleRecalc();
    122118}
    123119
Note: See TracChangeset for help on using the changeset viewer.