2022-05-23 Alan Coon Cherry-pick r294186. rdar://problem/93213436 Infinite recursion caused by call to accessibilityIsIgnored in the midst of AccessibilityObject::ignoredFromModalPresence https://bugs.webkit.org/show_bug.cgi?id=240365 Reviewed by Chris Fleizach. Source/WebCore: We can get infinite recursion when accessibilityIsIgnored is called as part of computing AccessibilityObject::ignoredFromModalPresence. One example of such a cycle: AXObjectCache::currentModalNode() -> AccessibilityRenderObject::computeAccessibilityIsIgnored() -> AccessibilityRenderObject::parentObjectUnignored() -> AccessibilityObject::accessibilityIsIgnored() -> AccessibilityObject::ignoredFromModalPresence() -> AXObjectCache::currentModalNode() -> ...repeat... This patch fixes this by tracking when we start computing the current modal node in the AXObjectCache. Then, in AccessibilityObject::accessibilityIsIgnored(), we don't call AccessibilityObject::ignoredFromModalPresence() if this new state is true, since in this context we only need to know if the object is inherently ignored (i.e. ignored disregarding modal presence). Test: accessibility/aria-modal-with-text-crash.html * accessibility/AXObjectCache.cpp: (WebCore::AXObjectCache::currentModalNode): * accessibility/AXObjectCache.h: Add m_isRetrievingCurrentModalNode. (WebCore::AXObjectCache::isRetrievingCurrentModalNode): Added. * accessibility/AccessibilityObject.cpp: (WebCore::AccessibilityObject::accessibilityIsIgnored const): Don't call ignoredFromModalPresence if we're in the midst of computing the current modal. LayoutTests: * accessibility/aria-modal-with-text-crash-expected.txt: Added. * accessibility/aria-modal-with-text-crash.html: Added. * platform/glib/TestExpectations: Skip new test. * platform/ios/TestExpectations: Enable new test. * platform/win/TestExpectations: Skip new test. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@294186 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2022-05-13 Tyler Wilcock Infinite recursion caused by call to accessibilityIsIgnored in the midst of AccessibilityObject::ignoredFromModalPresence https://bugs.webkit.org/show_bug.cgi?id=240365 Reviewed by Chris Fleizach. * accessibility/aria-modal-with-text-crash-expected.txt: Added. * accessibility/aria-modal-with-text-crash.html: Added. * platform/glib/TestExpectations: Skip new test. * platform/ios/TestExpectations: Enable new test. * platform/win/TestExpectations: Skip new test. 2022-04-26 Russell Epstein Cherry-pick r290630. rdar://problem/89442583 AX: WebKit should ignore empty modals rather than trapping focus inside them https://bugs.webkit.org/show_bug.cgi?id=237163 Reviewed by Chris Fleizach and Andres Gonzalez. Source/WebCore: Given this markup:
There is no accessible content inside this modal, but WebKit traps user focus inside, making the rest of the page completely inaccessible. With this patch we ignore modals that don't have accessible content. We do this by walking the DOM to find any non-AX-ignored objects. Because determining whether or not an element is ignored is dependent on modals present on the page, this patch moves the call to `ignoredFromModalPresence` out of `AccessibilityObject::defaultObjectInclusion`, as this function is downstream of `computeAccessibilityIsIgnored`, and we need to call that on objects inside modal candidates. Without this move, we would recurse infinitely in `AXObjectCache::modalElementHasAccessibleContent`. We now check whether an object is ignored due to modal presence in `AccessibilityObject::accessibilityIsIgnored()`, so that function should be used as the final say in determining whether an object is ignored. Test: accessibility/ignore-modals-without-any-content.html * accessibility/AXObjectCache.cpp: (WebCore::AXObjectCache::modalElementHasAccessibleContent): (WebCore::AXObjectCache::currentModalNode): * accessibility/AXObjectCache.h: * accessibility/AccessibilityObject.cpp: (WebCore::AccessibilityObject::defaultObjectInclusion const): (WebCore::AccessibilityObject::accessibilityIsIgnored const): * accessibility/AccessibilityObject.h: (WebCore::AccessibilityObject::computeAccessibilityIsIgnored const): LayoutTests: * accessibility/ignore-modals-without-any-content-expected.txt: Added. * accessibility/ignore-modals-without-any-content.html: Added. * platform/glib/TestExpectations: Skip new test. * platform/ios/TestExpectations: Enable new test. * platform/ios/accessibility/ignore-modals-without-any-content-expected.txt: Added. * platform/win/TestExpectations: Skip new test. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@290630 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2022-02-28 Tyler Wilcock AX: WebKit should ignore empty modals rather than trapping focus inside them https://bugs.webkit.org/show_bug.cgi?id=237163 Reviewed by Chris Fleizach and Andres Gonzalez. * accessibility/ignore-modals-without-any-content-expected.txt: Added. * accessibility/ignore-modals-without-any-content.html: Added. * platform/glib/TestExpectations: Skip new test. * platform/ios/TestExpectations: Enable new test. * platform/ios/accessibility/ignore-modals-without-any-content-expected.txt: Added. * platform/win/TestExpectations: Skip new test. 2022-04-22 Alan Coon Cherry-pick r292274. rdar://problem/80544133 [Cocoa] Automatically relayout the page when new fonts are installed https://bugs.webkit.org/show_bug.cgi?id=238483 Reviewed by Chris Dumez. Source/WebCore: This patch simply calls setNeedsRecalcStyleInAllFrames on every Page when we receive a kCTFontManagerRegisteredFontsChangedNotification. FontCache::invalidateAllFontCaches() can't do this directly because it's in platform/ and therefore isn't allowed to know what Pages are. Instead, this patch takes a process-global callback and calls that instead. This callback is set at initialization time. Test: fast/text/install-font-style-recalc.html * page/Page.cpp: (WebCore::m_contentSecurityPolicyModeForExtension): (WebCore::Page::firstTimeInitialization): * page/Page.h: * platform/graphics/FontCache.cpp: (WebCore::Function [Cocoa] Automatically relayout the page when new fonts are installed https://bugs.webkit.org/show_bug.cgi?id=238483 Reviewed by Chris Dumez. * TestExpectations: * fast/text/install-font-style-recalc-expected.txt: Added. * fast/text/install-font-style-recalc.html: Added. * platform/ios-wk2/TestExpectations: * platform/mac-wk2/TestExpectations: 2022-04-22 Alan Coon Cherry-pick r292274. rdar://problem/80544133 [Cocoa] Automatically relayout the page when new fonts are installed https://bugs.webkit.org/show_bug.cgi?id=238483 Reviewed by Chris Dumez. Source/WebCore: This patch simply calls setNeedsRecalcStyleInAllFrames on every Page when we receive a kCTFontManagerRegisteredFontsChangedNotification. FontCache::invalidateAllFontCaches() can't do this directly because it's in platform/ and therefore isn't allowed to know what Pages are. Instead, this patch takes a process-global callback and calls that instead. This callback is set at initialization time. Test: fast/text/install-font-style-recalc.html * page/Page.cpp: (WebCore::m_contentSecurityPolicyModeForExtension): (WebCore::Page::firstTimeInitialization): * page/Page.h: * platform/graphics/FontCache.cpp: (WebCore::Function [Cocoa] Automatically relayout the page when new fonts are installed https://bugs.webkit.org/show_bug.cgi?id=238483 Reviewed by Chris Dumez. * TestExpectations: * fast/text/install-font-style-recalc-expected.txt: Added. * fast/text/install-font-style-recalc.html: Added. * platform/ios-wk2/TestExpectations: * platform/mac-wk2/TestExpectations: 2022-04-22 Alan Coon Cherry-pick r292072. rdar://problem/80544133 [Cocoa] Automatically relayout the page when new fonts are installed https://bugs.webkit.org/show_bug.cgi?id=238483 Reviewed by Chris Dumez. Source/WebCore: This patch simply calls setNeedsRecalcStyleInAllFrames on every Page when we receive a kCTFontManagerRegisteredFontsChangedNotification. FontCache::invalidateAllFontCaches() can't do this directly because it's in platform/ and therefore isn't allowed to know what Pages are. Instead, this patch takes a process-global callback and calls that instead. This callback is set at initialization time. Test: fast/text/install-font-style-recalc.html * page/Page.cpp: (WebCore::m_attachmentElementClient): * platform/graphics/FontCache.cpp: (WebCore::Function [Cocoa] Automatically relayout the page when new fonts are installed https://bugs.webkit.org/show_bug.cgi?id=238483 Reviewed by Chris Dumez. * fast/text/install-font-style-recalc-expected.txt: Added. * fast/text/install-font-style-recalc.html: Added. 2022-04-22 Alan Coon Cherry-pick r291724. rdar://problem/91975589 Expose the AX tree of PDFs loaded via iframes on the Mac https://bugs.webkit.org/show_bug.cgi?id=238168 Reviewed by Chris Fleizach. Source/WebKit: Given this markup: