Factor free standing tree style resolve functions into a class
https://bugs.webkit.org/show_bug.cgi?id=152786
Reviewed by Simon Fraser.
Factor the free standing tree style resolve functions into a class that can keep state.
Style::TreeResolver instances resolve a single tree scope. It is instantiated for resolving
the document style and then recursively for each encountered shadow tree.
This will enable new features and optimizations later.
* dom/Document.cpp:
(WebCore::Document::recalcStyle):
Move the root style computation code back to Document. It fits better here and avoid some
awkwardness with style resolver construction order.
* style/StyleResolveTree.cpp:
(WebCore::Style::TreeResolver::TreeResolver):
TreeResolver knows the current tree context and the StyleResolver to use for it.
Switch the functions to use these instead of recomputing them repeatedly.
(WebCore::Style::shouldCreateRenderer):
(WebCore::Style::TreeResolver::styleForElement):
(WebCore::Style::moveToFlowThreadIfNeeded):
(WebCore::Style::TreeResolver::createRenderer):
(WebCore::Style::updateTextRendererAfterContentChange):
(WebCore::Style::TreeResolver::createRenderTreeForChildren):
(WebCore::Style::TreeResolver::createRenderTreeForShadowRoot):
(WebCore::Style::needsPseudoElement):
(WebCore::Style::TreeResolver::createRenderTreeForBeforeOrAfterPseudoElement):
(WebCore::Style::TreeResolver::createRenderTreeForSlotAssignees):
(WebCore::Style::TreeResolver::createRenderTreeRecursively):
Rename to reduce the use of confusing "attach" terminology.
(WebCore::Style::pseudoStyleCacheIsInvalid):
(WebCore::Style::TreeResolver::resolveLocally):
(WebCore::Style::resolveTextNode):
(WebCore::Style::TreeResolver::resolveChildAtShadowBoundary):
(WebCore::Style::TreeResolver::resolveShadowTree):
(WebCore::Style::TreeResolver::resolveBeforeOrAfterPseudoElement):
(WebCore::Style::TreeResolver::resolveChildren):
(WebCore::Style::TreeResolver::resolveSlotAssignees):
(WebCore::Style::TreeResolver::resolveRecursively):
(WebCore::Style::TreeResolver::resolve):
(WebCore::Style::detachRenderTree):
(WebCore::Style::styleForElement): Deleted.
(WebCore::Style::createRendererIfNeeded): Deleted.
(WebCore::Style::attachChildren): Deleted.
(WebCore::Style::attachShadowRoot): Deleted.
(WebCore::Style::attachBeforeOrAfterPseudoElementIfNeeded): Deleted.
(WebCore::Style::attachSlotAssignees): Deleted.
(WebCore::Style::attachRenderTree): Deleted.
(WebCore::Style::resolveLocal): Deleted.
(WebCore::Style::resolveChildAtShadowBoundary): Deleted.
(WebCore::Style::resolveShadowTree): Deleted.
(WebCore::Style::updateBeforeOrAfterPseudoElement): Deleted.
(WebCore::Style::resolveChildren): Deleted.
(WebCore::Style::resolveSlotAssignees): Deleted.
(WebCore::Style::resolveTree): Deleted.
* style/StyleResolveTree.h:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@194691 268f45cc-cd09-0410-ab3c-d52691b4dbfc
15 files changed