WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
wk-no-atk.diff (text/plain), 479.33 KB, created by
Carlos Garcia Campos
on 2022-03-22 03:36:03 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Carlos Garcia Campos
Created:
2022-03-22 03:36:03 PDT
Size:
479.33 KB
patch
obsolete
>diff --git a/ChangeLog b/ChangeLog >index de8942d8f9b8..830d626afacb 100644 >--- a/ChangeLog >+++ b/ChangeLog >@@ -1,3 +1,13 @@ >+2022-03-22 Carlos Garcia Campos <cgarcia@igalia.com> >+ >+ [GTK][WPE] Remove the ATK implementation >+ https://bugs.webkit.org/show_bug.cgi?id=238198 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * Source/cmake/OptionsGTK.cmake: >+ * Source/cmake/OptionsWPE.cmake: >+ > 2022-03-21 Commit Queue <commit-queue@webkit.org> > > Unreviewed, reverting r291055. >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 773c0d255a7f..fcc135456671 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,18 @@ >+2022-03-22 Carlos Garcia Campos <cgarcia@igalia.com> >+ >+ [GTK][WPE] Remove the ATK implementation >+ https://bugs.webkit.org/show_bug.cgi?id=238198 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * accessibility/gtk/aria-modal-state-exposed-expected.txt: >+ * accessibility/gtk/aria-modal-state-exposed.html: >+ * accessibility/gtk/name-from-label-expected.txt: >+ * accessibility/gtk/name-from-label.html: >+ * accessibility/gtk/object-attributes-expected.txt: >+ * accessibility/gtk/object-attributes.html: >+ * accessibility/language-attribute.html: >+ > 2022-03-21 Said Abou-Hallawa <said@apple.com> > > [GPU Process] Make GraphicsContextState keep track of changes till they are applied >diff --git a/LayoutTests/accessibility/gtk/aria-modal-state-exposed-expected.txt b/LayoutTests/accessibility/gtk/aria-modal-state-exposed-expected.txt >index 690a095d185f..feb5458d3359 100644 >--- a/LayoutTests/accessibility/gtk/aria-modal-state-exposed-expected.txt >+++ b/LayoutTests/accessibility/gtk/aria-modal-state-exposed-expected.txt >@@ -1,4 +1,4 @@ >-This tests that a dialog with aria-modal='true' exposes ATK_STATE_MODAL >+This tests that a dialog with aria-modal='true' exposes modal state > > On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". > >diff --git a/LayoutTests/accessibility/gtk/aria-modal-state-exposed.html b/LayoutTests/accessibility/gtk/aria-modal-state-exposed.html >index 1f1c155bb34a..16dea7448518 100644 >--- a/LayoutTests/accessibility/gtk/aria-modal-state-exposed.html >+++ b/LayoutTests/accessibility/gtk/aria-modal-state-exposed.html >@@ -12,7 +12,7 @@ > <p id="description"></p> > <div id="console"></div> > <script> >- description("This tests that a dialog with aria-modal='true' exposes ATK_STATE_MODAL"); >+ description("This tests that a dialog with aria-modal='true' exposes modal state"); > if (window.accessibilityController) { > var axElement = accessibilityController.accessibleElementById("test"); > shouldBeTrue("axElement.boolAttributeValue('AXModal')"); >diff --git a/LayoutTests/accessibility/gtk/name-from-label-expected.txt b/LayoutTests/accessibility/gtk/name-from-label-expected.txt >index 4f09f9dbc2d1..9f08a2445a40 100644 >--- a/LayoutTests/accessibility/gtk/name-from-label-expected.txt >+++ b/LayoutTests/accessibility/gtk/name-from-label-expected.txt >@@ -1,5 +1,5 @@ > Full Name: >-This tests that AtkObjects derive their names from associated labels. >+This tests that accessibility objects derive their names from associated labels. > > On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". > >diff --git a/LayoutTests/accessibility/gtk/name-from-label.html b/LayoutTests/accessibility/gtk/name-from-label.html >index f1f29dabc5c7..dee571ccd58e 100644 >--- a/LayoutTests/accessibility/gtk/name-from-label.html >+++ b/LayoutTests/accessibility/gtk/name-from-label.html >@@ -23,7 +23,7 @@ > } > > function startTest() { >- description("This tests that AtkObjects derive their names from associated labels."); >+ description("This tests that accessibility objects derive their names from associated labels."); > > if (window.testRunner) { > testRunner.dumpAsText(); >diff --git a/LayoutTests/accessibility/gtk/object-attributes-expected.txt b/LayoutTests/accessibility/gtk/object-attributes-expected.txt >index b48f1af9618d..7c7c7a67cb0d 100644 >--- a/LayoutTests/accessibility/gtk/object-attributes-expected.txt >+++ b/LayoutTests/accessibility/gtk/object-attributes-expected.txt >@@ -24,7 +24,7 @@ Odd Even > foo > bar > baz >-This tests the exposure of Atk object attributes. >+This tests the exposure of object attributes. > > On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". > >@@ -282,7 +282,7 @@ AXPosition: { 8.00000, 462.000 } > AXSize: { 784.000, 53.0000 } > AXTitle: > AXDescription: >-AXValue: This tests the exposure of Atk object attributes.<\n><\n>On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".<\n><\n><\n> >+AXValue: This tests the exposure of object attributes.<\n><\n>On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".<\n><\n><\n> > AXFocusable: 0 > AXFocused: 0 > AXSelectable: 0 >diff --git a/LayoutTests/accessibility/gtk/object-attributes.html b/LayoutTests/accessibility/gtk/object-attributes.html >index bd669d0eacfa..d234e92e5176 100644 >--- a/LayoutTests/accessibility/gtk/object-attributes.html >+++ b/LayoutTests/accessibility/gtk/object-attributes.html >@@ -26,7 +26,7 @@ > <p id="description"></p> > <div id="console"></div> > <script> >- description("This tests the exposure of Atk object attributes."); >+ description("This tests the exposure of object attributes."); > if (window.accessibilityController) { > testRunner.dumpAsText(); > document.getElementById("body").focus(); >diff --git a/LayoutTests/accessibility/language-attribute.html b/LayoutTests/accessibility/language-attribute.html >index 56fd3613a8bd..dbd0ada9ce5c 100644 >--- a/LayoutTests/accessibility/language-attribute.html >+++ b/LayoutTests/accessibility/language-attribute.html >@@ -4,7 +4,7 @@ > testRunner.dumpAsText(); > > // The Mac port exposes static text objects as an accessible child of an element with text. >- // The Atk port folds static text objects into the parent element. >+ // The ATSPI based ports fold static text objects into the parent element. > function getTextChild(accessibilityObject) { > if (accessibilityObject.childrenCount) > return accessibilityObject.childAtIndex(0); >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 5068c4d55876..23ef59679761 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,285 @@ >+2022-03-22 Carlos Garcia Campos <cgarcia@igalia.com> >+ >+ [GTK][WPE] Remove the ATK implementation >+ https://bugs.webkit.org/show_bug.cgi?id=238198 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * PlatformGTK.cmake: >+ * PlatformWPE.cmake: >+ * SourcesGTK.txt: >+ * SourcesWPE.txt: >+ * accessibility/AXObjectCache.h: >+ * accessibility/AccessibilityList.cpp: >+ (WebCore::AccessibilityList::childHasPseudoVisibleListItemMarkers): >+ * accessibility/AccessibilityNodeObject.cpp: >+ (WebCore::AccessibilityNodeObject::canSetValueAttribute const): >+ * accessibility/AccessibilityObject.cpp: >+ (WebCore::AccessibilityObject::textIteratorBehaviorForTextRange const): >+ * accessibility/AccessibilityObject.h: >+ * accessibility/AccessibilityObjectInterface.h: >+ * accessibility/AccessibilityRenderObject.cpp: >+ (WebCore::AccessibilityRenderObject::indexForVisiblePosition const): >+ (WebCore::AccessibilityRenderObject::shouldNotifyActiveDescendant const): >+ * accessibility/AccessibilityTableColumn.cpp: >+ (WebCore::AccessibilityTableColumn::computeAccessibilityIsIgnored const): >+ * accessibility/AccessibilityTableHeaderContainer.cpp: >+ (WebCore::AccessibilityTableHeaderContainer::computeAccessibilityIsIgnored const): >+ * accessibility/atk/AXObjectCacheAtk.cpp: Removed. >+ (WebCore::wrapperParent): Deleted. >+ (WebCore::AXObjectCache::detachWrapper): Deleted. >+ (WebCore::AXObjectCache::attachWrapper): Deleted. >+ (WebCore::AXObjectCache::platformPerformDeferredCacheUpdate): Deleted. >+ (WebCore::getListObject): Deleted. >+ (WebCore::notifyChildrenSelectionChange): Deleted. >+ (WebCore::AXObjectCache::postPlatformNotification): Deleted. >+ (WebCore::AXObjectCache::nodeTextChangePlatformNotification): Deleted. >+ (WebCore::AXObjectCache::frameLoadingEventPlatformNotification): Deleted. >+ (WebCore::AXObjectCache::platformHandleFocusedUIElementChanged): Deleted. >+ (WebCore::AXObjectCache::handleScrolledToAnchor): Deleted. >+ * accessibility/atk/AccessibilityObjectAtk.cpp: Removed. >+ (WebCore::AccessibilityObject::detachPlatformWrapper): Deleted. >+ (WebCore::AccessibilityObject::accessibilityIgnoreAttachment const): Deleted. >+ (WebCore::AccessibilityObject::accessibilityPlatformIncludesObject const): Deleted. >+ (WebCore::AccessibilityObject::allowsTextRanges const): Deleted. >+ (WebCore::AccessibilityObject::getLengthForTextRange const): Deleted. >+ * accessibility/atk/WebKitAccessible.cpp: Removed. >+ (webkitAccessibleGetName): Deleted. >+ (webkitAccessibleGetDescription): Deleted. >+ (removeAtkRelationByType): Deleted. >+ (setAtkRelationSetFromCoreObject): Deleted. >+ (isRootObject): Deleted. >+ (webkitAccessibleGetParent): Deleted. >+ (webkitAccessibleGetNChildren): Deleted. >+ (webkitAccessibleRefChild): Deleted. >+ (webkitAccessibleGetIndexInParent): Deleted. >+ (webkitAccessibleGetAttributes): Deleted. >+ (atkRole): Deleted. >+ (webkitAccessibleGetRole): Deleted. >+ (isTextWithCaret): Deleted. >+ (setAtkStateSetFromCoreObject): Deleted. >+ (webkitAccessibleRefStateSet): Deleted. >+ (webkitAccessibleRefRelationSet): Deleted. >+ (webkitAccessibleInit): Deleted. >+ (webkitAccessibleGetObjectLocale): Deleted. >+ (webkit_accessible_class_init): Deleted. >+ (roleIsTextType): Deleted. >+ (interfaceMaskFromObject): Deleted. >+ (uniqueAccessibilityTypeName): Deleted. >+ (accessibilityTypeFromObject): Deleted. >+ (webkitAccessibleNew): Deleted. >+ (webkitAccessibleGetAccessibilityObject): Deleted. >+ (webkitAccessibleDetach): Deleted. >+ (webkitAccessibleIsDetached): Deleted. >+ (webkitAccessibleCacheAndReturnAtkProperty): Deleted. >+ * accessibility/atk/WebKitAccessible.h: Removed. >+ * accessibility/atk/WebKitAccessibleHyperlink.cpp: Removed. >+ (webkitAccessibleHyperlinkActionDoAction): Deleted. >+ (webkitAccessibleHyperlinkActionGetNActions): Deleted. >+ (webkitAccessibleHyperlinkActionGetDescription): Deleted. >+ (webkitAccessibleHyperlinkActionGetKeybinding): Deleted. >+ (webkitAccessibleHyperlinkActionGetName): Deleted. >+ (webkit_accessible_hyperlink_atk_action_interface_init): Deleted. >+ (webkitAccessibleHyperlinkGetURI): Deleted. >+ (webkitAccessibleHyperlinkGetObject): Deleted. >+ (rangeLengthForObject): Deleted. >+ (webkitAccessibleHyperlinkGetStartIndex): Deleted. >+ (webkitAccessibleHyperlinkGetEndIndex): Deleted. >+ (webkitAccessibleHyperlinkIsValid): Deleted. >+ (webkitAccessibleHyperlinkGetNAnchors): Deleted. >+ (webkitAccessibleHyperlinkIsSelectedLink): Deleted. >+ (webkitAccessibleHyperlinkGetProperty): Deleted. >+ (webkitAccessibleHyperlinkSetProperty): Deleted. >+ (webkit_accessible_hyperlink_class_init): Deleted. >+ (webkitAccessibleHyperlinkGetOrCreate): Deleted. >+ * accessibility/atk/WebKitAccessibleHyperlink.h: Removed. >+ * accessibility/atk/WebKitAccessibleInterfaceAction.cpp: Removed. >+ (core): Deleted. >+ (webkitAccessibleActionDoAction): Deleted. >+ (webkitAccessibleActionGetNActions): Deleted. >+ (webkitAccessibleActionGetDescription): Deleted. >+ (webkitAccessibleActionGetKeybinding): Deleted. >+ (webkitAccessibleActionGetName): Deleted. >+ (webkitAccessibleActionInterfaceInit): Deleted. >+ * accessibility/atk/WebKitAccessibleInterfaceAction.h: Removed. >+ * accessibility/atk/WebKitAccessibleInterfaceComponent.cpp: Removed. >+ (atkToContents): Deleted. >+ (webkitAccessibleComponentRefAccessibleAtPoint): Deleted. >+ (webkitAccessibleComponentGetExtents): Deleted. >+ (webkitAccessibleComponentGrabFocus): Deleted. >+ (webkitAccessibleComponentScrollTo): Deleted. >+ (webkitAccessibleComponentScrollToPoint): Deleted. >+ (webkitAccessibleComponentInterfaceInit): Deleted. >+ * accessibility/atk/WebKitAccessibleInterfaceComponent.h: Removed. >+ * accessibility/atk/WebKitAccessibleInterfaceDocument.cpp: Removed. >+ (core): Deleted. >+ (documentAttributeValue): Deleted. >+ (webkitAccessibleDocumentGetAttributeValue): Deleted. >+ (webkitAccessibleDocumentGetAttributes): Deleted. >+ (webkitAccessibleDocumentGetLocale): Deleted. >+ (webkitAccessibleDocumentInterfaceInit): Deleted. >+ * accessibility/atk/WebKitAccessibleInterfaceDocument.h: Removed. >+ * accessibility/atk/WebKitAccessibleInterfaceEditableText.cpp: Removed. >+ (core): Deleted. >+ (webkitAccessibleEditableTextSetRunAttributes): Deleted. >+ (webkitAccessibleEditableTextSetTextContents): Deleted. >+ (webkitAccessibleEditableTextInsertText): Deleted. >+ (webkitAccessibleEditableTextCopyText): Deleted. >+ (webkitAccessibleEditableTextCutText): Deleted. >+ (webkitAccessibleEditableTextDeleteText): Deleted. >+ (webkitAccessibleEditableTextPasteText): Deleted. >+ (webkitAccessibleEditableTextInterfaceInit): Deleted. >+ * accessibility/atk/WebKitAccessibleInterfaceEditableText.h: Removed. >+ * accessibility/atk/WebKitAccessibleInterfaceHyperlinkImpl.cpp: Removed. >+ (webkitAccessibleHyperlinkImplGetHyperlink): Deleted. >+ (webkitAccessibleHyperlinkImplInterfaceInit): Deleted. >+ * accessibility/atk/WebKitAccessibleInterfaceHyperlinkImpl.h: Removed. >+ * accessibility/atk/WebKitAccessibleInterfaceHypertext.cpp: Removed. >+ (core): Deleted. >+ (webkitAccessibleHypertextGetLink): Deleted. >+ (webkitAccessibleHypertextGetNLinks): Deleted. >+ (webkitAccessibleHypertextGetLinkIndex): Deleted. >+ (webkitAccessibleHypertextInterfaceInit): Deleted. >+ * accessibility/atk/WebKitAccessibleInterfaceHypertext.h: Removed. >+ * accessibility/atk/WebKitAccessibleInterfaceImage.cpp: Removed. >+ (core): Deleted. >+ (webkitAccessibleImageGetImagePosition): Deleted. >+ (webkitAccessibleImageGetImageDescription): Deleted. >+ (webkitAccessibleImageGetImageSize): Deleted. >+ (webkitAccessibleImageInterfaceInit): Deleted. >+ * accessibility/atk/WebKitAccessibleInterfaceImage.h: Removed. >+ * accessibility/atk/WebKitAccessibleInterfaceSelection.cpp: Removed. >+ (core): Deleted. >+ (listObjectForCoreSelection): Deleted. >+ (optionFromList): Deleted. >+ (optionFromSelection): Deleted. >+ (webkitAccessibleSelectionAddSelection): Deleted. >+ (webkitAccessibleSelectionClearSelection): Deleted. >+ (webkitAccessibleSelectionRefSelection): Deleted. >+ (webkitAccessibleSelectionGetSelectionCount): Deleted. >+ (webkitAccessibleSelectionIsChildSelected): Deleted. >+ (webkitAccessibleSelectionRemoveSelection): Deleted. >+ (webkitAccessibleSelectionSelectAllSelection): Deleted. >+ (webkitAccessibleSelectionInterfaceInit): Deleted. >+ * accessibility/atk/WebKitAccessibleInterfaceSelection.h: Removed. >+ * accessibility/atk/WebKitAccessibleInterfaceTable.cpp: Removed. >+ (core): Deleted. >+ (cell): Deleted. >+ (cellIndex): Deleted. >+ (cellAtIndex): Deleted. >+ (webkitAccessibleTableRefAt): Deleted. >+ (webkitAccessibleTableGetIndexAt): Deleted. >+ (webkitAccessibleTableGetColumnAtIndex): Deleted. >+ (webkitAccessibleTableGetRowAtIndex): Deleted. >+ (webkitAccessibleTableGetNColumns): Deleted. >+ (webkitAccessibleTableGetNRows): Deleted. >+ (webkitAccessibleTableGetColumnExtentAt): Deleted. >+ (webkitAccessibleTableGetRowExtentAt): Deleted. >+ (webkitAccessibleTableGetColumnHeader): Deleted. >+ (webkitAccessibleTableGetRowHeader): Deleted. >+ (webkitAccessibleTableGetCaption): Deleted. >+ (webkitAccessibleTableGetColumnDescription): Deleted. >+ (webkitAccessibleTableGetRowDescription): Deleted. >+ (webkitAccessibleTableInterfaceInit): Deleted. >+ * accessibility/atk/WebKitAccessibleInterfaceTable.h: Removed. >+ * accessibility/atk/WebKitAccessibleInterfaceTableCell.cpp: Removed. >+ (convertToGPtrArray): Deleted. >+ (core): Deleted. >+ (webkitAccessibleTableCellGetColumnHeaderCells): Deleted. >+ (webkitAccessibleTableCellGetRowHeaderCells): Deleted. >+ (webkitAccessibleTableCellGetColumnSpan): Deleted. >+ (webkitAccessibleTableCellGetRowSpan): Deleted. >+ (webkitAccessibleTableCellGetPosition): Deleted. >+ (webkitAccessibleTableCellGetTable): Deleted. >+ (webkitAccessibleTableCellInterfaceInit): Deleted. >+ * accessibility/atk/WebKitAccessibleInterfaceTableCell.h: Removed. >+ * accessibility/atk/WebKitAccessibleInterfaceText.cpp: Removed. >+ (core): Deleted. >+ (baselinePositionForRenderObject): Deleted. >+ (getAttributeSetForAccessibilityObject): Deleted. >+ (compareAttribute): Deleted. >+ (attributeSetDifference): Deleted. >+ (accessibilityObjectLength): Deleted. >+ (getAccessibilityObjectForOffset): Deleted. >+ (getRunAttributesFromAccessibilityObject): Deleted. >+ (textExtents): Deleted. >+ (offsetAdjustmentForListItem): Deleted. >+ (webCoreOffsetToAtkOffset): Deleted. >+ (atkOffsetToWebCoreOffset): Deleted. >+ (getNodeForAccessibilityObject): Deleted. >+ (getSelectionOffsetsForObject): Deleted. >+ (webkitAccessibleTextGetText): Deleted. >+ (emptyTextSelectionAtOffset): Deleted. >+ (webkitAccessibleTextGetChar): Deleted. >+ (nextWordStartPosition): Deleted. >+ (previousWordEndPosition): Deleted. >+ (wordAtPositionForAtkBoundary): Deleted. >+ (numberOfReplacedElementsBeforeOffset): Deleted. >+ (webkitAccessibleTextWordForBoundary): Deleted. >+ (isSentenceBoundary): Deleted. >+ (isWhiteSpaceBetweenSentences): Deleted. >+ (sentenceAtPositionForAtkBoundary): Deleted. >+ (webkitAccessibleTextSentenceForBoundary): Deleted. >+ (lineAtPositionForAtkBoundary): Deleted. >+ (webkitAccessibleTextLineForBoundary): Deleted. >+ (webkitAccessibleTextGetTextForOffset): Deleted. >+ (webkitAccessibleTextGetTextAfterOffset): Deleted. >+ (webkitAccessibleTextGetTextAtOffset): Deleted. >+ (webkitAccessibleTextGetTextBeforeOffset): Deleted. >+ (webkitAccessibleTextGetCharacterAtOffset): Deleted. >+ (webkitAccessibleTextGetCaretOffset): Deleted. >+ (webkitAccessibleTextGetRunAttributes): Deleted. >+ (webkitAccessibleTextGetDefaultAttributes): Deleted. >+ (webkitAccessibleTextGetCharacterExtents): Deleted. >+ (webkitAccessibleTextGetRangeExtents): Deleted. >+ (webkitAccessibleTextGetCharacterCount): Deleted. >+ (webkitAccessibleTextGetOffsetAtPoint): Deleted. >+ (webkitAccessibleTextGetNSelections): Deleted. >+ (webkitAccessibleTextGetSelection): Deleted. >+ (webkitAccessibleTextAddSelection): Deleted. >+ (webkitAccessibleTextSetSelection): Deleted. >+ (webkitAccessibleTextRemoveSelection): Deleted. >+ (webkitAccessibleTextSetCaretOffset): Deleted. >+ (webkitAccessibleTextGetStringAtOffset): Deleted. >+ (webkitAccessibleTextInterfaceInit): Deleted. >+ * accessibility/atk/WebKitAccessibleInterfaceText.h: Removed. >+ * accessibility/atk/WebKitAccessibleInterfaceValue.cpp: Removed. >+ (core): Deleted. >+ (webkitAccessibleSetNewValue): Deleted. >+ (webkitAccessibleGetIncrementValue): Deleted. >+ (webkitAccessibleGetValueAndText): Deleted. >+ (webkitAccessibleGetIncrement): Deleted. >+ (webkitAccessibleSetValue): Deleted. >+ (webkitAccessibleGetRange): Deleted. >+ (webkitAccessibleValueGetCurrentValue): Deleted. >+ (webkitAccessibleValueGetMaximumValue): Deleted. >+ (webkitAccessibleValueGetMinimumValue): Deleted. >+ (webkitAccessibleValueSetCurrentValue): Deleted. >+ (webkitAccessibleValueGetMinimumIncrement): Deleted. >+ (webkitAccessibleValueInterfaceInit): Deleted. >+ * accessibility/atk/WebKitAccessibleInterfaceValue.h: Removed. >+ * accessibility/atk/WebKitAccessibleUtil.cpp: Removed. >+ (addToAtkAttributeSet): Deleted. >+ (contentsRelativeToAtkCoordinateType): Deleted. >+ (titleTagShouldBeUsedInDescriptionField): Deleted. >+ (accessibilityTitle): Deleted. >+ (accessibilityDescription): Deleted. >+ (selectionBelongsToObject): Deleted. >+ (objectFocusedAndCaretOffsetUnignored): Deleted. >+ * accessibility/atk/WebKitAccessibleUtil.h: Removed. >+ * accessibility/atspi/AccessibilityObjectAtspi.cpp: >+ (WebCore::AccessibilityObjectAtspi::attributes const): >+ * editing/FrameSelection.h: >+ * editing/atk/FrameSelectionAtk.cpp: Removed. >+ (WebCore::emitTextSelectionChange): Deleted. >+ (WebCore::maybeEmitTextFocusChange): Deleted. >+ (WebCore::FrameSelection::notifyAccessibilityForSelectionChange): Deleted. >+ * page/Settings.yaml: >+ * platform/graphics/PlatformDisplay.cpp: >+ * platform/graphics/PlatformDisplay.h: >+ * platform/graphics/x11/PlatformDisplayX11.cpp: >+ * platform/graphics/x11/PlatformDisplayX11.h: >+ > 2022-03-22 Frédéric Wang <fwang@igalia.com> > > Adjust anchor/focus nodes after removal when LiveRangeSelection is enabled >diff --git a/Source/WebCore/PlatformGTK.cmake b/Source/WebCore/PlatformGTK.cmake >index 9f0e5989157f..ffe9343f8255 100644 >--- a/Source/WebCore/PlatformGTK.cmake >+++ b/Source/WebCore/PlatformGTK.cmake >@@ -15,9 +15,7 @@ list(APPEND WebCore_UNIFIED_SOURCE_LIST_FILES > ) > > list(APPEND WebCore_PRIVATE_INCLUDE_DIRECTORIES >- "${WEBCORE_DIR}/accessibility/atk" > "${WEBCORE_DIR}/accessibility/atspi" >- "${WEBCORE_DIR}/editing/atk" > "${WEBCORE_DIR}/page/gtk" > "${WEBCORE_DIR}/platform/adwaita" > "${WEBCORE_DIR}/platform/audio/glib" >@@ -88,7 +86,6 @@ set(WebCore_USER_AGENT_SCRIPTS > set(WebCore_USER_AGENT_SCRIPTS_DEPENDENCIES ${WEBCORE_DIR}/rendering/RenderThemeAdwaita.cpp) > > list(APPEND WebCore_LIBRARIES >- ${ATK_LIBRARIES} > ${ENCHANT_LIBRARIES} > ${GLIB_GIO_LIBRARIES} > ${GLIB_GMODULE_LIBRARIES} >@@ -113,7 +110,6 @@ if (USE_WPE_RENDERER) > endif () > > list(APPEND WebCore_SYSTEM_INCLUDE_DIRECTORIES >- ${ATK_INCLUDE_DIRS} > ${ENCHANT_INCLUDE_DIRS} > ${GIO_UNIX_INCLUDE_DIRS} > ${GLIB_INCLUDE_DIRS} >diff --git a/Source/WebCore/PlatformWPE.cmake b/Source/WebCore/PlatformWPE.cmake >index 8a6e23d55ff2..9d021a1a887f 100644 >--- a/Source/WebCore/PlatformWPE.cmake >+++ b/Source/WebCore/PlatformWPE.cmake >@@ -17,7 +17,6 @@ list(APPEND WebCore_UNIFIED_SOURCE_LIST_FILES > ) > > list(APPEND WebCore_PRIVATE_INCLUDE_DIRECTORIES >- "${WEBCORE_DIR}/accessibility/atk" > "${WEBCORE_DIR}/accessibility/atspi" > "${WEBCORE_DIR}/platform/adwaita" > "${WEBCORE_DIR}/platform/audio/glib" >@@ -66,7 +65,6 @@ set(WebCore_USER_AGENT_SCRIPTS_DEPENDENCIES ${WEBCORE_DIR}/platform/wpe/RenderTh > > list(APPEND WebCore_LIBRARIES > WPE::libwpe >- ${ATK_LIBRARIES} > ${GLIB_GIO_LIBRARIES} > ${GLIB_GMODULE_LIBRARIES} > ${GLIB_GOBJECT_LIBRARIES} >@@ -76,7 +74,6 @@ list(APPEND WebCore_LIBRARIES > ) > > list(APPEND WebCore_SYSTEM_INCLUDE_DIRECTORIES >- ${ATK_INCLUDE_DIRS} > ${GIO_UNIX_INCLUDE_DIRS} > ${GLIB_INCLUDE_DIRS} > ${LIBTASN1_INCLUDE_DIRS} >diff --git a/Source/WebCore/SourcesGTK.txt b/Source/WebCore/SourcesGTK.txt >index b5e58ccd7619..c6386a65d471 100644 >--- a/Source/WebCore/SourcesGTK.txt >+++ b/Source/WebCore/SourcesGTK.txt >@@ -21,24 +21,6 @@ > // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF > // THE POSSIBILITY OF SUCH DAMAGE. > >-accessibility/atk/AXObjectCacheAtk.cpp >-accessibility/atk/AccessibilityObjectAtk.cpp >-accessibility/atk/WebKitAccessible.cpp >-accessibility/atk/WebKitAccessibleHyperlink.cpp >-accessibility/atk/WebKitAccessibleInterfaceAction.cpp @no-unify >-accessibility/atk/WebKitAccessibleInterfaceComponent.cpp >-accessibility/atk/WebKitAccessibleInterfaceDocument.cpp >-accessibility/atk/WebKitAccessibleInterfaceEditableText.cpp >-accessibility/atk/WebKitAccessibleInterfaceHyperlinkImpl.cpp >-accessibility/atk/WebKitAccessibleInterfaceHypertext.cpp >-accessibility/atk/WebKitAccessibleInterfaceImage.cpp >-accessibility/atk/WebKitAccessibleInterfaceSelection.cpp >-accessibility/atk/WebKitAccessibleInterfaceTable.cpp >-accessibility/atk/WebKitAccessibleInterfaceTableCell.cpp >-accessibility/atk/WebKitAccessibleInterfaceText.cpp >-accessibility/atk/WebKitAccessibleInterfaceValue.cpp >-accessibility/atk/WebKitAccessibleUtil.cpp >- > accessibility/atspi/AccessibilityAtspi.cpp > accessibility/atspi/AccessibilityObjectAtspi.cpp > accessibility/atspi/AccessibilityObjectActionAtspi.cpp >@@ -55,8 +37,6 @@ accessibility/atspi/AccessibilityObjectValueAtspi.cpp > accessibility/atspi/AccessibilityRootAtspi.cpp > accessibility/atspi/AXObjectCacheAtspi.cpp > >-editing/atk/FrameSelectionAtk.cpp >- > editing/atspi/FrameSelectionAtspi.cpp > > editing/gtk/EditorGtk.cpp >diff --git a/Source/WebCore/SourcesWPE.txt b/Source/WebCore/SourcesWPE.txt >index f8c8c70492fb..16d35344a308 100644 >--- a/Source/WebCore/SourcesWPE.txt >+++ b/Source/WebCore/SourcesWPE.txt >@@ -21,24 +21,6 @@ > // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF > // THE POSSIBILITY OF SUCH DAMAGE. > >-accessibility/atk/AXObjectCacheAtk.cpp >-accessibility/atk/AccessibilityObjectAtk.cpp >-accessibility/atk/WebKitAccessible.cpp >-accessibility/atk/WebKitAccessibleHyperlink.cpp >-accessibility/atk/WebKitAccessibleInterfaceAction.cpp @no-unify >-accessibility/atk/WebKitAccessibleInterfaceComponent.cpp >-accessibility/atk/WebKitAccessibleInterfaceDocument.cpp >-accessibility/atk/WebKitAccessibleInterfaceEditableText.cpp >-accessibility/atk/WebKitAccessibleInterfaceHyperlinkImpl.cpp >-accessibility/atk/WebKitAccessibleInterfaceHypertext.cpp >-accessibility/atk/WebKitAccessibleInterfaceImage.cpp >-accessibility/atk/WebKitAccessibleInterfaceSelection.cpp >-accessibility/atk/WebKitAccessibleInterfaceTable.cpp >-accessibility/atk/WebKitAccessibleInterfaceTableCell.cpp >-accessibility/atk/WebKitAccessibleInterfaceText.cpp >-accessibility/atk/WebKitAccessibleInterfaceValue.cpp >-accessibility/atk/WebKitAccessibleUtil.cpp >- > accessibility/atspi/AccessibilityAtspi.cpp > accessibility/atspi/AccessibilityObjectAtspi.cpp > accessibility/atspi/AccessibilityObjectActionAtspi.cpp >@@ -55,7 +37,6 @@ accessibility/atspi/AccessibilityObjectValueAtspi.cpp > accessibility/atspi/AccessibilityRootAtspi.cpp > accessibility/atspi/AXObjectCacheAtspi.cpp > >-editing/atk/FrameSelectionAtk.cpp > editing/atspi/FrameSelectionAtspi.cpp > editing/libwpe/EditorLibWPE.cpp > >diff --git a/Source/WebCore/accessibility/AXObjectCache.h b/Source/WebCore/accessibility/AXObjectCache.h >index 26e4ceeb1046..abe784261b8b 100644 >--- a/Source/WebCore/accessibility/AXObjectCache.h >+++ b/Source/WebCore/accessibility/AXObjectCache.h >@@ -37,10 +37,6 @@ > #include <wtf/ListHashSet.h> > #include <wtf/WeakHashSet.h> > >-#if USE(ATK) >-#include <wtf/glib/GRefPtr.h> >-#endif >- > namespace WTF { > class TextStream; > } >@@ -530,10 +526,6 @@ private: > bool m_performingDeferredCacheUpdate { false }; > double m_loadingProgress { 0 }; > >-#if USE(ATK) >- ListHashSet<RefPtr<AccessibilityObject>> m_deferredAttachedWrapperObjectList; >- ListHashSet<GRefPtr<AccessibilityObjectWrapper>> m_deferredDetachedWrapperList; >-#endif > #if USE(ATSPI) > ListHashSet<RefPtr<AXCoreObject>> m_deferredParentChangedList; > #endif >diff --git a/Source/WebCore/accessibility/AccessibilityList.cpp b/Source/WebCore/accessibility/AccessibilityList.cpp >index ad8fcd803525..ba75c5e88bce 100644 >--- a/Source/WebCore/accessibility/AccessibilityList.cpp >+++ b/Source/WebCore/accessibility/AccessibilityList.cpp >@@ -117,7 +117,7 @@ bool AccessibilityList::childHasPseudoVisibleListItemMarkers(RenderObject* listI > > // Platforms which expose rendered text content through the parent element will treat > // those renderers as "ignored" objects. >-#if USE(ATK) || USE(ATSPI) >+#if USE(ATSPI) > String text = axObj->textUnderElement(); > return !text.isEmpty() && !text.isAllSpecialCharacters<isHTMLSpace>(); > #else >diff --git a/Source/WebCore/accessibility/AccessibilityNodeObject.cpp b/Source/WebCore/accessibility/AccessibilityNodeObject.cpp >index 5cf83451f3e2..14291372cfc4 100644 >--- a/Source/WebCore/accessibility/AccessibilityNodeObject.cpp >+++ b/Source/WebCore/accessibility/AccessibilityNodeObject.cpp >@@ -2405,8 +2405,8 @@ bool AccessibilityNodeObject::canSetValueAttribute() const > if (isProgressIndicator() || isSlider() || isScrollbar()) > return true; > >-#if USE(ATK) || USE(ATSPI) >- // In ATK, input types which support aria-readonly are treated as having a >+#if USE(ATSPI) >+ // In ATSPI, input types which support aria-readonly are treated as having a > // settable value if the user can modify the widget's value or its state. > if (supportsReadOnly()) > return true; >diff --git a/Source/WebCore/accessibility/AccessibilityObject.cpp b/Source/WebCore/accessibility/AccessibilityObject.cpp >index 5ad22c170f54..895e3db2ded5 100644 >--- a/Source/WebCore/accessibility/AccessibilityObject.cpp >+++ b/Source/WebCore/accessibility/AccessibilityObject.cpp >@@ -3618,8 +3618,8 @@ TextIteratorBehaviors AccessibilityObject::textIteratorBehaviorForTextRange() co > { > TextIteratorBehaviors behaviors { TextIteratorBehavior::IgnoresStyleVisibility }; > >-#if USE(ATK) || USE(ATSPI) >- // We need to emit replaced elements for GTK, and present >+#if USE(ATSPI) >+ // We need to emit replaced elements for ATSPI, and present > // them with the 'object replacement character' (0xFFFC). > behaviors.add(TextIteratorBehavior::EmitsObjectReplacementCharacters); > #endif >diff --git a/Source/WebCore/accessibility/AccessibilityObject.h b/Source/WebCore/accessibility/AccessibilityObject.h >index 4b2731356259..64b580b87e79 100644 >--- a/Source/WebCore/accessibility/AccessibilityObject.h >+++ b/Source/WebCore/accessibility/AccessibilityObject.h >@@ -42,10 +42,6 @@ > #include <wtf/RetainPtr.h> > #endif > >-#if USE(ATK) >-#include <wtf/glib/GRefPtr.h> >-#endif >- > #if PLATFORM(COCOA) > > OBJC_CLASS NSArray; >@@ -886,7 +882,7 @@ inline void AccessibilityObject::updateBackingStore() { } > inline void AccessibilityObject::detachPlatformWrapper(AccessibilityDetachmentType) { } > #endif > >-#if !(ENABLE(ACCESSIBILITY) && (USE(ATK) || USE(ATSPI))) >+#if !(ENABLE(ACCESSIBILITY) && USE(ATSPI)) > inline bool AccessibilityObject::allowsTextRanges() const { return true; } > inline unsigned AccessibilityObject::getLengthForTextRange() const { return text().length(); } > #endif >diff --git a/Source/WebCore/accessibility/AccessibilityObjectInterface.h b/Source/WebCore/accessibility/AccessibilityObjectInterface.h >index 0d0e60732d7f..fe3afcba7c61 100644 >--- a/Source/WebCore/accessibility/AccessibilityObjectInterface.h >+++ b/Source/WebCore/accessibility/AccessibilityObjectInterface.h >@@ -48,10 +48,6 @@ > #include "AccessibilityObjectAtspi.h" > #endif > >-#if USE(ATK) >-#include <wtf/glib/GRefPtr.h> >-#endif >- > #if PLATFORM(COCOA) > OBJC_CLASS WebAccessibilityObjectWrapper; > typedef WebAccessibilityObjectWrapper AccessibilityObjectWrapper; >@@ -60,9 +56,6 @@ typedef const struct __AXTextMarker* AXTextMarkerRef; > typedef const struct __AXTextMarkerRange* AXTextMarkerRangeRef; > #elif USE(ATSPI) > typedef WebCore::AccessibilityObjectAtspi AccessibilityObjectWrapper; >-#elif USE(ATK) >-typedef struct _WebKitAccessible WebKitAccessible; >-typedef struct _WebKitAccessible AccessibilityObjectWrapper; > #else > class AccessibilityObjectWrapper; > #endif >@@ -1542,8 +1535,6 @@ private: > COMPtr<AccessibilityObjectWrapper> m_wrapper; > #elif USE(ATSPI) > RefPtr<AccessibilityObjectAtspi> m_wrapper; >-#elif USE(ATK) >- GRefPtr<WebKitAccessible> m_wrapper; > #endif > virtual void detachPlatformWrapper(AccessibilityDetachmentType) = 0; > }; >diff --git a/Source/WebCore/accessibility/AccessibilityRenderObject.cpp b/Source/WebCore/accessibility/AccessibilityRenderObject.cpp >index 1126ebd41808..fa02d31fe18b 100644 >--- a/Source/WebCore/accessibility/AccessibilityRenderObject.cpp >+++ b/Source/WebCore/accessibility/AccessibilityRenderObject.cpp >@@ -2160,8 +2160,6 @@ int AccessibilityRenderObject::indexForVisiblePosition(const VisiblePosition& po > TextIteratorBehaviors behaviors; > #if USE(ATSPI) > behaviors.add(TextIteratorBehavior::EmitsObjectReplacementCharacters); >-#elif USE(ATK) >- behaviors.add(TextIteratorBehavior::EmitsCharactersBetweenAllVisiblePositions); > #endif > > return WebCore::indexForVisiblePosition(*node, position, behaviors); >@@ -2671,11 +2669,6 @@ AXCoreObject* AccessibilityRenderObject::accessibilityHitTest(const IntPoint& po > > bool AccessibilityRenderObject::shouldNotifyActiveDescendant() const > { >-#if USE(ATK) >- // According to the Core AAM spec, ATK expects object:state-changed:focused notifications >- // whenever the active descendant changes. >- return true; >-#endif > // We want to notify that the combo box has changed its active descendant, > // but we do not want to change the focus, because focus should remain with the combo box. > if (isComboBox()) >diff --git a/Source/WebCore/accessibility/AccessibilityTableColumn.cpp b/Source/WebCore/accessibility/AccessibilityTableColumn.cpp >index 4c9371233a83..98c77385fa56 100644 >--- a/Source/WebCore/accessibility/AccessibilityTableColumn.cpp >+++ b/Source/WebCore/accessibility/AccessibilityTableColumn.cpp >@@ -172,7 +172,7 @@ bool AccessibilityTableColumn::computeAccessibilityIsIgnored() const > if (!m_parent) > return true; > >-#if PLATFORM(IOS_FAMILY) || USE(ATK) || USE(ATSPI) >+#if PLATFORM(IOS_FAMILY) || USE(ATSPI) > return true; > #endif > >diff --git a/Source/WebCore/accessibility/AccessibilityTableHeaderContainer.cpp b/Source/WebCore/accessibility/AccessibilityTableHeaderContainer.cpp >index 074228e201e0..c1ea8fc9703b 100644 >--- a/Source/WebCore/accessibility/AccessibilityTableHeaderContainer.cpp >+++ b/Source/WebCore/accessibility/AccessibilityTableHeaderContainer.cpp >@@ -54,7 +54,7 @@ bool AccessibilityTableHeaderContainer::computeAccessibilityIsIgnored() const > if (!m_parent) > return true; > >-#if PLATFORM(IOS_FAMILY) || USE(ATK) || USE(ATSPI) >+#if PLATFORM(IOS_FAMILY) || USE(ATSPI) > return true; > #endif > >diff --git a/Source/WebCore/accessibility/atk/AXObjectCacheAtk.cpp b/Source/WebCore/accessibility/atk/AXObjectCacheAtk.cpp >deleted file mode 100644 >index 2b1c340211d1..000000000000 >--- a/Source/WebCore/accessibility/atk/AXObjectCacheAtk.cpp >+++ /dev/null >@@ -1,413 +0,0 @@ >-/* >- * Copyright (C) 2008 Nuanti Ltd. >- * >- * This library is free software; you can redistribute it and/or >- * modify it under the terms of the GNU Library General Public >- * License as published by the Free Software Foundation; either >- * version 2 of the License, or (at your option) any later version. >- * >- * This library is distributed in the hope that it will be useful, >- * but WITHOUT ANY WARRANTY; without even the implied warranty of >- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- * Library General Public License for more details. >- * >- * You should have received a copy of the GNU Library General Public License >- * along with this library; see the file COPYING.LIB. If not, write to >- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >- * Boston, MA 02110-1301, USA. >- */ >- >-#include "config.h" >-#include "AXObjectCache.h" >- >-#if ENABLE(ACCESSIBILITY) && USE(ATK) >- >-#include "AccessibilityObject.h" >-#include "AccessibilityRenderObject.h" >-#include "Document.h" >-#include "Element.h" >-#include "HTMLSelectElement.h" >-#include "Range.h" >-#include "TextIterator.h" >-#include "WebKitAccessible.h" >-#include <wtf/NeverDestroyed.h> >-#include <wtf/glib/GRefPtr.h> >-#include <wtf/text/CString.h> >- >-namespace WebCore { >- >-static AtkObject* wrapperParent(WebKitAccessible* wrapper) >-{ >- // Look for the right object to emit the signal from, but using the implementation >- // of atk_object_get_parent from AtkObject class (which uses a cached pointer if set) >- // since the accessibility hierarchy in WebCore will no longer be navigable. >- gpointer webkitAccessibleClass = g_type_class_peek_parent(WEBKIT_ACCESSIBLE_GET_CLASS(wrapper)); >- gpointer atkObjectClass = g_type_class_peek_parent(webkitAccessibleClass); >- AtkObject* atkParent = ATK_OBJECT_CLASS(atkObjectClass)->get_parent(ATK_OBJECT(wrapper)); >- // We don't want to emit any signal from an object outside WebKit's world. >- return WEBKIT_IS_ACCESSIBLE(atkParent) ? atkParent : nullptr; >-} >- >-void AXObjectCache::detachWrapper(AXCoreObject* obj, AccessibilityDetachmentType detachmentType) >-{ >- auto* wrapper = obj->wrapper(); >- ASSERT(wrapper); >- >- // If an object is being detached NOT because of the AXObjectCache being destroyed, >- // then it's being removed from the accessibility tree and we should emit a signal. >- if (detachmentType != AccessibilityDetachmentType::CacheDestroyed && obj->document() && wrapperParent(wrapper)) >- m_deferredDetachedWrapperList.add(wrapper); >- >- webkitAccessibleDetach(WEBKIT_ACCESSIBLE(wrapper)); >-} >- >-void AXObjectCache::attachWrapper(AXCoreObject* obj) >-{ >- // FIXME: at the moment, only allow to attach AccessibilityObjects. >- if (!is<AccessibilityObject>(obj)) >- return; >- AccessibilityObject* accessibilityObject = downcast<AccessibilityObject>(obj); >- >- GRefPtr<WebKitAccessible> wrapper = adoptGRef(webkitAccessibleNew(accessibilityObject)); >- accessibilityObject->setWrapper(wrapper.get()); >- >- // If an object is being attached and we are not in the middle of a layout update, then >- // we should report ATs by emitting the children-changed::add signal from the parent. >- Document* document = accessibilityObject->document(); >- if (!document || document->childNeedsStyleRecalc()) >- return; >- >- // Don't emit the signal when the actual object being added is not going to be exposed. >- if (accessibilityObject->accessibilityIsIgnoredByDefault()) >- return; >- >- // Don't emit the signal if the object being added is not -- or not yet -- rendered, >- // which can occur in nested iframes. In these instances we don't want to ignore the >- // child. But if an assistive technology is listening, AT-SPI2 will attempt to create >- // and cache the state set for the child upon emission of the signal. If the object >- // has not yet been rendered, this will result in a crash. >- if (!accessibilityObject->renderer()) >- return; >- >- m_deferredAttachedWrapperObjectList.add(accessibilityObject); >-} >- >-void AXObjectCache::platformPerformDeferredCacheUpdate() >-{ >- for (auto& coreObject : m_deferredAttachedWrapperObjectList) { >- auto* wrapper = coreObject->wrapper(); >- if (!wrapper) >- continue; >- >- // Don't emit the signal for objects whose parents won't be exposed directly. >- auto* coreParent = coreObject->parentObjectUnignored(); >- if (!coreParent || coreParent->accessibilityIsIgnoredByDefault()) >- continue; >- >- // Look for the right object to emit the signal from. >- auto* atkParent = coreParent->wrapper(); >- if (!atkParent) >- continue; >- >- size_t index = coreParent->children(false).find(coreObject); >- g_signal_emit_by_name(atkParent, "children-changed::add", index != notFound ? index : -1, wrapper); >- } >- m_deferredAttachedWrapperObjectList.clear(); >- >- for (auto& wrapper : m_deferredDetachedWrapperList) { >- if (auto* atkParent = wrapperParent(wrapper.get())) { >- // The accessibility hierarchy is already invalid, so the parent-children relationships >- // in the AccessibilityObject tree are not there anymore, so we can't know the offset. >- g_signal_emit_by_name(atkParent, "children-changed::remove", -1, wrapper.get()); >- } >- } >- m_deferredDetachedWrapperList.clear(); >-} >- >-static AXCoreObject* getListObject(AXCoreObject* object) >-{ >- // Only list boxes and menu lists supported so far. >- if (!object->isListBox() && !object->isMenuList()) >- return 0; >- >- // For list boxes the list object is just itself. >- if (object->isListBox()) >- return object; >- >- // For menu lists we need to return the first accessible child, >- // with role MenuListPopupRole, since that's the one holding the list >- // of items with role MenuListOptionRole. >- const AccessibilityObject::AccessibilityChildrenVector& children = object->children(); >- if (!children.size()) >- return 0; >- >- AXCoreObject* listObject = children.at(0).get(); >- if (!listObject->isMenuListPopup()) >- return 0; >- >- return listObject; >-} >- >-static void notifyChildrenSelectionChange(AXCoreObject* object) >-{ >- // This static variables are needed to keep track of the old >- // focused object and its associated list object, as per previous >- // calls to this function, in order to properly decide whether to >- // emit some signals or not. >- static NeverDestroyed<RefPtr<AXCoreObject>> oldListObject; >- static NeverDestroyed<RefPtr<AXCoreObject>> oldFocusedObject; >- >- // Only list boxes and menu lists supported so far. >- if (!object || !(object->isListBox() || object->isMenuList())) >- return; >- >- // Only support HTML select elements so far (ARIA selectors not supported). >- Node* node = object->node(); >- if (!is<HTMLSelectElement>(node)) >- return; >- >- // Emit signal from the listbox's point of view first. >- g_signal_emit_by_name(object->wrapper(), "selection-changed"); >- >- // Find the item where the selection change was triggered from. >- HTMLSelectElement& select = downcast<HTMLSelectElement>(*node); >- int changedItemIndex = select.activeSelectionStartListIndex(); >- >- AXCoreObject* listObject = getListObject(object); >- if (!listObject) { >- oldListObject.get() = nullptr; >- return; >- } >- >- const AccessibilityObject::AccessibilityChildrenVector& items = listObject->children(); >- if (changedItemIndex < 0 || changedItemIndex >= static_cast<int>(items.size())) >- return; >- AXCoreObject* item = items.at(changedItemIndex).get(); >- >- // Ensure the current list object is the same than the old one so >- // further comparisons make sense. Otherwise, just reset >- // oldFocusedObject so it won't be taken into account. >- if (oldListObject.get() != listObject) >- oldFocusedObject.get() = nullptr; >- >- WebKitAccessible* axItem = item ? item->wrapper() : nullptr; >- WebKitAccessible* axOldFocusedObject = oldFocusedObject.get() ? oldFocusedObject.get()->wrapper() : nullptr; >- >- // Old focused object just lost focus, so emit the events. >- if (axOldFocusedObject && axItem != axOldFocusedObject) { >- g_signal_emit_by_name(axOldFocusedObject, "focus-event", false); >- atk_object_notify_state_change(ATK_OBJECT(axOldFocusedObject), ATK_STATE_FOCUSED, false); >- } >- >- // Emit needed events for the currently (un)selected item. >- if (axItem) { >- bool isSelected = item->isSelected(); >- atk_object_notify_state_change(ATK_OBJECT(axItem), ATK_STATE_SELECTED, isSelected); >- // When the selection changes in a collapsed widget such as a combo box >- // whose child menu is not showing, that collapsed widget retains focus. >- if (!object->isCollapsed()) { >- g_signal_emit_by_name(axItem, "focus-event", isSelected); >- atk_object_notify_state_change(ATK_OBJECT(axItem), ATK_STATE_FOCUSED, isSelected); >- } >- } >- >- // Update pointers to the previously involved objects. >- oldListObject.get() = listObject; >- oldFocusedObject.get() = item; >-} >- >-void AXObjectCache::postPlatformNotification(AXCoreObject* coreObject, AXNotification notification) >-{ >- auto* axObject = ATK_OBJECT(coreObject->wrapper()); >- if (!axObject) >- return; >- >- switch (notification) { >- case AXCheckedStateChanged: >- if (!coreObject->isCheckboxOrRadio() && !coreObject->isSwitch()) >- return; >- atk_object_notify_state_change(axObject, ATK_STATE_CHECKED, coreObject->isChecked()); >- break; >- >- case AXSelectedChildrenChanged: >- case AXMenuListValueChanged: >- // Accessible focus claims should not be made if the associated widget is not focused. >- if (notification == AXMenuListValueChanged && coreObject->isMenuList() && coreObject->isFocused()) { >- g_signal_emit_by_name(axObject, "focus-event", true); >- atk_object_notify_state_change(axObject, ATK_STATE_FOCUSED, true); >- } >- notifyChildrenSelectionChange(coreObject); >- break; >- >- case AXValueChanged: >- if (ATK_IS_VALUE(axObject)) { >- AtkPropertyValues propertyValues; >- propertyValues.property_name = "accessible-value"; >- >- memset(&propertyValues.new_value, 0, sizeof(GValue)); >- >- double value; >- atk_value_get_value_and_text(ATK_VALUE(axObject), &value, nullptr); >- g_value_set_double(g_value_init(&propertyValues.new_value, G_TYPE_DOUBLE), value); >- >- g_signal_emit_by_name(axObject, "property-change::accessible-value", &propertyValues, NULL); >- } >- break; >- >- case AXInvalidStatusChanged: >- atk_object_notify_state_change(axObject, ATK_STATE_INVALID_ENTRY, coreObject->invalidStatus() != "false"); >- break; >- >- case AXElementBusyChanged: >- atk_object_notify_state_change(axObject, ATK_STATE_BUSY, coreObject->isBusy()); >- break; >- >- case AXCurrentStateChanged: >- atk_object_notify_state_change(axObject, ATK_STATE_ACTIVE, coreObject->currentState() != AccessibilityCurrentState::False); >- break; >- >- case AXRowExpanded: >- atk_object_notify_state_change(axObject, ATK_STATE_EXPANDED, true); >- break; >- >- case AXRowCollapsed: >- atk_object_notify_state_change(axObject, ATK_STATE_EXPANDED, false); >- break; >- >- case AXExpandedChanged: >- atk_object_notify_state_change(axObject, ATK_STATE_EXPANDED, coreObject->isExpanded()); >- break; >- >- case AXDisabledStateChanged: { >- bool enabledState = coreObject->isEnabled(); >- atk_object_notify_state_change(axObject, ATK_STATE_ENABLED, enabledState); >- atk_object_notify_state_change(axObject, ATK_STATE_SENSITIVE, enabledState); >- break; >- } >- >- case AXPressedStateChanged: >- atk_object_notify_state_change(axObject, ATK_STATE_PRESSED, coreObject->isPressed()); >- break; >- >- case AXReadOnlyStatusChanged: >- atk_object_notify_state_change(axObject, ATK_STATE_READ_ONLY, !coreObject->canSetValueAttribute()); >- break; >- >- case AXRequiredStatusChanged: >- atk_object_notify_state_change(axObject, ATK_STATE_REQUIRED, coreObject->isRequired()); >- break; >- >- case AXActiveDescendantChanged: >- if (AXCoreObject* descendant = coreObject->activeDescendant()) >- platformHandleFocusedUIElementChanged(nullptr, descendant->node()); >- break; >- >- default: >- break; >- } >-} >- >-void AXObjectCache::nodeTextChangePlatformNotification(AccessibilityObject* object, AXTextChange textChange, unsigned offset, const String& text) >-{ >- if (!object || text.isEmpty()) >- return; >- >- AXCoreObject* parentObject = object->isNonNativeTextControl() ? object : object->parentObjectUnignored(); >- if (!parentObject) >- return; >- >- auto* wrapper = parentObject->wrapper(); >- if (!wrapper || !ATK_IS_TEXT(wrapper)) >- return; >- >- Node* node = object->node(); >- if (!node) >- return; >- >- // Ensure document's layout is up-to-date before using TextIterator. >- Document& document = node->document(); >- document.updateLayout(); >- >- // Select the right signal to be emitted >- CString detail; >- switch (textChange) { >- case AXTextInserted: >- detail = "text-insert"; >- break; >- case AXTextDeleted: >- detail = "text-remove"; >- break; >- case AXTextAttributesChanged: >- detail = "text-attributes-changed"; >- break; >- } >- >- String textToEmit = text; >- unsigned offsetToEmit = offset; >- >- // If the object we're emitting the signal from represents a >- // password field, we will emit the masked text. >- if (parentObject->isPasswordField()) { >- String maskedText = parentObject->passwordFieldValue(); >- textToEmit = maskedText.substring(offset, text.length()); >- } else { >- // Consider previous text objects that might be present for >- // the current accessibility object to ensure we emit the >- // right offset (e.g. multiline text areas). >- offsetToEmit = offset + characterCount(SimpleRange { { *node->parentNode(), 0 }, { *node, 0 } }); >- } >- >- g_signal_emit_by_name(wrapper, detail.data(), offsetToEmit, textToEmit.length(), textToEmit.utf8().data()); >-} >- >-void AXObjectCache::frameLoadingEventPlatformNotification(AccessibilityObject* object, AXLoadingEvent loadingEvent) >-{ >- if (!object) >- return; >- >- auto* axObject = ATK_OBJECT(object->wrapper()); >- if (!axObject || !ATK_IS_DOCUMENT(axObject)) >- return; >- >- switch (loadingEvent) { >- case AXObjectCache::AXLoadingStarted: >- atk_object_notify_state_change(axObject, ATK_STATE_BUSY, true); >- break; >- case AXObjectCache::AXLoadingReloaded: >- atk_object_notify_state_change(axObject, ATK_STATE_BUSY, true); >- g_signal_emit_by_name(axObject, "reload"); >- break; >- case AXObjectCache::AXLoadingFailed: >- g_signal_emit_by_name(axObject, "load-stopped"); >- atk_object_notify_state_change(axObject, ATK_STATE_BUSY, false); >- break; >- case AXObjectCache::AXLoadingFinished: >- g_signal_emit_by_name(axObject, "load-complete"); >- atk_object_notify_state_change(axObject, ATK_STATE_BUSY, false); >- break; >- } >-} >- >-void AXObjectCache::platformHandleFocusedUIElementChanged(Node* oldFocusedNode, Node* newFocusedNode) >-{ >- RefPtr<AccessibilityObject> oldObject = getOrCreate(oldFocusedNode); >- if (oldObject) { >- auto* axObject = oldObject->wrapper(); >- g_signal_emit_by_name(axObject, "focus-event", false); >- atk_object_notify_state_change(ATK_OBJECT(axObject), ATK_STATE_FOCUSED, false); >- } >- RefPtr<AccessibilityObject> newObject = getOrCreate(newFocusedNode); >- if (newObject) { >- auto* axObject = newObject->wrapper(); >- g_signal_emit_by_name(axObject, "focus-event", true); >- atk_object_notify_state_change(ATK_OBJECT(axObject), ATK_STATE_FOCUSED, true); >- } >-} >- >-void AXObjectCache::handleScrolledToAnchor(const Node*) >-{ >-} >- >-} // namespace WebCore >- >-#endif >diff --git a/Source/WebCore/accessibility/atk/AccessibilityObjectAtk.cpp b/Source/WebCore/accessibility/atk/AccessibilityObjectAtk.cpp >deleted file mode 100644 >index 434bf50cc686..000000000000 >--- a/Source/WebCore/accessibility/atk/AccessibilityObjectAtk.cpp >+++ /dev/null >@@ -1,209 +0,0 @@ >-/* >- * Copyright (C) 2008 Apple Ltd. >- * Copyright (C) 2008 Alp Toker <alp@atoker.com> >- * >- * This library is free software; you can redistribute it and/or >- * modify it under the terms of the GNU Library General Public >- * License as published by the Free Software Foundation; either >- * version 2 of the License, or (at your option) any later version. >- * >- * This library is distributed in the hope that it will be useful, >- * but WITHOUT ANY WARRANTY; without even the implied warranty of >- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- * Library General Public License for more details. >- * >- * You should have received a copy of the GNU Library General Public License >- * along with this library; see the file COPYING.LIB. If not, write to >- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >- * Boston, MA 02110-1301, USA. >- */ >- >-#include "config.h" >-#include "AccessibilityObject.h" >- >-#if ENABLE(ACCESSIBILITY) && USE(ATK) >- >-#include "AXObjectCache.h" >-#include "HTMLSpanElement.h" >-#include "RenderBlock.h" >-#include "RenderInline.h" >-#include "RenderIterator.h" >-#include "RenderTableCell.h" >-#include "RenderText.h" >-#include "TextControlInnerElements.h" >-#include "WebKitAccessible.h" >-#include <glib-object.h> >- >-namespace WebCore { >- >-void AccessibilityObject::detachPlatformWrapper(AccessibilityDetachmentType detachmentType) >-{ >- if (detachmentType != AccessibilityDetachmentType::CacheDestroyed) { >- if (auto* cache = axObjectCache()) { >- cache->detachWrapper(this, detachmentType); >- return; >- } >- } >- >- auto* wrapper = this->wrapper(); >- ASSERT(wrapper); >- webkitAccessibleDetach(WEBKIT_ACCESSIBLE(wrapper)); >-} >- >-bool AccessibilityObject::accessibilityIgnoreAttachment() const >-{ >- return false; >-} >- >-AccessibilityObjectInclusion AccessibilityObject::accessibilityPlatformIncludesObject() const >-{ >- AccessibilityObject* parent = parentObject(); >- if (!parent) >- return AccessibilityObjectInclusion::DefaultBehavior; >- >- // If the author has provided a role, platform-specific inclusion likely doesn't apply. >- if (ariaRoleAttribute() != AccessibilityRole::Unknown) >- return AccessibilityObjectInclusion::DefaultBehavior; >- >- AccessibilityRole role = roleValue(); >- // We expose the slider as a whole but not its value indicator. >- if (role == AccessibilityRole::SliderThumb) >- return AccessibilityObjectInclusion::IgnoreObject; >- >- // When a list item is made up entirely of children (e.g. paragraphs) >- // the list item gets ignored. We need it. >- if (isGroup() && parent->isList()) >- return AccessibilityObjectInclusion::IncludeObject; >- >- // Entries and password fields have extraneous children which we want to ignore. >- if (parent->isPasswordField() || parent->isTextControl()) >- return AccessibilityObjectInclusion::IgnoreObject; >- >- // Include all tables, even layout tables. The AT can decide what to do with each. >- if (role == AccessibilityRole::Cell || role == AccessibilityRole::Table || role == AccessibilityRole::ColumnHeader || role == AccessibilityRole::RowHeader) >- return AccessibilityObjectInclusion::IncludeObject; >- >- // The object containing the text should implement AtkText itself. >- // However, WebCore also maps ARIA's "text" role to the StaticTextRole. >- if (role == AccessibilityRole::StaticText) >- return ariaRoleAttribute() != AccessibilityRole::Unknown ? AccessibilityObjectInclusion::DefaultBehavior : AccessibilityObjectInclusion::IgnoreObject; >- >- // Include all list items, regardless they have or not inline children >- if (role == AccessibilityRole::ListItem) >- return AccessibilityObjectInclusion::IncludeObject; >- >- // Bullets/numbers for list items shouldn't be exposed as AtkObjects. >- if (role == AccessibilityRole::ListMarker) >- return AccessibilityObjectInclusion::IgnoreObject; >- >- // Never expose an unknown object, since AT's won't know what to >- // do with them. This is what is done on the Mac as well. >- if (role == AccessibilityRole::Unknown) >- return AccessibilityObjectInclusion::IgnoreObject; >- >- if (role == AccessibilityRole::Inline) >- return AccessibilityObjectInclusion::IncludeObject; >- >- // Lines past this point only make sense for AccessibilityRenderObjects. >- RenderObject* renderObject = renderer(); >- if (!renderObject) >- return AccessibilityObjectInclusion::DefaultBehavior; >- >- // We always want to include paragraphs that have rendered content. >- // WebCore Accessibility does so unless there is a RenderBlock child. >- if (role == AccessibilityRole::Paragraph) { >- auto child = childrenOfType<RenderBlock>(downcast<RenderElement>(*renderObject)).first(); >- return child ? AccessibilityObjectInclusion::IncludeObject : AccessibilityObjectInclusion::DefaultBehavior; >- } >- >- // We always want to include table cells (layout and CSS) that have rendered text content. >- if (is<RenderTableCell>(renderObject)) { >- for (const auto& child : childrenOfType<RenderObject>(downcast<RenderElement>(*renderObject))) { >- if (is<RenderInline>(child) || is<RenderText>(child) || is<HTMLSpanElement>(child.node())) >- return AccessibilityObjectInclusion::IncludeObject; >- } >- return AccessibilityObjectInclusion::DefaultBehavior; >- } >- >- if (renderObject->isAnonymousBlock()) { >- // The text displayed by an ARIA menu item is exposed through the accessible name. >- if (parent->isMenuItem()) >- return AccessibilityObjectInclusion::IgnoreObject; >- >- // The text displayed in headings is typically exposed in the heading itself. >- if (parent->isHeading()) >- return AccessibilityObjectInclusion::IgnoreObject; >- >- // The text displayed in list items is typically exposed in the list item itself. >- if (parent->isListItem()) >- return AccessibilityObjectInclusion::IgnoreObject; >- >- // The text displayed in links is typically exposed in the link itself. >- if (parent->isLink()) >- return AccessibilityObjectInclusion::IgnoreObject; >- >- // FIXME: This next one needs some further consideration. But paragraphs are not >- // typically huge (like divs). And ignoring anonymous block children of paragraphs >- // will preserve existing behavior. >- if (parent->roleValue() == AccessibilityRole::Paragraph) >- return AccessibilityObjectInclusion::IgnoreObject; >- >- return AccessibilityObjectInclusion::DefaultBehavior; >- } >- >- Node* node = renderObject->node(); >- if (!node) >- return AccessibilityObjectInclusion::DefaultBehavior; >- >- // We don't want <span> elements to show up in the accessibility hierarchy unless >- // we have good reasons for that (e.g. focusable or visible because of containing >- // a meaningful accessible name, maybe set through ARIA), so we can use >- // atk_component_grab_focus() to set the focus to it. >- if (is<HTMLSpanElement>(node) && !canSetFocusAttribute() && !hasAttributesRequiredForInclusion() && !supportsARIAAttributes()) >- return AccessibilityObjectInclusion::IgnoreObject; >- >- // If we include TextControlInnerTextElement children, changes to those children >- // will result in focus and text notifications that suggest the user is no longer >- // in the control. This can be especially problematic for screen reader users with >- // key echo enabled when typing in a password input. >- if (is<TextControlInnerTextElement>(node)) >- return AccessibilityObjectInclusion::IgnoreObject; >- >- return AccessibilityObjectInclusion::DefaultBehavior; >-} >- >-bool AccessibilityObject::allowsTextRanges() const >-{ >- // Check type for the AccessibilityObject. >- if (isTextControl() || isWebArea() || isGroup() || isLink() || isHeading() || isListItem() || isTableCell()) >- return true; >- >- // Check roles as the last fallback mechanism. >- AccessibilityRole role = roleValue(); >- return role == AccessibilityRole::Paragraph || role == AccessibilityRole::Label || role == AccessibilityRole::Div || role == AccessibilityRole::Form || role == AccessibilityRole::Pre; >-} >- >-unsigned AccessibilityObject::getLengthForTextRange() const >-{ >- unsigned textLength = text().length(); >- >- if (textLength) >- return textLength; >- >- // Gtk ATs need this for all text objects; not just text controls. >- Node* node = this->node(); >- RenderObject* renderer = node ? node->renderer() : nullptr; >- if (is<RenderText>(renderer)) >- textLength = downcast<RenderText>(*renderer).text().length(); >- >- // Get the text length from the elements under the >- // accessibility object if the value is still zero. >- if (!textLength && allowsTextRanges()) >- textLength = textUnderElement(AccessibilityTextUnderElementMode(AccessibilityTextUnderElementMode::TextUnderElementModeIncludeAllChildren)).length(); >- >- return textLength; >-} >- >-} // namespace WebCore >- >-#endif // ENABLE(ACCESSIBILITY) && USE(ATK) >diff --git a/Source/WebCore/accessibility/atk/WebKitAccessible.cpp b/Source/WebCore/accessibility/atk/WebKitAccessible.cpp >deleted file mode 100644 >index fa8e47930057..000000000000 >--- a/Source/WebCore/accessibility/atk/WebKitAccessible.cpp >+++ /dev/null >@@ -1,1386 +0,0 @@ >-/* >- * Copyright (C) 2008 Nuanti Ltd. >- * Copyright (C) 2009 Jan Alonzo >- * Copyright (C) 2009, 2010, 2011, 2012, 2019 Igalia S.L. >- * Copyright (C) 2013 Samsung Electronics >- * >- * Portions from Mozilla a11y, copyright as follows: >- * >- * The Original Code is mozilla.org code. >- * >- * The Initial Developer of the Original Code is >- * Sun Microsystems, Inc. >- * Portions created by the Initial Developer are Copyright (C) 2002 >- * the Initial Developer. All Rights Reserved. >- * >- * This library is free software; you can redistribute it and/or >- * modify it under the terms of the GNU Library General Public >- * License as published by the Free Software Foundation; either >- * version 2 of the License, or (at your option) any later version. >- * >- * This library is distributed in the hope that it will be useful, >- * but WITHOUT ANY WARRANTY; without even the implied warranty of >- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- * Library General Public License for more details. >- * >- * You should have received a copy of the GNU Library General Public License >- * along with this library; see the file COPYING.LIB. If not, write to >- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >- * Boston, MA 02110-1301, USA. >- */ >- >-#include "config.h" >-#include "WebKitAccessible.h" >- >-#if ENABLE(ACCESSIBILITY) && USE(ATK) >- >-#include "AXObjectCache.h" >-#include "AccessibilityList.h" >-#include "AccessibilityListBoxOption.h" >-#include "AccessibilityTable.h" >-#include "AccessibilityTableCell.h" >-#include "AccessibilityTableRow.h" >-#include "Document.h" >-#include "Editing.h" >-#include "ElementInlines.h" >-#include "Frame.h" >-#include "FrameView.h" >-#include "HTMLNames.h" >-#include "HTMLTableElement.h" >-#include "HostWindow.h" >-#include "RenderAncestorIterator.h" >-#include "RenderBlock.h" >-#include "RenderObject.h" >-#include "SVGElement.h" >-#include "Settings.h" >-#include "TextIterator.h" >-#include "VisibleUnits.h" >-#include "WebKitAccessibleHyperlink.h" >-#include "WebKitAccessibleInterfaceAction.h" >-#include "WebKitAccessibleInterfaceComponent.h" >-#include "WebKitAccessibleInterfaceDocument.h" >-#include "WebKitAccessibleInterfaceEditableText.h" >-#include "WebKitAccessibleInterfaceHyperlinkImpl.h" >-#include "WebKitAccessibleInterfaceHypertext.h" >-#include "WebKitAccessibleInterfaceImage.h" >-#include "WebKitAccessibleInterfaceSelection.h" >-#include "WebKitAccessibleInterfaceTable.h" >-#include "WebKitAccessibleInterfaceTableCell.h" >-#include "WebKitAccessibleInterfaceText.h" >-#include "WebKitAccessibleInterfaceValue.h" >-#include "WebKitAccessibleUtil.h" >-#include <glib/gprintf.h> >-#include <wtf/glib/WTFGType.h> >-#include <wtf/text/CString.h> >- >-using namespace WebCore; >- >-struct _WebKitAccessiblePrivate { >- AccessibilityObject* object; >- >- // Cached data for AtkObject. >- CString accessibleName; >- CString accessibleDescription; >- >- // Cached data for AtkAction. >- CString actionName; >- CString actionKeyBinding; >- >- // Cached data for AtkDocument. >- CString documentLocale; >- CString documentType; >- CString documentEncoding; >- CString documentURI; >- >- // Cached data for AtkImage. >- CString imageDescription; >-}; >- >-WEBKIT_DEFINE_TYPE(WebKitAccessible, webkit_accessible, ATK_TYPE_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); >- >- for (const auto& text : textOrder) { >- // FIXME: This check is here because AccessibilityNodeObject::titleElementText() >- // appends an empty String for the LabelByElementText source when there is a >- // titleUIElement(). Removing this check makes some fieldsets lose their name. >- if (text.text.isEmpty()) >- continue; >- >- // WebCore Accessibility should provide us with the text alternative computation >- // in the order defined by that spec. So take the first thing that our platform >- // does not expose via the AtkObject description. >- if (text.textSource != AccessibilityTextSource::Help && text.textSource != AccessibilityTextSource::Summary) >- return webkitAccessibleCacheAndReturnAtkProperty(accessible, AtkCachedAccessibleName, text.text.utf8()); >- } >- >- return webkitAccessibleCacheAndReturnAtkProperty(accessible, AtkCachedAccessibleName, ""); >-} >- >-static const gchar* webkitAccessibleGetDescription(AtkObject* object) >-{ >- auto* accessible = WEBKIT_ACCESSIBLE(object); >- returnValIfWebKitAccessibleIsInvalid(accessible, nullptr); >- >- if (!accessible->priv->object) >- return ""; >- >- Vector<AccessibilityText> textOrder; >- accessible->priv->object->accessibilityText(textOrder); >- >- bool nameTextAvailable = false; >- for (const auto& text : textOrder) { >- // WebCore Accessibility should provide us with the text alternative computation >- // in the order defined by that spec. So take the first thing that our platform >- // does not expose via the AtkObject name. >- if (text.textSource == AccessibilityTextSource::Help || text.textSource == AccessibilityTextSource::Summary) >- return webkitAccessibleCacheAndReturnAtkProperty(accessible, AtkCachedAccessibleDescription, text.text.utf8()); >- >- // If there is no other text alternative, the title tag contents will have been >- // used for the AtkObject name. We don't want to duplicate it here. >- if (text.textSource == AccessibilityTextSource::TitleTag && nameTextAvailable) >- return webkitAccessibleCacheAndReturnAtkProperty(accessible, AtkCachedAccessibleDescription, text.text.utf8()); >- >- nameTextAvailable = true; >- } >- >- return webkitAccessibleCacheAndReturnAtkProperty(accessible, AtkCachedAccessibleDescription, ""); >-} >- >-static void removeAtkRelationByType(AtkRelationSet* relationSet, AtkRelationType relationType) >-{ >- int count = atk_relation_set_get_n_relations(relationSet); >- for (int i = 0; i < count; i++) { >- AtkRelation* relation = atk_relation_set_get_relation(relationSet, i); >- if (atk_relation_get_relation_type(relation) == relationType) { >- atk_relation_set_remove(relationSet, relation); >- break; >- } >- } >-} >- >-static void setAtkRelationSetFromCoreObject(AccessibilityObject* coreObject, AtkRelationSet* relationSet) >-{ >- // Elements with aria-labelledby should have the labelled-by relation as per the ARIA AAM spec. >- // Controls with a label element and fieldsets with a legend element should also use this relation >- // as per the HTML AAM spec. The reciprocal label-for relation should also be used. >- removeAtkRelationByType(relationSet, ATK_RELATION_LABELLED_BY); >- removeAtkRelationByType(relationSet, ATK_RELATION_LABEL_FOR); >- if (coreObject->isControl()) { >- if (AccessibilityObject* label = coreObject->correspondingLabelForControlElement()) >- atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_LABELLED_BY, ATK_OBJECT(label->wrapper())); >- } else if (coreObject->isFieldset()) { >- if (AccessibilityObject* label = coreObject->titleUIElement()) >- atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_LABELLED_BY, ATK_OBJECT(label->wrapper())); >- } else if (coreObject->roleValue() == AccessibilityRole::Legend) { >- if (RenderBlock* renderFieldset = ancestorsOfType<RenderBlock>(*coreObject->renderer()).first()) { >- if (renderFieldset->isFieldset()) { >- AccessibilityObject* fieldset = coreObject->axObjectCache()->getOrCreate(renderFieldset); >- atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_LABEL_FOR, ATK_OBJECT(fieldset->wrapper())); >- } >- } >- } else if (AccessibilityObject* control = coreObject->correspondingControlForLabelElement()) >- atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_LABEL_FOR, ATK_OBJECT(control->wrapper())); >- else { >- AccessibilityObject::AccessibilityChildrenVector ariaLabelledByElements; >- coreObject->ariaLabelledByElements(ariaLabelledByElements); >- for (const auto& accessibilityObject : ariaLabelledByElements) >- atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_LABELLED_BY, ATK_OBJECT(accessibilityObject->wrapper())); >- } >- >- // Elements referenced by aria-labelledby should have the label-for relation as per the ARIA AAM spec. >- AccessibilityObject::AccessibilityChildrenVector labels; >- coreObject->ariaLabelledByReferencingElements(labels); >- for (const auto& accessibilityObject : labels) >- atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_LABEL_FOR, ATK_OBJECT(accessibilityObject->wrapper())); >- >- // Elements with aria-flowto should have the flows-to relation as per the ARIA AAM spec. >- removeAtkRelationByType(relationSet, ATK_RELATION_FLOWS_TO); >- AccessibilityObject::AccessibilityChildrenVector ariaFlowToElements; >- coreObject->ariaFlowToElements(ariaFlowToElements); >- for (const auto& accessibilityObject : ariaFlowToElements) >- atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_FLOWS_TO, ATK_OBJECT(accessibilityObject->wrapper())); >- >- // Elements referenced by aria-flowto should have the flows-from relation as per the ARIA AAM spec. >- removeAtkRelationByType(relationSet, ATK_RELATION_FLOWS_FROM); >- AccessibilityObject::AccessibilityChildrenVector flowFrom; >- coreObject->ariaFlowToReferencingElements(flowFrom); >- for (const auto& accessibilityObject : flowFrom) >- atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_FLOWS_FROM, ATK_OBJECT(accessibilityObject->wrapper())); >- >- // Elements with aria-describedby should have the described-by relation as per the ARIA AAM spec. >- removeAtkRelationByType(relationSet, ATK_RELATION_DESCRIBED_BY); >- AccessibilityObject::AccessibilityChildrenVector ariaDescribedByElements; >- coreObject->ariaDescribedByElements(ariaDescribedByElements); >- for (const auto& accessibilityObject : ariaDescribedByElements) >- atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_DESCRIBED_BY, ATK_OBJECT(accessibilityObject->wrapper())); >- >- // Elements referenced by aria-describedby should have the description-for relation as per the ARIA AAM spec. >- removeAtkRelationByType(relationSet, ATK_RELATION_DESCRIPTION_FOR); >- AccessibilityObject::AccessibilityChildrenVector describers; >- coreObject->ariaDescribedByReferencingElements(describers); >- for (const auto& accessibilityObject : describers) >- atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_DESCRIPTION_FOR, ATK_OBJECT(accessibilityObject->wrapper())); >- >- // Elements with aria-controls should have the controller-for relation as per the ARIA AAM spec. >- removeAtkRelationByType(relationSet, ATK_RELATION_CONTROLLER_FOR); >- AccessibilityObject::AccessibilityChildrenVector ariaControls; >- coreObject->ariaControlsElements(ariaControls); >- for (const auto& accessibilityObject : ariaControls) >- atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_CONTROLLER_FOR, ATK_OBJECT(accessibilityObject->wrapper())); >- >- // Elements referenced by aria-controls should have the controlled-by relation as per the ARIA AAM spec. >- removeAtkRelationByType(relationSet, ATK_RELATION_CONTROLLED_BY); >- AccessibilityObject::AccessibilityChildrenVector controllers; >- coreObject->ariaControlsReferencingElements(controllers); >- for (const auto& accessibilityObject : controllers) >- atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_CONTROLLED_BY, ATK_OBJECT(accessibilityObject->wrapper())); >- >- // Elements with aria-owns should have the node-parent-of relation as per the ARIA AAM spec. >- removeAtkRelationByType(relationSet, ATK_RELATION_NODE_PARENT_OF); >- AccessibilityObject::AccessibilityChildrenVector ariaOwns; >- coreObject->ariaOwnsElements(ariaOwns); >- for (const auto& accessibilityObject : ariaOwns) >- atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_NODE_PARENT_OF, ATK_OBJECT(accessibilityObject->wrapper())); >- >- // Elements referenced by aria-owns should have the node-child-of relation as per the ARIA AAM spec. >- removeAtkRelationByType(relationSet, ATK_RELATION_NODE_CHILD_OF); >- AccessibilityObject::AccessibilityChildrenVector owners; >- coreObject->ariaOwnsReferencingElements(owners); >- for (const auto& accessibilityObject : owners) >- atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_NODE_CHILD_OF, ATK_OBJECT(accessibilityObject->wrapper())); >- >-#if ATK_CHECK_VERSION(2, 25, 2) >- // Elements with aria-details should have the details relation as per the ARIA AAM spec. >- removeAtkRelationByType(relationSet, ATK_RELATION_DETAILS); >- AccessibilityObject::AccessibilityChildrenVector ariaDetails; >- coreObject->ariaDetailsElements(ariaDetails); >- for (const auto& accessibilityObject : ariaDetails) >- atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_DETAILS, ATK_OBJECT(accessibilityObject->wrapper())); >- >- // Elements referenced by aria-details should have the details-for relation as per the ARIA AAM spec. >- removeAtkRelationByType(relationSet, ATK_RELATION_DETAILS_FOR); >- AccessibilityObject::AccessibilityChildrenVector details; >- coreObject->ariaDetailsReferencingElements(details); >- for (const auto& accessibilityObject : details) >- atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_DETAILS_FOR, ATK_OBJECT(accessibilityObject->wrapper())); >- >- // Elements with aria-errormessage should have the error-message relation as per the ARIA AAM spec. >- removeAtkRelationByType(relationSet, ATK_RELATION_ERROR_MESSAGE); >- AccessibilityObject::AccessibilityChildrenVector ariaErrorMessage; >- coreObject->ariaErrorMessageElements(ariaErrorMessage); >- for (const auto& accessibilityObject : ariaErrorMessage) >- atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_ERROR_MESSAGE, ATK_OBJECT(accessibilityObject->wrapper())); >- >- // Elements referenced by aria-errormessage should have the error-for relation as per the ARIA AAM spec. >- removeAtkRelationByType(relationSet, ATK_RELATION_ERROR_FOR); >- AccessibilityObject::AccessibilityChildrenVector errors; >- coreObject->ariaErrorMessageReferencingElements(errors); >- for (const auto& accessibilityObject : errors) >- atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_ERROR_FOR, ATK_OBJECT(accessibilityObject->wrapper())); >-#endif >-} >- >-static bool isRootObject(AccessibilityObject* coreObject) >-{ >- // The root accessible object in WebCore is always an object with >- // the ScrolledArea role with one child with the WebArea role. >- if (!coreObject || !coreObject->isScrollView()) >- return false; >- >- AccessibilityObject* firstChild = coreObject->firstChild(); >- return firstChild && firstChild->isWebArea(); >-} >- >-static AtkObject* webkitAccessibleGetParent(AtkObject* object) >-{ >- auto* accessible = WEBKIT_ACCESSIBLE(object); >- returnValIfWebKitAccessibleIsInvalid(accessible, nullptr); >- >- // Check first if the parent has been already set. >- AtkObject* accessibleParent = ATK_OBJECT_CLASS(webkit_accessible_parent_class)->get_parent(object); >- if (accessibleParent) >- return accessibleParent; >- >- // 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 >- // impossible for assistive technologies to ascend the accessible >- // hierarchy all the way to the application. (Bug 30489) >- if (!coreObject->document()) >- return nullptr; >- } >- >- return coreParent ? ATK_OBJECT(coreParent->wrapper()) : nullptr; >-} >- >-static gint webkitAccessibleGetNChildren(AtkObject* object) >-{ >- auto* accessible = WEBKIT_ACCESSIBLE(object); >- returnValIfWebKitAccessibleIsInvalid(accessible, 0); >- >- if (!accessible->priv->object) >- return 0; >- return accessible->priv->object->children().size(); >-} >- >-static AtkObject* webkitAccessibleRefChild(AtkObject* object, gint index) >-{ >- auto* accessible = WEBKIT_ACCESSIBLE(object); >- returnValIfWebKitAccessibleIsInvalid(accessible, nullptr); >- >- if (!accessible->priv->object || index < 0) >- return nullptr; >- >- const auto& children = accessible->priv->object->children(); >- if (static_cast<size_t>(index) >= children.size()) >- return nullptr; >- >- auto& coreChild = children[index]; >- if (!coreChild) >- return nullptr; >- >- auto* child = coreChild->wrapper(); >- if (!child) >- return nullptr; >- >- atk_object_set_parent(ATK_OBJECT(child), object); >- return ATK_OBJECT(g_object_ref(child)); >-} >- >-static gint webkitAccessibleGetIndexInParent(AtkObject* object) >-{ >- auto* accessible = WEBKIT_ACCESSIBLE(object); >- returnValIfWebKitAccessibleIsInvalid(accessible, -1); >- >- auto* coreObject = accessible->priv->object; >- if (!coreObject) >- return -1; >- auto* parent = coreObject->parentObjectUnignored(); >- if (!parent && isRootObject(coreObject)) { >- if (!coreObject->document()) >- return -1; >- >- auto* atkParent = parent ? ATK_OBJECT(parent->wrapper()) : nullptr; >- if (!atkParent) >- return -1; >- >- unsigned count = atk_object_get_n_accessible_children(atkParent); >- for (unsigned i = 0; i < count; ++i) { >- GRefPtr<AtkObject> child = adoptGRef(atk_object_ref_accessible_child(atkParent, i)); >- if (child.get() == object) >- return i; >- } >- } >- >- if (!parent) >- return -1; >- >- size_t index = parent->children().find(coreObject); >- return (index == notFound) ? -1 : index; >-} >- >-static AtkAttributeSet* webkitAccessibleGetAttributes(AtkObject* object) >-{ >- auto* accessible = WEBKIT_ACCESSIBLE(object); >- returnValIfWebKitAccessibleIsInvalid(accessible, nullptr); >- >- AtkAttributeSet* attributeSet = nullptr; >-#if PLATFORM(GTK) >- attributeSet = addToAtkAttributeSet(attributeSet, "toolkit", "WebKitGtk"); >-#elif PLATFORM(WPE) >- attributeSet = addToAtkAttributeSet(attributeSet, "toolkit", "WPEWebKit"); >-#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 >- // for this information. >- Element* element = coreObject->element() ? coreObject->element() : coreObject->actionElement(); >- if (element) { >- String tagName = element->tagName(); >- if (!tagName.isEmpty()) >- attributeSet = addToAtkAttributeSet(attributeSet, "tag", tagName.convertToASCIILowercase().utf8().data()); >- String id = element->getIdAttribute().string(); >- if (!id.isEmpty()) >- attributeSet = addToAtkAttributeSet(attributeSet, "html-id", id.utf8().data()); >- } >- >- int level = coreObject->isHeading() ? coreObject->headingLevel() : coreObject->hierarchicalLevel(); >- if (level) { >- String value = String::number(level); >- attributeSet = addToAtkAttributeSet(attributeSet, "level", value.utf8().data()); >- } >- >- if (coreObject->roleValue() == AccessibilityRole::MathElement) { >- if (coreObject->isMathMultiscriptObject(AccessibilityMathMultiscriptObjectType::PreSuperscript) || coreObject->isMathMultiscriptObject(AccessibilityMathMultiscriptObjectType::PreSubscript)) >- attributeSet = addToAtkAttributeSet(attributeSet, "multiscript-type", "pre"); >- else if (coreObject->isMathMultiscriptObject(AccessibilityMathMultiscriptObjectType::PostSuperscript) || coreObject->isMathMultiscriptObject(AccessibilityMathMultiscriptObjectType::PostSubscript)) >- attributeSet = addToAtkAttributeSet(attributeSet, "multiscript-type", "post"); >- } >- >- if (is<AccessibilityTable>(*coreObject) && downcast<AccessibilityTable>(*coreObject).isExposable()) { >- auto& table = downcast<AccessibilityTable>(*coreObject); >- int rowCount = table.axRowCount(); >- if (rowCount) >- attributeSet = addToAtkAttributeSet(attributeSet, "rowcount", String::number(rowCount).utf8().data()); >- >- int columnCount = table.axColumnCount(); >- if (columnCount) >- attributeSet = addToAtkAttributeSet(attributeSet, "colcount", String::number(columnCount).utf8().data()); >- } else if (is<AccessibilityTableRow>(*coreObject)) { >- auto& row = downcast<AccessibilityTableRow>(*coreObject); >- int rowIndex = row.axRowIndex(); >- if (rowIndex != -1) >- attributeSet = addToAtkAttributeSet(attributeSet, "rowindex", String::number(rowIndex).utf8().data()); >- } else if (is<AccessibilityTableCell>(*coreObject)) { >- auto& cell = downcast<AccessibilityTableCell>(*coreObject); >- int rowIndex = cell.axRowIndex(); >- if (rowIndex != -1) >- attributeSet = addToAtkAttributeSet(attributeSet, "rowindex", String::number(rowIndex).utf8().data()); >- >- int columnIndex = cell.axColumnIndex(); >- if (columnIndex != -1) >- attributeSet = addToAtkAttributeSet(attributeSet, "colindex", String::number(columnIndex).utf8().data()); >- >- int rowSpan = cell.axRowSpan(); >- if (rowSpan != -1) >- attributeSet = addToAtkAttributeSet(attributeSet, "rowspan", String::number(rowSpan).utf8().data()); >- >- int columnSpan = cell.axColumnSpan(); >- if (columnSpan != -1) >- attributeSet = addToAtkAttributeSet(attributeSet, "colspan", String::number(columnSpan).utf8().data()); >- } >- >- String placeholder = coreObject->placeholderValue(); >- if (!placeholder.isEmpty()) >- attributeSet = addToAtkAttributeSet(attributeSet, "placeholder-text", placeholder.utf8().data()); >- >- if (coreObject->supportsAutoComplete()) >- attributeSet = addToAtkAttributeSet(attributeSet, "autocomplete", coreObject->autoCompleteValue().utf8().data()); >- >- if (coreObject->supportsHasPopup()) >- attributeSet = addToAtkAttributeSet(attributeSet, "haspopup", coreObject->popupValue().utf8().data()); >- >- if (coreObject->supportsCurrent()) >- attributeSet = addToAtkAttributeSet(attributeSet, "current", coreObject->currentValue().utf8().data()); >- >- // The Core AAM states that an explicitly-set value should be exposed, including "none". >- if (coreObject->hasAttribute(HTMLNames::aria_sortAttr)) { >- switch (coreObject->sortDirection()) { >- case AccessibilitySortDirection::Invalid: >- break; >- case AccessibilitySortDirection::Ascending: >- attributeSet = addToAtkAttributeSet(attributeSet, "sort", "ascending"); >- break; >- case AccessibilitySortDirection::Descending: >- attributeSet = addToAtkAttributeSet(attributeSet, "sort", "descending"); >- break; >- case AccessibilitySortDirection::Other: >- attributeSet = addToAtkAttributeSet(attributeSet, "sort", "other"); >- break; >- case AccessibilitySortDirection::None: >- attributeSet = addToAtkAttributeSet(attributeSet, "sort", "none"); >- } >- } >- >- if (coreObject->supportsPosInSet()) >- attributeSet = addToAtkAttributeSet(attributeSet, "posinset", String::number(coreObject->posInSet()).utf8().data()); >- >- if (coreObject->supportsSetSize()) >- attributeSet = addToAtkAttributeSet(attributeSet, "setsize", String::number(coreObject->setSize()).utf8().data()); >- >- String isReadOnly = coreObject->readOnlyValue(); >- if (!isReadOnly.isEmpty()) >- attributeSet = addToAtkAttributeSet(attributeSet, "readonly", isReadOnly.utf8().data()); >- >- String valueDescription = coreObject->valueDescription(); >- if (!valueDescription.isEmpty()) >- attributeSet = addToAtkAttributeSet(attributeSet, "valuetext", valueDescription.utf8().data()); >- >- // According to the W3C Core Accessibility API Mappings 1.1, section 5.4.1 General Rules: >- // "User agents must expose the WAI-ARIA role string if the API supports a mechanism to do so." >- // In the case of ATK, the mechanism to do so is an object attribute pair (xml-roles:"string"). >- // We cannot use the computedRoleString for this purpose because it is not limited to elements >- // with ARIA roles, and it might not contain the actual ARIA role value (e.g. DPub ARIA). >- String roleString = coreObject->getAttribute(HTMLNames::roleAttr); >- if (!roleString.isEmpty()) >- attributeSet = addToAtkAttributeSet(attributeSet, "xml-roles", roleString.utf8().data()); >- >- String computedRoleString = coreObject->computedRoleString(); >- if (!computedRoleString.isEmpty()) { >- attributeSet = addToAtkAttributeSet(attributeSet, "computed-role", computedRoleString.utf8().data()); >- >- // The HTML AAM maps several elements to ARIA landmark roles. In order for the type of landmark >- // to be obtainable in the same fashion as an ARIA landmark, fall back on the computedRoleString. >- // We also want to do this for the style-format-group element types so that the type of format >- // group it is doesn't get lost to a generic platform role. >- if (coreObject->ariaRoleAttribute() == AccessibilityRole::Unknown >- && (coreObject->isLandmark() || coreObject->isStyleFormatGroup())) >- attributeSet = addToAtkAttributeSet(attributeSet, "xml-roles", computedRoleString.utf8().data()); >- } >- >- String roleDescription = coreObject->roleDescription(); >- if (!roleDescription.isEmpty()) >- attributeSet = addToAtkAttributeSet(attributeSet, "roledescription", roleDescription.utf8().data()); >- >- // We need to expose the live region attributes even if the live region is currently disabled/off. >- if (auto liveContainer = coreObject->liveRegionAncestor(false)) { >- String liveStatus = liveContainer->liveRegionStatus(); >- String relevant = liveContainer->liveRegionRelevant(); >- bool isAtom = liveContainer->liveRegionAtomic(); >- String liveRole = roleString.isEmpty() ? computedRoleString : roleString; >- >- // According to the Core AAM, we need to expose the above properties with "container-" prefixed >- // object attributes regardless of whether the container is this object, or an ancestor of it. >- attributeSet = addToAtkAttributeSet(attributeSet, "container-live", liveStatus.utf8().data()); >- attributeSet = addToAtkAttributeSet(attributeSet, "container-relevant", relevant.utf8().data()); >- if (isAtom) >- attributeSet = addToAtkAttributeSet(attributeSet, "container-atomic", "true"); >- if (!liveRole.isEmpty()) >- attributeSet = addToAtkAttributeSet(attributeSet, "container-live-role", liveRole.utf8().data()); >- >- // According to the Core AAM, if this object is the live region (rather than its descendant), >- // we must expose the above properties on the object without a "container-" prefix. >- if (liveContainer == coreObject) { >- attributeSet = addToAtkAttributeSet(attributeSet, "live", liveStatus.utf8().data()); >- attributeSet = addToAtkAttributeSet(attributeSet, "relevant", relevant.utf8().data()); >- if (isAtom) >- attributeSet = addToAtkAttributeSet(attributeSet, "atomic", "true"); >- } else if (!isAtom && coreObject->liveRegionAtomic()) >- attributeSet = addToAtkAttributeSet(attributeSet, "atomic", "true"); >- } >- >- // The Core AAM states the author-provided value should be exposed as-is. >- String dropEffect = coreObject->getAttribute(HTMLNames::aria_dropeffectAttr); >- if (!dropEffect.isEmpty()) >- attributeSet = addToAtkAttributeSet(attributeSet, "dropeffect", dropEffect.utf8().data()); >- >- if (coreObject->isGrabbed()) >- attributeSet = addToAtkAttributeSet(attributeSet, "grabbed", "true"); >- else if (coreObject->supportsDragging()) >- attributeSet = addToAtkAttributeSet(attributeSet, "grabbed", "false"); >- >- // The Core AAM states the author-provided value should be exposed as-is. >- const AtomString& keyShortcuts = coreObject->keyShortcutsValue(); >- if (!keyShortcuts.isEmpty()) >- attributeSet = addToAtkAttributeSet(attributeSet, "keyshortcuts", keyShortcuts.string().utf8().data()); >- >- return attributeSet; >-} >- >-static AtkRole atkRole(AccessibilityObject* coreObject) >-{ >- switch (coreObject->roleValue()) { >- case AccessibilityRole::ApplicationAlert: >- return ATK_ROLE_NOTIFICATION; >- case AccessibilityRole::ApplicationAlertDialog: >- return ATK_ROLE_ALERT; >- case AccessibilityRole::ApplicationDialog: >- return ATK_ROLE_DIALOG; >- case AccessibilityRole::ApplicationStatus: >- return ATK_ROLE_STATUSBAR; >- case AccessibilityRole::Unknown: >- return ATK_ROLE_UNKNOWN; >- case AccessibilityRole::Audio: >- return ATK_ROLE_AUDIO; >- case AccessibilityRole::Video: >- return ATK_ROLE_VIDEO; >- case AccessibilityRole::Button: >- return ATK_ROLE_PUSH_BUTTON; >- case AccessibilityRole::Switch: >- case AccessibilityRole::ToggleButton: >- return ATK_ROLE_TOGGLE_BUTTON; >- case AccessibilityRole::RadioButton: >- return ATK_ROLE_RADIO_BUTTON; >- case AccessibilityRole::CheckBox: >- return ATK_ROLE_CHECK_BOX; >- case AccessibilityRole::Slider: >- return ATK_ROLE_SLIDER; >- case AccessibilityRole::TabGroup: >- case AccessibilityRole::TabList: >- return ATK_ROLE_PAGE_TAB_LIST; >- case AccessibilityRole::TextField: >- case AccessibilityRole::TextArea: >- case AccessibilityRole::SearchField: >- return ATK_ROLE_ENTRY; >- case AccessibilityRole::StaticText: >- return ATK_ROLE_STATIC; >- case AccessibilityRole::Outline: >- case AccessibilityRole::Tree: >- return ATK_ROLE_TREE; >- case AccessibilityRole::TreeItem: >- return ATK_ROLE_TREE_ITEM; >- case AccessibilityRole::MenuBar: >- return ATK_ROLE_MENU_BAR; >- case AccessibilityRole::MenuListPopup: >- case AccessibilityRole::Menu: >- return ATK_ROLE_MENU; >- case AccessibilityRole::MenuListOption: >- case AccessibilityRole::MenuItem: >- case AccessibilityRole::MenuButton: >- return ATK_ROLE_MENU_ITEM; >- case AccessibilityRole::MenuItemCheckbox: >- return ATK_ROLE_CHECK_MENU_ITEM; >- case AccessibilityRole::MenuItemRadio: >- return ATK_ROLE_RADIO_MENU_ITEM; >- case AccessibilityRole::Column: >- // return ATK_ROLE_TABLE_COLUMN_HEADER; // Is this right? >- return ATK_ROLE_UNKNOWN; // Matches Mozilla >- case AccessibilityRole::Row: >- return ATK_ROLE_TABLE_ROW; >- case AccessibilityRole::Toolbar: >- return ATK_ROLE_TOOL_BAR; >- case AccessibilityRole::Meter: >- return ATK_ROLE_LEVEL_BAR; >- case AccessibilityRole::BusyIndicator: >- case AccessibilityRole::ProgressIndicator: >- return ATK_ROLE_PROGRESS_BAR; >- case AccessibilityRole::Window: >- return ATK_ROLE_WINDOW; >- case AccessibilityRole::PopUpButton: >- return coreObject->hasPopup() ? ATK_ROLE_PUSH_BUTTON : ATK_ROLE_COMBO_BOX; >- case AccessibilityRole::ComboBox: >- return ATK_ROLE_COMBO_BOX; >- case AccessibilityRole::SplitGroup: >- return ATK_ROLE_SPLIT_PANE; >- case AccessibilityRole::Splitter: >- return ATK_ROLE_SEPARATOR; >-#if PLATFORM(GTK) >- case AccessibilityRole::ColorWell: >- // ATK_ROLE_COLOR_CHOOSER is defined as a dialog (i.e. it's what appears when you push the button). >- return ATK_ROLE_PUSH_BUTTON; >-#endif >- case AccessibilityRole::List: >- return ATK_ROLE_LIST; >- case AccessibilityRole::ScrollBar: >- return ATK_ROLE_SCROLL_BAR; >- case AccessibilityRole::ScrollArea: >- case AccessibilityRole::TabPanel: >- return ATK_ROLE_SCROLL_PANE; >- case AccessibilityRole::Grid: >- case AccessibilityRole::Table: >- return ATK_ROLE_TABLE; >- case AccessibilityRole::TreeGrid: >- return ATK_ROLE_TREE_TABLE; >- case AccessibilityRole::Application: >- return ATK_ROLE_APPLICATION; >- case AccessibilityRole::ApplicationGroup: >- case AccessibilityRole::Feed: >- case AccessibilityRole::Figure: >- case AccessibilityRole::GraphicsObject: >- case AccessibilityRole::Group: >- case AccessibilityRole::RadioGroup: >- case AccessibilityRole::SVGRoot: >- return ATK_ROLE_PANEL; >- case AccessibilityRole::RowHeader: >- return ATK_ROLE_ROW_HEADER; >- case AccessibilityRole::ColumnHeader: >- return ATK_ROLE_COLUMN_HEADER; >- case AccessibilityRole::Caption: >- return ATK_ROLE_CAPTION; >- case AccessibilityRole::Cell: >- case AccessibilityRole::GridCell: >- return coreObject->inheritsPresentationalRole() ? ATK_ROLE_SECTION : ATK_ROLE_TABLE_CELL; >- case AccessibilityRole::Link: >- case AccessibilityRole::WebCoreLink: >- case AccessibilityRole::ImageMapLink: >- return ATK_ROLE_LINK; >- case AccessibilityRole::ImageMap: >- return ATK_ROLE_IMAGE_MAP; >- case AccessibilityRole::GraphicsSymbol: >- case AccessibilityRole::Image: >- return ATK_ROLE_IMAGE; >- case AccessibilityRole::ListMarker: >- return ATK_ROLE_TEXT; >- case AccessibilityRole::DocumentArticle: >- return ATK_ROLE_ARTICLE; >- case AccessibilityRole::Document: >- case AccessibilityRole::GraphicsDocument: >- return ATK_ROLE_DOCUMENT_FRAME; >- case AccessibilityRole::DocumentNote: >- return ATK_ROLE_COMMENT; >- case AccessibilityRole::Heading: >- return ATK_ROLE_HEADING; >- case AccessibilityRole::ListBox: >- // https://rawgit.com/w3c/aria/master/core-aam/core-aam.html#role-map-listbox >- return coreObject->isDescendantOfRole(AccessibilityRole::ComboBox) ? ATK_ROLE_MENU : ATK_ROLE_LIST_BOX; >- case AccessibilityRole::ListItem: >- return coreObject->inheritsPresentationalRole() ? ATK_ROLE_SECTION : ATK_ROLE_LIST_ITEM; >- case AccessibilityRole::ListBoxOption: >- return coreObject->isDescendantOfRole(AccessibilityRole::ComboBox) ? ATK_ROLE_MENU_ITEM : ATK_ROLE_LIST_ITEM; >- case AccessibilityRole::Paragraph: >- return ATK_ROLE_PARAGRAPH; >- case AccessibilityRole::Label: >- case AccessibilityRole::Legend: >- return ATK_ROLE_LABEL; >- case AccessibilityRole::Blockquote: >- return ATK_ROLE_BLOCK_QUOTE; >-#if ATK_CHECK_VERSION(2, 25, 2) >- case AccessibilityRole::Footnote: >- return ATK_ROLE_FOOTNOTE; >-#endif >- case AccessibilityRole::ApplicationTextGroup: >- case AccessibilityRole::Div: >- case AccessibilityRole::Pre: >- case AccessibilityRole::SVGText: >- case AccessibilityRole::TextGroup: >- return ATK_ROLE_SECTION; >- case AccessibilityRole::Footer: >- return ATK_ROLE_FOOTER; >- case AccessibilityRole::Form: >- if (coreObject->ariaRoleAttribute() != AccessibilityRole::Unknown) >- return ATK_ROLE_LANDMARK; >- return ATK_ROLE_FORM; >- case AccessibilityRole::Canvas: >- return ATK_ROLE_CANVAS; >- case AccessibilityRole::HorizontalRule: >- return ATK_ROLE_SEPARATOR; >- case AccessibilityRole::SpinButton: >- return ATK_ROLE_SPIN_BUTTON; >- case AccessibilityRole::Tab: >- return ATK_ROLE_PAGE_TAB; >- case AccessibilityRole::UserInterfaceTooltip: >- return ATK_ROLE_TOOL_TIP; >- case AccessibilityRole::WebArea: >- return ATK_ROLE_DOCUMENT_WEB; >- case AccessibilityRole::WebApplication: >- return ATK_ROLE_EMBEDDED; >- case AccessibilityRole::ApplicationLog: >- return ATK_ROLE_LOG; >- case AccessibilityRole::ApplicationMarquee: >- return ATK_ROLE_MARQUEE; >- case AccessibilityRole::ApplicationTimer: >- return ATK_ROLE_TIMER; >- case AccessibilityRole::Definition: >- return ATK_ROLE_DEFINITION; >- case AccessibilityRole::DocumentMath: >- return ATK_ROLE_MATH; >- case AccessibilityRole::MathElement: >- if (coreObject->isMathRow()) >- return ATK_ROLE_PANEL; >- if (coreObject->isMathTable()) >- return ATK_ROLE_TABLE; >- if (coreObject->isMathTableRow()) >- return ATK_ROLE_TABLE_ROW; >- if (coreObject->isMathTableCell()) >- return ATK_ROLE_TABLE_CELL; >- if (coreObject->isMathSubscriptSuperscript() || coreObject->isMathMultiscript()) >- return ATK_ROLE_SECTION; >- if (coreObject->isMathFraction()) >- return ATK_ROLE_MATH_FRACTION; >- if (coreObject->isMathSquareRoot() || coreObject->isMathRoot()) >- return ATK_ROLE_MATH_ROOT; >- if (coreObject->isMathScriptObject(AccessibilityMathScriptObjectType::Subscript) >- || coreObject->isMathMultiscriptObject(AccessibilityMathMultiscriptObjectType::PreSubscript) || coreObject->isMathMultiscriptObject(AccessibilityMathMultiscriptObjectType::PostSubscript)) >- return ATK_ROLE_SUBSCRIPT; >- if (coreObject->isMathScriptObject(AccessibilityMathScriptObjectType::Superscript) >- || coreObject->isMathMultiscriptObject(AccessibilityMathMultiscriptObjectType::PreSuperscript) || coreObject->isMathMultiscriptObject(AccessibilityMathMultiscriptObjectType::PostSuperscript)) >- return ATK_ROLE_SUPERSCRIPT; >- if (coreObject->isMathToken()) >- return ATK_ROLE_STATIC; >- return ATK_ROLE_UNKNOWN; >- case AccessibilityRole::LandmarkBanner: >- case AccessibilityRole::LandmarkComplementary: >- case AccessibilityRole::LandmarkContentInfo: >- case AccessibilityRole::LandmarkDocRegion: >- case AccessibilityRole::LandmarkMain: >- case AccessibilityRole::LandmarkNavigation: >- case AccessibilityRole::LandmarkRegion: >- case AccessibilityRole::LandmarkSearch: >- return ATK_ROLE_LANDMARK; >- case AccessibilityRole::DescriptionList: >- return ATK_ROLE_DESCRIPTION_LIST; >- case AccessibilityRole::Term: >- case AccessibilityRole::DescriptionListTerm: >- return ATK_ROLE_DESCRIPTION_TERM; >- case AccessibilityRole::DescriptionListDetail: >- return ATK_ROLE_DESCRIPTION_VALUE; >- case AccessibilityRole::Deletion: >-#if ATK_CHECK_VERSION(2, 33, 3) >- return ATK_ROLE_CONTENT_DELETION; >-#else >- return ATK_ROLE_STATIC; >-#endif >- case AccessibilityRole::Insertion: >-#if ATK_CHECK_VERSION(2, 33, 3) >- return ATK_ROLE_CONTENT_INSERTION; >-#else >- return ATK_ROLE_STATIC; >-#endif >- case AccessibilityRole::Subscript: >- return ATK_ROLE_SUBSCRIPT; >- case AccessibilityRole::Superscript: >- return ATK_ROLE_SUPERSCRIPT; >- case AccessibilityRole::Inline: >- case AccessibilityRole::SVGTextPath: >- case AccessibilityRole::SVGTSpan: >- case AccessibilityRole::Time: >- return ATK_ROLE_STATIC; >- default: >- return ATK_ROLE_UNKNOWN; >- } >-} >- >-static AtkRole webkitAccessibleGetRole(AtkObject* object) >-{ >- // ATK_ROLE_UNKNOWN should only be applied in cases where there is a valid >- // WebCore accessible object for which the platform role mapping is unknown. >- 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; >- >- return atkRole(accessible->priv->object); >-} >- >-static bool isTextWithCaret(AccessibilityObject* coreObject) >-{ >- if (!coreObject || !coreObject->isAccessibilityRenderObject()) >- return false; >- >- Document* document = coreObject->document(); >- if (!document) >- return false; >- >- Frame* frame = document->frame(); >- if (!frame) >- return false; >- >- if (!frame->settings().caretBrowsingEnabled()) >- return false; >- >- // Check text objects and paragraphs only. >- auto* axObject = coreObject->wrapper(); >- AtkRole role = axObject ? atk_object_get_role(ATK_OBJECT(axObject)) : ATK_ROLE_INVALID; >- if (role != ATK_ROLE_TEXT && role != ATK_ROLE_PARAGRAPH) >- return false; >- >- // Finally, check whether the caret is set in the current object. >- VisibleSelection selection = coreObject->selection(); >- if (!selection.isCaret()) >- return false; >- >- return selectionBelongsToObject(coreObject, selection); >-} >- >-static void setAtkStateSetFromCoreObject(AccessibilityObject* coreObject, AtkStateSet* stateSet) >-{ >- AccessibilityObject* parent = coreObject->parentObject(); >- bool isListBoxOption = parent && parent->isListBox(); >- >- // Please keep the state list in alphabetical order >- if ((isListBoxOption && coreObject->isSelectedOptionActive()) >- || coreObject->currentState() != AccessibilityCurrentState::False) >- atk_state_set_add_state(stateSet, ATK_STATE_ACTIVE); >- >- if (coreObject->isBusy()) >- atk_state_set_add_state(stateSet, ATK_STATE_BUSY); >- >- if (coreObject->supportsChecked() && coreObject->canSetValueAttribute()) >- atk_state_set_add_state(stateSet, ATK_STATE_CHECKABLE); >- >- if (coreObject->isChecked()) >- atk_state_set_add_state(stateSet, ATK_STATE_CHECKED); >- >- if ((coreObject->isTextControl() || coreObject->isNonNativeTextControl()) && coreObject->canSetValueAttribute()) >- atk_state_set_add_state(stateSet, ATK_STATE_EDITABLE); >- >- // FIXME: Put both ENABLED and SENSITIVE together here for now >- if (coreObject->isEnabled()) { >- atk_state_set_add_state(stateSet, ATK_STATE_ENABLED); >- atk_state_set_add_state(stateSet, ATK_STATE_SENSITIVE); >- } >- >- if (coreObject->canSetExpandedAttribute()) >- atk_state_set_add_state(stateSet, ATK_STATE_EXPANDABLE); >- >- if (coreObject->isExpanded()) >- atk_state_set_add_state(stateSet, ATK_STATE_EXPANDED); >- >- if (coreObject->canSetFocusAttribute()) >- atk_state_set_add_state(stateSet, ATK_STATE_FOCUSABLE); >- >- // According to the Core AAM, if the element which is focused has a valid aria-activedescendant, >- // we should not expose the focused state on the element which is actually focused, but instead >- // on its active descendant. >- if ((coreObject->isFocused() && !coreObject->activeDescendant()) || isTextWithCaret(coreObject)) >- atk_state_set_add_state(stateSet, ATK_STATE_FOCUSED); >- else if (coreObject->isActiveDescendantOfFocusedContainer()) { >- atk_state_set_add_state(stateSet, ATK_STATE_FOCUSABLE); >- atk_state_set_add_state(stateSet, ATK_STATE_FOCUSED); >- } >- >- if (coreObject->orientation() == AccessibilityOrientation::Horizontal) >- atk_state_set_add_state(stateSet, ATK_STATE_HORIZONTAL); >- else if (coreObject->orientation() == AccessibilityOrientation::Vertical) >- atk_state_set_add_state(stateSet, ATK_STATE_VERTICAL); >- >- if (coreObject->hasPopup()) >- atk_state_set_add_state(stateSet, ATK_STATE_HAS_POPUP); >- >- if (coreObject->isIndeterminate()) >- atk_state_set_add_state(stateSet, ATK_STATE_INDETERMINATE); >- else if (coreObject->isCheckboxOrRadio() || coreObject->isMenuItem() || coreObject->isToggleButton()) { >- if (coreObject->checkboxOrRadioValue() == AccessibilityButtonState::Mixed) >- atk_state_set_add_state(stateSet, ATK_STATE_INDETERMINATE); >- } >- >- if (coreObject->isModalNode()) >- atk_state_set_add_state(stateSet, ATK_STATE_MODAL); >- >- if (coreObject->invalidStatus() != "false") >- atk_state_set_add_state(stateSet, ATK_STATE_INVALID_ENTRY); >- >- if (coreObject->isMultiSelectable()) >- atk_state_set_add_state(stateSet, ATK_STATE_MULTISELECTABLE); >- >- // TODO: ATK_STATE_OPAQUE >- >- if (coreObject->isPressed()) >- atk_state_set_add_state(stateSet, ATK_STATE_PRESSED); >- >- if (!coreObject->canSetValueAttribute() && (coreObject->supportsReadOnly())) >- atk_state_set_add_state(stateSet, ATK_STATE_READ_ONLY); >- >- if (coreObject->isRequired()) >- atk_state_set_add_state(stateSet, ATK_STATE_REQUIRED); >- >- // TODO: ATK_STATE_SELECTABLE_TEXT >- >- if (coreObject->canSetSelectedAttribute()) { >- atk_state_set_add_state(stateSet, ATK_STATE_SELECTABLE); >- // Items in focusable lists have both STATE_SELECT{ABLE,ED} >- // and STATE_FOCUS{ABLE,ED}. We'll fake the latter based on >- // the former. >- if (isListBoxOption) >- atk_state_set_add_state(stateSet, ATK_STATE_FOCUSABLE); >- } >- >- if (coreObject->isSelected()) { >- atk_state_set_add_state(stateSet, ATK_STATE_SELECTED); >- // Items in focusable lists have both STATE_SELECT{ABLE,ED} >- // and STATE_FOCUS{ABLE,ED}. We'll fake the latter based on the >- // former. >- if (isListBoxOption) >- atk_state_set_add_state(stateSet, ATK_STATE_FOCUSED); >- } >- >- // FIXME: Group both SHOWING and VISIBLE here for now >- // Not sure how to handle this in WebKit, see bug >- // http://bugzilla.gnome.org/show_bug.cgi?id=509650 for other >- // issues with SHOWING vs VISIBLE. >- if (!coreObject->isOffScreen()) { >- atk_state_set_add_state(stateSet, ATK_STATE_SHOWING); >- atk_state_set_add_state(stateSet, ATK_STATE_VISIBLE); >- } >- >- // Mutually exclusive, so we group these two >- if (coreObject->roleValue() == AccessibilityRole::TextArea || coreObject->ariaIsMultiline()) >- atk_state_set_add_state(stateSet, ATK_STATE_MULTI_LINE); >- else if (coreObject->roleValue() == AccessibilityRole::TextField || coreObject->roleValue() == AccessibilityRole::SearchField) >- atk_state_set_add_state(stateSet, ATK_STATE_SINGLE_LINE); >- >- // TODO: ATK_STATE_SENSITIVE >- >- if (coreObject->supportsAutoComplete() && coreObject->autoCompleteValue() != "none") >- atk_state_set_add_state(stateSet, ATK_STATE_SUPPORTS_AUTOCOMPLETION); >- >- if (coreObject->isVisited()) >- atk_state_set_add_state(stateSet, ATK_STATE_VISITED); >-} >- >-static AtkStateSet* webkitAccessibleRefStateSet(AtkObject* object) >-{ >- auto* accessible = WEBKIT_ACCESSIBLE(object); >- AtkStateSet* stateSet = ATK_OBJECT_CLASS(webkit_accessible_parent_class)->ref_state_set(object); >- >- // Make sure the layout is updated to really know whether the object >- // is defunct or not, so we can return the proper state. >- if (accessible->priv->object) >- accessible->priv->object->updateBackingStore(); >- if (!accessible->priv->object) { >- atk_state_set_add_state(stateSet, ATK_STATE_DEFUNCT); >- return stateSet; >- } >- >- // Text objects must be focusable. >- AtkRole role = atk_object_get_role(object); >- if (role == ATK_ROLE_TEXT || role == ATK_ROLE_PARAGRAPH) >- atk_state_set_add_state(stateSet, ATK_STATE_FOCUSABLE); >- >- setAtkStateSetFromCoreObject(accessible->priv->object, stateSet); >- return stateSet; >-} >- >-static AtkRelationSet* webkitAccessibleRefRelationSet(AtkObject* object) >-{ >- auto* accessible = WEBKIT_ACCESSIBLE(object); >- returnValIfWebKitAccessibleIsInvalid(accessible, nullptr); >- >- AtkRelationSet* relationSet = ATK_OBJECT_CLASS(webkit_accessible_parent_class)->ref_relation_set(object); >- if (accessible->priv->object) >- setAtkRelationSetFromCoreObject(accessible->priv->object, relationSet); >- return relationSet; >-} >- >-static void webkitAccessibleInit(AtkObject* object, gpointer data) >-{ >- if (ATK_OBJECT_CLASS(webkit_accessible_parent_class)->initialize) >- ATK_OBJECT_CLASS(webkit_accessible_parent_class)->initialize(object, data); >- >- WebKitAccessible* accessible = WEBKIT_ACCESSIBLE(object); >- accessible->priv->object = reinterpret_cast<AccessibilityObject*>(data); >-} >- >-static const gchar* webkitAccessibleGetObjectLocale(AtkObject* object) >-{ >- 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(); >- if (!language.isEmpty()) >- return webkitAccessibleCacheAndReturnAtkProperty(accessible, AtkCachedDocumentLocale, language.utf8()); >- >- } else if (ATK_IS_TEXT(object)) { >- const gchar* locale = nullptr; >- >- AtkAttributeSet* textAttributes = atk_text_get_default_attributes(ATK_TEXT(object)); >- for (auto* attributes = textAttributes; attributes; attributes = attributes->next) { >- auto* atkAttribute = static_cast<AtkAttribute*>(attributes->data); >- if (!strcmp(atkAttribute->name, atk_text_attribute_get_name(ATK_TEXT_ATTR_LANGUAGE))) { >- locale = webkitAccessibleCacheAndReturnAtkProperty(accessible, AtkCachedDocumentLocale, atkAttribute->value); >- break; >- } >- } >- atk_attribute_set_free(textAttributes); >- >- return locale; >- } >- >- return nullptr; >-} >- >-static void webkit_accessible_class_init(WebKitAccessibleClass* klass) >-{ >- auto* atkObjectClass = ATK_OBJECT_CLASS(klass); >- atkObjectClass->initialize = webkitAccessibleInit; >- atkObjectClass->get_name = webkitAccessibleGetName; >- atkObjectClass->get_description = webkitAccessibleGetDescription; >- atkObjectClass->get_parent = webkitAccessibleGetParent; >- atkObjectClass->get_n_children = webkitAccessibleGetNChildren; >- atkObjectClass->ref_child = webkitAccessibleRefChild; >- atkObjectClass->get_role = webkitAccessibleGetRole; >- atkObjectClass->ref_state_set = webkitAccessibleRefStateSet; >- atkObjectClass->get_index_in_parent = webkitAccessibleGetIndexInParent; >- atkObjectClass->get_attributes = webkitAccessibleGetAttributes; >- atkObjectClass->ref_relation_set = webkitAccessibleRefRelationSet; >- atkObjectClass->get_object_locale = webkitAccessibleGetObjectLocale; >-} >- >-static const GInterfaceInfo atkInterfacesInitFunctions[] = { >- {reinterpret_cast<GInterfaceInitFunc>(reinterpret_cast<GCallback>(webkitAccessibleActionInterfaceInit)), nullptr, nullptr}, >- {reinterpret_cast<GInterfaceInitFunc>(reinterpret_cast<GCallback>(webkitAccessibleSelectionInterfaceInit)), nullptr, nullptr}, >- {reinterpret_cast<GInterfaceInitFunc>(reinterpret_cast<GCallback>(webkitAccessibleEditableTextInterfaceInit)), nullptr, nullptr}, >- {reinterpret_cast<GInterfaceInitFunc>(reinterpret_cast<GCallback>(webkitAccessibleTextInterfaceInit)), nullptr, nullptr}, >- {reinterpret_cast<GInterfaceInitFunc>(reinterpret_cast<GCallback>(webkitAccessibleComponentInterfaceInit)), nullptr, nullptr}, >- {reinterpret_cast<GInterfaceInitFunc>(reinterpret_cast<GCallback>(webkitAccessibleImageInterfaceInit)), nullptr, nullptr}, >- {reinterpret_cast<GInterfaceInitFunc>(reinterpret_cast<GCallback>(webkitAccessibleTableInterfaceInit)), nullptr, nullptr}, >- {reinterpret_cast<GInterfaceInitFunc>(reinterpret_cast<GCallback>(webkitAccessibleTableCellInterfaceInit)), nullptr, nullptr}, >- {reinterpret_cast<GInterfaceInitFunc>(reinterpret_cast<GCallback>(webkitAccessibleHypertextInterfaceInit)), nullptr, nullptr}, >- {reinterpret_cast<GInterfaceInitFunc>(reinterpret_cast<GCallback>(webkitAccessibleHyperlinkImplInterfaceInit)), nullptr, nullptr}, >- {reinterpret_cast<GInterfaceInitFunc>(reinterpret_cast<GCallback>(webkitAccessibleDocumentInterfaceInit)), nullptr, nullptr}, >- {reinterpret_cast<GInterfaceInitFunc>(reinterpret_cast<GCallback>(webkitAccessibleValueInterfaceInit)), nullptr, nullptr} >-}; >- >-enum WAIType { >- WAIAction, >- WAISelection, >- WAIEditableText, >- WAIText, >- WAIComponent, >- WAIImage, >- WAITable, >- WAITableCell, >- WAIHypertext, >- WAIHyperlink, >- WAIDocument, >- WAIValue, >-}; >- >-static GType atkInterfaceTypeFromWAIType(WAIType type) >-{ >- switch (type) { >- case WAIAction: >- return ATK_TYPE_ACTION; >- case WAISelection: >- return ATK_TYPE_SELECTION; >- case WAIEditableText: >- return ATK_TYPE_EDITABLE_TEXT; >- case WAIText: >- return ATK_TYPE_TEXT; >- case WAIComponent: >- return ATK_TYPE_COMPONENT; >- case WAIImage: >- return ATK_TYPE_IMAGE; >- case WAITable: >- return ATK_TYPE_TABLE; >- case WAITableCell: >- return ATK_TYPE_TABLE_CELL; >- case WAIHypertext: >- return ATK_TYPE_HYPERTEXT; >- case WAIHyperlink: >- return ATK_TYPE_HYPERLINK_IMPL; >- case WAIDocument: >- return ATK_TYPE_DOCUMENT; >- case WAIValue: >- return ATK_TYPE_VALUE; >- } >- >- return G_TYPE_INVALID; >-} >- >-static bool roleIsTextType(AccessibilityRole role) >-{ >- return role == AccessibilityRole::Paragraph >- || role == AccessibilityRole::Heading >- || role == AccessibilityRole::Div >- || role == AccessibilityRole::Cell >- || role == AccessibilityRole::Link >- || role == AccessibilityRole::WebCoreLink >- || role == AccessibilityRole::ListItem >- || role == AccessibilityRole::Pre >- || role == AccessibilityRole::GridCell >- || role == AccessibilityRole::TextGroup >- || role == AccessibilityRole::ApplicationTextGroup >- || role == AccessibilityRole::ApplicationGroup; >-} >- >-static guint16 interfaceMaskFromObject(AXCoreObject* coreObject) >-{ >- guint16 interfaceMask = 0; >- >- // Component interface is always supported >- interfaceMask |= 1 << WAIComponent; >- >- AccessibilityRole role = coreObject->roleValue(); >- >- // Action >- // As the implementation of the AtkAction interface is a very >- // basic one (just relays in executing the default action for each >- // object, and only supports having one action per object), it is >- // better just to implement this interface for every instance of >- // the WebKitAccessible class and let WebCore decide what to do. >- interfaceMask |= 1 << WAIAction; >- >- // Selection >- if (coreObject->canHaveSelectedChildren() || coreObject->isMenuList()) >- interfaceMask |= 1 << WAISelection; >- >- // Get renderer if available. >- RenderObject* renderer = nullptr; >- if (coreObject->isAccessibilityRenderObject()) >- renderer = coreObject->renderer(); >- >- // Hyperlink (links and embedded objects). >- if (coreObject->isLink() || (renderer && renderer->isReplacedOrInlineBlock())) >- interfaceMask |= 1 << WAIHyperlink; >- >- // Text, Editable Text & Hypertext >- if (role == AccessibilityRole::StaticText || coreObject->isMenuListOption()) >- interfaceMask |= 1 << WAIText; >- else if (coreObject->isTextControl() || coreObject->isNonNativeTextControl()) { >- interfaceMask |= 1 << WAIText; >- if (coreObject->canSetValueAttribute()) >- interfaceMask |= 1 << WAIEditableText; >- } else if (!coreObject->isWebArea()) { >- if (role != AccessibilityRole::Table) { >- interfaceMask |= 1 << WAIHypertext; >- if ((renderer && renderer->childrenInline()) || roleIsTextType(role) || coreObject->isMathToken()) >- interfaceMask |= 1 << WAIText; >- } >- >- // Add the TEXT interface for list items whose >- // first accessible child has a text renderer >- if (role == AccessibilityRole::ListItem) { >- const auto& children = coreObject->children(); >- if (!children.isEmpty()) >- interfaceMask |= interfaceMaskFromObject(children[0].get()); >- } >- } >- >- // Image >- if (coreObject->isImage()) >- interfaceMask |= 1 << WAIImage; >- >- // Table >- if (coreObject->isTable()) >- interfaceMask |= 1 << WAITable; >- >- if (role == AccessibilityRole::Cell || role == AccessibilityRole::GridCell || role == AccessibilityRole::ColumnHeader || role == AccessibilityRole::RowHeader) >- interfaceMask |= 1 << WAITableCell; >- >- // Document >- if (role == AccessibilityRole::WebArea) >- interfaceMask |= 1 << WAIDocument; >- >- // Value >- if (coreObject->supportsRangeValue()) >- interfaceMask |= 1 << WAIValue; >- >-#if ENABLE(INPUT_TYPE_COLOR) >- // Color type. >- if (role == AccessibilityRole::ColorWell) >- interfaceMask |= 1 << WAIText; >-#endif >- >- return interfaceMask; >-} >- >-static const char* uniqueAccessibilityTypeName(guint16 interfaceMask) >-{ >-#define WAI_TYPE_NAME_LEN (30) // Enough for prefix + 5 hex characters (max). >- static char name[WAI_TYPE_NAME_LEN + 1]; >- >- g_sprintf(name, "WAIType%x", interfaceMask); >- name[WAI_TYPE_NAME_LEN] = '\0'; >- >- return name; >-} >- >-static GType accessibilityTypeFromObject(AccessibilityObject* coreObject) >-{ >- static const GTypeInfo typeInfo = { >- sizeof(WebKitAccessibleClass), >- nullptr, // GBaseInitFunc >- nullptr, // GBaseFinalizeFunc >- nullptr, // GClassInitFunc >- nullptr, // GClassFinalizeFunc >- nullptr, // class data >- sizeof(WebKitAccessible), // instance size >- 0, // nb preallocs >- nullptr, // GInstanceInitFunc >- nullptr // value table >- }; >- >- guint16 interfaceMask = interfaceMaskFromObject(coreObject); >- const char* atkTypeName = uniqueAccessibilityTypeName(interfaceMask); >- if (GType type = g_type_from_name(atkTypeName)) >- return type; >- >- GType type = g_type_register_static(WEBKIT_TYPE_ACCESSIBLE, atkTypeName, &typeInfo, static_cast<GTypeFlags>(0)); >- for (unsigned i = 0; i < G_N_ELEMENTS(atkInterfacesInitFunctions); ++i) { >- if (interfaceMask & (1 << i)) { >- g_type_add_interface_static(type, >- atkInterfaceTypeFromWAIType(static_cast<WAIType>(i)), >- &atkInterfacesInitFunctions[i]); >- } >- } >- >- return type; >-} >- >-WebKitAccessible* webkitAccessibleNew(AccessibilityObject* coreObject) >-{ >- auto* object = ATK_OBJECT(g_object_new(accessibilityTypeFromObject(coreObject), nullptr)); >- atk_object_initialize(object, coreObject); >- return WEBKIT_ACCESSIBLE(object); >-} >- >-AccessibilityObject& webkitAccessibleGetAccessibilityObject(WebKitAccessible* accessible) >-{ >- ASSERT(WEBKIT_IS_ACCESSIBLE(accessible)); >- ASSERT(accessible->priv->object); >- return *accessible->priv->object; >-} >- >-void webkitAccessibleDetach(WebKitAccessible* accessible) >-{ >- ASSERT(WEBKIT_IS_ACCESSIBLE(accessible)); >- >- if (accessible->priv->object && accessible->priv->object->roleValue() == AccessibilityRole::WebArea) >- atk_object_notify_state_change(ATK_OBJECT(accessible), ATK_STATE_DEFUNCT, TRUE); >- >- accessible->priv->object = nullptr; >-} >- >-bool webkitAccessibleIsDetached(WebKitAccessible* accessible) >-{ >- ASSERT(WEBKIT_IS_ACCESSIBLE(accessible)); >- return !accessible->priv->object; >-} >- >-const char* webkitAccessibleCacheAndReturnAtkProperty(WebKitAccessible* accessible, AtkCachedProperty property, CString&& value) >-{ >- ASSERT(WEBKIT_IS_ACCESSIBLE(accessible)); >- >- WebKitAccessiblePrivate* priv = accessible->priv; >- CString* propertyPtr = nullptr; >- >- switch (property) { >- case AtkCachedAccessibleName: >- propertyPtr = &priv->accessibleName; >- break; >- case AtkCachedAccessibleDescription: >- propertyPtr = &priv->accessibleDescription; >- break; >- case AtkCachedActionName: >- propertyPtr = &priv->actionName; >- break; >- case AtkCachedActionKeyBinding: >- propertyPtr = &priv->actionKeyBinding; >- break; >- case AtkCachedDocumentLocale: >- propertyPtr = &priv->documentLocale; >- break; >- case AtkCachedDocumentType: >- propertyPtr = &priv->documentType; >- break; >- case AtkCachedDocumentEncoding: >- propertyPtr = &priv->documentEncoding; >- break; >- case AtkCachedDocumentURI: >- propertyPtr = &priv->documentURI; >- break; >- case AtkCachedImageDescription: >- propertyPtr = &priv->imageDescription; >- break; >- default: >- ASSERT_NOT_REACHED(); >- } >- >- // Don't invalidate old memory if not stricly needed, since other >- // callers might be still holding on to it. >- if (*propertyPtr != value) >- *propertyPtr = WTFMove(value); >- >- return (*propertyPtr).data(); >-} >- >-#endif // ENABLE(ACCESSIBILITY) && USE(ATK) >diff --git a/Source/WebCore/accessibility/atk/WebKitAccessible.h b/Source/WebCore/accessibility/atk/WebKitAccessible.h >deleted file mode 100644 >index ef9236a73e48..000000000000 >--- a/Source/WebCore/accessibility/atk/WebKitAccessible.h >+++ /dev/null >@@ -1,88 +0,0 @@ >-/* >- * Copyright (C) 2008 Nuanti Ltd. >- * Copyright (C) 2009 Jan Alonzo >- * Copyright (C) 2009, 2010, 2011, 2012, 2019 Igalia S.L. >- * Copyright (C) 2013 Samsung Electronics >- * >- * This library is free software; you can redistribute it and/or >- * modify it under the terms of the GNU Library General Public >- * License as published by the Free Software Foundation; either >- * version 2 of the License, or (at your option) any later version. >- * >- * This library is distributed in the hope that it will be useful, >- * but WITHOUT ANY WARRANTY; without even the implied warranty of >- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- * Library General Public License for more details. >- * >- * You should have received a copy of the GNU Library General Public License >- * along with this library; see the file COPYING.LIB. If not, write to >- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >- * Boston, MA 02110-1301, USA. >- */ >- >-#pragma once >- >-#if ENABLE(ACCESSIBILITY) && USE(ATK) >- >-#include <atk/atk.h> >-#include <wtf/text/WTFString.h> >- >-namespace WebCore { >-class AccessibilityObject; >-} >- >-G_BEGIN_DECLS >- >-#define WEBKIT_TYPE_ACCESSIBLE (webkit_accessible_get_type()) >-#define WEBKIT_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_ACCESSIBLE, WebKitAccessible)) >-#define WEBKIT_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), WEBKIT_TYPE_ACCESSIBLE, WebKitAccessibleClass)) >-#define WEBKIT_IS_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_TYPE_ACCESSIBLE)) >-#define WEBKIT_IS_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), WEBKIT_TYPE_ACCESSIBLE)) >-#define WEBKIT_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), WEBKIT_TYPE_ACCESSIBLE, WebKitAccessibleClass)) >- >-typedef struct _WebKitAccessible WebKitAccessible; >-typedef struct _WebKitAccessibleClass WebKitAccessibleClass; >-typedef struct _WebKitAccessiblePrivate WebKitAccessiblePrivate; >- >- >-struct _WebKitAccessible { >- AtkObject parent; >- >- WebKitAccessiblePrivate *priv; >-}; >- >-struct _WebKitAccessibleClass { >- AtkObjectClass parentClass; >-}; >- >-GType webkit_accessible_get_type(void); >- >-G_END_DECLS >- >-// The definitions below are only used in C++ code, and some use C++ types, >-// therefore they should be outside of the G_BEGIN_DECLS/G_END_DECLS block >-// to make them use the C++ ABI. >- >-enum AtkCachedProperty { >- AtkCachedAccessibleName, >- AtkCachedAccessibleDescription, >- AtkCachedActionName, >- AtkCachedActionKeyBinding, >- AtkCachedDocumentLocale, >- AtkCachedDocumentType, >- AtkCachedDocumentEncoding, >- AtkCachedDocumentURI, >- AtkCachedImageDescription >-}; >- >-WebKitAccessible* webkitAccessibleNew(WebCore::AccessibilityObject*); >- >-WebCore::AccessibilityObject& webkitAccessibleGetAccessibilityObject(WebKitAccessible*); >- >-void webkitAccessibleDetach(WebKitAccessible*); >- >-bool webkitAccessibleIsDetached(WebKitAccessible*); >- >-const char* webkitAccessibleCacheAndReturnAtkProperty(WebKitAccessible*, AtkCachedProperty, CString&&); >- >-#endif // ENABLE(ACCESSIBILITY) && USE(ATK) >diff --git a/Source/WebCore/accessibility/atk/WebKitAccessibleHyperlink.cpp b/Source/WebCore/accessibility/atk/WebKitAccessibleHyperlink.cpp >deleted file mode 100644 >index 8dde624df0b4..000000000000 >--- a/Source/WebCore/accessibility/atk/WebKitAccessibleHyperlink.cpp >+++ /dev/null >@@ -1,316 +0,0 @@ >-/* >- * Copyright (C) 2010, 2011, 2012 Igalia S.L. >- * Copyright (C) 2013 Samsung Electronics >- * >- * This library is free software; you can redistribute it and/or >- * modify it under the terms of the GNU Library General Public >- * License as published by the Free Software Foundation; either >- * version 2 of the License, or (at your option) any later version. >- * >- * This library is distributed in the hope that it will be useful, >- * but WITHOUT ANY WARRANTY; without even the implied warranty of >- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- * Library General Public License for more details. >- * >- * You should have received a copy of the GNU Library General Public License >- * along with this library; see the file COPYING.LIB. If not, write to >- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >- * Boston, MA 02110-1301, USA. >- */ >- >-#include "config.h" >-#include "WebKitAccessibleHyperlink.h" >- >-#if ENABLE(ACCESSIBILITY) && USE(ATK) >- >-#include "AXObjectCache.h" >-#include "AccessibilityObject.h" >-#include "Editing.h" >-#include "NotImplemented.h" >-#include "Position.h" >-#include "Range.h" >-#include "RenderListMarker.h" >-#include "RenderObject.h" >-#include "TextIterator.h" >-#include "WebKitAccessible.h" >-#include "WebKitAccessibleUtil.h" >-#include <wtf/glib/WTFGType.h> >-#include <wtf/text/CString.h> >- >-using namespace WebCore; >- >-static void webkit_accessible_hyperlink_atk_action_interface_init(AtkActionIface*); >- >-struct _WebKitAccessibleHyperlinkPrivate { >- WebKitAccessible* hyperlinkImpl; >- >- // We cache these values so we can return them as const values. >- CString actionName; >- CString actionKeyBinding; >-}; >- >-WEBKIT_DEFINE_TYPE_WITH_CODE( >- WebKitAccessibleHyperlink, webkit_accessible_hyperlink, ATK_TYPE_HYPERLINK, >- G_IMPLEMENT_INTERFACE(ATK_TYPE_ACTION, webkit_accessible_hyperlink_atk_action_interface_init)) >- >-enum { >- PROP_0, >- >- PROP_HYPERLINK_IMPL >-}; >- >-static gboolean webkitAccessibleHyperlinkActionDoAction(AtkAction* action, gint) >-{ >- auto* accessibleHyperlink = WEBKIT_ACCESSIBLE_HYPERLINK(action); >- returnValIfWebKitAccessibleIsInvalid(accessibleHyperlink->priv->hyperlinkImpl, FALSE); >- >- if (!ATK_IS_ACTION(accessibleHyperlink->priv->hyperlinkImpl)) >- return FALSE; >- >- auto& coreObject = webkitAccessibleGetAccessibilityObject(accessibleHyperlink->priv->hyperlinkImpl); >- return coreObject.performDefaultAction(); >-} >- >-static gint webkitAccessibleHyperlinkActionGetNActions(AtkAction* action) >-{ >- auto* accessibleHyperlink = WEBKIT_ACCESSIBLE_HYPERLINK(action); >- returnValIfWebKitAccessibleIsInvalid(accessibleHyperlink->priv->hyperlinkImpl, 0); >- >- return ATK_IS_ACTION(accessibleHyperlink->priv->hyperlinkImpl) ? 1 : 0; >-} >- >-static const gchar* webkitAccessibleHyperlinkActionGetDescription(AtkAction* action, gint) >-{ >- auto* accessibleHyperlink = WEBKIT_ACCESSIBLE_HYPERLINK(action); >- returnValIfWebKitAccessibleIsInvalid(accessibleHyperlink->priv->hyperlinkImpl, nullptr); >- >- // TODO: Need a way to provide/localize action descriptions. >- notImplemented(); >- return ""; >-} >- >-static const gchar* webkitAccessibleHyperlinkActionGetKeybinding(AtkAction* action, gint) >-{ >- auto* accessibleHyperlink = WEBKIT_ACCESSIBLE_HYPERLINK(action); >- returnValIfWebKitAccessibleIsInvalid(accessibleHyperlink->priv->hyperlinkImpl, nullptr); >- >- if (!ATK_IS_ACTION(accessibleHyperlink->priv->hyperlinkImpl)) >- return nullptr; >- >- auto& coreObject = webkitAccessibleGetAccessibilityObject(accessibleHyperlink->priv->hyperlinkImpl); >- accessibleHyperlink->priv->actionKeyBinding = coreObject.accessKey().utf8(); >- return accessibleHyperlink->priv->actionKeyBinding.data(); >-} >- >-static const gchar* webkitAccessibleHyperlinkActionGetName(AtkAction* action, gint) >-{ >- auto* accessibleHyperlink = WEBKIT_ACCESSIBLE_HYPERLINK(action); >- returnValIfWebKitAccessibleIsInvalid(accessibleHyperlink->priv->hyperlinkImpl, nullptr); >- >- if (!ATK_IS_ACTION(accessibleHyperlink->priv->hyperlinkImpl)) >- return nullptr; >- >- auto& coreObject = webkitAccessibleGetAccessibilityObject(accessibleHyperlink->priv->hyperlinkImpl); >- accessibleHyperlink->priv->actionName = coreObject.localizedActionVerb().utf8(); >- return accessibleHyperlink->priv->actionName.data(); >-} >- >-static void webkit_accessible_hyperlink_atk_action_interface_init(AtkActionIface* iface) >-{ >- iface->do_action = webkitAccessibleHyperlinkActionDoAction; >- iface->get_n_actions = webkitAccessibleHyperlinkActionGetNActions; >- iface->get_description = webkitAccessibleHyperlinkActionGetDescription; >- iface->get_keybinding = webkitAccessibleHyperlinkActionGetKeybinding; >- iface->get_name = webkitAccessibleHyperlinkActionGetName; >-} >- >-static gchar* webkitAccessibleHyperlinkGetURI(AtkHyperlink* link, gint index) >-{ >- // FIXME: Do NOT support more than one instance of an AtkObject >- // implementing AtkHyperlinkImpl in every instance of AtkHyperLink >- if (index) >- return nullptr; >- >- auto* accessibleHyperlink = WEBKIT_ACCESSIBLE_HYPERLINK(link); >- returnValIfWebKitAccessibleIsInvalid(accessibleHyperlink->priv->hyperlinkImpl, nullptr); >- >- auto& coreObject = webkitAccessibleGetAccessibilityObject(accessibleHyperlink->priv->hyperlinkImpl); >- return !coreObject.url().isNull() ? g_strdup(coreObject.url().string().utf8().data()) : nullptr; >-} >- >-static AtkObject* webkitAccessibleHyperlinkGetObject(AtkHyperlink* link, gint index) >-{ >- // FIXME: Do NOT support more than one instance of an AtkObject >- // implementing AtkHyperlinkImpl in every instance of AtkHyperLink >- if (index) >- return nullptr; >- >- auto* accessibleHyperlink = WEBKIT_ACCESSIBLE_HYPERLINK(link); >- returnValIfWebKitAccessibleIsInvalid(accessibleHyperlink->priv->hyperlinkImpl, 0); >- >- return ATK_OBJECT(accessibleHyperlink->priv->hyperlinkImpl); >-} >- >-static gint rangeLengthForObject(AccessibilityObject& obj, const std::optional<SimpleRange>& range) >-{ >- if (!range) >- return 0; >- >- // This is going to be the actual length in most of the cases >- int baseLength = characterCount(*range, TextIteratorBehavior::EmitsCharactersBetweenAllVisiblePositions); >- >- // Check whether the current hyperlink belongs to a list item. >- // If so, we need to consider the length of the item's marker >- AXCoreObject* parent = obj.parentObjectUnignored(); >- if (!parent || !parent->isAccessibilityRenderObject() || !parent->isListItem()) >- return baseLength; >- >- // Even if we don't expose list markers to Assistive >- // Technologies, we need to have a way to measure their length >- // for those cases when it's needed to take it into account >- // separately (as in getAccessibilityObjectForOffset) >- AXCoreObject* markerObj = parent->firstChild(); >- if (!markerObj) >- return baseLength; >- >- RenderObject* renderer = markerObj->renderer(); >- if (!is<RenderListMarker>(renderer)) >- return baseLength; >- >- return baseLength + downcast<RenderListMarker>(*renderer).textWithSuffix().length(); >-} >- >-static gint webkitAccessibleHyperlinkGetStartIndex(AtkHyperlink* link) >-{ >- auto* accessibleHyperlink = WEBKIT_ACCESSIBLE_HYPERLINK(link); >- returnValIfWebKitAccessibleIsInvalid(accessibleHyperlink->priv->hyperlinkImpl, 0); >- >- auto& coreObject = webkitAccessibleGetAccessibilityObject(accessibleHyperlink->priv->hyperlinkImpl); >- AXCoreObject* parentUnignored = coreObject.parentObjectUnignored(); >- if (!parentUnignored) >- return 0; >- >- Node* node = coreObject.node(); >- if (!node) >- return 0; >- >- Node* parentNode = parentUnignored->node(); >- if (!parentNode) >- return 0; >- >- return rangeLengthForObject(coreObject, makeSimpleRange(firstPositionInOrBeforeNode(parentNode), firstPositionInOrBeforeNode(node))); >-} >- >-static gint webkitAccessibleHyperlinkGetEndIndex(AtkHyperlink* link) >-{ >- auto* accessibleHyperlink = WEBKIT_ACCESSIBLE_HYPERLINK(link); >- returnValIfWebKitAccessibleIsInvalid(accessibleHyperlink->priv->hyperlinkImpl, 0); >- >- auto& coreObject = webkitAccessibleGetAccessibilityObject(accessibleHyperlink->priv->hyperlinkImpl); >- AXCoreObject* parentUnignored = coreObject.parentObjectUnignored(); >- if (!parentUnignored) >- return 0; >- >- Node* node = coreObject.node(); >- if (!node) >- return 0; >- >- Node* parentNode = parentUnignored->node(); >- if (!parentNode) >- return 0; >- >- return rangeLengthForObject(coreObject, makeSimpleRange(firstPositionInOrBeforeNode(parentNode), lastPositionInOrAfterNode(node))); >-} >- >-static gboolean webkitAccessibleHyperlinkIsValid(AtkHyperlink* link) >-{ >- auto* accessibleHyperlink = WEBKIT_ACCESSIBLE_HYPERLINK(link); >- returnValIfWebKitAccessibleIsInvalid(accessibleHyperlink->priv->hyperlinkImpl, FALSE); >- >- // Link is valid for the whole object's lifetime >- return TRUE; >-} >- >-static gint webkitAccessibleHyperlinkGetNAnchors(AtkHyperlink* link) >-{ >- // FIXME Do NOT support more than one instance of an AtkObject >- // implementing AtkHyperlinkImpl in every instance of AtkHyperLink >- auto* accessibleHyperlink = WEBKIT_ACCESSIBLE_HYPERLINK(link); >- returnValIfWebKitAccessibleIsInvalid(accessibleHyperlink->priv->hyperlinkImpl, 0); >- >- return 1; >-} >- >-static gboolean webkitAccessibleHyperlinkIsSelectedLink(AtkHyperlink* link) >-{ >- auto* accessibleHyperlink = WEBKIT_ACCESSIBLE_HYPERLINK(link); >- returnValIfWebKitAccessibleIsInvalid(accessibleHyperlink->priv->hyperlinkImpl, FALSE); >- >- // Not implemented: this function is deprecated in ATK now >- notImplemented(); >- return FALSE; >-} >- >-static void webkitAccessibleHyperlinkGetProperty(GObject* object, guint propId, GValue* value, GParamSpec* pspec) >-{ >- auto* accessibleHyperlink = WEBKIT_ACCESSIBLE_HYPERLINK(object); >- >- switch (propId) { >- case PROP_HYPERLINK_IMPL: >- g_value_set_object(value, accessibleHyperlink->priv->hyperlinkImpl); >- break; >- default: >- G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propId, pspec); >- } >-} >- >-static void webkitAccessibleHyperlinkSetProperty(GObject* object, guint propId, const GValue* value, GParamSpec* pspec) >-{ >- auto* accessibleHyperlink = WEBKIT_ACCESSIBLE_HYPERLINK(object); >- >- switch (propId) { >- case PROP_HYPERLINK_IMPL: >- accessibleHyperlink->priv->hyperlinkImpl = WEBKIT_ACCESSIBLE(g_value_get_object(value)); >- break; >- default: >- G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propId, pspec); >- } >-} >- >-static void webkit_accessible_hyperlink_class_init(WebKitAccessibleHyperlinkClass* klass) >-{ >- GObjectClass* gobjectClass = G_OBJECT_CLASS(klass); >- gobjectClass->set_property = webkitAccessibleHyperlinkSetProperty; >- gobjectClass->get_property = webkitAccessibleHyperlinkGetProperty; >- >- AtkHyperlinkClass* atkHyperlinkClass = ATK_HYPERLINK_CLASS(klass); >- atkHyperlinkClass->get_uri = webkitAccessibleHyperlinkGetURI; >- atkHyperlinkClass->get_object = webkitAccessibleHyperlinkGetObject; >- atkHyperlinkClass->get_start_index = webkitAccessibleHyperlinkGetStartIndex; >- atkHyperlinkClass->get_end_index = webkitAccessibleHyperlinkGetEndIndex; >- atkHyperlinkClass->is_valid = webkitAccessibleHyperlinkIsValid; >- atkHyperlinkClass->get_n_anchors = webkitAccessibleHyperlinkGetNAnchors; >- atkHyperlinkClass->is_selected_link = webkitAccessibleHyperlinkIsSelectedLink; >- >- g_object_class_install_property(gobjectClass, PROP_HYPERLINK_IMPL, >- g_param_spec_object("hyperlink-impl", >- "Hyperlink implementation", >- "The associated WebKitAccessible instance.", >- WEBKIT_TYPE_ACCESSIBLE, >- static_cast<GParamFlags>(WEBKIT_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY))); >-} >- >-WebKitAccessibleHyperlink* webkitAccessibleHyperlinkGetOrCreate(AtkHyperlinkImpl* hyperlinkImpl) >-{ >- g_return_val_if_fail(ATK_IS_HYPERLINK_IMPL(hyperlinkImpl), nullptr); >- g_return_val_if_fail(WEBKIT_IS_ACCESSIBLE(hyperlinkImpl), nullptr); >- >- if (auto* currentHyperLink = g_object_get_data(G_OBJECT(hyperlinkImpl), "webkit-accessible-hyperlink-object")) >- return WEBKIT_ACCESSIBLE_HYPERLINK(g_object_ref(currentHyperLink)); >- >- auto* hyperlink = WEBKIT_ACCESSIBLE_HYPERLINK(g_object_new(WEBKIT_TYPE_ACCESSIBLE_HYPERLINK, "hyperlink-impl", hyperlinkImpl, nullptr)); >- g_object_set_data_full(G_OBJECT(hyperlinkImpl), "webkit-accessible-hyperlink-object", hyperlink, g_object_unref); >- return hyperlink; >-} >- >-#endif // ENABLE(ACCESSIBILITY) && USE(ATK) >diff --git a/Source/WebCore/accessibility/atk/WebKitAccessibleHyperlink.h b/Source/WebCore/accessibility/atk/WebKitAccessibleHyperlink.h >deleted file mode 100644 >index 19fa9c1dc7f7..000000000000 >--- a/Source/WebCore/accessibility/atk/WebKitAccessibleHyperlink.h >+++ /dev/null >@@ -1,55 +0,0 @@ >-/* >- * Copyright (C) 2010, 2011, 2012 Igalia S.L. >- * >- * This library is free software; you can redistribute it and/or >- * modify it under the terms of the GNU Library General Public >- * License as published by the Free Software Foundation; either >- * version 2 of the License, or (at your option) any later version. >- * >- * This library is distributed in the hope that it will be useful, >- * but WITHOUT ANY WARRANTY; without even the implied warranty of >- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- * Library General Public License for more details. >- * >- * You should have received a copy of the GNU Library General Public License >- * along with this library; see the file COPYING.LIB. If not, write to >- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >- * Boston, MA 02110-1301, USA. >- */ >- >-#pragma once >- >-#if ENABLE(ACCESSIBILITY) && USE(ATK) >- >-#include <atk/atk.h> >- >-G_BEGIN_DECLS >- >-#define WEBKIT_TYPE_ACCESSIBLE_HYPERLINK (webkit_accessible_hyperlink_get_type()) >-#define WEBKIT_ACCESSIBLE_HYPERLINK(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_ACCESSIBLE_HYPERLINK, WebKitAccessibleHyperlink)) >-#define WEBKIT_ACCESSIBLE_HYPERLINK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), WEBKIT_TYPE_ACCESSIBLE_HYPERLINK, WebKitAccessibleHyperlinkClass)) >-#define WEBKIT_IS_ACCESSIBLE_HYPERLINK(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_TYPE_ACCESSIBLE_HYPERLINK)) >-#define WEBKIT_IS_ACCESSIBLE_HYPERLINK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), WEBKIT_TYPE_ACCESSIBLE_HYPERLINK)) >-#define WEBKIT_ACCESSIBLE_HYPERLINK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), WEBKIT_TYPE_ACCESSIBLE_HYPERLINK, WebKitAccessibleHyperlinkClass)) >- >-typedef struct _WebKitAccessibleHyperlink WebKitAccessibleHyperlink; >-typedef struct _WebKitAccessibleHyperlinkClass WebKitAccessibleHyperlinkClass; >-typedef struct _WebKitAccessibleHyperlinkPrivate WebKitAccessibleHyperlinkPrivate; >- >-struct _WebKitAccessibleHyperlink { >- AtkHyperlink parent; >- >- WebKitAccessibleHyperlinkPrivate *priv; >-}; >- >-struct _WebKitAccessibleHyperlinkClass { >- AtkHyperlinkClass parentClass; >-}; >- >-GType webkit_accessible_hyperlink_get_type(void); >- >-WebKitAccessibleHyperlink* webkitAccessibleHyperlinkGetOrCreate(AtkHyperlinkImpl*); >- >-G_END_DECLS >- >-#endif // ENABLE(ACCESSIBILITY) && USE(ATK) >diff --git a/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceAction.cpp b/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceAction.cpp >deleted file mode 100644 >index 636e585011a6..000000000000 >--- a/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceAction.cpp >+++ /dev/null >@@ -1,106 +0,0 @@ >-/* >- * Copyright (C) 2008 Nuanti Ltd. >- * Copyright (C) 2009 Jan Alonzo >- * Copyright (C) 2012 Igalia S.L. >- * Copyright (C) 2013 Samsung Electronics >- * >- * Portions from Mozilla a11y, copyright as follows: >- * >- * The Original Code is mozilla.org code. >- * >- * The Initial Developer of the Original Code is >- * Sun Microsystems, Inc. >- * Portions created by the Initial Developer are Copyright (C) 2002 >- * the Initial Developer. All Rights Reserved. >- * >- * This library is free software; you can redistribute it and/or >- * modify it under the terms of the GNU Library General Public >- * License as published by the Free Software Foundation; either >- * version 2 of the License, or (at your option) any later version. >- * >- * This library is distributed in the hope that it will be useful, >- * but WITHOUT ANY WARRANTY; without even the implied warranty of >- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- * Library General Public License for more details. >- * >- * You should have received a copy of the GNU Library General Public License >- * along with this library; see the file COPYING.LIB. If not, write to >- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >- * Boston, MA 02110-1301, USA. >- */ >- >-#include "config.h" >-#include "WebKitAccessibleInterfaceAction.h" >- >-#if ENABLE(ACCESSIBILITY) && USE(ATK) >- >-#include "AccessibilityObject.h" >-#include "NotImplemented.h" >-#include "WebKitAccessible.h" >-#include "WebKitAccessibleUtil.h" >- >-using namespace WebCore; >- >-static AccessibilityObject* core(AtkAction* action) >-{ >- if (!WEBKIT_IS_ACCESSIBLE(action)) >- return 0; >- >- return &webkitAccessibleGetAccessibilityObject(WEBKIT_ACCESSIBLE(action)); >-} >- >-static gboolean webkitAccessibleActionDoAction(AtkAction* action, gint index) >-{ >- g_return_val_if_fail(ATK_IS_ACTION(action), FALSE); >- g_return_val_if_fail(!index, FALSE); >- >- returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(action), FALSE); >- >- return core(action)->performDefaultAction(); >-} >- >-static gint webkitAccessibleActionGetNActions(AtkAction* action) >-{ >- g_return_val_if_fail(ATK_IS_ACTION(action), 0); >- returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(action), 0); >- >- return 1; >-} >- >-static const gchar* webkitAccessibleActionGetDescription(AtkAction* action, gint) >-{ >- g_return_val_if_fail(ATK_IS_ACTION(action), 0); >- returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(action), 0); >- >- // TODO: Need a way to provide/localize action descriptions. >- notImplemented(); >- return ""; >-} >- >-static const gchar* webkitAccessibleActionGetKeybinding(AtkAction* action, gint) >-{ >- auto* accessible = WEBKIT_ACCESSIBLE(action); >- returnValIfWebKitAccessibleIsInvalid(accessible, nullptr); >- >- // FIXME: Construct a proper keybinding string. >- return webkitAccessibleCacheAndReturnAtkProperty(accessible, AtkCachedActionKeyBinding, core(action)->accessKey().utf8()); >-} >- >-static const gchar* webkitAccessibleActionGetName(AtkAction* action, gint) >-{ >- auto* accessible = WEBKIT_ACCESSIBLE(action); >- returnValIfWebKitAccessibleIsInvalid(accessible, nullptr); >- >- return webkitAccessibleCacheAndReturnAtkProperty(accessible, AtkCachedActionName, core(action)->localizedActionVerb().utf8()); >-} >- >-void webkitAccessibleActionInterfaceInit(AtkActionIface* iface) >-{ >- iface->do_action = webkitAccessibleActionDoAction; >- iface->get_n_actions = webkitAccessibleActionGetNActions; >- iface->get_description = webkitAccessibleActionGetDescription; >- iface->get_keybinding = webkitAccessibleActionGetKeybinding; >- iface->get_name = webkitAccessibleActionGetName; >-} >- >-#endif >diff --git a/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceAction.h b/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceAction.h >deleted file mode 100644 >index 02d7596d937b..000000000000 >--- a/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceAction.h >+++ /dev/null >@@ -1,30 +0,0 @@ >-/* >- * Copyright (C) 2008 Nuanti Ltd. >- * Copyright (C) 2009 Jan Alonzo >- * Copyright (C) 2012 Igalia S.L. >- * >- * This library is free software; you can redistribute it and/or >- * modify it under the terms of the GNU Library General Public >- * License as published by the Free Software Foundation; either >- * version 2 of the License, or (at your option) any later version. >- * >- * This library is distributed in the hope that it will be useful, >- * but WITHOUT ANY WARRANTY; without even the implied warranty of >- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- * Library General Public License for more details. >- * >- * You should have received a copy of the GNU Library General Public License >- * along with this library; see the file COPYING.LIB. If not, write to >- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >- * Boston, MA 02110-1301, USA. >- */ >- >-#pragma once >- >-#if ENABLE(ACCESSIBILITY) && USE(ATK) >- >-#include <atk/atk.h> >- >-void webkitAccessibleActionInterfaceInit(AtkActionIface*); >- >-#endif // ENABLE(ACCESSIBILITY) && USE(ATK) >diff --git a/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceComponent.cpp b/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceComponent.cpp >deleted file mode 100644 >index 98457aadf059..000000000000 >--- a/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceComponent.cpp >+++ /dev/null >@@ -1,172 +0,0 @@ >-/* >- * Copyright (C) 2008 Nuanti Ltd. >- * Copyright (C) 2009 Jan Alonzo >- * Copyright (C) 2009, 2012 Igalia S.L. >- * >- * Portions from Mozilla a11y, copyright as follows: >- * >- * The Original Code is mozilla.org code. >- * >- * The Initial Developer of the Original Code is >- * Sun Microsystems, Inc. >- * Portions created by the Initial Developer are Copyright (C) 2002 >- * the Initial Developer. All Rights Reserved. >- * >- * This library is free software; you can redistribute it and/or >- * modify it under the terms of the GNU Library General Public >- * License as published by the Free Software Foundation; either >- * version 2 of the License, or (at your option) any later version. >- * >- * This library is distributed in the hope that it will be useful, >- * but WITHOUT ANY WARRANTY; without even the implied warranty of >- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- * Library General Public License for more details. >- * >- * You should have received a copy of the GNU Library General Public License >- * along with this library; see the file COPYING.LIB. If not, write to >- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >- * Boston, MA 02110-1301, USA. >- */ >- >-#include "config.h" >-#include "WebKitAccessibleInterfaceComponent.h" >- >-#if ENABLE(ACCESSIBILITY) && USE(ATK) >- >-#include "AccessibilityObject.h" >-#include "FrameView.h" >-#include "IntRect.h" >-#include "RenderLayer.h" >-#include "WebKitAccessible.h" >-#include "WebKitAccessibleUtil.h" >- >-using namespace WebCore; >- >-static IntPoint atkToContents(const AccessibilityObject& coreObject, AtkCoordType coordType, gint x, gint y) >-{ >- auto* frameView = coreObject.documentFrameView(); >- if (!frameView) >- return { x, y }; >- >- switch (coordType) { >- case ATK_XY_SCREEN: >- return frameView->screenToContents({ x, y }); >- case ATK_XY_WINDOW: >- return frameView->windowToContents({ x, y }); >-#if ATK_CHECK_VERSION(2, 30, 0) >- case ATK_XY_PARENT: >- RELEASE_ASSERT_NOT_REACHED(); >-#endif >- } >- >- return { x, y }; >-} >- >-static AtkObject* webkitAccessibleComponentRefAccessibleAtPoint(AtkComponent* component, gint x, gint y, AtkCoordType coordType) >-{ >- auto* accessible = WEBKIT_ACCESSIBLE(component); >- returnValIfWebKitAccessibleIsInvalid(accessible, nullptr); >- >- auto& coreObject = webkitAccessibleGetAccessibilityObject(accessible); >- auto* target = downcast<AccessibilityObject>(coreObject.accessibilityHitTest(atkToContents(coreObject, coordType, x, y))); >- if (!target) >- return nullptr; >- >- if (auto* wrapper = target->wrapper()) >- return ATK_OBJECT(g_object_ref(wrapper)); >- >- return nullptr; >-} >- >-static void webkitAccessibleComponentGetExtents(AtkComponent* component, gint* x, gint* y, gint* width, gint* height, AtkCoordType coordType) >-{ >- auto* accessible = WEBKIT_ACCESSIBLE(component); >- returnIfWebKitAccessibleIsInvalid(accessible); >- >- auto& coreObject = webkitAccessibleGetAccessibilityObject(accessible); >- contentsRelativeToAtkCoordinateType(&coreObject, coordType, snappedIntRect(coreObject.elementRect()), x, y, width, height); >-} >- >-static gboolean webkitAccessibleComponentGrabFocus(AtkComponent* component) >-{ >- auto* accessible = WEBKIT_ACCESSIBLE(component); >- returnValIfWebKitAccessibleIsInvalid(accessible, FALSE); >- >- auto& coreObject = webkitAccessibleGetAccessibilityObject(accessible); >- coreObject.setFocused(true); >- return coreObject.isFocused(); >-} >- >-#if ATK_CHECK_VERSION(2, 30, 0) >-static gboolean webkitAccessibleComponentScrollTo(AtkComponent* component, AtkScrollType scrollType) >-{ >- auto* accessible = WEBKIT_ACCESSIBLE(component); >- returnValIfWebKitAccessibleIsInvalid(accessible, FALSE); >- >- ScrollAlignment alignX; >- ScrollAlignment alignY; >- >- switch (scrollType) { >- case ATK_SCROLL_TOP_LEFT: >- alignX = ScrollAlignment::alignLeftAlways; >- alignY = ScrollAlignment::alignTopAlways; >- break; >- case ATK_SCROLL_BOTTOM_RIGHT: >- alignX = ScrollAlignment::alignRightAlways; >- alignY = ScrollAlignment::alignBottomAlways; >- break; >- case ATK_SCROLL_TOP_EDGE: >- case ATK_SCROLL_BOTTOM_EDGE: >- // Align to a particular edge is not supported, it's always the closest edge. >- alignX = ScrollAlignment::alignCenterIfNeeded; >- alignY = ScrollAlignment::alignToEdgeIfNeeded; >- break; >- case ATK_SCROLL_LEFT_EDGE: >- case ATK_SCROLL_RIGHT_EDGE: >- // Align to a particular edge is not supported, it's always the closest edge. >- alignX = ScrollAlignment::alignToEdgeIfNeeded; >- alignY = ScrollAlignment::alignCenterIfNeeded; >- break; >- case ATK_SCROLL_ANYWHERE: >- alignX = ScrollAlignment::alignCenterIfNeeded; >- alignY = ScrollAlignment::alignCenterIfNeeded; >- break; >- } >- >- auto& coreObject = webkitAccessibleGetAccessibilityObject(accessible); >- coreObject.scrollToMakeVisible({ SelectionRevealMode::Reveal, alignX, alignY, ShouldAllowCrossOriginScrolling::Yes }); >- >- return TRUE; >-} >- >-static gboolean webkitAccessibleComponentScrollToPoint(AtkComponent* component, AtkCoordType coordType, gint x, gint y) >-{ >- auto* accessible = WEBKIT_ACCESSIBLE(component); >- returnValIfWebKitAccessibleIsInvalid(accessible, FALSE); >- >- auto& coreObject = webkitAccessibleGetAccessibilityObject(accessible); >- >- IntPoint point(x, y); >- if (coordType == ATK_XY_SCREEN) { >- if (auto* frameView = coreObject.documentFrameView()) >- point = frameView->contentsToWindow(frameView->screenToContents(point)); >- } >- >- coreObject.scrollToGlobalPoint(point); >- >- return TRUE; >-} >-#endif >- >-void webkitAccessibleComponentInterfaceInit(AtkComponentIface* iface) >-{ >- iface->ref_accessible_at_point = webkitAccessibleComponentRefAccessibleAtPoint; >- iface->get_extents = webkitAccessibleComponentGetExtents; >- iface->grab_focus = webkitAccessibleComponentGrabFocus; >-#if ATK_CHECK_VERSION(2, 30, 0) >- iface->scroll_to = webkitAccessibleComponentScrollTo; >- iface->scroll_to_point = webkitAccessibleComponentScrollToPoint; >-#endif >-} >- >-#endif // ENABLE(ACCESSIBILITY) && USE(ATK) >diff --git a/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceComponent.h b/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceComponent.h >deleted file mode 100644 >index 7daf347c44c2..000000000000 >--- a/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceComponent.h >+++ /dev/null >@@ -1,30 +0,0 @@ >-/* >- * Copyright (C) 2008 Nuanti Ltd. >- * Copyright (C) 2009 Jan Alonzo >- * Copyright (C) 2009, 2012 Igalia S.L. >- * >- * This library is free software; you can redistribute it and/or >- * modify it under the terms of the GNU Library General Public >- * License as published by the Free Software Foundation; either >- * version 2 of the License, or (at your option) any later version. >- * >- * This library is distributed in the hope that it will be useful, >- * but WITHOUT ANY WARRANTY; without even the implied warranty of >- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- * Library General Public License for more details. >- * >- * You should have received a copy of the GNU Library General Public License >- * along with this library; see the file COPYING.LIB. If not, write to >- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >- * Boston, MA 02110-1301, USA. >- */ >- >-#pragma once >- >-#if ENABLE(ACCESSIBILITY) && USE(ATK) >- >-#include <atk/atk.h> >- >-void webkitAccessibleComponentInterfaceInit(AtkComponentIface*); >- >-#endif // ENABLE(ACCESSIBILITY) && USE(ATK) >diff --git a/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceDocument.cpp b/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceDocument.cpp >deleted file mode 100644 >index 34900e71b316..000000000000 >--- a/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceDocument.cpp >+++ /dev/null >@@ -1,124 +0,0 @@ >-/* >- * Copyright (C) 2008 Nuanti Ltd. >- * Copyright (C) 2009 Jan Alonzo >- * Copyright (C) 2012 Igalia S.L. >- * Copyright (C) 2013 Samsung Electronics >- * >- * Portions from Mozilla a11y, copyright as follows: >- * >- * The Original Code is mozilla.org code. >- * >- * The Initial Developer of the Original Code is >- * Sun Microsystems, Inc. >- * Portions created by the Initial Developer are Copyright (C) 2002 >- * the Initial Developer. All Rights Reserved. >- * >- * This library is free software; you can redistribute it and/or >- * modify it under the terms of the GNU Library General Public >- * License as published by the Free Software Foundation; either >- * version 2 of the License, or (at your option) any later version. >- * >- * This library is distributed in the hope that it will be useful, >- * but WITHOUT ANY WARRANTY; without even the implied warranty of >- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- * Library General Public License for more details. >- * >- * You should have received a copy of the GNU Library General Public License >- * along with this library; see the file COPYING.LIB. If not, write to >- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >- * Boston, MA 02110-1301, USA. >- */ >- >-#include "config.h" >-#include "WebKitAccessibleInterfaceDocument.h" >- >-#if ENABLE(ACCESSIBILITY) && USE(ATK) >- >-#include "AccessibilityObject.h" >-#include "DocumentInlines.h" >-#include "DocumentType.h" >-#include "WebKitAccessible.h" >-#include "WebKitAccessibleUtil.h" >- >-using namespace WebCore; >- >-static AccessibilityObject* core(AtkDocument* document) >-{ >- if (!WEBKIT_IS_ACCESSIBLE(document)) >- return 0; >- >- return &webkitAccessibleGetAccessibilityObject(WEBKIT_ACCESSIBLE(document)); >-} >- >-static const gchar* documentAttributeValue(AtkDocument* document, const gchar* attribute) >-{ >- Document* coreDocument = core(document)->document(); >- if (!coreDocument) >- return 0; >- >- String value; >- AtkCachedProperty atkCachedProperty; >- >- if (!g_ascii_strcasecmp(attribute, "DocType") && coreDocument->doctype()) { >- value = coreDocument->doctype()->name(); >- atkCachedProperty = AtkCachedDocumentType; >- } else if (!g_ascii_strcasecmp(attribute, "Encoding")) { >- value = coreDocument->charset(); >- atkCachedProperty = AtkCachedDocumentEncoding; >- } else if (!g_ascii_strcasecmp(attribute, "URI")) { >- value = coreDocument->documentURI(); >- atkCachedProperty = AtkCachedDocumentURI; >- } >- >- if (!value.isEmpty()) >- return webkitAccessibleCacheAndReturnAtkProperty(WEBKIT_ACCESSIBLE(document), atkCachedProperty, value.utf8()); >- >- return 0; >-} >- >-static const gchar* webkitAccessibleDocumentGetAttributeValue(AtkDocument* document, const gchar* attribute) >-{ >- g_return_val_if_fail(ATK_IS_DOCUMENT(document), 0); >- returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(document), 0); >- >- return documentAttributeValue(document, attribute); >-} >- >-static AtkAttributeSet* webkitAccessibleDocumentGetAttributes(AtkDocument* document) >-{ >- g_return_val_if_fail(ATK_IS_DOCUMENT(document), 0); >- returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(document), 0); >- >- AtkAttributeSet* attributeSet = nullptr; >- const gchar* attributes[] = { "DocType", "Encoding", "URI" }; >- >- for (unsigned i = 0; i < G_N_ELEMENTS(attributes); i++) { >- const gchar* value = documentAttributeValue(document, attributes[i]); >- if (value) >- attributeSet = addToAtkAttributeSet(attributeSet, attributes[i], value); >- } >- >- return attributeSet; >-} >- >-static const gchar* webkitAccessibleDocumentGetLocale(AtkDocument* document) >-{ >- g_return_val_if_fail(ATK_IS_DOCUMENT(document), 0); >- returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(document), 0); >- >- // The logic to resolve locale has been moved to >- // AtkObject::get_object_locale() virtual method. However, to avoid breaking >- // clients expecting the deprecated AtkDocumentIface::get_document_locale() >- // to be overriden, method is kept and chained up to >- // AtkObject::get_object_locale(). <https://bugs.webkit.org/show_bug.cgi?id=115647> >- return atk_object_get_object_locale(ATK_OBJECT(document)); >-} >- >-void webkitAccessibleDocumentInterfaceInit(AtkDocumentIface* iface) >-{ >- iface->get_document_attribute_value = webkitAccessibleDocumentGetAttributeValue; >- iface->get_document_attributes = webkitAccessibleDocumentGetAttributes; >- iface->get_document_locale = webkitAccessibleDocumentGetLocale; >-} >- >-#endif >diff --git a/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceDocument.h b/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceDocument.h >deleted file mode 100644 >index 6beaaed39667..000000000000 >--- a/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceDocument.h >+++ /dev/null >@@ -1,30 +0,0 @@ >-/* >- * Copyright (C) 2008 Nuanti Ltd. >- * Copyright (C) 2009 Jan Alonzo >- * Copyright (C) 2012 Igalia S.L. >- * >- * This library is free software; you can redistribute it and/or >- * modify it under the terms of the GNU Library General Public >- * License as published by the Free Software Foundation; either >- * version 2 of the License, or (at your option) any later version. >- * >- * This library is distributed in the hope that it will be useful, >- * but WITHOUT ANY WARRANTY; without even the implied warranty of >- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- * Library General Public License for more details. >- * >- * You should have received a copy of the GNU Library General Public License >- * along with this library; see the file COPYING.LIB. If not, write to >- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >- * Boston, MA 02110-1301, USA. >- */ >- >-#pragma once >- >-#if ENABLE(ACCESSIBILITY) && USE(ATK) >- >-#include <atk/atk.h> >- >-void webkitAccessibleDocumentInterfaceInit(AtkDocumentIface*); >- >-#endif // ENABLE(ACCESSIBILITY) && USE(ATK) >diff --git a/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceEditableText.cpp b/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceEditableText.cpp >deleted file mode 100644 >index 494eb001826a..000000000000 >--- a/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceEditableText.cpp >+++ /dev/null >@@ -1,150 +0,0 @@ >-/* >- * Copyright (C) 2008 Nuanti Ltd. >- * Copyright (C) 2009 Jan Alonzo >- * Copyright (C) 2011, 2012 Igalia S.L. >- * >- * Portions from Mozilla a11y, copyright as follows: >- * >- * The Original Code is mozilla.org code. >- * >- * The Initial Developer of the Original Code is >- * Sun Microsystems, Inc. >- * Portions created by the Initial Developer are Copyright (C) 2002 >- * the Initial Developer. All Rights Reserved. >- * >- * This library is free software; you can redistribute it and/or >- * modify it under the terms of the GNU Library General Public >- * License as published by the Free Software Foundation; either >- * version 2 of the License, or (at your option) any later version. >- * >- * This library is distributed in the hope that it will be useful, >- * but WITHOUT ANY WARRANTY; without even the implied warranty of >- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- * Library General Public License for more details. >- * >- * You should have received a copy of the GNU Library General Public License >- * along with this library; see the file COPYING.LIB. If not, write to >- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >- * Boston, MA 02110-1301, USA. >- */ >- >-#include "config.h" >-#include "WebKitAccessibleInterfaceEditableText.h" >- >-#if ENABLE(ACCESSIBILITY) && USE(ATK) >- >-#include "AccessibilityObject.h" >-#include "Document.h" >-#include "Editor.h" >-#include "Frame.h" >-#include "NotImplemented.h" >-#include "WebKitAccessible.h" >-#include "WebKitAccessibleUtil.h" >- >-using namespace WebCore; >- >-static AccessibilityObject* core(AtkEditableText* text) >-{ >- if (!WEBKIT_IS_ACCESSIBLE(text)) >- return 0; >- >- return &webkitAccessibleGetAccessibilityObject(WEBKIT_ACCESSIBLE(text)); >-} >- >-static gboolean webkitAccessibleEditableTextSetRunAttributes(AtkEditableText* text, AtkAttributeSet*, gint, gint) >-{ >- g_return_val_if_fail(ATK_IS_EDITABLE_TEXT(text), FALSE); >- returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(text), FALSE); >- >- notImplemented(); >- return FALSE; >-} >- >-static void webkitAccessibleEditableTextSetTextContents(AtkEditableText* text, const gchar* string) >-{ >- g_return_if_fail(ATK_IS_EDITABLE_TEXT(text)); >- returnIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(text)); >- >- // FIXME: string nullcheck? >- core(text)->setValue(String::fromUTF8(string)); >-} >- >-static void webkitAccessibleEditableTextInsertText(AtkEditableText* text, const gchar* string, gint length, gint* position) >-{ >- g_return_if_fail(ATK_IS_EDITABLE_TEXT(text)); >- returnIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(text)); >- >- if (!string) >- return; >- >- AccessibilityObject* coreObject = core(text); >- // FIXME: Not implemented in WebCore >- // coreObject->setSelectedTextRange(PlainTextRange(*position, 0)); >- // coreObject->setSelectedText(String::fromUTF8(string)); >- >- Document* document = coreObject->document(); >- if (!document || !document->frame()) >- return; >- >- coreObject->setSelectedVisiblePositionRange(coreObject->visiblePositionRangeForRange(PlainTextRange(*position, 0))); >- coreObject->setFocused(true); >- // FIXME: We should set position to the actual inserted text length, which may be less than that requested. >- if (document->frame()->editor().insertTextWithoutSendingTextEvent(String::fromUTF8(string).substring(0, length), false, 0)) >- *position += length; >-} >- >-static void webkitAccessibleEditableTextCopyText(AtkEditableText* text, gint, gint) >-{ >- g_return_if_fail(ATK_IS_EDITABLE_TEXT(text)); >- returnIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(text)); >- >- notImplemented(); >-} >- >-static void webkitAccessibleEditableTextCutText(AtkEditableText* text, gint, gint) >-{ >- g_return_if_fail(ATK_IS_EDITABLE_TEXT(text)); >- returnIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(text)); >- >- notImplemented(); >-} >- >-static void webkitAccessibleEditableTextDeleteText(AtkEditableText* text, gint startPos, gint endPos) >-{ >- g_return_if_fail(ATK_IS_EDITABLE_TEXT(text)); >- returnIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(text)); >- >- AccessibilityObject* coreObject = core(text); >- // FIXME: Not implemented in WebCore >- // coreObject->setSelectedTextRange(PlainTextRange(startPos, endPos - startPos)); >- // coreObject->setSelectedText(String()); >- >- Document* document = coreObject->document(); >- if (!document || !document->frame()) >- return; >- >- coreObject->setSelectedVisiblePositionRange(coreObject->visiblePositionRangeForRange(PlainTextRange(startPos, endPos - startPos))); >- coreObject->setFocused(true); >- document->frame()->editor().performDelete(); >-} >- >-static void webkitAccessibleEditableTextPasteText(AtkEditableText* text, gint) >-{ >- g_return_if_fail(ATK_IS_EDITABLE_TEXT(text)); >- returnIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(text)); >- >- notImplemented(); >-} >- >-void webkitAccessibleEditableTextInterfaceInit(AtkEditableTextIface* iface) >-{ >- iface->set_run_attributes = webkitAccessibleEditableTextSetRunAttributes; >- iface->set_text_contents = webkitAccessibleEditableTextSetTextContents; >- iface->insert_text = webkitAccessibleEditableTextInsertText; >- iface->copy_text = webkitAccessibleEditableTextCopyText; >- iface->cut_text = webkitAccessibleEditableTextCutText; >- iface->delete_text = webkitAccessibleEditableTextDeleteText; >- iface->paste_text = webkitAccessibleEditableTextPasteText; >-} >- >-#endif >diff --git a/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceEditableText.h b/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceEditableText.h >deleted file mode 100644 >index ef5f7d269bed..000000000000 >--- a/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceEditableText.h >+++ /dev/null >@@ -1,30 +0,0 @@ >-/* >- * Copyright (C) 2008 Nuanti Ltd. >- * Copyright (C) 2009 Jan Alonzo >- * Copyright (C) 2011, 2012 Igalia S.L. >- * >- * This library is free software; you can redistribute it and/or >- * modify it under the terms of the GNU Library General Public >- * License as published by the Free Software Foundation; either >- * version 2 of the License, or (at your option) any later version. >- * >- * This library is distributed in the hope that it will be useful, >- * but WITHOUT ANY WARRANTY; without even the implied warranty of >- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- * Library General Public License for more details. >- * >- * You should have received a copy of the GNU Library General Public License >- * along with this library; see the file COPYING.LIB. If not, write to >- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >- * Boston, MA 02110-1301, USA. >- */ >- >-#pragma once >- >-#if ENABLE(ACCESSIBILITY) && USE(ATK) >- >-#include <atk/atk.h> >- >-void webkitAccessibleEditableTextInterfaceInit(AtkEditableTextIface*); >- >-#endif // ENABLE(ACCESSIBILITY) && USE(ATK) >diff --git a/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceHyperlinkImpl.cpp b/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceHyperlinkImpl.cpp >deleted file mode 100644 >index 6a8edd496737..000000000000 >--- a/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceHyperlinkImpl.cpp >+++ /dev/null >@@ -1,37 +0,0 @@ >-/* >- * Copyright (C) 2010, 2011, 2012 Igalia S.L. >- * >- * This library is free software; you can redistribute it and/or >- * modify it under the terms of the GNU Library General Public >- * License as published by the Free Software Foundation; either >- * version 2 of the License, or (at your option) any later version. >- * >- * This library is distributed in the hope that it will be useful, >- * but WITHOUT ANY WARRANTY; without even the implied warranty of >- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- * Library General Public License for more details. >- * >- * You should have received a copy of the GNU Library General Public License >- * along with this library; see the file COPYING.LIB. If not, write to >- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >- * Boston, MA 02110-1301, USA. >- */ >- >-#include "config.h" >-#include "WebKitAccessibleInterfaceHyperlinkImpl.h" >- >-#if ENABLE(ACCESSIBILITY) && USE(ATK) >- >-#include "WebKitAccessibleHyperlink.h" >- >-static AtkHyperlink* webkitAccessibleHyperlinkImplGetHyperlink(AtkHyperlinkImpl* hyperlink) >-{ >- return ATK_HYPERLINK(webkitAccessibleHyperlinkGetOrCreate(hyperlink)); >-} >- >-void webkitAccessibleHyperlinkImplInterfaceInit(AtkHyperlinkImplIface* iface) >-{ >- iface->get_hyperlink = webkitAccessibleHyperlinkImplGetHyperlink; >-} >- >-#endif // ENABLE(ACCESSIBILITY) && USE(ATK) >diff --git a/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceHyperlinkImpl.h b/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceHyperlinkImpl.h >deleted file mode 100644 >index 2092bf7c9709..000000000000 >--- a/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceHyperlinkImpl.h >+++ /dev/null >@@ -1,28 +0,0 @@ >-/* >- * Copyright (C) 2010, 2011, 2012 Igalia S.L. >- * >- * This library is free software; you can redistribute it and/or >- * modify it under the terms of the GNU Library General Public >- * License as published by the Free Software Foundation; either >- * version 2 of the License, or (at your option) any later version. >- * >- * This library is distributed in the hope that it will be useful, >- * but WITHOUT ANY WARRANTY; without even the implied warranty of >- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- * Library General Public License for more details. >- * >- * You should have received a copy of the GNU Library General Public License >- * along with this library; see the file COPYING.LIB. If not, write to >- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >- * Boston, MA 02110-1301, USA. >- */ >- >-#pragma once >- >-#if ENABLE(ACCESSIBILITY) && USE(ATK) >- >-#include <atk/atk.h> >- >-void webkitAccessibleHyperlinkImplInterfaceInit(AtkHyperlinkImplIface*); >- >-#endif // ENABLE(ACCESSIBILITY) && USE(ATK) >diff --git a/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceHypertext.cpp b/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceHypertext.cpp >deleted file mode 100644 >index 523bab96f0d4..000000000000 >--- a/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceHypertext.cpp >+++ /dev/null >@@ -1,116 +0,0 @@ >-/* >- * Copyright (C) 2010, 2011, 2012 Igalia S.L. >- * >- * This library is free software; you can redistribute it and/or >- * modify it under the terms of the GNU Library General Public >- * License as published by the Free Software Foundation; either >- * version 2 of the License, or (at your option) any later version. >- * >- * This library is distributed in the hope that it will be useful, >- * but WITHOUT ANY WARRANTY; without even the implied warranty of >- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- * Library General Public License for more details. >- * >- * You should have received a copy of the GNU Library General Public License >- * along with this library; see the file COPYING.LIB. If not, write to >- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >- * Boston, MA 02110-1301, USA. >- */ >- >-#include "config.h" >-#include "WebKitAccessibleInterfaceHypertext.h" >- >-#if ENABLE(ACCESSIBILITY) && USE(ATK) >- >-#include "AccessibilityObject.h" >-#include "WebKitAccessible.h" >-#include "WebKitAccessibleUtil.h" >- >-using namespace WebCore; >- >-static AccessibilityObject* core(AtkHypertext* hypertext) >-{ >- if (!WEBKIT_IS_ACCESSIBLE(hypertext)) >- return 0; >- >- return &webkitAccessibleGetAccessibilityObject(WEBKIT_ACCESSIBLE(hypertext)); >-} >- >-static AtkHyperlink* webkitAccessibleHypertextGetLink(AtkHypertext* hypertext, gint index) >-{ >- g_return_val_if_fail(ATK_HYPERTEXT(hypertext), 0); >- returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(hypertext), 0); >- >- const AccessibilityObject::AccessibilityChildrenVector& children = core(hypertext)->children(); >- if (index < 0 || static_cast<unsigned>(index) >= children.size()) >- return 0; >- >- gint currentLink = -1; >- for (const auto& child : children) { >- AXCoreObject* coreChild = child.get(); >- if (!coreChild->accessibilityIsIgnored()) { >- auto* axObject = coreChild->wrapper(); >- if (!axObject || !ATK_IS_HYPERLINK_IMPL(axObject)) >- continue; >- >- currentLink++; >- if (index != currentLink) >- continue; >- >- return atk_hyperlink_impl_get_hyperlink(ATK_HYPERLINK_IMPL(axObject)); >- } >- } >- >- return 0; >-} >- >-static gint webkitAccessibleHypertextGetNLinks(AtkHypertext* hypertext) >-{ >- g_return_val_if_fail(ATK_HYPERTEXT(hypertext), 0); >- returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(hypertext), 0); >- >- const AccessibilityObject::AccessibilityChildrenVector& children = core(hypertext)->children(); >- gint linksFound = 0; >- for (const auto& child : children) { >- AXCoreObject* coreChild = child.get(); >- if (!coreChild->accessibilityIsIgnored()) { >- auto* axObject = coreChild->wrapper(); >- if (axObject && ATK_IS_HYPERLINK_IMPL(axObject)) >- linksFound++; >- } >- } >- >- return linksFound; >-} >- >-static gint webkitAccessibleHypertextGetLinkIndex(AtkHypertext* hypertext, gint charIndex) >-{ >- g_return_val_if_fail(ATK_HYPERTEXT(hypertext), -1); >- returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(hypertext), -1); >- >- size_t linksCount = webkitAccessibleHypertextGetNLinks(hypertext); >- if (!linksCount) >- return -1; >- >- for (size_t i = 0; i < linksCount; i++) { >- AtkHyperlink* hyperlink = ATK_HYPERLINK(webkitAccessibleHypertextGetLink(hypertext, i)); >- gint startIndex = atk_hyperlink_get_start_index(hyperlink); >- gint endIndex = atk_hyperlink_get_end_index(hyperlink); >- >- // Check if the char index in the link's offset range >- if (startIndex <= charIndex && charIndex < endIndex) >- return i; >- } >- >- // Not found if reached >- return -1; >-} >- >-void webkitAccessibleHypertextInterfaceInit(AtkHypertextIface* iface) >-{ >- iface->get_link = webkitAccessibleHypertextGetLink; >- iface->get_n_links = webkitAccessibleHypertextGetNLinks; >- iface->get_link_index = webkitAccessibleHypertextGetLinkIndex; >-} >- >-#endif >diff --git a/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceHypertext.h b/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceHypertext.h >deleted file mode 100644 >index c3f61385f49b..000000000000 >--- a/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceHypertext.h >+++ /dev/null >@@ -1,28 +0,0 @@ >-/* >- * Copyright (C) 2010, 2011, 2012 Igalia S.L. >- * >- * This library is free software; you can redistribute it and/or >- * modify it under the terms of the GNU Library General Public >- * License as published by the Free Software Foundation; either >- * version 2 of the License, or (at your option) any later version. >- * >- * This library is distributed in the hope that it will be useful, >- * but WITHOUT ANY WARRANTY; without even the implied warranty of >- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- * Library General Public License for more details. >- * >- * You should have received a copy of the GNU Library General Public License >- * along with this library; see the file COPYING.LIB. If not, write to >- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >- * Boston, MA 02110-1301, USA. >- */ >- >-#pragma once >- >-#if ENABLE(ACCESSIBILITY) && USE(ATK) >- >-#include <atk/atk.h> >- >-void webkitAccessibleHypertextInterfaceInit(AtkHypertextIface*); >- >-#endif // ENABLE(ACCESSIBILITY) && USE(ATK) >diff --git a/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceImage.cpp b/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceImage.cpp >deleted file mode 100644 >index 28606027155f..000000000000 >--- a/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceImage.cpp >+++ /dev/null >@@ -1,89 +0,0 @@ >-/* >- * Copyright (C) 2008 Nuanti Ltd. >- * Copyright (C) 2009 Jan Alonzo >- * Copyright (C) 2009, 2012 Igalia S.L. >- * Copyright (C) 2013 Samsung Electronics >- * >- * Portions from Mozilla a11y, copyright as follows: >- * >- * The Original Code is mozilla.org code. >- * >- * The Initial Developer of the Original Code is >- * Sun Microsystems, Inc. >- * Portions created by the Initial Developer are Copyright (C) 2002 >- * the Initial Developer. All Rights Reserved. >- * >- * This library is free software; you can redistribute it and/or >- * modify it under the terms of the GNU Library General Public >- * License as published by the Free Software Foundation; either >- * version 2 of the License, or (at your option) any later version. >- * >- * This library is distributed in the hope that it will be useful, >- * but WITHOUT ANY WARRANTY; without even the implied warranty of >- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- * Library General Public License for more details. >- * >- * You should have received a copy of the GNU Library General Public License >- * along with this library; see the file COPYING.LIB. If not, write to >- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >- * Boston, MA 02110-1301, USA. >- */ >- >-#include "config.h" >-#include "WebKitAccessibleInterfaceImage.h" >- >-#if ENABLE(ACCESSIBILITY) && USE(ATK) >- >-#include "AccessibilityObject.h" >-#include "IntRect.h" >-#include "WebKitAccessible.h" >-#include "WebKitAccessibleUtil.h" >- >-using namespace WebCore; >- >-static AccessibilityObject* core(AtkImage* image) >-{ >- if (!WEBKIT_IS_ACCESSIBLE(image)) >- return 0; >- >- return &webkitAccessibleGetAccessibilityObject(WEBKIT_ACCESSIBLE(image)); >-} >- >-static void webkitAccessibleImageGetImagePosition(AtkImage* image, gint* x, gint* y, AtkCoordType coordType) >-{ >- g_return_if_fail(ATK_IMAGE(image)); >- returnIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(image)); >- >- IntRect rect = snappedIntRect(core(image)->elementRect()); >- contentsRelativeToAtkCoordinateType(core(image), coordType, rect, x, y); >-} >- >-static const gchar* webkitAccessibleImageGetImageDescription(AtkImage* image) >-{ >- auto* accessible = WEBKIT_ACCESSIBLE(image); >- returnValIfWebKitAccessibleIsInvalid(accessible, nullptr); >- >- return webkitAccessibleCacheAndReturnAtkProperty(accessible, AtkCachedImageDescription, accessibilityDescription(core(image)).utf8()); >-} >- >-static void webkitAccessibleImageGetImageSize(AtkImage* image, gint* width, gint* height) >-{ >- g_return_if_fail(ATK_IMAGE(image)); >- returnIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(image)); >- >- IntSize size = snappedIntRect(core(image)->elementRect()).size(); >- >- if (width) >- *width = size.width(); >- if (height) >- *height = size.height(); >-} >- >-void webkitAccessibleImageInterfaceInit(AtkImageIface* iface) >-{ >- iface->get_image_position = webkitAccessibleImageGetImagePosition; >- iface->get_image_description = webkitAccessibleImageGetImageDescription; >- iface->get_image_size = webkitAccessibleImageGetImageSize; >-} >- >-#endif >diff --git a/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceImage.h b/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceImage.h >deleted file mode 100644 >index 0d5d8ceb1cd7..000000000000 >--- a/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceImage.h >+++ /dev/null >@@ -1,30 +0,0 @@ >-/* >- * Copyright (C) 2008 Nuanti Ltd. >- * Copyright (C) 2009 Jan Alonzo >- * Copyright (C) 2009, 2012 Igalia S.L. >- * >- * This library is free software; you can redistribute it and/or >- * modify it under the terms of the GNU Library General Public >- * License as published by the Free Software Foundation; either >- * version 2 of the License, or (at your option) any later version. >- * >- * This library is distributed in the hope that it will be useful, >- * but WITHOUT ANY WARRANTY; without even the implied warranty of >- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- * Library General Public License for more details. >- * >- * You should have received a copy of the GNU Library General Public License >- * along with this library; see the file COPYING.LIB. If not, write to >- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >- * Boston, MA 02110-1301, USA. >- */ >- >-#pragma once >- >-#if ENABLE(ACCESSIBILITY) && USE(ATK) >- >-#include <atk/atk.h> >- >-void webkitAccessibleImageInterfaceInit(AtkImageIface*); >- >-#endif // ENABLE(ACCESSIBILITY) && USE(ATK) >diff --git a/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceSelection.cpp b/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceSelection.cpp >deleted file mode 100644 >index 86a1998cbcdf..000000000000 >--- a/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceSelection.cpp >+++ /dev/null >@@ -1,256 +0,0 @@ >-/* >- * Copyright (C) 2008 Nuanti Ltd. >- * Copyright (C) 2009 Jan Alonzo >- * Copyright (C) 2010, 2011, 2012 Igalia S.L. >- * >- * Portions from Mozilla a11y, copyright as follows: >- * >- * The Original Code is mozilla.org code. >- * >- * The Initial Developer of the Original Code is >- * Sun Microsystems, Inc. >- * Portions created by the Initial Developer are Copyright (C) 2002 >- * the Initial Developer. All Rights Reserved. >- * >- * This library is free software; you can redistribute it and/or >- * modify it under the terms of the GNU Library General Public >- * License as published by the Free Software Foundation; either >- * version 2 of the License, or (at your option) any later version. >- * >- * This library is distributed in the hope that it will be useful, >- * but WITHOUT ANY WARRANTY; without even the implied warranty of >- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- * Library General Public License for more details. >- * >- * You should have received a copy of the GNU Library General Public License >- * along with this library; see the file COPYING.LIB. If not, write to >- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >- * Boston, MA 02110-1301, USA. >- */ >- >-#include "config.h" >-#include "WebKitAccessibleInterfaceSelection.h" >- >-#if ENABLE(ACCESSIBILITY) && USE(ATK) >- >-#include "AccessibilityListBox.h" >-#include "AccessibilityObject.h" >-#include "HTMLSelectElement.h" >-#include "RenderObject.h" >-#include "WebKitAccessible.h" >-#include "WebKitAccessibleUtil.h" >- >-using namespace WebCore; >- >-static AccessibilityObject* core(AtkSelection* selection) >-{ >- if (!WEBKIT_IS_ACCESSIBLE(selection)) >- return nullptr; >- >- return &webkitAccessibleGetAccessibilityObject(WEBKIT_ACCESSIBLE(selection)); >-} >- >-static AXCoreObject* listObjectForCoreSelection(AccessibilityObject* coreSelection) >-{ >- // Only list boxes and menu lists supported so far. >- if (!coreSelection->isListBox() && !coreSelection->isMenuList()) >- return nullptr; >- >- // For list boxes the list object is just itself. >- if (coreSelection->isListBox()) >- return coreSelection; >- >- // For menu lists we need to return the first accessible child, >- // with role MenuListPopupRole, since that's the one holding the list >- // of items with role MenuListOptionRole. >- const AccessibilityObject::AccessibilityChildrenVector& children = coreSelection->children(); >- if (!children.size()) >- return nullptr; >- >- AXCoreObject* listObject = children.at(0).get(); >- if (!listObject->isMenuListPopup()) >- return nullptr; >- >- return listObject; >-} >- >-static AXCoreObject* optionFromList(AtkSelection* selection, gint index) >-{ >- AccessibilityObject* coreSelection = core(selection); >- if (!coreSelection || index < 0) >- return nullptr; >- >- // Need to select the proper list object depending on the type. >- AXCoreObject* listObject = listObjectForCoreSelection(coreSelection); >- if (!listObject) >- return nullptr; >- >- const AccessibilityObject::AccessibilityChildrenVector& options = listObject->children(); >- if (index < static_cast<gint>(options.size())) >- return options.at(index).get(); >- >- return nullptr; >-} >- >-static AXCoreObject* optionFromSelection(AtkSelection* selection, gint index) >-{ >- AccessibilityObject* coreSelection = core(selection); >- if (!coreSelection || !coreSelection->isAccessibilityRenderObject() || index < 0) >- return nullptr; >- >- // This method provides the functionality expected by atk_selection_ref_selection(). >- // According to the ATK documentation for this method, the index is "a gint specifying >- // the index in the selection set. (e.g. the ith selection as opposed to the ith child)." >- // There is different API, namely atk_object_ref_accessible_child(), when the ith child >- // from the set of all children is sought. >- AccessibilityObject::AccessibilityChildrenVector options; >- coreSelection->selectedChildren(options); >- if (index < static_cast<gint>(options.size())) >- return options.at(index).get(); >- >- return nullptr; >-} >- >-static gboolean webkitAccessibleSelectionAddSelection(AtkSelection* selection, gint index) >-{ >- g_return_val_if_fail(ATK_SELECTION(selection), FALSE); >- returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(selection), FALSE); >- >- AccessibilityObject* coreSelection = core(selection); >- if (!coreSelection) >- return FALSE; >- >- AXCoreObject* option = optionFromList(selection, index); >- if (option && (coreSelection->isListBox() || coreSelection->isMenuList())) { >- option->setSelected(true); >- return option->isSelected(); >- } >- >- return FALSE; >-} >- >-static gboolean webkitAccessibleSelectionClearSelection(AtkSelection* selection) >-{ >- g_return_val_if_fail(ATK_SELECTION(selection), FALSE); >- returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(selection), FALSE); >- >- AccessibilityObject* coreSelection = core(selection); >- if (!coreSelection) >- return FALSE; >- >- AccessibilityObject::AccessibilityChildrenVector selectedItems; >- if (is<AccessibilityListBox>(*coreSelection)) { >- // Set the list of selected items to an empty list; then verify that it worked. >- auto& listBox = downcast<AccessibilityListBox>(*coreSelection); >- listBox.setSelectedChildren(selectedItems); >- listBox.selectedChildren(selectedItems); >- return selectedItems.isEmpty(); >- } >- return FALSE; >-} >- >-static AtkObject* webkitAccessibleSelectionRefSelection(AtkSelection* selection, gint index) >-{ >- g_return_val_if_fail(ATK_SELECTION(selection), nullptr); >- returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(selection), nullptr); >- >- AXCoreObject* option = optionFromSelection(selection, index); >- if (option) { >- auto* child = option->wrapper(); >- g_object_ref(child); >- return ATK_OBJECT(child); >- } >- >- return nullptr; >-} >- >-static gint webkitAccessibleSelectionGetSelectionCount(AtkSelection* selection) >-{ >- g_return_val_if_fail(ATK_SELECTION(selection), 0); >- returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(selection), 0); >- >- AccessibilityObject* coreSelection = core(selection); >- if (!coreSelection || !coreSelection->isAccessibilityRenderObject()) >- return 0; >- >- if (coreSelection->isMenuList()) { >- RenderObject* renderer = coreSelection->renderer(); >- if (!renderer) >- return 0; >- >- int selectedIndex = downcast<HTMLSelectElement>(renderer->node())->selectedIndex(); >- return selectedIndex >= 0 && selectedIndex < static_cast<int>(downcast<HTMLSelectElement>(renderer->node())->listItems().size()); >- } >- >- AccessibilityObject::AccessibilityChildrenVector selectedItems; >- coreSelection->selectedChildren(selectedItems); >- return static_cast<gint>(selectedItems.size()); >-} >- >-static gboolean webkitAccessibleSelectionIsChildSelected(AtkSelection* selection, gint index) >-{ >- g_return_val_if_fail(ATK_SELECTION(selection), FALSE); >- returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(selection), FALSE); >- >- AccessibilityObject* coreSelection = core(selection); >- if (!coreSelection) >- return FALSE; >- >- AXCoreObject* option = optionFromList(selection, index); >- if (option && (coreSelection->isListBox() || coreSelection->isMenuList())) >- return option->isSelected(); >- >- return FALSE; >-} >- >-static gboolean webkitAccessibleSelectionRemoveSelection(AtkSelection* selection, gint index) >-{ >- g_return_val_if_fail(ATK_SELECTION(selection), FALSE); >- returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(selection), FALSE); >- >- AccessibilityObject* coreSelection = core(selection); >- if (!coreSelection) >- return FALSE; >- >- AXCoreObject* option = optionFromSelection(selection, index); >- if (option && (coreSelection->isListBox() || coreSelection->isMenuList())) { >- option->setSelected(false); >- return !option->isSelected(); >- } >- >- return FALSE; >-} >- >-static gboolean webkitAccessibleSelectionSelectAllSelection(AtkSelection* selection) >-{ >- g_return_val_if_fail(ATK_SELECTION(selection), FALSE); >- returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(selection), FALSE); >- >- AccessibilityObject* coreSelection = core(selection); >- if (!coreSelection || !coreSelection->isMultiSelectable()) >- return FALSE; >- >- if (is<AccessibilityListBox>(*coreSelection)) { >- const AccessibilityObject::AccessibilityChildrenVector& children = coreSelection->children(); >- AccessibilityListBox& listBox = downcast<AccessibilityListBox>(*coreSelection); >- listBox.setSelectedChildren(children); >- AccessibilityObject::AccessibilityChildrenVector selectedItems; >- listBox.selectedChildren(selectedItems); >- return selectedItems.size() == children.size(); >- } >- >- return FALSE; >-} >- >-void webkitAccessibleSelectionInterfaceInit(AtkSelectionIface* iface) >-{ >- iface->add_selection = webkitAccessibleSelectionAddSelection; >- iface->clear_selection = webkitAccessibleSelectionClearSelection; >- iface->ref_selection = webkitAccessibleSelectionRefSelection; >- iface->get_selection_count = webkitAccessibleSelectionGetSelectionCount; >- iface->is_child_selected = webkitAccessibleSelectionIsChildSelected; >- iface->remove_selection = webkitAccessibleSelectionRemoveSelection; >- iface->select_all_selection = webkitAccessibleSelectionSelectAllSelection; >-} >- >-#endif >diff --git a/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceSelection.h b/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceSelection.h >deleted file mode 100644 >index c5334b3a232a..000000000000 >--- a/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceSelection.h >+++ /dev/null >@@ -1,30 +0,0 @@ >-/* >- * Copyright (C) 2008 Nuanti Ltd. >- * Copyright (C) 2009 Jan Alonzo >- * Copyright (C) 2010, 2011, 2012 Igalia S.L. >- * >- * This library is free software; you can redistribute it and/or >- * modify it under the terms of the GNU Library General Public >- * License as published by the Free Software Foundation; either >- * version 2 of the License, or (at your option) any later version. >- * >- * This library is distributed in the hope that it will be useful, >- * but WITHOUT ANY WARRANTY; without even the implied warranty of >- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- * Library General Public License for more details. >- * >- * You should have received a copy of the GNU Library General Public License >- * along with this library; see the file COPYING.LIB. If not, write to >- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >- * Boston, MA 02110-1301, USA. >- */ >- >-#pragma once >- >-#if ENABLE(ACCESSIBILITY) && USE(ATK) >- >-#include <atk/atk.h> >- >-void webkitAccessibleSelectionInterfaceInit(AtkSelectionIface*); >- >-#endif // ENABLE(ACCESSIBILITY) && USE(ATK) >diff --git a/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceTable.cpp b/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceTable.cpp >deleted file mode 100644 >index e5eec5c5b1e0..000000000000 >--- a/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceTable.cpp >+++ /dev/null >@@ -1,290 +0,0 @@ >-/* >- * Copyright (C) 2008 Nuanti Ltd. >- * Copyright (C) 2009 Jan Alonzo >- * Copyright (C) 2009, 2010, 2011, 2012 Igalia S.L. >- * >- * Portions from Mozilla a11y, copyright as follows: >- * >- * The Original Code is mozilla.org code. >- * >- * The Initial Developer of the Original Code is >- * Sun Microsystems, Inc. >- * Portions created by the Initial Developer are Copyright (C) 2002 >- * the Initial Developer. All Rights Reserved. >- * >- * This library is free software; you can redistribute it and/or >- * modify it under the terms of the GNU Library General Public >- * License as published by the Free Software Foundation; either >- * version 2 of the License, or (at your option) any later version. >- * >- * This library is distributed in the hope that it will be useful, >- * but WITHOUT ANY WARRANTY; without even the implied warranty of >- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- * Library General Public License for more details. >- * >- * You should have received a copy of the GNU Library General Public License >- * along with this library; see the file COPYING.LIB. If not, write to >- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >- * Boston, MA 02110-1301, USA. >- */ >- >-#include "config.h" >-#include "WebKitAccessibleInterfaceTable.h" >- >-#if ENABLE(ACCESSIBILITY) && USE(ATK) >- >-#include "AccessibilityListBox.h" >-#include "AccessibilityObject.h" >-#include "AccessibilityTable.h" >-#include "AccessibilityTableCell.h" >-#include "HTMLTableCaptionElement.h" >-#include "HTMLTableElement.h" >-#include "RenderElement.h" >-#include "WebKitAccessible.h" >-#include "WebKitAccessibleInterfaceText.h" >-#include "WebKitAccessibleUtil.h" >- >-using namespace WebCore; >- >-static AccessibilityObject* core(AtkTable* table) >-{ >- if (!WEBKIT_IS_ACCESSIBLE(table)) >- return nullptr; >- >- return &webkitAccessibleGetAccessibilityObject(WEBKIT_ACCESSIBLE(table)); >-} >- >-static AXCoreObject* cell(AtkTable* table, guint row, guint column) >-{ >- auto* accTable = core(table); >- return accTable ? accTable->cellForColumnAndRow(column, row) : nullptr; >-} >- >-static gint cellIndex(AXCoreObject* axCell, AccessibilityTable* axTable) >-{ >- // Calculate the cell's index as if we had a traditional Gtk+ table in >- // which cells are all direct children of the table, arranged row-first. >- auto allCells = axTable->cells(); >- AXCoreObject::AccessibilityChildrenVector::iterator position; >- position = std::find(allCells.begin(), allCells.end(), axCell); >- if (position == allCells.end()) >- return -1; >- return position - allCells.begin(); >-} >- >-static AccessibilityTableCell* cellAtIndex(AtkTable* table, gint index) >-{ >- AccessibilityObject* accTable = core(table); >- if (is<AccessibilityTable>(*accTable)) { >- auto allCells = downcast<AccessibilityTable>(*accTable).cells(); >- if (0 <= index && static_cast<unsigned>(index) < allCells.size()) >- return downcast<AccessibilityTableCell>(allCells[index].get()); >- } >- return nullptr; >-} >- >-static AtkObject* webkitAccessibleTableRefAt(AtkTable* table, gint row, gint column) >-{ >- g_return_val_if_fail(ATK_TABLE(table), 0); >- returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(table), 0); >- >- auto* axCell = cell(table, row, column); >- if (!axCell) >- return 0; >- >- auto* cell = axCell->wrapper(); >- if (!cell) >- return 0; >- >- // This method transfers full ownership over the returned >- // AtkObject, so an extra reference is needed here. >- return ATK_OBJECT(g_object_ref(cell)); >-} >- >-static gint webkitAccessibleTableGetIndexAt(AtkTable* table, gint row, gint column) >-{ >- g_return_val_if_fail(ATK_TABLE(table), -1); >- returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(table), -1); >- >- auto* axCell = cell(table, row, column); >- AccessibilityTable* axTable = downcast<AccessibilityTable>(core(table)); >- return cellIndex(axCell, axTable); >-} >- >-static gint webkitAccessibleTableGetColumnAtIndex(AtkTable* table, gint index) >-{ >- g_return_val_if_fail(ATK_TABLE(table), -1); >- returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(table), -1); >- >- AccessibilityTableCell* axCell = cellAtIndex(table, index); >- if (axCell) { >- auto columnRange = axCell->columnIndexRange(); >- return columnRange.first; >- } >- return -1; >-} >- >-static gint webkitAccessibleTableGetRowAtIndex(AtkTable* table, gint index) >-{ >- g_return_val_if_fail(ATK_TABLE(table), -1); >- returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(table), -1); >- >- AccessibilityTableCell* axCell = cellAtIndex(table, index); >- if (axCell) { >- auto rowRange = axCell->rowIndexRange(); >- return rowRange.first; >- } >- return -1; >-} >- >-static gint webkitAccessibleTableGetNColumns(AtkTable* table) >-{ >- g_return_val_if_fail(ATK_TABLE(table), 0); >- returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(table), 0); >- >- AccessibilityObject* accTable = core(table); >- if (!is<AccessibilityTable>(*accTable)) >- return 0; >- >- if (int columnCount = downcast<AccessibilityTable>(*accTable).axColumnCount()) >- return columnCount; >- >- return downcast<AccessibilityTable>(*accTable).columnCount(); >-} >- >-static gint webkitAccessibleTableGetNRows(AtkTable* table) >-{ >- g_return_val_if_fail(ATK_TABLE(table), 0); >- returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(table), 0); >- >- AccessibilityObject* accTable = core(table); >- if (!is<AccessibilityTable>(*accTable)) >- return 0; >- >- if (int rowCount = downcast<AccessibilityTable>(*accTable).axRowCount()) >- return rowCount; >- >- return downcast<AccessibilityTable>(*accTable).rowCount(); >-} >- >-static gint webkitAccessibleTableGetColumnExtentAt(AtkTable* table, gint row, gint column) >-{ >- g_return_val_if_fail(ATK_TABLE(table), 0); >- returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(table), 0); >- >- auto* axCell = cell(table, row, column); >- if (axCell) { >- auto columnRange = axCell->columnIndexRange(); >- return columnRange.second; >- } >- return 0; >-} >- >-static gint webkitAccessibleTableGetRowExtentAt(AtkTable* table, gint row, gint column) >-{ >- g_return_val_if_fail(ATK_TABLE(table), 0); >- returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(table), 0); >- >- auto* axCell = cell(table, row, column); >- if (axCell) { >- auto rowRange = axCell->rowIndexRange(); >- return rowRange.second; >- } >- return 0; >-} >- >-static AtkObject* webkitAccessibleTableGetColumnHeader(AtkTable* table, gint column) >-{ >- g_return_val_if_fail(ATK_TABLE(table), 0); >- returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(table), 0); >- >- AccessibilityObject* accTable = core(table); >- if (is<AccessibilityTable>(*accTable)) { >- auto columnHeaders = downcast<AccessibilityTable>(*accTable).columnHeaders(); >- >- for (const auto& columnHeader : columnHeaders) { >- auto columnRange = columnHeader->columnIndexRange(); >- if (columnRange.first <= static_cast<unsigned>(column) && static_cast<unsigned>(column) < columnRange.first + columnRange.second) >- return ATK_OBJECT(columnHeader->wrapper()); >- } >- } >- return nullptr; >-} >- >-static AtkObject* webkitAccessibleTableGetRowHeader(AtkTable* table, gint row) >-{ >- g_return_val_if_fail(ATK_TABLE(table), 0); >- returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(table), 0); >- >- AccessibilityObject* accTable = core(table); >- if (is<AccessibilityTable>(*accTable)) { >- auto rowHeaders = downcast<AccessibilityTable>(*accTable).rowHeaders(); >- >- for (const auto& rowHeader : rowHeaders) { >- auto rowRange = rowHeader->rowIndexRange(); >- if (rowRange.first <= static_cast<unsigned>(row) && static_cast<unsigned>(row) < rowRange.first + rowRange.second) >- return ATK_OBJECT(rowHeader->wrapper()); >- } >- } >- return nullptr; >-} >- >-static AtkObject* webkitAccessibleTableGetCaption(AtkTable* table) >-{ >- g_return_val_if_fail(ATK_TABLE(table), nullptr); >- returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(table), nullptr); >- >- AccessibilityObject* accTable = core(table); >- if (accTable->isAccessibilityRenderObject()) { >- Node* node = accTable->node(); >- if (is<HTMLTableElement>(node)) { >- auto caption = downcast<HTMLTableElement>(*node).caption(); >- if (caption) >- return ATK_OBJECT(AccessibilityObject::firstAccessibleObjectFromNode(caption->renderer()->element())->wrapper()); >- } >- } >- return nullptr; >-} >- >-static const gchar* webkitAccessibleTableGetColumnDescription(AtkTable* table, gint column) >-{ >- g_return_val_if_fail(ATK_TABLE(table), 0); >- returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(table), 0); >- >- AtkObject* columnHeader = atk_table_get_column_header(table, column); >- if (columnHeader && ATK_IS_TEXT(columnHeader)) >- return atk_text_get_text(ATK_TEXT(columnHeader), 0, -1); >- >- return 0; >-} >- >-static const gchar* webkitAccessibleTableGetRowDescription(AtkTable* table, gint row) >-{ >- g_return_val_if_fail(ATK_TABLE(table), 0); >- returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(table), 0); >- >- AtkObject* rowHeader = atk_table_get_row_header(table, row); >- if (rowHeader && ATK_IS_TEXT(rowHeader)) >- return atk_text_get_text(ATK_TEXT(rowHeader), 0, -1); >- >- return 0; >-} >- >-void webkitAccessibleTableInterfaceInit(AtkTableIface* iface) >-{ >- iface->ref_at = webkitAccessibleTableRefAt; >- iface->get_index_at = webkitAccessibleTableGetIndexAt; >- iface->get_column_at_index = webkitAccessibleTableGetColumnAtIndex; >- iface->get_row_at_index = webkitAccessibleTableGetRowAtIndex; >- iface->get_n_columns = webkitAccessibleTableGetNColumns; >- iface->get_n_rows = webkitAccessibleTableGetNRows; >- iface->get_column_extent_at = webkitAccessibleTableGetColumnExtentAt; >- iface->get_row_extent_at = webkitAccessibleTableGetRowExtentAt; >- iface->get_column_header = webkitAccessibleTableGetColumnHeader; >- iface->get_row_header = webkitAccessibleTableGetRowHeader; >- iface->get_caption = webkitAccessibleTableGetCaption; >- iface->get_column_description = webkitAccessibleTableGetColumnDescription; >- iface->get_row_description = webkitAccessibleTableGetRowDescription; >-} >- >-#endif >diff --git a/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceTable.h b/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceTable.h >deleted file mode 100644 >index f42b5cfd6b37..000000000000 >--- a/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceTable.h >+++ /dev/null >@@ -1,30 +0,0 @@ >-/* >- * Copyright (C) 2008 Nuanti Ltd. >- * Copyright (C) 2009 Jan Alonzo >- * Copyright (C) 2009, 2010, 2011, 2012 Igalia S.L. >- * >- * This library is free software; you can redistribute it and/or >- * modify it under the terms of the GNU Library General Public >- * License as published by the Free Software Foundation; either >- * version 2 of the License, or (at your option) any later version. >- * >- * This library is distributed in the hope that it will be useful, >- * but WITHOUT ANY WARRANTY; without even the implied warranty of >- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- * Library General Public License for more details. >- * >- * You should have received a copy of the GNU Library General Public License >- * along with this library; see the file COPYING.LIB. If not, write to >- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >- * Boston, MA 02110-1301, USA. >- */ >- >-#pragma once >- >-#if ENABLE(ACCESSIBILITY) && USE(ATK) >- >-#include <atk/atk.h> >- >-void webkitAccessibleTableInterfaceInit(AtkTableIface*); >- >-#endif // ENABLE(ACCESSIBILITY) && USE(ATK) >diff --git a/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceTableCell.cpp b/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceTableCell.cpp >deleted file mode 100644 >index 86e7a75865b5..000000000000 >--- a/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceTableCell.cpp >+++ /dev/null >@@ -1,156 +0,0 @@ >-/* >- * Copyright (C) 2014 Samsung Electronics. All rights reserved. >- * >- * This library is free software; you can redistribute it and/or >- * modify it under the terms of the GNU Library General Public >- * License as published by the Free Software Foundation; either >- * version 2 of the License, or (at your option) any later version. >- * >- * This library is distributed in the hope that it will be useful, >- * but WITHOUT ANY WARRANTY; without even the implied warranty of >- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- * Library General Public License for more details. >- * >- * You should have received a copy of the GNU Library General Public License >- * along with this library; see the file COPYING.LIB. If not, write to >- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >- * Boston, MA 02110-1301, USA. >- */ >- >-#include "config.h" >-#include "WebKitAccessibleInterfaceTableCell.h" >- >-#if ENABLE(ACCESSIBILITY) && USE(ATK) >- >-#include "AccessibilityObject.h" >-#include "AccessibilityTable.h" >-#include "AccessibilityTableCell.h" >-#include "WebKitAccessible.h" >-#include "WebKitAccessibleUtil.h" >- >-using namespace WebCore; >- >-static GPtrArray* convertToGPtrArray(const AccessibilityObject::AccessibilityChildrenVector& children) >-{ >- GPtrArray* array = g_ptr_array_new(); >- for (const auto& child : children) { >- if (auto* atkObject = child->wrapper()) >- g_ptr_array_add(array, atkObject); >- } >- return array; >-} >- >-static AccessibilityObject* core(AtkTableCell* cell) >-{ >- if (!WEBKIT_IS_ACCESSIBLE(cell)) >- return nullptr; >- >- return &webkitAccessibleGetAccessibilityObject(WEBKIT_ACCESSIBLE(cell)); >-} >- >-GPtrArray* webkitAccessibleTableCellGetColumnHeaderCells(AtkTableCell* cell) >-{ >- g_return_val_if_fail(ATK_TABLE_CELL(cell), nullptr); >- returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(cell), nullptr); >- >- AccessibilityObject* axObject = core(cell); >- if (!is<AccessibilityTableCell>(axObject)) >- return nullptr; >- >- auto columnHeaders = downcast<AccessibilityTableCell>(*axObject).columnHeaders(); >- >- return convertToGPtrArray(columnHeaders); >-} >- >-GPtrArray* webkitAccessibleTableCellGetRowHeaderCells(AtkTableCell* cell) >-{ >- g_return_val_if_fail(ATK_TABLE_CELL(cell), nullptr); >- returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(cell), nullptr); >- >- AccessibilityObject* axObject = core(cell); >- if (!is<AccessibilityTableCell>(axObject)) >- return nullptr; >- >- auto rowHeaders = downcast<AccessibilityTableCell>(*axObject).rowHeaders(); >- >- return convertToGPtrArray(rowHeaders); >-} >- >-gint webkitAccessibleTableCellGetColumnSpan(AtkTableCell* cell) >-{ >- g_return_val_if_fail(ATK_TABLE_CELL(cell), 0); >- returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(cell), 0); >- >- AccessibilityObject* axObject = core(cell); >- if (!is<AccessibilityTableCell>(axObject)) >- return 0; >- >- return axObject->columnIndexRange().second; >-} >- >-gint webkitAccessibleTableCellGetRowSpan(AtkTableCell* cell) >-{ >- g_return_val_if_fail(ATK_TABLE_CELL(cell), 0); >- returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(cell), 0); >- >- AccessibilityObject* axObject = core(cell); >- if (!is<AccessibilityTableCell>(axObject)) >- return 0; >- >- return axObject->rowIndexRange().second; >-} >- >-gboolean webkitAccessibleTableCellGetPosition(AtkTableCell* cell, gint* row, gint* column) >-{ >- g_return_val_if_fail(ATK_TABLE_CELL(cell), false); >- returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(cell), false); >- >- AccessibilityObject* axObject = core(cell); >- if (!is<AccessibilityTableCell>(axObject)) >- return false; >- >- if (row) { >- // aria-rowindex is 1-based. >- int rowIndex = axObject->axRowIndex() - 1; >- if (rowIndex <= -1) >- rowIndex = axObject->rowIndexRange().first; >- *row = rowIndex; >- } >- if (column) { >- // aria-colindex is 1-based. >- int columnIndex = axObject->axColumnIndex() - 1; >- if (columnIndex <= -1) >- columnIndex = axObject->columnIndexRange().first; >- *column = columnIndex; >- } >- >- return true; >-} >- >-AtkObject* webkitAccessibleTableCellGetTable(AtkTableCell* cell) >-{ >- g_return_val_if_fail(ATK_TABLE_CELL(cell), nullptr); >- returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(cell), nullptr); >- >- AccessibilityObject* axObject = core(cell); >- if (!axObject || !axObject->isTableCell()) >- return nullptr; >- >- auto* table = atk_object_get_parent(ATK_OBJECT(axObject->wrapper())); >- if (!table || !ATK_IS_TABLE(table)) >- return nullptr; >- >- return ATK_OBJECT(g_object_ref(table)); >-} >- >-void webkitAccessibleTableCellInterfaceInit(AtkTableCellIface* iface) >-{ >- iface->get_column_header_cells = webkitAccessibleTableCellGetColumnHeaderCells; >- iface->get_row_header_cells = webkitAccessibleTableCellGetRowHeaderCells; >- iface->get_column_span = webkitAccessibleTableCellGetColumnSpan; >- iface->get_row_span = webkitAccessibleTableCellGetRowSpan; >- iface->get_position = webkitAccessibleTableCellGetPosition; >- iface->get_table = webkitAccessibleTableCellGetTable; >-} >- >-#endif // ENABLE(ACCESSIBILITY) && USE(ATK) >diff --git a/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceTableCell.h b/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceTableCell.h >deleted file mode 100644 >index f2d7034e45fb..000000000000 >--- a/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceTableCell.h >+++ /dev/null >@@ -1,30 +0,0 @@ >-/* >- * Copyright (C) 2008 Nuanti Ltd. >- * Copyright (C) 2009 Jan Alonzo >- * Copyright (C) 2009, 2010, 2011, 2012 Igalia S.L. >- * >- * This library is free software; you can redistribute it and/or >- * modify it under the terms of the GNU Library General Public >- * License as published by the Free Software Foundation; either >- * version 2 of the License, or (at your option) any later version. >- * >- * This library is distributed in the hope that it will be useful, >- * but WITHOUT ANY WARRANTY; without even the implied warranty of >- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- * Library General Public License for more details. >- * >- * You should have received a copy of the GNU Library General Public License >- * along with this library; see the file COPYING.LIB. If not, write to >- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >- * Boston, MA 02110-1301, USA. >- */ >- >-#pragma once >- >-#if ENABLE(ACCESSIBILITY) && USE(ATK) >- >-#include <atk/atk.h> >- >-void webkitAccessibleTableCellInterfaceInit(AtkTableCellIface*); >- >-#endif // ENABLE(ACCESSIBILITY) && USE(ATK) >diff --git a/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceText.cpp b/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceText.cpp >deleted file mode 100644 >index 0d96308b0160..000000000000 >--- a/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceText.cpp >+++ /dev/null >@@ -1,1270 +0,0 @@ >-/* >- * Copyright (C) 2008 Nuanti Ltd. >- * Copyright (C) 2009 Jan Alonzo >- * Copyright (C) 2009, 2010, 2011, 2012 Igalia S.L. >- * Copyright (C) 2013 Samsung Electronics. All rights reserved. >- * >- * Portions from Mozilla a11y, copyright as follows: >- * >- * The Original Code is mozilla.org code. >- * >- * The Initial Developer of the Original Code is >- * Sun Microsystems, Inc. >- * Portions created by the Initial Developer are Copyright (C) 2002 >- * the Initial Developer. All Rights Reserved. >- * >- * This library is free software; you can redistribute it and/or >- * modify it under the terms of the GNU Library General Public >- * License as published by the Free Software Foundation; either >- * version 2 of the License, or (at your option) any later version. >- * >- * This library is distributed in the hope that it will be useful, >- * but WITHOUT ANY WARRANTY; without even the implied warranty of >- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- * Library General Public License for more details. >- * >- * You should have received a copy of the GNU Library General Public License >- * along with this library; see the file COPYING.LIB. If not, write to >- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >- * Boston, MA 02110-1301, USA. >- */ >- >-#include "config.h" >-#include "WebKitAccessibleInterfaceText.h" >- >-#if ENABLE(ACCESSIBILITY) && USE(ATK) >- >-#include "AccessibilityObject.h" >-#include "Document.h" >-#include "Editing.h" >-#include "FontCascade.h" >-#include "FrameView.h" >-#include "HTMLParserIdioms.h" >-#include "HostWindow.h" >-#include "NotImplemented.h" >-#include "Range.h" >-#include "RenderListItem.h" >-#include "RenderListMarker.h" >-#include "RenderText.h" >-#include "TextIterator.h" >-#include "VisibleUnits.h" >-#include "WebKitAccessible.h" >-#include "WebKitAccessibleUtil.h" >-#include <pal/text/TextEncoding.h> >-#include <wtf/glib/GUniquePtr.h> >-#include <wtf/text/CString.h> >- >-using namespace WebCore; >- >-// Text attribute to expose the ARIA 'aria-invalid' attribute. Initially initialized >-// to ATK_TEXT_ATTR_INVALID (which means 'invalid' text attribute'), will later on >-// hold a reference to the custom registered AtkTextAttribute that we will use. >-static AtkTextAttribute atkTextAttributeInvalid = ATK_TEXT_ATTR_INVALID; >- >-static AccessibilityObject* core(AtkText* text) >-{ >- if (!WEBKIT_IS_ACCESSIBLE(text)) >- return 0; >- >- return &webkitAccessibleGetAccessibilityObject(WEBKIT_ACCESSIBLE(text)); >-} >- >-static int baselinePositionForRenderObject(RenderObject* renderObject) >-{ >- // FIXME: This implementation of baselinePosition originates from RenderObject.cpp and was >- // removed in r70072. The implementation looks incorrect though, because this is not the >- // baseline of the underlying RenderObject, but of the AccessibilityRenderObject. >- const FontMetrics& fontMetrics = renderObject->firstLineStyle().metricsOfPrimaryFont(); >- return fontMetrics.ascent() + (renderObject->firstLineStyle().computedLineHeight() - fontMetrics.height()) / 2; >-} >- >-static AtkAttributeSet* getAttributeSetForAccessibilityObject(const AccessibilityObject* object) >-{ >- if (!object->isAccessibilityRenderObject()) >- return 0; >- >- RenderObject* renderer = object->renderer(); >- auto* style = &renderer->style(); >- >- AtkAttributeSet* result = nullptr; >- GUniquePtr<gchar> buffer(g_strdup_printf("%i", style->computedFontPixelSize())); >- result = addToAtkAttributeSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_SIZE), buffer.get()); >- >- Color bgColor = style->visitedDependentColor(CSSPropertyBackgroundColor); >- if (bgColor.isValid()) { >- auto [r, g, b, a] = bgColor.toColorTypeLossy<SRGBA<uint8_t>>().resolved(); >- buffer.reset(g_strdup_printf("%i,%i,%i", r, g, b)); >- result = addToAtkAttributeSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_BG_COLOR), buffer.get()); >- } >- >- Color fgColor = style->visitedDependentColor(CSSPropertyColor); >- if (fgColor.isValid()) { >- auto [r, g, b, a] = fgColor.toColorTypeLossy<SRGBA<uint8_t>>().resolved(); >- buffer.reset(g_strdup_printf("%i,%i,%i", r, g, b)); >- result = addToAtkAttributeSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_FG_COLOR), buffer.get()); >- } >- >- int baselinePosition; >- bool includeRise = true; >- switch (style->verticalAlign()) { >- case VerticalAlign::Sub: >- baselinePosition = -1 * baselinePositionForRenderObject(renderer); >- break; >- case VerticalAlign::Super: >- baselinePosition = baselinePositionForRenderObject(renderer); >- break; >- case VerticalAlign::Baseline: >- baselinePosition = 0; >- break; >- default: >- includeRise = false; >- break; >- } >- >- if (includeRise) { >- buffer.reset(g_strdup_printf("%i", baselinePosition)); >- result = addToAtkAttributeSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_RISE), buffer.get()); >- } >- >- if (!style->textIndent().isUndefined()) { >- int indentation = valueForLength(style->textIndent(), object->size().width()); >- buffer.reset(g_strdup_printf("%i", indentation)); >- result = addToAtkAttributeSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_INDENT), buffer.get()); >- } >- >- String fontFamilyName = style->fontCascade().firstFamily(); >- if (fontFamilyName.left(8) == "-webkit-") >- fontFamilyName = fontFamilyName.substring(8); >- >- result = addToAtkAttributeSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_FAMILY_NAME), fontFamilyName.utf8().data()); >- >- int fontWeight = static_cast<float>(style->fontCascade().weight()); >- if (fontWeight > 0) { >- buffer.reset(g_strdup_printf("%i", fontWeight)); >- result = addToAtkAttributeSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_WEIGHT), buffer.get()); >- } >- >- switch (style->textAlign()) { >- case TextAlignMode::Start: >- case TextAlignMode::End: >- break; >- case TextAlignMode::Left: >- case TextAlignMode::WebKitLeft: >- result = addToAtkAttributeSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_JUSTIFICATION), "left"); >- break; >- case TextAlignMode::Right: >- case TextAlignMode::WebKitRight: >- result = addToAtkAttributeSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_JUSTIFICATION), "right"); >- break; >- case TextAlignMode::Center: >- case TextAlignMode::WebKitCenter: >- result = addToAtkAttributeSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_JUSTIFICATION), "center"); >- break; >- case TextAlignMode::Justify: >- result = addToAtkAttributeSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_JUSTIFICATION), "fill"); >- } >- >- result = addToAtkAttributeSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_UNDERLINE), (style->textDecorationLine() & TextDecorationLine::Underline) ? "single" : "none"); >- >- result = addToAtkAttributeSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_STYLE), style->fontCascade().italic() ? "italic" : "normal"); >- >- result = addToAtkAttributeSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_STRIKETHROUGH), (style->textDecorationLine() & TextDecorationLine::LineThrough) ? "true" : "false"); >- >- result = addToAtkAttributeSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_INVISIBLE), (style->visibility() == Visibility::Hidden) ? "true" : "false"); >- >- result = addToAtkAttributeSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_EDITABLE), object->canSetValueAttribute() ? "true" : "false"); >- >- String language = object->language(); >- if (!language.isEmpty()) >- result = addToAtkAttributeSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_LANGUAGE), language.utf8().data()); >- >- String invalidStatus = object->invalidStatus(); >- if (invalidStatus != "false") { >- // Register the custom attribute for 'aria-invalid' if not done yet. >- if (atkTextAttributeInvalid == ATK_TEXT_ATTR_INVALID) >- atkTextAttributeInvalid = atk_text_attribute_register("invalid"); >- >- result = addToAtkAttributeSet(result, atk_text_attribute_get_name(atkTextAttributeInvalid), invalidStatus.utf8().data()); >- } >- >- return result; >-} >- >-static gint compareAttribute(const AtkAttribute* a, const AtkAttribute* b) >-{ >- return g_strcmp0(a->name, b->name) || g_strcmp0(a->value, b->value); >-} >- >-// Returns an AtkAttributeSet with the elements of attributeSet1 which >-// are either not present or different in attributeSet2. Neither >-// attributeSet1 nor attributeSet2 should be used after calling this. >-static AtkAttributeSet* attributeSetDifference(AtkAttributeSet* attributeSet1, AtkAttributeSet* attributeSet2) >-{ >- if (!attributeSet2) >- return attributeSet1; >- >- AtkAttributeSet* currentSet = attributeSet1; >- AtkAttributeSet* found; >- AtkAttributeSet* toDelete = nullptr; >- >- while (currentSet) { >- found = g_slist_find_custom(attributeSet2, currentSet->data, (GCompareFunc)compareAttribute); >- if (found) { >- AtkAttributeSet* nextSet = currentSet->next; >- toDelete = g_slist_prepend(toDelete, currentSet->data); >- attributeSet1 = g_slist_delete_link(attributeSet1, currentSet); >- currentSet = nextSet; >- } else >- currentSet = currentSet->next; >- } >- >- atk_attribute_set_free(attributeSet2); >- atk_attribute_set_free(toDelete); >- return attributeSet1; >-} >- >-static gchar* webkitAccessibleTextGetText(AtkText*, gint startOffset, gint endOffset); >- >-static guint accessibilityObjectLength(const AccessibilityObject* object) >-{ >- // Non render objects are not taken into account >- if (!object->isAccessibilityRenderObject()) >- return 0; >- >- // For those objects implementing the AtkText interface we use the >- // well known API to always get the text in a consistent way >- auto* atkObj = ATK_OBJECT(object->wrapper()); >- if (ATK_IS_TEXT(atkObj)) { >- GUniquePtr<gchar> text(webkitAccessibleTextGetText(ATK_TEXT(atkObj), 0, -1)); >- return g_utf8_strlen(text.get(), -1); >- } >- >- // Even if we don't expose list markers to Assistive >- // Technologies, we need to have a way to measure their length >- // for those cases when it's needed to take it into account >- // separately (as in getAccessibilityObjectForOffset) >- if (auto renderer = object->renderer(); is<RenderListMarker>(renderer)) >- return downcast<RenderListMarker>(*renderer).textWithSuffix().length(); >- >- return 0; >-} >- >-static const AccessibilityObject* getAccessibilityObjectForOffset(const AccessibilityObject* object, guint offset, gint* startOffset, gint* endOffset) >-{ >- const AccessibilityObject* result; >- guint length = accessibilityObjectLength(object); >- if (length > offset) { >- *startOffset = 0; >- *endOffset = length; >- result = object; >- } else { >- *startOffset = -1; >- *endOffset = -1; >- result = 0; >- } >- >- if (!object->firstChild()) >- return result; >- >- AccessibilityObject* child = object->firstChild(); >- guint currentOffset = 0; >- guint childPosition = 0; >- while (child && currentOffset <= offset) { >- guint childLength = accessibilityObjectLength(child); >- currentOffset = childLength + childPosition; >- if (currentOffset > offset) { >- gint childStartOffset; >- gint childEndOffset; >- const AccessibilityObject* grandChild = getAccessibilityObjectForOffset(child, offset-childPosition, &childStartOffset, &childEndOffset); >- if (childStartOffset >= 0) { >- *startOffset = childStartOffset + childPosition; >- *endOffset = childEndOffset + childPosition; >- result = grandChild; >- } >- } else { >- childPosition += childLength; >- child = child->nextSibling(); >- } >- } >- return result; >-} >- >-static AtkAttributeSet* getRunAttributesFromAccessibilityObject(const AccessibilityObject* element, gint offset, gint* startOffset, gint* endOffset) >-{ >- const AccessibilityObject* child = getAccessibilityObjectForOffset(element, offset, startOffset, endOffset); >- if (!child) { >- *startOffset = -1; >- *endOffset = -1; >- return 0; >- } >- >- AtkAttributeSet* defaultAttributes = getAttributeSetForAccessibilityObject(element); >- AtkAttributeSet* childAttributes = getAttributeSetForAccessibilityObject(child); >- >- return attributeSetDifference(childAttributes, defaultAttributes); >-} >- >-static IntRect textExtents(AtkText* text, gint startOffset, gint length, AtkCoordType coords) >-{ >- GUniquePtr<char> textContent(webkitAccessibleTextGetText(text, startOffset, -1)); >- gint textLength = g_utf8_strlen(textContent.get(), -1); >- >- // The first case (endOffset of -1) should work, but seems broken for all Gtk+ apps. >- gint rangeLength = length; >- if (rangeLength < 0 || rangeLength > textLength) >- rangeLength = textLength; >- AccessibilityObject* coreObject = core(text); >- >- IntRect extents = coreObject->doAXBoundsForRange(PlainTextRange(startOffset, rangeLength)); >- switch (coords) { >- case ATK_XY_SCREEN: >- if (Document* document = coreObject->document()) >- extents = document->view()->contentsToScreen(extents); >- break; >- case ATK_XY_WINDOW: >- // No-op >- break; >-#if ATK_CHECK_VERSION(2, 30, 0) >- case ATK_XY_PARENT: >- RELEASE_ASSERT_NOT_REACHED(); >-#endif >- } >- >- return extents; >-} >- >-static int offsetAdjustmentForListItem(const AXCoreObject* object) >-{ >- // We need to adjust the offsets for the list item marker in >- // Left-To-Right text, since we expose it together with the text. >- RenderObject* renderer = object->renderer(); >- if (is<RenderListItem>(renderer) && renderer->style().direction() == TextDirection::LTR) >- return downcast<RenderListItem>(*renderer).markerTextWithSuffix().length(); >- >- return 0; >-} >- >-static int webCoreOffsetToAtkOffset(const AXCoreObject* object, int offset) >-{ >- if (!object->isListItem()) >- return offset; >- >- return offset + offsetAdjustmentForListItem(object); >-} >- >-static int atkOffsetToWebCoreOffset(AtkText* text, int offset) >-{ >- AccessibilityObject* coreObject = core(text); >- if (!coreObject || !coreObject->isListItem()) >- return offset; >- >- return offset - offsetAdjustmentForListItem(coreObject); >-} >- >-static Node* getNodeForAccessibilityObject(AccessibilityObject* coreObject) >-{ >- if (!coreObject->isNativeTextControl()) >- return coreObject->node(); >- >- // For text controls, we get the first visible position on it (which will >- // belong to its inner element, unreachable from the DOM) and return its >- // parent node, so we have a "bounding node" for the accessibility object. >- VisiblePosition positionInTextControlInnerElement = coreObject->visiblePositionForIndex(0, true); >- Node* innerMostNode = positionInTextControlInnerElement.deepEquivalent().anchorNode(); >- if (!innerMostNode) >- return 0; >- >- return innerMostNode->parentNode(); >-} >- >-static void getSelectionOffsetsForObject(AccessibilityObject* coreObject, VisibleSelection& selection, gint& startOffset, gint& endOffset) >-{ >- // Default values, unless the contrary is proved. >- startOffset = 0; >- endOffset = 0; >- >- Node* node = getNodeForAccessibilityObject(coreObject); >- if (!node) >- return; >- >- if (selection.isNone()) >- return; >- >- // We need to limit our search to positions that fall inside the domain of the current object. >- Position firstValidPosition = firstPositionInOrBeforeNode(node->firstDescendant()); >- Position lastValidPosition = lastPositionInOrAfterNode(node->lastDescendant()); >- >- // Find the proper range for the selection that falls inside the object. >- auto nodeRangeStart = std::max(selection.start(), firstValidPosition); >- auto nodeRangeEnd = std::min(selection.end(), lastValidPosition); >- >- // Calculate position of the selected range inside the object. >- Position parentFirstPosition = firstPositionInOrBeforeNode(node); >- auto rangeInParent = *makeSimpleRange(parentFirstPosition, nodeRangeStart); >- >- // Set values for start offsets and calculate initial range length. >- // These values might be adjusted later to cover special cases. >- startOffset = webCoreOffsetToAtkOffset(coreObject, characterCount(rangeInParent, TextIteratorBehavior::EmitsCharactersBetweenAllVisiblePositions)); >- auto nodeRange = *makeSimpleRange(nodeRangeStart, nodeRangeEnd); >- int rangeLength = characterCount(nodeRange, TextIteratorBehavior::EmitsCharactersBetweenAllVisiblePositions); >- >- // Special cases that are only relevant when working with *_END boundaries. >- if (selection.affinity() == Affinity::Upstream) { >- VisiblePosition visibleStart(nodeRangeStart, Affinity::Upstream); >- VisiblePosition visibleEnd(nodeRangeEnd, Affinity::Upstream); >- >- // We need to adjust offsets when finding wrapped lines so the position at the end >- // of the line is properly taking into account when calculating the offsets. >- if (isEndOfLine(visibleStart) && !lineBreakExistsAtVisiblePosition(visibleStart)) { >- if (isStartOfLine(visibleStart.next())) >- rangeLength++; >- >- if (!isEndOfBlock(visibleStart)) >- startOffset = std::max(startOffset - 1, 0); >- } >- >- if (isEndOfLine(visibleEnd) && !lineBreakExistsAtVisiblePosition(visibleEnd) && !isEndOfBlock(visibleEnd)) >- rangeLength--; >- } >- >- endOffset = std::min(startOffset + rangeLength, static_cast<int>(accessibilityObjectLength(coreObject))); >-} >- >-static gchar* webkitAccessibleTextGetText(AtkText* text, gint startOffset, gint endOffset) >-{ >- g_return_val_if_fail(ATK_TEXT(text), 0); >- returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(text), 0); >- >- AccessibilityObject* coreObject = core(text); >- >-#if ENABLE(INPUT_TYPE_COLOR) >- if (coreObject->roleValue() == AccessibilityRole::ColorWell) { >- auto color = convertColor<SRGBA<float>>(coreObject->colorValue()).resolved(); >- return g_strdup_printf("rgb %7.5f %7.5f %7.5f 1", color.red, color.green, color.blue); >- } >-#endif >- >- String ret; >- if (coreObject->isTextControl()) >- ret = coreObject->doAXStringForRange(PlainTextRange(0, endOffset)); >- else { >- ret = coreObject->stringValue(); >- if (!ret) >- ret = coreObject->textUnderElement(AccessibilityTextUnderElementMode(AccessibilityTextUnderElementMode::TextUnderElementModeIncludeAllChildren)); >- } >- >- // Prefix a item number/bullet if needed >- int actualEndOffset = endOffset == -1 ? ret.length() : endOffset; >- if (coreObject->roleValue() == AccessibilityRole::ListItem) { >- RenderObject* objRenderer = coreObject->renderer(); >- if (is<RenderListItem>(objRenderer)) { >- String markerText = downcast<RenderListItem>(*objRenderer).markerTextWithSuffix().toString(); >- ret = objRenderer->style().direction() == TextDirection::LTR ? markerText + ret : ret + markerText; >- if (endOffset == -1) >- actualEndOffset = ret.length() + markerText.length(); >- } >- } >- >- ret = ret.substring(startOffset, actualEndOffset - startOffset); >- return g_strdup(ret.utf8().data()); >-} >- >-enum GetTextRelativePosition { >- GetTextPositionAt, >- GetTextPositionBefore, >- GetTextPositionAfter >-}; >- >-// Convenience function to be used in early returns. >-static char* emptyTextSelectionAtOffset(int offset, int* startOffset, int* endOffset) >-{ >- *startOffset = offset; >- *endOffset = offset; >- return g_strdup(""); >-} >- >-static char* webkitAccessibleTextGetChar(AtkText* text, int offset, GetTextRelativePosition textPosition, int* startOffset, int* endOffset) >-{ >- int actualOffset = offset; >- if (textPosition == GetTextPositionBefore) >- actualOffset--; >- else if (textPosition == GetTextPositionAfter) >- actualOffset++; >- >- GUniquePtr<char> textData(webkitAccessibleTextGetText(text, 0, -1)); >- int textLength = g_utf8_strlen(textData.get(), -1); >- >- *startOffset = std::max(0, actualOffset); >- *startOffset = std::min(*startOffset, textLength); >- >- *endOffset = std::max(0, actualOffset + 1); >- *endOffset = std::min(*endOffset, textLength); >- >- if (*startOffset == *endOffset) >- return g_strdup(""); >- >- return g_utf8_substring(textData.get(), *startOffset, *endOffset); >-} >- >-static VisiblePosition nextWordStartPosition(const VisiblePosition &position) >-{ >- VisiblePosition positionAfterCurrentWord = nextWordPosition(position); >- >- // In order to skip spaces when moving right, we advance one word further >- // and then move one word back. This will put us at the beginning of the >- // word following. >- VisiblePosition positionAfterSpacingAndFollowingWord = nextWordPosition(positionAfterCurrentWord); >- >- if (positionAfterSpacingAndFollowingWord != positionAfterCurrentWord) >- positionAfterCurrentWord = previousWordPosition(positionAfterSpacingAndFollowingWord); >- >- bool movingBackwardsMovedPositionToStartOfCurrentWord = positionAfterCurrentWord == previousWordPosition(nextWordPosition(position)); >- if (movingBackwardsMovedPositionToStartOfCurrentWord) >- positionAfterCurrentWord = positionAfterSpacingAndFollowingWord; >- >- return positionAfterCurrentWord; >-} >- >-static VisiblePosition previousWordEndPosition(const VisiblePosition &position) >-{ >- // We move forward and then backward to position ourselves at the beginning >- // of the current word for this boundary, making the most of the semantics >- // of previousWordPosition() and nextWordPosition(). >- VisiblePosition positionAtStartOfCurrentWord = previousWordPosition(nextWordPosition(position)); >- VisiblePosition positionAtPreviousWord = previousWordPosition(position); >- >- // Need to consider special cases (punctuation) when we are in the last word of a sentence. >- if (isStartOfWord(position) && positionAtPreviousWord != position && positionAtPreviousWord == positionAtStartOfCurrentWord) >- return nextWordPosition(positionAtStartOfCurrentWord); >- >- // In order to skip spaces when moving left, we advance one word backwards >- // and then move one word forward. This will put us at the beginning of >- // the word following. >- VisiblePosition positionBeforeSpacingAndPreceedingWord = previousWordPosition(positionAtStartOfCurrentWord); >- >- if (positionBeforeSpacingAndPreceedingWord != positionAtStartOfCurrentWord) >- positionAtStartOfCurrentWord = nextWordPosition(positionBeforeSpacingAndPreceedingWord); >- >- bool movingForwardMovedPositionToEndOfCurrentWord = nextWordPosition(positionAtStartOfCurrentWord) == previousWordPosition(nextWordPosition(position)); >- if (movingForwardMovedPositionToEndOfCurrentWord) >- positionAtStartOfCurrentWord = positionBeforeSpacingAndPreceedingWord; >- >- return positionAtStartOfCurrentWord; >-} >- >-static VisibleSelection wordAtPositionForAtkBoundary(const AccessibilityObject* /*coreObject*/, const VisiblePosition& position, AtkTextBoundary boundaryType) >-{ >- VisiblePosition startPosition; >- VisiblePosition endPosition; >- >- switch (boundaryType) { >- case ATK_TEXT_BOUNDARY_WORD_START: >- // isStartOfWord() returns true both when at the beginning of a "real" word >- // as when at the beginning of a whitespace range between two "real" words, >- // since that whitespace is considered a "word" as well. And in case we are >- // already at the beginning of a "real" word we do not need to look backwards. >- if (isStartOfWord(position) && deprecatedIsEditingWhitespace(position.characterBefore())) >- startPosition = position; >- else >- startPosition = previousWordPosition(position); >- endPosition = nextWordStartPosition(startPosition); >- >- // We need to make sure that we look for the word in the current line when >- // we are at the beginning of a new line, and not look into the previous one >- // at all, which might happen when lines belong to different nodes. >- if (isStartOfLine(position) && isStartOfLine(endPosition)) { >- startPosition = endPosition; >- endPosition = nextWordStartPosition(startPosition); >- } >- break; >- >- case ATK_TEXT_BOUNDARY_WORD_END: >- startPosition = previousWordEndPosition(position); >- endPosition = nextWordPosition(startPosition); >- break; >- >- default: >- ASSERT_NOT_REACHED(); >- } >- >- VisibleSelection selectedWord(startPosition, endPosition); >- >- // We mark the selection as 'upstream' so we can use that information later, >- // when finding the actual offsets in getSelectionOffsetsForObject(). >- if (boundaryType == ATK_TEXT_BOUNDARY_WORD_END) >- selectedWord.setAffinity(Affinity::Upstream); >- >- return selectedWord; >-} >- >-static int numberOfReplacedElementsBeforeOffset(AtkText* text, unsigned offset) >-{ >- GUniquePtr<char> textForObject(webkitAccessibleTextGetText(text, 0, offset)); >- String textBeforeOffset = String::fromUTF8(textForObject.get()); >- >- int count = 0; >- size_t index = textBeforeOffset.find(objectReplacementCharacter, 0); >- while (index < offset && index != notFound) { >- index = textBeforeOffset.find(objectReplacementCharacter, index + 1); >- count++; >- } >- return count; >-} >- >-static char* webkitAccessibleTextWordForBoundary(AtkText* text, int offset, AtkTextBoundary boundaryType, GetTextRelativePosition textPosition, int* startOffset, int* endOffset) >-{ >- AccessibilityObject* coreObject = core(text); >- Document* document = coreObject->document(); >- if (!document) >- return emptyTextSelectionAtOffset(0, startOffset, endOffset); >- >- Node* node = getNodeForAccessibilityObject(coreObject); >- if (!node) >- return emptyTextSelectionAtOffset(0, startOffset, endOffset); >- >- int actualOffset = atkOffsetToWebCoreOffset(text, offset); >- >- // Besides of the usual conversion from ATK offsets to WebCore offsets, >- // we need to consider the potential embedded objects that might have been >- // inserted in the text exposed through AtkText when calculating the offset. >- actualOffset -= numberOfReplacedElementsBeforeOffset(text, actualOffset); >- >- VisiblePosition caretPosition = coreObject->visiblePositionForIndex(actualOffset); >- VisibleSelection currentWord = wordAtPositionForAtkBoundary(coreObject, caretPosition, boundaryType); >- >- // Take into account other relative positions, if needed, by >- // calculating the new position that we would need to consider. >- VisiblePosition newPosition = caretPosition; >- switch (textPosition) { >- case GetTextPositionAt: >- break; >- >- case GetTextPositionBefore: >- // Early return if asking for the previous word while already at the beginning. >- if (isFirstVisiblePositionInNode(currentWord.visibleStart(), node)) >- return emptyTextSelectionAtOffset(0, startOffset, endOffset); >- >- if (isStartOfLine(currentWord.end())) >- newPosition = currentWord.visibleStart().previous(); >- else >- newPosition = startOfWord(currentWord.start(), LeftWordIfOnBoundary); >- break; >- >- case GetTextPositionAfter: >- // Early return if asking for the following word while already at the end. >- if (isLastVisiblePositionInNode(currentWord.visibleEnd(), node)) >- return emptyTextSelectionAtOffset(accessibilityObjectLength(coreObject), startOffset, endOffset); >- >- if (isEndOfLine(currentWord.end())) >- newPosition = currentWord.visibleEnd().next(); >- else >- newPosition = endOfWord(currentWord.end(), RightWordIfOnBoundary); >- break; >- >- default: >- ASSERT_NOT_REACHED(); >- } >- >- // Determine the relevant word we are actually interested in >- // and calculate the ATK offsets for it, then return everything. >- VisibleSelection selectedWord = newPosition != caretPosition ? wordAtPositionForAtkBoundary(coreObject, newPosition, boundaryType) : currentWord; >- getSelectionOffsetsForObject(coreObject, selectedWord, *startOffset, *endOffset); >- return webkitAccessibleTextGetText(text, *startOffset, *endOffset); >-} >- >-static bool isSentenceBoundary(const VisiblePosition &pos) >-{ >- if (pos.isNull()) >- return false; >- >- // It's definitely a sentence boundary if there's nothing before. >- if (pos.previous().isNull()) >- return true; >- >- // We go backwards and forward to make sure about this. >- VisiblePosition startOfPreviousSentence = startOfSentence(pos); >- return startOfPreviousSentence.isNotNull() && pos == endOfSentence(startOfPreviousSentence); >-} >- >-static bool isWhiteSpaceBetweenSentences(const VisiblePosition& position) >-{ >- if (position.isNull()) >- return false; >- >- if (!deprecatedIsEditingWhitespace(position.characterAfter())) >- return false; >- >- auto start = startOfWord(position, RightWordIfOnBoundary); >- auto end = endOfWord(start, RightWordIfOnBoundary); >- if (!isSentenceBoundary(start) && !isSentenceBoundary(end)) >- return false; >- >- auto range = makeSimpleRange(start, end); >- return range && contains<ComposedTree>(*range, makeBoundaryPoint(position)); >-} >- >-static VisibleSelection sentenceAtPositionForAtkBoundary(const AccessibilityObject*, const VisiblePosition& position, AtkTextBoundary boundaryType) >-{ >- VisiblePosition startPosition; >- VisiblePosition endPosition; >- >- bool isAtStartOfSentenceForEndBoundary = isWhiteSpaceBetweenSentences(position) || isSentenceBoundary(position); >- if (boundaryType == ATK_TEXT_BOUNDARY_SENTENCE_START || !isAtStartOfSentenceForEndBoundary) { >- startPosition = isSentenceBoundary(position) ? position : startOfSentence(position); >- // startOfSentence might stop at a linebreak in the HTML source code, >- // but we don't want to stop there yet, so keep going. >- while (!isSentenceBoundary(startPosition) && isHTMLLineBreak(startPosition.characterBefore())) >- startPosition = startOfSentence(startPosition); >- >- endPosition = endOfSentence(startPosition); >- } >- >- if (boundaryType == ATK_TEXT_BOUNDARY_SENTENCE_END) { >- if (isAtStartOfSentenceForEndBoundary) { >- startPosition = position; >- endPosition = endOfSentence(endOfWord(position, RightWordIfOnBoundary)); >- } >- >- // startOfSentence returns a position after any white space previous to >- // the sentence, so we might need to adjust that offset for this boundary. >- if (deprecatedIsEditingWhitespace(startPosition.characterBefore())) >- startPosition = startOfWord(startPosition, LeftWordIfOnBoundary); >- >- // endOfSentence returns a position after any white space after the >- // sentence, so we might need to adjust that offset for this boundary. >- if (deprecatedIsEditingWhitespace(endPosition.characterBefore())) >- endPosition = startOfWord(endPosition, LeftWordIfOnBoundary); >- >- // Finally, do some additional adjustments that might be needed if >- // positions are at the start or the end of a line. >- if (isStartOfLine(startPosition) && !isStartOfBlock(startPosition)) >- startPosition = startPosition.previous(); >- if (isStartOfLine(endPosition) && !isStartOfBlock(endPosition)) >- endPosition = endPosition.previous(); >- } >- >- VisibleSelection selectedSentence(startPosition, endPosition); >- >- // We mark the selection as 'upstream' so we can use that information later, >- // when finding the actual offsets in getSelectionOffsetsForObject(). >- if (boundaryType == ATK_TEXT_BOUNDARY_SENTENCE_END) >- selectedSentence.setAffinity(Affinity::Upstream); >- >- return selectedSentence; >-} >- >-static char* webkitAccessibleTextSentenceForBoundary(AtkText* text, int offset, AtkTextBoundary boundaryType, GetTextRelativePosition textPosition, int* startOffset, int* endOffset) >-{ >- AccessibilityObject* coreObject = core(text); >- Document* document = coreObject->document(); >- if (!document) >- return emptyTextSelectionAtOffset(0, startOffset, endOffset); >- >- Node* node = getNodeForAccessibilityObject(coreObject); >- if (!node) >- return emptyTextSelectionAtOffset(0, startOffset, endOffset); >- >- int actualOffset = atkOffsetToWebCoreOffset(text, offset); >- >- // Besides of the usual conversion from ATK offsets to WebCore offsets, >- // we need to consider the potential embedded objects that might have been >- // inserted in the text exposed through AtkText when calculating the offset. >- actualOffset -= numberOfReplacedElementsBeforeOffset(text, actualOffset); >- >- VisiblePosition caretPosition = coreObject->visiblePositionForIndex(actualOffset); >- VisibleSelection currentSentence = sentenceAtPositionForAtkBoundary(coreObject, caretPosition, boundaryType); >- >- // Take into account other relative positions, if needed, by >- // calculating the new position that we would need to consider. >- VisiblePosition newPosition = caretPosition; >- switch (textPosition) { >- case GetTextPositionAt: >- break; >- >- case GetTextPositionBefore: >- // Early return if asking for the previous sentence while already at the beginning. >- if (isFirstVisiblePositionInNode(currentSentence.visibleStart(), node)) >- return emptyTextSelectionAtOffset(0, startOffset, endOffset); >- newPosition = currentSentence.visibleStart().previous(); >- break; >- >- case GetTextPositionAfter: >- // Early return if asking for the following word while already at the end. >- if (isLastVisiblePositionInNode(currentSentence.visibleEnd(), node)) >- return emptyTextSelectionAtOffset(accessibilityObjectLength(coreObject), startOffset, endOffset); >- newPosition = currentSentence.visibleEnd().next(); >- break; >- >- default: >- ASSERT_NOT_REACHED(); >- } >- >- // Determine the relevant sentence we are actually interested in >- // and calculate the ATK offsets for it, then return everything. >- VisibleSelection selectedSentence = newPosition != caretPosition ? sentenceAtPositionForAtkBoundary(coreObject, newPosition, boundaryType) : currentSentence; >- getSelectionOffsetsForObject(coreObject, selectedSentence, *startOffset, *endOffset); >- return webkitAccessibleTextGetText(text, *startOffset, *endOffset); >-} >- >-static VisibleSelection lineAtPositionForAtkBoundary(const AccessibilityObject* coreObject, const VisiblePosition& position, AtkTextBoundary boundaryType) >-{ >- UNUSED_PARAM(coreObject); >- VisiblePosition startPosition; >- VisiblePosition endPosition; >- >- switch (boundaryType) { >- case ATK_TEXT_BOUNDARY_LINE_START: >- startPosition = isStartOfLine(position) ? position : logicalStartOfLine(position); >- endPosition = logicalEndOfLine(position); >- >- // In addition to checking that we are not at the end of a block, we need >- // to check that endPosition has not UPSTREAM affinity, since that would >- // cause trouble inside of text controls (we would be advancing too much). >- if (!isEndOfBlock(endPosition) && endPosition.affinity() != Affinity::Upstream) >- endPosition = endPosition.next(); >- break; >- >- case ATK_TEXT_BOUNDARY_LINE_END: >- startPosition = isEndOfLine(position) ? position : logicalStartOfLine(position); >- if (!isStartOfBlock(startPosition)) >- startPosition = startPosition.previous(); >- endPosition = logicalEndOfLine(position); >- break; >- >- default: >- ASSERT_NOT_REACHED(); >- } >- >- VisibleSelection selectedLine(startPosition, endPosition); >- >- // We mark the selection as 'upstream' so we can use that information later, >- // when finding the actual offsets in getSelectionOffsetsForObject(). >- if (boundaryType == ATK_TEXT_BOUNDARY_LINE_END) >- selectedLine.setAffinity(Affinity::Upstream); >- >- return selectedLine; >-} >- >-static char* webkitAccessibleTextLineForBoundary(AtkText* text, int offset, AtkTextBoundary boundaryType, GetTextRelativePosition textPosition, int* startOffset, int* endOffset) >-{ >- AccessibilityObject* coreObject = core(text); >- Document* document = coreObject->document(); >- if (!document) >- return emptyTextSelectionAtOffset(0, startOffset, endOffset); >- >- Node* node = getNodeForAccessibilityObject(coreObject); >- if (!node) >- return emptyTextSelectionAtOffset(0, startOffset, endOffset); >- >- int actualOffset = atkOffsetToWebCoreOffset(text, offset); >- >- // Besides the usual conversion from ATK offsets to WebCore offsets, >- // we need to consider the potential embedded objects that might have been >- // inserted in the text exposed through AtkText when calculating the offset. >- actualOffset -= numberOfReplacedElementsBeforeOffset(text, actualOffset); >- >- VisiblePosition caretPosition = coreObject->visiblePositionForIndex(actualOffset); >- VisibleSelection currentLine = lineAtPositionForAtkBoundary(coreObject, caretPosition, boundaryType); >- >- // Take into account other relative positions, if needed, by >- // calculating the new position that we would need to consider. >- VisiblePosition newPosition = caretPosition; >- switch (textPosition) { >- case GetTextPositionAt: >- // No need to do additional work if we are using the "at" position, we just >- // explicitly list this case option to catch invalid values in the default case. >- break; >- >- case GetTextPositionBefore: >- // Early return if asking for the previous line while already at the beginning. >- if (isFirstVisiblePositionInNode(currentLine.visibleStart(), node)) >- return emptyTextSelectionAtOffset(0, startOffset, endOffset); >- newPosition = currentLine.visibleStart().previous(); >- break; >- >- case GetTextPositionAfter: >- // Early return if asking for the following word while already at the end. >- if (isLastVisiblePositionInNode(currentLine.visibleEnd(), node)) >- return emptyTextSelectionAtOffset(accessibilityObjectLength(coreObject), startOffset, endOffset); >- newPosition = currentLine.visibleEnd().next(); >- break; >- >- default: >- ASSERT_NOT_REACHED(); >- } >- >- // Determine the relevant line we are actually interested in >- // and calculate the ATK offsets for it, then return everything. >- VisibleSelection selectedLine = newPosition != caretPosition ? lineAtPositionForAtkBoundary(coreObject, newPosition, boundaryType) : currentLine; >- getSelectionOffsetsForObject(coreObject, selectedLine, *startOffset, *endOffset); >- >- // We might need to adjust the start or end offset to include the list item marker, >- // if present, when printing the first or the last full line for a list item. >- RenderObject* renderer = coreObject->renderer(); >- if (renderer->isListItem()) { >- // For Left-to-Right, the list item marker is at the beginning of the exposed text. >- if (renderer->style().direction() == TextDirection::LTR && isFirstVisiblePositionInNode(selectedLine.visibleStart(), node)) >- *startOffset = 0; >- >- // For Right-to-Left, the list item marker is at the end of the exposed text. >- if (renderer->style().direction() == TextDirection::RTL && isLastVisiblePositionInNode(selectedLine.visibleEnd(), node)) >- *endOffset = accessibilityObjectLength(coreObject); >- } >- >- return webkitAccessibleTextGetText(text, *startOffset, *endOffset); >-} >- >-static gchar* webkitAccessibleTextGetTextForOffset(AtkText* text, gint offset, AtkTextBoundary boundaryType, GetTextRelativePosition textPosition, gint* startOffset, gint* endOffset) >-{ >- AccessibilityObject* coreObject = core(text); >- if (!coreObject || !coreObject->isAccessibilityRenderObject()) >- return emptyTextSelectionAtOffset(0, startOffset, endOffset); >- >- switch (boundaryType) { >- case ATK_TEXT_BOUNDARY_CHAR: >- return webkitAccessibleTextGetChar(text, offset, textPosition, startOffset, endOffset); >- >- case ATK_TEXT_BOUNDARY_WORD_START: >- case ATK_TEXT_BOUNDARY_WORD_END: >- return webkitAccessibleTextWordForBoundary(text, offset, boundaryType, textPosition, startOffset, endOffset); >- >- case ATK_TEXT_BOUNDARY_LINE_START: >- case ATK_TEXT_BOUNDARY_LINE_END: >- return webkitAccessibleTextLineForBoundary(text, offset, boundaryType, textPosition, startOffset, endOffset); >- >- case ATK_TEXT_BOUNDARY_SENTENCE_START: >- case ATK_TEXT_BOUNDARY_SENTENCE_END: >- return webkitAccessibleTextSentenceForBoundary(text, offset, boundaryType, textPosition, startOffset, endOffset); >- >- default: >- ASSERT_NOT_REACHED(); >- } >- >- // This should never be reached. >- return 0; >-} >- >-static gchar* webkitAccessibleTextGetTextAfterOffset(AtkText* text, gint offset, AtkTextBoundary boundaryType, gint* startOffset, gint* endOffset) >-{ >- g_return_val_if_fail(ATK_TEXT(text), 0); >- returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(text), 0); >- >- return webkitAccessibleTextGetTextForOffset(text, offset, boundaryType, GetTextPositionAfter, startOffset, endOffset); >-} >- >-static gchar* webkitAccessibleTextGetTextAtOffset(AtkText* text, gint offset, AtkTextBoundary boundaryType, gint* startOffset, gint* endOffset) >-{ >- g_return_val_if_fail(ATK_TEXT(text), 0); >- returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(text), 0); >- >- return webkitAccessibleTextGetTextForOffset(text, offset, boundaryType, GetTextPositionAt, startOffset, endOffset); >-} >- >-static gchar* webkitAccessibleTextGetTextBeforeOffset(AtkText* text, gint offset, AtkTextBoundary boundaryType, gint* startOffset, gint* endOffset) >-{ >- g_return_val_if_fail(ATK_TEXT(text), 0); >- returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(text), 0); >- >- return webkitAccessibleTextGetTextForOffset(text, offset, boundaryType, GetTextPositionBefore, startOffset, endOffset); >-} >- >-static gunichar webkitAccessibleTextGetCharacterAtOffset(AtkText* text, gint) >-{ >- g_return_val_if_fail(ATK_TEXT(text), 0); >- returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(text), 0); >- >- notImplemented(); >- return 0; >-} >- >-static gint webkitAccessibleTextGetCaretOffset(AtkText* text) >-{ >- g_return_val_if_fail(ATK_TEXT(text), 0); >- returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(text), 0); >- >- // coreObject is the unignored object whose offset the caller is requesting. >- // focusedObject is the object with the caret. It is likely ignored -- unless it's a link. >- AXCoreObject* coreObject = core(text); >- if (!coreObject->isAccessibilityRenderObject()) >- return 0; >- >- // We need to make sure we pass a valid object as reference. >- if (coreObject->accessibilityIsIgnored()) >- coreObject = coreObject->parentObjectUnignored(); >- if (!coreObject) >- return 0; >- >- int offset; >- if (!objectFocusedAndCaretOffsetUnignored(coreObject, offset)) >- return 0; >- >- return webCoreOffsetToAtkOffset(coreObject, offset); >-} >- >-static AtkAttributeSet* webkitAccessibleTextGetRunAttributes(AtkText* text, gint offset, gint* startOffset, gint* endOffset) >-{ >- g_return_val_if_fail(ATK_TEXT(text), 0); >- returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(text), 0); >- >- AccessibilityObject* coreObject = core(text); >- AtkAttributeSet* result; >- >- if (!coreObject) { >- *startOffset = 0; >- *endOffset = atk_text_get_character_count(text); >- return 0; >- } >- >- if (offset == -1) >- offset = atk_text_get_caret_offset(text); >- >- result = getRunAttributesFromAccessibilityObject(coreObject, offset, startOffset, endOffset); >- >- if (*startOffset < 0) { >- *startOffset = offset; >- *endOffset = offset; >- } >- >- return result; >-} >- >-static AtkAttributeSet* webkitAccessibleTextGetDefaultAttributes(AtkText* text) >-{ >- g_return_val_if_fail(ATK_TEXT(text), 0); >- returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(text), 0); >- >- AccessibilityObject* coreObject = core(text); >- if (!coreObject || !coreObject->isAccessibilityRenderObject()) >- return 0; >- >- return getAttributeSetForAccessibilityObject(coreObject); >-} >- >-static void webkitAccessibleTextGetCharacterExtents(AtkText* text, gint offset, gint* x, gint* y, gint* width, gint* height, AtkCoordType coords) >-{ >- g_return_if_fail(ATK_TEXT(text)); >- returnIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(text)); >- >- IntRect extents = textExtents(text, offset, 1, coords); >- *x = extents.x(); >- *y = extents.y(); >- *width = extents.width(); >- *height = extents.height(); >-} >- >-static void webkitAccessibleTextGetRangeExtents(AtkText* text, gint startOffset, gint endOffset, AtkCoordType coords, AtkTextRectangle* rect) >-{ >- g_return_if_fail(ATK_TEXT(text)); >- returnIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(text)); >- >- IntRect extents = textExtents(text, startOffset, endOffset - startOffset, coords); >- rect->x = extents.x(); >- rect->y = extents.y(); >- rect->width = extents.width(); >- rect->height = extents.height(); >-} >- >-static gint webkitAccessibleTextGetCharacterCount(AtkText* text) >-{ >- g_return_val_if_fail(ATK_TEXT(text), 0); >- returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(text), 0); >- >- return accessibilityObjectLength(core(text)); >-} >- >-static gint webkitAccessibleTextGetOffsetAtPoint(AtkText* text, gint x, gint y, AtkCoordType) >-{ >- g_return_val_if_fail(ATK_TEXT(text), 0); >- returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(text), 0); >- >- // FIXME: Use the AtkCoordType >- // TODO: Is it correct to ignore range.length? >- IntPoint pos(x, y); >- PlainTextRange range = core(text)->doAXRangeForPosition(pos); >- return range.start; >-} >- >-static gint webkitAccessibleTextGetNSelections(AtkText* text) >-{ >- g_return_val_if_fail(ATK_TEXT(text), 0); >- returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(text), 0); >- >- AccessibilityObject* coreObject = core(text); >- VisibleSelection selection = coreObject->selection(); >- >- // Only range selections are needed for the purpose of this method >- if (!selection.isRange()) >- return 0; >- >- // We don't support multiple selections for now, so there's only >- // two possibilities >- // Also, we don't want to do anything if the selection does not >- // belong to the currently selected object. We have to check since >- // there's no way to get the selection for a given object, only >- // the global one (the API is a bit confusing) >- return selectionBelongsToObject(coreObject, selection) ? 1 : 0; >-} >- >-static gchar* webkitAccessibleTextGetSelection(AtkText* text, gint selectionNum, gint* startOffset, gint* endOffset) >-{ >- g_return_val_if_fail(ATK_TEXT(text), 0); >- returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(text), 0); >- >- // WebCore does not support multiple selection, so anything but 0 does not make sense for now. >- if (selectionNum) >- return 0; >- >- // Get the offsets of the selection for the selected object >- AccessibilityObject* coreObject = core(text); >- VisibleSelection selection = coreObject->selection(); >- getSelectionOffsetsForObject(coreObject, selection, *startOffset, *endOffset); >- >- // Return 0 instead of "", as that's the expected result for >- // this AtkText method when there's no selection >- if (*startOffset == *endOffset) >- return 0; >- >- return webkitAccessibleTextGetText(text, *startOffset, *endOffset); >-} >- >-static gboolean webkitAccessibleTextAddSelection(AtkText* text, gint, gint) >-{ >- g_return_val_if_fail(ATK_TEXT(text), FALSE); >- returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(text), FALSE); >- >- notImplemented(); >- return FALSE; >-} >- >-static gboolean webkitAccessibleTextSetSelection(AtkText* text, gint selectionNum, gint startOffset, gint endOffset) >-{ >- g_return_val_if_fail(ATK_TEXT(text), FALSE); >- returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(text), FALSE); >- >- // WebCore does not support multiple selection, so anything but 0 does not make sense for now. >- if (selectionNum) >- return FALSE; >- >- AccessibilityObject* coreObject = core(text); >- if (!coreObject->isAccessibilityRenderObject()) >- return FALSE; >- >- // Consider -1 and out-of-bound values and correct them to length >- gint textCount = webkitAccessibleTextGetCharacterCount(text); >- if (startOffset < 0 || startOffset > textCount) >- startOffset = textCount; >- if (endOffset < 0 || endOffset > textCount) >- endOffset = textCount; >- >- // We need to adjust the offsets for the list item marker. >- int offsetAdjustment = offsetAdjustmentForListItem(coreObject); >- if (offsetAdjustment) { >- if (startOffset < offsetAdjustment || endOffset < offsetAdjustment) >- return FALSE; >- >- startOffset = atkOffsetToWebCoreOffset(text, startOffset); >- endOffset = atkOffsetToWebCoreOffset(text, endOffset); >- } >- >- PlainTextRange textRange(startOffset, endOffset - startOffset); >- VisiblePositionRange range = coreObject->visiblePositionRangeForRange(textRange); >- if (range.isNull()) >- return FALSE; >- >- coreObject->setSelectedVisiblePositionRange(range); >- return TRUE; >-} >- >-static gboolean webkitAccessibleTextRemoveSelection(AtkText* text, gint selectionNum) >-{ >- g_return_val_if_fail(ATK_TEXT(text), FALSE); >- returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(text), FALSE); >- >- // WebCore does not support multiple selection, so anything but 0 does not make sense for now. >- if (selectionNum) >- return FALSE; >- >- // Do nothing if current selection doesn't belong to the object >- if (!webkitAccessibleTextGetNSelections(text)) >- return FALSE; >- >- // Set a new 0-sized selection to the caret position, in order >- // to simulate selection removal (GAIL style) >- gint caretOffset = webkitAccessibleTextGetCaretOffset(text); >- return webkitAccessibleTextSetSelection(text, selectionNum, caretOffset, caretOffset); >-} >- >-static gboolean webkitAccessibleTextSetCaretOffset(AtkText* text, gint offset) >-{ >- // Internally, setting the caret offset is equivalent to set a zero-length >- // selection, so delegate in that implementation and void duplicated code. >- return webkitAccessibleTextSetSelection(text, 0, offset, offset); >-} >- >-static gchar* webkitAccessibleTextGetStringAtOffset(AtkText* text, gint offset, AtkTextGranularity granularity, gint* startOffset, gint* endOffset) >-{ >- // This new API has been designed to simplify the AtkText interface and it has been >- // designed to keep exactly the same behaviour the atk_text_get_text_at_text() for >- // ATK_TEXT_BOUNDARY_*_START boundaries, so for now we just need to translate the >- // granularity to the right old boundary and reuse the code for the old API. >- // However, this should be simplified later on (and a lot of code removed) once >- // WebKitGTK depends on ATK >= 2.9.4 *and* can safely assume that a version of >- // AT-SPI2 new enough not to include the old APIs is being used. But until then, >- // we will have to live with both the old and new APIs implemented here. >- // FIXME: WebKit nowadays depends on much newer ATK and we can safely assume AT-SPI2 >- // isn't ancient. But whoever wrote this code didn't use ATK_CHECK_VERSION() guards, >- // so it's unclear what is supposed to be changed here. >- AtkTextBoundary boundaryType = ATK_TEXT_BOUNDARY_CHAR; >- switch (granularity) { >- case ATK_TEXT_GRANULARITY_CHAR: >- break; >- >- case ATK_TEXT_GRANULARITY_WORD: >- boundaryType = ATK_TEXT_BOUNDARY_WORD_START; >- break; >- >- case ATK_TEXT_GRANULARITY_SENTENCE: >- boundaryType = ATK_TEXT_BOUNDARY_SENTENCE_START; >- break; >- >- case ATK_TEXT_GRANULARITY_LINE: >- boundaryType = ATK_TEXT_BOUNDARY_LINE_START; >- break; >- >- case ATK_TEXT_GRANULARITY_PARAGRAPH: >- // FIXME: This has not been a need with the old AtkText API, which means ATs won't >- // need it yet for some time, so we can skip it for now. >- notImplemented(); >- return g_strdup(""); >- >- default: >- ASSERT_NOT_REACHED(); >- } >- >- return webkitAccessibleTextGetTextForOffset(text, offset, boundaryType, GetTextPositionAt, startOffset, endOffset); >-} >- >-void webkitAccessibleTextInterfaceInit(AtkTextIface* iface) >-{ >- iface->get_text = webkitAccessibleTextGetText; >- iface->get_text_after_offset = webkitAccessibleTextGetTextAfterOffset; >- iface->get_text_at_offset = webkitAccessibleTextGetTextAtOffset; >- iface->get_text_before_offset = webkitAccessibleTextGetTextBeforeOffset; >- iface->get_character_at_offset = webkitAccessibleTextGetCharacterAtOffset; >- iface->get_caret_offset = webkitAccessibleTextGetCaretOffset; >- iface->get_run_attributes = webkitAccessibleTextGetRunAttributes; >- iface->get_default_attributes = webkitAccessibleTextGetDefaultAttributes; >- iface->get_character_extents = webkitAccessibleTextGetCharacterExtents; >- iface->get_range_extents = webkitAccessibleTextGetRangeExtents; >- iface->get_character_count = webkitAccessibleTextGetCharacterCount; >- iface->get_offset_at_point = webkitAccessibleTextGetOffsetAtPoint; >- iface->get_n_selections = webkitAccessibleTextGetNSelections; >- iface->get_selection = webkitAccessibleTextGetSelection; >- iface->add_selection = webkitAccessibleTextAddSelection; >- iface->remove_selection = webkitAccessibleTextRemoveSelection; >- iface->set_selection = webkitAccessibleTextSetSelection; >- iface->set_caret_offset = webkitAccessibleTextSetCaretOffset; >- iface->get_string_at_offset = webkitAccessibleTextGetStringAtOffset; >-} >- >-#endif >diff --git a/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceText.h b/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceText.h >deleted file mode 100644 >index ec2aae3c29b9..000000000000 >--- a/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceText.h >+++ /dev/null >@@ -1,30 +0,0 @@ >-/* >- * Copyright (C) 2008 Nuanti Ltd. >- * Copyright (C) 2009 Jan Alonzo >- * Copyright (C) 2009, 2010, 2011, 2012 Igalia S.L. >- * >- * This library is free software; you can redistribute it and/or >- * modify it under the terms of the GNU Library General Public >- * License as published by the Free Software Foundation; either >- * version 2 of the License, or (at your option) any later version. >- * >- * This library is distributed in the hope that it will be useful, >- * but WITHOUT ANY WARRANTY; without even the implied warranty of >- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- * Library General Public License for more details. >- * >- * You should have received a copy of the GNU Library General Public License >- * along with this library; see the file COPYING.LIB. If not, write to >- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >- * Boston, MA 02110-1301, USA. >- */ >- >-#pragma once >- >-#if ENABLE(ACCESSIBILITY) && USE(ATK) >- >-#include <atk/atk.h> >- >-void webkitAccessibleTextInterfaceInit(AtkTextIface*); >- >-#endif // ENABLE(ACCESSIBILITY) && USE(ATK) >diff --git a/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceValue.cpp b/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceValue.cpp >deleted file mode 100644 >index 08259d99f1e7..000000000000 >--- a/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceValue.cpp >+++ /dev/null >@@ -1,200 +0,0 @@ >-/* >- * Copyright (C) 2011, 2012 Igalia S.L. >- * >- * This library is free software; you can redistribute it and/or >- * modify it under the terms of the GNU Library General Public >- * License as published by the Free Software Foundation; either >- * version 2 of the License, or (at your option) any later version. >- * >- * This library is distributed in the hope that it will be useful, >- * but WITHOUT ANY WARRANTY; without even the implied warranty of >- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- * Library General Public License for more details. >- * >- * You should have received a copy of the GNU Library General Public License >- * along with this library; see the file COPYING.LIB. If not, write to >- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >- * Boston, MA 02110-1301, USA. >- */ >- >-#include "config.h" >-#include "WebKitAccessibleInterfaceValue.h" >- >-#if ENABLE(ACCESSIBILITY) && USE(ATK) >- >-#include "AccessibilityObject.h" >-#include "HTMLNames.h" >-#include "WebKitAccessible.h" >-#include "WebKitAccessibleUtil.h" >-#include <wtf/text/CString.h> >- >-using namespace WebCore; >- >-static AccessibilityObject* core(AtkValue* value) >-{ >- if (!WEBKIT_IS_ACCESSIBLE(value)) >- return 0; >- >- return &webkitAccessibleGetAccessibilityObject(WEBKIT_ACCESSIBLE(value)); >-} >- >-static bool webkitAccessibleSetNewValue(AtkValue* coreValue, const gdouble newValue) >-{ >- AccessibilityObject* coreObject = core(coreValue); >- if (!coreObject->canSetValueAttribute()) >- return FALSE; >- >- // Check value against range limits >- double value; >- value = std::max(static_cast<double>(coreObject->minValueForRange()), newValue); >- value = std::min(static_cast<double>(coreObject->maxValueForRange()), newValue); >- >- coreObject->setValue(String::numberToStringFixedPrecision(value)); >- return TRUE; >-} >- >-static float webkitAccessibleGetIncrementValue(AccessibilityObject* coreObject) >-{ >- if (!coreObject->getAttribute(HTMLNames::stepAttr).isEmpty()) >- return coreObject->stepValueForRange(); >- >- // If 'step' attribute is not defined, WebCore assumes a 5% of the >- // range between minimum and maximum values. Implicit value of step should be one or larger. >- float step = (coreObject->maxValueForRange() - coreObject->minValueForRange()) * 0.05; >- return step < 1 ? 1 : step; >-} >- >-static void webkitAccessibleGetValueAndText(AtkValue* value, gdouble* currentValue, gchar** alternativeText) >-{ >- g_return_if_fail(ATK_VALUE(value)); >- returnIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(value)); >- >- AccessibilityObject* coreObject = core(value); >- if (!coreObject) >- return; >- >- if (currentValue) >- *currentValue = coreObject->valueForRange(); >- if (alternativeText) >- *alternativeText = g_strdup_printf("%s", coreObject->valueDescription().utf8().data()); >-} >- >-static double webkitAccessibleGetIncrement(AtkValue* value) >-{ >- g_return_val_if_fail(ATK_VALUE(value), 0); >- returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(value), 0); >- >- AccessibilityObject* coreObject = core(value); >- if (!coreObject) >- return 0; >- >- return webkitAccessibleGetIncrementValue(coreObject); >-} >- >-static void webkitAccessibleSetValue(AtkValue* value, const gdouble newValue) >-{ >- g_return_if_fail(ATK_VALUE(value)); >- returnIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(value)); >- >- webkitAccessibleSetNewValue(value, newValue); >-} >- >-static AtkRange* webkitAccessibleGetRange(AtkValue* value) >-{ >- g_return_val_if_fail(ATK_VALUE(value), nullptr); >- returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(value), nullptr); >- >- AccessibilityObject* coreObject = core(value); >- if (!coreObject) >- return nullptr; >- >- gdouble minValue = coreObject->minValueForRange(); >- gdouble maxValue = coreObject->maxValueForRange(); >- gchar* valueDescription = g_strdup_printf("%s", coreObject->valueDescription().utf8().data()); >- return atk_range_new(minValue, maxValue, valueDescription); >-} >- >-static void webkitAccessibleValueGetCurrentValue(AtkValue* value, GValue* gValue) >-{ >- g_return_if_fail(ATK_VALUE(value)); >- returnIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(value)); >- >- memset(gValue, 0, sizeof(GValue)); >- g_value_init(gValue, G_TYPE_FLOAT); >- g_value_set_float(gValue, core(value)->valueForRange()); >-} >- >-static void webkitAccessibleValueGetMaximumValue(AtkValue* value, GValue* gValue) >-{ >- g_return_if_fail(ATK_VALUE(value)); >- returnIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(value)); >- >- memset(gValue, 0, sizeof(GValue)); >- g_value_init(gValue, G_TYPE_FLOAT); >- g_value_set_float(gValue, core(value)->maxValueForRange()); >-} >- >-static void webkitAccessibleValueGetMinimumValue(AtkValue* value, GValue* gValue) >-{ >- g_return_if_fail(ATK_VALUE(value)); >- returnIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(value)); >- >- memset(gValue, 0, sizeof(GValue)); >- g_value_init(gValue, G_TYPE_FLOAT); >- g_value_set_float(gValue, core(value)->minValueForRange()); >-} >- >-static gboolean webkitAccessibleValueSetCurrentValue(AtkValue* value, const GValue* gValue) >-{ >- g_return_val_if_fail(ATK_VALUE(value), FALSE); >- returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(value), FALSE); >- >- double newValue; >- if (G_VALUE_HOLDS_DOUBLE(gValue)) >- newValue = g_value_get_double(gValue); >- else if (G_VALUE_HOLDS_FLOAT(gValue)) >- newValue = g_value_get_float(gValue); >- else if (G_VALUE_HOLDS_INT64(gValue)) >- newValue = g_value_get_int64(gValue); >- else if (G_VALUE_HOLDS_INT(gValue)) >- newValue = g_value_get_int(gValue); >- else if (G_VALUE_HOLDS_LONG(gValue)) >- newValue = g_value_get_long(gValue); >- else if (G_VALUE_HOLDS_ULONG(gValue)) >- newValue = g_value_get_ulong(gValue); >- else if (G_VALUE_HOLDS_UINT64(gValue)) >- newValue = g_value_get_uint64(gValue); >- else if (G_VALUE_HOLDS_UINT(gValue)) >- newValue = g_value_get_uint(gValue); >- else >- return FALSE; >- >- return webkitAccessibleSetNewValue(value, newValue); >-} >- >-static void webkitAccessibleValueGetMinimumIncrement(AtkValue* value, GValue* gValue) >-{ >- g_return_if_fail(ATK_VALUE(value)); >- returnIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(value)); >- >- memset(gValue, 0, sizeof(GValue)); >- g_value_init(gValue, G_TYPE_FLOAT); >- >- AccessibilityObject* coreObject = core(value); >- g_value_set_float(gValue, webkitAccessibleGetIncrementValue(coreObject)); >-} >- >-void webkitAccessibleValueInterfaceInit(AtkValueIface* iface) >-{ >- iface->get_value_and_text = webkitAccessibleGetValueAndText; >- iface->get_increment = webkitAccessibleGetIncrement; >- iface->set_value = webkitAccessibleSetValue; >- iface->get_range = webkitAccessibleGetRange; >- iface->get_current_value = webkitAccessibleValueGetCurrentValue; >- iface->get_maximum_value = webkitAccessibleValueGetMaximumValue; >- iface->get_minimum_value = webkitAccessibleValueGetMinimumValue; >- iface->set_current_value = webkitAccessibleValueSetCurrentValue; >- iface->get_minimum_increment = webkitAccessibleValueGetMinimumIncrement; >-} >- >-#endif >diff --git a/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceValue.h b/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceValue.h >deleted file mode 100644 >index d11d5e81e19b..000000000000 >--- a/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceValue.h >+++ /dev/null >@@ -1,28 +0,0 @@ >-/* >- * Copyright (C) 2011, 2012 Igalia S.L. >- * >- * This library is free software; you can redistribute it and/or >- * modify it under the terms of the GNU Library General Public >- * License as published by the Free Software Foundation; either >- * version 2 of the License, or (at your option) any later version. >- * >- * This library is distributed in the hope that it will be useful, >- * but WITHOUT ANY WARRANTY; without even the implied warranty of >- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- * Library General Public License for more details. >- * >- * You should have received a copy of the GNU Library General Public License >- * along with this library; see the file COPYING.LIB. If not, write to >- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >- * Boston, MA 02110-1301, USA. >- */ >- >-#pragma once >- >-#if ENABLE(ACCESSIBILITY) && USE(ATK) >- >-#include <atk/atk.h> >- >-void webkitAccessibleValueInterfaceInit(AtkValueIface*); >- >-#endif // ENABLE(ACCESSIBILITY) && USE(ATK) >diff --git a/Source/WebCore/accessibility/atk/WebKitAccessibleUtil.cpp b/Source/WebCore/accessibility/atk/WebKitAccessibleUtil.cpp >deleted file mode 100644 >index b3f876d24304..000000000000 >--- a/Source/WebCore/accessibility/atk/WebKitAccessibleUtil.cpp >+++ /dev/null >@@ -1,242 +0,0 @@ >-/* >- * Copyright (C) 2008 Nuanti Ltd. >- * Copyright (C) 2009 Jan Alonzo >- * Copyright (C) 2009, 2010, 2012 Igalia S.L. >- * >- * Portions from Mozilla a11y, copyright as follows: >- * >- * The Original Code is mozilla.org code. >- * >- * The Initial Developer of the Original Code is >- * Sun Microsystems, Inc. >- * Portions created by the Initial Developer are Copyright (C) 2002 >- * the Initial Developer. All Rights Reserved. >- * >- * This library is free software; you can redistribute it and/or >- * modify it under the terms of the GNU Library General Public >- * License as published by the Free Software Foundation; either >- * version 2 of the License, or (at your option) any later version. >- * >- * This library is distributed in the hope that it will be useful, >- * but WITHOUT ANY WARRANTY; without even the implied warranty of >- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- * Library General Public License for more details. >- * >- * You should have received a copy of the GNU Library General Public License >- * along with this library; see the file COPYING.LIB. If not, write to >- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >- * Boston, MA 02110-1301, USA. >- */ >- >-#include "config.h" >-#include "WebKitAccessibleUtil.h" >- >-#if ENABLE(ACCESSIBILITY) && USE(ATK) >- >-#include "AXObjectCache.h" >-#include "AccessibilityObject.h" >-#include "FrameView.h" >-#include "IntRect.h" >-#include "Node.h" >-#include "Range.h" >-#include "RenderObject.h" >-#include "TextIterator.h" >-#include "VisibleSelection.h" >- >-#include <wtf/text/AtomString.h> >-#include <wtf/text/CString.h> >- >-using namespace WebCore; >- >-AtkAttributeSet* addToAtkAttributeSet(AtkAttributeSet* attributeSet, const char* name, const char* value) >-{ >- AtkAttribute* attribute = static_cast<AtkAttribute*>(g_malloc(sizeof(AtkAttribute))); >- attribute->name = g_strdup(name); >- attribute->value = g_strdup(value); >- attributeSet = g_slist_prepend(attributeSet, attribute); >- return attributeSet; >-} >- >-void contentsRelativeToAtkCoordinateType(AccessibilityObject* coreObject, AtkCoordType coordType, IntRect rect, gint* x, gint* y, gint* width, gint* height) >-{ >- FrameView* frameView = coreObject->documentFrameView(); >- >- if (frameView) { >- switch (coordType) { >- case ATK_XY_WINDOW: >- rect = frameView->contentsToWindow(rect); >- break; >- case ATK_XY_SCREEN: >- rect = frameView->contentsToScreen(rect); >- break; >-#if ATK_CHECK_VERSION(2, 30, 0) >- case ATK_XY_PARENT: >- RELEASE_ASSERT_NOT_REACHED(); >-#endif >- } >- } >- >- if (x) >- *x = rect.x(); >- if (y) >- *y = rect.y(); >- if (width) >- *width = rect.width(); >- if (height) >- *height = rect.height(); >-} >- >-// FIXME: Different kinds of elements are putting the title tag to use >-// in different AX fields. This might not be 100% correct but we will >-// keep it now in order to achieve consistency with previous behavior. >-static bool titleTagShouldBeUsedInDescriptionField(AccessibilityObject* coreObject) >-{ >- return (coreObject->isLink() && !coreObject->isImageMapLink()) || coreObject->isImage(); >-} >- >-// This should be the "visible" text that's actually on the screen if possible. >-// If there's alternative text, that can override the title. >-String accessibilityTitle(AccessibilityObject* coreObject) >-{ >- Vector<AccessibilityText> textOrder; >- coreObject->accessibilityText(textOrder); >- >- for (const AccessibilityText& text : textOrder) { >- // Once we encounter visible text, or the text from our children that should be used foremost. >- if (text.textSource == AccessibilityTextSource::Visible || text.textSource == AccessibilityTextSource::Children) >- return text.text; >- >- // If there's an element that labels this object and it's not exposed, then we should use >- // that text as our title. >- if (text.textSource == AccessibilityTextSource::LabelByElement && !coreObject->titleUIElement()) >- return text.text; >- >- // Elements of role AccessibilityRole::Toolbar will return its title as AccessibilityTextSource::Alternative. >- if (coreObject->roleValue() == AccessibilityRole::Toolbar && text.textSource == AccessibilityTextSource::Alternative) >- return text.text; >- >- // FIXME: The title tag is used in certain cases for the title. This usage should >- // probably be in the description field since it's not "visible". >- if (text.textSource == AccessibilityTextSource::TitleTag && !titleTagShouldBeUsedInDescriptionField(coreObject)) >- return text.text; >- } >- >- return String(); >-} >- >-String accessibilityDescription(AccessibilityObject* coreObject) >-{ >- Vector<AccessibilityText> textOrder; >- coreObject->accessibilityText(textOrder); >- >- bool visibleTextAvailable = false; >- for (const AccessibilityText& text : textOrder) { >- if (text.textSource == AccessibilityTextSource::Alternative) >- return text.text; >- >- switch (text.textSource) { >- case AccessibilityTextSource::Visible: >- case AccessibilityTextSource::Children: >- case AccessibilityTextSource::LabelByElement: >- visibleTextAvailable = true; >- default: >- break; >- } >- >- if (text.textSource == AccessibilityTextSource::TitleTag && !visibleTextAvailable) >- return text.text; >- } >- >- return String(); >-} >- >-bool selectionBelongsToObject(AccessibilityObject* coreObject, VisibleSelection& selection) >-{ >- if (!coreObject || !coreObject->isAccessibilityRenderObject()) >- return false; >- >- auto range = selection.firstRange(); >- return range && intersects<ComposedTree>(*range, *coreObject->node()); >-} >- >-AXCoreObject* objectFocusedAndCaretOffsetUnignored(AXCoreObject* referenceObject, int& offset) >-{ >- // Indication that something bogus has transpired. >- offset = -1; >- >- Document* document = referenceObject->document(); >- if (!document) >- return nullptr; >- >- Node* focusedNode = referenceObject->selection().end().containerNode(); >- if (!focusedNode) >- return nullptr; >- >- RenderObject* focusedRenderer = focusedNode->renderer(); >- if (!focusedRenderer) >- return nullptr; >- >- AccessibilityObject* focusedObject = document->axObjectCache()->getOrCreate(focusedRenderer); >- if (!focusedObject) >- return nullptr; >- >- // Look for the actual (not ignoring accessibility) selected object. >- AXCoreObject* firstUnignoredParent = focusedObject; >- if (firstUnignoredParent->accessibilityIsIgnored()) >- firstUnignoredParent = firstUnignoredParent->parentObjectUnignored(); >- if (!firstUnignoredParent) >- return nullptr; >- >- // Don't ignore links if the offset is being requested for a link >- // or if the link is a block. >- if (!referenceObject->isLink() && firstUnignoredParent->isLink() >- && !(firstUnignoredParent->renderer() && !firstUnignoredParent->renderer()->isInline())) >- firstUnignoredParent = firstUnignoredParent->parentObjectUnignored(); >- if (!firstUnignoredParent) >- return nullptr; >- >- // The reference object must either coincide with the focused >- // object being considered, or be a descendant of it. >- if (referenceObject->isDescendantOfObject(firstUnignoredParent)) >- referenceObject = firstUnignoredParent; >- >- Node* startNode = nullptr; >- if (firstUnignoredParent != referenceObject || firstUnignoredParent->isTextControl()) { >- // We need to use the first child's node of the reference >- // object as the start point to calculate the caret offset >- // because we want it to be relative to the object of >- // reference, not just to the focused object (which could have >- // previous siblings which should be taken into account too). >- AXCoreObject* axFirstChild = referenceObject->firstChild(); >- if (axFirstChild) >- startNode = axFirstChild->node(); >- } >- // Getting the Position of a PseudoElement now triggers an assertion. >- // This can occur when clicking on empty space in a render block. >- if (!startNode || startNode->isPseudoElement()) >- startNode = firstUnignoredParent->node(); >- >- // Check if the node for the first parent object not ignoring >- // accessibility is null again before using it. This might happen >- // with certain kind of accessibility objects, such as the root >- // one (the scroller containing the webArea object). >- if (!startNode) >- return nullptr; >- >- VisiblePosition startPosition = VisiblePosition(positionBeforeNode(startNode)); >- VisiblePosition endPosition = firstUnignoredParent->selection().visibleEnd(); >- >- if (startPosition == endPosition) >- offset = 0; >- else if (!isStartOfLine(endPosition)) { >- auto range = makeSimpleRange(startPosition, endPosition.previous()); >- offset = (range ? characterCount(*range, TextIteratorBehavior::EmitsCharactersBetweenAllVisiblePositions) : 0) + 1; >- } else { >- auto range = makeSimpleRange(startPosition, endPosition); >- offset = range ? characterCount(*range, TextIteratorBehavior::EmitsCharactersBetweenAllVisiblePositions) : 0; >- } >- >- return firstUnignoredParent; >-} >- >-#endif >diff --git a/Source/WebCore/accessibility/atk/WebKitAccessibleUtil.h b/Source/WebCore/accessibility/atk/WebKitAccessibleUtil.h >deleted file mode 100644 >index f549302fe99f..000000000000 >--- a/Source/WebCore/accessibility/atk/WebKitAccessibleUtil.h >+++ /dev/null >@@ -1,72 +0,0 @@ >-/* >- * Copyright (C) 2008 Nuanti Ltd. >- * Copyright (C) 2009 Jan Alonzo >- * Copyright (C) 2009, 2010, 2012 Igalia S.L. >- * >- * This library is free software; you can redistribute it and/or >- * modify it under the terms of the GNU Library General Public >- * License as published by the Free Software Foundation; either >- * version 2 of the License, or (at your option) any later version. >- * >- * This library is distributed in the hope that it will be useful, >- * but WITHOUT ANY WARRANTY; without even the implied warranty of >- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- * Library General Public License for more details. >- * >- * You should have received a copy of the GNU Library General Public License >- * along with this library; see the file COPYING.LIB. If not, write to >- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >- * Boston, MA 02110-1301, USA. >- */ >- >-#pragma once >- >-#if ENABLE(ACCESSIBILITY) && USE(ATK) >- >-#include <atk/atk.h> >-#include <wtf/text/WTFString.h> >- >-namespace WebCore { >-class AXCoreObject; >-class AccessibilityObject; >-class IntRect; >-class VisibleSelection; >-} >- >-// An existing accessibility object is considered to be invalid whether it's already >-// detached or if it's not but just updating the layout will detach it anyway. >-#define returnIfWebKitAccessibleIsInvalid(webkitAccessible) G_STMT_START { \ >- if (!webkitAccessible || webkitAccessibleIsDetached(webkitAccessible)) \ >- return; \ >- auto& coreObject = webkitAccessibleGetAccessibilityObject(webkitAccessible); \ >- if (!coreObject.document()) \ >- return; \ >- coreObject.updateBackingStore(); \ >- if (webkitAccessibleIsDetached(webkitAccessible)) \ >- return; \ >- ; } G_STMT_END >- >-#define returnValIfWebKitAccessibleIsInvalid(webkitAccessible, val) G_STMT_START { \ >- if (!webkitAccessible || webkitAccessibleIsDetached(webkitAccessible)) \ >- return (val); \ >- auto& coreObject = webkitAccessibleGetAccessibilityObject(webkitAccessible); \ >- if (!coreObject.document()) \ >- return (val); \ >- coreObject.updateBackingStore(); \ >- if (webkitAccessibleIsDetached(webkitAccessible)) \ >- return (val); \ >- ; } G_STMT_END >- >-AtkAttributeSet* addToAtkAttributeSet(AtkAttributeSet*, const char* name, const char* value); >- >-void contentsRelativeToAtkCoordinateType(WebCore::AccessibilityObject*, AtkCoordType, WebCore::IntRect, gint* x, gint* y, gint* width = nullptr, gint* height = nullptr); >- >-String accessibilityTitle(WebCore::AccessibilityObject*); >- >-String accessibilityDescription(WebCore::AccessibilityObject*); >- >-bool selectionBelongsToObject(WebCore::AccessibilityObject*, WebCore::VisibleSelection&); >- >-WebCore::AXCoreObject* objectFocusedAndCaretOffsetUnignored(WebCore::AXCoreObject*, int& offset); >- >-#endif // ENABLE(ACCESSIBILITY) && USE(ATK) >diff --git a/Source/WebCore/accessibility/atspi/AccessibilityObjectAtspi.cpp b/Source/WebCore/accessibility/atspi/AccessibilityObjectAtspi.cpp >index f81a885988d8..a6b5119be82a 100644 >--- a/Source/WebCore/accessibility/atspi/AccessibilityObjectAtspi.cpp >+++ b/Source/WebCore/accessibility/atspi/AccessibilityObjectAtspi.cpp >@@ -966,7 +966,7 @@ HashMap<String, String> AccessibilityObjectAtspi::attributes() const > > // According to the W3C Core Accessibility API Mappings 1.1, section 5.4.1 General Rules: > // "User agents must expose the WAI-ARIA role string if the API supports a mechanism to do so." >- // In the case of ATK, the mechanism to do so is an object attribute pair (xml-roles:"string"). >+ // In the case of ATSPI, the mechanism to do so is an object attribute pair (xml-roles:"string"). > // We cannot use the computedRoleString for this purpose because it is not limited to elements > // with ARIA roles, and it might not contain the actual ARIA role value (e.g. DPub ARIA). > String roleString = static_cast<AccessibilityObject*>(m_coreObject)->getAttribute(HTMLNames::roleAttr); >diff --git a/Source/WebCore/editing/FrameSelection.h b/Source/WebCore/editing/FrameSelection.h >index 147ead103fe9..a9aa629e3098 100644 >--- a/Source/WebCore/editing/FrameSelection.h >+++ b/Source/WebCore/editing/FrameSelection.h >@@ -378,7 +378,7 @@ inline void FrameSelection::clearTypingStyle() > m_typingStyle = nullptr; > } > >-#if !(ENABLE(ACCESSIBILITY) && (PLATFORM(COCOA) || USE(ATK) || USE(ATSPI))) >+#if !(ENABLE(ACCESSIBILITY) && (PLATFORM(COCOA) || USE(ATSPI))) > > inline void FrameSelection::notifyAccessibilityForSelectionChange(const AXTextStateChangeIntent&) > { >diff --git a/Source/WebCore/editing/atk/FrameSelectionAtk.cpp b/Source/WebCore/editing/atk/FrameSelectionAtk.cpp >deleted file mode 100644 >index c9ad610ebbf5..000000000000 >--- a/Source/WebCore/editing/atk/FrameSelectionAtk.cpp >+++ /dev/null >@@ -1,119 +0,0 @@ >-/* >- * Copyright (C) 2009 Igalia S.L. >- * >- * This library is free software; you can redistribute it and/or >- * modify it under the terms of the GNU Library General Public >- * License as published by the Free Software Foundation; either >- * version 2 of the License, or (at your option) any later version. >- * >- * This library is distributed in the hope that it will be useful, >- * but WITHOUT ANY WARRANTY; without even the implied warranty of >- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- * Library General Public License for more details. >- * >- * You should have received a copy of the GNU Library General Public License >- * along with this library; see the file COPYING.LIB. If not, write to >- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >- * Boston, MA 02110-1301, USA. >- */ >- >-#include "config.h" >-#include "FrameSelection.h" >- >-#if ENABLE(ACCESSIBILITY) && USE(ATK) >- >-#include "AXObjectCache.h" >-#include "DocumentInlines.h" >-#include "Frame.h" >-#include "RenderListItem.h" >-#include "WebKitAccessible.h" >-#include "WebKitAccessibleUtil.h" >-#include <glib.h> >-#include <wtf/NeverDestroyed.h> >-#include <wtf/RefPtr.h> >- >-namespace WebCore { >- >-static void emitTextSelectionChange(AXCoreObject* object, VisibleSelection selection, int offset) >-{ >- auto* axObject = object->wrapper(); >- if (!axObject || !ATK_IS_TEXT(axObject)) >- return; >- >- // We need to adjust the offset for the list item marker in Left-To-Right text because >- // the list item marker is exposed through the text of the accessible list item rather >- // than through a separate accessible object. >- RenderObject* renderer = object->renderer(); >- if (is<RenderListItem>(renderer) && renderer->style().direction() == TextDirection::LTR) >- offset += downcast<RenderListItem>(*renderer).markerTextWithSuffix().length(); >- >- g_signal_emit_by_name(axObject, "text-caret-moved", offset); >- if (selection.isRange()) >- g_signal_emit_by_name(axObject, "text-selection-changed"); >-} >- >-static void maybeEmitTextFocusChange(RefPtr<AXCoreObject>&& object) >-{ >- // This static variable is needed to keep track of the old object >- // as per previous calls to this function, in order to properly >- // decide whether to emit some signals or not. >- static NeverDestroyed<RefPtr<AXCoreObject>> oldObject; >- >- // Ensure the oldObject belongs to the same document that the >- // current object so further comparisons make sense. Otherwise, >- // just reset oldObject to 0 so it won't be taken into account in >- // the immediately following call to this function. >- if (object && oldObject.get() && oldObject.get()->document() != object->document()) >- oldObject.get() = nullptr; >- >- auto* axObject = object ? object->wrapper() : nullptr; >- auto* oldAxObject = oldObject.get() ? oldObject.get()->wrapper() : nullptr; >- >- if (axObject != oldAxObject) { >- if (oldAxObject && ATK_IS_TEXT(oldAxObject)) { >- g_signal_emit_by_name(oldAxObject, "focus-event", FALSE); >- atk_object_notify_state_change(ATK_OBJECT(oldAxObject), ATK_STATE_FOCUSED, FALSE); >- } >- if (axObject && ATK_IS_TEXT(axObject)) { >- g_signal_emit_by_name(axObject, "focus-event", TRUE); >- atk_object_notify_state_change(ATK_OBJECT(axObject), ATK_STATE_FOCUSED, TRUE); >- } >- } >- >- // Update pointer to last focused object. >- oldObject.get() = WTFMove(object); >-} >- >- >-void FrameSelection::notifyAccessibilityForSelectionChange(const AXTextStateChangeIntent&) >-{ >- if (!AXObjectCache::accessibilityEnabled()) >- return; >- >- if (!m_selection.start().isNotNull() || !m_selection.end().isNotNull()) >- return; >- >- Node* focusedNode = m_selection.end().containerNode(); >- if (!focusedNode) >- return; >- >- AXObjectCache* cache = m_document->existingAXObjectCache(); >- if (!cache) >- return; >- >- AccessibilityObject* accessibilityObject = cache->getOrCreate(focusedNode->renderer()); >- if (!accessibilityObject) >- return; >- >- int offset; >- RefPtr<AXCoreObject> object = objectFocusedAndCaretOffsetUnignored(accessibilityObject, offset); >- if (!object) >- return; >- >- emitTextSelectionChange(object.get(), m_selection, offset); >- maybeEmitTextFocusChange(WTFMove(object)); >-} >- >-} // namespace WebCore >- >-#endif // ENABLE(ACCESSIBILITY) && USE(ATK) >diff --git a/Source/WebCore/page/Settings.yaml b/Source/WebCore/page/Settings.yaml >index cb927ecb1c00..14e82fd92f8f 100644 >--- a/Source/WebCore/page/Settings.yaml >+++ b/Source/WebCore/page/Settings.yaml >@@ -263,7 +263,6 @@ IsAccessibilityIsolatedTreeEnabled: > type: bool > defaultValue: > WebCore: >- USE(ATSPI): true > default: false > > IsPerActivityStateCPUUsageMeasurementEnabled: >diff --git a/Source/WebCore/platform/graphics/PlatformDisplay.cpp b/Source/WebCore/platform/graphics/PlatformDisplay.cpp >index 2e2eb905da78..aabe3f222609 100644 >--- a/Source/WebCore/platform/graphics/PlatformDisplay.cpp >+++ b/Source/WebCore/platform/graphics/PlatformDisplay.cpp >@@ -80,7 +80,7 @@ > #include <wtf/NeverDestroyed.h> > #endif > >-#if USE(ATSPI) || USE(ATK) >+#if USE(ATSPI) > #include <wtf/glib/GUniquePtr.h> > #endif > >@@ -294,7 +294,7 @@ cmsHPROFILE PlatformDisplay::colorProfile() const > } > #endif > >-#if USE(ATSPI) || USE(ATK) >+#if USE(ATSPI) > const String& PlatformDisplay::accessibilityBusAddress() const > { > if (m_accessibilityBusAddress) >diff --git a/Source/WebCore/platform/graphics/PlatformDisplay.h b/Source/WebCore/platform/graphics/PlatformDisplay.h >index be7db6e887b5..bec59a002ff3 100644 >--- a/Source/WebCore/platform/graphics/PlatformDisplay.h >+++ b/Source/WebCore/platform/graphics/PlatformDisplay.h >@@ -90,7 +90,7 @@ public: > virtual cmsHPROFILE colorProfile() const; > #endif > >-#if USE(ATSPI) || USE(ATK) >+#if USE(ATSPI) > void setAccessibilityBusAddress(String&& address) { m_accessibilityBusAddress = WTFMove(address); } > const String& accessibilityBusAddress() const; > #endif >@@ -117,7 +117,7 @@ protected: > mutable LCMSProfilePtr m_iccProfile; > #endif > >-#if USE(ATSPI) || USE(ATK) >+#if USE(ATSPI) > virtual String plartformAccessibilityBusAddress() const { return { }; } > > mutable std::optional<String> m_accessibilityBusAddress; >diff --git a/Source/WebCore/platform/graphics/x11/PlatformDisplayX11.cpp b/Source/WebCore/platform/graphics/x11/PlatformDisplayX11.cpp >index dc46ede14cdf..22154c8763ef 100644 >--- a/Source/WebCore/platform/graphics/x11/PlatformDisplayX11.cpp >+++ b/Source/WebCore/platform/graphics/x11/PlatformDisplayX11.cpp >@@ -217,7 +217,7 @@ cmsHPROFILE PlatformDisplayX11::colorProfile() const > } > #endif > >-#if USE(ATSPI) || USE(ATK) >+#if USE(ATSPI) > String PlatformDisplayX11::plartformAccessibilityBusAddress() const > { > Atom atspiBusAtom = XInternAtom(m_display, "AT_SPI_BUS", False); >diff --git a/Source/WebCore/platform/graphics/x11/PlatformDisplayX11.h b/Source/WebCore/platform/graphics/x11/PlatformDisplayX11.h >index 2943a5549ecb..5a7ffe05d508 100644 >--- a/Source/WebCore/platform/graphics/x11/PlatformDisplayX11.h >+++ b/Source/WebCore/platform/graphics/x11/PlatformDisplayX11.h >@@ -64,7 +64,7 @@ private: > cmsHPROFILE colorProfile() const override; > #endif > >-#if USE(ATSPI) || USE(ATK) >+#if USE(ATSPI) > String plartformAccessibilityBusAddress() const override; > #endif > >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 2e228e415b59..ae4b12a0ebe6 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,32 @@ >+2022-03-22 Carlos Garcia Campos <cgarcia@igalia.com> >+ >+ [GTK][WPE] Remove the ATK implementation >+ https://bugs.webkit.org/show_bug.cgi?id=238198 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * PlatformGTK.cmake: >+ * PlatformWPE.cmake: >+ * SourcesGTK.txt: >+ * SourcesWPE.txt: >+ * WebProcess/WebPage/WebPage.h: >+ * WebProcess/WebPage/atk/WebKitWebPageAccessibilityObject.cpp: Removed. >+ (coreRootObjectWrapperDetachedCallback): Deleted. >+ (rootWebAreaWrapper): Deleted. >+ (accessibilityRootObjectWrapper): Deleted. >+ (webkitWebPageAccessibilityObjectInitialize): Deleted. >+ (webkitWebPageAccessibilityObjectGetIndexInParent): Deleted. >+ (webkitWebPageAccessibilityObjectGetNChildren): Deleted. >+ (webkitWebPageAccessibilityObjectRefChild): Deleted. >+ (webkitWebPageAccessibilityObjectRefStateSet): Deleted. >+ (webkit_web_page_accessibility_object_class_init): Deleted. >+ (webkitWebPageAccessibilityObjectNew): Deleted. >+ * WebProcess/WebPage/atk/WebKitWebPageAccessibilityObject.h: Removed. >+ * WebProcess/WebPage/glib/WebPageGLib.cpp: >+ (WebKit::WebPage::platformInitialize): >+ * WebProcess/wpe/WebProcessMainWPE.cpp: >+ (WebKit::initializeAccessibility): Deleted. >+ > 2022-03-22 Youenn Fablet <youenn@apple.com> > > Website policies are not respected when doing COOP based process swap >diff --git a/Source/WebKit/PlatformGTK.cmake b/Source/WebKit/PlatformGTK.cmake >index 2947f31b0d82..333bfe0755da 100644 >--- a/Source/WebKit/PlatformGTK.cmake >+++ b/Source/WebKit/PlatformGTK.cmake >@@ -465,12 +465,10 @@ list(APPEND WebKit_INCLUDE_DIRECTORIES > "${WEBKIT_DIR}/WebProcess/WebCoreSupport/gtk" > "${WEBKIT_DIR}/WebProcess/WebCoreSupport/soup" > "${WEBKIT_DIR}/WebProcess/WebPage/CoordinatedGraphics" >- "${WEBKIT_DIR}/WebProcess/WebPage/atk" > "${WEBKIT_DIR}/WebProcess/WebPage/gtk" > ) > > list(APPEND WebKit_SYSTEM_INCLUDE_DIRECTORIES >- ${ATK_INCLUDE_DIRS} > ${ENCHANT_INCLUDE_DIRS} > ${GIO_UNIX_INCLUDE_DIRS} > ${GLIB_INCLUDE_DIRS} >diff --git a/Source/WebKit/PlatformWPE.cmake b/Source/WebKit/PlatformWPE.cmake >index 9587313c286b..c5ade3f53c47 100644 >--- a/Source/WebKit/PlatformWPE.cmake >+++ b/Source/WebKit/PlatformWPE.cmake >@@ -322,7 +322,6 @@ list(APPEND WebKit_INCLUDE_DIRECTORIES > "${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe/DOM" > "${WEBKIT_DIR}/WebProcess/WebCoreSupport/soup" > "${WEBKIT_DIR}/WebProcess/WebPage/CoordinatedGraphics" >- "${WEBKIT_DIR}/WebProcess/WebPage/atk" > "${WEBKIT_DIR}/WebProcess/WebPage/libwpe" > "${WEBKIT_DIR}/WebProcess/WebPage/wpe" > "${WEBKIT_DIR}/WebProcess/glib" >diff --git a/Source/WebKit/SourcesGTK.txt b/Source/WebKit/SourcesGTK.txt >index cbc4b5e0a2c0..66f9ed0b9bf7 100644 >--- a/Source/WebKit/SourcesGTK.txt >+++ b/Source/WebKit/SourcesGTK.txt >@@ -431,8 +431,6 @@ WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp > WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp > WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp > >-WebProcess/WebPage/atk/WebKitWebPageAccessibilityObject.cpp >- > WebProcess/WebPage/glib/WebPageGLib.cpp > > WebProcess/WebPage/gstreamer/WebPageGStreamer.cpp >diff --git a/Source/WebKit/SourcesWPE.txt b/Source/WebKit/SourcesWPE.txt >index cc7875e51a26..5a9adbfd1189 100644 >--- a/Source/WebKit/SourcesWPE.txt >+++ b/Source/WebKit/SourcesWPE.txt >@@ -263,8 +263,6 @@ WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp > WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp > WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp > >-WebProcess/WebPage/atk/WebKitWebPageAccessibilityObject.cpp >- > WebProcess/WebPage/glib/WebPageGLib.cpp > > WebProcess/WebPage/gstreamer/WebPageGStreamer.cpp >diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.h b/Source/WebKit/WebProcess/WebPage/WebPage.h >index 6aef20def30c..cd9f61663995 100644 >--- a/Source/WebKit/WebProcess/WebPage/WebPage.h >+++ b/Source/WebKit/WebProcess/WebPage/WebPage.h >@@ -108,14 +108,9 @@ > #include <wtf/WallTime.h> > #include <wtf/text/WTFString.h> > >-#if ENABLE(ACCESSIBILITY) >-#if USE(ATK) >-typedef struct _AtkObject AtkObject; >-#include <wtf/glib/GRefPtr.h> >-#elif USE(ATSPI) >+#if USE(ATSPI) > #include <WebCore/AccessibilityRootAtspi.h> > #endif >-#endif > > #if PLATFORM(GTK) > #include "ArgumentCodersGtk.h" >@@ -2071,13 +2066,9 @@ private: > RetainPtr<NSDictionary> m_dataDetectionContext; > #endif > >-#if ENABLE(ACCESSIBILITY) >-#if USE(ATK) >- GRefPtr<AtkObject> m_accessibilityObject; >-#elif USE(ATSPI) >+#if USE(ATSPI) > RefPtr<WebCore::AccessibilityRootAtspi> m_accessibilityRootObject; > #endif >-#endif > > #if PLATFORM(WIN) > uint64_t m_nativeWindowHandle { 0 }; >diff --git a/Source/WebKit/WebProcess/WebPage/atk/WebKitWebPageAccessibilityObject.cpp b/Source/WebKit/WebProcess/WebPage/atk/WebKitWebPageAccessibilityObject.cpp >deleted file mode 100644 >index edd218b69de9..000000000000 >--- a/Source/WebKit/WebProcess/WebPage/atk/WebKitWebPageAccessibilityObject.cpp >+++ /dev/null >@@ -1,170 +0,0 @@ >-/* >- * Copyright (C) 2012, 2019 Igalia S.L. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions >- * are met: >- * 1. Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * 2. Redistributions in binary form must reproduce the above copyright >- * notice, this list of conditions and the following disclaimer in the >- * documentation and/or other materials provided with the distribution. >- * >- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >- * THE POSSIBILITY OF SUCH DAMAGE. >- */ >- >-#include "config.h" >-#include "WebKitWebPageAccessibilityObject.h" >- >-#if ENABLE(ACCESSIBILITY) >- >-#include "WebPage.h" >-#include <WebCore/AXObjectCache.h> >-#include <WebCore/AccessibilityScrollView.h> >-#include <WebCore/Document.h> >-#include <WebCore/Frame.h> >-#include <WebCore/Page.h> >-#include <WebCore/ScrollView.h> >-#include <wtf/glib/WTFGType.h> >- >-using namespace WebKit; >-using namespace WebCore; >- >-struct _WebKitWebPageAccessibilityObjectPrivate { >- WebPage* page; >-}; >- >-WEBKIT_DEFINE_TYPE(WebKitWebPageAccessibilityObject, webkit_web_page_accessibility_object, ATK_TYPE_PLUG) >- >-static void coreRootObjectWrapperDetachedCallback(AtkObject* wrapper, const char*, gboolean value, AtkObject* atkObject) >-{ >- if (!value) >- return; >- >- g_signal_emit_by_name(atkObject, "children-changed::remove", 0, wrapper); >-} >- >-static AccessibilityObjectWrapper* rootWebAreaWrapper(AXCoreObject& rootObject) >-{ >- if (!rootObject.isScrollView()) >- return nullptr; >- >- if (auto* webAreaObject = rootObject.webAreaObject()) >- return webAreaObject->wrapper(); >- >- return nullptr; >-} >- >-static AtkObject* accessibilityRootObjectWrapper(AtkObject* atkObject) >-{ >- if (!AXObjectCache::accessibilityEnabled()) >- AXObjectCache::enableAccessibility(); >- >- auto* accessible = WEBKIT_WEB_PAGE_ACCESSIBILITY_OBJECT(atkObject); >- if (!accessible->priv->page) >- return nullptr; >- >- Page* corePage = accessible->priv->page->corePage(); >- if (!corePage) >- return nullptr; >- >- Frame& coreFrame = corePage->mainFrame(); >- if (!coreFrame.document()) >- return nullptr; >- >- AXObjectCache* cache = coreFrame.document()->axObjectCache(); >- if (!cache) >- return nullptr; >- >- AXCoreObject* coreRootObject = cache->rootObject(); >- if (!coreRootObject) >- return nullptr; >- >- auto* wrapper = ATK_OBJECT(coreRootObject->wrapper()); >- if (!wrapper) >- return nullptr; >- >- if (atk_object_peek_parent(wrapper) != ATK_OBJECT(accessible)) { >- atk_object_set_parent(wrapper, ATK_OBJECT(accessible)); >- g_signal_emit_by_name(accessible, "children-changed::add", 0, wrapper); >- >- if (auto* webAreaWrapper = rootWebAreaWrapper(*coreRootObject)) { >- g_signal_connect_object(webAreaWrapper, "state-change::defunct", >- G_CALLBACK(coreRootObjectWrapperDetachedCallback), accessible, static_cast<GConnectFlags>(0)); >- } >- } >- >- return wrapper; >-} >- >-static void webkitWebPageAccessibilityObjectInitialize(AtkObject* atkObject, gpointer data) >-{ >- if (ATK_OBJECT_CLASS(webkit_web_page_accessibility_object_parent_class)->initialize) >- ATK_OBJECT_CLASS(webkit_web_page_accessibility_object_parent_class)->initialize(atkObject, data); >- >- WEBKIT_WEB_PAGE_ACCESSIBILITY_OBJECT(atkObject)->priv->page = reinterpret_cast<WebPage*>(data); >- atk_object_set_role(atkObject, ATK_ROLE_FILLER); >-} >- >-static gint webkitWebPageAccessibilityObjectGetIndexInParent(AtkObject*) >-{ >- // An AtkPlug is the only child an AtkSocket can have. >- return 0; >-} >- >-static gint webkitWebPageAccessibilityObjectGetNChildren(AtkObject* atkObject) >-{ >- return accessibilityRootObjectWrapper(atkObject) ? 1 : 0; >-} >- >-static AtkObject* webkitWebPageAccessibilityObjectRefChild(AtkObject* atkObject, gint index) >-{ >- // It's supposed to have either one child or zero. >- if (index && index != 1) >- return nullptr; >- >- if (auto* rootObjectWrapper = accessibilityRootObjectWrapper(atkObject)) >- return ATK_OBJECT(g_object_ref(rootObjectWrapper)); >- >- return nullptr; >-} >- >-static AtkStateSet* webkitWebPageAccessibilityObjectRefStateSet(AtkObject* atkObject) >-{ >- if (auto* rootObjectWrapper = accessibilityRootObjectWrapper(atkObject)) >- return atk_object_ref_state_set(rootObjectWrapper); >- >- return atk_state_set_new(); >-} >- >-static void webkit_web_page_accessibility_object_class_init(WebKitWebPageAccessibilityObjectClass* klass) >-{ >- AtkObjectClass* atkObjectClass = ATK_OBJECT_CLASS(klass); >- // No need to implement get_parent() here since this is a subclass >- // of AtkPlug and all the logic related to that function will be >- // implemented by the ATK bridge. >- atkObjectClass->initialize = webkitWebPageAccessibilityObjectInitialize; >- atkObjectClass->get_index_in_parent = webkitWebPageAccessibilityObjectGetIndexInParent; >- atkObjectClass->get_n_children = webkitWebPageAccessibilityObjectGetNChildren; >- atkObjectClass->ref_child = webkitWebPageAccessibilityObjectRefChild; >- atkObjectClass->ref_state_set = webkitWebPageAccessibilityObjectRefStateSet; >-} >- >-AtkObject* webkitWebPageAccessibilityObjectNew(WebPage* page) >-{ >- AtkObject* object = ATK_OBJECT(g_object_new(WEBKIT_TYPE_WEB_PAGE_ACCESSIBILITY_OBJECT, nullptr)); >- atk_object_initialize(object, page); >- return object; >-} >- >-#endif // ENABLE(ACCESSIBILITY) >diff --git a/Source/WebKit/WebProcess/WebPage/atk/WebKitWebPageAccessibilityObject.h b/Source/WebKit/WebProcess/WebPage/atk/WebKitWebPageAccessibilityObject.h >deleted file mode 100644 >index 6d56134fed53..000000000000 >--- a/Source/WebKit/WebProcess/WebPage/atk/WebKitWebPageAccessibilityObject.h >+++ /dev/null >@@ -1,65 +0,0 @@ >-/* >- * Copyright (C) 2012, 2019 Igalia S.L. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions >- * are met: >- * 1. Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * 2. Redistributions in binary form must reproduce the above copyright >- * notice, this list of conditions and the following disclaimer in the >- * documentation and/or other materials provided with the distribution. >- * >- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >- * THE POSSIBILITY OF SUCH DAMAGE. >- */ >- >-#pragma once >- >-#if ENABLE(ACCESSIBILITY) >- >-#include <atk/atk.h> >- >-namespace WebKit { >-class WebPage; >-} >- >-G_BEGIN_DECLS >- >-#define WEBKIT_TYPE_WEB_PAGE_ACCESSIBILITY_OBJECT (webkit_web_page_accessibility_object_get_type()) >-#define WEBKIT_WEB_PAGE_ACCESSIBILITY_OBJECT(object) (G_TYPE_CHECK_INSTANCE_CAST((object), WEBKIT_TYPE_WEB_PAGE_ACCESSIBILITY_OBJECT, WebKitWebPageAccessibilityObject)) >-#define WEBKIT_WEB_PAGE_ACCESSIBILITY_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), WEBKIT_TYPE_WEB_PAGE_ACCESSIBILITY_OBJECT, WebKitWebPageAccessibilityObjectClass)) >-#define WEBKIT_IS_WEB_PAGE_ACCESSIBILITY_OBJECT(object) (G_TYPE_CHECK_INSTANCE_TYPE((object), WEBKIT_TYPE_WEB_PAGE_ACCESSIBILITY_OBJECT)) >-#define WEBKIT_IS_WEB_PAGE_ACCESSIBILITY_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), WEBKIT_TYPE_WEB_PAGE_ACCESSIBILITY_OBJECT)) >-#define WEBKIT_WEB_PAGE_ACCESSIBILITY_OBJECT_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS((object), WEBKIT_TYPE_WEB_PAGE_ACCESSIBILITY_OBJECT, WebKitWebPageAccessibilityObjectClass)) >- >-typedef struct _WebKitWebPageAccessibilityObject WebKitWebPageAccessibilityObject; >-typedef struct _WebKitWebPageAccessibilityObjectClass WebKitWebPageAccessibilityObjectClass; >-typedef struct _WebKitWebPageAccessibilityObjectPrivate WebKitWebPageAccessibilityObjectPrivate; >- >-struct _WebKitWebPageAccessibilityObject { >- AtkPlug parent; >- >- WebKitWebPageAccessibilityObjectPrivate* priv; >-}; >- >-struct _WebKitWebPageAccessibilityObjectClass { >- AtkPlugClass parentClass; >-}; >- >-GType webkit_web_page_accessibility_object_get_type(); >- >-AtkObject* webkitWebPageAccessibilityObjectNew(WebKit::WebPage*); >- >-G_END_DECLS >- >-#endif // ENABLE(ACCESSIBILITY) >diff --git a/Source/WebKit/WebProcess/WebPage/glib/WebPageGLib.cpp b/Source/WebKit/WebProcess/WebPage/glib/WebPageGLib.cpp >index ea4e27ea06ef..9baa72884a89 100644 >--- a/Source/WebKit/WebProcess/WebPage/glib/WebPageGLib.cpp >+++ b/Source/WebKit/WebProcess/WebPage/glib/WebPageGLib.cpp >@@ -32,7 +32,6 @@ > #include "WebKitExtensionManager.h" > #include "WebKitUserMessage.h" > #include "WebKitWebExtension.h" >-#include "WebKitWebPageAccessibilityObject.h" > #include "WebKitWebPagePrivate.h" > #include "WebPageProxyMessages.h" > #include <WebCore/Editor.h> >@@ -51,35 +50,11 @@ using namespace WebCore; > > void WebPage::platformInitialize(const WebPageCreationParameters&) > { >-#if ENABLE(ACCESSIBILITY) >+#if USE(ATSPI) > // Create the accessible object (the plug) that will serve as the > // entry point to the Web process, and send a message to the UI > // process to connect the two worlds through the accessibility > // object there specifically placed for that purpose (the socket). >-#if USE(ATK) >- auto isValidPlugID = [](const char* plugID) -> bool { >- if (!plugID || plugID[0] != ':') >- return false; >- >- auto* p = g_strrstr(plugID, ":"); >- if (!p) >- return false; >- >- if (!g_variant_is_object_path(p + 1)) >- return false; >- >- GUniquePtr<char> name(g_strndup(plugID, p - plugID)); >- if (!g_dbus_is_unique_name(name.get())) >- return false; >- >- return true; >- }; >- >- m_accessibilityObject = adoptGRef(webkitWebPageAccessibilityObjectNew(this)); >- GUniquePtr<gchar> plugID(atk_plug_get_id(ATK_PLUG(m_accessibilityObject.get()))); >- if (isValidPlugID(plugID.get())) >- send(Messages::WebPageProxy::BindAccessibilityTree(String(plugID.get()))); >-#elif USE(ATSPI) > #if PLATFORM(GTK) && USE(GTK4) > // FIXME: we need a way to connect DOM and app a11y tree in GTK4. > #else >@@ -92,7 +67,6 @@ void WebPage::platformInitialize(const WebPageCreationParameters&) > } > #endif > #endif >-#endif > } > > void WebPage::platformDetach() >diff --git a/Source/WebKit/WebProcess/wpe/WebProcessMainWPE.cpp b/Source/WebKit/WebProcess/wpe/WebProcessMainWPE.cpp >index 935693d29212..ff5eeeb0f0ab 100644 >--- a/Source/WebKit/WebProcess/wpe/WebProcessMainWPE.cpp >+++ b/Source/WebKit/WebProcess/wpe/WebProcessMainWPE.cpp >@@ -31,11 +31,6 @@ > #include "WebProcess.h" > #include <glib.h> > >-#if USE(ATK) >-#include <atk-bridge.h> >-#include <atk/atk.h> >-#endif >- > #if USE(GCRYPT) > #include <pal/crypto/gcrypt/Initialization.h> > #endif >@@ -47,39 +42,6 @@ > namespace WebKit { > using namespace WebCore; > >-#if USE(ATK) >-static void initializeAccessibility() >-{ >- auto* atkUtilClass = ATK_UTIL_CLASS(g_type_class_ref(ATK_TYPE_UTIL)); >- >- atkUtilClass->add_key_event_listener = [](AtkKeySnoopFunc, gpointer) -> guint { >- return 0; >- }; >- >- atkUtilClass->remove_key_event_listener = [](guint) { >- }; >- >- atkUtilClass->get_root = []() -> AtkObject* { >- // ATK bridge needs a root object. We use an AtkPlug because that way the >- // web process is not registered as an application. >- static AtkObject* root = nullptr; >- if (!root) >- root = atk_plug_new(); >- return root; >- }; >- >- atkUtilClass->get_toolkit_name = []() -> const gchar* { >- return "WPEWebKit"; >- }; >- >- atkUtilClass->get_toolkit_version = []() -> const gchar* { >- return ""; >- }; >- >- atk_bridge_adaptor_init(nullptr, nullptr); >-} >-#endif >- > class WebProcessMainWPE final : public AuxiliaryProcessMainBase<WebProcess> { > public: > bool platformInitialize() override >@@ -97,10 +59,6 @@ public: > // FIXME: This should be probably called in other processes as well. > g_set_prgname("WPEWebProcess"); > >-#if USE(ATK) >- initializeAccessibility(); >-#endif >- > return true; > } > >diff --git a/Source/cmake/OptionsGTK.cmake b/Source/cmake/OptionsGTK.cmake >index 4ea3d447dfaa..a6630ec67e3b 100644 >--- a/Source/cmake/OptionsGTK.cmake >+++ b/Source/cmake/OptionsGTK.cmake >@@ -21,7 +21,6 @@ find_package(PNG REQUIRED) > find_package(SQLite3 REQUIRED) > find_package(Threads REQUIRED) > find_package(ZLIB REQUIRED) >-find_package(ATK 2.16.0 REQUIRED) > find_package(WebP REQUIRED COMPONENTS demux) > find_package(ATSPI 2.5.3) > find_package(EGL) >@@ -76,7 +75,6 @@ WEBKIT_OPTION_DEFINE(USE_WPE_RENDERER "Whether to enable WPE rendering" PUBLIC O > > # Private options specific to the GTK port. Changing these options is > # completely unsupported. They are intended for use only by WebKit developers. >-WEBKIT_OPTION_DEFINE(USE_ATSPI "Whether to use the ATSPI a11y implementation instead of ATK." PRIVATE ON) > > WEBKIT_OPTION_DEPEND(ENABLE_3D_TRANSFORMS USE_OPENGL_OR_ES) > WEBKIT_OPTION_DEPEND(ENABLE_ASYNC_SCROLLING USE_OPENGL_OR_ES) >@@ -273,17 +271,7 @@ if (NOT EXISTS "${TOOLS_DIR}/glib/apply-build-revision-to-files.py") > set(BUILD_REVISION "tarball") > endif () > >-if (ENABLE_ACCESSIBILITY) >- if (USE_ATSPI) >- SET_AND_EXPOSE_TO_BUILD(USE_ATK FALSE) >- else () >- SET_AND_EXPOSE_TO_BUILD(USE_ATK TRUE) >- endif () >-else () >- SET_AND_EXPOSE_TO_BUILD(USE_ATK FALSE) >- SET_AND_EXPOSE_TO_BUILD(USE_ATSPI FALSE) >-endif () >- >+SET_AND_EXPOSE_TO_BUILD(USE_ATSPI ${ENABLE_ACCESSIBILITY}) > SET_AND_EXPOSE_TO_BUILD(HAVE_GTK_UNIX_PRINTING ${GTK_UNIX_PRINT_FOUND}) > SET_AND_EXPOSE_TO_BUILD(HAVE_OS_DARK_MODE_SUPPORT 1) > >diff --git a/Source/cmake/OptionsWPE.cmake b/Source/cmake/OptionsWPE.cmake >index 0ce879189dd9..d1fd2f01e8a6 100644 >--- a/Source/cmake/OptionsWPE.cmake >+++ b/Source/cmake/OptionsWPE.cmake >@@ -91,7 +91,6 @@ WEBKIT_OPTION_DEFINE(USE_WOFF2 "Whether to enable support for WOFF2 Web Fonts." > WEBKIT_OPTION_DEFINE(USE_GSTREAMER_HOLEPUNCH "Whether to enable GStreamer holepunch" PRIVATE OFF) > WEBKIT_OPTION_DEFINE(USE_EXTERNAL_HOLEPUNCH "Whether to enable external holepunch" PRIVATE OFF) > WEBKIT_OPTION_DEPEND(USE_ANGLE_WEBGL ENABLE_WEBGL) >-WEBKIT_OPTION_DEFINE(USE_ATSPI "Whether to use the ATSPI a11y implementation instead of ATK." PRIVATE ON) > WEBKIT_OPTION_DEPEND(ENABLE_WEBGL2 USE_ANGLE_WEBGL) > > if (CMAKE_SYSTEM_NAME MATCHES "Linux") >@@ -279,6 +278,7 @@ if (NOT EXISTS "${TOOLS_DIR}/glib/apply-build-revision-to-files.py") > endif () > > SET_AND_EXPOSE_TO_BUILD(HAVE_ACCESSIBILITY ${ENABLE_ACCESSIBILITY}) >+SET_AND_EXPOSE_TO_BUILD(USE_ATSPI ${ENABLE_ACCESSIBILITY}) > SET_AND_EXPOSE_TO_BUILD(USE_CAIRO TRUE) > SET_AND_EXPOSE_TO_BUILD(USE_EGL TRUE) > SET_AND_EXPOSE_TO_BUILD(USE_GCRYPT TRUE) >@@ -294,17 +294,6 @@ if (WTF_CPU_ARM OR WTF_CPU_MIPS) > SET_AND_EXPOSE_TO_BUILD(USE_CAPSTONE ${ENABLE_DEVELOPER_MODE}) > endif () > >-if (ENABLE_ACCESSIBILITY) >- if (USE_ATSPI) >- SET_AND_EXPOSE_TO_BUILD(USE_ATK FALSE) >- else () >- SET_AND_EXPOSE_TO_BUILD(USE_ATK TRUE) >- endif () >-else () >- SET_AND_EXPOSE_TO_BUILD(USE_ATK FALSE) >- SET_AND_EXPOSE_TO_BUILD(USE_ATSPI FALSE) >-endif () >- > SET_AND_EXPOSE_TO_BUILD(USE_TEXTURE_MAPPER TRUE) > SET_AND_EXPOSE_TO_BUILD(USE_TEXTURE_MAPPER_GL TRUE) > SET_AND_EXPOSE_TO_BUILD(USE_TEXTURE_MAPPER_DMABUF TRUE) >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index 212c89674343..75ab1035e67f 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,246 @@ >+2022-03-22 Carlos Garcia Campos <cgarcia@igalia.com> >+ >+ [GTK][WPE] Remove the ATK implementation >+ https://bugs.webkit.org/show_bug.cgi?id=238198 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * DumpRenderTree/AccessibilityController.h: >+ * DumpRenderTree/AccessibilityUIElement.h: >+ * Scripts/valgrind/suppressions.txt: >+ * Scripts/webkit-filter-log: >+ * TestWebKitAPI/Tests/WebKitGtk/TestWebKitAccessibility.cpp: >+ (testAccessibleChildrenChanged): >+ (testAccessibleAttributes): >+ (testAccessibleState): >+ (testAccessibleStateChanged): >+ (testAccessibleListMarkers): >+ (testTextSurrogatePair): >+ (testTextIterator): >+ (testTextExtents): >+ (testTextSelections): >+ (testTextAttributes): >+ (testTextStateChanged): >+ (testTextReplacedObjects): >+ (testTextListMarkers): >+ (testHyperlinkBasic): >+ (testHypertextBasic): >+ (testActionBasic): >+ (testDocumentBasic): >+ (testImageBasic): >+ (testSelectionMenuList): >+ (testTableBasic): >+ * TestWebKitAPI/glib/PlatformGTK.cmake: >+ * WebKitTestRunner/InjectedBundle/AccessibilityController.h: >+ * WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h: >+ * WebKitTestRunner/InjectedBundle/atk/AccessibilityControllerAtk.cpp: Removed. >+ (WTR::AccessibilityController::resetToConsistentState): Deleted. >+ (WTR::childElementById): Deleted. >+ (WTR::AccessibilityController::accessibleElementById): Deleted. >+ (WTR::AccessibilityController::platformName): Deleted. >+ (WTR::AccessibilityController::injectAccessibilityPreference): Deleted. >+ (WTR::AccessibilityController::rootElement): Deleted. >+ (WTR::AccessibilityController::focusedElement): Deleted. >+ (WTR::AccessibilityController::addNotificationListener): Deleted. >+ (WTR::AccessibilityController::removeNotificationListener): Deleted. >+ * WebKitTestRunner/InjectedBundle/atk/AccessibilityNotificationHandlerAtk.cpp: Removed. >+ (): Deleted. >+ (WTR::AccessibilityNotificationHandler::AccessibilityNotificationHandler): Deleted. >+ (WTR::AccessibilityNotificationHandler::~AccessibilityNotificationHandler): Deleted. >+ (WTR::AccessibilityNotificationHandler::setNotificationFunctionCallback): Deleted. >+ (WTR::AccessibilityNotificationHandler::removeAccessibilityNotificationHandler): Deleted. >+ (WTR::AccessibilityNotificationHandler::connectAccessibilityCallbacks): Deleted. >+ (WTR::AccessibilityNotificationHandler::disconnectAccessibilityCallbacks): Deleted. >+ * WebKitTestRunner/InjectedBundle/atk/AccessibilityNotificationHandlerAtk.h: Removed. >+ (WTR::AccessibilityNotificationHandler::create): Deleted. >+ (WTR::AccessibilityNotificationHandler::setPlatformElement): Deleted. >+ (WTR::AccessibilityNotificationHandler::platformElement const): Deleted. >+ (WTR::AccessibilityNotificationHandler::notificationFunctionCallback const): Deleted. >+ * WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp: Removed. >+ (): Deleted. >+ (WTR::AccessibilityUIElement::AccessibilityUIElement): Deleted. >+ (WTR::AccessibilityUIElement::~AccessibilityUIElement): Deleted. >+ (WTR::AccessibilityUIElement::isEqual): Deleted. >+ (WTR::AccessibilityUIElement::getChildren): Deleted. >+ (WTR::AccessibilityUIElement::getChildrenWithRange): Deleted. >+ (WTR::AccessibilityUIElement::childrenCount): Deleted. >+ (WTR::AccessibilityUIElement::elementAtPoint): Deleted. >+ (WTR::AccessibilityUIElement::indexOfChild): Deleted. >+ (WTR::AccessibilityUIElement::childAtIndex): Deleted. >+ (WTR::accessibilityElementAtIndex): Deleted. >+ (WTR::AccessibilityUIElement::linkedUIElementAtIndex): Deleted. >+ (WTR::AccessibilityUIElement::ariaOwnsElementAtIndex): Deleted. >+ (WTR::AccessibilityUIElement::ariaOwnsReferencingElementAtIndex): Deleted. >+ (WTR::AccessibilityUIElement::ariaFlowToElementAtIndex): Deleted. >+ (WTR::AccessibilityUIElement::ariaFlowToReferencingElementAtIndex): Deleted. >+ (WTR::AccessibilityUIElement::ariaControlsElementAtIndex): Deleted. >+ (WTR::AccessibilityUIElement::ariaControlsReferencingElementAtIndex): Deleted. >+ (WTR::AccessibilityUIElement::ariaLabelledByElementAtIndex): Deleted. >+ (WTR::AccessibilityUIElement::ariaLabelledByReferencingElementAtIndex): Deleted. >+ (WTR::AccessibilityUIElement::ariaDescribedByElementAtIndex): Deleted. >+ (WTR::AccessibilityUIElement::ariaDescribedByReferencingElementAtIndex): Deleted. >+ (WTR::AccessibilityUIElement::ariaDetailsElementAtIndex): Deleted. >+ (WTR::AccessibilityUIElement::ariaDetailsReferencingElementAtIndex): Deleted. >+ (WTR::AccessibilityUIElement::ariaErrorMessageElementAtIndex): Deleted. >+ (WTR::AccessibilityUIElement::ariaErrorMessageReferencingElementAtIndex): Deleted. >+ (WTR::AccessibilityUIElement::disclosedRowAtIndex): Deleted. >+ (WTR::AccessibilityUIElement::rowAtIndex): Deleted. >+ (WTR::AccessibilityUIElement::selectedChildAtIndex const): Deleted. >+ (WTR::AccessibilityUIElement::selectedChildrenCount const): Deleted. >+ (WTR::AccessibilityUIElement::selectedRowAtIndex): Deleted. >+ (WTR::AccessibilityUIElement::titleUIElement): Deleted. >+ (WTR::AccessibilityUIElement::parentElement): Deleted. >+ (WTR::AccessibilityUIElement::disclosedByRow): Deleted. >+ (WTR::AccessibilityUIElement::attributesOfLinkedUIElements): Deleted. >+ (WTR::AccessibilityUIElement::attributesOfDocumentLinks): Deleted. >+ (WTR::AccessibilityUIElement::attributesOfChildren): Deleted. >+ (WTR::AccessibilityUIElement::allAttributes): Deleted. >+ (WTR::AccessibilityUIElement::stringDescriptionOfAttributeValue): Deleted. >+ (WTR::AccessibilityUIElement::stringAttributeValue): Deleted. >+ (WTR::AccessibilityUIElement::numberAttributeValue): Deleted. >+ (WTR::AccessibilityUIElement::currentStateValue const): Deleted. >+ (WTR::AccessibilityUIElement::uiElementArrayAttributeValue const): Deleted. >+ (WTR::AccessibilityUIElement::rowHeaders const): Deleted. >+ (WTR::AccessibilityUIElement::columnHeaders const): Deleted. >+ (WTR::AccessibilityUIElement::uiElementAttributeValue const): Deleted. >+ (WTR::AccessibilityUIElement::boolAttributeValue): Deleted. >+ (WTR::AccessibilityUIElement::isAttributeSettable): Deleted. >+ (WTR::AccessibilityUIElement::isAttributeSupported): Deleted. >+ (WTR::AccessibilityUIElement::parameterizedAttributeNames): Deleted. >+ (WTR::AccessibilityUIElement::role): Deleted. >+ (WTR::AccessibilityUIElement::subrole): Deleted. >+ (WTR::AccessibilityUIElement::roleDescription): Deleted. >+ (WTR::AccessibilityUIElement::computedRoleString): Deleted. >+ (WTR::AccessibilityUIElement::title): Deleted. >+ (WTR::AccessibilityUIElement::description): Deleted. >+ (WTR::AccessibilityUIElement::orientation const): Deleted. >+ (WTR::AccessibilityUIElement::stringValue): Deleted. >+ (WTR::AccessibilityUIElement::language): Deleted. >+ (WTR::AccessibilityUIElement::helpText const): Deleted. >+ (WTR::AccessibilityUIElement::x): Deleted. >+ (WTR::AccessibilityUIElement::y): Deleted. >+ (WTR::AccessibilityUIElement::width): Deleted. >+ (WTR::AccessibilityUIElement::height): Deleted. >+ (WTR::AccessibilityUIElement::clickPointX): Deleted. >+ (WTR::AccessibilityUIElement::clickPointY): Deleted. >+ (WTR::AccessibilityUIElement::intValue const): Deleted. >+ (WTR::AccessibilityUIElement::minValue): Deleted. >+ (WTR::AccessibilityUIElement::maxValue): Deleted. >+ (WTR::AccessibilityUIElement::valueDescription): Deleted. >+ (WTR::AccessibilityUIElement::insertionPointLineNumber): Deleted. >+ (WTR::AccessibilityUIElement::isPressActionSupported): Deleted. >+ (WTR::AccessibilityUIElement::isIncrementActionSupported): Deleted. >+ (WTR::AccessibilityUIElement::isDecrementActionSupported): Deleted. >+ (WTR::AccessibilityUIElement::isEnabled): Deleted. >+ (WTR::AccessibilityUIElement::isRequired const): Deleted. >+ (WTR::AccessibilityUIElement::isFocused const): Deleted. >+ (WTR::AccessibilityUIElement::isSelected const): Deleted. >+ (WTR::AccessibilityUIElement::isSelectedOptionActive const): Deleted. >+ (WTR::AccessibilityUIElement::isExpanded const): Deleted. >+ (WTR::AccessibilityUIElement::isChecked const): Deleted. >+ (WTR::AccessibilityUIElement::isIndeterminate const): Deleted. >+ (WTR::AccessibilityUIElement::hierarchicalLevel const): Deleted. >+ (WTR::AccessibilityUIElement::speakAs): Deleted. >+ (WTR::AccessibilityUIElement::ariaIsGrabbed const): Deleted. >+ (WTR::AccessibilityUIElement::ariaDropEffects const): Deleted. >+ (WTR::AccessibilityUIElement::lineForIndex): Deleted. >+ (WTR::AccessibilityUIElement::rangeForLine): Deleted. >+ (WTR::AccessibilityUIElement::rangeForPosition): Deleted. >+ (WTR::AccessibilityUIElement::boundsForRange): Deleted. >+ (WTR::AccessibilityUIElement::stringForRange): Deleted. >+ (WTR::AccessibilityUIElement::attributedStringForRange): Deleted. >+ (WTR::AccessibilityUIElement::attributedStringRangeIsMisspelled): Deleted. >+ (WTR::AccessibilityUIElement::uiElementCountForSearchPredicate): Deleted. >+ (WTR::AccessibilityUIElement::uiElementForSearchPredicate): Deleted. >+ (WTR::AccessibilityUIElement::selectTextWithCriteria): Deleted. >+ (WTR::AccessibilityUIElement::attributesOfColumnHeaders): Deleted. >+ (WTR::AccessibilityUIElement::attributesOfRowHeaders): Deleted. >+ (WTR::AccessibilityUIElement::attributesOfColumns): Deleted. >+ (WTR::AccessibilityUIElement::attributesOfRows): Deleted. >+ (WTR::AccessibilityUIElement::attributesOfVisibleCells): Deleted. >+ (WTR::AccessibilityUIElement::attributesOfHeader): Deleted. >+ (WTR::AccessibilityUIElement::rowCount): Deleted. >+ (WTR::AccessibilityUIElement::columnCount): Deleted. >+ (WTR::AccessibilityUIElement::indexInTable): Deleted. >+ (WTR::AccessibilityUIElement::rowIndexRange): Deleted. >+ (WTR::AccessibilityUIElement::columnIndexRange): Deleted. >+ (WTR::AccessibilityUIElement::cellForColumnAndRow): Deleted. >+ (WTR::AccessibilityUIElement::horizontalScrollbar const): Deleted. >+ (WTR::AccessibilityUIElement::verticalScrollbar const): Deleted. >+ (WTR::AccessibilityUIElement::selectedTextRange): Deleted. >+ (WTR::AccessibilityUIElement::setSelectedTextRange): Deleted. >+ (WTR::AccessibilityUIElement::increment): Deleted. >+ (WTR::AccessibilityUIElement::decrement): Deleted. >+ (WTR::AccessibilityUIElement::showMenu): Deleted. >+ (WTR::AccessibilityUIElement::press): Deleted. >+ (WTR::AccessibilityUIElement::setSelectedChild const): Deleted. >+ (WTR::AccessibilityUIElement::setSelectedChildAtIndex const): Deleted. >+ (WTR::AccessibilityUIElement::removeSelectionAtIndex const): Deleted. >+ (WTR::AccessibilityUIElement::clearSelectedChildren const): Deleted. >+ (WTR::AccessibilityUIElement::accessibilityValue const): Deleted. >+ (WTR::AccessibilityUIElement::documentEncoding): Deleted. >+ (WTR::AccessibilityUIElement::documentURI): Deleted. >+ (WTR::AccessibilityUIElement::url): Deleted. >+ (WTR::AccessibilityUIElement::addNotificationListener): Deleted. >+ (WTR::AccessibilityUIElement::removeNotificationListener): Deleted. >+ (WTR::AccessibilityUIElement::isFocusable const): Deleted. >+ (WTR::AccessibilityUIElement::isSelectable const): Deleted. >+ (WTR::AccessibilityUIElement::isMultiSelectable const): Deleted. >+ (WTR::AccessibilityUIElement::isVisible const): Deleted. >+ (WTR::AccessibilityUIElement::isOffScreen const): Deleted. >+ (WTR::AccessibilityUIElement::isCollapsed const): Deleted. >+ (WTR::AccessibilityUIElement::isIgnored const): Deleted. >+ (WTR::AccessibilityUIElement::isSingleLine const): Deleted. >+ (WTR::AccessibilityUIElement::isMultiLine const): Deleted. >+ (WTR::AccessibilityUIElement::hasPopup const): Deleted. >+ (WTR::AccessibilityUIElement::takeFocus): Deleted. >+ (WTR::AccessibilityUIElement::takeSelection): Deleted. >+ (WTR::AccessibilityUIElement::addSelection): Deleted. >+ (WTR::AccessibilityUIElement::removeSelection): Deleted. >+ (WTR::AccessibilityUIElement::lineTextMarkerRangeForTextMarker): Deleted. >+ (WTR::AccessibilityUIElement::textMarkerRangeForElement): Deleted. >+ (WTR::AccessibilityUIElement::textMarkerRangeLength): Deleted. >+ (WTR::AccessibilityUIElement::previousTextMarker): Deleted. >+ (WTR::AccessibilityUIElement::nextTextMarker): Deleted. >+ (WTR::AccessibilityUIElement::stringForTextMarkerRange): Deleted. >+ (WTR::AccessibilityUIElement::rectsForTextMarkerRange): Deleted. >+ (WTR::AccessibilityUIElement::textMarkerRangeForMarkers): Deleted. >+ (WTR::AccessibilityUIElement::startTextMarkerForTextMarkerRange): Deleted. >+ (WTR::AccessibilityUIElement::endTextMarkerForTextMarkerRange): Deleted. >+ (WTR::AccessibilityUIElement::endTextMarkerForBounds): Deleted. >+ (WTR::AccessibilityUIElement::startTextMarkerForBounds): Deleted. >+ (WTR::AccessibilityUIElement::textMarkerForPoint): Deleted. >+ (WTR::AccessibilityUIElement::accessibilityElementForTextMarker): Deleted. >+ (WTR::AccessibilityUIElement::attributedStringForTextMarkerRange): Deleted. >+ (WTR::AccessibilityUIElement::attributedStringForTextMarkerRangeWithOptions): Deleted. >+ (WTR::AccessibilityUIElement::attributedStringForTextMarkerRangeContainsAttribute): Deleted. >+ (WTR::AccessibilityUIElement::indexForTextMarker): Deleted. >+ (WTR::AccessibilityUIElement::isTextMarkerValid): Deleted. >+ (WTR::AccessibilityUIElement::textMarkerForIndex): Deleted. >+ (WTR::AccessibilityUIElement::startTextMarker): Deleted. >+ (WTR::AccessibilityUIElement::endTextMarker): Deleted. >+ (WTR::AccessibilityUIElement::setSelectedTextMarkerRange): Deleted. >+ (WTR::AccessibilityUIElement::scrollToMakeVisible): Deleted. >+ (WTR::AccessibilityUIElement::scrollToGlobalPoint): Deleted. >+ (WTR::AccessibilityUIElement::scrollToMakeVisibleWithSubFocus): Deleted. >+ (WTR::AccessibilityUIElement::supportedActions const): Deleted. >+ (WTR::AccessibilityUIElement::pathDescription const): Deleted. >+ (WTR::AccessibilityUIElement::mathPostscriptsDescription const): Deleted. >+ (WTR::AccessibilityUIElement::mathPrescriptsDescription const): Deleted. >+ (WTR::AccessibilityUIElement::classList const): Deleted. >+ (WTR::stringAtOffset): Deleted. >+ (WTR::AccessibilityUIElement::characterAtOffset): Deleted. >+ (WTR::AccessibilityUIElement::wordAtOffset): Deleted. >+ (WTR::AccessibilityUIElement::lineAtOffset): Deleted. >+ (WTR::AccessibilityUIElement::sentenceAtOffset): Deleted. >+ (WTR::AccessibilityUIElement::replaceTextInRange): Deleted. >+ (WTR::AccessibilityUIElement::insertText): Deleted. >+ (WTR::AccessibilityUIElement::popupValue const): Deleted. >+ * WebKitTestRunner/PlatformGTK.cmake: >+ * WebKitTestRunner/PlatformWPE.cmake: >+ * WebKitTestRunner/TestOptions.cpp: >+ (WTR::TestOptions::defaults): >+ > 2022-03-22 Myles C. Maxfield <mmaxfield@apple.com> > > Squelch warning message from output of build-jsc >diff --git a/Tools/DumpRenderTree/AccessibilityController.h b/Tools/DumpRenderTree/AccessibilityController.h >index 1f460cd3771b..c0eb66232fd9 100644 >--- a/Tools/DumpRenderTree/AccessibilityController.h >+++ b/Tools/DumpRenderTree/AccessibilityController.h >@@ -36,11 +36,6 @@ > #include <windows.h> > #endif > >-#if ENABLE(ACCESSIBILITY) && PLATFORM(GTK) >-#include "AccessibilityNotificationHandlerAtk.h" >-#include <atk/atk.h> >-#endif >- > class AccessibilityController { > WTF_MAKE_FAST_ALLOCATED; > public: >@@ -78,10 +73,6 @@ public: > void winNotificationReceived(PlatformUIElement, const std::string& eventName); > #endif > >-#if ENABLE(ACCESSIBILITY) && PLATFORM(GTK) >- AtkObject* childElementById(AtkObject* parent, const char* id); >-#endif >- > private: > static JSRetainPtr<JSClassRef> createJSClass(); > >@@ -99,9 +90,5 @@ private: > RetainPtr<id> m_globalNotificationHandler; > #endif > >-#if ENABLE(ACCESSIBILITY) && PLATFORM(GTK) >- RefPtr<AccessibilityNotificationHandler> m_globalNotificationHandler; >-#endif >- > void platformResetToConsistentState(); > }; >diff --git a/Tools/DumpRenderTree/AccessibilityUIElement.h b/Tools/DumpRenderTree/AccessibilityUIElement.h >index f6e4ff6ef3b0..b2e3361b87df 100644 >--- a/Tools/DumpRenderTree/AccessibilityUIElement.h >+++ b/Tools/DumpRenderTree/AccessibilityUIElement.h >@@ -43,10 +43,6 @@ OBJC_CLASS NSString; > #include <WebCore/COMPtr.h> > #include <oleacc.h> > typedef COMPtr<IAccessible> PlatformUIElement; >-#elif ENABLE(ACCESSIBILITY) && PLATFORM(GTK) >-#include "AccessibilityNotificationHandlerAtk.h" >-#include <atk/atk.h> >-typedef AtkObject* PlatformUIElement; > #else > typedef void* PlatformUIElement; > #endif >@@ -253,14 +249,6 @@ public: > JSRetainPtr<JSStringRef> attributedStringForElement(); > #endif > >-#if PLATFORM(GTK) >- // Text-specific >- JSRetainPtr<JSStringRef> characterAtOffset(int offset); >- JSRetainPtr<JSStringRef> wordAtOffset(int offset); >- JSRetainPtr<JSStringRef> lineAtOffset(int offset); >- JSRetainPtr<JSStringRef> sentenceAtOffset(int offset); >-#endif >- > // Table-specific > AccessibilityUIElement cellForColumnAndRow(unsigned column, unsigned row); > >@@ -357,8 +345,4 @@ private: > RetainPtr<id> m_element; > RetainPtr<id> m_notificationHandler; > #endif >- >-#if ENABLE(ACCESSIBILITY) && PLATFORM(GTK) >- RefPtr<AccessibilityNotificationHandler> m_notificationHandler; >-#endif > }; >diff --git a/Tools/Scripts/valgrind/suppressions.txt b/Tools/Scripts/valgrind/suppressions.txt >index 08a49c95b15e..7bffd29ae42a 100644 >--- a/Tools/Scripts/valgrind/suppressions.txt >+++ b/Tools/Scripts/valgrind/suppressions.txt >@@ -529,58 +529,6 @@ > # 3. Suppressions for real webkit bugs that are not yet fixed. > # These should all be in webkit's bug tracking system (but a few aren't yet). > >-{ >- # AtkProperty is cached but not released (see https://bugs.webkit.org/show_bug.cgi?id=118567#c2). >- cacheAndReturnAtkProperty >- Memcheck:Leak >- fun:malloc >- fun:_ZN3WTF10fastMallocEm >- fun:_ZN3WTF13CStringBuffer19createUninitializedEm >- fun:_ZN3WTF7CString4initEPKcm >- fun:_ZN3WTF7CStringC1EPKcm >- fun:_ZNK3WTF6String4utf8ENS0_14ConversionModeE >- fun:cacheAndReturnAtkProperty >-} >- >-{ >- # AtkRelationSet is never freed because the target AtkObject is >- # cached. See https://bugs.webkit.org/show_bug.cgi?id=118567. >- AccessibilityUIElement::title() >- Memcheck:Leak >- fun:malloc >- ... >- fun:g_object_weak_ref >- fun:atk_relation_set_property >- fun:g_object_newv >- fun:g_object_new_valist >- fun:g_object_new >- fun:atk_relation_new >- fun:atk_relation_set_add_relation_by_type >- fun:_ZL31setAtkRelationSetFromCoreObjectPN7WebCore19AccessibilityObjectEP15_AtkRelationSet >- fun:_ZL30webkitAccessibleRefRelationSetP10_AtkObject >- fun:_ZN22AccessibilityUIElement14titleUIElementEv >-} >- >-{ >- # Leak in webkitAccessibleNew https://bugs.webkit.org/show_bug.cgi?id=118382 >- webkitAccessibleNew >- Memcheck:Leak >- fun:*alloc >- ... >- fun:webkitAccessibleNew >-} >- >-{ >- # Leak ATK text https://bugs.webkit.org/show_bug.cgi?id=118385 >- webkitAccessibleTextGetText >- Memcheck:Leak >- fun:malloc >- fun:g_malloc >- fun:g_strdup >- fun:_ZL27webkitAccessibleTextGetTextP8_AtkTextii >- fun:_ZL23webkitAccessibleGetNameP10_AtkObject >-} >- > { > # Leak PluginObject in exceptional circumstances https://bugs.webkit.org/show_bug.cgi?id=118528 > WebCore::PluginView::start() >diff --git a/Tools/Scripts/webkit-filter-log b/Tools/Scripts/webkit-filter-log >index 6ad2cbeaa931..f15aad101e6e 100755 >--- a/Tools/Scripts/webkit-filter-log >+++ b/Tools/Scripts/webkit-filter-log >@@ -55,7 +55,7 @@ except NotImplementedError as e: > > scm = SCMDetector(FileSystem(), Executive()).default_scm() > >-filter_dirs = [ 'gobject', 'glib', 'soup', 'cairo', 'gstreamer', 'atk', 'adwaita', >+filter_dirs = [ 'gobject', 'glib', 'soup', 'cairo', 'gstreamer', 'atspi', 'adwaita', > 'unix', 'linux', 'CoordinatedGraphics', 'texmap', 'nicosia', > 'WebDriver', 'harfbuzz', 'freetype', 'egl', 'buildstream' ] > if port.name() == 'gtk': >diff --git a/Tools/TestWebKitAPI/Tests/WebKitGtk/TestWebKitAccessibility.cpp b/Tools/TestWebKitAPI/Tests/WebKitGtk/TestWebKitAccessibility.cpp >index 4b2b5c1af8a5..554e9abdd8ba 100644 >--- a/Tools/TestWebKitAPI/Tests/WebKitGtk/TestWebKitAccessibility.cpp >+++ b/Tools/TestWebKitAPI/Tests/WebKitGtk/TestWebKitAccessibility.cpp >@@ -311,9 +311,6 @@ static void testAccessibleIgnoredObjects(AccessibilityTest* test, gconstpointer) > > static void testAccessibleChildrenChanged(AccessibilityTest* test, gconstpointer) > { >-#if !USE(ATSPI) >- g_test_skip("This test doesn't work with ATK"); >-#else > test->showInWindow(); > test->loadHtml( > "<html>" >@@ -410,7 +407,6 @@ static void testAccessibleChildrenChanged(AccessibilityTest* test, gconstpointer > set = adoptGRef(atspi_accessible_get_state_set(baz.get())); > g_assert_true(atspi_state_set_contains(set.get(), ATSPI_STATE_DEFUNCT)); > g_assert_cmpint(atspi_accessible_get_child_count(documentWeb.get(), nullptr), ==, 0); >-#endif > } > > static void testAccessibleAttributes(AccessibilityTest* test, gconstpointer) >@@ -426,11 +422,7 @@ static void testAccessibleAttributes(AccessibilityTest* test, gconstpointer) > nullptr); > test->waitUntilLoadFinished(); > >-#if USE(ATSPI) > static const char* toolkitName = "WebKitGTK"; >-#else >- static const char* toolkitName = "WebKitGtk"; >-#endif > > auto testApp = test->findTestApplication(); > g_assert_true(ATSPI_IS_ACCESSIBLE(testApp.get())); >@@ -439,12 +431,7 @@ static void testAccessibleAttributes(AccessibilityTest* test, gconstpointer) > g_assert_true(ATSPI_IS_ACCESSIBLE(documentWeb.get())); > g_assert_cmpint(atspi_accessible_get_child_count(documentWeb.get(), nullptr), ==, 2); > auto attributes = adoptGRef(atspi_accessible_get_attributes(documentWeb.get(), nullptr)); >-#if USE(ATSPI) > g_assert_cmpuint(g_hash_table_size(attributes.get()), ==, 1); >-#else >- // FIXME: ATK includes dragged state, but dragging is not supported. >- g_assert_cmpuint(g_hash_table_size(attributes.get()), ==, 2); >-#endif > g_assert_cmpstr(static_cast<const char*>(g_hash_table_lookup(attributes.get(), "toolkit")), ==, toolkitName); > > auto h2 = adoptGRef(atspi_accessible_get_child_at_index(documentWeb.get(), 0, nullptr)); >@@ -466,11 +453,7 @@ static void testAccessibleAttributes(AccessibilityTest* test, gconstpointer) > g_assert_cmpuint(g_hash_table_size(attributes.get()), ==, 4); > g_assert_cmpstr(static_cast<const char*>(g_hash_table_lookup(attributes.get(), "toolkit")), ==, toolkitName); > g_assert_cmpstr(static_cast<const char*>(g_hash_table_lookup(attributes.get(), "computed-role")), ==, "link"); >-#if USE(ATSPI) > g_assert_cmpstr(static_cast<const char*>(g_hash_table_lookup(attributes.get(), "id")), ==, "webkitgtk"); >-#else >- g_assert_cmpstr(static_cast<const char*>(g_hash_table_lookup(attributes.get(), "html-id")), ==, "webkitgtk"); >-#endif > g_assert_cmpstr(static_cast<const char*>(g_hash_table_lookup(attributes.get(), "tag")), ==, "a"); > } > >@@ -508,13 +491,7 @@ static void testAccessibleState(AccessibilityTest* test, gconstpointer) > auto h1 = adoptGRef(atspi_accessible_get_child_at_index(documentWeb.get(), 0, nullptr)); > g_assert_true(ATSPI_IS_ACCESSIBLE(h1.get())); > GRefPtr<AtspiStateSet> stateSet = adoptGRef(atspi_accessible_get_state_set(h1.get())); >-#if USE(ATSPI) > g_assert_cmpuint(AccessibilityTest::stateSetSize(stateSet.get()), ==, 4); >-#else >- // FIXME: ATK includes orientation state in every element. >- g_assert_cmpuint(AccessibilityTest::stateSetSize(stateSet.get()), ==, 5); >- g_assert_true(atspi_state_set_contains(stateSet.get(), ATSPI_STATE_HORIZONTAL)); >-#endif > g_assert_true(atspi_state_set_contains(stateSet.get(), ATSPI_STATE_ENABLED)); > g_assert_true(atspi_state_set_contains(stateSet.get(), ATSPI_STATE_SENSITIVE)); > g_assert_true(atspi_state_set_contains(stateSet.get(), ATSPI_STATE_VISIBLE)); >@@ -528,13 +505,7 @@ static void testAccessibleState(AccessibilityTest* test, gconstpointer) > auto button = adoptGRef(atspi_accessible_get_child_at_index(section.get(), nextChild++, nullptr)); > g_assert_true(ATSPI_IS_ACCESSIBLE(button.get())); > stateSet = adoptGRef(atspi_accessible_get_state_set(button.get())); >-#if USE(ATSPI) > g_assert_cmpuint(AccessibilityTest::stateSetSize(stateSet.get()), ==, 5); >-#else >- // FIXME: ATK includes orientation state in every element. >- g_assert_cmpuint(AccessibilityTest::stateSetSize(stateSet.get()), ==, 6); >- g_assert_true(atspi_state_set_contains(stateSet.get(), ATSPI_STATE_HORIZONTAL)); >-#endif > g_assert_true(atspi_state_set_contains(stateSet.get(), ATSPI_STATE_ENABLED)); > g_assert_true(atspi_state_set_contains(stateSet.get(), ATSPI_STATE_SENSITIVE)); > g_assert_true(atspi_state_set_contains(stateSet.get(), ATSPI_STATE_VISIBLE)); >@@ -544,26 +515,14 @@ static void testAccessibleState(AccessibilityTest* test, gconstpointer) > auto buttonDisabled = adoptGRef(atspi_accessible_get_child_at_index(section.get(), nextChild++, nullptr)); > g_assert_true(ATSPI_IS_ACCESSIBLE(buttonDisabled.get())); > stateSet = adoptGRef(atspi_accessible_get_state_set(buttonDisabled.get())); >-#if USE(ATSPI) > g_assert_cmpuint(AccessibilityTest::stateSetSize(stateSet.get()), ==, 2); >-#else >- // FIXME: ATK includes orientation state in every element. >- g_assert_cmpuint(AccessibilityTest::stateSetSize(stateSet.get()), ==, 3); >- g_assert_true(atspi_state_set_contains(stateSet.get(), ATSPI_STATE_HORIZONTAL)); >-#endif > g_assert_true(atspi_state_set_contains(stateSet.get(), ATSPI_STATE_VISIBLE)); > g_assert_true(atspi_state_set_contains(stateSet.get(), ATSPI_STATE_SHOWING)); > > auto toggleButton = adoptGRef(atspi_accessible_get_child_at_index(section.get(), nextChild++, nullptr)); > g_assert_true(ATSPI_IS_ACCESSIBLE(toggleButton.get())); > stateSet = adoptGRef(atspi_accessible_get_state_set(toggleButton.get())); >-#if USE(ATSPI) > g_assert_cmpuint(AccessibilityTest::stateSetSize(stateSet.get()), ==, 6); >-#else >- // FIXME: ATK includes orientation state in every element. >- g_assert_cmpuint(AccessibilityTest::stateSetSize(stateSet.get()), ==, 7); >- g_assert_true(atspi_state_set_contains(stateSet.get(), ATSPI_STATE_HORIZONTAL)); >-#endif > g_assert_true(atspi_state_set_contains(stateSet.get(), ATSPI_STATE_ENABLED)); > g_assert_true(atspi_state_set_contains(stateSet.get(), ATSPI_STATE_SENSITIVE)); > g_assert_true(atspi_state_set_contains(stateSet.get(), ATSPI_STATE_VISIBLE)); >@@ -574,13 +533,7 @@ static void testAccessibleState(AccessibilityTest* test, gconstpointer) > auto radio = adoptGRef(atspi_accessible_get_child_at_index(section.get(), nextChild++, nullptr)); > g_assert_true(ATSPI_IS_ACCESSIBLE(radio.get())); > stateSet = adoptGRef(atspi_accessible_get_state_set(radio.get())); >-#if USE(ATSPI) > g_assert_cmpuint(AccessibilityTest::stateSetSize(stateSet.get()), ==, 6); >-#else >- // FIXME: ATK includes orientation state in every element. >- g_assert_cmpuint(AccessibilityTest::stateSetSize(stateSet.get()), ==, 7); >- g_assert_true(atspi_state_set_contains(stateSet.get(), ATSPI_STATE_VERTICAL)); >-#endif > g_assert_true(atspi_state_set_contains(stateSet.get(), ATSPI_STATE_ENABLED)); > g_assert_true(atspi_state_set_contains(stateSet.get(), ATSPI_STATE_SENSITIVE)); > g_assert_true(atspi_state_set_contains(stateSet.get(), ATSPI_STATE_VISIBLE)); >@@ -628,12 +581,7 @@ static void testAccessibleState(AccessibilityTest* test, gconstpointer) > g_assert_true(atspi_state_set_contains(stateSet.get(), ATSPI_STATE_FOCUSABLE)); > g_assert_true(atspi_state_set_contains(stateSet.get(), ATSPI_STATE_EDITABLE)); > g_assert_true(atspi_state_set_contains(stateSet.get(), ATSPI_STATE_SINGLE_LINE)); >-#if USE(ATSPI) > g_assert_true(atspi_state_set_contains(stateSet.get(), ATSPI_STATE_SELECTABLE_TEXT)); >-#else >- // FIXME: ATK doesn't implement selectable text, but includes oprientation. >- g_assert_true(atspi_state_set_contains(stateSet.get(), ATSPI_STATE_HORIZONTAL)); >-#endif > g_assert_true(atspi_state_set_contains(stateSet.get(), ATSPI_STATE_REQUIRED)); > > auto entryDisabled = adoptGRef(atspi_accessible_get_child_at_index(section.get(), nextChild++, nullptr)); >@@ -644,12 +592,7 @@ static void testAccessibleState(AccessibilityTest* test, gconstpointer) > g_assert_true(atspi_state_set_contains(stateSet.get(), ATSPI_STATE_SHOWING)); > g_assert_true(atspi_state_set_contains(stateSet.get(), ATSPI_STATE_EDITABLE)); > g_assert_true(atspi_state_set_contains(stateSet.get(), ATSPI_STATE_SINGLE_LINE)); >-#if USE(ATSPI) > g_assert_true(atspi_state_set_contains(stateSet.get(), ATSPI_STATE_SELECTABLE_TEXT)); >-#else >- // FIXME: ATK doesn't implement selectable text, but includes oprientation. >- g_assert_true(atspi_state_set_contains(stateSet.get(), ATSPI_STATE_HORIZONTAL)); >-#endif > > auto entryReadOnly = adoptGRef(atspi_accessible_get_child_at_index(section.get(), nextChild++, nullptr)); > g_assert_true(ATSPI_IS_ACCESSIBLE(entryReadOnly.get())); >@@ -661,12 +604,7 @@ static void testAccessibleState(AccessibilityTest* test, gconstpointer) > g_assert_true(atspi_state_set_contains(stateSet.get(), ATSPI_STATE_SHOWING)); > g_assert_true(atspi_state_set_contains(stateSet.get(), ATSPI_STATE_FOCUSABLE)); > g_assert_true(atspi_state_set_contains(stateSet.get(), ATSPI_STATE_SINGLE_LINE)); >-#if USE(ATSPI) > g_assert_true(atspi_state_set_contains(stateSet.get(), ATSPI_STATE_SELECTABLE_TEXT)); >-#else >- // FIXME: ATK doesn't implement selectable text, but includes oprientation. >- g_assert_true(atspi_state_set_contains(stateSet.get(), ATSPI_STATE_HORIZONTAL)); >-#endif > g_assert_true(atspi_state_set_contains(stateSet.get(), ATSPI_STATE_READ_ONLY)); > > auto textArea = adoptGRef(atspi_accessible_get_child_at_index(section.get(), nextChild++, nullptr)); >@@ -681,12 +619,7 @@ static void testAccessibleState(AccessibilityTest* test, gconstpointer) > g_assert_true(atspi_state_set_contains(stateSet.get(), ATSPI_STATE_FOCUSED)); > g_assert_true(atspi_state_set_contains(stateSet.get(), ATSPI_STATE_EDITABLE)); > g_assert_true(atspi_state_set_contains(stateSet.get(), ATSPI_STATE_MULTI_LINE)); >-#if USE(ATSPI) > g_assert_true(atspi_state_set_contains(stateSet.get(), ATSPI_STATE_SELECTABLE_TEXT)); >-#else >- // FIXME: ATK doesn't implement selectable text, but includes oprientation. >- g_assert_true(atspi_state_set_contains(stateSet.get(), ATSPI_STATE_HORIZONTAL)); >-#endif > > auto ul = adoptGRef(atspi_accessible_get_child_at_index(documentWeb.get(), 2, nullptr)); > g_assert_true(ATSPI_IS_ACCESSIBLE(textArea.get())); >@@ -753,16 +686,6 @@ static void testAccessibleStateChanged(AccessibilityTest* test, gconstpointer) > test->startEventMonitor(entry.get(), { "object:state-changed" }); > test->runJavaScriptAndWaitUntilFinished("let e = document.getElementById('entry'); e.ariaRequired = true; e.focus();", nullptr); > events = test->stopEventMonitor(2); >-#if !USE(ATSPI) >- // FIXME: With ATK focused event is sometimes emitted twice for some reason. >- if (events.size() == 3) { >- events.removeFirstMatching([](auto& item) { >- if (!strcmp(item->type, "object:state-changed:focused")) >- return true; >- return false; >- }); >- } >-#endif > g_assert_cmpuint(events.size(), ==, 2); > if (!g_strcmp0(events[0]->type, "object:state-changed:focused")) { > g_assert_cmpuint(events[0]->detail1, ==, 1); >@@ -778,7 +701,6 @@ static void testAccessibleStateChanged(AccessibilityTest* test, gconstpointer) > g_assert_not_reached(); > events = { }; > >-#if USE(ATSPI) > test->runJavaScriptAndWaitUntilFinished("document.getElementById('list').focus();", nullptr); > auto listBox = adoptGRef(atspi_accessible_get_child_at_index(section.get(), nextChild++, nullptr)); > g_assert_true(ATSPI_IS_ACCESSIBLE(listBox.get())); >@@ -836,7 +758,6 @@ static void testAccessibleStateChanged(AccessibilityTest* test, gconstpointer) > events = { }; > g_assert_true(AccessibilityTest::isSelected(option1.get())); > g_assert_false(AccessibilityTest::isSelected(option2.get())); >-#endif > } > > static void testAccessibleEventListener(AccessibilityTest* test, gconstpointer) >@@ -880,9 +801,6 @@ static void testAccessibleEventListener(AccessibilityTest* test, gconstpointer) > > static void testAccessibleListMarkers(AccessibilityTest* test, gconstpointer) > { >-#if !USE(ATSPI) >- g_test_skip("List markers are handled differently with ATK"); >-#else > GUniquePtr<char> baseDir(g_strdup_printf("file://%s/", Test::getResourcesDir().data())); > test->showInWindow(800, 600); > test->loadHtml( >@@ -948,7 +866,6 @@ static void testAccessibleListMarkers(AccessibilityTest* test, gconstpointer) > g_assert_cmpstr(name.get(), ==, "image"); > GRefPtr<AtspiImage> image = adoptGRef(atspi_accessible_get_image_iface(marker.get())); > g_assert_nonnull(image.get()); >-#endif > } > > static void testComponentHitTest(AccessibilityTest* test, gconstpointer) >@@ -1080,11 +997,6 @@ static void testTextBasic(AccessibilityTest* test, gconstpointer) > > static void testTextSurrogatePair(AccessibilityTest* test, gconstpointer) > { >-#if USE(ATK) >- g_test_skip("Surrogate pairs are not correctly handled by WebKit when using ATK"); >- return; >-#endif >- > test->showInWindow(); > test->loadHtml( > "<html>" >@@ -1166,14 +1078,8 @@ static void testTextIterator(AccessibilityTest* test, gconstpointer) > g_assert_cmpint(range->end_offset, ==, 84); > range.reset(atspi_text_get_string_at_offset(ATSPI_TEXT(p.get()), 85, ATSPI_TEXT_GRANULARITY_CHAR, nullptr)); > g_assert_cmpstr(range->content, ==, ""); >-#if USE(ATSPI) > g_assert_cmpint(range->start_offset, ==, 0); > g_assert_cmpint(range->end_offset, ==, 0); >-#else >- // FIXME: ATK returns wrong offsets in this case. >- g_assert_cmpint(range->start_offset, ==, 84); >- g_assert_cmpint(range->end_offset, ==, 84); >-#endif > range.reset(atspi_text_get_string_at_offset(ATSPI_TEXT(p.get()), -1, ATSPI_TEXT_GRANULARITY_CHAR, nullptr)); > g_assert_cmpstr(range->content, ==, ""); > g_assert_cmpint(range->start_offset, ==, 0); >@@ -1249,7 +1155,6 @@ static void testTextIterator(AccessibilityTest* test, gconstpointer) > g_assert_cmpint(range->start_offset, ==, 53); > g_assert_cmpint(range->end_offset, ==, 84); > >-#if USE(ATSPI) // ATK doesn't implement paragraph granularity. > // Paragraph granularity. > range.reset(atspi_text_get_string_at_offset(ATSPI_TEXT(p.get()), 0, ATSPI_TEXT_GRANULARITY_PARAGRAPH, nullptr)); > g_assert_cmpstr(range->content, ==, "Text of first sentence. This is the second sentence."); >@@ -1259,7 +1164,6 @@ static void testTextIterator(AccessibilityTest* test, gconstpointer) > g_assert_cmpstr(range->content, ==, "And this is the next paragraph."); > g_assert_cmpint(range->start_offset, ==, 53); > g_assert_cmpint(range->end_offset, ==, 84); >-#endif > > // Using a text control now. > test->loadHtml( >@@ -1381,7 +1285,7 @@ static void testTextExtents(AccessibilityTest* test, gconstpointer) > g_assert_cmpuint(rangeRect->y, ==, firstCharRect->y); > g_assert_cmpuint(rangeRect->width, >, 0); > g_assert_cmpuint(rangeRect->height, >, 0); >-#if USE(ATSPI) // Offset at point is broken with ATK. >+ > auto offset = atspi_text_get_offset_at_point(ATSPI_TEXT(p.get()), firstCharRect->x, firstCharRect->y, ATSPI_COORD_TYPE_WINDOW, nullptr); > g_assert_cmpint(offset, ==, 0); > offset = atspi_text_get_offset_at_point(ATSPI_TEXT(p.get()), firstCharRect->x + firstCharRect->width, firstCharRect->y, ATSPI_COORD_TYPE_WINDOW, nullptr); >@@ -1390,7 +1294,6 @@ static void testTextExtents(AccessibilityTest* test, gconstpointer) > g_assert_cmpint(offset, ==, 3); > offset = atspi_text_get_offset_at_point(ATSPI_TEXT(p.get()), lastCharRect->x + lastCharRect->width, lastCharRect->y, ATSPI_COORD_TYPE_WINDOW, nullptr); > g_assert_cmpint(offset, ==, 4); >-#endif > } > > static void testTextSelections(AccessibilityTest* test, gconstpointer) >@@ -1420,11 +1323,7 @@ static void testTextSelections(AccessibilityTest* test, gconstpointer) > auto selectionCount = atspi_text_get_n_selections(ATSPI_TEXT(p.get()), nullptr); > g_assert_cmpuint(selectionCount, ==, 0); > auto caretOffset = atspi_text_get_caret_offset(ATSPI_TEXT(p.get()), nullptr); >-#if USE(ATSPI) > g_assert_cmpint(caretOffset, ==, -1); >-#else >- g_assert_cmpint(caretOffset, ==, 0); >-#endif > > GUniquePtr<AtspiRange> selection(atspi_text_get_selection(ATSPI_TEXT(p.get()), 0, nullptr)); > g_assert_nonnull(selection.get()); >@@ -1563,7 +1462,6 @@ static void testTextAttributes(AccessibilityTest* test, gconstpointer) > g_assert_cmpuint(g_hash_table_size(attributes.get()), >, 1); > g_assert_cmpstr(static_cast<const char*>(g_hash_table_lookup(attributes.get(), "weight")), ==, "400"); > >-#if USE(ATSPI) > // Atspi implementation handles ranges with the same attributes as one run. > test->loadHtml( > "<html>" >@@ -1601,8 +1499,6 @@ static void testTextAttributes(AccessibilityTest* test, gconstpointer) > g_assert_cmpstr(static_cast<const char*>(g_hash_table_lookup(attributes.get(), "weight")), ==, "400"); > g_assert_cmpint(startOffset, ==, 14); > g_assert_cmpint(endOffset, ==, 22); >- >-#endif > } > > static void testTextStateChanged(AccessibilityTest* test, gconstpointer) >@@ -1670,7 +1566,6 @@ static void testTextStateChanged(AccessibilityTest* test, gconstpointer) > g_assert_cmpstr(events[0]->type, ==, "object:text-caret-moved"); > g_assert_cmpuint(events[0]->detail1, ==, 2); > >-#if USE(ATSPI) // Selection changed seems to be broken with ATK. > // Selection changed. > test->startEventMonitor(p.get(), { "object:text-selection-changed", "object:text-caret-moved" }); > g_assert_true(atspi_text_set_selection(ATSPI_TEXT(p.get()), 0, 10, 15, nullptr)); >@@ -1707,7 +1602,6 @@ static void testTextStateChanged(AccessibilityTest* test, gconstpointer) > g_assert_nonnull(event); > g_assert_cmpuint(event->detail1, ==, 3); > g_assert_nonnull(AccessibilityTest::findEvent(events, "object:text-selection-changed")); >-#endif > > // Text changed. > g_assert_true(atspi_text_set_caret_offset(ATSPI_TEXT(input.get()), 5, nullptr)); >@@ -1716,9 +1610,7 @@ static void testTextStateChanged(AccessibilityTest* test, gconstpointer) > events = test->stopEventMonitor(1); > g_assert_cmpuint(events.size(), ==, 1); > g_assert_cmpstr(events[0]->type, ==, "object:text-changed:insert"); >-#if USE(ATSPI) > g_assert_cmpuint(events[0]->detail1, ==, 5); >-#endif > g_assert_cmpuint(events[0]->detail2, ==, 1); > g_assert_true(G_VALUE_HOLDS_STRING(&events[0]->any_data)); > g_assert_cmpstr(g_value_get_string(&events[0]->any_data), ==, "a"); >@@ -1739,9 +1631,7 @@ static void testTextStateChanged(AccessibilityTest* test, gconstpointer) > events = test->stopEventMonitor(1); > g_assert_cmpuint(events.size(), ==, 1); > g_assert_cmpstr(events[0]->type, ==, "object:text-changed:insert"); >-#if USE(ATSPI) > g_assert_cmpuint(events[0]->detail1, ==, 10); >-#endif > g_assert_cmpuint(events[0]->detail2, ==, 1); > g_assert_true(G_VALUE_HOLDS_STRING(&events[0]->any_data)); > g_assert_cmpstr(g_value_get_string(&events[0]->any_data), ==, "b"); >@@ -1751,9 +1641,7 @@ static void testTextStateChanged(AccessibilityTest* test, gconstpointer) > events = test->stopEventMonitor(1); > g_assert_cmpuint(events.size(), ==, 1); > g_assert_cmpstr(events[0]->type, ==, "object:text-changed:delete"); >-#if USE(ATSPI) > g_assert_cmpuint(events[0]->detail1, ==, 14); >-#endif > g_assert_cmpuint(events[0]->detail2, ==, 1); > g_assert_true(G_VALUE_HOLDS_STRING(&events[0]->any_data)); > g_assert_cmpstr(g_value_get_string(&events[0]->any_data), ==, "n"); >@@ -1763,9 +1651,7 @@ static void testTextStateChanged(AccessibilityTest* test, gconstpointer) > test->keyStroke(GDK_KEY_a); > events = test->stopEventMonitor(1); > g_assert_cmpstr(events[0]->type, ==, "object:text-changed:insert"); >-#if USE(ATSPI) > g_assert_cmpuint(events[0]->detail1, ==, 2); >-#endif > g_assert_cmpuint(events[0]->detail2, ==, 1); > g_assert_true(G_VALUE_HOLDS_STRING(&events[0]->any_data)); > g_assert_cmpstr(g_value_get_string(&events[0]->any_data), ==, "â¢"); >@@ -1774,9 +1660,7 @@ static void testTextStateChanged(AccessibilityTest* test, gconstpointer) > events = test->stopEventMonitor(1); > g_assert_cmpuint(events.size(), ==, 1); > g_assert_cmpstr(events[0]->type, ==, "object:text-changed:delete"); >-#if USE(ATSPI) > g_assert_cmpuint(events[0]->detail1, ==, 2); >-#endif > g_assert_cmpuint(events[0]->detail2, ==, 1); > g_assert_true(G_VALUE_HOLDS_STRING(&events[0]->any_data)); > g_assert_cmpstr(g_value_get_string(&events[0]->any_data), ==, "â¢"); >@@ -1793,9 +1677,7 @@ static void testTextStateChanged(AccessibilityTest* test, gconstpointer) > g_assert_true(G_VALUE_HOLDS_STRING(&events[0]->any_data)); > g_assert_cmpstr(g_value_get_string(&events[0]->any_data), ==, "is a "); > g_assert_cmpstr(events[1]->type, ==, "object:text-changed:insert"); >-#if USE(ATSPI) > g_assert_cmpuint(events[1]->detail1, ==, 5); >-#endif > g_assert_cmpuint(events[1]->detail2, ==, 1); > g_assert_true(G_VALUE_HOLDS_STRING(&events[1]->any_data)); > g_assert_cmpstr(g_value_get_string(&events[1]->any_data), ==, "c"); >@@ -1806,9 +1688,7 @@ static void testTextStateChanged(AccessibilityTest* test, gconstpointer) > events = test->stopEventMonitor(1); > g_assert_cmpuint(events.size(), ==, 1); > g_assert_cmpstr(events[0]->type, ==, "object:text-changed:delete"); >-#if USE(ATSPI) > g_assert_cmpuint(events[0]->detail1, ==, 10); >-#endif > g_assert_cmpuint(events[0]->detail2, ==, 8); > g_assert_true(G_VALUE_HOLDS_STRING(&events[0]->any_data)); > g_assert_cmpstr(g_value_get_string(&events[0]->any_data), ==, "bntet ed"); >@@ -1824,14 +1704,11 @@ static void testTextStateChanged(AccessibilityTest* test, gconstpointer) > g_assert_true(G_VALUE_HOLDS_STRING(&events[0]->any_data)); > g_assert_cmpstr(g_value_get_string(&events[0]->any_data), ==, "â¢â¢â¢"); > g_assert_cmpstr(events[1]->type, ==, "object:text-changed:insert"); >-#if USE(ATSPI) > g_assert_cmpuint(events[1]->detail1, ==, 0); >-#endif > g_assert_cmpuint(events[1]->detail2, ==, 1); > g_assert_true(G_VALUE_HOLDS_STRING(&events[1]->any_data)); > g_assert_cmpstr(g_value_get_string(&events[1]->any_data), ==, "â¢"); > >-#if USE(ATSPI) > // Text input value changed. > test->startEventMonitor(input.get(), { "object:text-changed:insert", "object:text-changed:delete" }); > test->runJavaScriptAndWaitUntilFinished("document.getElementsByTagName('input')[0].value = 'foo';", nullptr); >@@ -1862,14 +1739,10 @@ static void testTextStateChanged(AccessibilityTest* test, gconstpointer) > g_assert_cmpuint(events[1]->detail2, ==, 4); > g_assert_true(G_VALUE_HOLDS_STRING(&events[1]->any_data)); > g_assert_cmpstr(g_value_get_string(&events[1]->any_data), ==, "â¢â¢â¢â¢"); >-#endif > } > > static void testTextReplacedObjects(AccessibilityTest* test, gconstpointer) > { >-#if !USE(ATSPI) >- g_test_skip("Embedded objects are not correctly handled with ATK"); >-#else > test->showInWindow(800, 600); > test->loadHtml( > "<html>" >@@ -1972,14 +1845,10 @@ static void testTextReplacedObjects(AccessibilityTest* test, gconstpointer) > g_assert_true(ATSPI_IS_TEXT(link2.get())); > text.reset(atspi_text_get_text(ATSPI_TEXT(link2.get()), 0, -1, nullptr)); > g_assert_cmpstr(text.get(), ==, "link2"); >-#endif > } > > static void testTextListMarkers(AccessibilityTest* test, gconstpointer) > { >-#if !USE(ATSPI) >- g_test_skip("List markers are handled differently with ATK"); >-#else > test->showInWindow(800, 600); > test->loadHtml( > "<html>" >@@ -2086,7 +1955,6 @@ static void testTextListMarkers(AccessibilityTest* test, gconstpointer) > g_assert_true(ATSPI_IS_TEXT(marker.get())); > text.reset(atspi_text_get_text(ATSPI_TEXT(marker.get()), 0, -1, nullptr)); > g_assert_cmpstr(text.get(), ==, "1. "); >-#endif > } > > static void testValueBasic(AccessibilityTest* test, gconstpointer) >@@ -2176,11 +2044,7 @@ static void testHyperlinkBasic(AccessibilityTest* test, gconstpointer) > g_assert_cmpint(atspi_hyperlink_get_n_anchors(ATSPI_HYPERLINK(link.get()), nullptr), ==, 1); > g_assert_true(atspi_hyperlink_is_valid(ATSPI_HYPERLINK(link.get()), nullptr)); > g_assert_cmpint(atspi_hyperlink_get_start_index(ATSPI_HYPERLINK(link.get()), nullptr), ==, 0); >-#if USE(ATSPI) > g_assert_cmpint(atspi_hyperlink_get_end_index(ATSPI_HYPERLINK(link.get()), nullptr), ==, 1); >-#else >- g_assert_cmpint(atspi_hyperlink_get_end_index(ATSPI_HYPERLINK(link.get()), nullptr), ==, 0); >-#endif > GUniquePtr<char> uri(atspi_hyperlink_get_uri(ATSPI_HYPERLINK(link.get()), 0, nullptr)); > g_assert_cmpstr(uri.get(), ==, "https://www.webkitgtk.org/"); > g_assert_true(atspi_hyperlink_get_object(ATSPI_HYPERLINK(link.get()), 0, nullptr) == a.get()); >@@ -2192,13 +2056,8 @@ static void testHyperlinkBasic(AccessibilityTest* test, gconstpointer) > g_assert_true(ATSPI_IS_HYPERLINK(link.get())); > g_assert_cmpint(atspi_hyperlink_get_n_anchors(ATSPI_HYPERLINK(link.get()), nullptr), ==, 1); > g_assert_true(atspi_hyperlink_is_valid(ATSPI_HYPERLINK(link.get()), nullptr)); >-#if USE(ATSPI) > g_assert_cmpint(atspi_hyperlink_get_start_index(ATSPI_HYPERLINK(link.get()), nullptr), ==, 0); > g_assert_cmpint(atspi_hyperlink_get_end_index(ATSPI_HYPERLINK(link.get()), nullptr), ==, 1); >-#else >- g_assert_cmpint(atspi_hyperlink_get_start_index(ATSPI_HYPERLINK(link.get()), nullptr), ==, 10); >- g_assert_cmpint(atspi_hyperlink_get_end_index(ATSPI_HYPERLINK(link.get()), nullptr), ==, 14); >-#endif > uri.reset(atspi_hyperlink_get_uri(ATSPI_HYPERLINK(link.get()), 0, nullptr)); > g_assert_cmpstr(uri.get(), ==, ""); > g_assert_true(atspi_hyperlink_get_object(ATSPI_HYPERLINK(link.get()), 0, nullptr) == div.get()); >@@ -2213,11 +2072,7 @@ static void testHyperlinkBasic(AccessibilityTest* test, gconstpointer) > g_assert_cmpint(atspi_hyperlink_get_n_anchors(ATSPI_HYPERLINK(link.get()), nullptr), ==, 1); > g_assert_true(atspi_hyperlink_is_valid(ATSPI_HYPERLINK(link.get()), nullptr)); > g_assert_cmpint(atspi_hyperlink_get_start_index(ATSPI_HYPERLINK(link.get()), nullptr), ==, 8); >-#if USE(ATSPI) > g_assert_cmpint(atspi_hyperlink_get_end_index(ATSPI_HYPERLINK(link.get()), nullptr), ==, 9); >-#else >- g_assert_cmpint(atspi_hyperlink_get_end_index(ATSPI_HYPERLINK(link.get()), nullptr), ==, 16); >-#endif > uri.reset(atspi_hyperlink_get_uri(ATSPI_HYPERLINK(link.get()), 0, nullptr)); > g_assert_cmpstr(uri.get(), ==, ""); > g_assert_true(atspi_hyperlink_get_object(ATSPI_HYPERLINK(link.get()), 0, nullptr) == button1.get()); >@@ -2227,13 +2082,8 @@ static void testHyperlinkBasic(AccessibilityTest* test, gconstpointer) > g_assert_true(ATSPI_IS_HYPERLINK(link.get())); > g_assert_cmpint(atspi_hyperlink_get_n_anchors(ATSPI_HYPERLINK(link.get()), nullptr), ==, 1); > g_assert_true(atspi_hyperlink_is_valid(ATSPI_HYPERLINK(link.get()), nullptr)); >-#if USE(ATSPI) > g_assert_cmpint(atspi_hyperlink_get_start_index(ATSPI_HYPERLINK(link.get()), nullptr), ==, 14); > g_assert_cmpint(atspi_hyperlink_get_end_index(ATSPI_HYPERLINK(link.get()), nullptr), ==, 15); >-#else >- g_assert_cmpint(atspi_hyperlink_get_start_index(ATSPI_HYPERLINK(link.get()), nullptr), ==, 21); >- g_assert_cmpint(atspi_hyperlink_get_end_index(ATSPI_HYPERLINK(link.get()), nullptr), ==, 29); >-#endif > uri.reset(atspi_hyperlink_get_uri(ATSPI_HYPERLINK(link.get()), 0, nullptr)); > g_assert_cmpstr(uri.get(), ==, ""); > g_assert_true(atspi_hyperlink_get_object(ATSPI_HYPERLINK(link.get()), 0, nullptr) == button2.get()); >@@ -2248,11 +2098,7 @@ static void testHyperlinkBasic(AccessibilityTest* test, gconstpointer) > g_assert_cmpint(atspi_hyperlink_get_n_anchors(ATSPI_HYPERLINK(link.get()), nullptr), ==, 1); > g_assert_true(atspi_hyperlink_is_valid(ATSPI_HYPERLINK(link.get()), nullptr)); > g_assert_cmpint(atspi_hyperlink_get_start_index(ATSPI_HYPERLINK(link.get()), nullptr), ==, 8); >-#if USE(ATSPI) > g_assert_cmpint(atspi_hyperlink_get_end_index(ATSPI_HYPERLINK(link.get()), nullptr), ==, 9); >-#else >- g_assert_cmpint(atspi_hyperlink_get_end_index(ATSPI_HYPERLINK(link.get()), nullptr), ==, 13); >-#endif > uri.reset(atspi_hyperlink_get_uri(ATSPI_HYPERLINK(link.get()), 0, nullptr)); > g_assert_cmpstr(uri.get(), ==, "https://www.webkitgtk.org/"); > g_assert_true(atspi_hyperlink_get_object(ATSPI_HYPERLINK(link.get()), 0, nullptr) == link1.get()); >@@ -2262,18 +2108,12 @@ static void testHyperlinkBasic(AccessibilityTest* test, gconstpointer) > g_assert_true(ATSPI_IS_HYPERLINK(link.get())); > g_assert_cmpint(atspi_hyperlink_get_n_anchors(ATSPI_HYPERLINK(link.get()), nullptr), ==, 1); > g_assert_true(atspi_hyperlink_is_valid(ATSPI_HYPERLINK(link.get()), nullptr)); >-#if USE(ATSPI) > g_assert_cmpint(atspi_hyperlink_get_start_index(ATSPI_HYPERLINK(link.get()), nullptr), ==, 14); > g_assert_cmpint(atspi_hyperlink_get_end_index(ATSPI_HYPERLINK(link.get()), nullptr), ==, 15); >-#else >- g_assert_cmpint(atspi_hyperlink_get_start_index(ATSPI_HYPERLINK(link.get()), nullptr), ==, 18); >- g_assert_cmpint(atspi_hyperlink_get_end_index(ATSPI_HYPERLINK(link.get()), nullptr), ==, 23); >-#endif > uri.reset(atspi_hyperlink_get_uri(ATSPI_HYPERLINK(link.get()), 0, nullptr)); > g_assert_cmpstr(uri.get(), ==, "https://www.gnome.org/"); > g_assert_true(atspi_hyperlink_get_object(ATSPI_HYPERLINK(link.get()), 0, nullptr) == link2.get()); > >-#if USE(ATSPI) > auto ul = adoptGRef(atspi_accessible_get_child_at_index(documentWeb.get(), 4, nullptr)); > g_assert_true(ATSPI_IS_ACCESSIBLE(ul.get())); > g_assert_cmpint(atspi_accessible_get_child_count(ul.get(), nullptr), ==, 1); >@@ -2291,7 +2131,6 @@ static void testHyperlinkBasic(AccessibilityTest* test, gconstpointer) > uri.reset(atspi_hyperlink_get_uri(ATSPI_HYPERLINK(link.get()), 0, nullptr)); > g_assert_cmpstr(uri.get(), ==, ""); > g_assert_true(atspi_hyperlink_get_object(ATSPI_HYPERLINK(link.get()), 0, nullptr) == marker.get()); >-#endif > } > > static void testHypertextBasic(AccessibilityTest* test, gconstpointer) >@@ -2323,11 +2162,7 @@ static void testHypertextBasic(AccessibilityTest* test, gconstpointer) > g_assert_cmpint(atspi_hyperlink_get_n_anchors(ATSPI_HYPERLINK(link.get()), nullptr), ==, 1); > g_assert_true(atspi_hyperlink_is_valid(ATSPI_HYPERLINK(link.get()), nullptr)); > g_assert_cmpint(atspi_hyperlink_get_start_index(ATSPI_HYPERLINK(link.get()), nullptr), ==, 8); >-#if USE(ATSPI) > g_assert_cmpint(atspi_hyperlink_get_end_index(ATSPI_HYPERLINK(link.get()), nullptr), ==, 9); >-#else >- g_assert_cmpint(atspi_hyperlink_get_end_index(ATSPI_HYPERLINK(link.get()), nullptr), ==, 15); >-#endif > GUniquePtr<char> uri(atspi_hyperlink_get_uri(ATSPI_HYPERLINK(link.get()), 0, nullptr)); > g_assert_cmpstr(uri.get(), ==, ""); > auto button = adoptGRef(atspi_accessible_get_child_at_index(p.get(), 0, nullptr)); >@@ -2337,13 +2172,8 @@ static void testHypertextBasic(AccessibilityTest* test, gconstpointer) > g_assert_true(ATSPI_IS_HYPERLINK(link.get())); > g_assert_cmpint(atspi_hyperlink_get_n_anchors(ATSPI_HYPERLINK(link.get()), nullptr), ==, 1); > g_assert_true(atspi_hyperlink_is_valid(ATSPI_HYPERLINK(link.get()), nullptr)); >-#if USE(ATSPI) > g_assert_cmpint(atspi_hyperlink_get_start_index(ATSPI_HYPERLINK(link.get()), nullptr), ==, 14); > g_assert_cmpint(atspi_hyperlink_get_end_index(ATSPI_HYPERLINK(link.get()), nullptr), ==, 15); >-#else >- g_assert_cmpint(atspi_hyperlink_get_start_index(ATSPI_HYPERLINK(link.get()), nullptr), ==, 20); >- g_assert_cmpint(atspi_hyperlink_get_end_index(ATSPI_HYPERLINK(link.get()), nullptr), ==, 24); >-#endif > uri.reset(atspi_hyperlink_get_uri(ATSPI_HYPERLINK(link.get()), 0, nullptr)); > g_assert_cmpstr(uri.get(), ==, "https://www.webkitgtk.org/"); > auto a = adoptGRef(atspi_accessible_get_child_at_index(p.get(), 1, nullptr)); >@@ -2351,17 +2181,10 @@ static void testHypertextBasic(AccessibilityTest* test, gconstpointer) > > g_assert_cmpint(atspi_hypertext_get_link_index(ATSPI_HYPERTEXT(p.get()), 0, nullptr), ==, -1); > g_assert_cmpint(atspi_hypertext_get_link_index(ATSPI_HYPERTEXT(p.get()), 8, nullptr), ==, 0); >-#if USE(ATSPI) > g_assert_cmpint(atspi_hypertext_get_link_index(ATSPI_HYPERTEXT(p.get()), 9, nullptr), ==, -1); > g_assert_cmpint(atspi_hypertext_get_link_index(ATSPI_HYPERTEXT(p.get()), 14, nullptr), ==, 1); > g_assert_cmpint(atspi_hypertext_get_link_index(ATSPI_HYPERTEXT(p.get()), 15, nullptr), ==, -1); >-#else >- g_assert_cmpint(atspi_hypertext_get_link_index(ATSPI_HYPERTEXT(p.get()), 15, nullptr), ==, -1); >- g_assert_cmpint(atspi_hypertext_get_link_index(ATSPI_HYPERTEXT(p.get()), 20, nullptr), ==, 1); >- g_assert_cmpint(atspi_hypertext_get_link_index(ATSPI_HYPERTEXT(p.get()), 24, nullptr), ==, -1); >-#endif > >-#if USE(ATSPI) > auto ol = adoptGRef(atspi_accessible_get_child_at_index(documentWeb.get(), 1, nullptr)); > g_assert_true(ATSPI_IS_ACCESSIBLE(ol.get())); > g_assert_cmpint(atspi_accessible_get_child_count(ol.get(), nullptr), ==, 1); >@@ -2393,7 +2216,6 @@ static void testHypertextBasic(AccessibilityTest* test, gconstpointer) > g_assert_cmpint(atspi_hypertext_get_link_index(ATSPI_HYPERTEXT(li.get()), 1, nullptr), ==, -1); > g_assert_cmpint(atspi_hypertext_get_link_index(ATSPI_HYPERTEXT(li.get()), 13, nullptr), ==, 1); > g_assert_cmpint(atspi_hypertext_get_link_index(ATSPI_HYPERTEXT(li.get()), 14, nullptr), ==, -1); >-#endif > } > > static void testActionBasic(AccessibilityTest* test, gconstpointer) >@@ -2431,10 +2253,8 @@ static void testActionBasic(AccessibilityTest* test, gconstpointer) > g_assert_cmpint(atspi_action_get_n_actions(ATSPI_ACTION(button.get()), nullptr), ==, 1); > name.reset(atspi_action_get_action_name(ATSPI_ACTION(button.get()), 0, nullptr)); > g_assert_cmpstr(name.get(), ==, "press"); >-#if USE(ATSPI) > localizedName.reset(atspi_action_get_localized_name(ATSPI_ACTION(button.get()), 0, nullptr)); > g_assert_cmpstr(localizedName.get(), ==, "press"); >-#endif > keyBinding.reset(atspi_action_get_key_binding(ATSPI_ACTION(button.get()), 0, nullptr)); > g_assert_cmpstr(keyBinding.get(), ==, "p"); > >@@ -2443,10 +2263,8 @@ static void testActionBasic(AccessibilityTest* test, gconstpointer) > g_assert_cmpint(atspi_action_get_n_actions(ATSPI_ACTION(a.get()), nullptr), ==, 1); > name.reset(atspi_action_get_action_name(ATSPI_ACTION(a.get()), 0, nullptr)); > g_assert_cmpstr(name.get(), ==, "jump"); >-#if USE(ATSPI) > localizedName.reset(atspi_action_get_localized_name(ATSPI_ACTION(a.get()), 0, nullptr)); > g_assert_cmpstr(localizedName.get(), ==, "jump"); >-#endif > keyBinding.reset(atspi_action_get_key_binding(ATSPI_ACTION(a.get()), 0, nullptr)); > g_assert_cmpstr(keyBinding.get(), ==, ""); > } >@@ -2489,11 +2307,7 @@ static void testDocumentBasic(AccessibilityTest* test, gconstpointer) > > GRefPtr<GHashTable> attributes = adoptGRef(atspi_document_get_attributes(ATSPI_DOCUMENT(documentWeb.get()), nullptr)); > g_assert_nonnull(attributes.get()); >-#if USE(ATSPI) > g_assert_cmpuint(g_hash_table_size(attributes.get()), ==, 5); >-#else >- g_assert_cmpuint(g_hash_table_size(attributes.get()), ==, 3); >-#endif > g_assert_cmpstr(static_cast<const char*>(g_hash_table_lookup(attributes.get(), "DocType")), ==, "html"); > GUniquePtr<char> value(atspi_document_get_document_attribute_value(ATSPI_DOCUMENT(documentWeb.get()), const_cast<char*>("DocType"), nullptr)); > g_assert_cmpstr(value.get(), ==, "html"); >@@ -2503,14 +2317,12 @@ static void testDocumentBasic(AccessibilityTest* test, gconstpointer) > g_assert_cmpstr(static_cast<const char*>(g_hash_table_lookup(attributes.get(), "URI")), ==, "http://example.org/"); > value.reset(atspi_document_get_document_attribute_value(ATSPI_DOCUMENT(documentWeb.get()), const_cast<char*>("URI"), nullptr)); > g_assert_cmpstr(value.get(), ==, "http://example.org/"); >-#if USE(ATSPI) > g_assert_cmpstr(static_cast<const char*>(g_hash_table_lookup(attributes.get(), "MimeType")), ==, "text/html"); > value.reset(atspi_document_get_document_attribute_value(ATSPI_DOCUMENT(documentWeb.get()), const_cast<char*>("MimeType"), nullptr)); > g_assert_cmpstr(value.get(), ==, "text/html"); > g_assert_cmpstr(static_cast<const char*>(g_hash_table_lookup(attributes.get(), "Title")), ==, "Document attributes"); > value.reset(atspi_document_get_document_attribute_value(ATSPI_DOCUMENT(documentWeb.get()), const_cast<char*>("Title"), nullptr)); > g_assert_cmpstr(value.get(), ==, "Document attributes"); >-#endif > } > > static void testDocumentLoadEvents(AccessibilityTest* test, gconstpointer) >@@ -2599,10 +2411,8 @@ static void testImageBasic(AccessibilityTest* test, gconstpointer) > > GUniquePtr<char> description(atspi_image_get_image_description(ATSPI_IMAGE(img.get()), nullptr)); > g_assert_cmpstr(description.get(), ==, "This is a blank icon"); >-#if USE(ATSPI) > GUniquePtr<char> locale(atspi_image_get_image_locale(ATSPI_IMAGE(img.get()), nullptr)); > g_assert_cmpstr(locale.get(), ==, "en"); >-#endif > } > > static void testSelectionListBox(AccessibilityTest* test, gconstpointer) >@@ -2747,9 +2557,6 @@ static void testSelectionListBox(AccessibilityTest* test, gconstpointer) > > static void testSelectionMenuList(AccessibilityTest* test, gconstpointer) > { >-#if !USE(ATSPI) >- g_test_skip("MenuList work differently with ATK"); >-#else > test->showInWindow(800, 600); > test->loadHtml( > "<html>" >@@ -2820,14 +2627,10 @@ static void testSelectionMenuList(AccessibilityTest* test, gconstpointer) > g_assert_false(atspi_selection_deselect_child(ATSPI_SELECTION(menuList.get()), 0, nullptr)); > g_assert_false(atspi_selection_select_all(ATSPI_SELECTION(menuList.get()), nullptr)); > g_assert_false(atspi_selection_clear_selection(ATSPI_SELECTION(menuList.get()), nullptr)); >-#endif > } > > static void testTableBasic(AccessibilityTest* test, gconstpointer) > { >-#if !USE(ATSPI) >- g_test_skip("Tables work differently with ATK"); >-#else > test->showInWindow(800, 600); > test->loadHtml( > "<html>" >@@ -3238,7 +3041,6 @@ static void testTableBasic(AccessibilityTest* test, gconstpointer) > g_assert_cmpint(atspi_table_get_column_extent_at(ATSPI_TABLE(table.get()), 3, 2, nullptr), ==, 3); > cell = adoptGRef(atspi_table_get_accessible_at(ATSPI_TABLE(table.get()), 3, 2, nullptr)); > g_assert_true(cell8.get() == cell.get()); >-#endif > } > > void beforeAll() >diff --git a/Tools/TestWebKitAPI/glib/PlatformGTK.cmake b/Tools/TestWebKitAPI/glib/PlatformGTK.cmake >index c5a3991741d0..91742c075f77 100644 >--- a/Tools/TestWebKitAPI/glib/PlatformGTK.cmake >+++ b/Tools/TestWebKitAPI/glib/PlatformGTK.cmake >@@ -47,6 +47,6 @@ ADD_WK2_TEST(TestWebKitFaviconDatabase ${TOOLS_DIR}/TestWebKitAPI/Tests/WebKitGL > ADD_WK2_TEST(TestWebKitVersion ${TOOLS_DIR}/TestWebKitAPI/Tests/WebKitGtk/TestWebKitVersion.cpp) > ADD_WK2_TEST(TestWebViewEditor ${TOOLS_DIR}/TestWebKitAPI/Tests/WebKitGtk/TestWebViewEditor.cpp) > >-if (ATSPI_FOUND) >+if (ENABLE_ACCESSIBILITY AND ATSPI_FOUND) > ADD_WK2_TEST(TestWebKitAccessibility ${TOOLS_DIR}/TestWebKitAPI/Tests/WebKitGtk/TestWebKitAccessibility.cpp) > endif () >diff --git a/Tools/WebKitTestRunner/InjectedBundle/AccessibilityController.h b/Tools/WebKitTestRunner/InjectedBundle/AccessibilityController.h >index 637a116a9e40..caab5d59b835 100644 >--- a/Tools/WebKitTestRunner/InjectedBundle/AccessibilityController.h >+++ b/Tools/WebKitTestRunner/InjectedBundle/AccessibilityController.h >@@ -37,10 +37,6 @@ > #include <wtf/RunLoop.h> > #include <wtf/Threading.h> > >-#if USE(ATK) >-#include "AccessibilityNotificationHandlerAtk.h" >-#endif >- > namespace WTR { > > class AccessibilityUIElement; >@@ -100,8 +96,6 @@ private: > > #if PLATFORM(COCOA) > RetainPtr<id> m_globalNotificationHandler; >-#elif USE(ATK) >- RefPtr<AccessibilityNotificationHandler> m_globalNotificationHandler; > #elif USE(ATSPI) > std::unique_ptr<AccessibilityNotificationHandler> m_globalNotificationHandler; > #endif >diff --git a/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h b/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h >index 6eba7116788e..4954d1b21f15 100644 >--- a/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h >+++ b/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h >@@ -43,11 +43,6 @@ OBJC_CLASS NSArray; > OBJC_CLASS NSString; > #include <wtf/RetainPtr.h> > using PlatformUIElement = id; >-#elif ENABLE(ACCESSIBILITY) && USE(ATK) >-#include "AccessibilityNotificationHandlerAtk.h" >-#include <atk/atk.h> >-#include <wtf/glib/GRefPtr.h> >-typedef GRefPtr<AtkObject> PlatformUIElement; > #elif USE(ATSPI) > namespace WebCore { > class AccessibilityObjectAtspi; >@@ -247,7 +242,7 @@ public: > RefPtr<AccessibilityUIElement> ariaOwnsElementAtIndex(unsigned); > RefPtr<AccessibilityUIElement> ariaFlowToElementAtIndex(unsigned); > RefPtr<AccessibilityUIElement> ariaControlsElementAtIndex(unsigned); >-#if PLATFORM(COCOA) || USE(ATK) || USE(ATSPI) >+#if PLATFORM(COCOA) || USE(ATSPI) > RefPtr<AccessibilityUIElement> ariaDetailsElementAtIndex(unsigned); > RefPtr<AccessibilityUIElement> ariaErrorMessageElementAtIndex(unsigned); > #else >@@ -255,7 +250,7 @@ public: > RefPtr<AccessibilityUIElement> ariaErrorMessageElementAtIndex(unsigned) { return nullptr; } > #endif > >-#if USE(ATK) || USE(ATSPI) >+#if USE(ATSPI) > RefPtr<AccessibilityUIElement> ariaLabelledByElementAtIndex(unsigned); > RefPtr<AccessibilityUIElement> ariaDescribedByElementAtIndex(unsigned); > RefPtr<AccessibilityUIElement> ariaOwnsReferencingElementAtIndex(unsigned); >@@ -435,9 +430,7 @@ private: > void getChildren(Vector<RefPtr<AccessibilityUIElement> >&); > void getChildrenWithRange(Vector<RefPtr<AccessibilityUIElement> >&, unsigned location, unsigned length); > >-#if USE(ATK) >- RefPtr<AccessibilityNotificationHandler> m_notificationHandler; >-#elif USE(ATSPI) >+#if USE(ATSPI) > static RefPtr<AccessibilityController> s_controller; > RefPtr<WebCore::AccessibilityObjectAtspi> m_element; > std::unique_ptr<AccessibilityNotificationHandler> m_notificationHandler; >diff --git a/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityControllerAtk.cpp b/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityControllerAtk.cpp >deleted file mode 100644 >index 3f8b9889696f..000000000000 >--- a/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityControllerAtk.cpp >+++ /dev/null >@@ -1,150 +0,0 @@ >-/* >- * Copyright (C) 2012 Igalia S.L. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions are >- * met: >- * >- * * Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * * Redistributions in binary form must reproduce the above >- * copyright notice, this list of conditions and the following disclaimer >- * in the documentation and/or other materials provided with the >- * distribution. >- * >- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS >- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT >- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR >- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT >- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, >- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT >- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, >- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY >- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >- */ >- >-#include "config.h" >-#include "AccessibilityController.h" >- >-#if ENABLE(ACCESSIBILITY) && USE(ATK) >- >-#include "AccessibilityUIElement.h" >-#include "InjectedBundle.h" >-#include "InjectedBundlePage.h" >- >-#include <WebKit/WKBundlePagePrivate.h> >-#include <atk/atk.h> >-#include <cstdio> >-#include <wtf/glib/GUniquePtr.h> >-#include <wtf/text/StringBuilder.h> >- >-namespace WTR { >- >-void AccessibilityController::resetToConsistentState() >-{ >- m_globalNotificationHandler = nullptr; >-} >- >-static AtkObject* childElementById(AtkObject* parent, const char* id) >-{ >- if (!ATK_IS_OBJECT(parent)) >- return nullptr; >- >- bool parentFound = false; >- AtkAttributeSet* attributeSet = atk_object_get_attributes(parent); >- for (AtkAttributeSet* attributes = attributeSet; attributes; attributes = attributes->next) { >- AtkAttribute* attribute = static_cast<AtkAttribute*>(attributes->data); >- if (!strcmp(attribute->name, "html-id")) { >- if (!strcmp(attribute->value, id)) >- parentFound = true; >- break; >- } >- } >- atk_attribute_set_free(attributeSet); >- >- if (parentFound) >- return parent; >- >- int childCount = atk_object_get_n_accessible_children(parent); >- for (int i = 0; i < childCount; i++) { >- AtkObject* result = childElementById(atk_object_ref_accessible_child(parent, i), id); >- if (ATK_IS_OBJECT(result)) >- return result; >- } >- >- return nullptr; >-} >- >-RefPtr<AccessibilityUIElement> AccessibilityController::accessibleElementById(JSStringRef id) >-{ >- AtkObject* root = ATK_OBJECT(WKAccessibilityRootObject(InjectedBundle::singleton().page()->page())); >- if (!root) >- return nullptr; >- >- size_t bufferSize = JSStringGetMaximumUTF8CStringSize(id); >- GUniquePtr<gchar> idBuffer(static_cast<gchar*>(g_malloc(bufferSize))); >- JSStringGetUTF8CString(id, idBuffer.get(), bufferSize); >- >- AtkObject* result = childElementById(root, idBuffer.get()); >- if (ATK_IS_OBJECT(result)) >- return AccessibilityUIElement::create(result); >- >- return nullptr; >-} >- >-JSRetainPtr<JSStringRef> AccessibilityController::platformName() >-{ >- JSRetainPtr<JSStringRef> platformName(Adopt, JSStringCreateWithUTF8CString("atk")); >- return platformName; >-} >- >-void AccessibilityController::injectAccessibilityPreference(JSStringRef domain, JSStringRef key, JSStringRef value) >-{ >-} >- >-Ref<AccessibilityUIElement> AccessibilityController::rootElement() >-{ >- WKBundlePageRef page = InjectedBundle::singleton().page()->page(); >- void* root = WKAccessibilityRootObject(page); >- >- return AccessibilityUIElement::create(static_cast<AtkObject*>(root)); >-} >- >-RefPtr<AccessibilityUIElement> AccessibilityController::focusedElement() >-{ >- WKBundlePageRef page = InjectedBundle::singleton().page()->page(); >- void* root = WKAccessibilityFocusedObject(page); >- >- if (!ATK_IS_OBJECT(root)) >- return nullptr; >- >- return AccessibilityUIElement::create(static_cast<AtkObject*>(root)); >-} >- >-bool AccessibilityController::addNotificationListener(JSValueRef functionCallback) >-{ >- if (!functionCallback) >- return false; >- >- // Only one global notification listener. >- if (!m_globalNotificationHandler) >- m_globalNotificationHandler = AccessibilityNotificationHandler::create(); >- m_globalNotificationHandler->setNotificationFunctionCallback(functionCallback); >- >- return true; >-} >- >-bool AccessibilityController::removeNotificationListener() >-{ >- // Programmers should not be trying to remove a listener that's already removed. >- ASSERT(m_globalNotificationHandler); >- >- m_globalNotificationHandler = nullptr; >- return false; >-} >- >-} // namespace WTR >- >-#endif // ENABLE(ACCESSIBILITY) && USE(ATK) >diff --git a/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityNotificationHandlerAtk.cpp b/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityNotificationHandlerAtk.cpp >deleted file mode 100644 >index ff505dc8dd0e..000000000000 >--- a/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityNotificationHandlerAtk.cpp >+++ /dev/null >@@ -1,281 +0,0 @@ >-/* >- * Copyright (C) 2013 Samsung Electronics Inc. All rights reserved. >- * >- * This library is free software; you can redistribute it and/or >- * modify it under the terms of the GNU Library General Public >- * License as published by the Free Software Foundation; either >- * version 2 of the License, or (at your option) any later version. >- * >- * This library is distributed in the hope that it will be useful, >- * but WITHOUT ANY WARRANTY; without even the implied warranty of >- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- * Library General Public License for more details. >- * >- * You should have received a copy of the GNU Library General Public License >- * along with this library; see the file COPYING.LIB. If not, write to >- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >- * Boston, MA 02110-1301, USA. >- */ >- >-#include "config.h" >-#include "AccessibilityNotificationHandlerAtk.h" >- >-#if ENABLE(ACCESSIBILITY) && USE(ATK) >- >-#include "AccessibilityUIElement.h" >-#include "InjectedBundle.h" >-#include "InjectedBundlePage.h" >-#include "JSWrapper.h" >-#include <WebKit/WKBundleFrame.h> >-#include <WebKit/WKBundlePage.h> >-#include <WebKit/WKBundlePagePrivate.h> >-#include <wtf/HashMap.h> >-#include <wtf/Vector.h> >-#include <wtf/glib/GUniquePtr.h> >-#include <wtf/text/CString.h> >-#include <wtf/text/WTFString.h> >- >-namespace WTR { >- >-namespace { >- >-typedef HashMap<AtkObject*, AccessibilityNotificationHandler*> NotificationHandlersMap; >- >-static WTF::Vector<unsigned>& listenerIds() >-{ >- static NeverDestroyed<WTF::Vector<unsigned>> ids; >- return ids.get(); >-} >- >-static NotificationHandlersMap& notificationHandlers() >-{ >- static NeverDestroyed<NotificationHandlersMap> map; >- return map.get(); >-} >- >-AccessibilityNotificationHandler* globalNotificationHandler = nullptr; >- >-gboolean axObjectEventListener(GSignalInvocationHint* signalHint, unsigned numParamValues, const GValue* paramValues, gpointer data) >-{ >- // At least we should receive the instance emitting the signal. >- if (!numParamValues) >- return true; >- >- AtkObject* accessible = ATK_OBJECT(g_value_get_object(¶mValues[0])); >- if (!accessible || !ATK_IS_OBJECT(accessible)) >- return true; >- >- WKBundlePageRef page = InjectedBundle::singleton().page()->page(); >- WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(page); >- JSContextRef jsContext = WKBundleFrameGetJavaScriptContext(mainFrame); >- >- GSignalQuery signalQuery; >- const char* notificationName = nullptr; >- Vector<JSValueRef> extraArgs; >- >- g_signal_query(signalHint->signal_id, &signalQuery); >- >- if (!g_strcmp0(signalQuery.signal_name, "state-change")) { >- if (!g_strcmp0(g_value_get_string(¶mValues[1]), "checked")) >- notificationName = "CheckedStateChanged"; >- else if (!g_strcmp0(g_value_get_string(¶mValues[1]), "invalid-entry")) >- notificationName = "AXInvalidStatusChanged"; >- else if (!g_strcmp0(g_value_get_string(¶mValues[1]), "active")) >- notificationName = "ActiveStateChanged"; >- else if (!g_strcmp0(g_value_get_string(¶mValues[1]), "busy")) >- notificationName = "AXElementBusyChanged"; >- else if (!g_strcmp0(g_value_get_string(¶mValues[1]), "enabled")) >- notificationName = "AXDisabledStateChanged"; >- else if (!g_strcmp0(g_value_get_string(¶mValues[1]), "expanded")) >- notificationName = "AXExpandedChanged"; >- else if (!g_strcmp0(g_value_get_string(¶mValues[1]), "pressed")) >- notificationName = "AXPressedStateChanged"; >- else if (!g_strcmp0(g_value_get_string(¶mValues[1]), "read-only")) >- notificationName = "AXReadOnlyStatusChanged"; >- else if (!g_strcmp0(g_value_get_string(¶mValues[1]), "required")) >- notificationName = "AXRequiredStatusChanged"; >- else if (!g_strcmp0(g_value_get_string(¶mValues[1]), "sensitive")) >- notificationName = "AXSensitiveStateChanged"; >- else >- return true; >- GUniquePtr<char> signalValue(g_strdup_printf("%d", g_value_get_boolean(¶mValues[2]))); >- JSRetainPtr<JSStringRef> jsSignalValue(Adopt, JSStringCreateWithUTF8CString(signalValue.get())); >- extraArgs.append(JSValueMakeString(jsContext, jsSignalValue.get())); >- } else if (!g_strcmp0(signalQuery.signal_name, "focus-event")) { >- if (g_value_get_boolean(¶mValues[1])) >- notificationName = "AXFocusedUIElementChanged"; >- } else if (!g_strcmp0(signalQuery.signal_name, "selection-changed")) { >- notificationName = "AXSelectedChildrenChanged"; >- } else if (!g_strcmp0(signalQuery.signal_name, "children-changed")) { >- const gchar* childrenChangedDetail = g_quark_to_string(signalHint->detail); >- notificationName = !g_strcmp0(childrenChangedDetail, "add") ? "AXChildrenAdded" : "AXChildrenRemoved"; >- gpointer child = g_value_get_pointer(¶mValues[2]); >- if (ATK_IS_OBJECT(child)) >- extraArgs.append(toJS(jsContext, WTF::getPtr(WTR::AccessibilityUIElement::create(ATK_OBJECT(child))))); >- } else if (!g_strcmp0(signalQuery.signal_name, "property-change")) { >- if (!g_strcmp0(g_quark_to_string(signalHint->detail), "accessible-value")) >- notificationName = "AXValueChanged"; >- } else if (!g_strcmp0(signalQuery.signal_name, "load-complete")) >- notificationName = "AXLoadComplete"; >- else if (!g_strcmp0(signalQuery.signal_name, "text-caret-moved")) { >- notificationName = "AXTextCaretMoved"; >- GUniquePtr<char> signalValue(g_strdup_printf("%d", g_value_get_int(¶mValues[1]))); >- JSRetainPtr<JSStringRef> jsSignalValue(Adopt, JSStringCreateWithUTF8CString(signalValue.get())); >- extraArgs.append(JSValueMakeString(jsContext, jsSignalValue.get())); >- } else if (!g_strcmp0(signalQuery.signal_name, "text-insert") || !g_strcmp0(signalQuery.signal_name, "text-remove")) >- notificationName = "AXTextChanged"; >- >- if (!jsContext) >- return true; >- >- if (notificationName) { >- JSRetainPtr<JSStringRef> jsNotificationEventName(Adopt, JSStringCreateWithUTF8CString(notificationName)); >- JSValueRef notificationNameArgument = JSValueMakeString(jsContext, jsNotificationEventName.get()); >- NotificationHandlersMap::iterator elementNotificationHandler = notificationHandlers().find(accessible); >- JSValueRef arguments[5]; // this dimension must be >= 2 + max(extraArgs.size()) >- arguments[0] = toJS(jsContext, WTF::getPtr(WTR::AccessibilityUIElement::create(accessible))); >- arguments[1] = notificationNameArgument; >- size_t numOfExtraArgs = extraArgs.size(); >- for (size_t i = 0; i < numOfExtraArgs; i++) >- arguments[i + 2] = extraArgs[i]; >- if (elementNotificationHandler != notificationHandlers().end()) { >- // Listener for one element. As arguments, it gets the notification name >- // and sometimes extra arguments. >- JSObjectCallAsFunction(jsContext, >- const_cast<JSObjectRef>(elementNotificationHandler->value->notificationFunctionCallback()), >- 0, numOfExtraArgs + 1, arguments + 1, 0); >- } >- >- if (globalNotificationHandler) { >- // A global listener gets additionally the element as the first argument. >- JSObjectCallAsFunction(jsContext, >- const_cast<JSObjectRef>(globalNotificationHandler->notificationFunctionCallback()), >- 0, numOfExtraArgs + 2, arguments, 0); >- } >- } >- >- return true; >-} >- >-} // namespace >- >-AccessibilityNotificationHandler::AccessibilityNotificationHandler() >- : m_platformElement(0) >- , m_notificationFunctionCallback(0) >-{ >-} >- >-AccessibilityNotificationHandler::~AccessibilityNotificationHandler() >-{ >- removeAccessibilityNotificationHandler(); >- disconnectAccessibilityCallbacks(); >-} >- >-void AccessibilityNotificationHandler::setNotificationFunctionCallback(JSValueRef notificationFunctionCallback) >-{ >- if (!notificationFunctionCallback) { >- removeAccessibilityNotificationHandler(); >- disconnectAccessibilityCallbacks(); >- return; >- } >- >- m_notificationFunctionCallback = notificationFunctionCallback; >- >- WKBundlePageRef page = InjectedBundle::singleton().page()->page(); >- WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(page); >- JSContextRef jsContext = WKBundleFrameGetJavaScriptContext(mainFrame); >- >- connectAccessibilityCallbacks(); >- >- JSValueProtect(jsContext, m_notificationFunctionCallback); >- // Check if this notification handler is related to a specific element. >- if (m_platformElement) { >- NotificationHandlersMap::iterator currentNotificationHandler = notificationHandlers().find(m_platformElement.get()); >- if (currentNotificationHandler != notificationHandlers().end()) { >- ASSERT(currentNotificationHandler->value->platformElement()); >- JSValueUnprotect(jsContext, currentNotificationHandler->value->notificationFunctionCallback()); >- notificationHandlers().remove(currentNotificationHandler->value->platformElement().get()); >- } >- notificationHandlers().add(m_platformElement.get(), this); >- } else { >- if (globalNotificationHandler) >- JSValueUnprotect(jsContext, globalNotificationHandler->notificationFunctionCallback()); >- globalNotificationHandler = this; >- } >-} >- >-void AccessibilityNotificationHandler::removeAccessibilityNotificationHandler() >-{ >- WKBundlePageRef page = InjectedBundle::singleton().page()->page(); >- WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(page); >- JSContextRef jsContext = WKBundleFrameGetJavaScriptContext(mainFrame); >- >- if (globalNotificationHandler == this) { >- JSValueUnprotect(jsContext, globalNotificationHandler->notificationFunctionCallback()); >- globalNotificationHandler = nullptr; >- } else if (m_platformElement.get()) { >- NotificationHandlersMap::iterator removeNotificationHandler = notificationHandlers().find(m_platformElement.get()); >- if (removeNotificationHandler != notificationHandlers().end()) { >- JSValueUnprotect(jsContext, removeNotificationHandler->value->notificationFunctionCallback()); >- notificationHandlers().remove(removeNotificationHandler); >- } >- } >-} >- >-void AccessibilityNotificationHandler::connectAccessibilityCallbacks() >-{ >- // Ensure no callbacks are connected before. >- if (!disconnectAccessibilityCallbacks()) >- return; >- >- const char* signalNames[] = { >- "ATK:AtkObject:state-change", >- "ATK:AtkObject:focus-event", >- "ATK:AtkObject:active-descendant-changed", >- "ATK:AtkObject:children-changed", >- "ATK:AtkObject:property-change", >- "ATK:AtkObject:visible-data-changed", >- "ATK:AtkDocument:load-complete", >- "ATK:AtkSelection:selection-changed", >- "ATK:AtkText:text-caret-moved", >- "ATK:AtkText:text-insert", >- "ATK:AtkText:text-remove", >- 0 >- }; >- >- // Register atk interfaces, otherwise add_global may fail. >- GObject* dummyObject = (GObject*)g_object_new(G_TYPE_OBJECT, NULL, NULL); >- g_object_unref(atk_no_op_object_new(dummyObject)); >- g_object_unref(dummyObject); >- >- // Add global listeners for AtkObject's signals. >- for (const char** signalName = signalNames; *signalName; signalName++) { >- unsigned id = atk_add_global_event_listener(axObjectEventListener, *signalName); >- if (!id) { >- String message = makeString("atk_add_global_event_listener failed for signal ", *signalName, '\n'); >- InjectedBundle::singleton().outputText(message); >- continue; >- } >- >- listenerIds().append(id); >- } >-} >- >-bool AccessibilityNotificationHandler::disconnectAccessibilityCallbacks() >-{ >- // Only disconnect if there is no notification handler. >- if (!notificationHandlers().isEmpty() || globalNotificationHandler) >- return false; >- >- // AtkObject signals. >- for (size_t i = 0; i < listenerIds().size(); i++) { >- ASSERT(listenerIds()[i]); >- atk_remove_global_event_listener(listenerIds()[i]); >- } >- listenerIds().clear(); >- return true; >-} >- >-} // namespace WTR >- >-#endif // ENABLE(ACCESSIBILITY) && USE(ATK) >diff --git a/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityNotificationHandlerAtk.h b/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityNotificationHandlerAtk.h >deleted file mode 100644 >index 23ece94bbe34..000000000000 >--- a/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityNotificationHandlerAtk.h >+++ /dev/null >@@ -1,56 +0,0 @@ >-/* >- * Copyright (C) 2013 Samsung Electronics Inc. All rights reserved. >- * >- * This library is free software; you can redistribute it and/or >- * modify it under the terms of the GNU Library General Public >- * License as published by the Free Software Foundation; either >- * version 2 of the License, or (at your option) any later version. >- * >- * This library is distributed in the hope that it will be useful, >- * but WITHOUT ANY WARRANTY; without even the implied warranty of >- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- * Library General Public License for more details. >- * >- * You should have received a copy of the GNU Library General Public License >- * along with this library; see the file COPYING.LIB. If not, write to >- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >- * Boston, MA 02110-1301, USA. >- */ >- >-#pragma once >- >-#if ENABLE(ACCESSIBILITY) && USE(ATK) >- >-#include <JavaScriptCore/JSObjectRef.h> >-#include <atk/atk.h> >-#include <atk/atkobject.h> >-#include <wtf/RefCounted.h> >-#include <wtf/glib/GRefPtr.h> >- >-namespace WTR { >- >-class AccessibilityNotificationHandler : public RefCounted<AccessibilityNotificationHandler> { >-public: >- static Ref<AccessibilityNotificationHandler> create() >- { >- return adoptRef(*new AccessibilityNotificationHandler()); >- } >- ~AccessibilityNotificationHandler(); >- void setPlatformElement(GRefPtr<AtkObject> platformElement) { m_platformElement = platformElement; } >- GRefPtr<AtkObject> platformElement() const { return m_platformElement; } >- void setNotificationFunctionCallback(JSValueRef); >- JSValueRef notificationFunctionCallback() const { return m_notificationFunctionCallback; } >- >-private: >- AccessibilityNotificationHandler(); >- void connectAccessibilityCallbacks(); >- bool disconnectAccessibilityCallbacks(); >- void removeAccessibilityNotificationHandler(); >- >- GRefPtr<AtkObject> m_platformElement; >- JSValueRef m_notificationFunctionCallback; >-}; >- >-} // namespace WTR >- >-#endif // ENABLE(ACCESSIBILITY) && USE(ATK) >diff --git a/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp b/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp >deleted file mode 100644 >index 2c28d411a900..000000000000 >--- a/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp >+++ /dev/null >@@ -1,2324 +0,0 @@ >-/* >- * Copyright (C) 2011 Apple Inc. All Rights Reserved. >- * Copyright (C) 2012 Igalia S.L. >- * Copyright (C) 2013 Samsung Electronics. All rights reserved. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions >- * are met: >- * 1. Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * 2. Redistributions in binary form must reproduce the above copyright >- * notice, this list of conditions and the following disclaimer in the >- * documentation and/or other materials provided with the distribution. >- * >- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY >- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR >- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, >- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, >- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR >- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY >- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >- */ >- >-#include "config.h" >-#include "AccessibilityUIElement.h" >- >-#if ENABLE(ACCESSIBILITY) && USE(ATK) >- >-#include "InjectedBundle.h" >-#include "InjectedBundlePage.h" >-#include <JavaScriptCore/JSStringRef.h> >-#include <JavaScriptCore/OpaqueJSString.h> >-#include <WebCore/NotImplemented.h> >-#include <WebKit/WKBundleFrame.h> >-#include <atk/atk.h> >-#include <wtf/Assertions.h> >-#include <wtf/UniqueArray.h> >-#include <wtf/glib/GRefPtr.h> >-#include <wtf/glib/GUniquePtr.h> >-#include <wtf/text/CString.h> >-#include <wtf/text/StringBuilder.h> >-#include <wtf/text/StringToIntegerConversion.h> >-#include <wtf/unicode/CharacterNames.h> >- >-namespace WTR { >- >-namespace { >- >-enum RangeLimit { >- RangeLimitMinimum, >- RangeLimitMaximum >-}; >- >-enum AtkAttributeType { >- ObjectAttributeType, >- TextAttributeType >-}; >- >-enum AttributesIndex { >- // Attribute names. >- InvalidNameIndex = 0, >- ColumnCount, >- ColumnIndex, >- ColumnSpan, >- RowCount, >- RowIndex, >- RowSpan, >- PosInSetIndex, >- SetSizeIndex, >- PlaceholderNameIndex, >- SortNameIndex, >- CurrentNameIndex, >- AriaLiveNameIndex, >- AriaAtomicNameIndex, >- AriaRelevantNameIndex, >- BusyNameIndex, >- >- // Attribute values. >- SortAscendingValueIndex, >- SortDescendingValueIndex, >- SortUnknownValueIndex, >- >- NumberOfAttributes >-}; >- >-// Attribute names & Values (keep on sync with enum AttributesIndex). >-struct Attribute { >- String coreDomain; >- String atkDomain; >-}; >-using Attributes = std::array<Attribute, NumberOfAttributes>; >-static const Attributes& attributesMap() >-{ >- static NeverDestroyed<Attributes> attributes = Attributes({ >- // Attribute names. >- Attribute { "AXInvalid", "invalid" }, >- Attribute { "AXARIAColumnCount", "colcount" }, >- Attribute { "AXARIAColumnIndex", "colindex" }, >- Attribute { "AXARIAColumnSpan", "colspan" }, >- Attribute { "AXARIARowCount", "rowcount" }, >- Attribute { "AXARIARowIndex", "rowindex" }, >- Attribute { "AXARIARowSpan", "rowspan" }, >- Attribute { "AXARIAPosInSet", "posinset" }, >- Attribute { "AXARIASetSize", "setsize" }, >- Attribute { "AXPlaceholderValue", "placeholder-text" } , >- Attribute { "AXSortDirection", "sort" }, >- Attribute { "AXARIACurrent", "current" }, >- Attribute { "AXARIALive", "live" }, >- Attribute { "AXARIAAtomic", "atomic" }, >- Attribute { "AXARIARelevant", "relevant" }, >- Attribute { "AXElementBusy", "busy" }, >- >- // Attribute values. >- Attribute { "AXAscendingSortDirection", "ascending" }, >- Attribute { "AXDescendingSortDirection", "descending" }, >- Attribute { "AXUnknownSortDirection", "unknown" }, >- }); >- return attributes.get(); >-} >- >-const char* landmarkStringBanner = "AXLandmarkBanner"; >-const char* landmarkStringComplementary = "AXLandmarkComplementary"; >-const char* landmarkStringContentinfo = "AXLandmarkContentInfo"; >-const char* landmarkStringForm = "AXLandmarkForm"; >-const char* landmarkStringMain = "AXLandmarkMain"; >-const char* landmarkStringNavigation = "AXLandmarkNavigation"; >-const char* landmarkStringRegion = "AXLandmarkRegion"; >-const char* landmarkStringSearch = "AXLandmarkSearch"; >- >-String jsStringToWTFString(JSStringRef attribute) >-{ >- size_t bufferSize = JSStringGetMaximumUTF8CStringSize(attribute); >- GUniquePtr<gchar> buffer(static_cast<gchar*>(g_malloc(bufferSize))); >- JSStringGetUTF8CString(attribute, buffer.get(), bufferSize); >- >- return String::fromUTF8(buffer.get()); >-} >- >-String coreAttributeToAtkAttribute(JSStringRef attribute) >-{ >- String attributeString = jsStringToWTFString(attribute); >- for (int i = 0; i < NumberOfAttributes; ++i) { >- if (attributesMap()[i].coreDomain == attributeString) >- return attributesMap()[i].atkDomain; >- } >- >- return attributeString; >-} >- >-String atkAttributeValueToCoreAttributeValue(AtkAttributeType type, const String& id, const String& value) >-{ >- if (type == ObjectAttributeType) { >- // We don't expose the "current" attribute if there is no author-provided value. >- if (id == attributesMap()[CurrentNameIndex].atkDomain && value.isEmpty()) >- return "false"; >- >- // We need to translate ATK values exposed for 'aria-sort' (e.g. 'ascending') >- // into those expected by the layout tests (e.g. 'AXAscendingSortDirection'). >- if (id == attributesMap()[SortNameIndex].atkDomain && !value.isEmpty()) { >- if (value == attributesMap()[SortAscendingValueIndex].atkDomain) >- return attributesMap()[SortAscendingValueIndex].coreDomain; >- if (value == attributesMap()[SortDescendingValueIndex].atkDomain) >- return attributesMap()[SortDescendingValueIndex].coreDomain; >- >- return attributesMap()[SortUnknownValueIndex].coreDomain; >- } >- } else if (type == TextAttributeType) { >- // In case of 'aria-invalid' when the attribute empty or has "false" for ATK >- // it should not be mapped at all, but layout tests will expect 'false'. >- if (id == attributesMap()[InvalidNameIndex].atkDomain && value.isEmpty()) >- return "false"; >- } >- >- return value; >-} >- >-AtkAttributeSet* getAttributeSet(AtkObject* accessible, AtkAttributeType type) >-{ >- if (!accessible) >- return nullptr; >- >- if (type == ObjectAttributeType) >- return atk_object_get_attributes(accessible); >- >- if (type == TextAttributeType) { >- if (!ATK_IS_TEXT(accessible)) >- return nullptr; >- >- return atk_text_get_default_attributes(ATK_TEXT(accessible)); >- } >- >- ASSERT_NOT_REACHED(); >- return nullptr; >-} >- >-String getAttributeSetValueForId(AtkObject* accessible, AtkAttributeType type, String id) >-{ >- AtkAttributeSet* attributeSet = getAttributeSet(accessible, type); >- if (!attributeSet) >- return String(); >- >- String attributeValue; >- for (AtkAttributeSet* attributes = attributeSet; attributes; attributes = attributes->next) { >- AtkAttribute* atkAttribute = static_cast<AtkAttribute*>(attributes->data); >- if (id == atkAttribute->name) { >- attributeValue = String::fromUTF8(atkAttribute->value); >- break; >- } >- } >- atk_attribute_set_free(attributeSet); >- >- return atkAttributeValueToCoreAttributeValue(type, id, attributeValue); >-} >- >-String attributeSetToString(AtkAttributeSet* attributeSet, String separator=", ") >-{ >- if (!attributeSet) >- return String(); >- >- Vector<String> attributeList; >- for (AtkAttributeSet* attributes = attributeSet; attributes; attributes = attributes->next) { >- AtkAttribute* attribute = static_cast<AtkAttribute*>(attributes->data); >- if (!g_strcmp0(attribute->name, "html-id") || !g_strcmp0(attribute->name, "toolkit")) >- continue; >- >- attributeList.append(makeString(attribute->name, ':', attribute->value)); >- } >- atk_attribute_set_free(attributeSet); >- >- std::sort(attributeList.begin(), attributeList.end(), WTF::codePointCompareLessThan); >- >- StringBuilder builder; >- bool isFirst = true; >- for (const auto& attribute : attributeList) { >- if (!isFirst) >- builder.append(separator); >- builder.append(attribute); >- isFirst = false; >- } >- return builder.toString(); >-} >- >-String getAtkAttributeSetAsString(AtkObject* accessible, AtkAttributeType type, String separator=", ") >-{ >- return attributeSetToString(getAttributeSet(accessible, type), separator); >-} >- >-bool checkElementState(PlatformUIElement element, AtkStateType stateType) >-{ >- if (!ATK_IS_OBJECT(element.get())) >- return false; >- >- GRefPtr<AtkStateSet> stateSet = adoptGRef(atk_object_ref_state_set(ATK_OBJECT(element.get()))); >- return atk_state_set_contains_state(stateSet.get(), stateType); >-} >- >-JSStringRef indexRangeInTable(PlatformUIElement element, bool isRowRange) >-{ >- GUniquePtr<gchar> rangeString(g_strdup("{0, 0}")); >- if (!ATK_IS_TABLE_CELL(element.get())) >- return JSStringCreateWithUTF8CString(rangeString.get()); >- >- gint row = -1; >- gint column = -1; >- gint rowSpan = -1; >- gint columnSpan = -1; >- atk_table_cell_get_row_column_span(ATK_TABLE_CELL(element.get()), &row, &column, &rowSpan, &columnSpan); >- >- // Get the actual values, if row and columns are valid values. >- if (row != -1 && column != -1) { >- int base = 0; >- int length = 0; >- if (isRowRange) { >- base = row; >- length = rowSpan; >- } else { >- base = column; >- length = columnSpan; >- } >- rangeString.reset(g_strdup_printf("{%d, %d}", base, length)); >- } >- >- return JSStringCreateWithUTF8CString(rangeString.get()); >-} >- >-void alterCurrentValue(PlatformUIElement element, int factor) >-{ >- if (!ATK_IS_VALUE(element.get())) >- return; >- >- double currentValue; >- atk_value_get_value_and_text(ATK_VALUE(element.get()), ¤tValue, nullptr); >- >- double increment = atk_value_get_increment(ATK_VALUE(element.get())); >- atk_value_set_value(ATK_VALUE(element.get()), currentValue + factor * increment); >-} >- >-gchar* replaceCharactersForResults(gchar* str) >-{ >- WTF::String uString = WTF::String::fromUTF8(str); >- >- // The object replacement character is passed along to ATs so we need to be >- // able to test for their presence and do so without causing test failures. >- uString.replace(objectReplacementCharacter, "<obj>"); >- >- // The presence of newline characters in accessible text of a single object >- // is appropriate, but it makes test results (especially the accessible tree) >- // harder to read. >- uString.replace("\n", "<\\n>"); >- >- return g_strdup(uString.utf8().data()); >-} >- >-const gchar* roleToString(AtkObject* object) >-{ >- AtkRole role = atk_object_get_role(object); >- >- if (role == ATK_ROLE_LANDMARK) { >- String xmlRolesValue = getAttributeSetValueForId(object, ObjectAttributeType, "xml-roles"); >- if (equalLettersIgnoringASCIICase(xmlRolesValue, "banner")) >- return landmarkStringBanner; >- if (equalLettersIgnoringASCIICase(xmlRolesValue, "complementary")) >- return landmarkStringComplementary; >- if (equalLettersIgnoringASCIICase(xmlRolesValue, "contentinfo")) >- return landmarkStringContentinfo; >- if (equalLettersIgnoringASCIICase(xmlRolesValue, "doc-acknowledgments")) >- return landmarkStringRegion; >- if (equalLettersIgnoringASCIICase(xmlRolesValue, "doc-afterword")) >- return landmarkStringRegion; >- if (equalLettersIgnoringASCIICase(xmlRolesValue, "doc-appendix")) >- return landmarkStringRegion; >- if (equalLettersIgnoringASCIICase(xmlRolesValue, "doc-bibliography")) >- return landmarkStringRegion; >- if (equalLettersIgnoringASCIICase(xmlRolesValue, "doc-chapter")) >- return landmarkStringRegion; >- if (equalLettersIgnoringASCIICase(xmlRolesValue, "doc-conclusion")) >- return landmarkStringRegion; >- if (equalLettersIgnoringASCIICase(xmlRolesValue, "doc-credits")) >- return landmarkStringRegion; >- if (equalLettersIgnoringASCIICase(xmlRolesValue, "doc-endnotes")) >- return landmarkStringRegion; >- if (equalLettersIgnoringASCIICase(xmlRolesValue, "doc-epilogue")) >- return landmarkStringRegion; >- if (equalLettersIgnoringASCIICase(xmlRolesValue, "doc-errata")) >- return landmarkStringRegion; >- if (equalLettersIgnoringASCIICase(xmlRolesValue, "doc-foreword")) >- return landmarkStringRegion; >- if (equalLettersIgnoringASCIICase(xmlRolesValue, "doc-glossary")) >- return landmarkStringRegion; >- if (equalLettersIgnoringASCIICase(xmlRolesValue, "doc-glossref")) >- return landmarkStringRegion; >- if (equalLettersIgnoringASCIICase(xmlRolesValue, "doc-index")) >- return landmarkStringRegion; >- if (equalLettersIgnoringASCIICase(xmlRolesValue, "doc-introduction")) >- return landmarkStringRegion; >- if (equalLettersIgnoringASCIICase(xmlRolesValue, "doc-pagelist")) >- return landmarkStringRegion; >- if (equalLettersIgnoringASCIICase(xmlRolesValue, "doc-part")) >- return landmarkStringRegion; >- if (equalLettersIgnoringASCIICase(xmlRolesValue, "doc-preface")) >- return landmarkStringRegion; >- if (equalLettersIgnoringASCIICase(xmlRolesValue, "doc-prologue")) >- return landmarkStringRegion; >- if (equalLettersIgnoringASCIICase(xmlRolesValue, "doc-toc")) >- return landmarkStringRegion; >- if (equalLettersIgnoringASCIICase(xmlRolesValue, "form")) >- return landmarkStringForm; >- if (equalLettersIgnoringASCIICase(xmlRolesValue, "main")) >- return landmarkStringMain; >- if (equalLettersIgnoringASCIICase(xmlRolesValue, "navigation")) >- return landmarkStringNavigation; >- if (equalLettersIgnoringASCIICase(xmlRolesValue, "region")) >- return landmarkStringRegion; >- if (equalLettersIgnoringASCIICase(xmlRolesValue, "search")) >- return landmarkStringSearch; >- } >- >- switch (role) { >- case ATK_ROLE_ALERT: >- return "AXAlert"; >- case ATK_ROLE_DIALOG: >- return "AXDialog"; >- case ATK_ROLE_CANVAS: >- return "AXCanvas"; >- case ATK_ROLE_CAPTION: >- return "AXCaption"; >- case ATK_ROLE_CHECK_BOX: >- return "AXCheckBox"; >- case ATK_ROLE_COLOR_CHOOSER: >- return "AXColorWell"; >- case ATK_ROLE_COLUMN_HEADER: >- return "AXColumnHeader"; >- case ATK_ROLE_COMBO_BOX: >- return "AXComboBox"; >- case ATK_ROLE_COMMENT: >- return "AXComment"; >- case ATK_ROLE_DOCUMENT_FRAME: >- return "AXDocument"; >- case ATK_ROLE_DOCUMENT_WEB: >- return "AXWebArea"; >- case ATK_ROLE_EMBEDDED: >- return "AXEmbedded"; >- case ATK_ROLE_ENTRY: >- return "AXTextField"; >- case ATK_ROLE_FOOTER: >- return "AXFooter"; >- case ATK_ROLE_FORM: >- return "AXForm"; >- case ATK_ROLE_GROUPING: >- return "AXGroup"; >- case ATK_ROLE_HEADING: >- return "AXHeading"; >- case ATK_ROLE_IMAGE: >- return "AXImage"; >- case ATK_ROLE_IMAGE_MAP: >- return "AXImageMap"; >- case ATK_ROLE_INVALID: >- return "AXInvalid"; >- case ATK_ROLE_LABEL: >- return "AXLabel"; >- case ATK_ROLE_LEVEL_BAR: >- return "AXLevelIndicator"; >- case ATK_ROLE_LINK: >- return "AXLink"; >- case ATK_ROLE_LIST: >- return "AXList"; >- case ATK_ROLE_LIST_BOX: >- return "AXListBox"; >- case ATK_ROLE_LIST_ITEM: >- return "AXListItem"; >- case ATK_ROLE_MENU: >- return "AXMenu"; >- case ATK_ROLE_MENU_BAR: >- return "AXMenuBar"; >- case ATK_ROLE_MENU_ITEM: >- return "AXMenuItem"; >- case ATK_ROLE_NOTIFICATION: >- return "AXNotification"; >- case ATK_ROLE_PAGE_TAB: >- return "AXTab"; >- case ATK_ROLE_PAGE_TAB_LIST: >- return "AXTabGroup"; >- case ATK_ROLE_PANEL: >- return "AXGroup"; >- case ATK_ROLE_PARAGRAPH: >- return "AXParagraph"; >- case ATK_ROLE_PASSWORD_TEXT: >- return "AXPasswordField"; >- case ATK_ROLE_PROGRESS_BAR: >- return "AXProgressIndicator"; >- case ATK_ROLE_PUSH_BUTTON: >- return "AXButton"; >- case ATK_ROLE_RADIO_BUTTON: >- return "AXRadioButton"; >- case ATK_ROLE_RADIO_MENU_ITEM: >- return "AXRadioMenuItem"; >- case ATK_ROLE_ROW_HEADER: >- return "AXRowHeader"; >- case ATK_ROLE_CHECK_MENU_ITEM: >- return "AXCheckMenuItem"; >- case ATK_ROLE_RULER: >- return "AXRuler"; >- case ATK_ROLE_SCROLL_BAR: >- return "AXScrollBar"; >- case ATK_ROLE_SCROLL_PANE: >- return "AXScrollArea"; >- case ATK_ROLE_SECTION: >- return "AXSection"; >- case ATK_ROLE_SEPARATOR: >- return "AXSeparator"; >- case ATK_ROLE_SLIDER: >- return "AXSlider"; >- case ATK_ROLE_SPIN_BUTTON: >- return "AXSpinButton"; >- case ATK_ROLE_STATUSBAR: >- return "AXStatusBar"; >- case ATK_ROLE_TABLE: >- return "AXTable"; >- case ATK_ROLE_TABLE_CELL: >- return "AXCell"; >- case ATK_ROLE_TABLE_COLUMN_HEADER: >- return "AXColumnHeader"; >- case ATK_ROLE_TABLE_ROW: >- return "AXRow"; >- case ATK_ROLE_TABLE_ROW_HEADER: >- return "AXRowHeader"; >- case ATK_ROLE_TOGGLE_BUTTON: >- return "AXToggleButton"; >- case ATK_ROLE_TOOL_BAR: >- return "AXToolbar"; >- case ATK_ROLE_TOOL_TIP: >- return "AXUserInterfaceTooltip"; >- case ATK_ROLE_TREE: >- return "AXTree"; >- case ATK_ROLE_TREE_TABLE: >- return "AXTreeGrid"; >- case ATK_ROLE_TREE_ITEM: >- return "AXTreeItem"; >- case ATK_ROLE_WINDOW: >- return "AXWindow"; >- case ATK_ROLE_UNKNOWN: >- return "AXUnknown"; >- case ATK_ROLE_ARTICLE: >- return "AXArticle"; >- case ATK_ROLE_AUDIO: >- return "AXAudio"; >- case ATK_ROLE_BLOCK_QUOTE: >- return "AXBlockquote"; >- case ATK_ROLE_DEFINITION: >- return "AXDefinition"; >- case ATK_ROLE_LOG: >- return "AXLog"; >- case ATK_ROLE_MARQUEE: >- return "AXMarquee"; >- case ATK_ROLE_MATH: >- return "AXMath"; >- case ATK_ROLE_TIMER: >- return "AXTimer"; >- case ATK_ROLE_VIDEO: >- return "AXVideo"; >- case ATK_ROLE_DESCRIPTION_LIST: >- return "AXDescriptionList"; >- case ATK_ROLE_DESCRIPTION_TERM: >- return "AXDescriptionTerm"; >- case ATK_ROLE_DESCRIPTION_VALUE: >- return "AXDescriptionValue"; >- case ATK_ROLE_STATIC: >- return "AXStatic"; >- case ATK_ROLE_MATH_FRACTION: >- return "AXMathFraction"; >- case ATK_ROLE_MATH_ROOT: >- return "AXMathRoot"; >- case ATK_ROLE_SUBSCRIPT: >- return "AXSubscript"; >- case ATK_ROLE_SUPERSCRIPT: >- return "AXSuperscript"; >-#if ATK_CHECK_VERSION(2, 25, 2) >- case ATK_ROLE_FOOTNOTE: >- return "AXFootnote"; >-#endif >-#if ATK_CHECK_VERSION(2, 33, 3) >- case ATK_ROLE_CONTENT_DELETION: >- return "AXDeletion"; >- case ATK_ROLE_CONTENT_INSERTION: >- return "AXInsertion"; >-#endif >- default: >- // We want to distinguish ATK_ROLE_UNKNOWN from a known AtkRole which >- // our DRT isn't properly handling. >- return "FIXME not identified"; >- } >-} >- >-String selectedText(AtkObject* accessible) >-{ >- if (!ATK_IS_TEXT(accessible)) >- return String(); >- >- AtkText* text = ATK_TEXT(accessible); >- >- gint start, end; >- g_free(atk_text_get_selection(text, 0, &start, &end)); >- >- return atk_text_get_text(text, start, end); >-} >- >-String attributesOfElement(AccessibilityUIElement* element) >-{ >- StringBuilder builder; >- >- builder.append(element->role()->string(), '\n'); >- >- // For the parent we print its role and its name, if available. >- builder.append("AXParent: "); >- RefPtr<AccessibilityUIElement> parent = element->parentElement(); >- AtkObject* atkParent = parent ? parent->platformUIElement().get() : nullptr; >- if (atkParent) { >- builder.append(roleToString(atkParent)); >- const char* parentName = atk_object_get_name(atkParent); >- if (parentName && parentName[0]) >- builder.append(": ", parentName); >- } else >- builder.append("(null)"); >- builder.append('\n'); >- >- builder.append("AXChildren: ", element->childrenCount(), '\n'); >- >- builder.append("AXPosition: { ", FormattedNumber::fixedPrecision(element->x(), 6, KeepTrailingZeros)); >- builder.append(", ", FormattedNumber::fixedPrecision(element->y(), 6, KeepTrailingZeros)); >- builder.append(" }\n"); >- >- builder.append("AXSize: { ", FormattedNumber::fixedPrecision(element->width(), 6, KeepTrailingZeros)); >- builder.append(", ", FormattedNumber::fixedPrecision(element->height(), 6, KeepTrailingZeros)); >- builder.append(" }\n"); >- >- String title = element->title()->string(); >- if (!title.isEmpty()) { >- builder.append(title); >- builder.append('\n'); >- } >- >- String description = element->description()->string(); >- if (!description.isEmpty()) >- builder.append(description.utf8().data(), '\n'); >- >- String value = element->stringValue()->string(); >- if (!value.isEmpty()) >- builder.append(value, '\n'); >- >- builder.append("AXFocusable: ", element->isFocusable(), '\n'); >- builder.append("AXFocused: ", element->isFocused(), '\n'); >- builder.append("AXSelectable: ", element->isSelectable(), '\n'); >- builder.append("AXSelected: ", element->isSelected(), '\n'); >- builder.append("AXMultiSelectable: ", element->isMultiSelectable(), '\n'); >- builder.append("AXEnabled: ", element->isEnabled(), '\n'); >- builder.append("AXExpanded: ", element->isExpanded(), '\n'); >- builder.append("AXRequired: ", element->isRequired(), '\n'); >- builder.append("AXChecked: ", element->isChecked(), '\n'); >- >- String url = element->url()->string(); >- if (!url.isEmpty()) >- builder.append(url, '\n'); >- >- // We append the ATK specific attributes as a single line at the end. >- builder.append("AXPlatformAttributes: ", getAtkAttributeSetAsString(element->platformUIElement().get(), ObjectAttributeType)); >- >- return builder.toString(); >-} >- >-static JSRetainPtr<JSStringRef> createStringWithAttributes(const Vector<RefPtr<AccessibilityUIElement> >& elements) >-{ >- StringBuilder builder; >- for (auto& element : elements) >- builder.append(attributesOfElement(const_cast<AccessibilityUIElement*>(element.get())), "\n------------\n"); >- return JSStringCreateWithUTF8CString(builder.toString().utf8().data()); >-} >- >-static Vector<RefPtr<AccessibilityUIElement> > getTableRowHeaders(AtkTable* accessible) >-{ >- Vector<RefPtr<AccessibilityUIElement> > rowHeaders; >- >- int rowsCount = atk_table_get_n_rows(accessible); >- for (int row = 0; row < rowsCount; ++row) { >- if (AtkObject* header = atk_table_get_row_header(accessible, row)) >- rowHeaders.append(AccessibilityUIElement::create(header)); >- } >- >- return rowHeaders; >-} >- >-static Vector<RefPtr<AccessibilityUIElement> > getTableColumnHeaders(AtkTable* accessible) >-{ >- Vector<RefPtr<AccessibilityUIElement> > columnHeaders; >- >- int columnsCount = atk_table_get_n_columns(accessible); >- for (int column = 0; column < columnsCount; ++column) { >- if (AtkObject* header = atk_table_get_column_header(accessible, column)) >- columnHeaders.append(AccessibilityUIElement::create(header)); >- } >- >- return columnHeaders; >-} >- >-static Vector<RefPtr<AccessibilityUIElement> > getVisibleCells(AccessibilityUIElement* element) >-{ >- Vector<RefPtr<AccessibilityUIElement> > visibleCells; >- >- AtkTable* accessible = ATK_TABLE(element->platformUIElement().get()); >- int rowsCount = atk_table_get_n_rows(accessible); >- int columnsCount = atk_table_get_n_columns(accessible); >- >- for (int row = 0; row < rowsCount; ++row) { >- for (int column = 0; column < columnsCount; ++column) >- visibleCells.append(element->cellForColumnAndRow(column, row)); >- } >- >- return visibleCells; >-} >- >-static Vector<RefPtr<AccessibilityUIElement>> convertGPtrArrayToVector(const GPtrArray* array) >-{ >- Vector<RefPtr<AccessibilityUIElement>> cells; >- for (guint i = 0; i < array->len; i++) { >- if (AtkObject* atkObject = static_cast<AtkObject*>(g_ptr_array_index(array, i))) >- cells.append(AccessibilityUIElement::create(atkObject)); >- } >- return cells; >-} >- >-static JSValueRef convertToJSObjectArray(const Vector<RefPtr<AccessibilityUIElement>>& children) >-{ >- WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(InjectedBundle::singleton().page()->page()); >- JSContextRef context = WKBundleFrameGetJavaScriptContext(mainFrame); >- >- size_t elementCount = children.size(); >- auto valueElements = makeUniqueArray<JSValueRef>(elementCount); >- for (size_t i = 0; i < elementCount; i++) >- valueElements[i] = JSObjectMake(context, children[i]->wrapperClass(), children[i].get()); >- >- return JSObjectMakeArray(context, elementCount, valueElements.get(), nullptr); >-} >- >-static double rangeMinMaxValue(AtkValue* atkValue, RangeLimit rangeLimit) >-{ >- AtkRange* range = atk_value_get_range(atkValue); >- if (!range) >- return 0; >- >- double rangeValue = 0; >- switch (rangeLimit) { >- case RangeLimitMinimum: >- rangeValue = atk_range_get_lower_limit(range); >- break; >- case RangeLimitMaximum: >- rangeValue = atk_range_get_upper_limit(range); >- break; >- }; >- >- atk_range_free(range); >- return rangeValue; >-} >- >-} // namespace >- >-AccessibilityUIElement::AccessibilityUIElement(PlatformUIElement element) >- : m_element(element) >-{ >-} >- >-AccessibilityUIElement::AccessibilityUIElement(const AccessibilityUIElement& other) >- : JSWrappable() >- , m_element(other.m_element) >-{ >-} >- >-AccessibilityUIElement::~AccessibilityUIElement() >-{ >-} >- >-bool AccessibilityUIElement::isEqual(AccessibilityUIElement* otherElement) >-{ >- return m_element == otherElement->platformUIElement(); >-} >- >-void AccessibilityUIElement::getChildren(Vector<RefPtr<AccessibilityUIElement> >& children) >-{ >- if (!ATK_IS_OBJECT(m_element.get())) >- return; >- >- int count = childrenCount(); >- for (int i = 0; i < count; i++) { >- GRefPtr<AtkObject> child = adoptGRef(atk_object_ref_accessible_child(ATK_OBJECT(m_element.get()), i)); >- >- if (!ATK_IS_OBJECT(child.get())) >- continue; >- >- children.append(AccessibilityUIElement::create(child.get())); >- } >-} >- >-void AccessibilityUIElement::getChildrenWithRange(Vector<RefPtr<AccessibilityUIElement> >& children, unsigned location, unsigned length) >-{ >- if (!ATK_IS_OBJECT(m_element.get())) >- return; >- unsigned end = location + length; >- for (unsigned i = location; i < end; i++) { >- GRefPtr<AtkObject> child = adoptGRef(atk_object_ref_accessible_child(ATK_OBJECT(m_element.get()), i)); >- >- if (!ATK_IS_OBJECT(child.get())) >- continue; >- >- children.append(AccessibilityUIElement::create(child.get())); >- } >-} >- >-int AccessibilityUIElement::childrenCount() >-{ >- if (!ATK_IS_OBJECT(m_element.get())) >- return 0; >- >- return atk_object_get_n_accessible_children(ATK_OBJECT(m_element.get())); >-} >- >-RefPtr<AccessibilityUIElement> AccessibilityUIElement::elementAtPoint(int x, int y) >-{ >- if (!ATK_IS_COMPONENT(m_element.get())) >- return nullptr; >- >- GRefPtr<AtkObject> objectAtPoint = adoptGRef(atk_component_ref_accessible_at_point(ATK_COMPONENT(m_element.get()), x, y, ATK_XY_WINDOW)); >- return AccessibilityUIElement::create(objectAtPoint ? objectAtPoint.get() : m_element.get()); >-} >- >-unsigned AccessibilityUIElement::indexOfChild(AccessibilityUIElement* element) >-{ >- if (!ATK_IS_OBJECT(m_element.get())) >- return 0; >- >- Vector<RefPtr<AccessibilityUIElement> > children; >- getChildren(children); >- >- unsigned count = children.size(); >- for (unsigned i = 0; i < count; i++) >- if (children[i]->isEqual(element)) >- return i; >- >- return 0; >-} >- >-RefPtr<AccessibilityUIElement> AccessibilityUIElement::childAtIndex(unsigned index) >-{ >- if (!ATK_IS_OBJECT(m_element.get())) >- return nullptr; >- >- Vector<RefPtr<AccessibilityUIElement> > children; >- getChildrenWithRange(children, index, 1); >- >- if (children.size() == 1) >- return children[0]; >- >- return nullptr; >-} >- >-static RefPtr<AccessibilityUIElement> accessibilityElementAtIndex(AtkObject* element, AtkRelationType relationType, unsigned index) >-{ >- if (!ATK_IS_OBJECT(element)) >- return nullptr; >- >- AtkRelationSet* relationSet = atk_object_ref_relation_set(element); >- if (!relationSet) >- return nullptr; >- >- AtkRelation* relation = atk_relation_set_get_relation_by_type(relationSet, relationType); >- if (!relation) >- return nullptr; >- >- GPtrArray* targetList = atk_relation_get_target(relation); >- if (!targetList || !targetList->len || index >= targetList->len) >- return nullptr; >- >- AtkObject* target = static_cast<AtkObject*>(g_ptr_array_index(targetList, index)); >- g_object_unref(relationSet); >- >- return target ? AccessibilityUIElement::create(target).ptr() : nullptr; >-} >- >-RefPtr<AccessibilityUIElement> AccessibilityUIElement::linkedUIElementAtIndex(unsigned index) >-{ >- // FIXME: implement >- return nullptr; >-} >- >-RefPtr<AccessibilityUIElement> AccessibilityUIElement::ariaOwnsElementAtIndex(unsigned index) >-{ >- return accessibilityElementAtIndex(m_element.get(), ATK_RELATION_NODE_PARENT_OF, index); >-} >- >-RefPtr<AccessibilityUIElement> AccessibilityUIElement::ariaOwnsReferencingElementAtIndex(unsigned index) >-{ >- return accessibilityElementAtIndex(m_element.get(), ATK_RELATION_NODE_CHILD_OF, index); >-} >- >-RefPtr<AccessibilityUIElement> AccessibilityUIElement::ariaFlowToElementAtIndex(unsigned index) >-{ >- return accessibilityElementAtIndex(m_element.get(), ATK_RELATION_FLOWS_TO, index); >-} >- >-RefPtr<AccessibilityUIElement> AccessibilityUIElement::ariaFlowToReferencingElementAtIndex(unsigned index) >-{ >- return accessibilityElementAtIndex(m_element.get(), ATK_RELATION_FLOWS_FROM, index); >-} >- >-RefPtr<AccessibilityUIElement> AccessibilityUIElement::ariaControlsElementAtIndex(unsigned index) >-{ >- return accessibilityElementAtIndex(m_element.get(), ATK_RELATION_CONTROLLER_FOR, index); >-} >- >-RefPtr<AccessibilityUIElement> AccessibilityUIElement::ariaControlsReferencingElementAtIndex(unsigned index) >-{ >- return accessibilityElementAtIndex(m_element.get(), ATK_RELATION_CONTROLLED_BY, index); >-} >- >-RefPtr<AccessibilityUIElement> AccessibilityUIElement::ariaLabelledByElementAtIndex(unsigned index) >-{ >- return accessibilityElementAtIndex(m_element.get(), ATK_RELATION_LABELLED_BY, index); >-} >- >-RefPtr<AccessibilityUIElement> AccessibilityUIElement::ariaLabelledByReferencingElementAtIndex(unsigned index) >-{ >- return accessibilityElementAtIndex(m_element.get(), ATK_RELATION_LABEL_FOR, index); >-} >- >-RefPtr<AccessibilityUIElement> AccessibilityUIElement::ariaDescribedByElementAtIndex(unsigned index) >-{ >- return accessibilityElementAtIndex(m_element.get(), ATK_RELATION_DESCRIBED_BY, index); >-} >- >-RefPtr<AccessibilityUIElement> AccessibilityUIElement::ariaDescribedByReferencingElementAtIndex(unsigned index) >-{ >- return accessibilityElementAtIndex(m_element.get(), ATK_RELATION_DESCRIPTION_FOR, index); >-} >- >-RefPtr<AccessibilityUIElement> AccessibilityUIElement::ariaDetailsElementAtIndex(unsigned index) >-{ >-#if ATK_CHECK_VERSION(2, 25, 2) >- return accessibilityElementAtIndex(m_element.get(), ATK_RELATION_DETAILS, index); >-#endif >- return nullptr; >-} >- >-RefPtr<AccessibilityUIElement> AccessibilityUIElement::ariaDetailsReferencingElementAtIndex(unsigned index) >-{ >-#if ATK_CHECK_VERSION(2, 25, 2) >- return accessibilityElementAtIndex(m_element.get(), ATK_RELATION_DETAILS_FOR, index); >-#endif >- return nullptr; >-} >- >-RefPtr<AccessibilityUIElement> AccessibilityUIElement::ariaErrorMessageElementAtIndex(unsigned index) >-{ >-#if ATK_CHECK_VERSION(2, 25, 2) >- return accessibilityElementAtIndex(m_element.get(), ATK_RELATION_ERROR_MESSAGE, index); >-#endif >- return nullptr; >-} >- >-RefPtr<AccessibilityUIElement> AccessibilityUIElement::ariaErrorMessageReferencingElementAtIndex(unsigned index) >-{ >-#if ATK_CHECK_VERSION(2, 25, 2) >- return accessibilityElementAtIndex(m_element.get(), ATK_RELATION_ERROR_FOR, index); >-#endif >- return nullptr; >-} >- >-RefPtr<AccessibilityUIElement> AccessibilityUIElement::disclosedRowAtIndex(unsigned index) >-{ >- // FIXME: implement >- return nullptr; >-} >- >-RefPtr<AccessibilityUIElement> AccessibilityUIElement::rowAtIndex(unsigned index) >-{ >- // ATK doesn't have API to get an accessible row by index directly. It does, however, have >- // API to get cells in the row specified by index. The parent of a cell should be the row. >- AtkTable* axTable = ATK_TABLE(m_element.get()); >- unsigned nColumns = columnCount(); >- for (unsigned col = 0; col < nColumns; col++) { >- // Find the first cell in this row that only spans one row. >- if (atk_table_get_row_extent_at(axTable, index, col) == 1) { >- AtkObject* cell = atk_table_ref_at(axTable, index, col); >- return cell ? AccessibilityUIElement::create(atk_object_get_parent(cell)).ptr() : nullptr; >- } >- } >- >- return nullptr; >-} >- >-RefPtr<AccessibilityUIElement> AccessibilityUIElement::selectedChildAtIndex(unsigned index) const >-{ >- if (!ATK_SELECTION(m_element.get())) >- return nullptr; >- >- GRefPtr<AtkObject> child = adoptGRef(atk_selection_ref_selection(ATK_SELECTION(m_element.get()), index)); >- return child ? AccessibilityUIElement::create(child.get()).ptr() : nullptr; >-} >- >-unsigned AccessibilityUIElement::selectedChildrenCount() const >-{ >- if (!ATK_IS_SELECTION(m_element.get())) >- return 0; >- return atk_selection_get_selection_count(ATK_SELECTION(m_element.get())); >-} >- >-RefPtr<AccessibilityUIElement> AccessibilityUIElement::selectedRowAtIndex(unsigned index) >-{ >- // FIXME: implement >- return nullptr; >-} >- >-RefPtr<AccessibilityUIElement> AccessibilityUIElement::titleUIElement() >-{ >- if (!ATK_IS_OBJECT(m_element.get())) >- return nullptr; >- >- AtkRelationSet* set = atk_object_ref_relation_set(ATK_OBJECT(m_element.get())); >- if (!set) >- return nullptr; >- >- AtkObject* target = nullptr; >- int count = atk_relation_set_get_n_relations(set); >- for (int i = 0; i < count; i++) { >- AtkRelation* relation = atk_relation_set_get_relation(set, i); >- if (atk_relation_get_relation_type(relation) == ATK_RELATION_LABELLED_BY) { >- GPtrArray* targetList = atk_relation_get_target(relation); >- if (targetList->len) >- target = static_cast<AtkObject*>(g_ptr_array_index(targetList, 0)); >- } >- } >- >- g_object_unref(set); >- return target ? AccessibilityUIElement::create(target).ptr() : nullptr; >-} >- >-RefPtr<AccessibilityUIElement> AccessibilityUIElement::parentElement() >-{ >- if (!ATK_IS_OBJECT(m_element.get())) >- return nullptr; >- >- AtkObject* parent = atk_object_get_parent(ATK_OBJECT(m_element.get())); >- return parent ? AccessibilityUIElement::create(parent).ptr() : nullptr; >-} >- >-RefPtr<AccessibilityUIElement> AccessibilityUIElement::disclosedByRow() >-{ >- // FIXME: implement >- return nullptr; >-} >- >-JSRetainPtr<JSStringRef> AccessibilityUIElement::attributesOfLinkedUIElements() >-{ >- // FIXME: implement >- return JSStringCreateWithCharacters(0, 0); >-} >- >-JSRetainPtr<JSStringRef> AccessibilityUIElement::attributesOfDocumentLinks() >-{ >- // FIXME: implement >- return JSStringCreateWithCharacters(0, 0); >-} >- >-JSRetainPtr<JSStringRef> AccessibilityUIElement::attributesOfChildren() >-{ >- if (!ATK_IS_OBJECT(m_element.get())) >- return JSStringCreateWithCharacters(0, 0); >- >- Vector<RefPtr<AccessibilityUIElement> > children; >- getChildren(children); >- >- return createStringWithAttributes(children); >-} >- >-JSRetainPtr<JSStringRef> AccessibilityUIElement::allAttributes() >-{ >- if (!ATK_IS_OBJECT(m_element.get())) >- return JSStringCreateWithCharacters(0, 0); >- >- return JSStringCreateWithUTF8CString(attributesOfElement(this).utf8().data()); >-} >- >-JSRetainPtr<JSStringRef> AccessibilityUIElement::stringDescriptionOfAttributeValue(JSStringRef attribute) >-{ >- // FIXME: implement >- return JSStringCreateWithCharacters(0, 0); >-} >- >-JSRetainPtr<JSStringRef> AccessibilityUIElement::stringAttributeValue(JSStringRef attribute) >-{ >- if (!ATK_IS_OBJECT(m_element.get())) >- return JSStringCreateWithCharacters(0, 0); >- >- String atkAttributeName = coreAttributeToAtkAttribute(attribute); >- >- // The value of AXSelectedText is not exposed through any AtkAttribute. >- if (atkAttributeName == "AXSelectedText") { >- String string = selectedText(m_element.get()); >- return JSStringCreateWithUTF8CString(string.utf8().data()); >- } >- >- // Try object attributes before text attributes. >- String attributeValue = getAttributeSetValueForId(ATK_OBJECT(m_element.get()), ObjectAttributeType, atkAttributeName); >- >- // Try text attributes if the requested one was not found and we have an AtkText object. >- if (attributeValue.isEmpty() && ATK_IS_TEXT(m_element.get())) >- attributeValue = getAttributeSetValueForId(ATK_OBJECT(m_element.get()), TextAttributeType, atkAttributeName); >- >- // Additional check to make sure that the exposure of the state ATK_STATE_INVALID_ENTRY >- // is consistent with the exposure of aria-invalid as a text attribute, if present. >- if (atkAttributeName == attributesMap()[InvalidNameIndex].atkDomain) { >- bool isInvalidState = checkElementState(m_element.get(), ATK_STATE_INVALID_ENTRY); >- if (attributeValue.isEmpty()) >- return JSStringCreateWithUTF8CString(isInvalidState ? "true" : "false"); >- >- // If the text attribute was there, check that it's consistent with >- // what the state says or force the test to fail otherwise. >- bool isAriaInvalid = attributeValue != "false"; >- if (isInvalidState != isAriaInvalid) >- return JSStringCreateWithCharacters(0, 0); >- } >- >- return JSStringCreateWithUTF8CString(attributeValue.utf8().data()); >-} >- >-double AccessibilityUIElement::numberAttributeValue(JSStringRef attribute) >-{ >- if (!ATK_IS_OBJECT(m_element.get())) >- return 0; >- >- String atkAttributeName = coreAttributeToAtkAttribute(attribute); >- if (atkAttributeName.isEmpty()) >- return 0; >- >- if (atkAttributeName == "setsize" || atkAttributeName == "posinset") { >- String attributeValue = getAttributeSetValueForId(ATK_OBJECT(m_element.get()), ObjectAttributeType, atkAttributeName); >- if (!attributeValue.isEmpty()) >- return attributeValue.toDouble(); >- } >- >- if (atkAttributeName.startsWith("row") || atkAttributeName.startsWith("col")) { >- String attributeValue = getAttributeSetValueForId(ATK_OBJECT(m_element.get()), ObjectAttributeType, atkAttributeName); >- if (!attributeValue.isEmpty()) >- return parseIntegerAllowingTrailingJunk<int>(attributeValue).value_or(0); >- } >- >- return 0; >-} >- >-JSRetainPtr<JSStringRef> AccessibilityUIElement::currentStateValue() const >-{ >- return nullptr; >-} >- >-JSValueRef AccessibilityUIElement::uiElementArrayAttributeValue(JSStringRef attribute) const >-{ >- // FIXME: implement >- return nullptr; >-} >- >-JSValueRef AccessibilityUIElement::rowHeaders() const >-{ >- if (ATK_IS_TABLE(m_element.get())) >- return convertToJSObjectArray(getTableRowHeaders(ATK_TABLE(m_element.get()))); >- >- Vector<RefPtr<AccessibilityUIElement>> headers; >- if (!ATK_IS_TABLE_CELL(m_element.get())) >- return convertToJSObjectArray(headers); >- >- if (GRefPtr<GPtrArray> array = adoptGRef(atk_table_cell_get_row_header_cells(ATK_TABLE_CELL(m_element.get())))) >- headers = convertGPtrArrayToVector(array.get()); >- return convertToJSObjectArray(headers); >-} >- >-JSValueRef AccessibilityUIElement::columnHeaders() const >-{ >- if (ATK_IS_TABLE(m_element.get())) >- return convertToJSObjectArray(getTableColumnHeaders(ATK_TABLE(m_element.get()))); >- >- Vector<RefPtr<AccessibilityUIElement>> headers; >- if (!ATK_IS_TABLE_CELL(m_element.get())) >- return convertToJSObjectArray(headers); >- >- if (GRefPtr<GPtrArray> array = adoptGRef(atk_table_cell_get_column_header_cells(ATK_TABLE_CELL(m_element.get())))) >- headers = convertGPtrArrayToVector(array.get()); >- return convertToJSObjectArray(headers); >-} >- >-RefPtr<AccessibilityUIElement> AccessibilityUIElement::uiElementAttributeValue(JSStringRef attribute) const >-{ >- if (!ATK_IS_OBJECT(m_element.get())) >- return nullptr; >- >- // ATK does not have this API. So we're "faking it" here on a case-by-case basis. >- String attributeString = jsStringToWTFString(attribute); >- AtkRole role = atk_object_get_role(ATK_OBJECT(m_element.get())); >- if (role == ATK_ROLE_SPIN_BUTTON && const_cast<AccessibilityUIElement*>(this)->childrenCount() == 2) { >- if (attributeString == "AXDecrementButton") >- return const_cast<AccessibilityUIElement*>(this)->childAtIndex(0); >- if (attributeString == "AXIncrementButton") >- return const_cast<AccessibilityUIElement*>(this)->childAtIndex(1); >- } >- >- return nullptr; >-} >- >-bool AccessibilityUIElement::boolAttributeValue(JSStringRef attribute) >-{ >- if (!ATK_IS_OBJECT(m_element.get())) >- return false; >- >- String attributeString = jsStringToWTFString(attribute); >- if (attributeString == "AXElementBusy") >- return checkElementState(m_element.get(), ATK_STATE_BUSY); >- if (attributeString == "AXChecked") >- return checkElementState(m_element.get(), ATK_STATE_CHECKED); >- if (attributeString == "AXEnabled") >- return checkElementState(m_element.get(), ATK_STATE_ENABLED); >- if (attributeString == "AXExpanded") >- return checkElementState(m_element.get(), ATK_STATE_EXPANDED); >- if (attributeString == "AXFocused") >- return checkElementState(m_element.get(), ATK_STATE_FOCUSED); >- if (attributeString == "AXInvalid") >- return checkElementState(m_element.get(), ATK_STATE_INVALID); >- if (attributeString == "AXModal") >- return checkElementState(m_element.get(), ATK_STATE_MODAL); >- if (attributeString == "AXMultiSelectable") >- return checkElementState(m_element.get(), ATK_STATE_MULTISELECTABLE); >- if (attributeString == "AXRequired") >- return checkElementState(m_element.get(), ATK_STATE_REQUIRED); >- if (attributeString == "AXSelected") >- return checkElementState(m_element.get(), ATK_STATE_SELECTED); >- if (attributeString == "AXSupportsAutoCompletion") >- return checkElementState(m_element.get(), ATK_STATE_SUPPORTS_AUTOCOMPLETION); >- if (attributeString == "AXVisited") >- return checkElementState(m_element.get(), ATK_STATE_VISITED); >- >- if (attributeString == "AXInterfaceTable") >- return ATK_IS_TABLE(m_element.get()); >- if (attributeString == "AXInterfaceTableCell") >- return ATK_IS_TABLE_CELL(m_element.get()); >- >- if (attributeString == "AXARIAAtomic") { >- String atkAttribute = coreAttributeToAtkAttribute(attribute); >- return getAttributeSetValueForId(ATK_OBJECT(m_element.get()), ObjectAttributeType, atkAttribute) == "true"; >- } >- >- return false; >-} >- >-bool AccessibilityUIElement::isAttributeSettable(JSStringRef attribute) >-{ >- if (!ATK_IS_OBJECT(m_element.get())) >- return false; >- >- String attributeString = jsStringToWTFString(attribute); >- if (attributeString != "AXValue") >- return false; >- >- // ATK does not have a single state or property to indicate whether or not the value >- // of an accessible object can be set. ATs look at several states and properties based >- // on the type of object. If nothing explicitly indicates the value can or cannot be >- // set, ATs make role- and interface-based decisions. We'll do something similar here. >- >- // This state is expected to be present only for text widgets and contenteditable elements. >- if (checkElementState(m_element.get(), ATK_STATE_EDITABLE)) >- return true; >- >- // This state is applicable to checkboxes, radiobuttons, switches, etc. >- if (checkElementState(m_element.get(), ATK_STATE_CHECKABLE)) >- return true; >- >- // This state is expected to be present only for controls and only if explicitly set. >- if (checkElementState(m_element.get(), ATK_STATE_READ_ONLY)) >- return false; >- >- // We expose an object attribute to ATs when there is an author-provided ARIA property >- // and also when there is a supported ARIA role but no author-provided value. >- String isReadOnly = getAttributeSetValueForId(ATK_OBJECT(m_element.get()), ObjectAttributeType, "readonly"); >- if (!isReadOnly.isEmpty()) >- return isReadOnly == "true" ? false : true; >- >- // If we have a native listbox or combobox and the value can be set, the options should >- // have ATK_STATE_SELECTABLE. >- AtkRole role = atk_object_get_role(ATK_OBJECT(m_element.get())); >- if (role == ATK_ROLE_LIST_BOX || role == ATK_ROLE_COMBO_BOX) { >- if (GRefPtr<AtkObject> child = adoptGRef(atk_object_ref_accessible_child(ATK_OBJECT(m_element.get()), 0))) { >- if (atk_object_get_role(ATK_OBJECT(child.get())) == ATK_ROLE_MENU) >- child = adoptGRef(atk_object_ref_accessible_child(ATK_OBJECT(child.get()), 0)); >- return child && checkElementState(child.get(), ATK_STATE_SELECTABLE); >- } >- } >- >- // If we have a native element which exposes a range whose value can be set, it should >- // be focusable and have a true range. >- if (ATK_IS_VALUE(m_element.get()) && checkElementState(m_element.get(), ATK_STATE_FOCUSABLE)) >- return minValue() != maxValue(); >- >- return false; >-} >- >-bool AccessibilityUIElement::isAttributeSupported(JSStringRef attribute) >-{ >- if (!ATK_IS_OBJECT(m_element.get())) >- return false; >- >- String atkAttributeName = coreAttributeToAtkAttribute(attribute); >- if (atkAttributeName.isEmpty()) >- return false; >- >- // In ATK, "busy" is a state and is supported on all AtkObject instances. >- if (atkAttributeName == "busy") >- return true; >- >- // For now, an attribute is supported whether it's exposed as a object or a text attribute. >- String attributeValue = getAttributeSetValueForId(ATK_OBJECT(m_element.get()), ObjectAttributeType, atkAttributeName); >- if (attributeValue.isEmpty()) >- attributeValue = getAttributeSetValueForId(ATK_OBJECT(m_element.get()), TextAttributeType, atkAttributeName); >- >- // When the aria-live value is "off", we expose that value via the "live" object attribute. >- if (atkAttributeName == "live" && attributeValue == "off") >- return false; >- >- return !attributeValue.isEmpty(); >-} >- >-JSRetainPtr<JSStringRef> AccessibilityUIElement::parameterizedAttributeNames() >-{ >- // FIXME: implement >- return JSStringCreateWithCharacters(0, 0); >-} >- >-JSRetainPtr<JSStringRef> AccessibilityUIElement::role() >-{ >- if (!ATK_IS_OBJECT(m_element.get())) >- return JSStringCreateWithCharacters(0, 0); >- >- GUniquePtr<char> roleStringWithPrefix(g_strdup_printf("AXRole: %s", roleToString(ATK_OBJECT(m_element.get())))); >- return JSStringCreateWithUTF8CString(roleStringWithPrefix.get()); >-} >- >-JSRetainPtr<JSStringRef> AccessibilityUIElement::subrole() >-{ >- // FIXME: implement >- return JSStringCreateWithCharacters(0, 0); >-} >- >-JSRetainPtr<JSStringRef> AccessibilityUIElement::roleDescription() >-{ >- String roleDescription = getAttributeSetValueForId(ATK_OBJECT(m_element.get()), ObjectAttributeType, "roledescription"); >- GUniquePtr<gchar> axRoleDescription(g_strdup_printf("AXRoleDescription: %s", roleDescription.utf8().data())); >- >- return JSStringCreateWithUTF8CString(axRoleDescription.get()); >-} >- >-JSRetainPtr<JSStringRef> AccessibilityUIElement::computedRoleString() >-{ >- String role = getAttributeSetValueForId(ATK_OBJECT(m_element.get()), ObjectAttributeType, "computed-role"); >- if (!role.isEmpty()) >- return JSStringCreateWithUTF8CString(role.utf8().data()); >- >- return JSStringCreateWithCharacters(0, 0); >-} >- >-JSRetainPtr<JSStringRef> AccessibilityUIElement::title() >-{ >- if (!ATK_IS_OBJECT(m_element.get())) >- return JSStringCreateWithCharacters(0, 0); >- >- const gchar* name = atk_object_get_name(ATK_OBJECT(m_element.get())); >- GUniquePtr<gchar> axTitle(g_strdup_printf("AXTitle: %s", name ? name : "")); >- >- return JSStringCreateWithUTF8CString(axTitle.get()); >-} >- >-JSRetainPtr<JSStringRef> AccessibilityUIElement::description() >-{ >- if (!ATK_IS_OBJECT(m_element.get())) >- return JSStringCreateWithCharacters(0, 0); >- >- const gchar* description = atk_object_get_description(ATK_OBJECT(m_element.get())); >- if (!description) >- return JSStringCreateWithCharacters(0, 0); >- >- GUniquePtr<gchar> axDesc(g_strdup_printf("AXDescription: %s", description)); >- >- return JSStringCreateWithUTF8CString(axDesc.get()); >-} >- >-JSRetainPtr<JSStringRef> AccessibilityUIElement::orientation() const >-{ >- if (!ATK_IS_OBJECT(m_element.get())) >- return JSStringCreateWithCharacters(0, 0); >- >- const gchar* axOrientation = nullptr; >- if (checkElementState(m_element.get(), ATK_STATE_HORIZONTAL)) >- axOrientation = "AXOrientation: AXHorizontalOrientation"; >- else if (checkElementState(m_element.get(), ATK_STATE_VERTICAL)) >- axOrientation = "AXOrientation: AXVerticalOrientation"; >- else >- axOrientation = "AXOrientation: AXUnknownOrientation"; >- >- return JSStringCreateWithUTF8CString(axOrientation); >-} >- >-JSRetainPtr<JSStringRef> AccessibilityUIElement::stringValue() >-{ >- if (!ATK_IS_TEXT(m_element.get())) >- return JSStringCreateWithCharacters(0, 0); >- >- GUniquePtr<gchar> text(atk_text_get_text(ATK_TEXT(m_element.get()), 0, -1)); >- GUniquePtr<gchar> textWithReplacedCharacters(replaceCharactersForResults(text.get())); >- GUniquePtr<gchar> axValue(g_strdup_printf("AXValue: %s", textWithReplacedCharacters.get())); >- >- return JSStringCreateWithUTF8CString(axValue.get()); >-} >- >-JSRetainPtr<JSStringRef> AccessibilityUIElement::language() >-{ >- if (!ATK_IS_OBJECT(m_element.get())) >- return JSStringCreateWithCharacters(0, 0); >- >- const gchar* locale = atk_object_get_object_locale(ATK_OBJECT(m_element.get())); >- if (!locale) >- return JSStringCreateWithCharacters(0, 0); >- >- GUniquePtr<char> axValue(g_strdup_printf("AXLanguage: %s", locale)); >- return JSStringCreateWithUTF8CString(axValue.get()); >-} >- >-JSRetainPtr<JSStringRef> AccessibilityUIElement::helpText() const >-{ >- if (!ATK_IS_OBJECT(m_element.get())) >- return JSStringCreateWithCharacters(0, 0); >- >- AtkRelationSet* relationSet = atk_object_ref_relation_set(ATK_OBJECT(m_element.get())); >- if (!relationSet) >- return JSStringCreateWithCharacters(0, 0); >- >- AtkRelation* relation = atk_relation_set_get_relation_by_type(relationSet, ATK_RELATION_DESCRIBED_BY); >- if (!relation) >- return JSStringCreateWithCharacters(0, 0); >- >- GPtrArray* targetList = atk_relation_get_target(relation); >- if (!targetList || !targetList->len) >- return JSStringCreateWithCharacters(0, 0); >- >- StringBuilder builder; >- builder.append("AXHelp: "); >- >- for (guint targetCount = 0; targetCount < targetList->len; targetCount++) { >- if (AtkObject* target = static_cast<AtkObject*>(g_ptr_array_index(targetList, targetCount))) { >- GUniquePtr<gchar> text(atk_text_get_text(ATK_TEXT(target), 0, -1)); >- if (targetCount) >- builder.append(' '); >- builder.append(text.get()); >- } >- } >- >- g_object_unref(relationSet); >- >- return JSStringCreateWithUTF8CString(builder.toString().utf8().data()); >-} >- >-double AccessibilityUIElement::x() >-{ >- if (!ATK_IS_COMPONENT(m_element.get())) >- return 0; >- >- int x; >- atk_component_get_extents(ATK_COMPONENT(m_element.get()), &x, nullptr, nullptr, nullptr, ATK_XY_SCREEN); >- return x; >-} >- >-double AccessibilityUIElement::y() >-{ >- if (!ATK_IS_COMPONENT(m_element.get())) >- return 0; >- >- int y; >- atk_component_get_extents(ATK_COMPONENT(m_element.get()), nullptr, &y, nullptr, nullptr, ATK_XY_SCREEN); >- return y; >-} >- >-double AccessibilityUIElement::width() >-{ >- if (!ATK_IS_COMPONENT(m_element.get())) >- return 0; >- >- int width; >- atk_component_get_extents(ATK_COMPONENT(m_element.get()), nullptr, nullptr, &width, nullptr, ATK_XY_WINDOW); >- return width; >-} >- >-double AccessibilityUIElement::height() >-{ >- if (!ATK_IS_COMPONENT(m_element.get())) >- return 0; >- >- int height; >- atk_component_get_extents(ATK_COMPONENT(m_element.get()), nullptr, nullptr, nullptr, &height, ATK_XY_WINDOW); >- return height; >-} >- >-double AccessibilityUIElement::clickPointX() >-{ >- if (!ATK_IS_COMPONENT(m_element.get())) >- return 0; >- >- int x, width; >- atk_component_get_extents(ATK_COMPONENT(m_element.get()), &x, nullptr, &width, nullptr, ATK_XY_WINDOW); >- return x + width / 2.0; >-} >- >-double AccessibilityUIElement::clickPointY() >-{ >- if (!ATK_IS_COMPONENT(m_element.get())) >- return 0; >- >- int y, height; >- atk_component_get_extents(ATK_COMPONENT(m_element.get()), nullptr, &y, nullptr, &height, ATK_XY_WINDOW); >- return y + height / 2.0; >-} >- >-double AccessibilityUIElement::intValue() const >-{ >- if (!ATK_IS_OBJECT(m_element.get())) >- return 0; >- >- if (ATK_IS_VALUE(m_element.get())) { >- double value; >- atk_value_get_value_and_text(ATK_VALUE(m_element.get()), &value, nullptr); >- return value; >- } >- >- // Consider headings as an special case when returning the "int value" of >- // an AccessibilityUIElement, so we can reuse some tests to check the level >- // both for HTML headings and objects with the aria-level attribute. >- if (atk_object_get_role(ATK_OBJECT(m_element.get())) == ATK_ROLE_HEADING) { >- String headingLevel = getAttributeSetValueForId(ATK_OBJECT(m_element.get()), ObjectAttributeType, "level"); >- bool ok; >- double headingLevelValue = headingLevel.toDouble(&ok); >- if (ok) >- return headingLevelValue; >- } >- >- return 0; >-} >- >-double AccessibilityUIElement::minValue() >-{ >- if (!ATK_IS_VALUE(m_element.get())) >- return 0; >- >- return rangeMinMaxValue(ATK_VALUE(m_element.get()), RangeLimitMinimum); >-} >- >-double AccessibilityUIElement::maxValue() >-{ >- if (!ATK_IS_VALUE(m_element.get())) >- return 0; >- >- return rangeMinMaxValue(ATK_VALUE(m_element.get()), RangeLimitMaximum); >-} >- >-JSRetainPtr<JSStringRef> AccessibilityUIElement::valueDescription() >-{ >- String valueText = getAttributeSetValueForId(ATK_OBJECT(m_element.get()), ObjectAttributeType, "valuetext"); >- GUniquePtr<gchar> valueDescription(g_strdup_printf("AXValueDescription: %s", valueText.utf8().data())); >- return JSStringCreateWithUTF8CString(valueDescription.get()); >-} >- >-int AccessibilityUIElement::insertionPointLineNumber() >-{ >- // FIXME: implement >- return -1; >-} >- >-bool AccessibilityUIElement::isPressActionSupported() >-{ >- if (!ATK_IS_ACTION(m_element.get())) >- return false; >- >- const gchar* actionName = atk_action_get_name(ATK_ACTION(m_element.get()), 0); >- return equalLettersIgnoringASCIICase(String(actionName), "press") || equalLettersIgnoringASCIICase(String(actionName), "jump"); >-} >- >-bool AccessibilityUIElement::isIncrementActionSupported() >-{ >- // FIXME: implement >- return false; >-} >- >-bool AccessibilityUIElement::isDecrementActionSupported() >-{ >- // FIXME: implement >- return false; >-} >- >-bool AccessibilityUIElement::isEnabled() >-{ >- return checkElementState(m_element.get(), ATK_STATE_ENABLED); >-} >- >-bool AccessibilityUIElement::isRequired() const >-{ >- return checkElementState(m_element.get(), ATK_STATE_REQUIRED); >-} >- >-bool AccessibilityUIElement::isFocused() const >-{ >- return checkElementState(m_element.get(), ATK_STATE_FOCUSED); >-} >- >-bool AccessibilityUIElement::isSelected() const >-{ >- return checkElementState(m_element.get(), ATK_STATE_SELECTED); >-} >- >-bool AccessibilityUIElement::isSelectedOptionActive() const >-{ >- return checkElementState(m_element.get(), ATK_STATE_ACTIVE); >-} >- >-bool AccessibilityUIElement::isExpanded() const >-{ >- return checkElementState(m_element.get(), ATK_STATE_EXPANDED); >-} >- >-bool AccessibilityUIElement::isChecked() const >-{ >- return checkElementState(m_element.get(), ATK_STATE_CHECKED); >-} >- >-bool AccessibilityUIElement::isIndeterminate() const >-{ >- return checkElementState(m_element.get(), ATK_STATE_INDETERMINATE); >-} >- >-int AccessibilityUIElement::hierarchicalLevel() const >-{ >- return parseIntegerAllowingTrailingJunk<int>(getAttributeSetValueForId(ATK_OBJECT(m_element.get()), ObjectAttributeType, "level")).value_or(0); >-} >- >-JSRetainPtr<JSStringRef> AccessibilityUIElement::speakAs() >-{ >- // FIXME: implement >- return JSStringCreateWithCharacters(0, 0); >-} >- >-bool AccessibilityUIElement::ariaIsGrabbed() const >-{ >- return getAttributeSetValueForId(ATK_OBJECT(m_element.get()), ObjectAttributeType, "grabbed") == "true"; >-} >- >-JSRetainPtr<JSStringRef> AccessibilityUIElement::ariaDropEffects() const >-{ >- String dropEffects = getAttributeSetValueForId(ATK_OBJECT(m_element.get()), ObjectAttributeType, "dropeffect"); >- return dropEffects.isEmpty() ? JSStringCreateWithCharacters(0, 0) : JSStringCreateWithUTF8CString(dropEffects.utf8().data()); >-} >- >-// parameterized attributes >-int AccessibilityUIElement::lineForIndex(int index) >-{ >- if (!ATK_IS_TEXT(m_element.get())) >- return -1; >- >- if (index < 0 || index > atk_text_get_character_count(ATK_TEXT(m_element.get()))) >- return -1; >- >- GUniquePtr<gchar> text(atk_text_get_text(ATK_TEXT(m_element.get()), 0, index)); >- int lineNo = 0; >- for (gchar* offset = text.get(); *offset; ++offset) { >- if (*offset == '\n') >- ++lineNo; >- } >- >- return lineNo; >-} >- >-JSRetainPtr<JSStringRef> AccessibilityUIElement::rangeForLine(int line) >-{ >- if (!ATK_IS_TEXT(m_element.get())) >- return JSStringCreateWithCharacters(0, 0); >- >- AtkText* text = ATK_TEXT(m_element.get()); >- gint startOffset = 0, endOffset = 0; >- for (int i = 0; i <= line; ++i) >- atk_text_get_string_at_offset(text, endOffset, ATK_TEXT_GRANULARITY_LINE, &startOffset, &endOffset); >- >- GUniquePtr<gchar> range(g_strdup_printf("{%d, %d}", startOffset, endOffset - startOffset)); >- return JSStringCreateWithUTF8CString(range.get()); >-} >- >-JSRetainPtr<JSStringRef> AccessibilityUIElement::rangeForPosition(int x, int y) >-{ >- // FIXME: implement >- return JSStringCreateWithCharacters(0, 0); >-} >- >-JSRetainPtr<JSStringRef> AccessibilityUIElement::boundsForRange(unsigned location, unsigned length) >-{ >- if (!ATK_IS_TEXT(m_element.get())) >- return JSStringCreateWithCharacters(0, 0); >- >- AtkTextRectangle rect; >- atk_text_get_range_extents(ATK_TEXT(m_element.get()), location, location + length, ATK_XY_WINDOW, &rect); >- >- GUniquePtr<gchar> bounds(g_strdup_printf("{%d, %d, %d, %d}", rect.x, rect.y, rect.width, rect.height)); >- return JSStringCreateWithUTF8CString(bounds.get()); >-} >- >-JSRetainPtr<JSStringRef> AccessibilityUIElement::stringForRange(unsigned location, unsigned length) >-{ >- if (!ATK_IS_TEXT(m_element.get())) >- return JSStringCreateWithCharacters(0, 0); >- >- String string = atk_text_get_text(ATK_TEXT(m_element.get()), location, location + length); >- return JSStringCreateWithUTF8CString(string.utf8().data()); >-} >- >-JSRetainPtr<JSStringRef> AccessibilityUIElement::attributedStringForRange(unsigned location, unsigned length) >-{ >- if (!ATK_IS_TEXT(m_element.get())) >- return JSStringCreateWithCharacters(0, 0); >- >- StringBuilder builder; >- >- // The default text attributes apply to the entire element. >- builder.append("\n\tDefault text attributes:\n\t\t", attributeSetToString(getAttributeSet(m_element.get(), TextAttributeType), "\n\t\t")); >- >- // The attribute run provides attributes specific to the range of text at the specified offset. >- AtkText* text = ATK_TEXT(m_element.get()); >- gint start = 0, end = 0; >- for (unsigned i = location; i < location + length; i = end) { >- AtkAttributeSet* attributeSet = atk_text_get_run_attributes(text, i, &start, &end); >- GUniquePtr<gchar> substring(replaceCharactersForResults(atk_text_get_text(text, start, end))); >- builder.append("\n\tRange attributes for '", substring.get(), "':\n\t\t", attributeSetToString(attributeSet, "\n\t\t")); >- } >- >- return JSStringCreateWithUTF8CString(builder.toString().utf8().data()); >-} >- >-bool AccessibilityUIElement::attributedStringRangeIsMisspelled(unsigned location, unsigned length) >-{ >- // FIXME: implement >- return false; >-} >- >-unsigned AccessibilityUIElement::uiElementCountForSearchPredicate(JSContextRef context, AccessibilityUIElement* startElement, bool isDirectionNext, JSValueRef searchKey, JSStringRef searchText, bool visibleOnly, bool immediateDescendantsOnly) >-{ >- // FIXME: implement >- return 0; >-} >- >-RefPtr<AccessibilityUIElement> AccessibilityUIElement::uiElementForSearchPredicate(JSContextRef context, AccessibilityUIElement* startElement, bool isDirectionNext, JSValueRef searchKey, JSStringRef searchText, bool visibleOnly, bool immediateDescendantsOnly) >-{ >- // FIXME: implement >- return nullptr; >-} >- >-JSRetainPtr<JSStringRef> AccessibilityUIElement::selectTextWithCriteria(JSContextRef context, JSStringRef ambiguityResolution, JSValueRef searchStrings, JSStringRef replacementString, JSStringRef activity) >-{ >- // FIXME: implement >- return nullptr; >-} >- >-JSRetainPtr<JSStringRef> AccessibilityUIElement::attributesOfColumnHeaders() >-{ >- if (!ATK_IS_TABLE(m_element.get())) >- return JSStringCreateWithCharacters(0, 0); >- >- Vector<RefPtr<AccessibilityUIElement> > columnHeaders = getTableColumnHeaders(ATK_TABLE(m_element.get())); >- return createStringWithAttributes(columnHeaders); >-} >- >-JSRetainPtr<JSStringRef> AccessibilityUIElement::attributesOfRowHeaders() >-{ >- if (!ATK_IS_TABLE(m_element.get())) >- return JSStringCreateWithCharacters(0, 0); >- >- Vector<RefPtr<AccessibilityUIElement> > rowHeaders = getTableRowHeaders(ATK_TABLE(m_element.get())); >- return createStringWithAttributes(rowHeaders); >-} >- >-JSRetainPtr<JSStringRef> AccessibilityUIElement::attributesOfColumns() >-{ >- // FIXME: implement >- return JSStringCreateWithCharacters(0, 0); >-} >- >-JSRetainPtr<JSStringRef> AccessibilityUIElement::attributesOfRows() >-{ >- // FIXME: implement >- return JSStringCreateWithCharacters(0, 0); >-} >- >-JSRetainPtr<JSStringRef> AccessibilityUIElement::attributesOfVisibleCells() >-{ >- if (!ATK_IS_TABLE(m_element.get())) >- return JSStringCreateWithCharacters(0, 0); >- >- Vector<RefPtr<AccessibilityUIElement> > visibleCells = getVisibleCells(this); >- return createStringWithAttributes(visibleCells); >-} >- >-JSRetainPtr<JSStringRef> AccessibilityUIElement::attributesOfHeader() >-{ >- // FIXME: implement >- return JSStringCreateWithCharacters(0, 0); >-} >- >-int AccessibilityUIElement::rowCount() >-{ >- if (!ATK_IS_TABLE(m_element.get())) >- return 0; >- >- return atk_table_get_n_rows(ATK_TABLE(m_element.get())); >-} >- >-int AccessibilityUIElement::columnCount() >-{ >- if (!ATK_IS_TABLE(m_element.get())) >- return 0; >- >- return atk_table_get_n_columns(ATK_TABLE(m_element.get())); >-} >- >-int AccessibilityUIElement::indexInTable() >-{ >- // FIXME: implement >- return -1; >-} >- >-JSRetainPtr<JSStringRef> AccessibilityUIElement::rowIndexRange() >-{ >- // Range in table for rows. >- return indexRangeInTable(m_element.get(), true); >-} >- >-JSRetainPtr<JSStringRef> AccessibilityUIElement::columnIndexRange() >-{ >- // Range in table for columns. >- return indexRangeInTable(m_element.get(), false); >-} >- >-RefPtr<AccessibilityUIElement> AccessibilityUIElement::cellForColumnAndRow(unsigned col, unsigned row) >-{ >- if (!ATK_IS_TABLE(m_element.get())) >- return nullptr; >- >- // Adopt the AtkObject representing the cell because >- // at_table_ref_at() transfers full ownership. >- GRefPtr<AtkObject> foundCell = adoptGRef(atk_table_ref_at(ATK_TABLE(m_element.get()), row, col)); >- return foundCell ? AccessibilityUIElement::create(foundCell.get()).ptr() : nullptr; >-} >- >-RefPtr<AccessibilityUIElement> AccessibilityUIElement::horizontalScrollbar() const >-{ >- // FIXME: implement >- return nullptr; >-} >- >-RefPtr<AccessibilityUIElement> AccessibilityUIElement::verticalScrollbar() const >-{ >- // FIXME: implement >- return nullptr; >-} >- >-JSRetainPtr<JSStringRef> AccessibilityUIElement::selectedTextRange() >-{ >- if (!ATK_IS_TEXT(m_element.get())) >- return JSStringCreateWithCharacters(0, 0); >- >- gint start, end; >- g_free(atk_text_get_selection(ATK_TEXT(m_element.get()), 0, &start, &end)); >- >- GUniquePtr<gchar> selection(g_strdup_printf("{%d, %d}", start, end - start)); >- return JSStringCreateWithUTF8CString(selection.get()); >-} >- >-bool AccessibilityUIElement::setSelectedTextRange(unsigned location, unsigned length) >-{ >- if (!ATK_IS_TEXT(m_element.get())) >- return false; >- >- if (!length) >- return atk_text_set_caret_offset(ATK_TEXT(m_element.get()), location); >- >- return atk_text_set_selection(ATK_TEXT(m_element.get()), 0, location, location + length); >-} >- >-void AccessibilityUIElement::increment() >-{ >- alterCurrentValue(m_element.get(), 1); >-} >- >-void AccessibilityUIElement::decrement() >-{ >- alterCurrentValue(m_element.get(), -1); >-} >- >-void AccessibilityUIElement::showMenu() >-{ >- // FIXME: implement >-} >- >-void AccessibilityUIElement::press() >-{ >- if (!ATK_IS_ACTION(m_element.get())) >- return; >- >- // Only one action per object is supported so far. >- atk_action_do_action(ATK_ACTION(m_element.get()), 0); >-} >- >-void AccessibilityUIElement::setSelectedChild(AccessibilityUIElement* element) const >-{ >- // FIXME: implement >-} >- >-void AccessibilityUIElement::setSelectedChildAtIndex(unsigned index) const >-{ >- if (!ATK_IS_SELECTION(m_element.get())) >- return; >- >- atk_selection_add_selection(ATK_SELECTION(m_element.get()), index); >-} >- >-void AccessibilityUIElement::removeSelectionAtIndex(unsigned index) const >-{ >- if (!ATK_IS_SELECTION(m_element.get())) >- return; >- >- atk_selection_remove_selection(ATK_SELECTION(m_element.get()), index); >-} >- >-void AccessibilityUIElement::clearSelectedChildren() const >-{ >- if (!ATK_IS_SELECTION(m_element.get())) >- return; >- >- atk_selection_clear_selection(ATK_SELECTION(m_element.get())); >-} >- >-JSRetainPtr<JSStringRef> AccessibilityUIElement::accessibilityValue() const >-{ >- // FIXME: implement >- return JSStringCreateWithCharacters(0, 0); >-} >- >-JSRetainPtr<JSStringRef> AccessibilityUIElement::documentEncoding() >-{ >- if (!ATK_IS_DOCUMENT(m_element.get())) >- return JSStringCreateWithCharacters(0, 0); >- >- AtkRole role = atk_object_get_role(ATK_OBJECT(m_element.get())); >- if (role != ATK_ROLE_DOCUMENT_WEB) >- return JSStringCreateWithCharacters(0, 0); >- >- return JSStringCreateWithUTF8CString(atk_document_get_attribute_value(ATK_DOCUMENT(m_element.get()), "Encoding")); >-} >- >-JSRetainPtr<JSStringRef> AccessibilityUIElement::documentURI() >-{ >- if (!ATK_IS_DOCUMENT(m_element.get())) >- return JSStringCreateWithCharacters(0, 0); >- >- AtkRole role = atk_object_get_role(ATK_OBJECT(m_element.get())); >- if (role != ATK_ROLE_DOCUMENT_WEB) >- return JSStringCreateWithCharacters(0, 0); >- >- return JSStringCreateWithUTF8CString(atk_document_get_attribute_value(ATK_DOCUMENT(m_element.get()), "URI")); >-} >- >-JSRetainPtr<JSStringRef> AccessibilityUIElement::url() >-{ >- if (!ATK_IS_HYPERLINK_IMPL(m_element.get())) >- return JSStringCreateWithCharacters(0, 0); >- >- AtkHyperlink* hyperlink = atk_hyperlink_impl_get_hyperlink(ATK_HYPERLINK_IMPL(m_element.get())); >- GUniquePtr<char> hyperlinkURI(atk_hyperlink_get_uri(hyperlink, 0)); >- >- if (!hyperlinkURI.get()) >- return JSStringCreateWithUTF8CString("AXURL: (null)"); >- >- // Build the result string, stripping the absolute URL paths if present. >- char* localURI = g_strstr_len(hyperlinkURI.get(), -1, "LayoutTests"); >- String axURL = makeString("AXURL: ", localURI ? localURI : hyperlinkURI.get()); >- return JSStringCreateWithUTF8CString(axURL.utf8().data()); >-} >- >-bool AccessibilityUIElement::addNotificationListener(JSValueRef functionCallback) >-{ >- if (!functionCallback) >- return false; >- >- // Only one notification listener per element. >- if (m_notificationHandler) >- return false; >- >- m_notificationHandler = AccessibilityNotificationHandler::create(); >- m_notificationHandler->setPlatformElement(platformUIElement()); >- m_notificationHandler->setNotificationFunctionCallback(functionCallback); >- >- return true; >-} >- >-bool AccessibilityUIElement::removeNotificationListener() >-{ >- // Programmers should not be trying to remove a listener that's already removed. >- ASSERT(m_notificationHandler); >- m_notificationHandler = nullptr; >- >- return true; >-} >- >-bool AccessibilityUIElement::isFocusable() const >-{ >- return checkElementState(m_element.get(), ATK_STATE_FOCUSABLE); >-} >- >-bool AccessibilityUIElement::isSelectable() const >-{ >- return checkElementState(m_element.get(), ATK_STATE_SELECTABLE); >-} >- >-bool AccessibilityUIElement::isMultiSelectable() const >-{ >- return checkElementState(m_element.get(), ATK_STATE_MULTISELECTABLE); >-} >- >-bool AccessibilityUIElement::isVisible() const >-{ >- return checkElementState(m_element.get(), ATK_STATE_VISIBLE); >-} >- >-bool AccessibilityUIElement::isOffScreen() const >-{ >- // FIXME: implement >- return false; >-} >- >-bool AccessibilityUIElement::isCollapsed() const >-{ >- // FIXME: implement >- return false; >-} >- >-bool AccessibilityUIElement::isIgnored() const >-{ >- // FIXME: implement >- return false; >-} >- >-bool AccessibilityUIElement::isSingleLine() const >-{ >- return checkElementState(m_element.get(), ATK_STATE_SINGLE_LINE); >-} >- >-bool AccessibilityUIElement::isMultiLine() const >-{ >- return checkElementState(m_element.get(), ATK_STATE_MULTI_LINE); >-} >- >-bool AccessibilityUIElement::hasPopup() const >-{ >- return checkElementState(m_element.get(), ATK_STATE_HAS_POPUP); >-} >- >-void AccessibilityUIElement::takeFocus() >-{ >- // FIXME: implement >-} >- >-void AccessibilityUIElement::takeSelection() >-{ >- // FIXME: implement >-} >- >-void AccessibilityUIElement::addSelection() >-{ >- // FIXME: implement >-} >- >-void AccessibilityUIElement::removeSelection() >-{ >- // FIXME: implement >-} >- >-// Text markers >-RefPtr<AccessibilityTextMarkerRange> AccessibilityUIElement::lineTextMarkerRangeForTextMarker(AccessibilityTextMarker* textMarker) >-{ >- // FIXME: implement >- return nullptr; >-} >- >-RefPtr<AccessibilityTextMarkerRange> AccessibilityUIElement::textMarkerRangeForElement(AccessibilityUIElement* element) >-{ >- // FIXME: implement >- return nullptr; >-} >- >-int AccessibilityUIElement::textMarkerRangeLength(AccessibilityTextMarkerRange* range) >-{ >- // FIXME: implement >- return 0; >-} >- >-RefPtr<AccessibilityTextMarker> AccessibilityUIElement::previousTextMarker(AccessibilityTextMarker* textMarker) >-{ >- // FIXME: implement >- return nullptr; >-} >- >-RefPtr<AccessibilityTextMarker> AccessibilityUIElement::nextTextMarker(AccessibilityTextMarker* textMarker) >-{ >- // FIXME: implement >- return nullptr; >-} >- >-JSRetainPtr<JSStringRef> AccessibilityUIElement::stringForTextMarkerRange(AccessibilityTextMarkerRange* markerRange) >-{ >- // FIXME: implement >- return JSStringCreateWithCharacters(0, 0); >-} >- >-JSRetainPtr<JSStringRef> AccessibilityUIElement::rectsForTextMarkerRange(AccessibilityTextMarkerRange* markerRange, JSStringRef searchText) >-{ >- // FIXME: implement >- return JSStringCreateWithCharacters(0, 0); >-} >- >-RefPtr<AccessibilityTextMarkerRange> AccessibilityUIElement::textMarkerRangeForMarkers(AccessibilityTextMarker* startMarker, AccessibilityTextMarker* endMarker) >-{ >- // FIXME: implement >- return nullptr; >-} >- >-RefPtr<AccessibilityTextMarker> AccessibilityUIElement::startTextMarkerForTextMarkerRange(AccessibilityTextMarkerRange* range) >-{ >- // FIXME: implement >- return nullptr; >-} >- >-RefPtr<AccessibilityTextMarker> AccessibilityUIElement::endTextMarkerForTextMarkerRange(AccessibilityTextMarkerRange* range) >-{ >- // FIXME: implement >- return nullptr; >-} >- >-RefPtr<AccessibilityTextMarker> AccessibilityUIElement::endTextMarkerForBounds(int x, int y, int width, int height) >-{ >- // FIXME: implement >- return nullptr; >-} >- >-RefPtr<AccessibilityTextMarker> AccessibilityUIElement::startTextMarkerForBounds(int x, int y, int width, int height) >-{ >- // FIXME: implement >- return nullptr; >-} >- >-RefPtr<AccessibilityTextMarker> AccessibilityUIElement::textMarkerForPoint(int x, int y) >-{ >- // FIXME: implement >- return nullptr; >-} >- >-RefPtr<AccessibilityUIElement> AccessibilityUIElement::accessibilityElementForTextMarker(AccessibilityTextMarker* marker) >-{ >- // FIXME: implement >- return nullptr; >-} >- >-JSRetainPtr<JSStringRef> AccessibilityUIElement::attributedStringForTextMarkerRange(AccessibilityTextMarkerRange*) >-{ >- return nullptr; >-} >- >-JSRetainPtr<JSStringRef> AccessibilityUIElement::attributedStringForTextMarkerRangeWithOptions(AccessibilityTextMarkerRange*, bool) >-{ >- return nullptr; >-} >- >-bool AccessibilityUIElement::attributedStringForTextMarkerRangeContainsAttribute(JSStringRef attribute, AccessibilityTextMarkerRange* range) >-{ >- // FIXME: implement >- return false; >-} >- >-int AccessibilityUIElement::indexForTextMarker(AccessibilityTextMarker* marker) >-{ >- // FIXME: implement >- return -1; >-} >- >-bool AccessibilityUIElement::isTextMarkerValid(AccessibilityTextMarker* textMarker) >-{ >- // FIXME: implement >- return false; >-} >- >-RefPtr<AccessibilityTextMarker> AccessibilityUIElement::textMarkerForIndex(int textIndex) >-{ >- // FIXME: implement >- return nullptr; >-} >- >-RefPtr<AccessibilityTextMarker> AccessibilityUIElement::startTextMarker() >-{ >- // FIXME: implement >- return nullptr; >-} >- >-RefPtr<AccessibilityTextMarker> AccessibilityUIElement::endTextMarker() >-{ >- // FIXME: implement >- return nullptr; >-} >- >-bool AccessibilityUIElement::setSelectedTextMarkerRange(AccessibilityTextMarkerRange*) >-{ >- return false; >-} >- >-void AccessibilityUIElement::scrollToMakeVisible() >-{ >-#if ATK_CHECK_VERSION(2, 30, 0) >- if (!ATK_IS_COMPONENT(m_element.get())) >- return; >- >- atk_component_scroll_to(ATK_COMPONENT(m_element.get()), ATK_SCROLL_ANYWHERE); >-#endif >-} >- >-void AccessibilityUIElement::scrollToGlobalPoint(int x, int y) >-{ >-#if ATK_CHECK_VERSION(2, 30, 0) >- if (!ATK_IS_COMPONENT(m_element.get())) >- return; >- >- atk_component_scroll_to_point(ATK_COMPONENT(m_element.get()), ATK_XY_WINDOW, x, y); >-#endif >-} >- >-void AccessibilityUIElement::scrollToMakeVisibleWithSubFocus(int x, int y, int width, int height) >-{ >- // FIXME: implement >-} >- >-JSRetainPtr<JSStringRef> AccessibilityUIElement::supportedActions() const >-{ >- // FIXME: implement >- return nullptr; >-} >- >-JSRetainPtr<JSStringRef> AccessibilityUIElement::pathDescription() const >-{ >- notImplemented(); >- return nullptr; >-} >- >-JSRetainPtr<JSStringRef> AccessibilityUIElement::mathPostscriptsDescription() const >-{ >- notImplemented(); >- return nullptr; >-} >- >-JSRetainPtr<JSStringRef> AccessibilityUIElement::mathPrescriptsDescription() const >-{ >- notImplemented(); >- return nullptr; >-} >- >-JSRetainPtr<JSStringRef> AccessibilityUIElement::classList() const >-{ >- notImplemented(); >- return nullptr; >-} >- >-JSRetainPtr<JSStringRef> stringAtOffset(PlatformUIElement element, AtkTextBoundary boundary, int offset) >-{ >- if (!ATK_IS_TEXT(element.get())) >- return JSStringCreateWithCharacters(0, 0); >- >- gint startOffset, endOffset; >- StringBuilder builder; >- >- AtkTextGranularity granularity; >- switch (boundary) { >- case ATK_TEXT_BOUNDARY_CHAR: >- granularity = ATK_TEXT_GRANULARITY_CHAR; >- break; >- case ATK_TEXT_BOUNDARY_WORD_START: >- granularity = ATK_TEXT_GRANULARITY_WORD; >- break; >- case ATK_TEXT_BOUNDARY_LINE_START: >- granularity = ATK_TEXT_GRANULARITY_LINE; >- break; >- case ATK_TEXT_BOUNDARY_SENTENCE_START: >- granularity = ATK_TEXT_GRANULARITY_SENTENCE; >- break; >- default: >- return JSStringCreateWithCharacters(0, 0); >- } >- >- builder.append(atk_text_get_string_at_offset(ATK_TEXT(element.get()), offset, granularity, &startOffset, &endOffset)); >- builder.append(", ", startOffset, ", ", endOffset); >- >- return JSStringCreateWithUTF8CString(builder.toString().utf8().data()); >-} >- >-JSRetainPtr<JSStringRef> AccessibilityUIElement::characterAtOffset(int offset) >-{ >- return stringAtOffset(m_element, ATK_TEXT_BOUNDARY_CHAR, offset); >-} >- >-JSRetainPtr<JSStringRef> AccessibilityUIElement::wordAtOffset(int offset) >-{ >- return stringAtOffset(m_element, ATK_TEXT_BOUNDARY_WORD_START, offset); >-} >- >-JSRetainPtr<JSStringRef> AccessibilityUIElement::lineAtOffset(int offset) >-{ >- return stringAtOffset(m_element, ATK_TEXT_BOUNDARY_LINE_START, offset); >-} >- >-JSRetainPtr<JSStringRef> AccessibilityUIElement::sentenceAtOffset(int offset) >-{ >- return stringAtOffset(m_element, ATK_TEXT_BOUNDARY_SENTENCE_START, offset); >-} >- >-bool AccessibilityUIElement::replaceTextInRange(JSStringRef, int, int) >-{ >- notImplemented(); >- return false; >-} >- >-bool AccessibilityUIElement::insertText(JSStringRef) >-{ >- notImplemented(); >- return false; >-} >- >-JSRetainPtr<JSStringRef> AccessibilityUIElement::popupValue() const >-{ >- notImplemented(); >- return nullptr; >-} >- >-} // namespace WTR >- >-#endif // ENABLE(ACCESSIBILITY) && USE(ATK) >diff --git a/Tools/WebKitTestRunner/PlatformGTK.cmake b/Tools/WebKitTestRunner/PlatformGTK.cmake >index 44ebbc300336..a87adedcc0e1 100644 >--- a/Tools/WebKitTestRunner/PlatformGTK.cmake >+++ b/Tools/WebKitTestRunner/PlatformGTK.cmake >@@ -22,14 +22,12 @@ list(APPEND WebKitTestRunner_SYSTEM_INCLUDE_DIRECTORIES > ) > > list(APPEND WebKitTestRunner_LIBRARIES >- ${ATK_LIBRARIES} > ${GLIB_LIBRARIES} > Cairo::Cairo > GTK::GTK > ) > > list(APPEND WebKitTestRunnerInjectedBundle_LIBRARIES >- ${ATK_LIBRARIES} > ${GLIB_LIBRARIES} > Fontconfig::Fontconfig > GTK::GTK >@@ -40,10 +38,6 @@ list(APPEND WebKitTestRunner_FRAMEWORKS > ) > > list(APPEND WebKitTestRunnerInjectedBundle_SOURCES >- InjectedBundle/atk/AccessibilityControllerAtk.cpp >- InjectedBundle/atk/AccessibilityNotificationHandlerAtk.cpp >- InjectedBundle/atk/AccessibilityUIElementAtk.cpp >- > InjectedBundle/atspi/AccessibilityControllerAtspi.cpp > InjectedBundle/atspi/AccessibilityNotificationHandler.cpp > InjectedBundle/atspi/AccessibilityUIElementAtspi.cpp >@@ -55,9 +49,7 @@ list(APPEND WebKitTestRunnerInjectedBundle_SOURCES > ) > > list(APPEND WebKitTestRunnerInjectedBundle_INCLUDE_DIRECTORIES >- ${ATK_INCLUDE_DIRS} > ${GLIB_INCLUDE_DIRS} >- ${WebKitTestRunner_DIR}/InjectedBundle/atk > ${WebKitTestRunner_DIR}/InjectedBundle/atspi > ${WebKitTestRunner_DIR}/InjectedBundle/gtk > ) >diff --git a/Tools/WebKitTestRunner/PlatformWPE.cmake b/Tools/WebKitTestRunner/PlatformWPE.cmake >index f6b59db3c0ee..4f3640a8b938 100644 >--- a/Tools/WebKitTestRunner/PlatformWPE.cmake >+++ b/Tools/WebKitTestRunner/PlatformWPE.cmake >@@ -19,7 +19,6 @@ list(APPEND WebKitTestRunner_INCLUDE_DIRECTORIES > ) > > list(APPEND WebKitTestRunner_SYSTEM_INCLUDE_DIRECTORIES >- ${ATK_INCLUDE_DIRS} > ${GLIB_INCLUDE_DIRS} > ${LIBXKBCOMMON_INCLUDE_DIRS} > ${WPEBACKEND_FDO_INCLUDE_DIRS} >@@ -35,16 +34,11 @@ list(APPEND WebKitTestRunner_LIBRARIES > > list(APPEND WebKitTestRunnerInjectedBundle_LIBRARIES > $<TARGET_OBJECTS:JavaScriptCore> >- ${ATK_LIBRARIES} > ${GLIB_LIBRARIES} > Cairo::Cairo > ) > > list(APPEND WebKitTestRunnerInjectedBundle_SOURCES >- InjectedBundle/atk/AccessibilityControllerAtk.cpp >- InjectedBundle/atk/AccessibilityNotificationHandlerAtk.cpp >- InjectedBundle/atk/AccessibilityUIElementAtk.cpp >- > InjectedBundle/atspi/AccessibilityControllerAtspi.cpp > InjectedBundle/atspi/AccessibilityNotificationHandler.cpp > InjectedBundle/atspi/AccessibilityUIElementAtspi.cpp >@@ -55,9 +49,7 @@ list(APPEND WebKitTestRunnerInjectedBundle_SOURCES > ) > > list(APPEND WebKitTestRunnerInjectedBundle_INCLUDE_DIRECTORIES >- ${ATK_INCLUDE_DIRS} > ${GLIB_INCLUDE_DIRS} >- ${WebKitTestRunner_DIR}/InjectedBundle/atk > ${WebKitTestRunner_DIR}/InjectedBundle/atspi > ${WebKitTestRunner_DIR}/InjectedBundle/wpe > ) >diff --git a/Tools/WebKitTestRunner/TestOptions.cpp b/Tools/WebKitTestRunner/TestOptions.cpp >index 7e773a5f8889..faf3b1e9d83d 100644 >--- a/Tools/WebKitTestRunner/TestOptions.cpp >+++ b/Tools/WebKitTestRunner/TestOptions.cpp >@@ -97,9 +97,6 @@ const TestFeatures& TestOptions::defaults() > { "InputTypeMonthEnabled", true }, > { "InputTypeTimeEnabled", true }, > { "InputTypeWeekEnabled", true }, >-#if USE(ATSPI) >- { "IsAccessibilityIsolatedTreeEnabled", true }, >-#endif > { "JavaScriptCanAccessClipboard", true }, > { "JavaScriptCanOpenWindowsAutomatically", true }, > { "LargeImageAsyncDecodingEnabled", false },
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
aperez
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 238198
: 455358