Skip to content
  • robert@webkit.org's avatar
    Elements with position:absolute don't move to correct position after images load · d739d387
    robert@webkit.org authored
    https://bugs.webkit.org/show_bug.cgi?id=54611
    
    Reviewed by Simon Fraser.
    
    Source/WebCore:
    
    Test: fast/block/positioning/absolute-layout-after-image-load.html
    
    In the test the 'label' block is an absolutely positioned child of an inline flow. So during layout,
    this RenderBlock::layoutPositionedObjects fails to dirty it for rendering because it requires
    the parent to be a BlockFlow. The code to do this was introduced in http://trac.webkit.org/changeset/8284.
    There doesn't seem to be a good reason for requiring a BlockFlow, so remove the check.
    
    Note: Although the issue is encountered only on first load without a fragment identifier, it
    happens reliably when you include the fragment identifier in the url (#Footnote_1). This is so
    because scrolling to the fragment always happens before the image has loaded, rendering the page
    and clearing the initial dirty bits in the positioned element's renderer. When the image finally
    loads in this scenario, the positioned element is otherwise clean and relies on the above code to get
    re-rendered.
    
    Note: This was originally landed in r94755 but positioned-float-layout-after-image-load.html exposed
          an ASSERT bug, unrelated to this change, and was rolled out. That issue is tracked separately
          in bug 67759.
    
    * rendering/RenderBlock.cpp:
    (WebCore::RenderBlock::layoutPositionedObjects): remove the check for r->parent()->isBlockFlow() when
                                                     deciding whether to mark children for layout
    
    LayoutTests:
    
    * fast/block/positioning/absolute-layout-after-image-load-expected.txt: Added.
    * fast/block/positioning/absolute-layout-after-image-load.html: Added.
    * fast/block/positioning/resources/absolute-layout-after-image-load-2.html: Added.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@94785 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    d739d387