[CSS Regions] Fix content node renderers ordering inside the named flow thread
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 29 Nov 2012 08:35:50 +0000 (08:35 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 29 Nov 2012 08:35:50 +0000 (08:35 +0000)
commit876f879c76d9750d46397f5809b763c72db66606
tree16a063cd373602ee22a08e297b5f0f2bb7033340
parent550d6b2f616e72522805c4c1d340b5feb8822756
[CSS Regions] Fix content node renderers ordering inside the named flow thread
https://bugs.webkit.org/show_bug.cgi?id=103501

Patch by Andrei Bucur <abucur@adobe.com> on 2012-11-29
Reviewed by David Hyatt.

Source/WebCore:

This patch fixes two issues with how content nodes renderers are added to a named flow thread.
The first issue was about determining the insertion position of a renderer inside the children list of a named flow thread. Before this patch, the
insertion point was based on both the DOM ordering of the elements and insertion order of previous renderers.
The patch fixes this and makes the renderer position just a function of the DOM ordering of elements.
The second issue appeared when next/previousRenderer methods were skipping nodes because they had the flow-into property as a side effect
of copying the style of the parent element (e.g. Text nodes). The patch ensures the skipped nodes are also elements.

Tests: fast/regions/named-flow-content-order-1.html
       fast/regions/named-flow-content-order-2.html
       fast/regions/named-flow-content-order-3.html

* dom/NodeRenderingContext.cpp:
(WebCore::NodeRenderingContext::nextRenderer): Skip only elements.
(WebCore::NodeRenderingContext::previousRenderer): Skip only elements.
* rendering/RenderNamedFlowThread.cpp:
(WebCore::RenderNamedFlowThread::addFlowChild): Insert the renderer in the list based on the DOM position of the owner element.
* rendering/RenderNamedFlowThread.h:
(RenderNamedFlowThread):
* rendering/RenderObject.cpp:
(WebCore::RenderObject::renderNamedFlowThreadWrapper): Rename to eliminate the confusion with enclosingRenderFlowThread.
(WebCore::RenderObject::insertedIntoTree):
(WebCore::RenderObject::willBeRemovedFromTree):
* rendering/RenderObject.h:
(RenderObject):

LayoutTests:

The first two ref tests cover the issue with incorrectly computing the insertion position for a content node renderer.
The third ref test covers the issue with nextRenderer and previousRenderer skipping valid nodes.

* fast/regions/named-flow-content-order-1-expected.html: Added.
* fast/regions/named-flow-content-order-1.html: Added.
* fast/regions/named-flow-content-order-2-expected.html: Added.
* fast/regions/named-flow-content-order-2.html: Added.
* fast/regions/named-flow-content-order-3-expected.html: Added.
* fast/regions/named-flow-content-order-3.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@136107 268f45cc-cd09-0410-ab3c-d52691b4dbfc
13 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/regions/named-flow-content-order-1-expected.html [new file with mode: 0644]
LayoutTests/fast/regions/named-flow-content-order-1.html [new file with mode: 0644]
LayoutTests/fast/regions/named-flow-content-order-2-expected.html [new file with mode: 0644]
LayoutTests/fast/regions/named-flow-content-order-2.html [new file with mode: 0644]
LayoutTests/fast/regions/named-flow-content-order-3-expected.html [new file with mode: 0644]
LayoutTests/fast/regions/named-flow-content-order-3.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/dom/NodeRenderingContext.cpp
Source/WebCore/rendering/RenderNamedFlowThread.cpp
Source/WebCore/rendering/RenderNamedFlowThread.h
Source/WebCore/rendering/RenderObject.cpp
Source/WebCore/rendering/RenderObject.h