• antti@apple.com's avatar
    Test if non-immediate descendants obscure background · 4f141bf6
    antti@apple.com authored
    https://bugs.webkit.org/show_bug.cgi?id=113137
    
    Reviewed by Simon Fraser.
    
    Source/WebCore: 
    
    The current obscuration test only covers immediate children. We can find more cases by looking deeper into descendants.
            
    The patch makes the test sufficiently smart to stop a heavy fully obscured gif animation on micrsoft.com.
    
    * loader/cache/CachedImage.cpp:
    (WebCore::CachedImage::animationAdvanced):
    * rendering/RenderBox.cpp:
    (WebCore::RenderBox::styleDidChange):
            
        Invalidate parents to max test depth.
    
    (WebCore::RenderBox::backgroundPaintedExtent):
            
        Background painting is pixel snapped.
    
    (WebCore::isCandidateForOpaquenessTest):
    (WebCore::RenderBox::foregroundIsKnownToBeOpaqueInRect):
            
        Separate foreground testing and make it recursive.
        Add fast bailout for common static positioned case.
        Remove maximum child count, the fast bailouts should prevent long tests.
        Add maximum depth so we know how deep we need to invalidate in styleDidChange.
    
    (WebCore::RenderBox::computeBackgroundIsKnownToBeObscured):
    (WebCore):
    * rendering/RenderBox.h:
    (RenderBox):
    * rendering/RenderImage.cpp:
    (WebCore::RenderImage::foregroundIsKnownToBeOpaqueInRect):
    (WebCore):
    (WebCore::RenderImage::computeBackgroundIsKnownToBeObscured):
            
    * rendering/RenderImage.h:
    (RenderImage):
    
    LayoutTests: 
    
    * fast/backgrounds/obscured-background-child-style-change-expected.html:
    * fast/backgrounds/obscured-background-child-style-change.html:
    * fast/repaint/obscured-background-no-repaint-expected.txt:
    * fast/repaint/obscured-background-no-repaint.html:
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@146955 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    4f141bf6
RenderBox.h 39 KB