|
Lines 199-204
auto TreeResolver::computeDescendantsToResolve(Change change, Validity validity,
a/Source/WebCore/style/StyleTreeResolver.cpp_sec1
|
| 199 |
case Change::FastPathInherited: |
199 |
case Change::FastPathInherited: |
| 200 |
case Change::Inherited: |
200 |
case Change::Inherited: |
| 201 |
return DescendantsToResolve::Children; |
201 |
return DescendantsToResolve::Children; |
|
|
202 |
case Change::Descendants: |
| 203 |
return DescendantsToResolve::All; |
| 202 |
case Change::Renderer: |
204 |
case Change::Renderer: |
| 203 |
return DescendantsToResolve::All; |
205 |
return DescendantsToResolve::All; |
| 204 |
}; |
206 |
}; |
|
Lines 625-630
ElementUpdate TreeResolver::createAnimatedElementUpdate(std::unique_ptr<RenderSt
a/Source/WebCore/style/StyleTreeResolver.cpp_sec2
|
| 625 |
void TreeResolver::pushParent(Element& element, const RenderStyle& style, Change change, DescendantsToResolve descendantsToResolve) |
627 |
void TreeResolver::pushParent(Element& element, const RenderStyle& style, Change change, DescendantsToResolve descendantsToResolve) |
| 626 |
{ |
628 |
{ |
| 627 |
scope().selectorMatchingState.selectorFilter.pushParent(&element); |
629 |
scope().selectorMatchingState.selectorFilter.pushParent(&element); |
|
|
630 |
if (style.containerType() != ContainerType::None) |
| 631 |
scope().selectorMatchingState.queryContainers.append(element); |
| 628 |
|
632 |
|
| 629 |
Parent parent(element, style, change, descendantsToResolve); |
633 |
Parent parent(element, style, change, descendantsToResolve); |
| 630 |
|
634 |
|
|
Lines 645-651
void TreeResolver::popParent()
a/Source/WebCore/style/StyleTreeResolver.cpp_sec3
|
| 645 |
auto& parentElement = *parent().element; |
649 |
auto& parentElement = *parent().element; |
| 646 |
|
650 |
|
| 647 |
parentElement.setHasValidStyle(); |
651 |
parentElement.setHasValidStyle(); |
| 648 |
parentElement.clearChildNeedsStyleRecalc(); |
652 |
// Don't clear the child flag if the are unresolved containers because we are going to resume the style resolution. |
|
|
653 |
if (m_unresolvedQueryContainers.isEmpty()) |
| 654 |
parentElement.clearChildNeedsStyleRecalc(); |
| 649 |
|
655 |
|
| 650 |
if (parent().didPushScope) |
656 |
if (parent().didPushScope) |
| 651 |
popScope(); |
657 |
popScope(); |
|
Lines 834-843
void TreeResolver::resolveComposedTree()
a/Source/WebCore/style/StyleTreeResolver.cpp_sec4
|
| 834 |
if (!style) |
840 |
if (!style) |
| 835 |
resetStyleForNonRenderedDescendants(element); |
841 |
resetStyleForNonRenderedDescendants(element); |
| 836 |
|
842 |
|
| 837 |
bool shouldIterateChildren = style && (element.childNeedsStyleRecalc() || descendantsToResolve != DescendantsToResolve::None); |
843 |
auto queryContainerAction = determineQueryContainerAction(element, style, previousContainerType); |
| 838 |
|
844 |
|
| 839 |
if (style && updateQueryContainer(element, *style, previousContainerType) == QueryContainerAction::Layout) |
845 |
bool shouldIterateChildren = [&] { |
| 840 |
shouldIterateChildren = false; |
846 |
// display::none, no need to resolve descendants. |
|
|
847 |
if (!style) |
| 848 |
return false; |
| 849 |
// Style resolution will be resumed after the container has been resolved. |
| 850 |
if (queryContainerAction == QueryContainerAction::Resolve) |
| 851 |
return false; |
| 852 |
return element.childNeedsStyleRecalc() || descendantsToResolve != DescendantsToResolve::None; |
| 853 |
}(); |
| 854 |
|
| 855 |
// Ensure we respect DescendantsToResolve::All after resuming the style resolution. |
| 856 |
if (queryContainerAction == QueryContainerAction::Resolve && descendantsToResolve == DescendantsToResolve::All) |
| 857 |
element.invalidateStyleForSubtreeInternal(); |
| 841 |
|
858 |
|
| 842 |
if (!m_didSeePendingStylesheet) |
859 |
if (!m_didSeePendingStylesheet) |
| 843 |
m_didSeePendingStylesheet = hasLoadingStylesheet(m_document.styleScope(), element, !shouldIterateChildren); |
860 |
m_didSeePendingStylesheet = hasLoadingStylesheet(m_document.styleScope(), element, !shouldIterateChildren); |
|
Lines 860-898
void TreeResolver::resolveComposedTree()
a/Source/WebCore/style/StyleTreeResolver.cpp_sec5
|
| 860 |
popParentsToDepth(1); |
877 |
popParentsToDepth(1); |
| 861 |
} |
878 |
} |
| 862 |
|
879 |
|
| 863 |
auto TreeResolver::updateQueryContainer(Element& element, const RenderStyle& style, ContainerType previousContainerType) -> QueryContainerAction |
880 |
auto TreeResolver::determineQueryContainerAction(Element& element, const RenderStyle* style, ContainerType previousContainerType) -> QueryContainerAction |
| 864 |
{ |
881 |
{ |
| 865 |
if (style.containerType() != ContainerType::None) |
882 |
if (!style) |
| 866 |
scope().selectorMatchingState.queryContainers.append(element); |
883 |
return QueryContainerAction::None; |
| 867 |
|
|
|
| 868 |
if (m_unresolvedQueryContainers.remove(&element)) |
| 869 |
return QueryContainerAction::Continue; |
| 870 |
|
884 |
|
| 871 |
// Render tree needs to be updated before proceeding to children also if we have a former query container |
885 |
// FIXME: Render tree needs to be updated before proceeding to children also if we have a former query container |
| 872 |
// because container query resolution for descendants relies on it being up-to-date. |
886 |
// because container unit resolution for descendants relies on it being up-to-date. |
| 873 |
if (style.containerType() == ContainerType::None && previousContainerType == ContainerType::None) |
887 |
if (style->containerType() == ContainerType::None && previousContainerType == ContainerType::None) |
| 874 |
return QueryContainerAction::None; |
888 |
return QueryContainerAction::None; |
| 875 |
|
889 |
|
| 876 |
if (m_update->isEmpty()) |
890 |
if (m_resolvedQueryContainers.contains(&element)) |
| 877 |
return QueryContainerAction::Continue; |
891 |
return QueryContainerAction::None; |
| 878 |
|
892 |
|
| 879 |
// Bail out from TreeResolver to build a render tree and do a layout. Resolution continues after. |
|
|
| 880 |
m_unresolvedQueryContainers.add(&element); |
893 |
m_unresolvedQueryContainers.add(&element); |
| 881 |
return QueryContainerAction::Layout; |
894 |
return QueryContainerAction::Resolve; |
| 882 |
} |
895 |
} |
| 883 |
|
896 |
|
| 884 |
std::unique_ptr<Update> TreeResolver::resolve() |
897 |
std::unique_ptr<Update> TreeResolver::resolve() |
| 885 |
{ |
898 |
{ |
|
|
899 |
m_resolvedQueryContainers.add(m_unresolvedQueryContainers.begin(), m_unresolvedQueryContainers.end()); |
| 900 |
m_unresolvedQueryContainers.clear(); |
| 901 |
|
| 886 |
Element* documentElement = m_document.documentElement(); |
902 |
Element* documentElement = m_document.documentElement(); |
| 887 |
if (!documentElement) { |
903 |
if (!documentElement) { |
| 888 |
m_document.styleScope().resolver(); |
904 |
m_document.styleScope().resolver(); |
| 889 |
return nullptr; |
905 |
return nullptr; |
| 890 |
} |
906 |
} |
| 891 |
|
907 |
|
| 892 |
// FIXME: Just need to restore the ancestor marking. |
|
|
| 893 |
for (auto& queryContainer : m_unresolvedQueryContainers) |
| 894 |
queryContainer->invalidateStyleForSubtreeInternal(); |
| 895 |
|
| 896 |
if (!documentElement->childNeedsStyleRecalc() && !documentElement->needsStyleRecalc()) |
908 |
if (!documentElement->childNeedsStyleRecalc() && !documentElement->needsStyleRecalc()) |
| 897 |
return WTFMove(m_update); |
909 |
return WTFMove(m_update); |
| 898 |
|
910 |
|