<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[245101] releases/WebKitGTK/webkit-2.24/Source/WebCore</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/245101">245101</a></dd>
<dt>Author</dt> <dd>carlosgc@webkit.org</dd>
<dt>Date</dt> <dd>2019-05-09 01:29:32 -0700 (Thu, 09 May 2019)</dd>
</dl>

<h3>Log Message</h3>
<pre>Merge <a href="http://trac.webkit.org/projects/webkit/changeset/243970">r243970</a> - [ATK] Cleanup accessible wrapper base class
https://bugs.webkit.org/show_bug.cgi?id=196601

Reviewed by Mario Sanchez Prada.

Cleanups:

 - Rename WebKitAccessibleWrapperAtk cpp and header as WebKitAccessible for consistency with the class name.
 - Use WEBKIT_DEFINE_TYPE instead of custom type registration. This ensures that all CStrings used in private
   struct are no longer leaked.
 - Move core object pointer to the private struct.
 - Remove confusing core() function and simply get the core object from the private struct.
 - Use nullptr instead of 0 and other coding style issues.
 - Rename cacheAndReturnAtkProperty as webkitAccessibleCacheAndReturnAtkProperty and use WebKitAccessible as
   instance parameter.
 - Make webkitAccessibleGetAccessibilityObject() return a reference, since we use a fallback object on detach it
   never returns nullptr.
 - Move objectFocusedAndCaretOffsetUnignored() to WebKitAccessibleUtil.

* SourcesGTK.txt:
* accessibility/atk/AXObjectCacheAtk.cpp:
* accessibility/atk/WebKitAccessible.cpp: Renamed from Source/WebCore/accessibility/atk/WebKitAccessibleWrapperAtk.cpp.
(webkitAccessibleGetName):
(webkitAccessibleGetDescription):
(setAtkRelationSetFromCoreObject):
(isRootObject):
(webkitAccessibleGetParent):
(webkitAccessibleGetNChildren):
(webkitAccessibleRefChild):
(webkitAccessibleGetIndexInParent):
(webkitAccessibleGetAttributes):
(atkRole):
(webkitAccessibleGetRole):
(webkitAccessibleRefStateSet):
(webkitAccessibleRefRelationSet):
(webkitAccessibleInit):
(webkitAccessibleGetObjectLocale):
(webkit_accessible_class_init):
(interfaceMaskFromObject):
(uniqueAccessibilityTypeName):
(accessibilityTypeFromObject):
(webkitAccessibleNew):
(webkitAccessibleGetAccessibilityObject):
(webkitAccessibleDetach):
(webkitAccessibleIsDetached):
(webkitAccessibleCacheAndReturnAtkProperty):
* accessibility/atk/WebKitAccessible.h: Renamed from Source/WebCore/accessibility/atk/WebKitAccessibleWrapperAtk.h.
* accessibility/atk/WebKitAccessibleHyperlink.cpp:
(core):
* accessibility/atk/WebKitAccessibleInterfaceAction.cpp:
(core):
(webkitAccessibleActionGetKeybinding):
(webkitAccessibleActionGetName):
* accessibility/atk/WebKitAccessibleInterfaceComponent.cpp:
(core):
* accessibility/atk/WebKitAccessibleInterfaceDocument.cpp:
(core):
(documentAttributeValue):
* accessibility/atk/WebKitAccessibleInterfaceEditableText.cpp:
(core):
* accessibility/atk/WebKitAccessibleInterfaceHypertext.cpp:
(core):
* accessibility/atk/WebKitAccessibleInterfaceImage.cpp:
(core):
(webkitAccessibleImageGetImageDescription):
* accessibility/atk/WebKitAccessibleInterfaceSelection.cpp:
(core):
* accessibility/atk/WebKitAccessibleInterfaceTable.cpp:
(core):
* accessibility/atk/WebKitAccessibleInterfaceTableCell.cpp:
(core):
* accessibility/atk/WebKitAccessibleInterfaceText.cpp:
(core):
* accessibility/atk/WebKitAccessibleInterfaceValue.cpp:
(core):
* accessibility/atk/WebKitAccessibleUtil.cpp:
(objectFocusedAndCaretOffsetUnignored):
* accessibility/atk/WebKitAccessibleUtil.h:
* editing/atk/FrameSelectionAtk.cpp:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#releasesWebKitGTKwebkit224SourceWebCoreChangeLog">releases/WebKitGTK/webkit-2.24/Source/WebCore/ChangeLog</a></li>
<li><a href="#releasesWebKitGTKwebkit224SourceWebCoreSourcesGTKtxt">releases/WebKitGTK/webkit-2.24/Source/WebCore/SourcesGTK.txt</a></li>
<li><a href="#releasesWebKitGTKwebkit224SourceWebCoreaccessibilityatkAXObjectCacheAtkcpp">releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/atk/AXObjectCacheAtk.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit224SourceWebCoreaccessibilityatkWebKitAccessibleHyperlinkcpp">releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/atk/WebKitAccessibleHyperlink.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit224SourceWebCoreaccessibilityatkWebKitAccessibleInterfaceActioncpp">releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceAction.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit224SourceWebCoreaccessibilityatkWebKitAccessibleInterfaceComponentcpp">releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceComponent.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit224SourceWebCoreaccessibilityatkWebKitAccessibleInterfaceDocumentcpp">releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceDocument.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit224SourceWebCoreaccessibilityatkWebKitAccessibleInterfaceEditableTextcpp">releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceEditableText.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit224SourceWebCoreaccessibilityatkWebKitAccessibleInterfaceHypertextcpp">releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceHypertext.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit224SourceWebCoreaccessibilityatkWebKitAccessibleInterfaceImagecpp">releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceImage.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit224SourceWebCoreaccessibilityatkWebKitAccessibleInterfaceSelectioncpp">releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceSelection.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit224SourceWebCoreaccessibilityatkWebKitAccessibleInterfaceTablecpp">releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceTable.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit224SourceWebCoreaccessibilityatkWebKitAccessibleInterfaceTableCellcpp">releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceTableCell.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit224SourceWebCoreaccessibilityatkWebKitAccessibleInterfaceTextcpp">releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceText.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit224SourceWebCoreaccessibilityatkWebKitAccessibleInterfaceValuecpp">releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceValue.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit224SourceWebCoreaccessibilityatkWebKitAccessibleUtilcpp">releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/atk/WebKitAccessibleUtil.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit224SourceWebCoreaccessibilityatkWebKitAccessibleUtilh">releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/atk/WebKitAccessibleUtil.h</a></li>
<li><a href="#releasesWebKitGTKwebkit224SourceWebCoreeditingatkFrameSelectionAtkcpp">releases/WebKitGTK/webkit-2.24/Source/WebCore/editing/atk/FrameSelectionAtk.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#releasesWebKitGTKwebkit224SourceWebCoreaccessibilityatkWebKitAccessiblecpp">releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/atk/WebKitAccessible.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit224SourceWebCoreaccessibilityatkWebKitAccessibleh">releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/atk/WebKitAccessible.h</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#releasesWebKitGTKwebkit224SourceWebCoreaccessibilityatkWebKitAccessibleWrapperAtkcpp">releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/atk/WebKitAccessibleWrapperAtk.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit224SourceWebCoreaccessibilityatkWebKitAccessibleWrapperAtkh">releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/atk/WebKitAccessibleWrapperAtk.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="releasesWebKitGTKwebkit224SourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.24/Source/WebCore/ChangeLog (245100 => 245101)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.24/Source/WebCore/ChangeLog  2019-05-09 08:29:23 UTC (rev 245100)
+++ releases/WebKitGTK/webkit-2.24/Source/WebCore/ChangeLog     2019-05-09 08:29:32 UTC (rev 245101)
</span><span class="lines">@@ -1,3 +1,85 @@
</span><ins>+2019-04-08  Carlos Garcia Campos  <cgarcia@igalia.com>
+
+        [ATK] Cleanup accessible wrapper base class
+        https://bugs.webkit.org/show_bug.cgi?id=196601
+
+        Reviewed by Mario Sanchez Prada.
+
+        Cleanups:
+
+         - Rename WebKitAccessibleWrapperAtk cpp and header as WebKitAccessible for consistency with the class name.
+         - Use WEBKIT_DEFINE_TYPE instead of custom type registration. This ensures that all CStrings used in private
+           struct are no longer leaked.
+         - Move core object pointer to the private struct.
+         - Remove confusing core() function and simply get the core object from the private struct.
+         - Use nullptr instead of 0 and other coding style issues.
+         - Rename cacheAndReturnAtkProperty as webkitAccessibleCacheAndReturnAtkProperty and use WebKitAccessible as
+           instance parameter.
+         - Make webkitAccessibleGetAccessibilityObject() return a reference, since we use a fallback object on detach it
+           never returns nullptr.
+         - Move objectFocusedAndCaretOffsetUnignored() to WebKitAccessibleUtil.
+
+        * SourcesGTK.txt:
+        * accessibility/atk/AXObjectCacheAtk.cpp:
+        * accessibility/atk/WebKitAccessible.cpp: Renamed from Source/WebCore/accessibility/atk/WebKitAccessibleWrapperAtk.cpp.
+        (webkitAccessibleGetName):
+        (webkitAccessibleGetDescription):
+        (setAtkRelationSetFromCoreObject):
+        (isRootObject):
+        (webkitAccessibleGetParent):
+        (webkitAccessibleGetNChildren):
+        (webkitAccessibleRefChild):
+        (webkitAccessibleGetIndexInParent):
+        (webkitAccessibleGetAttributes):
+        (atkRole):
+        (webkitAccessibleGetRole):
+        (webkitAccessibleRefStateSet):
+        (webkitAccessibleRefRelationSet):
+        (webkitAccessibleInit):
+        (webkitAccessibleGetObjectLocale):
+        (webkit_accessible_class_init):
+        (interfaceMaskFromObject):
+        (uniqueAccessibilityTypeName):
+        (accessibilityTypeFromObject):
+        (webkitAccessibleNew):
+        (webkitAccessibleGetAccessibilityObject):
+        (webkitAccessibleDetach):
+        (webkitAccessibleIsDetached):
+        (webkitAccessibleCacheAndReturnAtkProperty):
+        * accessibility/atk/WebKitAccessible.h: Renamed from Source/WebCore/accessibility/atk/WebKitAccessibleWrapperAtk.h.
+        * accessibility/atk/WebKitAccessibleHyperlink.cpp:
+        (core):
+        * accessibility/atk/WebKitAccessibleInterfaceAction.cpp:
+        (core):
+        (webkitAccessibleActionGetKeybinding):
+        (webkitAccessibleActionGetName):
+        * accessibility/atk/WebKitAccessibleInterfaceComponent.cpp:
+        (core):
+        * accessibility/atk/WebKitAccessibleInterfaceDocument.cpp:
+        (core):
+        (documentAttributeValue):
+        * accessibility/atk/WebKitAccessibleInterfaceEditableText.cpp:
+        (core):
+        * accessibility/atk/WebKitAccessibleInterfaceHypertext.cpp:
+        (core):
+        * accessibility/atk/WebKitAccessibleInterfaceImage.cpp:
+        (core):
+        (webkitAccessibleImageGetImageDescription):
+        * accessibility/atk/WebKitAccessibleInterfaceSelection.cpp:
+        (core):
+        * accessibility/atk/WebKitAccessibleInterfaceTable.cpp:
+        (core):
+        * accessibility/atk/WebKitAccessibleInterfaceTableCell.cpp:
+        (core):
+        * accessibility/atk/WebKitAccessibleInterfaceText.cpp:
+        (core):
+        * accessibility/atk/WebKitAccessibleInterfaceValue.cpp:
+        (core):
+        * accessibility/atk/WebKitAccessibleUtil.cpp:
+        (objectFocusedAndCaretOffsetUnignored):
+        * accessibility/atk/WebKitAccessibleUtil.h:
+        * editing/atk/FrameSelectionAtk.cpp:
+
</ins><span class="cx"> 2019-04-05  Carlos Garcia Campos  <cgarcia@igalia.com>
</span><span class="cx"> 
</span><span class="cx">         [ATK] Use a smart pointer for AccessibilityObject wrapper and remove GTK specific code
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit224SourceWebCoreSourcesGTKtxt"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.24/Source/WebCore/SourcesGTK.txt (245100 => 245101)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.24/Source/WebCore/SourcesGTK.txt     2019-05-09 08:29:23 UTC (rev 245100)
+++ releases/WebKitGTK/webkit-2.24/Source/WebCore/SourcesGTK.txt        2019-05-09 08:29:32 UTC (rev 245101)
</span><span class="lines">@@ -23,6 +23,7 @@
</span><span class="cx"> 
</span><span class="cx"> accessibility/atk/AXObjectCacheAtk.cpp
</span><span class="cx"> accessibility/atk/AccessibilityObjectAtk.cpp
</span><ins>+accessibility/atk/WebKitAccessible.cpp
</ins><span class="cx"> accessibility/atk/WebKitAccessibleHyperlink.cpp
</span><span class="cx"> accessibility/atk/WebKitAccessibleInterfaceAction.cpp @no-unify
</span><span class="cx"> accessibility/atk/WebKitAccessibleInterfaceComponent.cpp
</span><span class="lines">@@ -37,7 +38,6 @@
</span><span class="cx"> accessibility/atk/WebKitAccessibleInterfaceText.cpp
</span><span class="cx"> accessibility/atk/WebKitAccessibleInterfaceValue.cpp
</span><span class="cx"> accessibility/atk/WebKitAccessibleUtil.cpp
</span><del>-accessibility/atk/WebKitAccessibleWrapperAtk.cpp
</del><span class="cx"> 
</span><span class="cx"> editing/atk/FrameSelectionAtk.cpp
</span><span class="cx"> 
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit224SourceWebCoreaccessibilityatkAXObjectCacheAtkcpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/atk/AXObjectCacheAtk.cpp (245100 => 245101)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/atk/AXObjectCacheAtk.cpp     2019-05-09 08:29:23 UTC (rev 245100)
+++ releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/atk/AXObjectCacheAtk.cpp        2019-05-09 08:29:32 UTC (rev 245101)
</span><span class="lines">@@ -29,7 +29,7 @@
</span><span class="cx"> #include "HTMLSelectElement.h"
</span><span class="cx"> #include "Range.h"
</span><span class="cx"> #include "TextIterator.h"
</span><del>-#include "WebKitAccessibleWrapperAtk.h"
</del><ins>+#include "WebKitAccessible.h"
</ins><span class="cx"> #include <wtf/NeverDestroyed.h>
</span><span class="cx"> #include <wtf/glib/GRefPtr.h>
</span><span class="cx"> #include <wtf/text/CString.h>
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit224SourceWebCoreaccessibilityatkWebKitAccessiblecppfromrev245100releasesWebKitGTKwebkit224SourceWebCoreaccessibilityatkWebKitAccessibleWrapperAtkcpp"></a>
<div class="copfile"><h4>Copied: releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/atk/WebKitAccessible.cpp (from rev 245100, releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/atk/WebKitAccessibleWrapperAtk.cpp) (0 => 245101)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/atk/WebKitAccessible.cpp                             (rev 0)
+++ releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/atk/WebKitAccessible.cpp        2019-05-09 08:29:32 UTC (rev 245101)
</span><span class="lines">@@ -0,0 +1,1392 @@
</span><ins>+/*
+ * 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 HAVE(ACCESSIBILITY)
+
+#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 "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 AccessibilityObject* fallbackObject()
+{
+    static AccessibilityObject* object = &AccessibilityListBoxOption::create().leakRef();
+    return object;
+}
+
+static const gchar* webkitAccessibleGetName(AtkObject* object)
+{
+    auto* accessible = WEBKIT_ACCESSIBLE(object);
+    returnValIfWebKitAccessibleIsInvalid(accessible, nullptr);
+
+    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);
+
+    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;
+    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);
+
+    return accessible->priv->object->children().size();
+}
+
+static AtkObject* webkitAccessibleRefChild(AtkObject* object, gint index)
+{
+    auto* accessible = WEBKIT_ACCESSIBLE(object);
+    returnValIfWebKitAccessibleIsInvalid(accessible, nullptr);
+
+    if (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 = ATK_OBJECT(coreChild->wrapper());
+    atk_object_set_parent(child, object);
+    g_object_ref(child);
+
+    return child;
+}
+
+static gint webkitAccessibleGetIndexInParent(AtkObject* object)
+{
+    auto* accessible = WEBKIT_ACCESSIBLE(object);
+    returnValIfWebKitAccessibleIsInvalid(accessible, -1);
+
+    auto* coreObject = accessible->priv->object;
+    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 == WTF::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");
+#endif
+
+    auto* coreObject = accessible->priv->object;
+
+    // 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).isExposableThroughAccessibility()) {
+        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->hasPopupValue().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.
+        if (coreObject->ariaRoleAttribute() == AccessibilityRole::Unknown && coreObject->isLandmark())
+            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 isAtomic = 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 (isAtomic)
+            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 (isAtomic)
+                attributeSet = addToAtkAttributeSet(attributeSet, "atomic", "true");
+        } else if (!isAtomic && 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->isARIAGrabbed())
+        attributeSet = addToAtkAttributeSet(attributeSet, "grabbed", "true");
+    else if (coreObject->supportsARIADragging())
+        attributeSet = addToAtkAttributeSet(attributeSet, "grabbed", "false");
+
+    // The Core AAM states the author-provided value should be exposed as-is.
+    const AtomicString& 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_ALERT;
+    case AccessibilityRole::ApplicationAlertDialog:
+    case AccessibilityRole::ApplicationDialog:
+        return ATK_ROLE_DIALOG;
+    case AccessibilityRole::ApplicationStatus:
+        return ATK_ROLE_STATUSBAR;
+    case AccessibilityRole::Unknown:
+        return ATK_ROLE_UNKNOWN;
+    case AccessibilityRole::Audio:
+#if ATK_CHECK_VERSION(2, 11, 3)
+        return ATK_ROLE_AUDIO;
+#endif
+    case AccessibilityRole::Video:
+#if ATK_CHECK_VERSION(2, 11, 3)
+        return ATK_ROLE_VIDEO;
+#endif
+        return ATK_ROLE_EMBEDDED;
+    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:
+#if ATK_CHECK_VERSION(2, 15, 2)
+        return ATK_ROLE_STATIC;
+#else
+        return ATK_ROLE_TEXT;
+#endif
+    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::BusyIndicator:
+        return ATK_ROLE_PROGRESS_BAR; // Is this right?
+    case AccessibilityRole::ProgressIndicator:
+        return coreObject->isMeter() ? ATK_ROLE_LEVEL_BAR : 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;
+    case AccessibilityRole::ColorWell:
+#if PLATFORM(GTK)
+        // 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:
+#if ATK_CHECK_VERSION(2, 11, 3)
+        return ATK_ROLE_ARTICLE;
+#endif
+    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:
+#if ATK_CHECK_VERSION(2, 11, 3)
+        return ATK_ROLE_BLOCK_QUOTE;
+#endif
+    case AccessibilityRole::Footnote:
+#if ATK_CHECK_VERSION(2, 25, 2)
+        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 ATK_CHECK_VERSION(2, 11, 3)
+        if (coreObject->ariaRoleAttribute() != AccessibilityRole::Unknown)
+            return ATK_ROLE_LANDMARK;
+#endif
+        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;
+#if ATK_CHECK_VERSION(2, 11, 3)
+    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 ATK_CHECK_VERSION(2, 15, 4)
+        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;
+#endif
+#if ATK_CHECK_VERSION(2, 15, 2)
+        if (coreObject->isMathToken())
+            return ATK_ROLE_STATIC;
+#endif
+        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;
+#endif
+#if ATK_CHECK_VERSION(2, 11, 4)
+    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;
+#endif
+    case AccessibilityRole::Inline:
+#if ATK_CHECK_VERSION(2, 15, 4)
+        if (coreObject->isSubscriptStyleGroup())
+            return ATK_ROLE_SUBSCRIPT;
+        if (coreObject->isSuperscriptStyleGroup())
+            return ATK_ROLE_SUPERSCRIPT;
+#endif
+#if ATK_CHECK_VERSION(2, 15, 2)
+        return ATK_ROLE_STATIC;
+    case AccessibilityRole::SVGTextPath:
+    case AccessibilityRole::SVGTSpan:
+    case AccessibilityRole::Time:
+        return ATK_ROLE_STATIC;
+#endif
+    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);
+
+    // 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 ATK_CHECK_VERSION(2,11,2)
+    if (coreObject->supportsChecked() && coreObject->canSetValueAttribute())
+        atk_state_set_add_state(stateSet, ATK_STATE_CHECKABLE);
+#endif
+
+    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 ATK_CHECK_VERSION(2,15,3)
+    if (!coreObject->canSetValueAttribute() && (coreObject->supportsReadOnly()))
+        atk_state_set_add_state(stateSet, ATK_STATE_READ_ONLY);
+#endif
+
+    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.
+    accessible->priv->object->updateBackingStore();
+
+    if (accessible->priv->object == fallbackObject()) {
+        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);
+    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 (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},
+#if ATK_CHECK_VERSION(2,11,90)
+    {reinterpret_cast<GInterfaceInitFunc>(reinterpret_cast<GCallback>(webkitAccessibleTableCellInterfaceInit)), nullptr, nullptr},
+#endif
+    {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,
+#if ATK_CHECK_VERSION(2,11,90)
+    WAITableCell,
+#endif
+    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;
+#if ATK_CHECK_VERSION(2,11,90)
+    case WAITableCell:
+        return ATK_TYPE_TABLE_CELL;
+#endif
+    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;
+}
+
+static guint16 interfaceMaskFromObject(AccessibilityObject* 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->isReplaced()))
+        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 ATK_CHECK_VERSION(2,11,90)
+    if (role == AccessibilityRole::Cell || role == AccessibilityRole::GridCell || role == AccessibilityRole::ColumnHeader || role == AccessibilityRole::RowHeader)
+        interfaceMask |= 1 << WAITableCell;
+#endif
+
+    // 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));
+    return *accessible->priv->object;
+}
+
+void webkitAccessibleDetach(WebKitAccessible* accessible)
+{
+    ASSERT(WEBKIT_IS_ACCESSIBLE(accessible));
+    ASSERT(accessible->priv->object != fallbackObject());
+
+    if (accessible->priv->object->roleValue() == AccessibilityRole::WebArea)
+        atk_object_notify_state_change(ATK_OBJECT(accessible), ATK_STATE_DEFUNCT, TRUE);
+
+    // We replace the WebCore AccessibilityObject with a fallback object that
+    // provides default implementations to avoid repetitive null-checking after
+    // detachment.
+    accessible->priv->object = fallbackObject();
+}
+
+bool webkitAccessibleIsDetached(WebKitAccessible* accessible)
+{
+    ASSERT(WEBKIT_IS_ACCESSIBLE(accessible));
+    return accessible->priv->object == fallbackObject();
+}
+
+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 // HAVE(ACCESSIBILITY)
</ins></span></pre></div>
<a id="releasesWebKitGTKwebkit224SourceWebCoreaccessibilityatkWebKitAccessiblehfromrev245100releasesWebKitGTKwebkit224SourceWebCoreaccessibilityatkWebKitAccessibleWrapperAtkh"></a>
<div class="copfile"><h4>Copied: releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/atk/WebKitAccessible.h (from rev 245100, releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/atk/WebKitAccessibleWrapperAtk.h) (0 => 245101)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/atk/WebKitAccessible.h                               (rev 0)
+++ releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/atk/WebKitAccessible.h  2019-05-09 08:29:32 UTC (rev 245101)
</span><span class="lines">@@ -0,0 +1,84 @@
</span><ins>+/*
+ * 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 HAVE(ACCESSIBILITY)
+
+#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;
+};
+
+enum AtkCachedProperty {
+    AtkCachedAccessibleName,
+    AtkCachedAccessibleDescription,
+    AtkCachedActionName,
+    AtkCachedActionKeyBinding,
+    AtkCachedDocumentLocale,
+    AtkCachedDocumentType,
+    AtkCachedDocumentEncoding,
+    AtkCachedDocumentURI,
+    AtkCachedImageDescription
+};
+
+GType webkit_accessible_get_type(void);
+
+WebKitAccessible* webkitAccessibleNew(WebCore::AccessibilityObject*);
+
+WebCore::AccessibilityObject& webkitAccessibleGetAccessibilityObject(WebKitAccessible*);
+
+void webkitAccessibleDetach(WebKitAccessible*);
+
+bool webkitAccessibleIsDetached(WebKitAccessible*);
+
+const char* webkitAccessibleCacheAndReturnAtkProperty(WebKitAccessible*, AtkCachedProperty, CString&&);
+
+G_END_DECLS
+
+#endif // HAVE(ACCESSIBILITY)
</ins></span></pre></div>
<a id="releasesWebKitGTKwebkit224SourceWebCoreaccessibilityatkWebKitAccessibleHyperlinkcpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/atk/WebKitAccessibleHyperlink.cpp (245100 => 245101)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/atk/WebKitAccessibleHyperlink.cpp    2019-05-09 08:29:23 UTC (rev 245100)
+++ releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/atk/WebKitAccessibleHyperlink.cpp       2019-05-09 08:29:32 UTC (rev 245101)
</span><span class="lines">@@ -32,8 +32,8 @@
</span><span class="cx"> #include "RenderListMarker.h"
</span><span class="cx"> #include "RenderObject.h"
</span><span class="cx"> #include "TextIterator.h"
</span><ins>+#include "WebKitAccessible.h"
</ins><span class="cx"> #include "WebKitAccessibleUtil.h"
</span><del>-#include "WebKitAccessibleWrapperAtk.h"
</del><span class="cx"> #include <wtf/text/CString.h>
</span><span class="cx"> 
</span><span class="cx"> #include <atk/atk.h>
</span><span class="lines">@@ -64,7 +64,7 @@
</span><span class="cx">     if (!accessible || !WEBKIT_IS_ACCESSIBLE(accessible))
</span><span class="cx">         return 0;
</span><span class="cx"> 
</span><del>-    return webkitAccessibleGetAccessibilityObject(accessible);
</del><ins>+    return &webkitAccessibleGetAccessibilityObject(accessible);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static AccessibilityObject* core(WebKitAccessibleHyperlink* link)
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit224SourceWebCoreaccessibilityatkWebKitAccessibleInterfaceActioncpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceAction.cpp (245100 => 245101)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceAction.cpp      2019-05-09 08:29:23 UTC (rev 245100)
+++ releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceAction.cpp 2019-05-09 08:29:32 UTC (rev 245101)
</span><span class="lines">@@ -36,8 +36,8 @@
</span><span class="cx"> 
</span><span class="cx"> #include "AccessibilityObject.h"
</span><span class="cx"> #include "NotImplemented.h"
</span><ins>+#include "WebKitAccessible.h"
</ins><span class="cx"> #include "WebKitAccessibleUtil.h"
</span><del>-#include "WebKitAccessibleWrapperAtk.h"
</del><span class="cx"> 
</span><span class="cx"> using namespace WebCore;
</span><span class="cx"> 
</span><span class="lines">@@ -46,7 +46,7 @@
</span><span class="cx">     if (!WEBKIT_IS_ACCESSIBLE(action))
</span><span class="cx">         return 0;
</span><span class="cx"> 
</span><del>-    return webkitAccessibleGetAccessibilityObject(WEBKIT_ACCESSIBLE(action));
</del><ins>+    return &webkitAccessibleGetAccessibilityObject(WEBKIT_ACCESSIBLE(action));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static gboolean webkitAccessibleActionDoAction(AtkAction* action, gint index)
</span><span class="lines">@@ -77,23 +77,21 @@
</span><span class="cx">     return "";
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static const gchar* webkitAccessibleActionGetKeybinding(AtkAction* action, gint index)
</del><ins>+static const gchar* webkitAccessibleActionGetKeybinding(AtkAction* action, gint)
</ins><span class="cx"> {
</span><del>-    g_return_val_if_fail(ATK_IS_ACTION(action), 0);
-    g_return_val_if_fail(!index, 0);
-    returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(action), 0);
</del><ins>+    auto* accessible = WEBKIT_ACCESSIBLE(action);
+    returnValIfWebKitAccessibleIsInvalid(accessible, nullptr);
</ins><span class="cx"> 
</span><span class="cx">     // FIXME: Construct a proper keybinding string.
</span><del>-    return cacheAndReturnAtkProperty(ATK_OBJECT(action), AtkCachedActionKeyBinding, core(action)->accessKey().string());
</del><ins>+    return webkitAccessibleCacheAndReturnAtkProperty(accessible, AtkCachedActionKeyBinding, core(action)->accessKey().string().utf8());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-static const gchar* webkitAccessibleActionGetName(AtkAction* action, gint index)
</del><ins>+static const gchar* webkitAccessibleActionGetName(AtkAction* action, gint)
</ins><span class="cx"> {
</span><del>-    g_return_val_if_fail(ATK_IS_ACTION(action), 0);
-    g_return_val_if_fail(!index, 0);
-    returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(action), 0);
</del><ins>+    auto* accessible = WEBKIT_ACCESSIBLE(action);
+    returnValIfWebKitAccessibleIsInvalid(accessible, nullptr);
</ins><span class="cx"> 
</span><del>-    return cacheAndReturnAtkProperty(ATK_OBJECT(action), AtkCachedActionName, core(action)->actionVerb());
</del><ins>+    return webkitAccessibleCacheAndReturnAtkProperty(accessible, AtkCachedActionName, core(action)->actionVerb().utf8());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void webkitAccessibleActionInterfaceInit(AtkActionIface* iface)
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit224SourceWebCoreaccessibilityatkWebKitAccessibleInterfaceComponentcpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceComponent.cpp (245100 => 245101)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceComponent.cpp   2019-05-09 08:29:23 UTC (rev 245100)
+++ releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceComponent.cpp      2019-05-09 08:29:32 UTC (rev 245101)
</span><span class="lines">@@ -36,8 +36,8 @@
</span><span class="cx"> #include "AccessibilityObject.h"
</span><span class="cx"> #include "FrameView.h"
</span><span class="cx"> #include "IntRect.h"
</span><ins>+#include "WebKitAccessible.h"
</ins><span class="cx"> #include "WebKitAccessibleUtil.h"
</span><del>-#include "WebKitAccessibleWrapperAtk.h"
</del><span class="cx"> 
</span><span class="cx"> using namespace WebCore;
</span><span class="cx"> 
</span><span class="lines">@@ -46,7 +46,7 @@
</span><span class="cx">     if (!WEBKIT_IS_ACCESSIBLE(component))
</span><span class="cx">         return 0;
</span><span class="cx"> 
</span><del>-    return webkitAccessibleGetAccessibilityObject(WEBKIT_ACCESSIBLE(component));
</del><ins>+    return &webkitAccessibleGetAccessibilityObject(WEBKIT_ACCESSIBLE(component));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static IntPoint atkToContents(AccessibilityObject* coreObject, AtkCoordType coordType, gint x, gint y)
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit224SourceWebCoreaccessibilityatkWebKitAccessibleInterfaceDocumentcpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceDocument.cpp (245100 => 245101)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceDocument.cpp    2019-05-09 08:29:23 UTC (rev 245100)
+++ releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceDocument.cpp       2019-05-09 08:29:32 UTC (rev 245101)
</span><span class="lines">@@ -37,8 +37,8 @@
</span><span class="cx"> #include "AccessibilityObject.h"
</span><span class="cx"> #include "Document.h"
</span><span class="cx"> #include "DocumentType.h"
</span><ins>+#include "WebKitAccessible.h"
</ins><span class="cx"> #include "WebKitAccessibleUtil.h"
</span><del>-#include "WebKitAccessibleWrapperAtk.h"
</del><span class="cx"> 
</span><span class="cx"> using namespace WebCore;
</span><span class="cx"> 
</span><span class="lines">@@ -47,7 +47,7 @@
</span><span class="cx">     if (!WEBKIT_IS_ACCESSIBLE(document))
</span><span class="cx">         return 0;
</span><span class="cx"> 
</span><del>-    return webkitAccessibleGetAccessibilityObject(WEBKIT_ACCESSIBLE(document));
</del><ins>+    return &webkitAccessibleGetAccessibilityObject(WEBKIT_ACCESSIBLE(document));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static const gchar* documentAttributeValue(AtkDocument* document, const gchar* attribute)
</span><span class="lines">@@ -56,7 +56,7 @@
</span><span class="cx">     if (!coreDocument)
</span><span class="cx">         return 0;
</span><span class="cx"> 
</span><del>-    String value = String();
</del><ins>+    String value;
</ins><span class="cx">     AtkCachedProperty atkCachedProperty;
</span><span class="cx"> 
</span><span class="cx">     if (!g_ascii_strcasecmp(attribute, "DocType") && coreDocument->doctype()) {
</span><span class="lines">@@ -71,7 +71,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (!value.isEmpty())
</span><del>-        return cacheAndReturnAtkProperty(ATK_OBJECT(document), atkCachedProperty, value);
</del><ins>+        return webkitAccessibleCacheAndReturnAtkProperty(WEBKIT_ACCESSIBLE(document), atkCachedProperty, value.utf8());
</ins><span class="cx"> 
</span><span class="cx">     return 0;
</span><span class="cx"> }
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit224SourceWebCoreaccessibilityatkWebKitAccessibleInterfaceEditableTextcpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceEditableText.cpp (245100 => 245101)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceEditableText.cpp        2019-05-09 08:29:23 UTC (rev 245100)
+++ releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceEditableText.cpp   2019-05-09 08:29:32 UTC (rev 245101)
</span><span class="lines">@@ -38,8 +38,8 @@
</span><span class="cx"> #include "Editor.h"
</span><span class="cx"> #include "Frame.h"
</span><span class="cx"> #include "NotImplemented.h"
</span><ins>+#include "WebKitAccessible.h"
</ins><span class="cx"> #include "WebKitAccessibleUtil.h"
</span><del>-#include "WebKitAccessibleWrapperAtk.h"
</del><span class="cx"> 
</span><span class="cx"> using namespace WebCore;
</span><span class="cx"> 
</span><span class="lines">@@ -48,7 +48,7 @@
</span><span class="cx">     if (!WEBKIT_IS_ACCESSIBLE(text))
</span><span class="cx">         return 0;
</span><span class="cx"> 
</span><del>-    return webkitAccessibleGetAccessibilityObject(WEBKIT_ACCESSIBLE(text));
</del><ins>+    return &webkitAccessibleGetAccessibilityObject(WEBKIT_ACCESSIBLE(text));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static gboolean webkitAccessibleEditableTextSetRunAttributes(AtkEditableText* text, AtkAttributeSet*, gint, gint)
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit224SourceWebCoreaccessibilityatkWebKitAccessibleInterfaceHypertextcpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceHypertext.cpp (245100 => 245101)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceHypertext.cpp   2019-05-09 08:29:23 UTC (rev 245100)
+++ releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceHypertext.cpp      2019-05-09 08:29:32 UTC (rev 245101)
</span><span class="lines">@@ -23,8 +23,8 @@
</span><span class="cx"> #if HAVE(ACCESSIBILITY)
</span><span class="cx"> 
</span><span class="cx"> #include "AccessibilityObject.h"
</span><ins>+#include "WebKitAccessible.h"
</ins><span class="cx"> #include "WebKitAccessibleUtil.h"
</span><del>-#include "WebKitAccessibleWrapperAtk.h"
</del><span class="cx"> 
</span><span class="cx"> using namespace WebCore;
</span><span class="cx"> 
</span><span class="lines">@@ -33,7 +33,7 @@
</span><span class="cx">     if (!WEBKIT_IS_ACCESSIBLE(hypertext))
</span><span class="cx">         return 0;
</span><span class="cx"> 
</span><del>-    return webkitAccessibleGetAccessibilityObject(WEBKIT_ACCESSIBLE(hypertext));
</del><ins>+    return &webkitAccessibleGetAccessibilityObject(WEBKIT_ACCESSIBLE(hypertext));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static AtkHyperlink* webkitAccessibleHypertextGetLink(AtkHypertext* hypertext, gint index)
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit224SourceWebCoreaccessibilityatkWebKitAccessibleInterfaceImagecpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceImage.cpp (245100 => 245101)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceImage.cpp       2019-05-09 08:29:23 UTC (rev 245100)
+++ releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceImage.cpp  2019-05-09 08:29:32 UTC (rev 245101)
</span><span class="lines">@@ -36,8 +36,8 @@
</span><span class="cx"> 
</span><span class="cx"> #include "AccessibilityObject.h"
</span><span class="cx"> #include "IntRect.h"
</span><ins>+#include "WebKitAccessible.h"
</ins><span class="cx"> #include "WebKitAccessibleUtil.h"
</span><del>-#include "WebKitAccessibleWrapperAtk.h"
</del><span class="cx"> 
</span><span class="cx"> using namespace WebCore;
</span><span class="cx"> 
</span><span class="lines">@@ -46,7 +46,7 @@
</span><span class="cx">     if (!WEBKIT_IS_ACCESSIBLE(image))
</span><span class="cx">         return 0;
</span><span class="cx"> 
</span><del>-    return webkitAccessibleGetAccessibilityObject(WEBKIT_ACCESSIBLE(image));
</del><ins>+    return &webkitAccessibleGetAccessibilityObject(WEBKIT_ACCESSIBLE(image));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static void webkitAccessibleImageGetImagePosition(AtkImage* image, gint* x, gint* y, AtkCoordType coordType)
</span><span class="lines">@@ -60,10 +60,10 @@
</span><span class="cx"> 
</span><span class="cx"> static const gchar* webkitAccessibleImageGetImageDescription(AtkImage* image)
</span><span class="cx"> {
</span><del>-    g_return_val_if_fail(ATK_IMAGE(image), 0);
-    returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(image), 0);
</del><ins>+    auto* accessible = WEBKIT_ACCESSIBLE(image);
+    returnValIfWebKitAccessibleIsInvalid(accessible, nullptr);
</ins><span class="cx"> 
</span><del>-    return cacheAndReturnAtkProperty(ATK_OBJECT(image), AtkCachedImageDescription, accessibilityDescription(core(image)));
</del><ins>+    return webkitAccessibleCacheAndReturnAtkProperty(accessible, AtkCachedImageDescription, accessibilityDescription(core(image)).utf8());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static void webkitAccessibleImageGetImageSize(AtkImage* image, gint* width, gint* height)
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit224SourceWebCoreaccessibilityatkWebKitAccessibleInterfaceSelectioncpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceSelection.cpp (245100 => 245101)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceSelection.cpp   2019-05-09 08:29:23 UTC (rev 245100)
+++ releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceSelection.cpp      2019-05-09 08:29:32 UTC (rev 245101)
</span><span class="lines">@@ -37,8 +37,8 @@
</span><span class="cx"> #include "AccessibilityObject.h"
</span><span class="cx"> #include "HTMLSelectElement.h"
</span><span class="cx"> #include "RenderObject.h"
</span><ins>+#include "WebKitAccessible.h"
</ins><span class="cx"> #include "WebKitAccessibleUtil.h"
</span><del>-#include "WebKitAccessibleWrapperAtk.h"
</del><span class="cx"> 
</span><span class="cx"> using namespace WebCore;
</span><span class="cx"> 
</span><span class="lines">@@ -47,7 +47,7 @@
</span><span class="cx">     if (!WEBKIT_IS_ACCESSIBLE(selection))
</span><span class="cx">         return nullptr;
</span><span class="cx"> 
</span><del>-    return webkitAccessibleGetAccessibilityObject(WEBKIT_ACCESSIBLE(selection));
</del><ins>+    return &webkitAccessibleGetAccessibilityObject(WEBKIT_ACCESSIBLE(selection));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static AccessibilityObject* listObjectForSelection(AtkSelection* selection)
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit224SourceWebCoreaccessibilityatkWebKitAccessibleInterfaceTablecpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceTable.cpp (245100 => 245101)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceTable.cpp       2019-05-09 08:29:23 UTC (rev 245100)
+++ releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceTable.cpp  2019-05-09 08:29:32 UTC (rev 245101)
</span><span class="lines">@@ -40,9 +40,9 @@
</span><span class="cx"> #include "HTMLTableCaptionElement.h"
</span><span class="cx"> #include "HTMLTableElement.h"
</span><span class="cx"> #include "RenderElement.h"
</span><ins>+#include "WebKitAccessible.h"
</ins><span class="cx"> #include "WebKitAccessibleInterfaceText.h"
</span><span class="cx"> #include "WebKitAccessibleUtil.h"
</span><del>-#include "WebKitAccessibleWrapperAtk.h"
</del><span class="cx"> 
</span><span class="cx"> using namespace WebCore;
</span><span class="cx"> 
</span><span class="lines">@@ -51,7 +51,7 @@
</span><span class="cx">     if (!WEBKIT_IS_ACCESSIBLE(table))
</span><span class="cx">         return nullptr;
</span><span class="cx"> 
</span><del>-    return webkitAccessibleGetAccessibilityObject(WEBKIT_ACCESSIBLE(table));
</del><ins>+    return &webkitAccessibleGetAccessibilityObject(WEBKIT_ACCESSIBLE(table));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static AccessibilityTableCell* cell(AtkTable* table, guint row, guint column)
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit224SourceWebCoreaccessibilityatkWebKitAccessibleInterfaceTableCellcpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceTableCell.cpp (245100 => 245101)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceTableCell.cpp   2019-05-09 08:29:23 UTC (rev 245100)
+++ releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceTableCell.cpp      2019-05-09 08:29:32 UTC (rev 245101)
</span><span class="lines">@@ -25,8 +25,8 @@
</span><span class="cx"> #include "AccessibilityObject.h"
</span><span class="cx"> #include "AccessibilityTable.h"
</span><span class="cx"> #include "AccessibilityTableCell.h"
</span><ins>+#include "WebKitAccessible.h"
</ins><span class="cx"> #include "WebKitAccessibleUtil.h"
</span><del>-#include "WebKitAccessibleWrapperAtk.h"
</del><span class="cx"> 
</span><span class="cx"> using namespace WebCore;
</span><span class="cx"> 
</span><span class="lines">@@ -45,7 +45,7 @@
</span><span class="cx">     if (!WEBKIT_IS_ACCESSIBLE(cell))
</span><span class="cx">         return nullptr;
</span><span class="cx"> 
</span><del>-    return webkitAccessibleGetAccessibilityObject(WEBKIT_ACCESSIBLE(cell));
</del><ins>+    return &webkitAccessibleGetAccessibilityObject(WEBKIT_ACCESSIBLE(cell));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> GPtrArray* webkitAccessibleTableCellGetColumnHeaderCells(AtkTableCell* cell)
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit224SourceWebCoreaccessibilityatkWebKitAccessibleInterfaceTextcpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceText.cpp (245100 => 245101)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceText.cpp        2019-05-09 08:29:23 UTC (rev 245100)
+++ releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceText.cpp   2019-05-09 08:29:32 UTC (rev 245101)
</span><span class="lines">@@ -49,8 +49,8 @@
</span><span class="cx"> #include "TextEncoding.h"
</span><span class="cx"> #include "TextIterator.h"
</span><span class="cx"> #include "VisibleUnits.h"
</span><ins>+#include "WebKitAccessible.h"
</ins><span class="cx"> #include "WebKitAccessibleUtil.h"
</span><del>-#include "WebKitAccessibleWrapperAtk.h"
</del><span class="cx"> #include <wtf/glib/GUniquePtr.h>
</span><span class="cx"> #include <wtf/text/CString.h>
</span><span class="cx"> 
</span><span class="lines">@@ -66,7 +66,7 @@
</span><span class="cx">     if (!WEBKIT_IS_ACCESSIBLE(text))
</span><span class="cx">         return 0;
</span><span class="cx"> 
</span><del>-    return webkitAccessibleGetAccessibilityObject(WEBKIT_ACCESSIBLE(text));
</del><ins>+    return &webkitAccessibleGetAccessibilityObject(WEBKIT_ACCESSIBLE(text));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static int baselinePositionForRenderObject(RenderObject* renderObject)
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit224SourceWebCoreaccessibilityatkWebKitAccessibleInterfaceValuecpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceValue.cpp (245100 => 245101)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceValue.cpp       2019-05-09 08:29:23 UTC (rev 245100)
+++ releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceValue.cpp  2019-05-09 08:29:32 UTC (rev 245101)
</span><span class="lines">@@ -24,8 +24,8 @@
</span><span class="cx"> 
</span><span class="cx"> #include "AccessibilityObject.h"
</span><span class="cx"> #include "HTMLNames.h"
</span><ins>+#include "WebKitAccessible.h"
</ins><span class="cx"> #include "WebKitAccessibleUtil.h"
</span><del>-#include "WebKitAccessibleWrapperAtk.h"
</del><span class="cx"> #include <wtf/text/CString.h>
</span><span class="cx"> 
</span><span class="cx"> using namespace WebCore;
</span><span class="lines">@@ -35,7 +35,7 @@
</span><span class="cx">     if (!WEBKIT_IS_ACCESSIBLE(value))
</span><span class="cx">         return 0;
</span><span class="cx"> 
</span><del>-    return webkitAccessibleGetAccessibilityObject(WEBKIT_ACCESSIBLE(value));
</del><ins>+    return &webkitAccessibleGetAccessibilityObject(WEBKIT_ACCESSIBLE(value));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static bool webkitAccessibleSetNewValue(AtkValue* coreValue, const gdouble newValue)
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit224SourceWebCoreaccessibilityatkWebKitAccessibleUtilcpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/atk/WebKitAccessibleUtil.cpp (245100 => 245101)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/atk/WebKitAccessibleUtil.cpp 2019-05-09 08:29:23 UTC (rev 245100)
+++ releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/atk/WebKitAccessibleUtil.cpp    2019-05-09 08:29:32 UTC (rev 245101)
</span><span class="lines">@@ -33,11 +33,14 @@
</span><span class="cx"> 
</span><span class="cx"> #if HAVE(ACCESSIBILITY)
</span><span class="cx"> 
</span><ins>+#include "AXObjectCache.h"
</ins><span class="cx"> #include "AccessibilityObject.h"
</span><span class="cx"> #include "FrameView.h"
</span><span class="cx"> #include "IntRect.h"
</span><span class="cx"> #include "Node.h"
</span><span class="cx"> #include "Range.h"
</span><ins>+#include "RenderObject.h"
+#include "TextIterator.h"
</ins><span class="cx"> #include "VisibleSelection.h"
</span><span class="cx"> 
</span><span class="cx"> #include <wtf/text/AtomicString.h>
</span><span class="lines">@@ -173,4 +176,84 @@
</span><span class="cx">         && (&range->startContainer() != lastDescendant || range->startOffset() != lastOffset);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+AccessibilityObject* objectFocusedAndCaretOffsetUnignored(AccessibilityObject* 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.
+    AccessibilityObject* 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).
+        AccessibilityObject* 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), DOWNSTREAM);
+    VisiblePosition endPosition = firstUnignoredParent->selection().visibleEnd();
+
+    if (startPosition == endPosition)
+        offset = 0;
+    else if (!isStartOfLine(endPosition)) {
+        RefPtr<Range> range = makeRange(startPosition, endPosition.previous());
+        offset = TextIterator::rangeLength(range.get(), true) + 1;
+    } else {
+        RefPtr<Range> range = makeRange(startPosition, endPosition);
+        offset = TextIterator::rangeLength(range.get(), true);
+    }
+
+    return firstUnignoredParent;
+}
+
</ins><span class="cx"> #endif
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit224SourceWebCoreaccessibilityatkWebKitAccessibleUtilh"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/atk/WebKitAccessibleUtil.h (245100 => 245101)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/atk/WebKitAccessibleUtil.h   2019-05-09 08:29:23 UTC (rev 245100)
+++ releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/atk/WebKitAccessibleUtil.h      2019-05-09 08:29:32 UTC (rev 245101)
</span><span class="lines">@@ -35,28 +35,26 @@
</span><span class="cx"> // An existing accessibility object is considered to be invalid whether it's already
</span><span class="cx"> // detached or if it's not but just updating the layout will detach it anyway.
</span><span class="cx"> #define returnIfWebKitAccessibleIsInvalid(webkitAccessible) G_STMT_START { \
</span><del>-    if (!webkitAccessible || webkitAccessibleIsDetached(webkitAccessible)) { \
</del><ins>+    if (!webkitAccessible || webkitAccessibleIsDetached(webkitAccessible)) \
</ins><span class="cx">         return; \
</span><del>-    } else { \
-        AccessibilityObject* coreObject = webkitAccessibleGetAccessibilityObject(webkitAccessible); \
-        if (!coreObject || !coreObject->document()) \
-            return; \
-        coreObject->updateBackingStore(); \
-        if (webkitAccessibleIsDetached(webkitAccessible)) \
-            return; \
-    }; } G_STMT_END
</del><ins>+    auto& coreObject = webkitAccessibleGetAccessibilityObject(webkitAccessible); \
+    if (!coreObject.document())                                         \
+        return;                                                         \
+    coreObject.updateBackingStore();                                    \
+    if (webkitAccessibleIsDetached(webkitAccessible))                   \
+        return;                                                         \
+    ; } G_STMT_END
</ins><span class="cx"> 
</span><span class="cx"> #define returnValIfWebKitAccessibleIsInvalid(webkitAccessible, val) G_STMT_START { \
</span><del>-    if (!webkitAccessible || webkitAccessibleIsDetached(webkitAccessible)) { \
-        return (val); \
-    } else { \
-        AccessibilityObject* coreObject = webkitAccessibleGetAccessibilityObject(webkitAccessible); \
-        if (!coreObject || !coreObject->document()) \
-            return (val); \
-        coreObject->updateBackingStore(); \
-        if (webkitAccessibleIsDetached(webkitAccessible)) \
-            return (val); \
-    }; } G_STMT_END
</del><ins>+    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
</ins><span class="cx"> 
</span><span class="cx"> AtkAttributeSet* addToAtkAttributeSet(AtkAttributeSet*, const char* name, const char* value);
</span><span class="cx"> 
</span><span class="lines">@@ -68,4 +66,6 @@
</span><span class="cx"> 
</span><span class="cx"> bool selectionBelongsToObject(WebCore::AccessibilityObject*, WebCore::VisibleSelection&);
</span><span class="cx"> 
</span><ins>+WebCore::AccessibilityObject* objectFocusedAndCaretOffsetUnignored(WebCore::AccessibilityObject*, int& offset);
+
</ins><span class="cx"> #endif // HAVE(ACCESSIBILITY)
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit224SourceWebCoreaccessibilityatkWebKitAccessibleWrapperAtkcpp"></a>
<div class="delfile"><h4>Deleted: releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/atk/WebKitAccessibleWrapperAtk.cpp (245100 => 245101)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/atk/WebKitAccessibleWrapperAtk.cpp   2019-05-09 08:29:23 UTC (rev 245100)
+++ releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/atk/WebKitAccessibleWrapperAtk.cpp      2019-05-09 08:29:32 UTC (rev 245101)
</span><span class="lines">@@ -1,1569 +0,0 @@
</span><del>-/*
- * Copyright (C) 2008 Nuanti Ltd.
- * Copyright (C) 2009 Jan Alonzo
- * Copyright (C) 2009, 2010, 2011, 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 "WebKitAccessibleWrapperAtk.h"
-
-#if HAVE(ACCESSIBILITY)
-
-#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 "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/text/CString.h>
-
-using namespace WebCore;
-
-struct _WebKitAccessiblePrivate {
-    // 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;
-};
-
-#define WEBKIT_ACCESSIBLE_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), WEBKIT_TYPE_ACCESSIBLE, WebKitAccessiblePrivate))
-
-static AccessibilityObject* fallbackObject()
-{
-    static AccessibilityObject* object = &AccessibilityListBoxOption::create().leakRef();
-    return object;
-}
-
-static AccessibilityObject* core(AtkObject* object)
-{
-    if (!WEBKIT_IS_ACCESSIBLE(object))
-        return 0;
-
-    return webkitAccessibleGetAccessibilityObject(WEBKIT_ACCESSIBLE(object));
-}
-
-static const gchar* webkitAccessibleGetName(AtkObject* object)
-{
-    g_return_val_if_fail(WEBKIT_IS_ACCESSIBLE(object), 0);
-    returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(object), 0);
-
-    Vector<AccessibilityText> textOrder;
-    core(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 cacheAndReturnAtkProperty(object, AtkCachedAccessibleName, text.text);
-    }
-
-    return cacheAndReturnAtkProperty(object, AtkCachedAccessibleName, "");
-}
-
-static const gchar* webkitAccessibleGetDescription(AtkObject* object)
-{
-    g_return_val_if_fail(WEBKIT_IS_ACCESSIBLE(object), 0);
-    returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(object), 0);
-
-    Vector<AccessibilityText> textOrder;
-    core(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 cacheAndReturnAtkProperty(object, AtkCachedAccessibleDescription, text.text);
-
-        // 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 cacheAndReturnAtkProperty(object, AtkCachedAccessibleDescription, text.text);
-
-        nameTextAvailable = true;
-    }
-
-    return cacheAndReturnAtkProperty(object, 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 gpointer webkitAccessibleParentClass = nullptr;
-
-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();
-    if (!firstChild || !firstChild->isWebArea())
-        return false;
-
-    return true;
-}
-
-static AtkObject* atkParentOfRootObject(AtkObject* object)
-{
-    AccessibilityObject* coreObject = core(object);
-    AccessibilityObject* coreParent = coreObject->parentObjectUnignored();
-
-    // 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 (!coreParent && isRootObject(coreObject)) {
-        Document* document = coreObject->document();
-        if (!document)
-            return 0;
-    }
-
-    return coreParent ? ATK_OBJECT(coreParent->wrapper()) : nullptr;
-}
-
-static AtkObject* webkitAccessibleGetParent(AtkObject* object)
-{
-    g_return_val_if_fail(WEBKIT_IS_ACCESSIBLE(object), 0);
-    returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(object), 0);
-
-    // Check first if the parent has been already set.
-    AtkObject* accessibleParent = ATK_OBJECT_CLASS(webkitAccessibleParentClass)->get_parent(object);
-    if (accessibleParent)
-        return accessibleParent;
-
-    // Parent not set yet, so try to find it in the hierarchy.
-    AccessibilityObject* coreObject = core(object);
-    if (!coreObject)
-        return 0;
-
-    AccessibilityObject* coreParent = coreObject->parentObjectUnignored();
-
-    if (!coreParent && isRootObject(coreObject))
-        return atkParentOfRootObject(object);
-
-    return coreParent ? ATK_OBJECT(coreParent->wrapper()) : nullptr;
-}
-
-static gint webkitAccessibleGetNChildren(AtkObject* object)
-{
-    g_return_val_if_fail(WEBKIT_IS_ACCESSIBLE(object), 0);
-    returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(object), 0);
-
-    AccessibilityObject* coreObject = core(object);
-
-    return coreObject->children().size();
-}
-
-static AtkObject* webkitAccessibleRefChild(AtkObject* object, gint index)
-{
-    g_return_val_if_fail(WEBKIT_IS_ACCESSIBLE(object), 0);
-    returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(object), 0);
-
-    if (index < 0)
-        return 0;
-
-    AccessibilityObject* coreObject = core(object);
-    AccessibilityObject* coreChild = nullptr;
-
-    const AccessibilityObject::AccessibilityChildrenVector& children = coreObject->children();
-    if (static_cast<size_t>(index) >= children.size())
-        return 0;
-    coreChild = children.at(index).get();
-
-    if (!coreChild)
-        return 0;
-
-    auto* child = ATK_OBJECT(coreChild->wrapper());
-    atk_object_set_parent(child, object);
-    g_object_ref(child);
-
-    return child;
-}
-
-static gint webkitAccessibleGetIndexInParent(AtkObject* object)
-{
-    g_return_val_if_fail(WEBKIT_IS_ACCESSIBLE(object), -1);
-    returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(object), -1);
-
-    AccessibilityObject* coreObject = core(object);
-    AccessibilityObject* parent = coreObject->parentObjectUnignored();
-
-    if (!parent && isRootObject(coreObject)) {
-        AtkObject* atkParent = atkParentOfRootObject(object);
-        if (!atkParent)
-            return -1;
-
-        unsigned count = atk_object_get_n_accessible_children(atkParent);
-        for (unsigned i = 0; i < count; ++i) {
-            AtkObject* child = atk_object_ref_accessible_child(atkParent, i);
-            bool childIsObject = child == object;
-            g_object_unref(child);
-            if (childIsObject)
-                return i;
-        }
-    }
-
-    if (!parent)
-        return -1;
-
-    size_t index = parent->children().find(coreObject);
-    return (index == WTF::notFound) ? -1 : index;
-}
-
-static AtkAttributeSet* webkitAccessibleGetAttributes(AtkObject* object)
-{
-    g_return_val_if_fail(WEBKIT_IS_ACCESSIBLE(object), 0);
-    returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(object), 0);
-
-    AtkAttributeSet* attributeSet = nullptr;
-#if PLATFORM(GTK)
-    attributeSet = addToAtkAttributeSet(attributeSet, "toolkit", "WebKitGtk");
-#endif
-
-    AccessibilityObject* coreObject = core(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).isExposableThroughAccessibility()) {
-        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->hasPopupValue().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.
-        if (coreObject->ariaRoleAttribute() == AccessibilityRole::Unknown && coreObject->isLandmark())
-            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 isAtomic = 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 (isAtomic)
-            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 (isAtomic)
-                attributeSet = addToAtkAttributeSet(attributeSet, "atomic", "true");
-        } else if (!isAtomic && 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->isARIAGrabbed())
-        attributeSet = addToAtkAttributeSet(attributeSet, "grabbed", "true");
-    else if (coreObject->supportsARIADragging())
-        attributeSet = addToAtkAttributeSet(attributeSet, "grabbed", "false");
-
-    // The Core AAM states the author-provided value should be exposed as-is.
-    const AtomicString& keyShortcuts = coreObject->keyShortcutsValue();
-    if (!keyShortcuts.isEmpty())
-        attributeSet = addToAtkAttributeSet(attributeSet, "keyshortcuts", keyShortcuts.string().utf8().data());
-
-    return attributeSet;
-}
-
-static AtkRole atkRole(AccessibilityObject* coreObject)
-{
-    AccessibilityRole role = coreObject->roleValue();
-    switch (role) {
-    case AccessibilityRole::ApplicationAlert:
-        return ATK_ROLE_ALERT;
-    case AccessibilityRole::ApplicationAlertDialog:
-    case AccessibilityRole::ApplicationDialog:
-        return ATK_ROLE_DIALOG;
-    case AccessibilityRole::ApplicationStatus:
-        return ATK_ROLE_STATUSBAR;
-    case AccessibilityRole::Unknown:
-        return ATK_ROLE_UNKNOWN;
-    case AccessibilityRole::Audio:
-#if ATK_CHECK_VERSION(2, 11, 3)
-        return ATK_ROLE_AUDIO;
-#endif
-    case AccessibilityRole::Video:
-#if ATK_CHECK_VERSION(2, 11, 3)
-        return ATK_ROLE_VIDEO;
-#endif
-        return ATK_ROLE_EMBEDDED;
-    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:
-#if ATK_CHECK_VERSION(2, 15, 2)
-        return ATK_ROLE_STATIC;
-#else
-        return ATK_ROLE_TEXT;
-#endif
-    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::BusyIndicator:
-        return ATK_ROLE_PROGRESS_BAR; // Is this right?
-    case AccessibilityRole::ProgressIndicator:
-        return coreObject->isMeter() ? ATK_ROLE_LEVEL_BAR : 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;
-    case AccessibilityRole::ColorWell:
-#if PLATFORM(GTK)
-        // 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:
-#if ATK_CHECK_VERSION(2, 11, 3)
-        return ATK_ROLE_ARTICLE;
-#endif
-    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:
-#if ATK_CHECK_VERSION(2, 11, 3)
-        return ATK_ROLE_BLOCK_QUOTE;
-#endif
-    case AccessibilityRole::Footnote:
-#if ATK_CHECK_VERSION(2, 25, 2)
-        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 ATK_CHECK_VERSION(2, 11, 3)
-        if (coreObject->ariaRoleAttribute() != AccessibilityRole::Unknown)
-            return ATK_ROLE_LANDMARK;
-#endif
-        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;
-#if ATK_CHECK_VERSION(2, 11, 3)
-    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 ATK_CHECK_VERSION(2, 15, 4)
-        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;
-#endif
-#if ATK_CHECK_VERSION(2, 15, 2)
-        if (coreObject->isMathToken())
-            return ATK_ROLE_STATIC;
-#endif
-        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;
-#endif
-#if ATK_CHECK_VERSION(2, 11, 4)
-    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;
-#endif
-    case AccessibilityRole::Inline:
-#if ATK_CHECK_VERSION(2, 15, 4)
-        if (coreObject->isSubscriptStyleGroup())
-            return ATK_ROLE_SUBSCRIPT;
-        if (coreObject->isSuperscriptStyleGroup())
-            return ATK_ROLE_SUPERSCRIPT;
-#endif
-#if ATK_CHECK_VERSION(2, 15, 2)
-        return ATK_ROLE_STATIC;
-    case AccessibilityRole::SVGTextPath:
-    case AccessibilityRole::SVGTSpan:
-    case AccessibilityRole::Time:
-        return ATK_ROLE_STATIC;
-#endif
-    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.
-    g_return_val_if_fail(WEBKIT_IS_ACCESSIBLE(object), ATK_ROLE_INVALID);
-    returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(object), ATK_ROLE_INVALID);
-
-    AccessibilityObject* coreObject = core(object);
-
-    if (!coreObject)
-        return ATK_ROLE_INVALID;
-
-    // Note: Why doesn't WebCore have a password field for this
-    if (coreObject->isPasswordField())
-        return ATK_ROLE_PASSWORD_TEXT;
-
-    return atkRole(coreObject);
-}
-
-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 ATK_CHECK_VERSION(2,11,2)
-    if (coreObject->supportsChecked() && coreObject->canSetValueAttribute())
-        atk_state_set_add_state(stateSet, ATK_STATE_CHECKABLE);
-#endif
-
-    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 ATK_CHECK_VERSION(2,15,3)
-    if (!coreObject->canSetValueAttribute() && (coreObject->supportsReadOnly()))
-        atk_state_set_add_state(stateSet, ATK_STATE_READ_ONLY);
-#endif
-
-    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)
-{
-    g_return_val_if_fail(WEBKIT_IS_ACCESSIBLE(object), 0);
-
-    AtkStateSet* stateSet = ATK_OBJECT_CLASS(webkitAccessibleParentClass)->ref_state_set(object);
-    AccessibilityObject* coreObject = core(object);
-
-    // Make sure the layout is updated to really know whether the object
-    // is defunct or not, so we can return the proper state.
-    coreObject->updateBackingStore();
-
-    if (coreObject == fallbackObject()) {
-        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(coreObject, stateSet);
-    return stateSet;
-}
-
-static AtkRelationSet* webkitAccessibleRefRelationSet(AtkObject* object)
-{
-    g_return_val_if_fail(WEBKIT_IS_ACCESSIBLE(object), 0);
-    returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(object), 0);
-
-    AtkRelationSet* relationSet = ATK_OBJECT_CLASS(webkitAccessibleParentClass)->ref_relation_set(object);
-    AccessibilityObject* coreObject = core(object);
-
-    setAtkRelationSetFromCoreObject(coreObject, relationSet);
-
-    return relationSet;
-}
-
-static void webkitAccessibleInit(AtkObject* object, gpointer data)
-{
-    if (ATK_OBJECT_CLASS(webkitAccessibleParentClass)->initialize)
-        ATK_OBJECT_CLASS(webkitAccessibleParentClass)->initialize(object, data);
-
-    WebKitAccessible* accessible = WEBKIT_ACCESSIBLE(object);
-    accessible->m_object = reinterpret_cast<AccessibilityObject*>(data);
-    accessible->priv = WEBKIT_ACCESSIBLE_GET_PRIVATE(accessible);
-}
-
-static const gchar* webkitAccessibleGetObjectLocale(AtkObject* object)
-{
-    g_return_val_if_fail(WEBKIT_IS_ACCESSIBLE(object), 0);
-    returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(object), 0);
-
-    AccessibilityObject* coreObject = core(object);
-    if (!coreObject)
-        return 0;
-
-    if (ATK_IS_DOCUMENT(object)) {
-        // TODO: Should we fall back on lang xml:lang when the following comes up empty?
-        String language = coreObject->language();
-        if (!language.isEmpty())
-            return cacheAndReturnAtkProperty(object, AtkCachedDocumentLocale, language);
-
-    } else if (ATK_IS_TEXT(object)) {
-        const gchar* locale = nullptr;
-
-        AtkAttributeSet* textAttributes = atk_text_get_default_attributes(ATK_TEXT(object));
-        for (AtkAttributeSet* attributes = textAttributes; attributes; attributes = attributes->next) {
-            AtkAttribute* atkAttribute = static_cast<AtkAttribute*>(attributes->data);
-            if (!strcmp(atkAttribute->name, atk_text_attribute_get_name(ATK_TEXT_ATTR_LANGUAGE))) {
-                locale = cacheAndReturnAtkProperty(object, AtkCachedDocumentLocale, String::fromUTF8(atkAttribute->value));
-                break;
-            }
-        }
-        atk_attribute_set_free(textAttributes);
-
-        return locale;
-    }
-
-    return 0;
-}
-
-static void webkitAccessibleFinalize(GObject* object)
-{
-    G_OBJECT_CLASS(webkitAccessibleParentClass)->finalize(object);
-}
-
-static void webkitAccessibleClassInit(AtkObjectClass* klass)
-{
-    GObjectClass* gobjectClass = G_OBJECT_CLASS(klass);
-
-    webkitAccessibleParentClass = g_type_class_peek_parent(klass);
-
-    gobjectClass->finalize = webkitAccessibleFinalize;
-
-    klass->initialize = webkitAccessibleInit;
-    klass->get_name = webkitAccessibleGetName;
-    klass->get_description = webkitAccessibleGetDescription;
-    klass->get_parent = webkitAccessibleGetParent;
-    klass->get_n_children = webkitAccessibleGetNChildren;
-    klass->ref_child = webkitAccessibleRefChild;
-    klass->get_role = webkitAccessibleGetRole;
-    klass->ref_state_set = webkitAccessibleRefStateSet;
-    klass->get_index_in_parent = webkitAccessibleGetIndexInParent;
-    klass->get_attributes = webkitAccessibleGetAttributes;
-    klass->ref_relation_set = webkitAccessibleRefRelationSet;
-    klass->get_object_locale = webkitAccessibleGetObjectLocale;
-
-    g_type_class_add_private(klass, sizeof(WebKitAccessiblePrivate));
-}
-
-GType
-webkitAccessibleGetType(void)
-{
-    static volatile gsize typeVolatile = 0;
-
-    if (g_once_init_enter(&typeVolatile)) {
-        static const GTypeInfo tinfo = {
-            sizeof(WebKitAccessibleClass),
-            (GBaseInitFunc) 0,
-            (GBaseFinalizeFunc) 0,
-            (GClassInitFunc)(GCallback) webkitAccessibleClassInit,
-            (GClassFinalizeFunc) 0,
-            0, /* class data */
-            sizeof(WebKitAccessible), /* instance size */
-            0, /* nb preallocs */
-            (GInstanceInitFunc) 0,
-            0 /* value table */
-        };
-
-        GType type = g_type_register_static(ATK_TYPE_OBJECT, "WebKitAccessible", &tinfo, GTypeFlags(0));
-        g_once_init_leave(&typeVolatile, type);
-    }
-
-    return typeVolatile;
-}
-
-static const GInterfaceInfo AtkInterfacesInitFunctions[] = {
-    {reinterpret_cast<GInterfaceInitFunc>(reinterpret_cast<GCallback>(webkitAccessibleActionInterfaceInit)), 0, 0},
-    {reinterpret_cast<GInterfaceInitFunc>(reinterpret_cast<GCallback>(webkitAccessibleSelectionInterfaceInit)), 0, 0},
-    {reinterpret_cast<GInterfaceInitFunc>(reinterpret_cast<GCallback>(webkitAccessibleEditableTextInterfaceInit)), 0, 0},
-    {reinterpret_cast<GInterfaceInitFunc>(reinterpret_cast<GCallback>(webkitAccessibleTextInterfaceInit)), 0, 0},
-    {reinterpret_cast<GInterfaceInitFunc>(reinterpret_cast<GCallback>(webkitAccessibleComponentInterfaceInit)), 0, 0},
-    {reinterpret_cast<GInterfaceInitFunc>(reinterpret_cast<GCallback>(webkitAccessibleImageInterfaceInit)), 0, 0},
-    {reinterpret_cast<GInterfaceInitFunc>(reinterpret_cast<GCallback>(webkitAccessibleTableInterfaceInit)), 0, 0},
-#if ATK_CHECK_VERSION(2,11,90)
-    {reinterpret_cast<GInterfaceInitFunc>(reinterpret_cast<GCallback>(webkitAccessibleTableCellInterfaceInit)), 0, 0},
-#endif
-    {reinterpret_cast<GInterfaceInitFunc>(reinterpret_cast<GCallback>(webkitAccessibleHypertextInterfaceInit)), 0, 0},
-    {reinterpret_cast<GInterfaceInitFunc>(reinterpret_cast<GCallback>(webkitAccessibleHyperlinkImplInterfaceInit)), 0, 0},
-    {reinterpret_cast<GInterfaceInitFunc>(reinterpret_cast<GCallback>(webkitAccessibleDocumentInterfaceInit)), 0, 0},
-    {reinterpret_cast<GInterfaceInitFunc>(reinterpret_cast<GCallback>(webkitAccessibleValueInterfaceInit)), 0, 0}
-};
-
-enum WAIType {
-    WAIAction,
-    WAISelection,
-    WAIEditableText,
-    WAIText,
-    WAIComponent,
-    WAIImage,
-    WAITable,
-#if ATK_CHECK_VERSION(2,11,90)
-    WAITableCell,
-#endif
-    WAIHypertext,
-    WAIHyperlink,
-    WAIDocument,
-    WAIValue,
-};
-
-static GType GetAtkInterfaceTypeFromWAIType(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;
-#if ATK_CHECK_VERSION(2,11,90)
-    case WAITableCell:
-        return ATK_TYPE_TABLE_CELL;
-#endif
-    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;
-}
-
-static guint16 getInterfaceMaskFromObject(AccessibilityObject* 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->isReplaced()))
-        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 AccessibilityObject::AccessibilityChildrenVector& children = coreObject->children();
-            if (children.size()) {
-                AccessibilityObject* axRenderChild = children.at(0).get();
-                interfaceMask |= getInterfaceMaskFromObject(axRenderChild);
-            }
-        }
-    }
-
-    // Image
-    if (coreObject->isImage())
-        interfaceMask |= 1 << WAIImage;
-
-    // Table
-    if (coreObject->isTable())
-        interfaceMask |= 1 << WAITable;
-
-#if ATK_CHECK_VERSION(2,11,90)
-    if (role == AccessibilityRole::Cell || role == AccessibilityRole::GridCell || role == AccessibilityRole::ColumnHeader || role == AccessibilityRole::RowHeader)
-        interfaceMask |= 1 << WAITableCell;
-#endif
-
-    // 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* getUniqueAccessibilityTypeName(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 getAccessibilityTypeFromObject(AccessibilityObject* coreObject)
-{
-    static const GTypeInfo typeInfo = {
-        sizeof(WebKitAccessibleClass),
-        (GBaseInitFunc) 0,
-        (GBaseFinalizeFunc) 0,
-        (GClassInitFunc) 0,
-        (GClassFinalizeFunc) 0,
-        0, /* class data */
-        sizeof(WebKitAccessible), /* instance size */
-        0, /* nb preallocs */
-        (GInstanceInitFunc) 0,
-        0 /* value table */
-    };
-
-    guint16 interfaceMask = getInterfaceMaskFromObject(coreObject);
-    const char* atkTypeName = getUniqueAccessibilityTypeName(interfaceMask);
-    GType type = g_type_from_name(atkTypeName);
-    if (type)
-        return type;
-
-    type = g_type_register_static(WEBKIT_TYPE_ACCESSIBLE, atkTypeName, &typeInfo, GTypeFlags(0));
-    for (guint i = 0; i < G_N_ELEMENTS(AtkInterfacesInitFunctions); i++) {
-        if (interfaceMask & (1 << i))
-            g_type_add_interface_static(type,
-                GetAtkInterfaceTypeFromWAIType(static_cast<WAIType>(i)),
-                &AtkInterfacesInitFunctions[i]);
-    }
-
-    return type;
-}
-
-WebKitAccessible* webkitAccessibleNew(AccessibilityObject* coreObject)
-{
-    GType type = getAccessibilityTypeFromObject(coreObject);
-    AtkObject* object = static_cast<AtkObject*>(g_object_new(type, 0));
-
-    atk_object_initialize(object, coreObject);
-
-    return WEBKIT_ACCESSIBLE(object);
-}
-
-AccessibilityObject* webkitAccessibleGetAccessibilityObject(WebKitAccessible* accessible)
-{
-    return accessible->m_object;
-}
-
-void webkitAccessibleDetach(WebKitAccessible* accessible)
-{
-    ASSERT(accessible->m_object);
-
-    if (accessible->m_object->roleValue() == AccessibilityRole::WebArea)
-        atk_object_notify_state_change(ATK_OBJECT(accessible), ATK_STATE_DEFUNCT, true);
-
-    // We replace the WebCore AccessibilityObject with a fallback object that
-    // provides default implementations to avoid repetitive null-checking after
-    // detachment.
-    accessible->m_object = fallbackObject();
-}
-
-bool webkitAccessibleIsDetached(WebKitAccessible* accessible)
-{
-    ASSERT(accessible->m_object);
-    return accessible->m_object == fallbackObject();
-}
-
-AccessibilityObject* objectFocusedAndCaretOffsetUnignored(AccessibilityObject* referenceObject, int& offset)
-{
-    // Indication that something bogus has transpired.
-    offset = -1;
-
-    Document* document = referenceObject->document();
-    if (!document)
-        return 0;
-
-    Node* focusedNode = referenceObject->selection().end().containerNode();
-    if (!focusedNode)
-        return 0;
-
-    RenderObject* focusedRenderer = focusedNode->renderer();
-    if (!focusedRenderer)
-        return 0;
-
-    AccessibilityObject* focusedObject = document->axObjectCache()->getOrCreate(focusedRenderer);
-    if (!focusedObject)
-        return 0;
-
-    // Look for the actual (not ignoring accessibility) selected object.
-    AccessibilityObject* firstUnignoredParent = focusedObject;
-    if (firstUnignoredParent->accessibilityIsIgnored())
-        firstUnignoredParent = firstUnignoredParent->parentObjectUnignored();
-    if (!firstUnignoredParent)
-        return 0;
-
-    // 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 0;
-
-    // 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).
-        AccessibilityObject* 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 0;
-
-    VisiblePosition startPosition = VisiblePosition(positionBeforeNode(startNode), DOWNSTREAM);
-    VisiblePosition endPosition = firstUnignoredParent->selection().visibleEnd();
-
-    if (startPosition == endPosition)
-        offset = 0;
-    else if (!isStartOfLine(endPosition)) {
-        RefPtr<Range> range = makeRange(startPosition, endPosition.previous());
-        offset = TextIterator::rangeLength(range.get(), true) + 1;
-    } else {
-        RefPtr<Range> range = makeRange(startPosition, endPosition);
-        offset = TextIterator::rangeLength(range.get(), true);
-    }
-
-    return firstUnignoredParent;
-}
-
-const char* cacheAndReturnAtkProperty(AtkObject* object, AtkCachedProperty property, String value)
-{
-    WebKitAccessiblePrivate* priv = WEBKIT_ACCESSIBLE(object)->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.utf8())
-        *propertyPtr = value.utf8();
-
-    return (*propertyPtr).data();
-}
-
-#endif // HAVE(ACCESSIBILITY)
</del></span></pre></div>
<a id="releasesWebKitGTKwebkit224SourceWebCoreaccessibilityatkWebKitAccessibleWrapperAtkh"></a>
<div class="delfile"><h4>Deleted: releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/atk/WebKitAccessibleWrapperAtk.h (245100 => 245101)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/atk/WebKitAccessibleWrapperAtk.h     2019-05-09 08:29:23 UTC (rev 245100)
+++ releases/WebKitGTK/webkit-2.24/Source/WebCore/accessibility/atk/WebKitAccessibleWrapperAtk.h        2019-05-09 08:29:32 UTC (rev 245101)
</span><span class="lines">@@ -1,87 +0,0 @@
</span><del>-/*
- * Copyright (C) 2008 Nuanti Ltd.
- * Copyright (C) 2009 Jan Alonzo
- * Copyright (C) 2009, 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.
- */
-
-#pragma once
-
-#if HAVE(ACCESSIBILITY)
-
-#include <atk/atk.h>
-#include <wtf/text/WTFString.h>
-
-namespace WebCore {
-class AccessibilityObject;
-}
-
-G_BEGIN_DECLS
-
-#define WEBKIT_TYPE_ACCESSIBLE                  (webkitAccessibleGetType ())
-#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;
-    WebCore::AccessibilityObject* m_object;
-
-    WebKitAccessiblePrivate *priv;
-};
-
-struct _WebKitAccessibleClass {
-    AtkObjectClass parentClass;
-};
-
-enum AtkCachedProperty {
-    AtkCachedAccessibleName,
-    AtkCachedAccessibleDescription,
-    AtkCachedActionName,
-    AtkCachedActionKeyBinding,
-    AtkCachedDocumentLocale,
-    AtkCachedDocumentType,
-    AtkCachedDocumentEncoding,
-    AtkCachedDocumentURI,
-    AtkCachedImageDescription
-};
-
-GType webkitAccessibleGetType(void) G_GNUC_CONST;
-
-WebKitAccessible* webkitAccessibleNew(WebCore::AccessibilityObject*);
-
-WebCore::AccessibilityObject* webkitAccessibleGetAccessibilityObject(WebKitAccessible*);
-
-void webkitAccessibleDetach(WebKitAccessible*);
-
-bool webkitAccessibleIsDetached(WebKitAccessible*);
-
-WebCore::AccessibilityObject* objectFocusedAndCaretOffsetUnignored(WebCore::AccessibilityObject*, int& offset);
-
-const char* cacheAndReturnAtkProperty(AtkObject*, AtkCachedProperty, String value);
-
-G_END_DECLS
-
-#endif // HAVE(ACCESSIBILITY)
</del></span></pre></div>
<a id="releasesWebKitGTKwebkit224SourceWebCoreeditingatkFrameSelectionAtkcpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.24/Source/WebCore/editing/atk/FrameSelectionAtk.cpp (245100 => 245101)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.24/Source/WebCore/editing/atk/FrameSelectionAtk.cpp  2019-05-09 08:29:23 UTC (rev 245100)
+++ releases/WebKitGTK/webkit-2.24/Source/WebCore/editing/atk/FrameSelectionAtk.cpp     2019-05-09 08:29:32 UTC (rev 245101)
</span><span class="lines">@@ -26,7 +26,8 @@
</span><span class="cx"> #include "Document.h"
</span><span class="cx"> #include "Frame.h"
</span><span class="cx"> #include "RenderListItem.h"
</span><del>-#include "WebKitAccessibleWrapperAtk.h"
</del><ins>+#include "WebKitAccessible.h"
+#include "WebKitAccessibleUtil.h"
</ins><span class="cx"> #include <glib.h>
</span><span class="cx"> #include <wtf/NeverDestroyed.h>
</span><span class="cx"> #include <wtf/RefPtr.h>
</span></span></pre>
</div>
</div>

</body>
</html>