Changeset 295196 in webkit
- Timestamp:
- Jun 2, 2022, 11:46:05 PM (4 years ago)
- Location:
- branches/safari-613-branch/Source/WebCore
- Files:
-
- 5 edited
-
ChangeLog (modified) (1 diff)
-
css/CSSStyleSheet.cpp (modified) (3 diffs)
-
css/CSSStyleSheet.h (modified) (2 diffs)
-
style/StyleScope.cpp (modified) (2 diffs)
-
style/StyleScope.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/safari-613-branch/Source/WebCore/ChangeLog
r295195 r295196 1 2022-04-22 Brandon Stewart <brandonstewart@apple.com> 2 3 Store StyleScope during CSSStyleSheet Creation 4 https://bugs.webkit.org/show_bug.cgi?id=239659 5 6 Reviewed by Antti Koivisto. 7 8 To ensure that we can always access the style scope, we shall ensure we store the style scope 9 at CSSStyleSheet creation time. It was possible before that a style sheet could become disconnected 10 and then a rule would later be mutated. This resulted in the unfortunate side effect of being unable to find 11 the style scope. 12 13 * css/CSSStyleSheet.cpp: 14 (WebCore::CSSStyleSheet::CSSStyleSheet): 15 (WebCore::CSSStyleSheet::styleScope): 16 * css/CSSStyleSheet.h: 17 * style/StyleScope.cpp: 18 (WebCore::Style::Scope::collectResolverScopes): 19 * style/StyleScope.h: 20 1 21 2022-03-15 Gabriel Nava Marino <gnavamarino@apple.com> 2 22 -
branches/safari-613-branch/Source/WebCore/css/CSSStyleSheet.cpp
r289935 r295196 93 93 , m_ownerRule(ownerRule) 94 94 { 95 if (auto* parent = parentStyleSheet()) 96 m_styleScope = parent->styleScope(); 97 95 98 m_contents->registerClient(this); 96 99 } … … 100 103 , m_isInlineStylesheet(isInlineStylesheet) 101 104 , m_isOriginClean(isOriginClean) 105 , m_styleScope(Style::Scope::forNode(ownerNode)) 102 106 , m_ownerNode(&ownerNode) 103 107 , m_startPosition(startPosition) … … 380 384 Style::Scope* CSSStyleSheet::styleScope() 381 385 { 382 auto* ownerNode = rootStyleSheet().ownerNode(); 383 if (!ownerNode) 384 return nullptr; 385 return &Style::Scope::forNode(*ownerNode); 386 return m_styleScope.get(); 386 387 } 387 388 -
branches/safari-613-branch/Source/WebCore/css/CSSStyleSheet.h
r289935 r295196 27 27 #include <wtf/Noncopyable.h> 28 28 #include <wtf/TypeCasts.h> 29 #include <wtf/WeakPtr.h> 29 30 #include <wtf/text/AtomStringHash.h> 30 31 #include <wtf/text/TextPosition.h> … … 148 149 String m_title; 149 150 RefPtr<MediaQuerySet> m_mediaQueries; 151 WeakPtr<Style::Scope> m_styleScope; 150 152 151 153 Node* m_ownerNode { nullptr }; -
branches/safari-613-branch/Source/WebCore/style/StyleScope.cpp
r287325 r295196 684 684 ResolverScopes resolverScopes; 685 685 686 resolverScopes.add(*resolverIfExists(), Vector< CheckedPtr<Scope>> { this });686 resolverScopes.add(*resolverIfExists(), Vector<WeakPtr<Scope>> { this }); 687 687 688 688 for (auto* shadowRoot : m_document.inDocumentShadowRoots()) { … … 691 691 if (!resolver) 692 692 continue; 693 resolverScopes.add(*resolver, Vector< CheckedPtr<Scope>> { }).iterator->value.append(&scope);693 resolverScopes.add(*resolver, Vector<WeakPtr<Scope>> { }).iterator->value.append(&scope); 694 694 } 695 695 return resolverScopes; -
branches/safari-613-branch/Source/WebCore/style/StyleScope.h
r287325 r295196 59 59 class Resolver; 60 60 61 class Scope : public CanMake CheckedPtr{61 class Scope : public CanMakeWeakPtr<Scope> { 62 62 WTF_MAKE_FAST_ALLOCATED; 63 63 public: … … 138 138 void scheduleUpdate(UpdateType); 139 139 140 using ResolverScopes = HashMap<Ref<Resolver>, Vector< CheckedPtr<Scope>>>;140 using ResolverScopes = HashMap<Ref<Resolver>, Vector<WeakPtr<Scope>>>; 141 141 ResolverScopes collectResolverScopes(); 142 142 template <typename TestFunction> void evaluateMediaQueries(TestFunction&&);
Note:
See TracChangeset
for help on using the changeset viewer.