Introduce RenderTreeBuilder
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 16 Dec 2017 19:07:55 +0000 (19:07 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 16 Dec 2017 19:07:55 +0000 (19:07 +0000)
commitf40e66eb9121f67af15c04abaa22d0051b7acbef
tree78bbe49db5204c9ff0630753dcf35f86f547c3b0
parent53f69d9466f0a005d4d52723e4deb1876f7d46d0
Introduce RenderTreeBuilder
https://bugs.webkit.org/show_bug.cgi?id=180817

Reviewed by Zalan Bujtas.

RenderTreeBuilder is responsible of building the render tree, including construction of various anonymous
renderers. Renderer subtype specific render tree construction code will eventually move there.

This patch adds RenderTreeBuilder class and passes it as a parameter for all addChild implementations.
Future patches can then mechanically move the building code from renderers to RenderTreeBuilder.

It also moves one addChild implementation (RenderRuby::addChild -> RenderTreeBuilder::rubyRunInsertChild)
to RenderTreeBuilder as a test.

* WebCore.xcodeproj/project.pbxproj:
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::addChildToContinuation):
(WebCore::RenderBlock::addChild):
(WebCore::RenderBlock::addChildIgnoringContinuation):
* rendering/RenderBlock.h:
* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::addChild):
* rendering/RenderBlockFlow.h:
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::moveChildTo):
* rendering/RenderButton.cpp:
(WebCore::RenderButton::addChild):
(WebCore::RenderButton::setText):
* rendering/RenderButton.h:
* rendering/RenderElement.cpp:
(WebCore::RenderElement::addChild):
* rendering/RenderElement.h:
(WebCore::RenderElement::addChildIgnoringContinuation):
* rendering/RenderFullScreen.cpp:
(WebCore::RenderFullScreen::wrapNewRenderer):
(WebCore::RenderFullScreen::wrapExistingRenderer):
(WebCore::RenderFullScreen::unwrapRenderer):
(WebCore::RenderFullScreen::createPlaceholder):
* rendering/RenderGrid.cpp:
(WebCore::RenderGrid::addChild):
* rendering/RenderGrid.h:
* rendering/RenderInline.cpp:
(WebCore::RenderInline::addChild):
(WebCore::RenderInline::addChildIgnoringContinuation):
(WebCore::RenderInline::splitInlines):
(WebCore::RenderInline::splitFlow):
(WebCore::RenderInline::addChildToContinuation):
(WebCore::RenderInline::childBecameNonInline):
* rendering/RenderInline.h:
* rendering/RenderMenuList.cpp:
(WebCore::RenderMenuList::createInnerBlock):
(RenderMenuList::addChild):
(RenderMenuList::setText):
* rendering/RenderMenuList.h:
* rendering/RenderMultiColumnFlow.cpp:
(WebCore::RenderMultiColumnFlow::processPossibleSpannerDescendant):
* rendering/RenderQuote.cpp:
(WebCore::RenderQuote::updateTextRenderer):
(WebCore::RenderQuote::updateRenderer):
* rendering/RenderQuote.h:
* rendering/RenderRuby.cpp:
(WebCore::RenderRubyAsInline::addChild):
(WebCore::RenderRubyAsBlock::addChild):
* rendering/RenderRuby.h:
* rendering/RenderRubyBase.h:
* rendering/RenderRubyRun.cpp:
(WebCore::RenderRubyRun::rubyBaseSafe):
(WebCore::RenderRubyRun::addChild): Deleted.
* rendering/RenderRubyRun.h:
* rendering/RenderTable.cpp:
(WebCore::RenderTable::addChild):
* rendering/RenderTable.h:
* rendering/RenderTableRow.cpp:
(WebCore::RenderTableRow::addChild):
* rendering/RenderTableRow.h:
* rendering/RenderTableSection.cpp:
(WebCore::RenderTableSection::addChild):
* rendering/RenderTableSection.h:
* rendering/RenderTreeBuilder.cpp: Added.
(WebCore::RenderTreeBuilder::RenderTreeBuilder):
(WebCore::RenderTreeBuilder::~RenderTreeBuilder):
(WebCore::RenderTreeBuilder::insertChild):
(WebCore::RenderTreeBuilder::rubyRunInsertChild):
* rendering/RenderTreeBuilder.h: Added.
(WebCore::RenderTreeBuilder::current):
* rendering/TextAutoSizing.cpp:
(WebCore::TextAutoSizingValue::adjustTextNodeSizes):
* rendering/mathml/RenderMathMLFenced.cpp:
(WebCore::RenderMathMLFenced::updateFromElement):
(WebCore::RenderMathMLFenced::makeFences):
(WebCore::RenderMathMLFenced::addChild):
* rendering/mathml/RenderMathMLFenced.h:
* rendering/svg/RenderSVGContainer.cpp:
(WebCore::RenderSVGContainer::addChild):
* rendering/svg/RenderSVGContainer.h:
* rendering/svg/RenderSVGInline.cpp:
(WebCore::RenderSVGInline::addChild):
* rendering/svg/RenderSVGInline.h:
* rendering/svg/RenderSVGRoot.cpp:
(WebCore::RenderSVGRoot::addChild):
* rendering/svg/RenderSVGRoot.h:
* rendering/svg/RenderSVGText.cpp:
(WebCore::RenderSVGText::addChild):
* rendering/svg/RenderSVGText.h:
* style/RenderTreePosition.cpp:
(WebCore::RenderTreePosition::insert): Deleted.
* style/RenderTreePosition.h:
(WebCore::RenderTreePosition::RenderTreePosition):
(WebCore::RenderTreePosition::nextSibling const):
(WebCore::RenderTreePosition::canInsert const): Deleted.
* style/RenderTreeUpdater.cpp:
(WebCore::RenderTreeUpdater::updateAfterDescendants):
(WebCore::RenderTreeUpdater::createRenderer):
(WebCore::RenderTreeUpdater::createTextRenderer):
(WebCore::RenderTreeUpdater::updateTextRenderer):
(WebCore::createTextRenderer): Deleted.
* style/RenderTreeUpdater.h:
* style/RenderTreeUpdaterFirstLetter.cpp:
(WebCore::updateFirstLetterStyle):
(WebCore::createFirstLetterRenderer):
* style/RenderTreeUpdaterGeneratedContent.cpp:
(WebCore::RenderTreeUpdater::GeneratedContent::updateQuotesUpTo):
(WebCore::createContentRenderers):
(WebCore::RenderTreeUpdater::GeneratedContent::updatePseudoElement):
* style/RenderTreeUpdaterListItem.cpp:
(WebCore::RenderTreeUpdater::ListItem::updateMarker):
* style/RenderTreeUpdaterListItem.h:
* style/RenderTreeUpdaterMultiColumn.cpp:
(WebCore::RenderTreeUpdater::MultiColumn::createFragmentedFlow):
(WebCore::RenderTreeUpdater::MultiColumn::destroyFragmentedFlow):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@226007 268f45cc-cd09-0410-ab3c-d52691b4dbfc
59 files changed:
Source/WebCore/ChangeLog
Source/WebCore/Sources.txt
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/dom/Element.cpp
Source/WebCore/dom/Element.h
Source/WebCore/rendering/RenderBlock.cpp
Source/WebCore/rendering/RenderBlock.h
Source/WebCore/rendering/RenderBlockFlow.cpp
Source/WebCore/rendering/RenderBlockFlow.h
Source/WebCore/rendering/RenderBoxModelObject.cpp
Source/WebCore/rendering/RenderButton.cpp
Source/WebCore/rendering/RenderButton.h
Source/WebCore/rendering/RenderElement.cpp
Source/WebCore/rendering/RenderElement.h
Source/WebCore/rendering/RenderFullScreen.cpp
Source/WebCore/rendering/RenderFullScreen.h
Source/WebCore/rendering/RenderGrid.cpp
Source/WebCore/rendering/RenderGrid.h
Source/WebCore/rendering/RenderInline.cpp
Source/WebCore/rendering/RenderInline.h
Source/WebCore/rendering/RenderMenuList.cpp
Source/WebCore/rendering/RenderMenuList.h
Source/WebCore/rendering/RenderMultiColumnFlow.cpp
Source/WebCore/rendering/RenderQuote.cpp
Source/WebCore/rendering/RenderQuote.h
Source/WebCore/rendering/RenderRuby.cpp
Source/WebCore/rendering/RenderRuby.h
Source/WebCore/rendering/RenderRubyBase.h
Source/WebCore/rendering/RenderRubyRun.cpp
Source/WebCore/rendering/RenderRubyRun.h
Source/WebCore/rendering/RenderTable.cpp
Source/WebCore/rendering/RenderTable.h
Source/WebCore/rendering/RenderTableRow.cpp
Source/WebCore/rendering/RenderTableRow.h
Source/WebCore/rendering/RenderTableSection.cpp
Source/WebCore/rendering/RenderTableSection.h
Source/WebCore/rendering/RenderTreeBuilder.cpp [new file with mode: 0644]
Source/WebCore/rendering/RenderTreeBuilder.h [new file with mode: 0644]
Source/WebCore/rendering/TextAutoSizing.cpp
Source/WebCore/rendering/mathml/RenderMathMLFenced.cpp
Source/WebCore/rendering/mathml/RenderMathMLFenced.h
Source/WebCore/rendering/svg/RenderSVGContainer.cpp
Source/WebCore/rendering/svg/RenderSVGContainer.h
Source/WebCore/rendering/svg/RenderSVGInline.cpp
Source/WebCore/rendering/svg/RenderSVGInline.h
Source/WebCore/rendering/svg/RenderSVGRoot.cpp
Source/WebCore/rendering/svg/RenderSVGRoot.h
Source/WebCore/rendering/svg/RenderSVGText.cpp
Source/WebCore/rendering/svg/RenderSVGText.h
Source/WebCore/style/RenderTreePosition.cpp
Source/WebCore/style/RenderTreePosition.h
Source/WebCore/style/RenderTreeUpdater.cpp
Source/WebCore/style/RenderTreeUpdater.h
Source/WebCore/style/RenderTreeUpdaterFirstLetter.cpp
Source/WebCore/style/RenderTreeUpdaterGeneratedContent.cpp
Source/WebCore/style/RenderTreeUpdaterGeneratedContent.h
Source/WebCore/style/RenderTreeUpdaterListItem.cpp
Source/WebCore/style/RenderTreeUpdaterListItem.h
Source/WebCore/style/RenderTreeUpdaterMultiColumn.cpp