Changeset 244538 in webkit


Ignore:
Timestamp:
Apr 23, 2019 3:47:45 AM (5 years ago)
Author:
commit-queue@webkit.org
Message:

[ATK] Implement AtkComponentIface scroll_to methods
https://bugs.webkit.org/show_bug.cgi?id=196856

Patch by Carlos Garcia Campos <cgarcia@igalia.com> on 2019-04-23
Reviewed by Michael Catanzaro.

Source/WebCore:

Implement scroll_to and scroll_to_point when ATK >= 2.30.

Fixes: accessibility/scroll-to-global-point-iframe-nested.html

accessibility/scroll-to-global-point-iframe.html
accessibility/scroll-to-global-point-main-window.html
accessibility/scroll-to-global-point-nested.html
accessibility/scroll-to-make-visible-div-overflow.html
accessibility/scroll-to-make-visible-iframe.html
accessibility/scroll-to-make-visible-nested-2.html
accessibility/scroll-to-make-visible-nested.html

  • accessibility/AccessibilityObject.cpp:

(WebCore::AccessibilityObject::scrollToMakeVisible const): Add new method receiving the
ScrollRectToVisibleOptions since ATK interface has a parameter to decide how to scroll.

  • accessibility/AccessibilityObject.h:
  • accessibility/atk/WebKitAccessibleInterfaceComponent.cpp:

(atkToContents):
(webkitAccessibleComponentRefAccessibleAtPoint):
(webkitAccessibleComponentGetExtents):
(webkitAccessibleComponentGrabFocus):
(webkitAccessibleComponentScrollTo):
(webkitAccessibleComponentScrollToPoint):
(webkitAccessibleComponentInterfaceInit):
(core): Deleted.

Tools:

  • WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp:

(WTR::AccessibilityUIElement::scrollToMakeVisible): Call atk_component_scroll_to().
(WTR::AccessibilityUIElement::scrollToGlobalPoint): Call atk_component_scroll_to_point().

  • gtk/jhbuild.modules: Bump atk, at-spi2-core and at-spi2-atk to their latest stable version.

LayoutTests:

Remove expectations for tests that are passing now.

  • platform/gtk/TestExpectations:
Location:
trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r244537 r244538  
     12019-04-23  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        [ATK] Implement AtkComponentIface scroll_to methods
     4        https://bugs.webkit.org/show_bug.cgi?id=196856
     5
     6        Reviewed by Michael Catanzaro.
     7
     8        Remove expectations for tests that are passing now.
     9
     10        * platform/gtk/TestExpectations:
     11
    1122019-04-22  Zalan Bujtas  <zalan@apple.com>
    213
  • trunk/LayoutTests/platform/gtk/TestExpectations

    r244498 r244538  
    818818webkit.org/b/169988 css3/filters/backdrop [ Skip ]
    819819
    820 webkit.org/b/141072 accessibility/frame-disconnect-textmarker-cache-crash.html [ Failure ]
    821 
    822820webkit.org/b/141423 fast/css/font-shorthand-from-longhands.html [ Failure ]
    823821webkit.org/b/141423 fast/css/font-shorthand-line-height.html [ Failure ]
     
    908906# Text marker tests are not supported
    909907webkit.org/b/153292 accessibility/text-marker [ Skip ]
     908webkit.org/b/141072 accessibility/frame-disconnect-textmarker-cache-crash.html [ Skip ]
    910909
    911910# WebKitGTK+ doesn't have killring support.
     
    31113110webkit.org/b/148932 imported/w3c/web-platform-tests/css/css-color/t425-hsla-clip-outside-device-gamut-b.xht [ ImageOnlyFailure ]
    31123111
    3113 webkit.org/b/148935 accessibility/scroll-to-global-point-iframe-nested.html [ Failure ]
    3114 webkit.org/b/148935 accessibility/scroll-to-global-point-iframe.html [ Failure ]
    3115 webkit.org/b/148935 accessibility/scroll-to-global-point-main-window.html [ Failure ]
    3116 webkit.org/b/148935 accessibility/scroll-to-global-point-nested.html [ Failure ]
    3117 webkit.org/b/148935 accessibility/scroll-to-make-visible-div-overflow.html [ Failure ]
    3118 webkit.org/b/148935 accessibility/scroll-to-make-visible-iframe.html [ Failure ]
    3119 webkit.org/b/148935 accessibility/scroll-to-make-visible-nested-2.html [ Failure ]
    3120 webkit.org/b/148935 accessibility/scroll-to-make-visible-nested.html [ Failure ]
    31213112webkit.org/b/148935 accessibility/scroll-to-make-visible-with-subfocus.html [ Failure ]
    31223113
  • trunk/Source/WebCore/ChangeLog

    r244517 r244538  
     12019-04-23  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        [ATK] Implement AtkComponentIface scroll_to methods
     4        https://bugs.webkit.org/show_bug.cgi?id=196856
     5
     6        Reviewed by Michael Catanzaro.
     7
     8        Implement scroll_to and scroll_to_point when ATK >= 2.30.
     9
     10        Fixes: accessibility/scroll-to-global-point-iframe-nested.html
     11               accessibility/scroll-to-global-point-iframe.html
     12               accessibility/scroll-to-global-point-main-window.html
     13               accessibility/scroll-to-global-point-nested.html
     14               accessibility/scroll-to-make-visible-div-overflow.html
     15               accessibility/scroll-to-make-visible-iframe.html
     16               accessibility/scroll-to-make-visible-nested-2.html
     17               accessibility/scroll-to-make-visible-nested.html
     18
     19        * accessibility/AccessibilityObject.cpp:
     20        (WebCore::AccessibilityObject::scrollToMakeVisible const): Add new method receiving the
     21        ScrollRectToVisibleOptions since ATK interface has a parameter to decide how to scroll.
     22        * accessibility/AccessibilityObject.h:
     23        * accessibility/atk/WebKitAccessibleInterfaceComponent.cpp:
     24        (atkToContents):
     25        (webkitAccessibleComponentRefAccessibleAtPoint):
     26        (webkitAccessibleComponentGetExtents):
     27        (webkitAccessibleComponentGrabFocus):
     28        (webkitAccessibleComponentScrollTo):
     29        (webkitAccessibleComponentScrollToPoint):
     30        (webkitAccessibleComponentInterfaceInit):
     31        (core): Deleted.
     32
    1332019-04-22  Youenn Fablet  <youenn@apple.com>
    234
  • trunk/Source/WebCore/accessibility/AccessibilityObject.cpp

    r244392 r244538  
    30653065void AccessibilityObject::scrollToMakeVisible() const
    30663066{
     3067    scrollToMakeVisible({ SelectionRevealMode::Reveal, ScrollAlignment::alignCenterIfNeeded, ScrollAlignment::alignCenterIfNeeded, ShouldAllowCrossOriginScrolling::Yes });
     3068}
     3069
     3070void AccessibilityObject::scrollToMakeVisible(const ScrollRectToVisibleOptions& options) const
     3071{
    30673072    if (dispatchAccessibilityEventWithType(AccessibilityEventType::ScrollIntoView))
    30683073        return;
    3069    
     3074
    30703075    if (isScrollView() && parentObject())
    30713076        parentObject()->scrollToMakeVisible();
    30723077
    30733078    if (auto* renderer = this->renderer())
    3074         renderer->scrollRectToVisible(boundingBoxRect(), false, { SelectionRevealMode::Reveal, ScrollAlignment::alignCenterIfNeeded, ScrollAlignment::alignCenterIfNeeded, ShouldAllowCrossOriginScrolling::Yes });
     3079        renderer->scrollRectToVisible(boundingBoxRect(), false, options);
    30753080}
    30763081
  • trunk/Source/WebCore/accessibility/AccessibilityObject.h

    r244394 r244538  
    8282class ScrollView;
    8383class Widget;
     84struct ScrollRectToVisibleOptions;
    8485
    8586enum class AccessibilityTextSource {
     
    883884    IntSize scrollContentsSize() const;   
    884885    IntRect scrollVisibleContentRect() const;
     886    void scrollToMakeVisible(const ScrollRectToVisibleOptions&) const;
    885887   
    886888    bool lastKnownIsIgnoredValue();
  • trunk/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceComponent.cpp

    r243970 r244538  
    3737#include "FrameView.h"
    3838#include "IntRect.h"
     39#include "RenderLayer.h"
    3940#include "WebKitAccessible.h"
    4041#include "WebKitAccessibleUtil.h"
     
    4243using namespace WebCore;
    4344
    44 static AccessibilityObject* core(AtkComponent* component)
     45static IntPoint atkToContents(const AccessibilityObject& coreObject, AtkCoordType coordType, gint x, gint y)
    4546{
    46     if (!WEBKIT_IS_ACCESSIBLE(component))
    47         return 0;
     47    auto* frameView = coreObject.documentFrameView();
     48    if (!frameView)
     49        return { x, y };
    4850
    49     return &webkitAccessibleGetAccessibilityObject(WEBKIT_ACCESSIBLE(component));
    50 }
    51 
    52 static IntPoint atkToContents(AccessibilityObject* coreObject, AtkCoordType coordType, gint x, gint y)
    53 {
    54     IntPoint pos(x, y);
    55 
    56     FrameView* frameView = coreObject->documentFrameView();
    57     if (frameView) {
    58         switch (coordType) {
    59         case ATK_XY_SCREEN:
    60             return frameView->screenToContents(pos);
    61         case ATK_XY_WINDOW:
    62             return frameView->windowToContents(pos);
     51    switch (coordType) {
     52    case ATK_XY_SCREEN:
     53        return frameView->screenToContents({ x, y });
     54    case ATK_XY_WINDOW:
     55        return frameView->windowToContents({ x, y });
    6356#if ATK_CHECK_VERSION(2, 30, 0)
    64         case ATK_XY_PARENT:
    65             RELEASE_ASSERT_NOT_REACHED();
     57    case ATK_XY_PARENT:
     58        RELEASE_ASSERT_NOT_REACHED();
    6659#endif
    67         }
    6860    }
    6961
    70     return pos;
     62    return { x, y };
    7163}
    7264
    7365static AtkObject* webkitAccessibleComponentRefAccessibleAtPoint(AtkComponent* component, gint x, gint y, AtkCoordType coordType)
    7466{
    75     g_return_val_if_fail(ATK_IS_COMPONENT(component), 0);
    76     returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(component), 0);
     67    auto* accessible = WEBKIT_ACCESSIBLE(component);
     68    returnValIfWebKitAccessibleIsInvalid(accessible, nullptr);
    7769
    78     IntPoint pos = atkToContents(core(component), coordType, x, y);
     70    auto& coreObject = webkitAccessibleGetAccessibilityObject(accessible);
     71    auto* target = downcast<AccessibilityObject>(coreObject.accessibilityHitTest(atkToContents(coreObject, coordType, x, y)));
     72    if (!target)
     73        return nullptr;
    7974
    80     AccessibilityObject* target = downcast<AccessibilityObject>(core(component)->accessibilityHitTest(pos));
    81     if (!target)
    82         return 0;
    83     g_object_ref(target->wrapper());
    84     return ATK_OBJECT(target->wrapper());
     75    if (auto* wrapper = target->wrapper())
     76        return ATK_OBJECT(g_object_ref(wrapper));
     77
     78    return nullptr;
    8579}
    8680
    8781static void webkitAccessibleComponentGetExtents(AtkComponent* component, gint* x, gint* y, gint* width, gint* height, AtkCoordType coordType)
    8882{
    89     g_return_if_fail(ATK_IS_COMPONENT(component));
    90     returnIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(component));
     83    auto* accessible = WEBKIT_ACCESSIBLE(component);
     84    returnIfWebKitAccessibleIsInvalid(accessible);
    9185
    92     IntRect rect = snappedIntRect(core(component)->elementRect());
    93     contentsRelativeToAtkCoordinateType(core(component), coordType, rect, x, y, width, height);
     86    auto& coreObject = webkitAccessibleGetAccessibilityObject(accessible);
     87    contentsRelativeToAtkCoordinateType(&coreObject, coordType, snappedIntRect(coreObject.elementRect()), x, y, width, height);
    9488}
    9589
    9690static gboolean webkitAccessibleComponentGrabFocus(AtkComponent* component)
    9791{
    98     g_return_val_if_fail(ATK_IS_COMPONENT(component), FALSE);
    99     returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(component), FALSE);
     92    auto* accessible = WEBKIT_ACCESSIBLE(component);
     93    returnValIfWebKitAccessibleIsInvalid(accessible, FALSE);
    10094
    101     core(component)->setFocused(true);
    102     return core(component)->isFocused();
     95    auto& coreObject = webkitAccessibleGetAccessibilityObject(accessible);
     96    coreObject.setFocused(true);
     97    return coreObject.isFocused();
    10398}
     99
     100#if ATK_CHECK_VERSION(2, 30, 0)
     101static gboolean webkitAccessibleComponentScrollTo(AtkComponent* component, AtkScrollType scrollType)
     102{
     103    auto* accessible = WEBKIT_ACCESSIBLE(component);
     104    returnValIfWebKitAccessibleIsInvalid(accessible, FALSE);
     105
     106    ScrollAlignment alignX;
     107    ScrollAlignment alignY;
     108
     109    switch (scrollType) {
     110    case ATK_SCROLL_TOP_LEFT:
     111        alignX = ScrollAlignment::alignLeftAlways;
     112        alignY = ScrollAlignment::alignTopAlways;
     113        break;
     114    case ATK_SCROLL_BOTTOM_RIGHT:
     115        alignX = ScrollAlignment::alignRightAlways;
     116        alignY = ScrollAlignment::alignBottomAlways;
     117        break;
     118    case ATK_SCROLL_TOP_EDGE:
     119    case ATK_SCROLL_BOTTOM_EDGE:
     120        // Align to a particular edge is not supported, it's always the closest edge.
     121        alignX = ScrollAlignment::alignCenterIfNeeded;
     122        alignY = ScrollAlignment::alignToEdgeIfNeeded;
     123        break;
     124    case ATK_SCROLL_LEFT_EDGE:
     125    case ATK_SCROLL_RIGHT_EDGE:
     126        // Align to a particular edge is not supported, it's always the closest edge.
     127        alignX = ScrollAlignment::alignToEdgeIfNeeded;
     128        alignY = ScrollAlignment::alignCenterIfNeeded;
     129        break;
     130    case ATK_SCROLL_ANYWHERE:
     131        alignX = ScrollAlignment::alignCenterIfNeeded;
     132        alignY = ScrollAlignment::alignCenterIfNeeded;
     133        break;
     134    }
     135
     136    auto& coreObject = webkitAccessibleGetAccessibilityObject(accessible);
     137    coreObject.scrollToMakeVisible({ SelectionRevealMode::Reveal, alignX, alignY, ShouldAllowCrossOriginScrolling::Yes });
     138
     139    return TRUE;
     140}
     141
     142static gboolean webkitAccessibleComponentScrollToPoint(AtkComponent* component, AtkCoordType coordType, gint x, gint y)
     143{
     144    auto* accessible = WEBKIT_ACCESSIBLE(component);
     145    returnValIfWebKitAccessibleIsInvalid(accessible, FALSE);
     146
     147    auto& coreObject = webkitAccessibleGetAccessibilityObject(accessible);
     148
     149    IntPoint point(x, y);
     150    if (coordType == ATK_XY_SCREEN) {
     151        if (auto* frameView = coreObject.documentFrameView())
     152            point = frameView->contentsToWindow(frameView->screenToContents(point));
     153    }
     154
     155    coreObject.scrollToGlobalPoint(point);
     156
     157    return TRUE;
     158}
     159#endif
    104160
    105161void webkitAccessibleComponentInterfaceInit(AtkComponentIface* iface)
     
    108164    iface->get_extents = webkitAccessibleComponentGetExtents;
    109165    iface->grab_focus = webkitAccessibleComponentGrabFocus;
     166#if ATK_CHECK_VERSION(2, 30, 0)
     167    iface->scroll_to = webkitAccessibleComponentScrollTo;
     168    iface->scroll_to_point = webkitAccessibleComponentScrollToPoint;
     169#endif
    110170}
    111171
    112 #endif
     172#endif // HAVE(ACCESSIBILITY)
  • trunk/Tools/ChangeLog

    r244533 r244538  
     12019-04-23  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        [ATK] Implement AtkComponentIface scroll_to methods
     4        https://bugs.webkit.org/show_bug.cgi?id=196856
     5
     6        Reviewed by Michael Catanzaro.
     7
     8        * WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp:
     9        (WTR::AccessibilityUIElement::scrollToMakeVisible): Call atk_component_scroll_to().
     10        (WTR::AccessibilityUIElement::scrollToGlobalPoint): Call atk_component_scroll_to_point().
     11        * gtk/jhbuild.modules: Bump atk, at-spi2-core and at-spi2-atk to their latest stable version.
     12
    1132019-04-22  Aakash Jain  <aakash_jain@apple.com>
    214
  • trunk/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp

    r244498 r244538  
    23332333void AccessibilityUIElement::scrollToMakeVisible()
    23342334{
    2335     // FIXME: implement
    2336 }
    2337    
     2335#if ATK_CHECK_VERSION(2, 30, 0)
     2336    if (!ATK_IS_COMPONENT(m_element.get()))
     2337        return;
     2338
     2339    atk_component_scroll_to(ATK_COMPONENT(m_element.get()), ATK_SCROLL_ANYWHERE);
     2340#endif
     2341}
     2342
    23382343void AccessibilityUIElement::scrollToGlobalPoint(int x, int y)
    23392344{
    2340     // FIXME: implement
    2341 }
    2342    
     2345#if ATK_CHECK_VERSION(2, 30, 0)
     2346    if (!ATK_IS_COMPONENT(m_element.get()))
     2347        return;
     2348
     2349    atk_component_scroll_to_point(ATK_COMPONENT(m_element.get()), ATK_XY_WINDOW, x, y);
     2350#endif
     2351}
     2352
    23432353void AccessibilityUIElement::scrollToMakeVisibleWithSubFocus(int x, int y, int width, int height)
    23442354{
  • trunk/Tools/gtk/jhbuild.modules

    r241016 r244538  
    282282  </autotools>
    283283
    284   <autotools id="atk"
    285              autogen-sh="configure"
    286              autogenargs="--disable-introspection">
    287     <branch module="pub/GNOME/sources/atk/2.25/atk-2.25.2.tar.xz" version="2.25.2"
    288             repo="ftp.gnome.org"
    289             hash="sha256:75ac1f63e845f895dec8d72d4645ef5f362e32c921cc78987f2f19c2ce212a24"/>
    290   </autotools>
    291 
    292   <autotools id="at-spi2-core"
    293              autogen-sh="configure"
    294              autogenargs="--disable-introspection">
    295     <branch module="pub/GNOME/sources/at-spi2-core/2.25/at-spi2-core-2.25.4.tar.xz" version="2.25.4"
    296             repo="ftp.gnome.org"
    297             hash="sha256:baeccbf92e84e64bb4a853f076c27b78ab44edf1fa5414a9c6e59a9b180bc9d8">
    298     </branch>
    299     <dependencies>
    300       <dep package="glib"/>
    301     </dependencies>
    302   </autotools>
    303 
    304   <autotools id="at-spi2-atk"
    305              autogen-sh="configure">
    306     <branch module="pub/GNOME/sources/at-spi2-atk/2.25/at-spi2-atk-2.25.3.tar.xz" version="2.25.3"
    307             repo="ftp.gnome.org"
    308             hash="sha256:b7aab1a4ee7182083fcfafb595b7b3fe4df34aa2230c775050fe6015b01f84e1">
     284  <meson id="atk" mesonargs="-Dintrospection=false">
     285    <branch module="pub/GNOME/sources/atk/2.32/atk-2.32.0.tar.xz" version="2.32.0"
     286            repo="ftp.gnome.org"
     287            hash="sha256:cb41feda7fe4ef0daa024471438ea0219592baf7c291347e5a858bb64e4091cc"/>
     288  </meson>
     289
     290  <meson id="at-spi2-core" mesonargs="-Dintrospection=no">
     291    <branch module="pub/GNOME/sources/at-spi2-core/2.32/at-spi2-core-2.32.1.tar.xz" version="2.32.1"
     292            repo="ftp.gnome.org"
     293            hash="sha256:3c2aa937ebfaca2c86569bce9b16a34fbe20d69ef0c58846313b1c42f53b0d53">
     294    </branch>
     295    <dependencies>
     296      <dep package="glib"/>
     297    </dependencies>
     298  </meson>
     299
     300  <meson id="at-spi2-atk">
     301    <branch module="pub/GNOME/sources/at-spi2-atk/2.32/at-spi2-atk-2.32.0.tar.xz" version="2.32.0"
     302            repo="ftp.gnome.org"
     303            hash="sha256:0b51e6d339fa2bcca3a3e3159ccea574c67b107f1ac8b00047fa60e34ce7a45c">
    309304    </branch>
    310305    <dependencies>
     
    313308      <dep package="at-spi2-core"/>
    314309    </dependencies>
    315   </autotools>
     310  </meson>
    316311
    317312  <autotools id="libxml2" supports-non-srcdir-builds="no"
Note: See TracChangeset for help on using the changeset viewer.