Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 27d1f9cc4510863db64c73d0c5739deb8d8d44b3
      
https://github.com/WebKit/WebKit/commit/27d1f9cc4510863db64c73d0c5739deb8d8d44b3
  Author: Tyler Wilcock <[email protected]>
  Date:   2026-02-27 (Fri, 27 Feb 2026)

  Changed paths:
    M Source/WebCore/accessibility/mac/AXObjectCacheMac.mm
    M Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm

  Log Message:
  -----------
  AX: -[WebAccessibilityObjectWrapperMac accessibilityAttributeValue] and the 
parameterized equivalent do O(n) comparisons to try to find matching attribute
https://bugs.webkit.org/show_bug.cgi?id=308256
rdar://170762901

Reviewed by Joshua Hoffman.

Replace O(n) if/else chains with O(1) HashMap lookup for attribute dispatch in
-accessibilityAttributeValue: and -accessibilityAttributeValue:forParameter:.

Extract each attribute handler into a static function and build a
MemoryCompactLookupOnlyRobinHoodHashMap mapping attribute names to handler
entries. Handler entries include an optional span of preconditions (e.g.,
IsWebArea, IsTextControl, IsExposableTable) with OR semantics - if any
precondition passes, the handler is invoked.

* Source/WebCore/accessibility/mac/AXObjectCacheMac.mm:
* Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(handleWindowAttribute):
(handleTopLevelUIElementAttribute):
(handleRoleAttribute):
(handleParentAttribute):
(handleSubroleAttribute):
(handlePrimaryScreenHeightAttribute):
(handleRelativeFrameAttribute):
(handleTitleAttribute):
(handleDescriptionAttribute):
(handleInlineTextAttribute):
(handleValueAttribute):
(handleChildrenAttribute):
(handleDatetimeValueAttribute):
(handleARIACurrentAttribute):
(handleEnabledAttribute):
(handleTitleUIElementAttribute):
(handleValueDescriptionAttribute):
(handleFocusedAttribute):
(handleRoleDescriptionAttribute):
(handleLanguageAttribute):
(handleURLAttribute):
(handleSelectedTextMarkerRangeAttribute):
(handleDisclosureLevelAttribute):
(handlePlaceholderValueAttribute):
(handleRequiredAttribute):
(handlePopupValueAttribute):
(handleInvalidAttribute):
(handleHasPopupAttribute):
(handleLinkedUIElementsAttribute):
(handleElementBusyAttribute):
(handleIntersectionWithSelectionRangeAttribute):
(handleDRTSpeechAttribute):
(handleExpandedAttribute):
(handleSelectedChildrenAttribute):
(handleSelectedAttribute):
(handleSizeAttribute):
(handleOrientationAttribute):
(handleVisitedAttribute):
(handleBlockQuoteLevelAttribute):
(handleEmbeddedImageDescriptionAttribute):
(handleContentsAttribute):
(handleHelpAttribute):
(handleDisclosingAttribute):
(handleActiveElementAttribute):
(handleVisibleChildrenAttribute):
(handleLinkUIElementsAttribute):
(handleLoadedAttribute):
(handleLayoutCountAttribute):
(handleLoadingProgressAttribute):
(handlePreventKeyboardDOMEventDispatchAttribute):
(handleCaretBrowsingEnabledAttribute):
(handleNumberOfCharactersAttribute):
(handleSelectedTextAttribute):
(handleSelectedTextRangeAttribute):
(handleInsertionPointLineNumberAttribute):
(handleVisibleCharacterRangeAttribute):
(handleIncrementButtonAttribute):
(handleDecrementButtonAttribute):
(handleDateTimeComponentsAttribute):
(handleMenuItemMarkCharAttribute):
(handleMinValueAttribute):
(handleMaxValueAttribute):
(handlePositionAttribute):
(handlePathAttribute):
(handleLineRectsAndTextAttribute):
(handleImageOverlayElementsAttribute):
(handleAccessKeyAttribute):
(handleLinkRelationshipTypeAttribute):
(handleTabsAttribute):
(handleRowsAttribute):
(handleVisibleRowsAttribute):
(handleColumnsAttribute):
(handleTableSelectedRowsAttribute):
(handleSelectedColumnsAttribute):
(handleSelectedCellsAttribute):
(handleColumnHeaderUIElementsAttribute):
(handleHeaderAttribute):
(handleRowHeaderUIElementsAttribute):
(handleVisibleCellsAttribute):
(handleColumnCountAttribute):
(handleRowCountAttribute):
(handleARIAColumnCountAttribute):
(handleARIARowCountAttribute):
(handleRowIndexRangeAttribute):
(handleColumnIndexRangeAttribute):
(handleARIAColumnIndexAttribute):
(handleARIARowIndexAttribute):
(handleColumnIndexDescriptionAttribute):
(handleRowIndexDescriptionAttribute):
(handleIndexAttribute):
(handleDisclosedRowsAttribute):
(handleDisclosedByRowAttribute):
(handleStartTextMarkerAttribute):
(handleEndTextMarkerAttribute):
(handleTableLevelAttribute):
(handleHorizontalScrollBarAttribute):
(handleVerticalScrollBarAttribute):
(handleSortDirectionAttribute):
(handleOwnsAttribute):
(handleARIAPosInSetAttribute):
(handleARIASetSizeAttribute):
(handleGrabbedAttribute):
(handleDropEffectsAttribute):
(handleValueAutofillAvailableAttribute):
(handleValueAutofillTypeAttribute):
(handleARIALiveAttribute):
(handleARIARelevantAttribute):
(handleARIAAtomicAttribute):
(handleMathRootIndexAttribute):
(handleMathRootRadicandAttribute):
(handleMathFractionNumeratorAttribute):
(handleMathFractionDenominatorAttribute):
(handleMathBaseAttribute):
(handleMathSubscriptAttribute):
(handleMathSuperscriptAttribute):
(handleMathUnderAttribute):
(handleMathOverAttribute):
(handleMathFencedOpenAttribute):
(handleMathFencedCloseAttribute):
(handleMathLineThicknessAttribute):
(handleMathPostscriptsAttribute):
(handleMathPrescriptsAttribute):
(handleExpandedTextValueAttribute):
(handleDOMIdentifierAttribute):
(handleDOMClassListAttribute):
(handleAssociatedPluginParentAttribute):
(handleKeyShortcutsAttribute):
(handleIsInDescriptionListTermAttribute):
(handleDetailsElementsAttribute):
(handleBrailleLabelAttribute):
(handleBrailleRoleDescriptionAttribute):
(handleErrorMessageElementsAttribute):
(handleFocusableAncestorAttribute):
(handleEditableAncestorAttribute):
(handleHighestEditableAncestorAttribute):
(handleTextInputMarkedRangeAttribute):
(handleTextInputMarkedTextMarkerRangeAttribute):
(handleAutoInteractableAttribute):
(createAttributeHandlerMap):
(matchesPrecondition):
(matchesAnyPrecondition):
(-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
(handleUIElementsForSearchPredicateAttribute):
(handleUIElementForTextMarkerAttribute):
(handleTextMarkerRangeForUIElementAttribute):
(handleTextMarkerRangeForTextMarkersAttribute):
(handleParamAttributedStringForRangeAttribute):
(handleParamLineForIndexAttribute):
(handleParamRangeForLineAttribute):
(handleParamRangeForPositionAttribute):
(handleParamRangeForIndexAttribute):
(handleParamRTFForRangeAttribute):
(handleParamStyleRangeForIndexAttribute):
(handleAttributedStringForTextMarkerRangeAttribute):
(handleSelectTextWithCriteriaAttribute):
(handleSearchTextWithCriteriaAttribute):
(handleTextOperationAttribute):
(handleRangesForSearchPredicateAttribute):
(handleEndTextMarkerForBoundsAttribute):
(handleStartTextMarkerForBoundsAttribute):
(handleLineTextMarkerRangeForTextMarkerAttribute):
(handleMisspellingTextMarkerRangeAttribute):
(handleTextMarkerIsValidAttribute):
(handleIndexForTextMarkerAttribute):
(handleTextMarkerForIndexAttribute):
(handleLineForTextMarkerAttribute):
(handleTextMarkerRangeForLineAttribute):
(handleStringForTextMarkerRangeAttribute):
(handleTextMarkerForPositionAttribute):
(handleBoundsForTextMarkerRangeAttribute):
(handleBoundsForRangeParameterizedAttribute):
(handleStringForRangeParameterizedAttribute):
(handleAttributedStringForTextMarkerRangeWithOptionsAttribute):
(handleNextTextMarkerForTextMarkerAttribute):
(handlePreviousTextMarkerForTextMarkerAttribute):
(handleLeftWordTextMarkerRangeForTextMarkerAttribute):
(handleRightWordTextMarkerRangeForTextMarkerAttribute):
(handleLeftLineTextMarkerRangeForTextMarkerAttribute):
(handleRightLineTextMarkerRangeForTextMarkerAttribute):
(handleSentenceTextMarkerRangeForTextMarkerAttribute):
(handleParagraphTextMarkerRangeForTextMarkerAttribute):
(handleNextWordEndTextMarkerForTextMarkerAttribute):
(handlePreviousWordStartTextMarkerForTextMarkerAttribute):
(handleNextLineEndTextMarkerForTextMarkerAttribute):
(handlePreviousLineStartTextMarkerForTextMarkerAttribute):
(handleNextSentenceEndTextMarkerForTextMarkerAttribute):
(handlePreviousSentenceStartTextMarkerForTextMarkerAttribute):
(handleNextParagraphEndTextMarkerForTextMarkerAttribute):
(handlePreviousParagraphStartTextMarkerForTextMarkerAttribute):
(handleStyleTextMarkerRangeForTextMarkerAttribute):
(handleLengthForTextMarkerRangeAttribute):
(handleIntersectTextMarkerRangesAttribute):
(handleCellForColumnAndRowParameterizedAttribute):
(handleConvertRelativeFrameParameterizedAttribute):
(createParameterizedAttributeHandlerMap):
(checkParameterizedAttributePrecondition):
(-[WebAccessibilityObjectWrapper accessibilityAttributeValue:forParameter:]):

Canonical link: https://commits.webkit.org/308339@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to