Changeset 141221 in webkit


Ignore:
Timestamp:
Jan 29, 2013 9:37:21 PM (11 years ago)
Author:
Simon Fraser
Message:

Rubberband scrolling on news.google.com causes text to blink repeatedly
https://bugs.webkit.org/show_bug.cgi?id=107326

Reviewed by Beth Dakin.

When in the middle of layout, RenderBlock::updateScrollInfoAfterLayout()
could cause us to re-evaluate reasons for compositing, via the call
to updateLayerCompositingState() in RenderLayer::updateScrollInfoAfterLayout().

At this time, when layout is still happening, it's bad to look at render
geometry to decide when to do compositing (e.g. for fixed position); we might
incorrectly conclude that the layer is outside the viewport.

Fix by having RenderLayerCompositing store in a member whether it's safe
to look at layout information. requiresCompositingForPosition() then consults
this bit, and, if it needs to make decisions based on layout but layout is not
complete, it doesn't change the compositing state of the layer.

Not testable, since dumping the layer tree will update layout and mask the bug.

  • rendering/RenderLayerCompositor.cpp:

(WebCore::RenderLayerCompositor::RenderLayerCompositor):
(WebCore::RenderLayerCompositor::updateCompositingLayers):
(WebCore::RenderLayerCompositor::requiresCompositingForPosition):

  • rendering/RenderLayerCompositor.h:

(RenderLayerCompositor):

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r141219 r141221  
     12013-01-29  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Rubberband scrolling on news.google.com causes text to blink repeatedly
     4        https://bugs.webkit.org/show_bug.cgi?id=107326
     5
     6        Reviewed by Beth Dakin.
     7
     8        When in the middle of layout, RenderBlock::updateScrollInfoAfterLayout()
     9        could cause us to re-evaluate reasons for compositing, via the call
     10        to updateLayerCompositingState() in RenderLayer::updateScrollInfoAfterLayout().
     11       
     12        At this time, when layout is still happening, it's bad to look at render
     13        geometry to decide when to do compositing (e.g. for fixed position); we might
     14        incorrectly conclude that the layer is outside the viewport.
     15       
     16        Fix by having RenderLayerCompositing store in a member whether it's safe
     17        to look at layout information. requiresCompositingForPosition() then consults
     18        this bit, and, if it needs to make decisions based on layout but layout is not
     19        complete, it doesn't change the compositing state of the layer.
     20       
     21        Not testable, since dumping the layer tree will update layout and mask the bug.
     22
     23        * rendering/RenderLayerCompositor.cpp:
     24        (WebCore::RenderLayerCompositor::RenderLayerCompositor):
     25        (WebCore::RenderLayerCompositor::updateCompositingLayers):
     26        (WebCore::RenderLayerCompositor::requiresCompositingForPosition):
     27        * rendering/RenderLayerCompositor.h:
     28        (RenderLayerCompositor):
     29
    1302013-01-29  Mark Lam  <mark.lam@apple.com>
    231
  • trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp

    r141121 r141221  
    6262#include "WebCoreMemoryInstrumentation.h"
    6363#include <wtf/MemoryInstrumentationHashMap.h>
     64#include <wtf/TemporaryChange.h>
    6465
    6566#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
     
    201202    , m_shouldFlushOnReattach(false)
    202203    , m_forceCompositingMode(false)
     204    , m_inPostLayoutUpdate(false)
    203205    , m_isTrackingRepaints(false)
    204206    , m_rootLayerAttachment(RootLayerUnattached)
     
    419421    AnimationUpdateBlock animationUpdateBlock(m_renderView->frameView()->frame()->animation());
    420422
     423    TemporaryChange<bool> postLayoutChange(m_inPostLayoutUpdate, true);
     424   
    421425    bool checkForHierarchyUpdate = m_reevaluateCompositingAfterLayout;
    422426    bool needGeometryUpdate = false;
     
    20662070        return false;
    20672071    }
     2072   
     2073    // Subsequent tests depend on layout. If we can't tell now, just keep things the way they are until layout is done.
     2074    if (!m_inPostLayoutUpdate) {
     2075        m_reevaluateCompositingAfterLayout = true;
     2076        return layer->isComposited();
     2077    }
    20682078
    20692079    // Fixed position elements that are invisible in the current view don't get their own layer.
     
    20762086            if (viewportConstrainedNotCompositedReason)
    20772087                *viewportConstrainedNotCompositedReason = RenderLayer::NotCompositedForBoundsOutOfView;
    2078             // Reevaluate compositing after layout because the layer bounds may change and become composited.
    2079             m_reevaluateCompositingAfterLayout = true;
    20802088            return false;
    20812089        }
     
    20832091   
    20842092    bool paintsContent = layer->isVisuallyNonEmpty() || layer->hasVisibleDescendant();
    2085     if (!paintsContent) {
    2086         // isVisuallyNonEmpty() depends on layout.
    2087         m_reevaluateCompositingAfterLayout = true;
    2088         return false;
    2089     }
     2093    if (!paintsContent)
     2094        return false;
    20902095
    20912096    return true;
  • trunk/Source/WebCore/rendering/RenderLayerCompositor.h

    r141121 r141221  
    367367    bool m_shouldFlushOnReattach;
    368368    bool m_forceCompositingMode;
     369    bool m_inPostLayoutUpdate; // true when it's OK to trust layout information (e.g. layer sizes and positions)
    369370
    370371    bool m_isTrackingRepaints; // Used for testing.
Note: See TracChangeset for help on using the changeset viewer.