Title: [265514] trunk
Revision
265514
Author
[email protected]
Date
2020-08-11 13:58:28 -0700 (Tue, 11 Aug 2020)

Log Message

LayoutTest accessibility/mac/select-element-selection-with-optgroups.html is a flaky failure
https://bugs.webkit.org/show_bug.cgi?id=175341

Reviewed by Chris Fleizach.

Source/WebCore:

Failures were due to new AX objects being created for HTMLOptionElement.
Unlike most other AX objects, these were not cached in the AXObjectCache
and multiple objects could be created for the same underlying option. Fixed this
by changing it to track the option element in the cache in the conventional way.

* WebCore.xcodeproj/project.pbxproj: Remove AccessibilityMediaControls.h/cpp.
The source files were removed back in April.

* accessibility/AXObjectCache.cpp:
(WebCore::AXObjectCache::getOrCreate): Added code for HTMLOptionElement and
HTMLOptGroupElement so AccessibilityMenuListOption and AccessibilityListBoxOption
can be created in this function.
(WebCore::AXObjectCache::create): Renamed the version of this that takes an
AccessibilityRole to not claim that it ever gets the value from the cache,
because it never does. Also removed the cases for ListBoxOption and MenuListOption.
* accessibility/AXObjectCache.h: Updated for above.

* accessibility/AccessibilityARIAGrid.cpp:
(WebCore::AccessibilityARIAGrid::addChildren): Use create.

* accessibility/AccessibilityListBox.cpp:
(WebCore::AccessibilityListBox::addChildren): Removed super-old comment that mentions
the long-ago-removed WML.
(WebCore::AccessibilityListBox::listBoxOptionAccessibilityObject const): Use the
element to get the list box option rather than creating a new one every time.
No longer any need to special case <hr> elements since the getOrCreate function
will return nil for non-option elements that don't have a renderer.

* accessibility/AccessibilityListBoxOption.cpp:
(WebCore::AccessibilityListBoxOption::AccessibilityListBoxOption): Take the element
in the constructor instead of using a separate function to associate it.
(WebCore::AccessibilityListBoxOption::create): Ditto.
(WebCore::AccessibilityListBoxOption::isEnabled const): Update for WeakPtr.
(WebCore::AccessibilityListBoxOption::isSelected const): Ditto.
(WebCore::AccessibilityListBoxOption::canSetSelectedAttribute const): Ditto.
(WebCore::AccessibilityListBoxOption::actionElement const): Update for WeakPtr.
(WebCore::AccessibilityListBoxOption::node const): Added. For some reason the
AccessibilityMenuListOption class had this function and this one did not. They
should both have it.
* accessibility/AccessibilityListBoxOption.h: Updated for above. Made most
functions private and final. Fixed includes and forward declarations.
Removed the setHTMLElement function. Changed m_optionElement from
HTMLElement* to WeakPtr<HTMLElement>.

* accessibility/AccessibilityMenuList.cpp:
(WebCore::AccessibilityMenuList::addChildren): Use create.

* accessibility/AccessibilityMenuListOption.cpp:
(WebCore::AccessibilityMenuListOption::AccessibilityMenuListOption): Take the
element in the constructor instead of using a separate function to associate it.
(WebCore::AccessibilityMenuListOption::create): Ditto.
(WebCore::AccessibilityMenuListOption::setElement): Deleted.
(WebCore::AccessibilityMenuListOption::node const): Moved here from the header.
(WebCore::AccessibilityMenuListOption::isEnabled const): Removed unneeded cast
now that m_element has a more specific type, and added a null check.
(WebCore::AccessibilityMenuListOption::isVisible const): Removed dependency
on m_parent pointer, which does not exist now that we don't derive from
AccessibilityMockObject.
(WebCore::AccessibilityMenuListOption::isSelected const): Removed unneeded cast
now that m_element has a more specific type, and added a null check.
(WebCore::AccessibilityMenuListOption::setSelected): Ditto, but no null check
needed because canSetSelectedAttribute takes care of that.
(WebCore::AccessibilityMenuListOption::stringValue const): Ditto.
* accessibility/AccessibilityMenuListOption.h: Updated for above. Marked
functions final instead of override. Changed m_element from RefPtr<HTMLElement>
to WeakPtr<HTMLOptionElement> to avoid reference cycles that could leak to
memory leaks. Derive from AccessibilityObject instead of
AccessibilityMockObject, since the latter class has nothing to offer us.

* accessibility/AccessibilityMenuListPopup.cpp:
(WebCore::AccessibilityMenuListPopup::menuListOptionAccessibilityObject const):
Use the element to get the menu list option rather than creating a new one
every time. No longer any need to check that the type is HTMLOptionElement
because that's the responsibility of the code in the cache now.
(WebCore::AccessibilityMenuListPopup::addChildren): Removed unneeded call
to setParent since the menu list option objects no longer hold parent pointers.

* accessibility/AccessibilityNodeObject.cpp:
(WebCore::accessibleNameForNode): Added a special case for HTMLOptionElement
like the one for HTMLInputElement. The code worked for fairly well for option
elements before, almost by accident, and the way it worked was perturbed by
the change to whether we cache those objects. This newer code path works in a
more straightforward way, keeps our existing tests psasing, and likely gets
some edge cases handled more correctly (should add new tests for those).

* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::documentLinks): Use create.
(WebCore::AccessibilityRenderObject::addImageMapChildren): Ditto.
(WebCore::AccessibilityRenderObject::addTextFieldChildren): Ditto.
* accessibility/AccessibilitySlider.cpp:
(WebCore::AccessibilitySlider::addChildren): Ditto.
* accessibility/AccessibilitySpinButton.cpp:
(WebCore::AccessibilitySpinButton::addChildren): Ditto.
* accessibility/AccessibilityTable.cpp:
(WebCore::AccessibilityTable::addChildren): Ditto.
(WebCore::AccessibilityTable::headerContainer): Ditto.

* accessibility/atk/WebKitAccessible.cpp:
(fallbackObject): Deleted.
(webkitAccessibleGetName): Added null check.
(webkitAccessibleGetDescription): Ditto.
(webkitAccessibleGetParent): Ditto.
(webkitAccessibleGetNChildren): Ditto.
(webkitAccessibleRefChild): Ditto.
(webkitAccessibleGetIndexInParent): Ditto.
(webkitAccessibleGetAttributes): Ditto.
(webkitAccessibleGetRole): Ditto.
(webkitAccessibleRefStateSet): Ditto.
(webkitAccessibleRefRelationSet): Ditto.
(webkitAccessibleGetObjectLocale): Ditto.
(webkitAccessibleGetAccessibilityObject): Ditto.
(webkitAccessibleDetach): Use nullptr instead of fallbackObject.
(webkitAccessibleIsDetached): Ditto.

* html/HTMLOptionElement.cpp:
(WebCore::HTMLOptionElement::selected const): Made this const. An earlier
version of the patch required this; the latest version doesn't, but it's
more logical and better for it to be const.
* html/HTMLOptionElement.h: Updated for above.

Tools:

* Scripts/webkitpy/layout_tests/controllers/single_test_runner.py:
(SingleTestRunner._compare_output_with_reference): Removed unhelpful log message that tells
about ref tests where the hash optimization for comparing images does not work, but the
test passes. We don't want to get this kind of log message for passing tests.

LayoutTests:

* platform/mac-wk1/TestExpectations: Fixed expectation for another accessibility test,
accessibility/mac/expanded-notification.html to expect flakiness, not failure, because that's
what the bug that went along with this expectation said, and indeed the test often passes.

* platform/mac-wk2/TestExpectations: Removed flakiness expectation for
accessibility/mac/select-element-selection-with-optgroups.html, since it's now fixed.
Fixed a "webkkit.org" typo, which caused the expectation for
tiled-drawing/scrolling/fast-scroll-mainframe-zoom.html to not work as expected.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (265513 => 265514)


--- trunk/LayoutTests/ChangeLog	2020-08-11 20:40:01 UTC (rev 265513)
+++ trunk/LayoutTests/ChangeLog	2020-08-11 20:58:28 UTC (rev 265514)
@@ -1,3 +1,19 @@
+2020-08-11  Darin Adler  <[email protected]>
+
+        LayoutTest accessibility/mac/select-element-selection-with-optgroups.html is a flaky failure
+        https://bugs.webkit.org/show_bug.cgi?id=175341
+
+        Reviewed by Chris Fleizach.
+
+        * platform/mac-wk1/TestExpectations: Fixed expectation for another accessibility test,
+        accessibility/mac/expanded-notification.html to expect flakiness, not failure, because that's
+        what the bug that went along with this expectation said, and indeed the test often passes.
+
+        * platform/mac-wk2/TestExpectations: Removed flakiness expectation for
+        accessibility/mac/select-element-selection-with-optgroups.html, since it's now fixed.
+        Fixed a "webkkit.org" typo, which caused the expectation for
+        tiled-drawing/scrolling/fast-scroll-mainframe-zoom.html to not work as expected.
+
 2020-08-11  Lauro Moura  <[email protected]>
 
         [GTK][WPE] Rebaseline outdated baselines

Modified: trunk/LayoutTests/platform/mac-wk1/TestExpectations (265513 => 265514)


--- trunk/LayoutTests/platform/mac-wk1/TestExpectations	2020-08-11 20:40:01 UTC (rev 265513)
+++ trunk/LayoutTests/platform/mac-wk1/TestExpectations	2020-08-11 20:58:28 UTC (rev 265514)
@@ -854,7 +854,7 @@
 
 webkit.org/b/205412 [ Mojave Debug ] webgl/1.0.3/conformance/rendering/many-draw-calls.html [ Timeout ]
 
-webkit.org/b/205410 [ Debug ] accessibility/mac/expanded-notification.html [ Failure ]
+webkit.org/b/205410 [ Debug ] accessibility/mac/expanded-notification.html [ Pass Failure ]
 
 webkit.org/b/206071 editing/spelling/grammar.html [ Skip ]
 webkit.org/b/206071 editing/spelling/markers.html [ Skip ]

Modified: trunk/LayoutTests/platform/mac-wk2/TestExpectations (265513 => 265514)


--- trunk/LayoutTests/platform/mac-wk2/TestExpectations	2020-08-11 20:40:01 UTC (rev 265513)
+++ trunk/LayoutTests/platform/mac-wk2/TestExpectations	2020-08-11 20:58:28 UTC (rev 265514)
@@ -653,8 +653,6 @@
 
 webkit.org/b/172148 tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-vertical.html [ Pass Failure ]
 
-webkit.org/b/175341 accessibility/mac/select-element-selection-with-optgroups.html [ Pass Failure ]
-
 webkit.org/b/172044 [ Debug ] imported/w3c/web-platform-tests/IndexedDB/open-request-queue.html [ Pass Timeout ]
 
 webkit.org/b/173779 [ Debug ] fast/scrolling/arrow-key-scroll-in-rtl-document.html [ Pass Failure ]
@@ -1086,7 +1084,7 @@
 
 webkit.org/b/214579 [ Release ] svg/animations/smil-leak-element-instances.svg [ Pass Failure ]
 
-webkkit.org/b/214651 [ Debug ] tiled-drawing/scrolling/fast-scroll-mainframe-zoom.html [ Pass Crash ]
+webkit.org/b/214651 [ Debug ] tiled-drawing/scrolling/fast-scroll-mainframe-zoom.html [ Pass Crash ]
 
 webkit.org/b/214661 [ Debug ] imported/w3c/web-platform-tests/webrtc/RTCSctpTransport-events.html [ Pass Crash ]
 

Modified: trunk/Source/WebCore/ChangeLog (265513 => 265514)


--- trunk/Source/WebCore/ChangeLog	2020-08-11 20:40:01 UTC (rev 265513)
+++ trunk/Source/WebCore/ChangeLog	2020-08-11 20:58:28 UTC (rev 265514)
@@ -1,3 +1,130 @@
+2020-08-11  Darin Adler  <[email protected]>
+
+        LayoutTest accessibility/mac/select-element-selection-with-optgroups.html is a flaky failure
+        https://bugs.webkit.org/show_bug.cgi?id=175341
+
+        Reviewed by Chris Fleizach.
+
+        Failures were due to new AX objects being created for HTMLOptionElement.
+        Unlike most other AX objects, these were not cached in the AXObjectCache
+        and multiple objects could be created for the same underlying option. Fixed this
+        by changing it to track the option element in the cache in the conventional way.
+
+        * WebCore.xcodeproj/project.pbxproj: Remove AccessibilityMediaControls.h/cpp.
+        The source files were removed back in April.
+
+        * accessibility/AXObjectCache.cpp:
+        (WebCore::AXObjectCache::getOrCreate): Added code for HTMLOptionElement and
+        HTMLOptGroupElement so AccessibilityMenuListOption and AccessibilityListBoxOption
+        can be created in this function.
+        (WebCore::AXObjectCache::create): Renamed the version of this that takes an
+        AccessibilityRole to not claim that it ever gets the value from the cache,
+        because it never does. Also removed the cases for ListBoxOption and MenuListOption.
+        * accessibility/AXObjectCache.h: Updated for above.
+
+        * accessibility/AccessibilityARIAGrid.cpp:
+        (WebCore::AccessibilityARIAGrid::addChildren): Use create.
+
+        * accessibility/AccessibilityListBox.cpp:
+        (WebCore::AccessibilityListBox::addChildren): Removed super-old comment that mentions
+        the long-ago-removed WML.
+        (WebCore::AccessibilityListBox::listBoxOptionAccessibilityObject const): Use the
+        element to get the list box option rather than creating a new one every time.
+        No longer any need to special case <hr> elements since the getOrCreate function
+        will return nil for non-option elements that don't have a renderer.
+
+        * accessibility/AccessibilityListBoxOption.cpp:
+        (WebCore::AccessibilityListBoxOption::AccessibilityListBoxOption): Take the element
+        in the constructor instead of using a separate function to associate it.
+        (WebCore::AccessibilityListBoxOption::create): Ditto.
+        (WebCore::AccessibilityListBoxOption::isEnabled const): Update for WeakPtr.
+        (WebCore::AccessibilityListBoxOption::isSelected const): Ditto.
+        (WebCore::AccessibilityListBoxOption::canSetSelectedAttribute const): Ditto.
+        (WebCore::AccessibilityListBoxOption::actionElement const): Update for WeakPtr.
+        (WebCore::AccessibilityListBoxOption::node const): Added. For some reason the
+        AccessibilityMenuListOption class had this function and this one did not. They
+        should both have it.
+        * accessibility/AccessibilityListBoxOption.h: Updated for above. Made most
+        functions private and final. Fixed includes and forward declarations.
+        Removed the setHTMLElement function. Changed m_optionElement from
+        HTMLElement* to WeakPtr<HTMLElement>.
+
+        * accessibility/AccessibilityMenuList.cpp:
+        (WebCore::AccessibilityMenuList::addChildren): Use create.
+
+        * accessibility/AccessibilityMenuListOption.cpp:
+        (WebCore::AccessibilityMenuListOption::AccessibilityMenuListOption): Take the
+        element in the constructor instead of using a separate function to associate it.
+        (WebCore::AccessibilityMenuListOption::create): Ditto.
+        (WebCore::AccessibilityMenuListOption::setElement): Deleted.
+        (WebCore::AccessibilityMenuListOption::node const): Moved here from the header.
+        (WebCore::AccessibilityMenuListOption::isEnabled const): Removed unneeded cast
+        now that m_element has a more specific type, and added a null check.
+        (WebCore::AccessibilityMenuListOption::isVisible const): Removed dependency
+        on m_parent pointer, which does not exist now that we don't derive from
+        AccessibilityMockObject.
+        (WebCore::AccessibilityMenuListOption::isSelected const): Removed unneeded cast
+        now that m_element has a more specific type, and added a null check.
+        (WebCore::AccessibilityMenuListOption::setSelected): Ditto, but no null check
+        needed because canSetSelectedAttribute takes care of that.
+        (WebCore::AccessibilityMenuListOption::stringValue const): Ditto.
+        * accessibility/AccessibilityMenuListOption.h: Updated for above. Marked
+        functions final instead of override. Changed m_element from RefPtr<HTMLElement>
+        to WeakPtr<HTMLOptionElement> to avoid reference cycles that could leak to
+        memory leaks. Derive from AccessibilityObject instead of
+        AccessibilityMockObject, since the latter class has nothing to offer us.
+
+        * accessibility/AccessibilityMenuListPopup.cpp:
+        (WebCore::AccessibilityMenuListPopup::menuListOptionAccessibilityObject const):
+        Use the element to get the menu list option rather than creating a new one
+        every time. No longer any need to check that the type is HTMLOptionElement
+        because that's the responsibility of the code in the cache now.
+        (WebCore::AccessibilityMenuListPopup::addChildren): Removed unneeded call
+        to setParent since the menu list option objects no longer hold parent pointers.
+
+        * accessibility/AccessibilityNodeObject.cpp:
+        (WebCore::accessibleNameForNode): Added a special case for HTMLOptionElement
+        like the one for HTMLInputElement. The code worked for fairly well for option
+        elements before, almost by accident, and the way it worked was perturbed by
+        the change to whether we cache those objects. This newer code path works in a
+        more straightforward way, keeps our existing tests psasing, and likely gets
+        some edge cases handled more correctly (should add new tests for those).
+
+        * accessibility/AccessibilityRenderObject.cpp:
+        (WebCore::AccessibilityRenderObject::documentLinks): Use create.
+        (WebCore::AccessibilityRenderObject::addImageMapChildren): Ditto.
+        (WebCore::AccessibilityRenderObject::addTextFieldChildren): Ditto.
+        * accessibility/AccessibilitySlider.cpp:
+        (WebCore::AccessibilitySlider::addChildren): Ditto.
+        * accessibility/AccessibilitySpinButton.cpp:
+        (WebCore::AccessibilitySpinButton::addChildren): Ditto.
+        * accessibility/AccessibilityTable.cpp:
+        (WebCore::AccessibilityTable::addChildren): Ditto.
+        (WebCore::AccessibilityTable::headerContainer): Ditto.
+
+        * accessibility/atk/WebKitAccessible.cpp:
+        (fallbackObject): Deleted.
+        (webkitAccessibleGetName): Added null check.
+        (webkitAccessibleGetDescription): Ditto.
+        (webkitAccessibleGetParent): Ditto.
+        (webkitAccessibleGetNChildren): Ditto.
+        (webkitAccessibleRefChild): Ditto.
+        (webkitAccessibleGetIndexInParent): Ditto.
+        (webkitAccessibleGetAttributes): Ditto.
+        (webkitAccessibleGetRole): Ditto.
+        (webkitAccessibleRefStateSet): Ditto.
+        (webkitAccessibleRefRelationSet): Ditto.
+        (webkitAccessibleGetObjectLocale): Ditto.
+        (webkitAccessibleGetAccessibilityObject): Ditto.
+        (webkitAccessibleDetach): Use nullptr instead of fallbackObject.
+        (webkitAccessibleIsDetached): Ditto.
+
+        * html/HTMLOptionElement.cpp:
+        (WebCore::HTMLOptionElement::selected const): Made this const. An earlier
+        version of the patch required this; the latest version doesn't, but it's
+        more logical and better for it to be const.
+        * html/HTMLOptionElement.h: Updated for above.
+
 2020-08-11  Timothy Hatcher  <[email protected]>
 
         Deferred WKUserScripts are exponentially injected on preloaded pages with frames.

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (265513 => 265514)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2020-08-11 20:40:01 UTC (rev 265513)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2020-08-11 20:58:28 UTC (rev 265514)
@@ -193,7 +193,6 @@
 		07AB996B18DA3C010018771E /* RTCIceServer.h in Headers */ = {isa = PBXBuildFile; fileRef = 07AB996718DA3C010018771E /* RTCIceServer.h */; };
 		07AFF4221EFB144900B545B3 /* CoreAudioCaptureSourceIOS.h in Headers */ = {isa = PBXBuildFile; fileRef = 07AFF4201EFB144700B545B3 /* CoreAudioCaptureSourceIOS.h */; };
 		07AFF4231EFB144900B545B3 /* CoreAudioCaptureSourceIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 07AFF4211EFB144700B545B3 /* CoreAudioCaptureSourceIOS.mm */; };
-		07B0113F1032242200FBDC33 /* AccessibilityMediaControls.h in Headers */ = {isa = PBXBuildFile; fileRef = 07B0113E1032242200FBDC33 /* AccessibilityMediaControls.h */; };
 		07B0ABCF1032242200FBDC33 /* AccessibilityMathMLElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 07B0ABCE1032242200FBDC33 /* AccessibilityMathMLElement.h */; };
 		07B442D6166C70B000556CAD /* InbandTextTrackPrivateAVF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07B442D4166C70B000556CAD /* InbandTextTrackPrivateAVF.cpp */; };
 		07B442D7166C70B000556CAD /* InbandTextTrackPrivateAVF.h in Headers */ = {isa = PBXBuildFile; fileRef = 07B442D5166C70B000556CAD /* InbandTextTrackPrivateAVF.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -5711,7 +5710,6 @@
 		07AB996818DA3C010018771E /* RTCIceServer.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = RTCIceServer.idl; sourceTree = "<group>"; };
 		07AFF4201EFB144700B545B3 /* CoreAudioCaptureSourceIOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CoreAudioCaptureSourceIOS.h; sourceTree = "<group>"; };
 		07AFF4211EFB144700B545B3 /* CoreAudioCaptureSourceIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CoreAudioCaptureSourceIOS.mm; sourceTree = "<group>"; };
-		07B0113E1032242200FBDC33 /* AccessibilityMediaControls.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AccessibilityMediaControls.h; sourceTree = "<group>"; };
 		07B0ABCE1032242200FBDC33 /* AccessibilityMathMLElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AccessibilityMathMLElement.h; sourceTree = "<group>"; };
 		07B442D4166C70B000556CAD /* InbandTextTrackPrivateAVF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InbandTextTrackPrivateAVF.cpp; sourceTree = "<group>"; };
 		07B442D5166C70B000556CAD /* InbandTextTrackPrivateAVF.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InbandTextTrackPrivateAVF.h; sourceTree = "<group>"; };
@@ -6813,7 +6811,6 @@
 		2981CAA1131822EC00D12F2A /* AccessibilityList.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = AccessibilityList.cpp; sourceTree = "<group>"; };
 		2981CAA2131822EC00D12F2A /* AccessibilityListBox.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = AccessibilityListBox.cpp; sourceTree = "<group>"; };
 		2981CAA3131822EC00D12F2A /* AccessibilityListBoxOption.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = AccessibilityListBoxOption.cpp; sourceTree = "<group>"; };
-		2981CAA4131822EC00D12F2A /* AccessibilityMediaControls.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = AccessibilityMediaControls.cpp; sourceTree = "<group>"; };
 		2981CAA5131822EC00D12F2A /* AccessibilityObject.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = AccessibilityObject.cpp; sourceTree = "<group>"; };
 		2981CAA6131822EC00D12F2A /* AccessibilityRenderObject.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = AccessibilityRenderObject.cpp; sourceTree = "<group>"; };
 		2981CAA7131822EC00D12F2A /* AccessibilityScrollbar.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = AccessibilityScrollbar.cpp; sourceTree = "<group>"; };
@@ -18352,8 +18349,6 @@
 				29A812240FBB9C1D00510293 /* AccessibilityListBoxOption.h */,
 				2981ABC4131822EC00D12F2A /* AccessibilityMathMLElement.cpp */,
 				07B0ABCE1032242200FBDC33 /* AccessibilityMathMLElement.h */,
-				2981CAA4131822EC00D12F2A /* AccessibilityMediaControls.cpp */,
-				07B0113E1032242200FBDC33 /* AccessibilityMediaControls.h */,
 				A9787CB31F5F5C6500C551C6 /* AccessibilityMediaObject.cpp */,
 				A9787CB21F5F599200C551C6 /* AccessibilityMediaObject.h */,
 				76CDD2EC1103DA6600680521 /* AccessibilityMenuList.cpp */,
@@ -29994,7 +29989,6 @@
 				29A812430FBB9C1D00510293 /* AccessibilityListBox.h in Headers */,
 				29A812420FBB9C1D00510293 /* AccessibilityListBoxOption.h in Headers */,
 				07B0ABCF1032242200FBDC33 /* AccessibilityMathMLElement.h in Headers */,
-				07B0113F1032242200FBDC33 /* AccessibilityMediaControls.h in Headers */,
 				76CDD2F31103DA6600680521 /* AccessibilityMenuList.h in Headers */,
 				76CDD2F71103DA6600680521 /* AccessibilityMenuListOption.h in Headers */,
 				76CDD2F51103DA6600680521 /* AccessibilityMenuListPopup.h in Headers */,

Modified: trunk/Source/WebCore/accessibility/AXObjectCache.cpp (265513 => 265514)


--- trunk/Source/WebCore/accessibility/AXObjectCache.cpp	2020-08-11 20:40:01 UTC (rev 265513)
+++ trunk/Source/WebCore/accessibility/AXObjectCache.cpp	2020-08-11 20:58:28 UTC (rev 265514)
@@ -78,7 +78,10 @@
 #include "HTMLMediaElement.h"
 #include "HTMLMeterElement.h"
 #include "HTMLNames.h"
+#include "HTMLOptGroupElement.h"
+#include "HTMLOptionElement.h"
 #include "HTMLParserIdioms.h"
+#include "HTMLSelectElement.h"
 #include "HTMLTextFormControlElement.h"
 #include "InlineElementBox.h"
 #include "MathMLElement.h"
@@ -640,6 +643,24 @@
     if (!node->parentElement())
         return nullptr;
     
+    bool isOptionElement = is<HTMLOptionElement>(*node);
+    if (isOptionElement || is<HTMLOptGroupElement>(*node)) {
+        auto select = isOptionElement
+            ? downcast<HTMLOptionElement>(*node).ownerSelectElement()
+            : downcast<HTMLOptGroupElement>(*node).ownerSelectElement();
+        if (!select)
+            return nullptr;
+        RefPtr<AccessibilityObject> object;
+        if (select->usesMenuList()) {
+            if (!isOptionElement)
+                return nullptr;
+            object = AccessibilityMenuListOption::create(downcast<HTMLOptionElement>(*node));
+        } else
+            object = AccessibilityListBoxOption::create(downcast<HTMLElement>(*node));
+        cacheAndInitializeWrapper(object.get(), node);
+        return object.get();
+    }
+
     // It's only allowed to create an AccessibilityObject from a Node if it's in a canvas subtree.
     // Or if it's a hidden element, but we still want to expose it because of other ARIA attributes.
     bool inCanvasSubtree = lineageOfType<HTMLCanvasElement>(*node->parentElement()).first();
@@ -801,15 +822,12 @@
     return getOrCreate(frame->view());
 }    
     
-AccessibilityObject* AXObjectCache::getOrCreate(AccessibilityRole role)
+AccessibilityObject* AXObjectCache::create(AccessibilityRole role)
 {
     RefPtr<AccessibilityObject> obj;
 
     // will be filled in...
     switch (role) {
-    case AccessibilityRole::ListBoxOption:
-        obj = AccessibilityListBoxOption::create();
-        break;
     case AccessibilityRole::ImageMapLink:
         obj = AccessibilityImageMapLink::create();
         break;
@@ -825,9 +843,6 @@
     case AccessibilityRole::MenuListPopup:
         obj = AccessibilityMenuListPopup::create();
         break;
-    case AccessibilityRole::MenuListOption:
-        obj = AccessibilityMenuListOption::create();
-        break;
     case AccessibilityRole::SpinButton:
         obj = AccessibilitySpinButton::create();
         break;

Modified: trunk/Source/WebCore/accessibility/AXObjectCache.h (265513 => 265514)


--- trunk/Source/WebCore/accessibility/AXObjectCache.h	2020-08-11 20:40:01 UTC (rev 265513)
+++ trunk/Source/WebCore/accessibility/AXObjectCache.h	2020-08-11 20:58:28 UTC (rev 265514)
@@ -159,7 +159,7 @@
     WEBCORE_EXPORT AccessibilityObject* getOrCreate(Node*);
 
     // used for objects without backing elements
-    AccessibilityObject* getOrCreate(AccessibilityRole);
+    AccessibilityObject* create(AccessibilityRole);
     
     // will only return the AccessibilityObject if it already exists
     AccessibilityObject* get(RenderObject*);

Modified: trunk/Source/WebCore/accessibility/AccessibilityARIAGrid.cpp (265513 => 265514)


--- trunk/Source/WebCore/accessibility/AccessibilityARIAGrid.cpp	2020-08-11 20:40:01 UTC (rev 265513)
+++ trunk/Source/WebCore/accessibility/AccessibilityARIAGrid.cpp	2020-08-11 20:58:28 UTC (rev 265514)
@@ -138,7 +138,7 @@
     
     // make the columns based on the number of columns in the first body
     for (unsigned i = 0; i < columnCount; ++i) {
-        auto& column = downcast<AccessibilityTableColumn>(*axCache->getOrCreate(AccessibilityRole::Column));
+        auto& column = downcast<AccessibilityTableColumn>(*axCache->create(AccessibilityRole::Column));
         column.setColumnIndex(i);
         column.setParent(this);
         m_columns.append(&column);

Modified: trunk/Source/WebCore/accessibility/AccessibilityListBox.cpp (265513 => 265514)


--- trunk/Source/WebCore/accessibility/AccessibilityListBox.cpp	2020-08-11 20:40:01 UTC (rev 265513)
+++ trunk/Source/WebCore/accessibility/AccessibilityListBox.cpp	2020-08-11 20:58:28 UTC (rev 265514)
@@ -74,8 +74,6 @@
     m_haveChildren = true;
 
     for (const auto& listItem : downcast<HTMLSelectElement>(*selectNode).listItems()) {
-        // The cast to HTMLElement below is safe because the only other possible listItem type
-        // would be a WMLElement, but WML builds don't use accessibility features at all.
         AccessibilityObject* listOption = listBoxOptionAccessibilityObject(listItem);
         if (listOption && !listOption->accessibilityIsIgnored())
             m_children.append(listOption);
@@ -135,16 +133,10 @@
 
 AccessibilityObject* AccessibilityListBox::listBoxOptionAccessibilityObject(HTMLElement* element) const
 {
-    // skip hr elements
-    if (!element || element->hasTagName(hrTag))
-        return nullptr;
-    
-    AccessibilityObject& listBoxObject = *m_renderer->document().axObjectCache()->getOrCreate(AccessibilityRole::ListBoxOption);
-    downcast<AccessibilityListBoxOption>(listBoxObject).setHTMLElement(element);
-    
-    return &listBoxObject;
+    // FIXME: Why does AccessibilityMenuListPopup::menuListOptionAccessibilityObject check inRenderedDocument, but this does not?
+    return m_renderer->document().axObjectCache()->getOrCreate(element);
 }
-    
+
 AXCoreObject* AccessibilityListBox::elementAccessibilityHitTest(const IntPoint& point) const
 {
     // the internal HTMLSelectElement methods for returning a listbox option at a point

Modified: trunk/Source/WebCore/accessibility/AccessibilityListBoxOption.cpp (265513 => 265514)


--- trunk/Source/WebCore/accessibility/AccessibilityListBoxOption.cpp	2020-08-11 20:40:01 UTC (rev 265513)
+++ trunk/Source/WebCore/accessibility/AccessibilityListBoxOption.cpp	2020-08-11 20:58:28 UTC (rev 265514)
@@ -31,8 +31,6 @@
 
 #include "AXObjectCache.h"
 #include "AccessibilityListBox.h"
-#include "Element.h"
-#include "HTMLElement.h"
 #include "HTMLNames.h"
 #include "HTMLOptGroupElement.h"
 #include "HTMLOptionElement.h"
@@ -39,27 +37,26 @@
 #include "HTMLSelectElement.h"
 #include "IntRect.h"
 #include "RenderListBox.h"
-#include "RenderObject.h"
 
 namespace WebCore {
 
 using namespace HTMLNames;
     
-AccessibilityListBoxOption::AccessibilityListBoxOption()
-    : m_optionElement(nullptr)
+AccessibilityListBoxOption::AccessibilityListBoxOption(HTMLElement& element)
+    : m_optionElement(makeWeakPtr(element))
 {
 }
 
 AccessibilityListBoxOption::~AccessibilityListBoxOption() = default;
     
-Ref<AccessibilityListBoxOption> AccessibilityListBoxOption::create()
+Ref<AccessibilityListBoxOption> AccessibilityListBoxOption::create(HTMLElement& element)
 {
-    return adoptRef(*new AccessibilityListBoxOption());
+    return adoptRef(*new AccessibilityListBoxOption(element));
 }
     
 bool AccessibilityListBoxOption::isEnabled() const
 {
-    if (is<HTMLOptGroupElement>(m_optionElement))
+    if (is<HTMLOptGroupElement>(m_optionElement.get()))
         return false;
 
     if (equalLettersIgnoringASCIICase(getAttribute(aria_disabledAttr), "true"))
@@ -73,7 +70,7 @@
     
 bool AccessibilityListBoxOption::isSelected() const
 {
-    if (!is<HTMLOptionElement>(m_optionElement))
+    if (!is<HTMLOptionElement>(m_optionElement.get()))
         return false;
 
     return downcast<HTMLOptionElement>(*m_optionElement).selected();
@@ -124,7 +121,7 @@
     
 bool AccessibilityListBoxOption::canSetSelectedAttribute() const
 {
-    if (!is<HTMLOptionElement>(m_optionElement))
+    if (!is<HTMLOptionElement>(m_optionElement.get()))
         return false;
     
     if (m_optionElement->isDisabledFormControl())
@@ -157,9 +154,14 @@
 
 Element* AccessibilityListBoxOption::actionElement() const
 {
-    return m_optionElement;
+    return m_optionElement.get();
 }
 
+Node* AccessibilityListBoxOption::node() const
+{
+    return m_optionElement.get();
+}
+
 AccessibilityObject* AccessibilityListBoxOption::parentObject() const
 {
     HTMLSelectElement* parentNode = listBoxOptionParentNode();

Modified: trunk/Source/WebCore/accessibility/AccessibilityListBoxOption.h (265513 => 265514)


--- trunk/Source/WebCore/accessibility/AccessibilityListBoxOption.h	2020-08-11 20:40:01 UTC (rev 265513)
+++ trunk/Source/WebCore/accessibility/AccessibilityListBoxOption.h	2020-08-11 20:58:28 UTC (rev 265514)
@@ -29,47 +29,43 @@
 #pragma once
 
 #include "AccessibilityObject.h"
-#include "HTMLElement.h"
-#include <wtf/Forward.h>
 
 namespace WebCore {
 
-class AccessibilityListBox;
-class Element;
+class HTMLElement;
 class HTMLSelectElement;
-    
+
 class AccessibilityListBoxOption final : public AccessibilityObject {
 public:
-    static Ref<AccessibilityListBoxOption> create();
+    static Ref<AccessibilityListBoxOption> create(HTMLElement&);
     virtual ~AccessibilityListBoxOption();
-    
-    void setHTMLElement(HTMLElement* element) { m_optionElement = element; }
-    
-    AccessibilityRole roleValue() const override { return AccessibilityRole::ListBoxOption; }
-    bool isSelected() const override;
-    bool isEnabled() const override;
-    bool isSelectedOptionActive() const override;
-    String stringValue() const override;
-    Element* actionElement() const override;
-    Node* node() const override { return m_optionElement; }
-    void setSelected(bool) override;
-    bool canSetSelectedAttribute() const override;
 
-    LayoutRect elementRect() const override;
-    AccessibilityObject* parentObject() const override;
+    bool isSelected() const final;
+    void setSelected(bool) final;
 
 private:
-    AccessibilityListBoxOption();
+    explicit AccessibilityListBoxOption(HTMLElement&);
 
-    bool isListBoxOption() const override { return true; }
-    bool canHaveChildren() const override { return false; }
+    AccessibilityRole roleValue() const final { return AccessibilityRole::ListBoxOption; }
+    bool isEnabled() const final;
+    bool isSelectedOptionActive() const final;
+    String stringValue() const final;
+    Element* actionElement() const final;
+    Node* node() const final;
+    bool canSetSelectedAttribute() const final;
+
+    LayoutRect elementRect() const final;
+    AccessibilityObject* parentObject() const final;
+
+    bool isListBoxOption() const final { return true; }
+    bool canHaveChildren() const final { return false; }
     HTMLSelectElement* listBoxOptionParentNode() const;
     int listBoxOptionIndex() const;
     IntRect listBoxOptionRect() const;
     AccessibilityObject* listBoxOptionAccessibilityObject(HTMLElement*) const;
-    bool computeAccessibilityIsIgnored() const override;
+    bool computeAccessibilityIsIgnored() const final;
 
-    HTMLElement* m_optionElement;
+    WeakPtr<HTMLElement> m_optionElement;
 };
     
 } // namespace WebCore 

Modified: trunk/Source/WebCore/accessibility/AccessibilityMenuList.cpp (265513 => 265514)


--- trunk/Source/WebCore/accessibility/AccessibilityMenuList.cpp	2020-08-11 20:40:01 UTC (rev 265513)
+++ trunk/Source/WebCore/accessibility/AccessibilityMenuList.cpp	2020-08-11 20:58:28 UTC (rev 265514)
@@ -71,7 +71,7 @@
     if (!cache)
         return;
     
-    AccessibilityObject* list = cache->getOrCreate(AccessibilityRole::MenuListPopup);
+    auto list = cache->create(AccessibilityRole::MenuListPopup);
     if (!list)
         return;
 

Modified: trunk/Source/WebCore/accessibility/AccessibilityMenuListOption.cpp (265513 => 265514)


--- trunk/Source/WebCore/accessibility/AccessibilityMenuListOption.cpp	2020-08-11 20:40:01 UTC (rev 265513)
+++ trunk/Source/WebCore/accessibility/AccessibilityMenuListOption.cpp	2020-08-11 20:58:28 UTC (rev 265514)
@@ -35,14 +35,14 @@
 
 using namespace HTMLNames;
 
-AccessibilityMenuListOption::AccessibilityMenuListOption()
+AccessibilityMenuListOption::AccessibilityMenuListOption(HTMLOptionElement& element)
+    : m_element(makeWeakPtr(element))
 {
 }
 
-void AccessibilityMenuListOption::setElement(HTMLElement* element)
+Ref<AccessibilityMenuListOption> AccessibilityMenuListOption::create(HTMLOptionElement& element)
 {
-    ASSERT_ARG(element, is<HTMLOptionElement>(element));
-    m_element = element;
+    return adoptRef(*new AccessibilityMenuListOption(element));
 }
 
 Element* AccessibilityMenuListOption::actionElement() const
@@ -49,22 +49,25 @@
 {
     return m_element.get();
 }
+
+Node* AccessibilityMenuListOption::node() const
+{
+    return m_element.get();
+}
     
 bool AccessibilityMenuListOption::isEnabled() const
 {
-    // isDisabledFormControl() returns true if the parent <select> element is disabled,
-    // which we don't want.
-    return !downcast<HTMLOptionElement>(*m_element).ownElementDisabled();
+    return m_element && !m_element->ownElementDisabled();
 }
 
 bool AccessibilityMenuListOption::isVisible() const
 {
-    if (!m_parent)
+    if (!m_element)
         return false;
-    
-    // In a single-option select with the popup collapsed, only the selected
-    // item is considered visible.
-    return !m_parent->isOffScreen() || isSelected();
+
+    // In a single-option select with the popup collapsed, only the selected item is considered visible.
+    auto parent = m_element->document().axObjectCache()->getOrCreate(m_element->ownerSelectElement());
+    return parent && (!parent->isOffScreen() || isSelected());
 }
 
 bool AccessibilityMenuListOption::isOffScreen() const
@@ -75,7 +78,7 @@
 
 bool AccessibilityMenuListOption::isSelected() const
 {
-    return downcast<HTMLOptionElement>(*m_element).selected();
+    return m_element && m_element->selected();
 }
 
 void AccessibilityMenuListOption::setSelected(bool selected)
@@ -83,7 +86,7 @@
     if (!canSetSelectedAttribute())
         return;
     
-    downcast<HTMLOptionElement>(*m_element).setSelected(selected);
+    m_element->setSelected(selected);
 }
 
 String AccessibilityMenuListOption::nameForMSAA() const
@@ -118,7 +121,7 @@
 
 String AccessibilityMenuListOption::stringValue() const
 {
-    return downcast<HTMLOptionElement>(*m_element).label();
+    return m_element ? m_element->label() : String();
 }
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/accessibility/AccessibilityMenuListOption.h (265513 => 265514)


--- trunk/Source/WebCore/accessibility/AccessibilityMenuListOption.h	2020-08-11 20:40:01 UTC (rev 265513)
+++ trunk/Source/WebCore/accessibility/AccessibilityMenuListOption.h	2020-08-11 20:58:28 UTC (rev 265514)
@@ -25,39 +25,38 @@
 
 #pragma once
 
-#include "AccessibilityMockObject.h"
+#include "AccessibilityObject.h"
 
 namespace WebCore {
 
-class HTMLElement;
+class HTMLOptionElement;
 
-class AccessibilityMenuListOption final : public AccessibilityMockObject {
+class AccessibilityMenuListOption final : public AccessibilityObject {
 public:
-    static Ref<AccessibilityMenuListOption> create() { return adoptRef(*new AccessibilityMenuListOption); }
+    static Ref<AccessibilityMenuListOption> create(HTMLOptionElement&);
 
-    void setElement(HTMLElement*);
-
 private:
-    AccessibilityMenuListOption();
+    explicit AccessibilityMenuListOption(HTMLOptionElement&);
 
-    bool isMenuListOption() const override { return true; }
+    bool isMenuListOption() const final { return true; }
 
-    AccessibilityRole roleValue() const override { return AccessibilityRole::MenuListOption; }
-    bool canHaveChildren() const override { return false; }
+    AccessibilityRole roleValue() const final { return AccessibilityRole::MenuListOption; }
+    bool canHaveChildren() const final { return false; }
 
-    Element* actionElement() const override;
-    bool isEnabled() const override;
-    bool isVisible() const override;
-    bool isOffScreen() const override;
-    bool isSelected() const override;
-    String nameForMSAA() const override;
-    void setSelected(bool) override;
-    bool canSetSelectedAttribute() const override;
-    LayoutRect elementRect() const override;
-    String stringValue() const override;
-    bool computeAccessibilityIsIgnored() const override;
+    Element* actionElement() const final;
+    Node* node() const final;
+    bool isEnabled() const final;
+    bool isVisible() const final;
+    bool isOffScreen() const final;
+    bool isSelected() const final;
+    String nameForMSAA() const final;
+    void setSelected(bool) final;
+    bool canSetSelectedAttribute() const final;
+    LayoutRect elementRect() const final;
+    String stringValue() const final;
+    bool computeAccessibilityIsIgnored() const final;
 
-    RefPtr<HTMLElement> m_element;
+    WeakPtr<HTMLOptionElement> m_element;
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/accessibility/AccessibilityMenuListPopup.cpp (265513 => 265514)


--- trunk/Source/WebCore/accessibility/AccessibilityMenuListPopup.cpp	2020-08-11 20:40:01 UTC (rev 265513)
+++ trunk/Source/WebCore/accessibility/AccessibilityMenuListPopup.cpp	2020-08-11 20:58:28 UTC (rev 265514)
@@ -70,13 +70,10 @@
 
 AccessibilityMenuListOption* AccessibilityMenuListPopup::menuListOptionAccessibilityObject(HTMLElement* element) const
 {
-    if (!is<HTMLOptionElement>(element) || !element->inRenderedDocument())
+    if (!element || !element->inRenderedDocument())
         return nullptr;
 
-    auto& option = downcast<AccessibilityMenuListOption>(*document()->axObjectCache()->getOrCreate(AccessibilityRole::MenuListOption));
-    option.setElement(element);
-
-    return &option;
+    return downcast<AccessibilityMenuListOption>(document()->axObjectCache()->getOrCreate(element));
 }
 
 bool AccessibilityMenuListPopup::press()
@@ -100,11 +97,9 @@
     m_haveChildren = true;
 
     for (const auto& listItem : downcast<HTMLSelectElement>(*selectNode).listItems()) {
-        AccessibilityMenuListOption* option = menuListOptionAccessibilityObject(listItem);
-        if (option) {
-            option->setParent(this);
+        // FIXME: Why does AccessibilityListBox::addChildren check accessibilityIsIgnored but this does not?
+        if (auto option = menuListOptionAccessibilityObject(listItem))
             m_children.append(option);
-        }
     }
 }
 

Modified: trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp (265513 => 265514)


--- trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp	2020-08-11 20:40:01 UTC (rev 265513)
+++ trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp	2020-08-11 20:58:28 UTC (rev 265514)
@@ -53,6 +53,7 @@
 #include "HTMLLabelElement.h"
 #include "HTMLLegendElement.h"
 #include "HTMLNames.h"
+#include "HTMLOptionElement.h"
 #include "HTMLParserIdioms.h"
 #include "HTMLSelectElement.h"
 #include "HTMLTextAreaElement.h"
@@ -2026,7 +2027,7 @@
 
     // If the node can be turned into an AX object, we can use standard name computation rules.
     // If however, the node cannot (because there's no renderer e.g.) fallback to using the basic text underneath.
-    AccessibilityObject* axObject = node->document().axObjectCache()->getOrCreate(node);
+    auto axObject = element.document().axObjectCache()->getOrCreate(&element);
     if (axObject) {
         String valueDescription = axObject->valueDescription();
         if (!valueDescription.isEmpty())
@@ -2056,9 +2057,11 @@
             return childText;
     }
     
-    if (is<HTMLInputElement>(*node))
-        return downcast<HTMLInputElement>(*node).value();
-    
+    if (is<HTMLInputElement>(element))
+        return downcast<HTMLInputElement>(element).value();
+    if (is<HTMLOptionElement>(element))
+        return downcast<HTMLOptionElement>(element).value();
+
     String text;
     if (axObject) {
         if (axObject->accessibleNameDerivesFromContent())

Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp (265513 => 265514)


--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2020-08-11 20:40:01 UTC (rev 265513)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2020-08-11 20:58:28 UTC (rev 265514)
@@ -1949,7 +1949,7 @@
         } else {
             auto* parent = current->parentNode();
             if (is<HTMLAreaElement>(*current) && is<HTMLMapElement>(parent)) {
-                auto& areaObject = downcast<AccessibilityImageMapLink>(*axObjectCache()->getOrCreate(AccessibilityRole::ImageMapLink));
+                auto& areaObject = downcast<AccessibilityImageMapLink>(*axObjectCache()->create(AccessibilityRole::ImageMapLink));
                 HTMLMapElement& map = downcast<HTMLMapElement>(*parent);
                 areaObject.setHTMLAreaElement(downcast<HTMLAreaElement>(current));
                 areaObject.setHTMLMapElement(&map);
@@ -3173,7 +3173,7 @@
         // add an <area> element for this child if it has a link
         if (!area.isLink())
             continue;
-        auto& areaObject = downcast<AccessibilityImageMapLink>(*axObjectCache()->getOrCreate(AccessibilityRole::ImageMapLink));
+        auto& areaObject = downcast<AccessibilityImageMapLink>(*axObjectCache()->create(AccessibilityRole::ImageMapLink));
         areaObject.setHTMLAreaElement(&area);
         areaObject.setHTMLMapElement(map);
         areaObject.setParent(this);
@@ -3208,7 +3208,7 @@
     if (!is<SpinButtonElement>(spinButtonElement))
         return;
 
-    auto& axSpinButton = downcast<AccessibilitySpinButton>(*axObjectCache()->getOrCreate(AccessibilityRole::SpinButton));
+    auto& axSpinButton = downcast<AccessibilitySpinButton>(*axObjectCache()->create(AccessibilityRole::SpinButton));
     axSpinButton.setSpinButtonElement(downcast<SpinButtonElement>(spinButtonElement));
     axSpinButton.setParent(this);
     m_children.append(&axSpinButton);

Modified: trunk/Source/WebCore/accessibility/AccessibilitySlider.cpp (265513 => 265514)


--- trunk/Source/WebCore/accessibility/AccessibilitySlider.cpp	2020-08-11 20:40:01 UTC (rev 265513)
+++ trunk/Source/WebCore/accessibility/AccessibilitySlider.cpp	2020-08-11 20:58:28 UTC (rev 265514)
@@ -84,7 +84,7 @@
 
     AXObjectCache* cache = m_renderer->document().axObjectCache();
 
-    auto& thumb = downcast<AccessibilitySliderThumb>(*cache->getOrCreate(AccessibilityRole::SliderThumb));
+    auto& thumb = downcast<AccessibilitySliderThumb>(*cache->create(AccessibilityRole::SliderThumb));
     thumb.setParent(this);
 
     // Before actually adding the value indicator to the hierarchy,

Modified: trunk/Source/WebCore/accessibility/AccessibilitySpinButton.cpp (265513 => 265514)


--- trunk/Source/WebCore/accessibility/AccessibilitySpinButton.cpp	2020-08-11 20:40:01 UTC (rev 265513)
+++ trunk/Source/WebCore/accessibility/AccessibilitySpinButton.cpp	2020-08-11 20:58:28 UTC (rev 265514)
@@ -88,12 +88,12 @@
     
     m_haveChildren = true;
     
-    auto& incrementor = downcast<AccessibilitySpinButtonPart>(*cache->getOrCreate(AccessibilityRole::SpinButtonPart));
+    auto& incrementor = downcast<AccessibilitySpinButtonPart>(*cache->create(AccessibilityRole::SpinButtonPart));
     incrementor.setIsIncrementor(true);
     incrementor.setParent(this);
     m_children.append(&incrementor);
 
-    auto& decrementor = downcast<AccessibilitySpinButtonPart>(*cache->getOrCreate(AccessibilityRole::SpinButtonPart));
+    auto& decrementor = downcast<AccessibilitySpinButtonPart>(*cache->create(AccessibilityRole::SpinButtonPart));
     decrementor.setIsIncrementor(false);
     decrementor.setParent(this);
     m_children.append(&decrementor);

Modified: trunk/Source/WebCore/accessibility/AccessibilityTable.cpp (265513 => 265514)


--- trunk/Source/WebCore/accessibility/AccessibilityTable.cpp	2020-08-11 20:40:01 UTC (rev 265513)
+++ trunk/Source/WebCore/accessibility/AccessibilityTable.cpp	2020-08-11 20:58:28 UTC (rev 265514)
@@ -417,7 +417,7 @@
     // make the columns based on the number of columns in the first body
     unsigned length = maxColumnCount;
     for (unsigned i = 0; i < length; ++i) {
-        auto& column = downcast<AccessibilityTableColumn>(*axCache->getOrCreate(AccessibilityRole::Column));
+        auto& column = downcast<AccessibilityTableColumn>(*axCache->create(AccessibilityRole::Column));
         column.setColumnIndex(i);
         column.setParent(this);
         m_columns.append(&column);
@@ -505,7 +505,7 @@
     if (m_headerContainer)
         return m_headerContainer.get();
     
-    auto& tableHeader = downcast<AccessibilityMockObject>(*axObjectCache()->getOrCreate(AccessibilityRole::TableHeaderContainer));
+    auto& tableHeader = downcast<AccessibilityMockObject>(*axObjectCache()->create(AccessibilityRole::TableHeaderContainer));
     tableHeader.setParent(this);
 
     m_headerContainer = &tableHeader;

Modified: trunk/Source/WebCore/accessibility/atk/WebKitAccessible.cpp (265513 => 265514)


--- trunk/Source/WebCore/accessibility/atk/WebKitAccessible.cpp	2020-08-11 20:40:01 UTC (rev 265513)
+++ trunk/Source/WebCore/accessibility/atk/WebKitAccessible.cpp	2020-08-11 20:58:28 UTC (rev 265514)
@@ -97,17 +97,14 @@
 
 WEBKIT_DEFINE_TYPE(WebKitAccessible, webkit_accessible, ATK_TYPE_OBJECT)
 
-static AccessibilityObject* fallbackObject()
-{
-    static AccessibilityObject* object = &AccessibilityListBoxOption::create().leakRef();
-    return object;
-}
-
 static const gchar* webkitAccessibleGetName(AtkObject* object)
 {
     auto* accessible = WEBKIT_ACCESSIBLE(object);
     returnValIfWebKitAccessibleIsInvalid(accessible, nullptr);
 
+    if (!accessible->priv->object)
+        return "";
+
     Vector<AccessibilityText> textOrder;
     accessible->priv->object->accessibilityText(textOrder);
 
@@ -133,6 +130,9 @@
     auto* accessible = WEBKIT_ACCESSIBLE(object);
     returnValIfWebKitAccessibleIsInvalid(accessible, nullptr);
 
+    if (!accessible->priv->object)
+        return "";
+
     Vector<AccessibilityText> textOrder;
     accessible->priv->object->accessibilityText(textOrder);
 
@@ -312,6 +312,8 @@
 
     // Parent not set yet, so try to find it in the hierarchy.
     auto* coreObject = accessible->priv->object;
+    if (!coreObject)
+        return nullptr;
     auto* coreParent = coreObject->parentObjectUnignored();
     if (!coreParent && isRootObject(coreObject)) {
         // The top level object claims to not have a parent. This makes it
@@ -329,6 +331,8 @@
     auto* accessible = WEBKIT_ACCESSIBLE(object);
     returnValIfWebKitAccessibleIsInvalid(accessible, 0);
 
+    if (!accessible->priv->object)
+        return 0;
     return accessible->priv->object->children().size();
 }
 
@@ -337,7 +341,7 @@
     auto* accessible = WEBKIT_ACCESSIBLE(object);
     returnValIfWebKitAccessibleIsInvalid(accessible, nullptr);
 
-    if (index < 0)
+    if (!accessible->priv->object || index < 0)
         return nullptr;
 
     const auto& children = accessible->priv->object->children();
@@ -362,6 +366,8 @@
     returnValIfWebKitAccessibleIsInvalid(accessible, -1);
 
     auto* coreObject = accessible->priv->object;
+    if (!coreObject)
+        return -1;
     auto* parent = coreObject->parentObjectUnignored();
     if (!parent && isRootObject(coreObject)) {
         if (!coreObject->document())
@@ -399,6 +405,8 @@
 #endif
 
     auto* coreObject = accessible->priv->object;
+    if (!coreObject)
+        return attributeSet;
 
     // Hack needed for WebKit2 tests because obtaining an element by its ID
     // cannot be done from the UIProcess. Assistive technologies have no need
@@ -836,6 +844,9 @@
     auto* accessible = WEBKIT_ACCESSIBLE(object);
     returnValIfWebKitAccessibleIsInvalid(accessible, ATK_ROLE_INVALID);
 
+    if (!accessible->priv->object)
+        return ATK_ROLE_INVALID;
+    
     // Note: Why doesn't WebCore have a password field for this
     if (accessible->priv->object->isPasswordField())
         return ATK_ROLE_PASSWORD_TEXT;
@@ -1006,9 +1017,9 @@
 
     // Make sure the layout is updated to really know whether the object
     // is defunct or not, so we can return the proper state.
-    accessible->priv->object->updateBackingStore();
-
-    if (accessible->priv->object == fallbackObject()) {
+    if (accessible->priv->object)
+        accessible->priv->object->updateBackingStore();
+    if (!accessible->priv->object) {
         atk_state_set_add_state(stateSet, ATK_STATE_DEFUNCT);
         return stateSet;
     }
@@ -1028,7 +1039,8 @@
     returnValIfWebKitAccessibleIsInvalid(accessible, nullptr);
 
     AtkRelationSet* relationSet = ATK_OBJECT_CLASS(webkit_accessible_parent_class)->ref_relation_set(object);
-    setAtkRelationSetFromCoreObject(accessible->priv->object, relationSet);
+    if (accessible->priv->object)
+        setAtkRelationSetFromCoreObject(accessible->priv->object, relationSet);
     return relationSet;
 }
 
@@ -1046,6 +1058,9 @@
     auto* accessible = WEBKIT_ACCESSIBLE(object);
     returnValIfWebKitAccessibleIsInvalid(accessible, nullptr);
 
+    if (!accessible->priv->object)
+        return nullptr;
+    
     if (ATK_IS_DOCUMENT(object)) {
         // TODO: Should we fall back on lang xml:lang when the following comes up empty?
         String language = accessible->priv->object->language();
@@ -1300,6 +1315,7 @@
 AccessibilityObject& webkitAccessibleGetAccessibilityObject(WebKitAccessible* accessible)
 {
     ASSERT(WEBKIT_IS_ACCESSIBLE(accessible));
+    ASSERT(accessible->priv->object);
     return *accessible->priv->object;
 }
 
@@ -1306,21 +1322,17 @@
 void webkitAccessibleDetach(WebKitAccessible* accessible)
 {
     ASSERT(WEBKIT_IS_ACCESSIBLE(accessible));
-    ASSERT(accessible->priv->object != fallbackObject());
 
-    if (accessible->priv->object->roleValue() == AccessibilityRole::WebArea)
+    if (accessible->priv->object && accessible->priv->object->roleValue() == AccessibilityRole::WebArea)
         atk_object_notify_state_change(ATK_OBJECT(accessible), ATK_STATE_DEFUNCT, TRUE);
 
-    // We replace the WebCore AccessibilityObject with a fallback object that
-    // provides default implementations to avoid repetitive null-checking after
-    // detachment.
-    accessible->priv->object = fallbackObject();
+    accessible->priv->object = nullptr;
 }
 
 bool webkitAccessibleIsDetached(WebKitAccessible* accessible)
 {
     ASSERT(WEBKIT_IS_ACCESSIBLE(accessible));
-    return accessible->priv->object == fallbackObject();
+    return !accessible->priv->object;
 }
 
 const char* webkitAccessibleCacheAndReturnAtkProperty(WebKitAccessible* accessible, AtkCachedProperty property, CString&& value)

Modified: trunk/Source/WebCore/html/HTMLOptionElement.cpp (265513 => 265514)


--- trunk/Source/WebCore/html/HTMLOptionElement.cpp	2020-08-11 20:40:01 UTC (rev 265513)
+++ trunk/Source/WebCore/html/HTMLOptionElement.cpp	2020-08-11 20:58:28 UTC (rev 265514)
@@ -209,7 +209,7 @@
     setAttributeWithoutSynchronization(valueAttr, value);
 }
 
-bool HTMLOptionElement::selected()
+bool HTMLOptionElement::selected() const
 {
     if (RefPtr<HTMLSelectElement> select = ownerSelectElement())
         select->updateListItemSelectedStates();

Modified: trunk/Source/WebCore/html/HTMLOptionElement.h (265513 => 265514)


--- trunk/Source/WebCore/html/HTMLOptionElement.h	2020-08-11 20:40:01 UTC (rev 265513)
+++ trunk/Source/WebCore/html/HTMLOptionElement.h	2020-08-11 20:58:28 UTC (rev 265514)
@@ -45,7 +45,7 @@
     WEBCORE_EXPORT String value() const;
     WEBCORE_EXPORT void setValue(const String&);
 
-    WEBCORE_EXPORT bool selected();
+    WEBCORE_EXPORT bool selected() const;
     WEBCORE_EXPORT void setSelected(bool);
 
     WEBCORE_EXPORT HTMLSelectElement* ownerSelectElement() const;

Modified: trunk/Tools/ChangeLog (265513 => 265514)


--- trunk/Tools/ChangeLog	2020-08-11 20:40:01 UTC (rev 265513)
+++ trunk/Tools/ChangeLog	2020-08-11 20:58:28 UTC (rev 265514)
@@ -1,3 +1,15 @@
+2020-08-11  Darin Adler  <[email protected]>
+
+        LayoutTest accessibility/mac/select-element-selection-with-optgroups.html is a flaky failure
+        https://bugs.webkit.org/show_bug.cgi?id=175341
+
+        Reviewed by Chris Fleizach.
+
+        * Scripts/webkitpy/layout_tests/controllers/single_test_runner.py:
+        (SingleTestRunner._compare_output_with_reference): Removed unhelpful log message that tells
+        about ref tests where the hash optimization for comparing images does not work, but the
+        test passes. We don't want to get this kind of log message for passing tests.
+
 2020-08-11  Timothy Hatcher  <[email protected]>
 
         Deferred WKUserScripts are exponentially injected on preloaded pages with frames.

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/controllers/single_test_runner.py (265513 => 265514)


--- trunk/Tools/Scripts/webkitpy/layout_tests/controllers/single_test_runner.py	2020-08-11 20:40:01 UTC (rev 265513)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/controllers/single_test_runner.py	2020-08-11 20:58:28 UTC (rev 265514)
@@ -346,7 +346,5 @@
                 actual_driver_output.error = (actual_driver_output.error or '') + error_string
             elif diff_result[0]:
                 failures.append(test_failures.FailureReftestMismatch(reference_filename))
-            else:
-                _log.warning("  %s -> ref test hashes didn't match but diff passed" % self._test_name)
 
         return TestResult(self._test_name, failures, total_test_time, has_stderr, pid=actual_driver_output.pid)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to