Changeset 16191 in webkit


Ignore:
Timestamp:
Sep 1, 2006 6:43:36 PM (18 years ago)
Author:
hyatt
Message:

Fix for 10682, refine the FOUC paint suppression logic so that it
is only triggered when FOUC would really have occurred.

Reviewed by aroben

  • css/cssstyleselector.cpp: (WebCore::CSSStyleSelector::styleForElement):
  • dom/Document.cpp: (WebCore::Document::Document): (WebCore::Document::updateLayoutIgnorePendingStylesheets): (WebCore::Document::updateStyleSelector):
  • dom/Document.h: (WebCore::Document::haveStylesheetsLoaded): (WebCore::Document::): (WebCore::Document::didLayoutWithPendingStylesheets):
  • rendering/RenderBlock.cpp: (WebCore::RenderBlock::paintChildren):
  • rendering/RenderLayer.cpp: (WebCore::RenderLayer::paintLayer):
Location:
trunk/WebCore
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r16190 r16191  
     12006-09-01  David Hyatt  <hyatt@apple.com>
     2
     3        Fix for 10682, refine the FOUC paint suppression logic so that it
     4        is only triggered when FOUC would really have occurred.
     5
     6        Reviewed by aroben
     7
     8        * css/cssstyleselector.cpp:
     9        (WebCore::CSSStyleSelector::styleForElement):
     10        * dom/Document.cpp:
     11        (WebCore::Document::Document):
     12        (WebCore::Document::updateLayoutIgnorePendingStylesheets):
     13        (WebCore::Document::updateStyleSelector):
     14        * dom/Document.h:
     15        (WebCore::Document::haveStylesheetsLoaded):
     16        (WebCore::Document::):
     17        (WebCore::Document::didLayoutWithPendingStylesheets):
     18        * rendering/RenderBlock.cpp:
     19        (WebCore::RenderBlock::paintChildren):
     20        * rendering/RenderLayer.cpp:
     21        (WebCore::RenderLayer::paintLayer):
     22
    1232006-09-01  MorganL  <morlmor@yahoo.com>
    224
  • trunk/WebCore/css/cssstyleselector.cpp

    r16045 r16191  
    768768RenderStyle* CSSStyleSelector::styleForElement(Element* e, RenderStyle* defaultParent, bool allowSharing, bool resolveForRootDefault)
    769769{
    770     if (allowSharing && !e->document()->haveStylesheetsLoaded()) {
     770    // Once an element has a renderer, we don't try to destroy it, since otherwise the renderer
     771    // will vanish if a style recalc happens during loading.
     772    if (allowSharing && !e->document()->haveStylesheetsLoaded() && !e->renderer()) {
    771773        if (!styleNotYetAvailable) {
    772774            styleNotYetAvailable = ::new RenderStyle();
  • trunk/WebCore/dom/Document.cpp

    r16169 r16191  
    266266    m_pendingStylesheets = 0;
    267267    m_ignorePendingStylesheets = false;
    268     m_didLayoutWithPendingStylesheets = false;
     268    m_pendingSheetLayout = NoLayoutWithPendingSheets;
    269269
    270270    m_cssTarget = 0;
     
    931931    if (!haveStylesheetsLoaded()) {
    932932        m_ignorePendingStylesheets = true;
    933         m_didLayoutWithPendingStylesheets = true;
     933        // FIXME: We are willing to attempt to suppress painting with outdated style info only once.  Our assumption is that it would be
     934        // dangerous to try to stop it a second time, after page content has already been loaded and displayed
     935        // with accurate style information.  (Our suppression involves blanking the whole page at the
     936        // moment.  If it were more refined, we might be able to do something better.)
     937        // It's worth noting though that this entire method is a hack, since what we really want to do is
     938        // suspend JS instead of doing a layout with inaccurate information.
     939        if (m_pendingSheetLayout == NoLayoutWithPendingSheets)
     940            m_pendingSheetLayout = DidLayoutWithPendingSheets;
    934941        updateStyleSelector();   
    935942    }
     
    17761783        return;
    17771784
    1778     if (m_didLayoutWithPendingStylesheets) {
    1779         m_didLayoutWithPendingStylesheets = false;
     1785    if (didLayoutWithPendingStylesheets() && m_pendingStylesheets <= 0) {
     1786        m_pendingSheetLayout = IgnoreLayoutWithPendingSheets;
    17801787        if (renderer())
    17811788            renderer()->repaint();
  • trunk/WebCore/dom/Document.h

    r16129 r16191  
    241241     * any @imports that they may be loading).
    242242     */
    243     bool haveStylesheetsLoaded(bool checkIgnoreFlag = true) const { return m_pendingStylesheets <= 0 || (checkIgnoreFlag && m_ignorePendingStylesheets); }
     243    bool haveStylesheetsLoaded() const { return m_pendingStylesheets <= 0 || m_ignorePendingStylesheets; }
    244244
    245245    /**
     
    598598#endif // XPATH_SUPPORT
    599599   
     600    enum PendingSheetLayout { NoLayoutWithPendingSheets, DidLayoutWithPendingSheets, IgnoreLayoutWithPendingSheets };
     601
     602    bool didLayoutWithPendingStylesheets() const { return m_pendingSheetLayout == DidLayoutWithPendingSheets; }
     603
    600604protected:
    601605    CSSStyleSelector* m_styleSelector;
     
    629633    // to track that this happened so that we can do a full repaint when the stylesheets
    630634    // do eventually load.
    631     bool m_didLayoutWithPendingStylesheets;
     635    PendingSheetLayout m_pendingSheetLayout;
    632636
    633637    RefPtr<CSSStyleSheet> m_elemSheet;
  • trunk/WebCore/rendering/RenderBlock.cpp

    r16129 r16191  
    12591259    // It's ok not to draw, because later on, when all the stylesheets do load, updateStyleSelector on the Document
    12601260    // will do a full repaint().
    1261     if (!document()->haveStylesheetsLoaded(false))
     1261    if (document()->didLayoutWithPendingStylesheets())
    12621262        return;
    12631263   
  • trunk/WebCore/rendering/RenderLayer.cpp

    r16129 r16191  
    12741274    // It's ok not to draw, because later on, when all the stylesheets do load, updateStyleSelector on the Document
    12751275    // will do a full repaint().
    1276     if (!renderer()->document()->haveStylesheetsLoaded(false) && !renderer()->isRenderView() && !renderer()->isRoot())
     1276    if (renderer()->document()->didLayoutWithPendingStylesheets() && !renderer()->isRenderView() && !renderer()->isRoot())
    12771277        return;
    12781278   
Note: See TracChangeset for help on using the changeset viewer.