Changeset 84066 in webkit


Ignore:
Timestamp:
Apr 15, 2011 5:49:25 PM (13 years ago)
Author:
morrita@google.com
Message:

2011-04-15 MORITA Hajime <morrita@google.com>

Reviewed by Simon Fraser.

Calls to WebCore::Document::mayCauseFlashOfUnstyledContent make frequently-run drawing methods slower
https://bugs.webkit.org/show_bug.cgi?id=58512

Manually rolled out r72367 at which mayCauseFlashOfUnstyledContent() was introduced.
This change keeps an small refactoring on
FrameView::shouldUpdate(), which doesn't affect on the behavior.

  • dom/Document.cpp:
  • dom/Document.h:
  • page/FrameView.cpp: (WebCore::FrameView::invalidateRect): (WebCore::FrameView::shouldUpdate):
  • rendering/RenderBlock.cpp: (WebCore::RenderBlock::paintContents):
  • rendering/RenderLayer.cpp: (WebCore::RenderLayer::paintLayer):
Location:
trunk/Source/WebCore
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r84065 r84066  
     12011-04-15  MORITA Hajime  <morrita@google.com>
     2
     3        Reviewed by Simon Fraser.
     4
     5        Calls to WebCore::Document::mayCauseFlashOfUnstyledContent make frequently-run drawing methods slower
     6        https://bugs.webkit.org/show_bug.cgi?id=58512
     7       
     8        Manually rolled out r72367 at which mayCauseFlashOfUnstyledContent() was introduced.
     9        This change keeps an small refactoring on
     10        FrameView::shouldUpdate(), which doesn't affect on the behavior.
     11
     12        * dom/Document.cpp:
     13        * dom/Document.h:
     14        * page/FrameView.cpp:
     15        (WebCore::FrameView::invalidateRect):
     16        (WebCore::FrameView::shouldUpdate):
     17        * rendering/RenderBlock.cpp:
     18        (WebCore::RenderBlock::paintContents):
     19        * rendering/RenderLayer.cpp:
     20        (WebCore::RenderLayer::paintLayer):
     21
    1222011-04-15  Chris Rogers  <crogers@google.com>
    223
  • trunk/Source/WebCore/dom/Document.cpp

    r84050 r84066  
    49774977#endif
    49784978
    4979 static bool hasHeadSibling(const Document* document)
    4980 {
    4981     Node* de = document->documentElement();
    4982     if (!de)
    4983         return false;
    4984 
    4985     for (Node* i = de->firstChild(); i; i = i->nextSibling()) {
    4986         // A child of the document element which is rather than <head> is
    4987         // typically visible and FOUC safe. So we return true here.
    4988         if (!i->hasTagName(headTag))
    4989             return true;
    4990     }
    4991 
    4992     return false;
    4993 }
    4994 
    4995 bool Document::mayCauseFlashOfUnstyledContent() const
    4996 {
    4997     // Some kind of FOUC is caused by a repaint request before page's <body> arrival
    4998     // because page authors often give background styles to <body>, not to <html>.
    4999     // (And these styles are unavailable before <style> or <link> is given.)
    5000     // This functions is used for checking such possibility of FOUCs.
    5001     // Note that the implementation considers only empty or <head> only contents as a FOUC cause
    5002     // rather than missing <body>, because non-HTML document like SVG and arbitrary XML from foreign namespace
    5003     // should be painted even if there is no <body>.
    5004     if (didLayoutWithPendingStylesheets())
    5005         return true;
    5006     return !hasHeadSibling(this);
    5007 }
    5008 
    50094979} // namespace WebCore
  • trunk/Source/WebCore/dom/Document.h

    r83990 r84066  
    10831083#endif
    10841084
    1085     bool mayCauseFlashOfUnstyledContent() const;
    1086 
    10871085    virtual EventTarget* errorEventTarget();
    10881086    virtual void logExceptionToConsole(const String& errorMessage, int lineNumber, const String& sourceURL, PassRefPtr<ScriptCallStack>);
  • trunk/Source/WebCore/page/FrameView.cpp

    r83943 r84066  
    329329{
    330330    if (!parent()) {
    331         if (hostWindow() && shouldUpdate())
     331        if (hostWindow())
    332332            hostWindow()->invalidateContentsAndWindow(rect, false /*immediate*/);
    333333        return;
     
    18391839{
    18401840    if (!immediateRequested && isOffscreen() && !shouldUpdateWhileOffscreen())
    1841         return false;
    1842     if (!m_frame || !m_frame->document() || m_frame->document()->mayCauseFlashOfUnstyledContent())
    18431841        return false;
    18441842    return true;
  • trunk/Source/WebCore/rendering/RenderBlock.cpp

    r83611 r84066  
    23592359    // It's ok not to draw, because later on, when all the stylesheets do load, updateStyleSelector on the Document
    23602360    // will do a full repaint().
    2361     if (document()->mayCauseFlashOfUnstyledContent() && !isRenderView())
     2361    if (document()->didLayoutWithPendingStylesheets() && !isRenderView())
    23622362        return;
    23632363
  • trunk/Source/WebCore/rendering/RenderLayer.cpp

    r83899 r84066  
    24972497    // It's ok not to draw, because later on, when all the stylesheets do load, updateStyleSelector on the Document
    24982498    // will do a full repaint().
    2499     if (renderer()->document()->mayCauseFlashOfUnstyledContent() && !renderer()->isRenderView() && !renderer()->isRoot())
     2499    if (renderer()->document()->didLayoutWithPendingStylesheets() && !renderer()->isRenderView() && !renderer()->isRoot())
    25002500        return;
    25012501   
Note: See TracChangeset for help on using the changeset viewer.