RenderQuote should not mutate render tree
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 9 Aug 2017 07:36:45 +0000 (07:36 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 9 Aug 2017 07:36:45 +0000 (07:36 +0000)
commit7e7e0436654d5d11b00dd50336d79de2e663fa36
tree346810c992d9111400d8b9c6b76f09d3184507df
parentab44b9d663cff954f46426895df2e94206c13bc5
RenderQuote should not mutate render tree
https://bugs.webkit.org/show_bug.cgi?id=175328

Reviewed by Zalan Bujtas.

RenderQuote text renderers are currently created and deleted in a quirky fashion using a linked list.
This patch moves to a simpler model that guarantees the mutations are always done in controlled fashion
during render tree update.

* dom/Document.cpp:
(WebCore::Document::updateTextRenderer):

    Move text renderer updating to Document so we can set the inRenderTreeUpdate bit for it too.

* dom/Document.h:
* dom/Text.cpp:
(WebCore::Text::updateRendererAfterContentChange):
* rendering/RenderDescendantIterator.h:
(WebCore::RenderDescendantIteratorAdapter<T>::at):
(WebCore::RenderDescendantConstIteratorAdapter<T>::at const):

    Add at() function for starting iteration from a specified renderer.

* rendering/RenderQuote.cpp:
(WebCore::RenderQuote::insertedIntoTree):
(WebCore::RenderQuote::willBeRemovedFromTree):

    Register and unregister quotes to RenderView.
    Don't do any mutations.

(WebCore::RenderQuote::styleDidChange):

    Invalidate the text renderer but don't mutate it.

(WebCore::RenderQuote::updateTextRenderer):
(WebCore::RenderQuote::computeText const):
(WebCore::RenderQuote::updateRenderers):

    Compute depth of all render quotes and update the text renderer as needed.

(WebCore::RenderQuote::willBeDestroyed): Deleted.
(WebCore::RenderQuote::attachQuote): Deleted.
(WebCore::RenderQuote::detachQuote): Deleted.
(WebCore::RenderQuote::updateDepth): Deleted.

    Get rid of the linked list.

* rendering/RenderQuote.h:
* rendering/RenderView.cpp:
(WebCore::RenderView::registerQuote):
(WebCore::RenderView::unregisterQuote):

    Maintain a render tree order ListHashSet of RenderQuotes.

(WebCore::RenderView::updateSpecialRenderers):

    Add a function for making additional render tree mutations at the end of a render tree update.
    Currently this just invokes RenderQuote::updateRenderers.

* rendering/RenderView.h:
* style/RenderTreeUpdater.cpp:
(WebCore::RenderTreeUpdater::commit):

    Call RenderView::updateSpecialRenderers after committing all other changes.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@220447 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/Document.h
Source/WebCore/dom/Text.cpp
Source/WebCore/rendering/RenderDescendantIterator.h
Source/WebCore/rendering/RenderQuote.cpp
Source/WebCore/rendering/RenderQuote.h
Source/WebCore/rendering/RenderView.cpp
Source/WebCore/rendering/RenderView.h
Source/WebCore/style/RenderTreeUpdater.cpp