|
Lines 783-789
bool Scope::isForUserAgentShadowTree() const
a/Source/WebCore/style/StyleScope.cpp_sec1
|
| 783 |
return m_shadowRoot && m_shadowRoot->mode() == ShadowRootMode::UserAgent; |
783 |
return m_shadowRoot && m_shadowRoot->mode() == ShadowRootMode::UserAgent; |
| 784 |
} |
784 |
} |
| 785 |
|
785 |
|
| 786 |
bool Scope::updateQueryContainerState() |
786 |
bool Scope::updateQueryContainerState(QueryContainerUpdateContext& context) |
| 787 |
{ |
787 |
{ |
| 788 |
ASSERT(!m_shadowRoot); |
788 |
ASSERT(!m_shadowRoot); |
| 789 |
ASSERT(m_document.renderView()); |
789 |
ASSERT(m_document.renderView()); |
|
Lines 791-797
bool Scope::updateQueryContainerState()
a/Source/WebCore/style/StyleScope.cpp_sec2
|
| 791 |
auto previousStates = WTFMove(m_queryContainerStates); |
791 |
auto previousStates = WTFMove(m_queryContainerStates); |
| 792 |
m_queryContainerStates.clear(); |
792 |
m_queryContainerStates.clear(); |
| 793 |
|
793 |
|
| 794 |
Vector<Element*> changedContainers; |
794 |
Vector<Element*> containersToInvalidate; |
| 795 |
|
795 |
|
| 796 |
for (auto& containerRenderer : m_document.renderView()->containerQueryBoxes()) { |
796 |
for (auto& containerRenderer : m_document.renderView()->containerQueryBoxes()) { |
| 797 |
auto* containerElement = containerRenderer.element(); |
797 |
auto* containerElement = containerRenderer.element(); |
|
Lines 814-828
bool Scope::updateQueryContainerState()
a/Source/WebCore/style/StyleScope.cpp_sec3
|
| 814 |
|
814 |
|
| 815 |
auto it = previousStates.find(*containerElement); |
815 |
auto it = previousStates.find(*containerElement); |
| 816 |
bool changed = it == previousStates.end() || sizeChanged(it->value); |
816 |
bool changed = it == previousStates.end() || sizeChanged(it->value); |
| 817 |
if (changed) |
817 |
// Protect against unstable layout by invalidating only once per container. |
| 818 |
changedContainers.append(containerElement); |
818 |
if (changed && context.invalidatedContainers.add(containerElement).isNewEntry) |
|
|
819 |
containersToInvalidate.append(containerElement); |
| 819 |
m_queryContainerStates.add(*containerElement, size); |
820 |
m_queryContainerStates.add(*containerElement, size); |
| 820 |
} |
821 |
} |
| 821 |
|
822 |
|
| 822 |
for (auto* toInvalidate : changedContainers) |
823 |
for (auto* toInvalidate : containersToInvalidate) |
| 823 |
toInvalidate->invalidateForQueryContainerChange(); |
824 |
toInvalidate->invalidateForQueryContainerChange(); |
| 824 |
|
825 |
|
| 825 |
return !changedContainers.isEmpty(); |
826 |
return !containersToInvalidate.isEmpty(); |
| 826 |
} |
827 |
} |
| 827 |
|
828 |
|
| 828 |
HTMLSlotElement* assignedSlotForScopeOrdinal(const Element& element, ScopeOrdinal scopeOrdinal) |
829 |
HTMLSlotElement* assignedSlotForScopeOrdinal(const Element& element, ScopeOrdinal scopeOrdinal) |