[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

morrita at google.com morrita at google.com
Wed Dec 22 15:14:11 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 52a78ba23c547a0f6001e5a6d4421bd6b81aa4cf
Author: morrita at google.com <morrita at google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Oct 29 07:49:43 2010 +0000

    2010-10-13  MORITA Hajime  <morrita at google.com>
    
            Reviewed by David Hyatt.
    
            Navigating dark background websites results in blinding white flashes between pages.
            https://bugs.webkit.org/show_bug.cgi?id=45640
    
            This FOUC is caused by an early layout request before the <body> is ready,
            and the page's background style given for <body>, instead of <html>.
            So many sites have such stylesheets that we should care them.
    
            - Some DOM operation such as 'element.offsetLeft' causes page layout.
            - The page layout results page repaint
            - The page page repaint makes a white screen. because there is nothing to paint
              before <body> is available.
    
            This change:
            - extracted existing FOUC check on RenderBlock and RenderLayer to
              Document::mayCauseFlashOfUnstyledContent(),
            - checked <body> availability on mayCauseFlashOfUnstyledContent(), and
            - added FOUC guards before requesting reapint on FrameView.
    
            No new tests. The data loading speed matters and it cannot be
            captured by DRT.
    
            * dom/Document.cpp:
            (WebCore::Document::mayCauseFlashOfUnstyledContent): Added.
            * dom/Document.h:
            * page/FrameView.cpp:
            (WebCore::FrameView::invalidateRect): Added a guard.
            (WebCore::FrameView::repaintContentRectangle): Added a guard.
            (WebCore::FrameView::doDeferredRepaints): Added a guard.
            (WebCore::FrameView::shouldUpdate): Added.
            * page/FrameView.h:
            * rendering/RenderBlock.cpp:
            (WebCore::RenderBlock::paintContents): Replaced FOUC check to use mayCauseFlashOfUnstyledContent
            * rendering/RenderLayer.cpp:
            (WebCore::RenderLayer::paintLayer): Replaced FOUC check to use mayCauseFlashOfUnstyledContent
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@70850 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 0325e4e..84ffed5 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,42 @@
+2010-10-13  MORITA Hajime  <morrita at google.com>
+
+        Reviewed by David Hyatt.
+
+        Navigating dark background websites results in blinding white flashes between pages. 
+        https://bugs.webkit.org/show_bug.cgi?id=45640
+
+        This FOUC is caused by an early layout request before the <body> is ready, 
+        and the page's background style given for <body>, instead of <html>.
+        So many sites have such stylesheets that we should care them.
+        
+        - Some DOM operation such as 'element.offsetLeft' causes page layout.
+        - The page layout results page repaint
+        - The page page repaint makes a white screen. because there is nothing to paint
+          before <body> is available.
+        
+        This change:
+        - extracted existing FOUC check on RenderBlock and RenderLayer to 
+          Document::mayCauseFlashOfUnstyledContent(),
+        - checked <body> availability on mayCauseFlashOfUnstyledContent(), and
+        - added FOUC guards before requesting reapint on FrameView.
+        
+        No new tests. The data loading speed matters and it cannot be
+        captured by DRT.
+
+        * dom/Document.cpp:
+        (WebCore::Document::mayCauseFlashOfUnstyledContent): Added.
+        * dom/Document.h:
+        * page/FrameView.cpp:
+        (WebCore::FrameView::invalidateRect): Added a guard.
+        (WebCore::FrameView::repaintContentRectangle): Added a guard.
+        (WebCore::FrameView::doDeferredRepaints): Added a guard.
+        (WebCore::FrameView::shouldUpdate): Added.
+        * page/FrameView.h:
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::paintContents): Replaced FOUC check to use mayCauseFlashOfUnstyledContent
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::paintLayer): Replaced FOUC check to use mayCauseFlashOfUnstyledContent
+
 2010-10-29  David Hyatt  <hyatt at apple.com>
 
         Reviewed by Dan Bernstein.
diff --git a/WebCore/dom/Document.cpp b/WebCore/dom/Document.cpp
index da9bd86..b047bfa 100644
--- a/WebCore/dom/Document.cpp
+++ b/WebCore/dom/Document.cpp
@@ -4791,4 +4791,11 @@ PassRefPtr<TouchList> Document::createTouchList(ExceptionCode&) const
 }
 #endif
 
+bool Document::mayCauseFlashOfUnstyledContent() const
+{
+    if (didLayoutWithPendingStylesheets())
+        return true;
+    return !body() && (isHTMLDocument() || isXHTMLDocument());
+}
+
 } // namespace WebCore
diff --git a/WebCore/dom/Document.h b/WebCore/dom/Document.h
index 1334aa3..c7df606 100644
--- a/WebCore/dom/Document.h
+++ b/WebCore/dom/Document.h
@@ -1045,6 +1045,7 @@ public:
     PassRefPtr<TouchList> createTouchList(ExceptionCode&) const;
 #endif
 
+    bool mayCauseFlashOfUnstyledContent() const;
 protected:
     Document(Frame*, const KURL& url, bool isXHTML, bool isHTML, const KURL& baseURL = KURL());
 
diff --git a/WebCore/page/FrameView.cpp b/WebCore/page/FrameView.cpp
index 2708ce5..532d572 100644
--- a/WebCore/page/FrameView.cpp
+++ b/WebCore/page/FrameView.cpp
@@ -303,7 +303,7 @@ bool FrameView::didFirstLayout() const
 void FrameView::invalidateRect(const IntRect& rect)
 {
     if (!parent()) {
-        if (hostWindow())
+        if (hostWindow() && shouldUpdate())
             hostWindow()->invalidateContentsAndWindow(rect, false /*immediate*/);
         return;
     }
@@ -1225,7 +1225,7 @@ void FrameView::repaintContentRectangle(const IntRect& r, bool immediate)
         return;
     }
     
-    if (!immediate && isOffscreen() && !shouldUpdateWhileOffscreen())
+    if (!shouldUpdate(immediate))
         return;
 
 #if ENABLE(TILED_BACKING_STORE)
@@ -1299,7 +1299,7 @@ void FrameView::checkStopDelayingDeferredRepaints()
 void FrameView::doDeferredRepaints()
 {
     ASSERT(!m_deferringRepaints);
-    if (isOffscreen() && !shouldUpdateWhileOffscreen()) {
+    if (!shouldUpdate()) {
         m_repaintRects.clear();
         m_repaintCount = 0;
         return;
@@ -1540,6 +1540,15 @@ void FrameView::setShouldUpdateWhileOffscreen(bool shouldUpdateWhileOffscreen)
     m_shouldUpdateWhileOffscreen = shouldUpdateWhileOffscreen;
 }
 
+bool FrameView::shouldUpdate(bool immediateRequested) const
+{
+    if (!immediateRequested && isOffscreen() && !shouldUpdateWhileOffscreen())
+        return false;
+    if (!m_frame || !m_frame->document() || m_frame->document()->mayCauseFlashOfUnstyledContent())
+        return false;
+    return true;
+}
+
 void FrameView::scheduleEvent(PassRefPtr<Event> event, PassRefPtr<Node> eventTarget)
 {
     if (!m_enqueueEvents) {
diff --git a/WebCore/page/FrameView.h b/WebCore/page/FrameView.h
index f9212c1..53f1a5a 100644
--- a/WebCore/page/FrameView.h
+++ b/WebCore/page/FrameView.h
@@ -134,6 +134,7 @@ public:
 
     bool shouldUpdateWhileOffscreen() const;
     void setShouldUpdateWhileOffscreen(bool);
+    bool shouldUpdate(bool = false) const;
 
     void adjustViewSize();
     
diff --git a/WebCore/rendering/RenderBlock.cpp b/WebCore/rendering/RenderBlock.cpp
index 47ec220..6bf0629 100644
--- a/WebCore/rendering/RenderBlock.cpp
+++ b/WebCore/rendering/RenderBlock.cpp
@@ -2223,7 +2223,7 @@ void RenderBlock::paintContents(PaintInfo& paintInfo, int tx, int ty)
     // Avoid painting descendants of the root element when stylesheets haven't loaded.  This eliminates FOUC.
     // It's ok not to draw, because later on, when all the stylesheets do load, updateStyleSelector on the Document
     // will do a full repaint().
-    if (document()->didLayoutWithPendingStylesheets() && !isRenderView())
+    if (document()->mayCauseFlashOfUnstyledContent() && !isRenderView())
         return;
 
     if (childrenInline())
diff --git a/WebCore/rendering/RenderLayer.cpp b/WebCore/rendering/RenderLayer.cpp
index 4e8ceec..b3270a6 100644
--- a/WebCore/rendering/RenderLayer.cpp
+++ b/WebCore/rendering/RenderLayer.cpp
@@ -2356,7 +2356,7 @@ void RenderLayer::paintLayer(RenderLayer* rootLayer, GraphicsContext* p,
     // Avoid painting layers when stylesheets haven't loaded.  This eliminates FOUC.
     // It's ok not to draw, because later on, when all the stylesheets do load, updateStyleSelector on the Document
     // will do a full repaint().
-    if (renderer()->document()->didLayoutWithPendingStylesheets() && !renderer()->isRenderView() && !renderer()->isRoot())
+    if (renderer()->document()->mayCauseFlashOfUnstyledContent() && !renderer()->isRenderView() && !renderer()->isRoot())
         return;
     
     // If this layer is totally invisible then there is nothing to paint.

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list