Elements with position:absolute don't move to correct position after images load
authorrobert@webkit.org <robert@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 7 Sep 2011 18:59:55 +0000 (18:59 +0000)
committerrobert@webkit.org <robert@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 7 Sep 2011 18:59:55 +0000 (18:59 +0000)
commit36088f9cf8bec2d05edcabf83de1b0614a2b0d01
tree2b048f4d328c9a80591b2745382dc000afa4901a
parent6c58f2f99ba7a0174f9a088a45b18494ed467280
Elements with position:absolute don't move to correct position after images load
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
      fast/block/positioning/positioned-float-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. Do the same
for positioned floats in RenderBlock::positionedFloatsNeedRelayout(), although currently layoutPositionedObjects()
takes care of it this at least ensures no regression in future.

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.

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::layoutPositionedObjects): remove the check for r->parent()->isBlockFlow() when
                                                 deciding whether to mark children for layout
(WebCore::RenderBlock::positionedFloatsNeedRelayout): ditto

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.
* fast/block/positioning/positioned-float-layout-after-image-load-expected.txt: Added.
* fast/block/positioning/positioned-float-layout-after-image-load.html: Added.
* fast/block/positioning/resources/positioned-float-layout-after-image-load-2.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@94695 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/block/positioning/absolute-layout-after-image-load-expected.txt [new file with mode: 0644]
LayoutTests/fast/block/positioning/absolute-layout-after-image-load.html [new file with mode: 0644]
LayoutTests/fast/block/positioning/positioned-float-layout-after-image-load-expected.txt [new file with mode: 0644]
LayoutTests/fast/block/positioning/positioned-float-layout-after-image-load.html [new file with mode: 0644]
LayoutTests/fast/block/positioning/resources/absolute-layout-after-image-load-2.html [new file with mode: 0644]
LayoutTests/fast/block/positioning/resources/positioned-float-layout-after-image-load-2.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderBlock.cpp