Source/WebCore: [CSS Regions] Elements in a region should be assignable to a named...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 22 Apr 2013 09:05:52 +0000 (09:05 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 22 Apr 2013 09:05:52 +0000 (09:05 +0000)
commit487573339057aa6442ffc3aa0dae89562135a15f
treed20d9af64b36115d17dca1fa88b3416d80f94ed7
parente8284775ac5321e03a8c6cd8b701dd4d7a07e83c
Source/WebCore: [CSS Regions] Elements in a region should be assignable to a named flow
https://bugs.webkit.org/show_bug.cgi?id=74144

Patch by Mihai Maerean <mmaerean@adobe.com> on 2013-04-22
Reviewed by David Hyatt.

DOM children of a region must not be rendered as children of the region, but can be collected in flow threads.

NodeRenderingContext::parentRenderer now creates the parent render flow thread if it doesn't exist.

Element::moveToFlowThreadIsNeeded is a virtual method that is overriden in PseudoElement to return false and
in SVGElement so only svg root elements can directly be collected by a render flow thread.

RenderObject::canDOMChildrenHaveRenderParent exists to optimize the code so nodes inside regions (and maybe
other types of renderers in the future) can still have renderers if they need to be in a flow thread while the
rest of renderers that can't have children skip the new instructions.

Tests: fast/regions/flow-body-in-html.html . To test the duplicate bug #103685.
       fast/regions/region-content-flown-into-region.html
       fast/regions/universal-selector-children-to-the-same-region.html . To test the duplicate bug #103685.

* dom/Element.cpp:
(WebCore::Element::moveToFlowThreadIsNeeded):
* dom/Element.h:
* dom/NodeRenderingContext.cpp:
(WebCore::NodeRenderingContext::parentRenderer): the renderer that will be the parent for this node's renderer.
In the case of RenderFlowThreads, it may need to create it.
(WebCore::NodeRenderingContext::shouldCreateRenderer): In a region, only the children that need to be in a flow
thread should have a renderer.
(WebCore::NodeRenderingContext::moveToFlowThreadIfNeeded):
(WebCore::NodeRenderingContext::moveToFlowThread):
* dom/NodeRenderingContext.h:
(NodeRenderingContext):
* dom/PseudoElement.h: pseudo-elements cannot be directly collected into a named flow.
* dom/Text.cpp:
(WebCore::Text::textRendererIsNeeded):
(WebCore::Text::updateTextRenderer): Because calling textRendererIsNeeded(NodeRenderingContext(...)) on a
non-const l-value NodeRenderingContext cannot be done on a temporary object on the stack.
* dom/Text.h:
* rendering/FlowThreadController.cpp:
(WebCore::FlowThreadController::isContentNodeRegisteredWithAnyNamedFlow):
* rendering/FlowThreadController.h:
* rendering/RenderObject.h:
(WebCore::RenderObject::canDOMChildrenHaveRenderParent): Even if this render object can't have render children,
the children in the DOM tree may have a render parent (that is different from this render object).
* rendering/RenderRegion.h:
* svg/SVGElement.cpp:
(WebCore::SVGElement::moveToFlowThreadIsNeeded): Allow only svg root elements to be directly collected by a
render flow thread.
* svg/SVGElement.h:

LayoutTests:  [CSS Regions] Elements in a region should be assignable to a named flow
https://bugs.webkit.org/show_bug.cgi?id=74144

 Reviewed by David Hyatt.

 * fast/regions/flow-body-in-html-expected.txt: Added.
Patch by Mihai Maerean <mmaerean@adobe.com> on 2013-04-22

* fast/regions/flow-body-in-html.html: Added. To test the duplicate bug #103685.
* fast/regions/region-content-flown-into-region-expected.txt: Added.
* fast/regions/region-content-flown-into-region.html: Added.
* fast/regions/universal-selector-children-to-the-same-region-expected.txt: Added.
* fast/regions/universal-selector-children-to-the-same-region.html: Added. To test the duplicate bug #103685.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@148865 268f45cc-cd09-0410-ab3c-d52691b4dbfc
21 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/regions/flow-body-in-html-expected.txt [new file with mode: 0644]
LayoutTests/fast/regions/flow-body-in-html.html [new file with mode: 0644]
LayoutTests/fast/regions/region-content-flown-into-region-expected.html [new file with mode: 0644]
LayoutTests/fast/regions/region-content-flown-into-region.html [new file with mode: 0644]
LayoutTests/fast/regions/universal-selector-children-to-the-same-region-expected.txt [new file with mode: 0644]
LayoutTests/fast/regions/universal-selector-children-to-the-same-region.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/dom/Element.cpp
Source/WebCore/dom/Element.h
Source/WebCore/dom/NodeRenderingContext.cpp
Source/WebCore/dom/NodeRenderingContext.h
Source/WebCore/dom/PseudoElement.h
Source/WebCore/dom/Text.cpp
Source/WebCore/dom/Text.h
Source/WebCore/rendering/FlowThreadController.cpp
Source/WebCore/rendering/FlowThreadController.h
Source/WebCore/rendering/RenderObject.h
Source/WebCore/rendering/RenderRegion.h
Source/WebCore/svg/SVGElement.cpp
Source/WebCore/svg/SVGElement.h