haikuwebkit/LayoutTests/fast/css/first-letter-style-relation...

34 lines
750 B
HTML
Raw Permalink Normal View History

Descendant style relations are sometimes reset when they shouldn't https://bugs.webkit.org/show_bug.cgi?id=224431 rdar://76267783 Reviewed by Sam Weinig. Source/WebCore: Some style relations computed during resolution of descendants are set on a parent element. The parent element shouldn't reset them unless we are actually also computing the descendants. Test: fast/css/first-letter-style-relation-crash.html * dom/Element.cpp: (WebCore::Element::resetStyleRelations): (WebCore::Element::resetChildStyleRelations): (WebCore::Element::resetAllDescendantStyleRelations): Split resetStyleRelations into separate parts. * dom/Element.h: (WebCore::Element::styleAffectedByEmpty const): (WebCore::Element::childrenAffectedByForwardPositionalRules const): (WebCore::Element::descendantsAffectedByForwardPositionalRules const): (WebCore::Element::childrenAffectedByBackwardPositionalRules const): (WebCore::Element::descendantsAffectedByBackwardPositionalRules const): (WebCore::Element::childrenAffectedByPropertyBasedBackwardPositionalRules const): (WebCore::Element::setStyleAffectedByEmpty): (WebCore::Element::setChildrenAffectedByForwardPositionalRules): (WebCore::Element::setDescendantsAffectedByForwardPositionalRules): (WebCore::Element::setChildrenAffectedByBackwardPositionalRules): (WebCore::Element::setDescendantsAffectedByBackwardPositionalRules): (WebCore::Element::setChildrenAffectedByPropertyBasedBackwardPositionalRules): * dom/ElementRareData.h: (WebCore::ElementRareData::resetStyleRelations): Deleted. * dom/Node.h: (WebCore::Node::StyleBitfields::clearFlags): (WebCore::Node::clearStyleFlags): (WebCore::Node::StyleBitfields::dynamicStyleRelations const): Deleted. (WebCore::Node::StyleBitfields::setDynamicStyleRelation): Deleted. (WebCore::Node::StyleBitfields::clearDynamicStyleRelations): Deleted. (WebCore::Node::hasDynamicStyleRelationFlag const): Deleted. (WebCore::Node::setDynamicStyleRelationFlag): Deleted. Remove the meaningless DynamicStyleRelation concept and merge these flags with the others. * style/StyleTreeResolver.cpp: (WebCore::Style::TreeResolver::resolveElement): (WebCore::Style::TreeResolver::resolveComposedTree): Only clear the descendant or child style relation bits if we are actually re-resolving descendants or children. LayoutTests: * fast/css/first-letter-style-relation-crash-expected.txt: Added. * fast/css/first-letter-style-relation-crash.html: Added. Canonical link: https://commits.webkit.org/236395@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@275825 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-04-12 16:49:52 +00:00
<style>
html {
-webkit-user-modify: read-write-plaintext-only;
}
* {
float: right;
border-image: url();
max-inline-size: 0;
}
:first-child {
content: url();
}
:nth-child(3)::first-letter {
background: grey;
}
div {
overflow-x: scroll;
}
div::-webkit-scrollbar {
background: grey;
}
</style>
<script>
if (window.testRunner)
testRunner.dumpAsText();
onload = () => {
document.body.appendChild(document.createElement('div'));
document.body.appendChild(document.createElement('div'));
document.body.appendChild(document.createElement('div'));
document.execCommand('SelectAll');
document.execCommand('InsertText', false, "This test passes if it doesn't crash");
};
</script>