display:contents should work with dynamic table mutations
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 2 Nov 2017 22:38:35 +0000 (22:38 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 2 Nov 2017 22:38:35 +0000 (22:38 +0000)
commit7ccd4208a45713d0ddc8f9698dc63d7b98912c06
treeda209f6c9495b04c7b694635a8a43ddb1cd1eb57
parent1dd96d255d0c9757d8341caaed8d5d89f0f95e8f
display:contents should work with dynamic table mutations
https://bugs.webkit.org/show_bug.cgi?id=179179

Reviewed by Ryosuke Niwa.

Source/WebCore:

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::addChildIgnoringContinuation):

    RenderText with inline text wrapper as beforeChild is now resolved in RenderTreePosition, covering all cases.
    Verify this with assert.

* rendering/RenderElement.cpp:
(WebCore::RenderElement::insertChildInternal):

    Add assertion.

* rendering/RenderTableSection.cpp:
(WebCore::RenderTableSection::addChild):

    Fix cases where we did unchecked downcasts for anonymous beforeChild.

* style/RenderTreePosition.cpp:
(WebCore::RenderTreePosition::insert):

    When inserting before a text rendeder with an display:contents inline wrapper, use the wrapper as beforeChild.

* style/RenderTreePosition.h:
(WebCore::RenderTreePosition::insert): Deleted.
* style/RenderTreeUpdater.cpp:
(WebCore::RenderTreeUpdater::updateRenderTree):
(WebCore::RenderTreeUpdater::renderingParent):

    Add separate helper to get parent frame for the closest rendered (non display:contents) ancestor.

(WebCore::RenderTreeUpdater::renderTreePosition):
(WebCore::RenderTreeUpdater::updateElementRenderer):
(WebCore::RenderTreeUpdater::textRendererIsNeeded):
(WebCore::RenderTreeUpdater::updateTextRenderer):
(WebCore::RenderTreeUpdater::storePreviousRenderer):

    Use it for tracking state related to render tree siblings. With this we compute whitespace nodes
    correctly for display:contents. The test cases end up depending on that.

* style/RenderTreeUpdater.h:

LayoutTests:

* TestExpectations:

These now pass:

imported/w3c/web-platform-tests/css/css-display-3/display-contents-dynamic-table-001-none.html
imported/w3c/web-platform-tests/css/css-display-3/display-contents-dynamic-table-002-none.html

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@224360 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderBlock.cpp
Source/WebCore/rendering/RenderElement.cpp
Source/WebCore/rendering/RenderTableSection.cpp
Source/WebCore/style/RenderTreePosition.cpp
Source/WebCore/style/RenderTreePosition.h
Source/WebCore/style/RenderTreeUpdater.cpp
Source/WebCore/style/RenderTreeUpdater.h